Bug 1313180 - Baldr: turn off wasm tests for --jitflags=interp for SM-msan's benefit (r=bbouvier)
authorLuke Wagner <luke@mozilla.com>
Fri, 04 Nov 2016 17:05:56 -0500
changeset 347923 e9b561d60697a81fa8afe157ff0e52efea3e2636
parent 347922 d0f06f2fdba053344e07fbd5b4e55af117077dd4
child 347924 b01106827c2ba1a0abcb75c1e28c6a65ff8508b4
push id10298
push userraliiev@mozilla.com
push dateMon, 14 Nov 2016 12:33:03 +0000
treeherdermozilla-aurora@7e29173b1641 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbbouvier
bugs1313180
milestone52.0a1
Bug 1313180 - Baldr: turn off wasm tests for --jitflags=interp for SM-msan's benefit (r=bbouvier) MozReview-Commit-ID: FvFAZUfG1Zs
js/src/devtools/automation/variants/msan
js/src/jit-test/jit_test.py
js/src/jit-test/tests/asm.js/testAtomics.js
js/src/jit-test/tests/asm.js/testBug1164391.js
js/src/jit-test/tests/asm.js/testSIMD-load-store.js
js/src/jit-test/tests/asm.js/testSIMD.js
js/src/jit-test/tests/asm.js/testStealing.js
js/src/jit-test/tests/asm.js/testZOOB.js
js/src/shell/js.cpp
js/src/tests/lib/tests.py
js/src/vm/GlobalObject.cpp
js/src/wasm/WasmJS.cpp
--- a/js/src/devtools/automation/variants/msan
+++ b/js/src/devtools/automation/variants/msan
@@ -2,10 +2,10 @@
     "configure-args": "--disable-debug --enable-optimize --enable-debug-symbols='-gline-tables-only' --disable-jemalloc --enable-memory-sanitizer",
     "compiler": "clang",
     "env": {
         "JITTEST_EXTRA_ARGS": "--jitflags=interp --ignore-timeouts={DIR}/cgc-jittest-timeouts.txt",
         "JSTESTS_EXTRA_ARGS": "--jitflags=interp --exclude-file={DIR}/cgc-jstests-slow.txt",
         "MSAN_OPTIONS": "external_symbolizer_path={TOOLTOOL_CHECKOUT}/clang/bin/llvm-symbolizer:log_path={OUTDIR}/sanitize_log"
     },
     "ignore-test-failures": "true",
-    "max-errors": 6
+    "max-errors": 2
 }
--- a/js/src/jit-test/jit_test.py
+++ b/js/src/jit-test/jit_test.py
@@ -200,16 +200,19 @@ def main(argv):
     # wasm-baseline run when requesting --jitflags=interp, but the test
     # contains test-also-noasmjs.)
     test_flags = get_jitflags(options.jitflags)
     options.can_test_also_noasmjs = True
     options.can_test_also_wasm_baseline = True
     if all(['--no-asmjs' in flags for flags in test_flags]):
         options.can_test_also_noasmjs = False
         options.can_test_also_wasm_baseline = False
+    if all(['--no-wasm' in flags for flags in test_flags]):
+        options.can_test_also_noasmjs = False
+        options.can_test_also_wasm_baseline = False
 
     if test_args:
         read_all = False
         for arg in test_args:
             test_list += jittests.find_tests(arg)
 
     if options.read_tests:
         read_all = False
--- a/js/src/jit-test/tests/asm.js/testAtomics.js
+++ b/js/src/jit-test/tests/asm.js/testAtomics.js
@@ -1,9 +1,9 @@
-if (!this.SharedArrayBuffer || !this.Atomics)
+if (!this.SharedArrayBuffer || !this.Atomics || !isAsmJSCompilationAvailable())
     quit();
 
 // The code duplication below is very far from elegant but provides
 // flexibility that comes in handy several places.
 
 load(libdir + "asm.js");
 load(libdir + "asserts.js");
 
