Bug 1518210 - Wasm: Don't run --wasm-disable-huge-memory if the platform doesn't support huge memory. r=lth
☠☠ backed out by ea9924171afd ☠ ☠
authorRyan Hunt <rhunt@eqrion.net>
Fri, 30 Aug 2019 02:34:10 +0000
changeset 554554 6e2e9274465d755271a5c1ffc32e1a42a608d879
parent 554553 39fc18ada840d9de69c45ca8484361a58ce0449b
child 554555 80bb50e715a30879981baac975767e26f42a7a87
push id2165
push userffxbld-merge
push dateMon, 14 Oct 2019 16:30:58 +0000
treeherdermozilla-release@0eae18af659f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1518210
milestone70.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1518210 - Wasm: Don't run --wasm-disable-huge-memory if the platform doesn't support huge memory. r=lth This commit extends the jit-test runner to support 'skip-variant-if: $FLAG, $COND', and uses this to not run '--wasm-disable-huge-memory' tests when the platform doesn't support huge memory. Differential Revision: https://phabricator.services.mozilla.com/D43670
js/src/builtin/TestingFunctions.cpp
js/src/jit-test/tests/wasm/bench/directives.txt
js/src/jit-test/tests/wasm/directives.txt
js/src/jit-test/tests/wasm/gc/directives.txt
js/src/jit-test/tests/wasm/regress/directives.txt
js/src/jit-test/tests/wasm/timeout/directives.txt
js/src/tests/lib/jittests.py
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -692,16 +692,26 @@ static bool WasmStreamingIsSupported(JSC
 }
 
 static bool WasmCachingIsSupported(JSContext* cx, unsigned argc, Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
   args.rval().setBoolean(wasm::HasCachingSupport(cx));
   return true;
 }
 
+static bool WasmHugeMemoryIsSupported(JSContext* cx, unsigned argc, Value* vp) {
+  CallArgs args = CallArgsFromVp(argc, vp);
+#ifdef WASM_SUPPORTS_HUGE_MEMORY
+  args.rval().setBoolean(true);
+#else
+  args.rval().setBoolean(false);
+#endif
+  return true;
+}
+
 static bool WasmUsesCranelift(JSContext* cx, unsigned argc, Value* vp) {
   CallArgs args = CallArgsFromVp(argc, vp);
 #ifdef ENABLE_WASM_CRANELIFT
   bool usesCranelift = cx->options().wasmCranelift();
 #else
   bool usesCranelift = false;
 #endif
   args.rval().setBoolean(usesCranelift);
@@ -6360,16 +6370,21 @@ gc::ZealModeHelpText),
     JS_FN_HELP("wasmStreamingIsSupported", WasmStreamingIsSupported, 0, 0,
 "wasmStreamingIsSupported()",
 "  Returns a boolean indicating whether WebAssembly caching is supported by the runtime."),
 
     JS_FN_HELP("wasmCachingIsSupported", WasmCachingIsSupported, 0, 0,
 "wasmCachingIsSupported()",
 "  Returns a boolean indicating whether WebAssembly caching is supported by the runtime."),
 
