1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/lib/jitopts.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,69 @@ 1.4 +// These predicates are for tests that require a particular set of JIT options. 1.5 + 1.6 +// Check if toggles match. Useful for tests that shouldn't be run if a 1.7 +// different set of JIT toggles are set, since TBPL runs each jit-test 1.8 +// multiple times with a variety of flags. 1.9 +function jitTogglesMatch(opts) { 1.10 + var currentOpts = getJitCompilerOptions(); 1.11 + for (var k in opts) { 1.12 + if (k.indexOf(".enable") > 0 && opts[k] != currentOpts[k]) 1.13 + return false; 1.14 + } 1.15 + return true; 1.16 +} 1.17 + 1.18 +// Run fn under a particular set of JIT options. 1.19 +function withJitOptions(opts, fn) { 1.20 + var oldOpts = getJitCompilerOptions(); 1.21 + for (var k in opts) 1.22 + setJitCompilerOption(k, opts[k]); 1.23 + try { 1.24 + fn(); 1.25 + } finally { 1.26 + for (var k in oldOpts) 1.27 + setJitCompilerOption(k, oldOpts[k]); 1.28 + } 1.29 +} 1.30 + 1.31 +// N.B. Ion opts *must come before* baseline opts because there's some kind of 1.32 +// "undo eager compilation" logic. If we don't set the baseline usecount 1.33 +// *after* the Ion usecount we end up setting the baseline usecount to be the 1.34 +// default if we hit the "undo eager compilation" logic. 1.35 +var Opts_BaselineEager = 1.36 + { 1.37 + 'ion.enable': 1, 1.38 + 'baseline.enable': 1, 1.39 + 'baseline.usecount.trigger': 0, 1.40 + 'parallel-compilation.enable': 1 1.41 + }; 1.42 + 1.43 +// Checking for parallel compilation being off is often helpful if the test 1.44 +// requires a function be Ion compiled. Each individual test will usually 1.45 +// finish before the Ion compilation thread has a chance to attach the 1.46 +// compiled code. 1.47 +var Opts_IonEagerNoParallelCompilation = 1.48 + { 1.49 + 'ion.enable': 1, 1.50 + 'ion.usecount.trigger': 0, 1.51 + 'baseline.enable': 1, 1.52 + 'baseline.usecount.trigger': 0, 1.53 + 'parallel-compilation.enable': 0, 1.54 + }; 1.55 + 1.56 +var Opts_Ion2NoParallelCompilation = 1.57 + { 1.58 + 'ion.enable': 1, 1.59 + 'ion.usecount.trigger': 2, 1.60 + 'baseline.enable': 1, 1.61 + 'baseline.usecount.trigger': 1, 1.62 + 'parallel-compilation.enable': 0 1.63 + }; 1.64 + 1.65 +var Opts_NoJits = 1.66 + { 1.67 + 'ion.enable': 0, 1.68 + 'ion.usecount.trigger': 0, 1.69 + 'baseline.usecount.trigger': 0, 1.70 + 'baseline.enable': 0, 1.71 + 'parallel-compilation.enable': 0 1.72 + };