--- a/js/src/jit-test/tests/asm.js/testBug1164391.js
+++ b/js/src/jit-test/tests/asm.js/testBug1164391.js
@@ -1,9 +1,9 @@
-if (!this.SharedArrayBuffer)
+if (!this.SharedArrayBuffer || !isAsmJSCompilationAvailable())
     quit(0);
 
 load(libdir + "asm.js");
 load(libdir + "asserts.js");
 setJitCompilerOption('asmjs.atomics.enable', 1);
 
 var m = asmCompile("stdlib", "ffi", "heap", `
     "use asm";
--- a/js/src/jit-test/tests/asm.js/testSIMD-load-store.js
+++ b/js/src/jit-test/tests/asm.js/testSIMD-load-store.js
@@ -4,17 +4,17 @@ load(libdir + "simd.js");
 load(libdir + "asserts.js");
 
 // Avoid pathological --ion-eager compile times due to bails in loops
 setJitCompilerOption('ion.warmup.trigger', 1000000);
 
 // Set to true to see more JS debugging spew
 const DEBUG = false;
 
-if (!isSimdAvailable() || typeof SIMD === 'undefined') {
+if (!isSimdAvailable() || typeof SIMD === 'undefined' || !isAsmJSCompilationAvailable()) {
     DEBUG && print("won't run tests as simd extensions aren't activated yet");
     quit(0);
 }
 
 const RuntimeError = WebAssembly.RuntimeError;
 
 const INT32_MAX = Math.pow(2, 31) - 1;
 const INT32_MIN = INT32_MAX + 1 | 0;
--- a/js/src/jit-test/tests/asm.js/testSIMD.js
+++ b/js/src/jit-test/tests/asm.js/testSIMD.js
@@ -4,17 +4,17 @@ load(libdir + "asserts.js");
 var heap = new ArrayBuffer(0x10000);
 
 // Avoid pathological --ion-eager compile times due to bails in loops
 setJitCompilerOption('ion.warmup.trigger', 1000000);
 
 // Set to true to see more JS debugging spew
 const DEBUG = false;
 
-if (!isSimdAvailable() || typeof SIMD === 'undefined') {
+if (!isSimdAvailable() || typeof SIMD === 'undefined' || !isAsmJSCompilationAvailable()) {
     DEBUG && print("won't run tests as simd extensions aren't activated yet");
     quit(0);
 }
 
 const I32 = 'var i4 = glob.SIMD.Int32x4;'
 const CI32 = 'var ci4 = i4.check;'
 const I32A = 'var i4a = i4.add;'
 const I32S = 'var i4s = i4.sub;'
--- a/js/src/jit-test/tests/asm.js/testStealing.js
+++ b/js/src/jit-test/tests/asm.js/testStealing.js
@@ -1,11 +1,14 @@
 load(libdir + "asm.js");
 load(libdir + "asserts.js");
 
+if (!isAsmJSCompilationAvailable())
+    quit();
+
 var code = USE_ASM + "var i32 = new stdlib.Int32Array(buf); function f() { return i32[0]|0 } return f";
 
 var ab = new ArrayBuffer(BUF_MIN);
 new Int32Array(ab)[0] = 42;
 
 var f = asmLink(asmCompile('stdlib', 'ffi', 'buf', code), this, null, ab);
 assertEq(f(), 42);
 
--- a/js/src/jit-test/tests/asm.js/testZOOB.js
+++ b/js/src/jit-test/tests/asm.js/testZOOB.js
@@ -1,12 +1,15 @@
 // |jit-test|
 load(libdir + "asm.js");
 load(libdir + "asserts.js");
 
+if (!isAsmJSCompilationAvailable())
+    quit();
+
 var ab = new ArrayBuffer(BUF_MIN);
 
 // Compute a set of interesting indices.
 indices = [0]
 for (var i of [4,1024,BUF_MIN,Math.pow(2,30),Math.pow(2,31),Math.pow(2,32),Math.pow(2,33)]) {
     for (var j of [-2,-1,0,1,2]) {
         for (var k of [1,-1])
             indices.push((i+j)*k);
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -310,16 +310,17 @@ struct MOZ_STACK_CLASS EnvironmentPrepar
 
 // Shell state set once at startup.
 static bool enableCodeCoverage = false;
 static bool enableDisassemblyDumps = false;
 static bool offthreadCompilation = false;
 static bool enableBaseline = false;
 static bool enableIon = false;
 static bool enableAsmJS = false;
+static bool enableWasm = false;
 static bool enableNativeRegExp = false;
 static bool enableUnboxedArrays = false;
 static bool enableSharedMemory = SHARED_MEMORY_DEFAULT;
 static bool enableWasmAlwaysBaseline = false;
 #ifdef JS_GC_ZEAL
 static uint32_t gZealBits = 0;
 static uint32_t gZealFrequency = 0;
 #endif
@@ -7204,24 +7205,25 @@ ProcessArgs(JSContext* cx, OptionParser*
 }
 
 static bool
 SetContextOptions(JSContext* cx, const OptionParser& op)
 {
     enableBaseline = !op.getBoolOption("no-baseline");
     enableIon = !op.getBoolOption("no-ion");
     enableAsmJS = !op.getBoolOption("no-asmjs");
+    enableWasm = !op.getBoolOption("no-wasm");
     enableNativeRegExp = !op.getBoolOption("no-native-regexp");
     enableUnboxedArrays = op.getBoolOption("unboxed-arrays");
     enableWasmAlwaysBaseline = op.getBoolOption("wasm-always-baseline");
 
     JS::ContextOptionsRef(cx).setBaseline(enableBaseline)
                              .setIon(enableIon)
                              .setAsmJS(enableAsmJS)
-                             .setWasm(true)
+                             .setWasm(enableWasm)
                              .setWasmAlwaysBaseline(enableWasmAlwaysBaseline)
                              .setNativeRegExp(enableNativeRegExp)
                              .setUnboxedArrays(enableUnboxedArrays);
 
     if (op.getBoolOption("no-unboxed-objects"))
         jit::JitOptions.disableUnboxedObjects = true;
 
     if (const char* str = op.getStringOption("cache-ir-stubs")) {
@@ -7489,17 +7491,17 @@ SetContextOptions(JSContext* cx, const O
 
 static void
 SetWorkerContextOptions(JSContext* cx)
 {
     // Copy option values from the main thread.
     JS::ContextOptionsRef(cx).setBaseline(enableBaseline)
                              .setIon(enableIon)
                              .setAsmJS(enableAsmJS)
-                             .setWasm(true)
+                             .setWasm(enableWasm)
                              .setWasmAlwaysBaseline(enableWasmAlwaysBaseline)
                              .setNativeRegExp(enableNativeRegExp)
                              .setUnboxedArrays(enableUnboxedArrays);
     cx->setOffthreadIonCompilationEnabled(offthreadCompilation);
     cx->profilingScripts = enableCodeCoverage || enableDisassemblyDumps;
 
 #ifdef JS_GC_ZEAL
     if (gZealBits && gZealFrequency) {
@@ -7669,16 +7671,17 @@ main(int argc, char** argv, char** envp)
         || !op.addOptionalMultiStringArg("scriptArgs",
                                          "String arguments to bind as |scriptArgs| in the "
                                          "shell's global")
         || !op.addIntOption('\0', "thread-count", "COUNT", "Use COUNT auxiliary threads "
                             "(default: # of cores - 1)", -1)
         || !op.addBoolOption('\0', "ion", "Enable IonMonkey (default)")
         || !op.addBoolOption('\0', "no-ion", "Disable IonMonkey")
         || !op.addBoolOption('\0', "no-asmjs", "Disable asm.js compilation")
+        || !op.addBoolOption('\0', "no-wasm", "Disable WebAssembly compilation")
         || !op.addBoolOption('\0', "no-native-regexp", "Disable native regexp compilation")
         || !op.addBoolOption('\0', "no-unboxed-objects", "Disable creating unboxed plain objects")
         || !op.addBoolOption('\0', "unboxed-arrays", "Allow creating unboxed arrays")
         || !op.addBoolOption('\0', "wasm-always-baseline", "Enable experimental Wasm baseline compiler when possible")
 #ifdef ENABLE_SHARED_ARRAY_BUFFER
         || !op.addStringOption('\0', "shared-memory", "on/off",
                                "SharedArrayBuffer and Atomics "
 #  if SHARED_MEMORY_DEFAULT
--- a/js/src/tests/lib/tests.py
+++ b/js/src/tests/lib/tests.py
@@ -29,17 +29,17 @@ JITFLAGS = {
     # Run reduced variants on debug builds, since they take longer time.
     'debug': [
         [], # no flags, normal baseline and ion
         ['--ion-eager', '--ion-offthread-compile=off'], # implies --baseline-eager
         ['--baseline-eager'],
     ],
     # Interpreter-only, for tools that cannot handle binary code generation.
     'interp': [
-        ['--no-baseline', '--no-asmjs', '--no-native-regexp']
+        ['--no-baseline', '--no-asmjs', '--no-wasm', '--no-native-regexp']
     ],
     'none': [
         [] # no flags, normal baseline and ion
     ]
 }
 
 def get_jitflags(variant, **kwargs):
     if variant not in JITFLAGS:
--- a/js/src/vm/GlobalObject.cpp
+++ b/js/src/vm/GlobalObject.cpp
@@ -94,17 +94,17 @@ js::GlobalObject::getTypedObjectModule()
     MOZ_ASSERT(v.isObject());
     return v.toObject().as<TypedObjectModuleObject>();
 }
 
 /* static */ bool
 GlobalObject::skipDeselectedConstructor(JSContext* cx, JSProtoKey key)
 {
     if (key == JSProto_WebAssembly)
-        return !cx->options().wasm() || !wasm::HasCompilerSupport(cx);
+        return !wasm::HasCompilerSupport(cx);
 
 #ifdef ENABLE_SHARED_ARRAY_BUFFER
     // Return true if the given constructor has been disabled at run-time.
     switch (key) {
       case JSProto_Atomics:
       case JSProto_SharedArrayBuffer:
         return !cx->compartment()->creationOptions().getSharedMemoryAndAtomicsEnabled();
       default:
--- a/js/src/wasm/WasmJS.cpp
+++ b/js/src/wasm/WasmJS.cpp
@@ -41,16 +41,19 @@ using namespace js::wasm;
 using mozilla::CheckedInt;
 using mozilla::IsNaN;
 using mozilla::IsSame;
 using mozilla::Nothing;
 
 bool
 wasm::HasCompilerSupport(ExclusiveContext* cx)
 {
+    if (!cx->options().wasm())
+        return false;
+
     if (gc::SystemPageSize() > wasm::PageSize)
         return false;
 
     if (!cx->jitSupportsFloatingPoint())
         return false;
 
     if (!cx->jitSupportsUnalignedAccesses())
         return false;
@@ -1613,17 +1616,16 @@ InitErrorClass(JSContext* cx, HandleObje
     RootedValue ctorValue(cx, global->getConstructor(GetExceptionProtoKey(exn)));
     return DefineProperty(cx, wasm, id, ctorValue, nullptr, nullptr, 0);
 }
 
 JSObject*
 js::InitWebAssemblyClass(JSContext* cx, HandleObject obj)
 {
     MOZ_RELEASE_ASSERT(HasCompilerSupport(cx));
-    MOZ_ASSERT(cx->options().wasm());
 
     Handle<GlobalObject*> global = obj.as<GlobalObject>();
     MOZ_ASSERT(!global->isStandardClassResolved(JSProto_WebAssembly));
 
     RootedObject proto(cx, global->getOrCreateObjectPrototype(cx));
     if (!proto)
         return nullptr;