Bug 1648755 - gate availability of thread ops on the shared memory pref. r=rhunt
authorLars T Hansen <lhansen@mozilla.com>
Tue, 30 Jun 2020 11:03:25 +0000
changeset 537967 eb95d039d9a025b22a54432bb26904eb5ab61494
parent 537966 7326303a277ff0a9d0895da1e579026ebf44b4ef
child 537968 d6844af829249448ca55df4d217fd800dc9d3633
push id37555
push usercbrindusan@mozilla.com
push dateTue, 30 Jun 2020 14:45:59 +0000
treeherdermozilla-central@933c9f34edfa [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersrhunt
bugs1648755
milestone80.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 1648755 - gate availability of thread ops on the shared memory pref. r=rhunt We will shortly be unable to depend on the presence of shared memory as a gate for the thread operations, so just add proper gating depending on the shared-memory pref. Differential Revision: https://phabricator.services.mozilla.com/D81328
js/src/wasm/WasmBaselineCompile.cpp
js/src/wasm/WasmIonCompile.cpp
js/src/wasm/WasmValidate.cpp
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -14773,16 +14773,19 @@ bool BaseCompiler::emitBody() {
           default:
             break;
         }  // switch (op.b1)
         return iter_.unrecognizedOpcode(&op);
       }
 
       // Thread operations
       case uint16_t(Op::ThreadPrefix): {
+        if (env_.sharedMemoryEnabled == Shareable::False) {
+          return iter_.unrecognizedOpcode(&op);
+        }
         switch (op.b1) {
           case uint32_t(ThreadOp::Wake):
             CHECK_NEXT(emitWake());
 
           case uint32_t(ThreadOp::I32Wait):
             CHECK_NEXT(emitWait(ValType::I32, 4));
           case uint32_t(ThreadOp::I64Wait):
             CHECK_NEXT(emitWait(ValType::I64, 8));
--- a/js/src/wasm/WasmIonCompile.cpp
+++ b/js/src/wasm/WasmIonCompile.cpp
@@ -4990,16 +4990,19 @@ static bool EmitBodyExprs(FunctionCompil
           default:
             return f.iter().unrecognizedOpcode(&op);
         }
         break;
       }
 
       // Thread operations
       case uint16_t(Op::ThreadPrefix): {
+        if (f.env().sharedMemoryEnabled == Shareable::False) {
+          return f.iter().unrecognizedOpcode(&op);
+        }
         switch (op.b1) {
           case uint32_t(ThreadOp::Wake):
             CHECK(EmitWake(f));
 
           case uint32_t(ThreadOp::I32Wait):
             CHECK(EmitWait(f, ValType::I32, 4));
           case uint32_t(ThreadOp::I64Wait):
             CHECK(EmitWait(f, ValType::I64, 8));
--- a/js/src/wasm/WasmValidate.cpp
+++ b/js/src/wasm/WasmValidate.cpp
@@ -1299,16 +1299,19 @@ static bool DecodeFunctionBodyExprs(cons
         if (!env.refTypesEnabled()) {
           return iter.unrecognizedOpcode(&op);
         }
         Nothing nothing;
         CHECK(iter.readRefIsNull(&nothing));
       }
 #endif
       case uint16_t(Op::ThreadPrefix): {
+        if (env.sharedMemoryEnabled == Shareable::False) {
+          return iter.unrecognizedOpcode(&op);
+        }
         switch (op.b1) {
           case uint32_t(ThreadOp::Wake): {
             LinearMemoryAddress<Nothing> addr;
             CHECK(iter.readWake(&addr, &nothing));
           }
           case uint32_t(ThreadOp::I32Wait): {
             LinearMemoryAddress<Nothing> addr;
             CHECK(iter.readWait(&addr, ValType::I32, 4, &nothing, &nothing));