Created
March 11, 2014 18:37
-
-
Save syg/9492182 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
shu@pikashu ~/moz/inbound/js/src/jit-test | |
% cat lib/jitopts.js | |
function withJitOptions(opts, fn) { | |
var oldOpts = getJitCompilerOptions(); | |
for (var k in opts) | |
setJitCompilerOption(k, opts[k]); | |
fn(); | |
for (var k in oldOpts) | |
setJitCompilerOption(k, oldOpts[k]); | |
} | |
// N.B. Ion opts *must come before* baseline opts because there's some kind of | |
// "undo eager compilation" logic. If we don't set the baseline usecount | |
// *after* the Ion usecount we end up setting the baseline usecount to be the | |
// default if we hit the "undo eager compilation" logic. | |
var Opts_BaselineOnlyEagerNoParallelCompilation = | |
{ | |
'type-inference.enable': 1, | |
'ion.enable': 0, | |
'ion.usecount.trigger': 0, | |
'baseline.enable': 1, | |
'baseline.usecount.trigger': 0, | |
'parallel-compilation.enable': 0 | |
}; | |
var Opts_IonEagerNoParallelCompilation = | |
{ | |
'type-inference.enable': 1, | |
'ion.enable': 1, | |
'ion.usecount.trigger': 0, | |
'baseline.enable': 1, | |
'baseline.usecount.trigger': 0, | |
'parallel-compilation.enable': 0, | |
}; | |
var Opts_Ion2NoParallelCompilation = | |
{ | |
'type-inference.enable': 1, | |
'ion.enable': 1, | |
'ion.usecount.trigger': 2, | |
'baseline.enable': 1, | |
'baseline.usecount.trigger': 1, | |
'parallel-compilation.enable': 0 | |
}; | |
var Opts_NoJits = | |
{ | |
'type-inference.enable': 1, | |
'ion.enable': 0, | |
'ion.usecount.trigger': 0, | |
'baseline.usecount.trigger': 0, | |
'baseline.enable': 0, | |
'parallel-compilation.enable': 0 | |
}; | |
shu@pikashu ~/moz/inbound/js/src/jit-test | |
% cat tests/debug/Frame-repr-02.js | |
// |jit-test| exitstatus: 6; | |
// | |
// Debugger.Frames for optimized frames. | |
load(libdir + "jitopts.js"); | |
function assertOptimizedFrame(f) { | |
assertEq(f.repr == "optimized" || f.repr == "optimized-inlined", true); | |
} | |
function test(p) { | |
return function () { | |
var g = newGlobal(); | |
var dbg = new Debugger; | |
g.eval("function f(d) { g(d); }"); | |
g.eval("function g(d) { h(d); }"); | |
g.eval("function h(d) { while (d); }"); | |
timeout(1, function () { | |
dbg.addDebuggee(g); | |
var frame = dbg.getNewestFrame(); | |
// The oldest frame is probably not Ion-compiled. | |
for (var i = 0; i < 3; i++) { | |
p(frame); | |
frame = frame.older; | |
} | |
}); | |
g.eval("for (i = 0; i < 5; i++) f(false); f(true);"); | |
} | |
} | |
withJitOptions(Opts_Ion2NoParallelCompilation, test(assertOptimizedFrame)); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment