js/src/jit-test/lib/jitopts.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

michael@0 1 // These predicates are for tests that require a particular set of JIT options.
michael@0 2
michael@0 3 // Check if toggles match. Useful for tests that shouldn't be run if a
michael@0 4 // different set of JIT toggles are set, since TBPL runs each jit-test
michael@0 5 // multiple times with a variety of flags.
michael@0 6 function jitTogglesMatch(opts) {
michael@0 7 var currentOpts = getJitCompilerOptions();
michael@0 8 for (var k in opts) {
michael@0 9 if (k.indexOf(".enable") > 0 && opts[k] != currentOpts[k])
michael@0 10 return false;
michael@0 11 }
michael@0 12 return true;
michael@0 13 }
michael@0 14
michael@0 15 // Run fn under a particular set of JIT options.
michael@0 16 function withJitOptions(opts, fn) {
michael@0 17 var oldOpts = getJitCompilerOptions();
michael@0 18 for (var k in opts)
michael@0 19 setJitCompilerOption(k, opts[k]);
michael@0 20 try {
michael@0 21 fn();
michael@0 22 } finally {
michael@0 23 for (var k in oldOpts)
michael@0 24 setJitCompilerOption(k, oldOpts[k]);
michael@0 25 }
michael@0 26 }
michael@0 27
michael@0 28 // N.B. Ion opts *must come before* baseline opts because there's some kind of
michael@0 29 // "undo eager compilation" logic. If we don't set the baseline usecount
michael@0 30 // *after* the Ion usecount we end up setting the baseline usecount to be the
michael@0 31 // default if we hit the "undo eager compilation" logic.
michael@0 32 var Opts_BaselineEager =
michael@0 33 {
michael@0 34 'ion.enable': 1,
michael@0 35 'baseline.enable': 1,
michael@0 36 'baseline.usecount.trigger': 0,
michael@0 37 'parallel-compilation.enable': 1
michael@0 38 };
michael@0 39
michael@0 40 // Checking for parallel compilation being off is often helpful if the test
michael@0 41 // requires a function be Ion compiled. Each individual test will usually
michael@0 42 // finish before the Ion compilation thread has a chance to attach the
michael@0 43 // compiled code.
michael@0 44 var Opts_IonEagerNoParallelCompilation =
michael@0 45 {
michael@0 46 'ion.enable': 1,
michael@0 47 'ion.usecount.trigger': 0,
michael@0 48 'baseline.enable': 1,
michael@0 49 'baseline.usecount.trigger': 0,
michael@0 50 'parallel-compilation.enable': 0,
michael@0 51 };
michael@0 52
michael@0 53 var Opts_Ion2NoParallelCompilation =
michael@0 54 {
michael@0 55 'ion.enable': 1,
michael@0 56 'ion.usecount.trigger': 2,
michael@0 57 'baseline.enable': 1,
michael@0 58 'baseline.usecount.trigger': 1,
michael@0 59 'parallel-compilation.enable': 0
michael@0 60 };
michael@0 61
michael@0 62 var Opts_NoJits =
michael@0 63 {
michael@0 64 'ion.enable': 0,
michael@0 65 'ion.usecount.trigger': 0,
michael@0 66 'baseline.usecount.trigger': 0,
michael@0 67 'baseline.enable': 0,
michael@0 68 'parallel-compilation.enable': 0
michael@0 69 };

mercurial