+    JS_FN_HELP("wasmHugeMemoryIsSupported", WasmHugeMemoryIsSupported, 0, 0,
+"wasmHugeMemoryIsSupported()",
+"  Returns a boolean indicating whether WebAssembly supports using a large"
+"  virtual memory reservation in order to elide bounds checks on this platform."),
+
     JS_FN_HELP("wasmUsesCranelift", WasmUsesCranelift, 0, 0,
 "wasmUsesCranelift()",
 "  Returns a boolean indicating whether Cranelift is currently enabled for backend\n"
 "  compilation. This doesn't necessarily mean a module will be compiled with \n"
 "  Cranelift (e.g. when baseline is also enabled)."),
 
     JS_FN_HELP("wasmThreadsSupported", WasmThreadsSupported, 0, 0,
 "wasmThreadsSupported()",
--- a/js/src/jit-test/tests/wasm/bench/directives.txt
+++ b/js/src/jit-test/tests/wasm/bench/directives.txt
@@ -1,1 +1,1 @@
-|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; include:wasm.js
+|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm.js
--- a/js/src/jit-test/tests/wasm/directives.txt
+++ b/js/src/jit-test/tests/wasm/directives.txt
@@ -1,1 +1,1 @@
-|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; include:wasm.js
+|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm.js
--- a/js/src/jit-test/tests/wasm/gc/directives.txt
+++ b/js/src/jit-test/tests/wasm/gc/directives.txt
@@ -1,1 +1,1 @@
-|jit-test| test-also=--wasm-gc; test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--wasm-gc --wasm-compiler=baseline; test-also=--disable-wasm-huge-memory; include:wasm.js
+|jit-test| test-also=--wasm-gc; test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--wasm-gc --wasm-compiler=baseline; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm.js
--- a/js/src/jit-test/tests/wasm/regress/directives.txt
+++ b/js/src/jit-test/tests/wasm/regress/directives.txt
@@ -1,1 +1,1 @@
-|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; include:wasm.js
+|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported(); include:wasm.js
--- a/js/src/jit-test/tests/wasm/timeout/directives.txt
+++ b/js/src/jit-test/tests/wasm/timeout/directives.txt
@@ -1,2 +1,2 @@
-|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory
+|jit-test| test-also=--wasm-compiler=ion; test-also=--wasm-compiler=baseline; test-also=--test-wasm-await-tier2; test-also=--disable-wasm-huge-memory; skip-variant-if: --disable-wasm-huge-memory, !wasmHugeMemoryIsSupported();
 
--- a/js/src/tests/lib/jittests.py
+++ b/js/src/tests/lib/jittests.py
@@ -81,16 +81,23 @@ def js_quote(quote, s):
             result += c
     result += quote
     return result
 
 
 os.path.relpath = _relpath
 
 
+def extend_condition(condition, value):
+    if condition:
+        condition += " || "
+    condition += "({})".format(value)
+    return condition
+
+
 class JitTest:
 
     VALGRIND_CMD = []
     paths = (d for d in os.environ['PATH'].split(os.pathsep))
     valgrinds = (os.path.join(d, 'valgrind') for d in paths)
     if any(os.path.exists(p) for p in valgrinds):
         VALGRIND_CMD = [
             'valgrind', '-q', '--smc-check=all-non-file',
@@ -142,16 +149,17 @@ class JitTest:
         self.is_module = False
         self.is_binast = False
         # Reflect.stringify implementation to test
         self.test_reflect_stringify = None
 
         # Skip-if condition. We don't have a xulrunner, but we can ask the shell
         # directly.
         self.skip_if_cond = ''
+        self.skip_variant_if_cond = {}
 
         # Expected by the test runner. Always true for jit-tests.
         self.enable = True
 
     def copy(self):
         t = JitTest(self.path)
         t.jitflags = self.jitflags[:]
         t.slow = self.slow
@@ -166,21 +174,25 @@ class JitTest:
         t.expect_error = self.expect_error
         t.expect_status = self.expect_status
         t.expect_crash = self.expect_crash
         t.test_reflect_stringify = self.test_reflect_stringify
         t.enable = True
         t.is_module = self.is_module
         t.is_binast = self.is_binast
         t.skip_if_cond = self.skip_if_cond
+        t.skip_variant_if_cond = self.skip_variant_if_cond
         return t
 
     def copy_and_extend_jitflags(self, variant):
         t = self.copy()
         t.jitflags.extend(variant)
+        for flags in variant:
+            if flags in self.skip_variant_if_cond:
+                t.skip_if_cond = extend_condition(t.skip_if_cond, self.skip_variant_if_cond[flags])
         return t
 
     def copy_variants(self, variants):
         # Append variants to be tested in addition to the current set of tests.
         variants = variants + self.test_also
 
         # For each existing variant, duplicates it for each list of options in
         # test_join.  This will multiply the number of variants by 2 for set of
@@ -268,20 +280,25 @@ class JitTest:
                             test.jitflags.append('--thread-count={}'.format(
                                 int(value, 0)))
                         except ValueError:
                             print("warning: couldn't parse thread-count"
                                   " {}".format(value))
                     elif name == 'include':
                         test.other_includes.append(value)
                     elif name == 'skip-if':
-                        # Ensure that skip-ifs are composable
-                        if test.skip_if_cond:
-                            test.skip_if_cond += " || "
-                        test.skip_if_cond += "({})".format(value)
+                        test.skip_if_cond = extend_condition(test.skip_if_cond, value)
+                    elif name == 'skip-variant-if':
+                        try:
+                            [variant, condition] = value.split(',')
+                            test.skip_variant_if_cond[variant] = extend_condition(
+                                test.skip_if_cond,
+                                condition)
+                        except ValueError:
+                            print("warning: couldn't parse skip-variant-if")
                     else:
                         print('{}: warning: unrecognized |jit-test| attribute'
                               ' {}'.format(path, part))
                 else:
                     if name == 'slow':
                         test.slow = True
                     elif name == 'allow-oom':
                         test.allow_oom = True