Skip to content

Instantly share code, notes, and snippets.

@chriswhocodes
Created June 9, 2015 21:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriswhocodes/bfe139592adb846967d8 to your computer and use it in GitHub Desktop.
Save chriswhocodes/bfe139592adb846967d8 to your computer and use it in GitHub Desktop.
Example JavaScript that dumps different bytecode with Nashorn 8u60b18 and 9b67
var sum = 0;
for (var i = 0; i < 1000000; i++)
{
sum = addOne(sum);
sum = addTwo(sum);
}
print(sum);
function addOne(number)
{
return add(number, 1);
}
function addTwo(number)
{
return add(number, 2);
}
function add(x, y)
{
return x + y;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment