Bug 1504288 - Baldr: remove shared memory and wasm thread ops #ifdefs (keeping default-off pref) (r=lth)
authorLuke Wagner <luke@mozilla.com>
Mon, 19 Nov 2018 13:10:36 -0600
changeset 503535 4b541b90438bec4490b30d3f0ca222f702180281
parent 503534 43db9886e19f185e03fc0e2e2fc2834627e0a2ee
child 503536 8943bbe0793f69ee9622bd26c9cdea4bbe07d65c
push id10290
push userffxbld-merge
push dateMon, 03 Dec 2018 16:23:23 +0000
treeherdermozilla-beta@700bed2445e6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1504288
milestone65.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 1504288 - Baldr: remove shared memory and wasm thread ops #ifdefs (keeping default-off pref) (r=lth)
js/public/ProtoKey.h
js/src/builtin/TestingFunctions.cpp
js/src/jit/none/AtomicOperations-feeling-lucky.h
js/src/js-config.mozbuild
js/src/jsapi.cpp
js/src/shell/js.cpp
js/src/wasm/WasmBaselineCompile.cpp
js/src/wasm/WasmIonCompile.cpp
js/src/wasm/WasmJS.cpp
js/src/wasm/WasmOpIter.cpp
js/src/wasm/WasmTextToBinary.cpp
js/src/wasm/WasmValidate.cpp
--- a/js/public/ProtoKey.h
+++ b/js/public/ProtoKey.h
@@ -90,23 +90,23 @@
     real(Uint8ClampedArray,     InitViaClassSpec,       TYPED_ARRAY_CLASP(Uint8Clamped)) \
 IF_BIGINT(real,imaginary)(BigInt, InitViaClassSpec, OCLASP(BigInt)) \
     real(Proxy,                 InitProxyClass,         &js::ProxyClass) \
     real(WeakMap,               InitWeakMapClass,       OCLASP(WeakMap)) \
     real(Map,                   InitViaClassSpec,       OCLASP(Map)) \
     real(Set,                   InitViaClassSpec,       OCLASP(Set)) \
     real(DataView,              InitViaClassSpec,       OCLASP(DataView)) \
     real(Symbol,                InitSymbolClass,        OCLASP(Symbol)) \
-IF_SAB(real,imaginary)(SharedArrayBuffer,       InitViaClassSpec, OCLASP(SharedArrayBuffer)) \
+    real(SharedArrayBuffer,    InitViaClassSpec,       OCLASP(SharedArrayBuffer)) \
 IF_INTL(real,imaginary) (Intl,                  InitIntlClass,          CLASP(Intl)) \
 IF_BDATA(real,imaginary)(TypedObject,           InitTypedObjectModuleObject,   OCLASP(TypedObjectModule)) \
     real(Reflect,               InitReflect,            nullptr) \
     real(WeakSet,               InitWeakSetClass,       OCLASP(WeakSet)) \
     real(TypedArray,            InitViaClassSpec,       &js::TypedArrayObject::sharedTypedArrayPrototypeClass) \
-IF_SAB(real,imaginary)(Atomics, InitAtomicsClass, OCLASP(Atomics)) \
+    real(Atomics,               InitAtomicsClass,       OCLASP(Atomics)) \
     real(SavedFrame,            InitViaClassSpec,       &js::SavedFrame::class_) \
     real(Promise,               InitViaClassSpec,       OCLASP(Promise)) \
     real(ReadableStream,        InitViaClassSpec,       &js::ReadableStream::class_) \
     real(ReadableStreamDefaultReader,           InitViaClassSpec, &js::ReadableStreamDefaultReader::class_) \
     real(ReadableStreamDefaultController,       InitViaClassSpec, &js::ReadableStreamDefaultController::class_) \
     real(ReadableByteStreamController,          InitViaClassSpec, &js::ReadableByteStreamController::class_) \
     imaginary(WritableStream,   dummy,                  dummy) \
     imaginary(WritableStreamDefaultWriter,      dummy,  dummy) \
--- a/js/src/builtin/TestingFunctions.cpp
+++ b/js/src/builtin/TestingFunctions.cpp
@@ -659,25 +659,21 @@ WasmCachingIsSupported(JSContext* cx, un
     args.rval().setBoolean(wasm::HasCachingSupport(cx));
     return true;
 }
 
 static bool
 WasmThreadsSupported(JSContext* cx, unsigned argc, Value* vp)
 {
     CallArgs args = CallArgsFromVp(argc, vp);
-#ifdef ENABLE_WASM_THREAD_OPS
     bool isSupported = wasm::HasSupport(cx);
-# ifdef ENABLE_WASM_CRANELIFT
+#ifdef ENABLE_WASM_CRANELIFT
     if (cx->options().wasmForceCranelift()) {
         isSupported = false;
     }
-# endif
-#else
-    bool isSupported = false;
 #endif
     args.rval().setBoolean(isSupported);
     return true;
 }
 
 static bool
 WasmBulkMemSupported(JSContext* cx, unsigned argc, Value* vp)
 {
--- a/js/src/jit/none/AtomicOperations-feeling-lucky.h
+++ b/js/src/jit/none/AtomicOperations-feeling-lucky.h
@@ -444,19 +444,19 @@ template<>
 inline uint64_t
 AtomicOperations::exchangeSeqCst(uint64_t* addr, uint64_t val) {
     MOZ_CRASH("No 64-bit atomics");
 }
 
 } }
 #endif
 
-#elif defined(ENABLE_SHARED_ARRAY_BUFFER)
+#else
 
-# error "Either disable JS shared memory, use GCC or Clang, or add code here"
+# error "Either use GCC or Clang, or add code here"
 
 #endif
 
 #undef ATOMICS_IMPLEMENTED_WITH_SYNC_INTRINSICS
 #undef GNUC_COMPATIBLE
 #undef HAS_64BIT_ATOMICS
 #undef HAS_64BIT_LOCKFREE
 
--- a/js/src/js-config.mozbuild
+++ b/js/src/js-config.mozbuild
@@ -16,21 +16,16 @@ if CONFIG['NIGHTLY_BUILD']:
 # platforms.
 if CONFIG['JS_CODEGEN_X64'] or CONFIG['JS_CODEGEN_ARM64']:
     DEFINES['WASM_HUGE_MEMORY'] = True
 
 # Enables CACHEIR_LOGS to diagnose IC coverage.
 if CONFIG['MOZ_DEBUG'] or CONFIG['NIGHTLY_BUILD']:
     DEFINES['JS_CACHEIR_SPEW'] = True
 
-# Build with SharedArrayBuffer/wasm-thread-ops code.
-# NOTE: This Realm creation options decide if this is exposed to script.
-DEFINES['ENABLE_SHARED_ARRAY_BUFFER'] = True
-DEFINES['ENABLE_WASM_THREAD_OPS'] = True
-
 # CTypes
 if CONFIG['JS_HAS_CTYPES']:
     DEFINES['JS_HAS_CTYPES'] = True
     if not CONFIG['MOZ_SYSTEM_FFI']:
         DEFINES['FFI_BUILDING'] = True
 
 # Forward MOZ_LINKER config
 if CONFIG['MOZ_LINKER']:
--- a/js/src/jsapi.cpp
+++ b/js/src/jsapi.cpp
@@ -1857,29 +1857,23 @@ const JS::RealmCreationOptions&
 JS::RealmCreationOptionsRef(JSContext* cx)
 {
     return cx->realm()->creationOptions();
 }
 
 bool
 JS::RealmCreationOptions::getSharedMemoryAndAtomicsEnabled() const
 {
-#if defined(ENABLE_SHARED_ARRAY_BUFFER)
     return sharedMemoryAndAtomics_;
-#else
-    return false;
-#endif
 }
 
 JS::RealmCreationOptions&
 JS::RealmCreationOptions::setSharedMemoryAndAtomicsEnabled(bool flag)
 {
-#if defined(ENABLE_SHARED_ARRAY_BUFFER)
     sharedMemoryAndAtomics_ = flag;
-#endif
     return *this;
 }
 
 JS::RealmBehaviors&
 JS::RealmBehaviorsRef(JS::Realm* realm)
 {
     return realm->behaviors();
 }
--- a/js/src/shell/js.cpp
+++ b/js/src/shell/js.cpp
@@ -10729,27 +10729,25 @@ SetContextOptions(JSContext* cx, const O
     }
     cx->runtime()->setOffthreadIonCompilationEnabled(offthreadCompilation);
 
     if (op.getStringOption("ion-parallel-compile")) {
         fprintf(stderr, "--ion-parallel-compile is deprecated. Please use --ion-offthread-compile instead.\n");
         return false;
     }
 
-#ifdef ENABLE_SHARED_ARRAY_BUFFER
     if (const char* str = op.getStringOption("shared-memory")) {
         if (strcmp(str, "off") == 0) {
             enableSharedMemory = false;
         } else if (strcmp(str, "on") == 0) {
             enableSharedMemory = true;
         } else {
             return OptionFailure("shared-memory", str);
         }
     }
-#endif
 
 #if defined(JS_CODEGEN_ARM)
     if (const char* str = op.getStringOption("arm-hwcap")) {
         jit::ParseARMHwCapFlags(str);
     }
 
     int32_t fill = op.getIntOption("arm-asm-nop-fill");
     if (fill >= 0) {
@@ -11123,26 +11121,24 @@ main(int argc, char** argv, char** envp)
 #endif
         || !op.addBoolOption('\0', "no-native-regexp", "Disable native regexp compilation")
         || !op.addBoolOption('\0', "no-unboxed-objects", "Disable creating unboxed plain objects")
         || !op.addBoolOption('\0', "enable-streams", "Enable WHATWG Streams (default)")
         || !op.addBoolOption('\0', "no-streams", "Disable WHATWG Streams")
 #ifdef ENABLE_BIGINT
         || !op.addBoolOption('\0', "no-bigint", "Disable experimental BigInt support")
 #endif
-#ifdef ENABLE_SHARED_ARRAY_BUFFER
         || !op.addStringOption('\0', "shared-memory", "on/off",
                                "SharedArrayBuffer and Atomics "
-#  if SHARED_MEMORY_DEFAULT
+#if SHARED_MEMORY_DEFAULT
                                "(default: on, off to disable)"
-#  else
+#else
                                "(default: off, on to enable)"
-#  endif
+#endif
             )
-#endif
         || !op.addStringOption('\0', "spectre-mitigations", "on/off",
                                "Whether Spectre mitigations are enabled (default: off, on to enable)")
         || !op.addStringOption('\0', "cache-ir-stubs", "on/off/nobinary",
                                "Use CacheIR stubs (default: on, off to disable, nobinary to"
                                "just disable binary arith)")
         || !op.addStringOption('\0', "ion-shared-stubs", "on/off",
                                "Use shared stubs (default: on, off to disable)")
         || !op.addStringOption('\0', "ion-scalar-replacement", "on/off",
--- a/js/src/wasm/WasmBaselineCompile.cpp
+++ b/js/src/wasm/WasmBaselineCompile.cpp
@@ -10926,17 +10926,16 @@ BaseCompiler::emitBody()
               default:
                 break;
             } // switch (op.b1)
             return iter_.unrecognizedOpcode(&op);
           }
 
           // Thread operations
           case uint16_t(Op::ThreadPrefix): {
-#ifdef ENABLE_WASM_THREAD_OPS
             switch (op.b1) {
               case uint16_t(ThreadOp::Wake):
                 CHECK_NEXT(emitWake());
 
               case uint16_t(ThreadOp::I32Wait):
                 CHECK_NEXT(emitWait(ValType::I32, 4));
               case uint16_t(ThreadOp::I64Wait):
                 CHECK_NEXT(emitWait(ValType::I64, 8));
@@ -11074,19 +11073,16 @@ BaseCompiler::emitBody()
               case uint16_t(ThreadOp::I64AtomicCmpXchg16U):
                 CHECK_NEXT(emitAtomicCmpXchg(ValType::I64, Scalar::Uint16));
               case uint16_t(ThreadOp::I64AtomicCmpXchg32U):
                 CHECK_NEXT(emitAtomicCmpXchg(ValType::I64, Scalar::Uint32));
 
               default:
                 return iter_.unrecognizedOpcode(&op);
             }
-#else
-            return iter_.unrecognizedOpcode(&op);
-#endif  // ENABLE_WASM_THREAD_OPS
             break;
           }
 
           // asm.js and other private operations
           case uint16_t(Op::MozPrefix):
             return iter_.unrecognizedOpcode(&op);
 
           default:
--- a/js/src/wasm/WasmIonCompile.cpp
+++ b/js/src/wasm/WasmIonCompile.cpp
@@ -2769,18 +2769,16 @@ EmitCurrentMemory(FunctionCompiler& f)
     if (!f.builtinInstanceMethodCall(SymbolicAddress::CurrentMemory, args, ValType::I32, &ret)) {
         return false;
     }
 
     f.iter().setResult(ret);
     return true;
 }
 
-#ifdef ENABLE_WASM_THREAD_OPS
-
 static bool
 EmitAtomicCmpXchg(FunctionCompiler& f, ValType type, Scalar::Type viewType)
 {
     LinearMemoryAddress<MDefinition*> addr;
     MDefinition* oldValue;
     MDefinition* newValue;
     if (!f.iter().readAtomicCmpXchg(&addr, type, byteSize(viewType), &oldValue, &newValue)) {
         return false;
@@ -2975,18 +2973,16 @@ EmitAtomicXchg(FunctionCompiler& f, ValT
     if (!f.inDeadCode() && !ins) {
         return false;
     }
 
     f.iter().setResult(ins);
     return true;
 }
 
-#endif // ENABLE_WASM_THREAD_OPS
-
 #ifdef ENABLE_WASM_BULKMEM_OPS
 static bool
 EmitMemOrTableCopy(FunctionCompiler& f, bool isMem)
 {
     MDefinition* dst, *src, *len;
     uint32_t dstTableIndex;
     uint32_t srcTableIndex;
     if (!f.iter().readMemOrTableCopy(isMem, &dstTableIndex, &dst, &srcTableIndex, &src, &len)) {
@@ -3764,17 +3760,16 @@ EmitBodyExprs(FunctionCompiler& f)
               default:
                 return f.iter().unrecognizedOpcode(&op);
             }
             break;
           }
 
           // Thread operations
           case uint16_t(Op::ThreadPrefix): {
-#ifdef ENABLE_WASM_THREAD_OPS
             switch (op.b1) {
               case uint16_t(ThreadOp::Wake):
                 CHECK(EmitWake(f));
 
               case uint16_t(ThreadOp::I32Wait):
                 CHECK(EmitWait(f, ValType::I32, 4));
               case uint16_t(ThreadOp::I64Wait):
                 CHECK(EmitWait(f, ValType::I64, 8));
@@ -3912,19 +3907,16 @@ EmitBodyExprs(FunctionCompiler& f)
               case uint16_t(ThreadOp::I64AtomicCmpXchg16U):
                 CHECK(EmitAtomicCmpXchg(f, ValType::I64, Scalar::Uint16));
               case uint16_t(ThreadOp::I64AtomicCmpXchg32U):
                 CHECK(EmitAtomicCmpXchg(f, ValType::I64, Scalar::Uint32));
 
               default:
                 return f.iter().unrecognizedOpcode(&op);
             }
-#else
-            return f.iter().unrecognizedOpcode(&op);
-#endif  // ENABLE_WASM_THREAD_OPS
             break;
           }
 
           // asm.js-specific operators
           case uint16_t(Op::MozPrefix): {
             if (!f.env().isAsmJS()) {
                 return f.iter().unrecognizedOpcode(&op);
             }
--- a/js/src/wasm/WasmJS.cpp
+++ b/js/src/wasm/WasmJS.cpp
@@ -54,54 +54,48 @@ using mozilla::CheckedInt;
 using mozilla::Nothing;
 using mozilla::RangedPtr;
 
 extern mozilla::Atomic<bool> fuzzingSafe;
 
 bool
 wasm::HasCompilerSupport(JSContext* cx)
 {
+#if !MOZ_LITTLE_ENDIAN || defined(JS_CODEGEN_NONE)
+    return false;
+#endif
+
     if (gc::SystemPageSize() > wasm::PageSize) {
         return false;
     }
 
     if (!cx->jitSupportsFloatingPoint()) {
         return false;
     }
 
     if (!cx->jitSupportsUnalignedAccesses()) {
         return false;
     }
 
     if (!wasm::EnsureFullSignalHandlers(cx)) {
         return false;
     }
 
-#if !MOZ_LITTLE_ENDIAN
-    return false;
-#endif
-
-#ifdef ENABLE_WASM_THREAD_OPS
     // Wasm threads require 8-byte lock-free atomics.
     if (!jit::AtomicOperations::isLockfree8()) {
         return false;
     }
-#endif
 
 #ifdef JS_SIMULATOR
     if (!Simulator::supportsAtomics()) {
         return false;
     }
 #endif
 
-#if defined(JS_CODEGEN_NONE)
-    return false;
-#else
     return BaselineCanCompile() || IonCanCompile();
-#endif
 }
 
 // Return whether wasm compilation is allowed by prefs.  This check
 // only makes sense if HasCompilerSupport() is true.
 static bool
 HasAvailableCompilerTier(JSContext* cx)
 {
     return (cx->options().wasmBaseline() && BaselineCanCompile()) ||
@@ -584,17 +578,16 @@ GetLimits(JSContext* cx, HandleObject ob
             JS_ReportErrorNumberUTF8(cx, GetErrorMessage, nullptr, JSMSG_WASM_BAD_RANGE,
                                      kind, "maximum size");
             return false;
         }
     }
 
     limits->shared = Shareable::False;
 
-#ifdef ENABLE_WASM_THREAD_OPS
     if (allowShared == Shareable::True) {
         JSAtom* sharedAtom = Atomize(cx, "shared", strlen("shared"));
         if (!sharedAtom) {
             return false;
         }
         RootedId sharedId(cx, AtomToId(sharedAtom));
 
         RootedValue sharedVal(cx);
@@ -616,17 +609,16 @@ GetLimits(JSContext* cx, HandleObject ob
                 if (!cx->realm()->creationOptions().getSharedMemoryAndAtomicsEnabled()) {
                     JS_ReportErrorNumberASCII(cx, GetErrorMessage, nullptr,
                                               JSMSG_WASM_NO_SHMEM_LINK);
                     return false;
                 }
             }
         }
     }
-#endif
 
     return true;
 }
 
 // ============================================================================
 // WebAssembly.Module class and methods
 
 const ClassOps WasmModuleObject::classOps_ =
--- a/js/src/wasm/WasmOpIter.cpp
+++ b/js/src/wasm/WasmOpIter.cpp
@@ -42,21 +42,16 @@ using namespace js::wasm;
 # else
 #  define WASM_BULK_OP(code) break
 # endif
 # ifdef ENABLE_WASM_GENERALIZED_TABLES
 #  define WASM_TABLE_OP(code) return code
 # else
 #  define WASM_TABLE_OP(code) break
 # endif
-# ifdef ENABLE_WASM_THREAD_OPS
-#  define WASM_THREAD_OP(code) return code
-# else
-#  define WASM_THREAD_OP(code) break
-# endif
 
 OpKind
 wasm::Classify(OpBytes op)
 {
     switch (Op(op.b0)) {
       case Op::Block:
         return OpKind::Block;
       case Op::Loop:
@@ -317,36 +312,36 @@ wasm::Classify(OpBytes op)
           break;
       }
       case Op::ThreadPrefix: {
           switch (ThreadOp(op.b1)) {
             case ThreadOp::Limit:
               // Reject Limit for ThreadPrefix encoding
               break;
             case ThreadOp::Wake:
-              WASM_THREAD_OP(OpKind::Wake);
+              return OpKind::Wake;
             case ThreadOp::I32Wait:
             case ThreadOp::I64Wait:
-              WASM_THREAD_OP(OpKind::Wait);
+              return OpKind::Wait;
             case ThreadOp::I32AtomicLoad:
             case ThreadOp::I64AtomicLoad:
             case ThreadOp::I32AtomicLoad8U:
             case ThreadOp::I32AtomicLoad16U:
             case ThreadOp::I64AtomicLoad8U:
             case ThreadOp::I64AtomicLoad16U:
             case ThreadOp::I64AtomicLoad32U:
-              WASM_THREAD_OP(OpKind::AtomicLoad);
+              return OpKind::AtomicLoad;
             case ThreadOp::I32AtomicStore:
             case ThreadOp::I64AtomicStore:
             case ThreadOp::I32AtomicStore8U:
             case ThreadOp::I32AtomicStore16U:
             case ThreadOp::I64AtomicStore8U:
             case ThreadOp::I64AtomicStore16U:
             case ThreadOp::I64AtomicStore32U:
-              WASM_THREAD_OP(OpKind::AtomicStore);
+              return OpKind::AtomicStore;
             case ThreadOp::I32AtomicAdd:
             case ThreadOp::I64AtomicAdd:
             case ThreadOp::I32AtomicAdd8U:
             case ThreadOp::I32AtomicAdd16U:
             case ThreadOp::I64AtomicAdd8U:
             case ThreadOp::I64AtomicAdd16U:
             case ThreadOp::I64AtomicAdd32U:
             case ThreadOp::I32AtomicSub:
@@ -379,25 +374,25 @@ wasm::Classify(OpBytes op)
             case ThreadOp::I64AtomicXor32U:
             case ThreadOp::I32AtomicXchg:
             case ThreadOp::I64AtomicXchg:
             case ThreadOp::I32AtomicXchg8U:
             case ThreadOp::I32AtomicXchg16U:
             case ThreadOp::I64AtomicXchg8U:
             case ThreadOp::I64AtomicXchg16U:
             case ThreadOp::I64AtomicXchg32U:
-              WASM_THREAD_OP(OpKind::AtomicBinOp);
+              return OpKind::AtomicBinOp;
             case ThreadOp::I32AtomicCmpXchg:
             case ThreadOp::I64AtomicCmpXchg:
             case ThreadOp::I32AtomicCmpXchg8U:
             case ThreadOp::I32AtomicCmpXchg16U:
             case ThreadOp::I64AtomicCmpXchg8U:
             case ThreadOp::I64AtomicCmpXchg16U:
             case ThreadOp::I64AtomicCmpXchg32U:
-              WASM_THREAD_OP(OpKind::AtomicCompareExchange);
+              return OpKind::AtomicCompareExchange;
             default:
               break;
           }
           break;
       }
       case Op::MozPrefix: {
           switch (MozOp(op.b1)) {
             case MozOp::Limit:
@@ -445,11 +440,10 @@ wasm::Classify(OpBytes op)
       }
     }
     MOZ_MAKE_COMPILER_ASSUME_IS_UNREACHABLE("unimplemented opcode");
 }
 
 # undef WASM_GC_OP
 # undef WASM_BULK_OP
 # undef WASM_TABLE_OP
-# undef WASM_THREAD_OP
 
 #endif
--- a/js/src/wasm/WasmTextToBinary.cpp
+++ b/js/src/wasm/WasmTextToBinary.cpp
@@ -1000,24 +1000,22 @@ WasmTokenStream::next()
             return WasmToken(WasmToken::Align, begin, cur_);
         }
         if (consume(u"anyfunc")) {
             return WasmToken(WasmToken::AnyFunc, begin, cur_);
         }
         if (consume(u"anyref")) {
             return WasmToken(WasmToken::ValueType, ValType::AnyRef, begin, cur_);
         }
-#ifdef ENABLE_WASM_THREAD_OPS
         if (consume(u"atomic.")) {
             if (consume(u"wake") || consume(u"notify")) {
                 return WasmToken(WasmToken::Wake, ThreadOp::Wake, begin, cur_);
             }
             break;
         }
-#endif
         break;
 
       case 'b':
         if (consume(u"block")) {
             return WasmToken(WasmToken::Block, begin, cur_);
         }
         if (consume(u"br")) {
             if (consume(u"_table")) {
@@ -1360,17 +1358,16 @@ WasmTokenStream::next()
             switch (*cur_) {
               case 'a':
                 if (consume(u"add")) {
                     return WasmToken(WasmToken::BinaryOpcode, Op::I32Add, begin, cur_);
                 }
                 if (consume(u"and")) {
                     return WasmToken(WasmToken::BinaryOpcode, Op::I32And, begin, cur_);
                 }
-#ifdef ENABLE_WASM_THREAD_OPS
                 if (consume(u"atomic.")) {
                     if (consume(u"rmw8_u.add")) {
                         return WasmToken(WasmToken::AtomicRMW, ThreadOp::I32AtomicAdd8U, begin, cur_);
                     }
                     if (consume(u"rmw16_u.add")) {
                         return WasmToken(WasmToken::AtomicRMW, ThreadOp::I32AtomicAdd16U, begin, cur_);
                     }
                     if (consume(u"rmw.add")) {
@@ -1447,17 +1444,16 @@ WasmTokenStream::next()
                     }
                     if (consume(u"rmw.xchg")) {
                         return WasmToken(WasmToken::AtomicRMW, ThreadOp::I32AtomicXchg, begin, cur_);
                     }
                     if (consume(u"wait")) {
                         return WasmToken(WasmToken::Wait, ThreadOp::I32Wait, begin, cur_);
                     }
                 }
-#endif // ENABLE_WASM_THREAD_OPS
                 break;
               case 'c':
                 if (consume(u"const")) {
                     return WasmToken(WasmToken::Const, ValType::I32, begin, cur_);
                 }
                 if (consume(u"clz")) {
                     return WasmToken(WasmToken::UnaryOpcode, Op::I32Clz, begin, cur_);
                 }
@@ -1653,17 +1649,16 @@ WasmTokenStream::next()
             switch (*cur_) {
               case 'a':
                 if (consume(u"add")) {
                     return WasmToken(WasmToken::BinaryOpcode, Op::I64Add, begin, cur_);
                 }
                 if (consume(u"and")) {
                     return WasmToken(WasmToken::BinaryOpcode, Op::I64And, begin, cur_);
                 }
-#ifdef ENABLE_WASM_THREAD_OPS
                 if (consume(u"atomic.")) {
                     if (consume(u"rmw8_u.add")) {
                         return WasmToken(WasmToken::AtomicRMW, ThreadOp::I64AtomicAdd8U, begin, cur_);
                     }
                     if (consume(u"rmw16_u.add")) {
                         return WasmToken(WasmToken::AtomicRMW, ThreadOp::I64AtomicAdd16U, begin, cur_);
                     }
                     if (consume(u"rmw32_u.add")) {
@@ -1767,17 +1762,16 @@ WasmTokenStream::next()
                     }
                     if (consume(u"rmw.xchg")) {
                         return WasmToken(WasmToken::AtomicRMW, ThreadOp::I64AtomicXchg, begin, cur_);
                     }
                     if (consume(u"wait")) {
                         return WasmToken(WasmToken::Wait, ThreadOp::I64Wait, begin, cur_);
                     }
                 }
-#endif // ENABLE_WASM_THREAD_OPS
                 break;
               case 'c':
                 if (consume(u"const")) {
                     return WasmToken(WasmToken::Const, ValType::I64, begin, cur_);
                 }
                 if (consume(u"clz")) {
                     return WasmToken(WasmToken::UnaryOpcode, Op::I64Clz, begin, cur_);
                 }
@@ -2088,21 +2082,19 @@ WasmTokenStream::next()
             return WasmToken(WasmToken::TernaryOpcode, Op::Select, begin, cur_);
         }
         if (consume(u"set_global")) {
             return WasmToken(WasmToken::SetGlobal, begin, cur_);
         }
         if (consume(u"set_local")) {
             return WasmToken(WasmToken::SetLocal, begin, cur_);
         }
-#ifdef ENABLE_WASM_THREAD_OPS
         if (consume(u"shared")) {
             return WasmToken(WasmToken::Shared, begin, cur_);
         }
-#endif
         if (consume(u"start")) {
             return WasmToken(WasmToken::Start, begin, cur_);
         }
         if (consume(u"struct")) {
 #ifdef ENABLE_WASM_GC
             if (consume(u".new")) {
                 return WasmToken(WasmToken::StructNew, begin, cur_);
             }
--- a/js/src/wasm/WasmValidate.cpp
+++ b/js/src/wasm/WasmValidate.cpp
@@ -1013,17 +1013,16 @@ DecodeFunctionBodyExprs(const ModuleEnvi
             if (env.gcTypesEnabled() == HasGcTypes::False) {
                 return iter.unrecognizedOpcode(&op);
             }
             CHECK(iter.readConversion(ValType::AnyRef, ValType::I32, &nothing));
             break;
           }
 #endif
           case uint16_t(Op::ThreadPrefix): {
-#ifdef ENABLE_WASM_THREAD_OPS
             switch (op.b1) {
               case uint16_t(ThreadOp::Wake): {
                 LinearMemoryAddress<Nothing> addr;
                 CHECK(iter.readWake(&addr, &nothing));
               }
               case uint16_t(ThreadOp::I32Wait): {
                 LinearMemoryAddress<Nothing> addr;
                 CHECK(iter.readWait(&addr, ValType::I32, 4, &nothing, &nothing));
@@ -1178,19 +1177,16 @@ DecodeFunctionBodyExprs(const ModuleEnvi
               case uint16_t(ThreadOp::I64AtomicCmpXchg32U): {
                   LinearMemoryAddress<Nothing> addr;
                   CHECK(iter.readAtomicCmpXchg(&addr, ValType::I64, 4, &nothing, &nothing));
               }
               default:
                 return iter.unrecognizedOpcode(&op);
             }
             break;
-#else
-            return iter.unrecognizedOpcode(&op);
-#endif  // ENABLE_WASM_THREAD_OPS
           }
           case uint16_t(Op::MozPrefix):
             return iter.unrecognizedOpcode(&op);
           default:
             return iter.unrecognizedOpcode(&op);
         }
     }
 
@@ -1607,27 +1603,25 @@ DecodeLimits(Decoder& d, Limits* limits,
                            maximum, limits->initial);
         }
 
         limits->maximum.emplace(maximum);
     }
 
     limits->shared = Shareable::False;
 
-#ifdef ENABLE_WASM_THREAD_OPS
     if (allowShared == Shareable::True) {
         if ((flags & uint8_t(MemoryTableFlags::IsShared)) && !(flags & uint8_t(MemoryTableFlags::HasMaximum))) {
             return d.fail("maximum length required for shared memory");
         }
 
         limits->shared = (flags & uint8_t(MemoryTableFlags::IsShared))
                        ? Shareable::True
                        : Shareable::False;
     }
-#endif
 
     return true;
 }
 
 static bool
 DecodeTableTypeAndLimits(Decoder& d, HasGcTypes gcTypesEnabled, TableDescVector* tables)
 {
     uint8_t elementType;