summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/lib/jitopts.js
diff options
context:
space:
mode:
authorMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
committerMatt A. Tobin <mattatobin@localhost.localdomain>2018-02-02 04:16:08 -0500
commit5f8de423f190bbb79a62f804151bc24824fa32d8 (patch)
tree10027f336435511475e392454359edea8e25895d /js/src/jit-test/lib/jitopts.js
parent49ee0794b5d912db1f95dce6eb52d781dc210db5 (diff)
downloadUXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.gz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.lz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.tar.xz
UXP-5f8de423f190bbb79a62f804151bc24824fa32d8.zip
Add m-esr52 at 52.6.0
Diffstat (limited to 'js/src/jit-test/lib/jitopts.js')
-rw-r--r--js/src/jit-test/lib/jitopts.js75
1 files changed, 75 insertions, 0 deletions
diff --git a/js/src/jit-test/lib/jitopts.js b/js/src/jit-test/lib/jitopts.js
new file mode 100644
index 000000000..0d35a9e02
--- /dev/null
+++ b/js/src/jit-test/lib/jitopts.js
@@ -0,0 +1,75 @@
+// These predicates are for tests that require a particular set of JIT options.
+
+// Check if toggles match. Useful for tests that shouldn't be run if a
+// different set of JIT toggles are set, since TBPL runs each jit-test
+// multiple times with a variety of flags.
+function jitTogglesMatch(opts) {
+ var currentOpts = getJitCompilerOptions();
+ for (var k in opts) {
+ if (k.indexOf(".enable") > 0 && opts[k] != currentOpts[k])
+ return false;
+ }
+
+ // ARM64 does not yet have an Ion code generator, so return false if
+ // ion.enable is requested.
+ if (getBuildConfiguration()['arm64-simulator'] && opts['ion.enable'])
+ return false;
+
+ return true;
+}
+
+// Run fn under a particular set of JIT options.
+function withJitOptions(opts, fn) {
+ var oldOpts = getJitCompilerOptions();
+ for (var k in opts)
+ setJitCompilerOption(k, opts[k]);
+ try {
+ fn();
+ } finally {
+ for (var k in oldOpts)
+ setJitCompilerOption(k, oldOpts[k]);
+ }
+}
+
+// N.B. Ion opts *must come before* baseline opts because there's some kind of
+// "undo eager compilation" logic. If we don't set the baseline warmup-counter
+// *after* the Ion warmup-counter we end up setting the baseline warmup-counter
+// to be the default if we hit the "undo eager compilation" logic.
+var Opts_BaselineEager =
+ {
+ 'ion.enable': 1,
+ 'baseline.enable': 1,
+ 'baseline.warmup.trigger': 0,
+ 'offthread-compilation.enable': 1
+ };
+
+// Checking for offthread compilation being off is often helpful if the test
+// requires a function be Ion compiled. Each individual test will usually
+// finish before the Ion compilation thread has a chance to attach the
+// compiled code.
+var Opts_IonEagerNoOffthreadCompilation =
+ {
+ 'ion.enable': 1,
+ 'ion.warmup.trigger': 0,
+ 'baseline.enable': 1,
+ 'baseline.warmup.trigger': 0,
+ 'offthread-compilation.enable': 0,
+ };
+
+var Opts_Ion2NoOffthreadCompilation =
+ {
+ 'ion.enable': 1,
+ 'ion.warmup.trigger': 2,
+ 'baseline.enable': 1,
+ 'baseline.warmup.trigger': 1,
+ 'offthread-compilation.enable': 0
+ };
+
+var Opts_NoJits =
+ {
+ 'ion.enable': 0,
+ 'ion.warmup.trigger': 0,
+ 'baseline.warmup.trigger': 0,
+ 'baseline.enable': 0,
+ 'offthread-compilation.enable': 0
+ };