Skip to content

Instantly share code, notes, and snippets.

@stefanpenner
Created June 11, 2015 17:51
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 stefanpenner/77667b914e6c698293f1 to your computer and use it in GitHub Desktop.
Save stefanpenner/77667b914e6c698293f1 to your computer and use it in GitHub Desktop.
node --allow_natives_syntax --block_concurrent_compilation --trace_opt --trace_deopt args.js (node 2.x)
function printStatus(fn) {
switch (%GetOptimizationStatus(fn)) {
case 1: console.log('Function is optimized'); break;
case 2: console.log('Function is not optimized'); break;
case 3: console.log('Function is always optimized'); break;
case 4: console.log('Function is never optimized'); break;
case 6: console.log('Function is maybe deoptimized'); break;
}
}
function Apple (){
}
Apple.prototype.apple = function() {
arguments[0] = 'hi';
this.orange.call(this, arguments[0], arguments[1], arguments[2], arguments[3]);
}
Apple.prototype.orange = function() {
}
var a = new Apple();
a.apple(1, 2, 3, 4);
%OptimizeFunctionOnNextCall(a.apple);
a.apple(1, 2, 3, 4);
printStatus(a.apple);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment