Last active
August 29, 2015 14:14
-
-
Save Ginden/672cb07cc6445ad08615 to your computer and use it in GitHub Desktop.
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 a(opt) { | |
opt = 3+opt; | |
return opt+1; | |
} | |
function b(opt) { | |
'use strict'; | |
opt = 3+opt; | |
return opt+1; | |
} | |
function c(opt) { | |
'use strict'; | |
var _opt = 3+opt; | |
return _opt+1; | |
} | |
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; | |
} | |
} | |
a(5); | |
b(4); | |
c(6); | |
%OptimizeFunctionOnNextCall(a); | |
%OptimizeFunctionOnNextCall(b); | |
%OptimizeFunctionOnNextCall(c); | |
a(4); | |
printStatus(a); | |
b(5); | |
printStatus(b); | |
c(7); | |
printStatus(c); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment