Debian Codegraph @

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

raw
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 warmup-counter
30 // *after* the Ion warmup-counter we end up setting the baseline warmup-counter
31 // to be the default if we hit the "undo eager compilation" logic.
32 var Opts_BaselineEager =
33 {
34 'ion.enable': 1,
35 'ion.warmup.trigger': 100,
36 'baseline.enable': 1,
37 'baseline.warmup.trigger': 0,
38 'offthread-compilation.enable': 1
39 };
40
41 // Checking for offthread compilation being off is often helpful if the test
42 // requires a function be Ion compiled. Each individual test will usually
43 // finish before the Ion compilation thread has a chance to attach the
44 // compiled code.
45 var Opts_IonEagerNoOffthreadCompilation =
46 {
47 'ion.enable': 1,
48 'ion.warmup.trigger': 0,
49 'baseline.enable': 1,
50 'baseline.warmup.trigger': 0,
51 'offthread-compilation.enable': 0,
52 };
53
54 var Opts_Ion2NoOffthreadCompilation =
55 {
56 'ion.enable': 1,
57 'ion.warmup.trigger': 3,
58 'baseline.enable': 1,
59 'baseline.warmup.trigger': 1,
60 'offthread-compilation.enable': 0
61 };
62
63 var Opts_NoJits =
64 {
65 'ion.enable': 0,
66 'ion.warmup.trigger': 0,
67 'baseline.warmup.trigger': 0,
68 'baseline.enable': 0,
69 'offthread-compilation.enable': 0
70 };