Created
June 11, 2015 17:51
-
-
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)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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