michael@0: // These predicates are for tests that require a particular set of JIT options. michael@0: michael@0: // Check if toggles match. Useful for tests that shouldn't be run if a michael@0: // different set of JIT toggles are set, since TBPL runs each jit-test michael@0: // multiple times with a variety of flags. michael@0: function jitTogglesMatch(opts) { michael@0: var currentOpts = getJitCompilerOptions(); michael@0: for (var k in opts) { michael@0: if (k.indexOf(".enable") > 0 && opts[k] != currentOpts[k]) michael@0: return false; michael@0: } michael@0: return true; michael@0: } michael@0: michael@0: // Run fn under a particular set of JIT options. michael@0: function withJitOptions(opts, fn) { michael@0: var oldOpts = getJitCompilerOptions(); michael@0: for (var k in opts) michael@0: setJitCompilerOption(k, opts[k]); michael@0: try { michael@0: fn(); michael@0: } finally { michael@0: for (var k in oldOpts) michael@0: setJitCompilerOption(k, oldOpts[k]); michael@0: } michael@0: } michael@0: michael@0: // N.B. Ion opts *must come before* baseline opts because there's some kind of michael@0: // "undo eager compilation" logic. If we don't set the baseline usecount michael@0: // *after* the Ion usecount we end up setting the baseline usecount to be the michael@0: // default if we hit the "undo eager compilation" logic. michael@0: var Opts_BaselineEager = michael@0: { michael@0: 'ion.enable': 1, michael@0: 'baseline.enable': 1, michael@0: 'baseline.usecount.trigger': 0, michael@0: 'parallel-compilation.enable': 1 michael@0: }; michael@0: michael@0: // Checking for parallel compilation being off is often helpful if the test michael@0: // requires a function be Ion compiled. Each individual test will usually michael@0: // finish before the Ion compilation thread has a chance to attach the michael@0: // compiled code. michael@0: var Opts_IonEagerNoParallelCompilation = michael@0: { michael@0: 'ion.enable': 1, michael@0: 'ion.usecount.trigger': 0, michael@0: 'baseline.enable': 1, michael@0: 'baseline.usecount.trigger': 0, michael@0: 'parallel-compilation.enable': 0, michael@0: }; michael@0: michael@0: var Opts_Ion2NoParallelCompilation = michael@0: { michael@0: 'ion.enable': 1, michael@0: 'ion.usecount.trigger': 2, michael@0: 'baseline.enable': 1, michael@0: 'baseline.usecount.trigger': 1, michael@0: 'parallel-compilation.enable': 0 michael@0: }; michael@0: michael@0: var Opts_NoJits = michael@0: { michael@0: 'ion.enable': 0, michael@0: 'ion.usecount.trigger': 0, michael@0: 'baseline.usecount.trigger': 0, michael@0: 'baseline.enable': 0, michael@0: 'parallel-compilation.enable': 0 michael@0: };