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