Bug 1562906 - Test non-booleans with explicit comparisons. r=jseward
authorLars T Hansen <lhansen@mozilla.com>
Tue, 02 Jul 2019 16:18:38 +0000
changeset 543799 e2786b16410c5f7db0aa7dffae3cdc643fd8c216
parent 543798 c638a6eed13d86b777338b6b0102b2717db36971
child 543800 33eca9689b583e8137ffbccf7171c8b785d3d8bd
push id2131
push userffxbld-merge
push dateMon, 26 Aug 2019 18:30:20 +0000
treeherdermozilla-release@b19ffb3ca153 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjseward
bugs1562906
milestone69.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 1562906 - Test non-booleans with explicit comparisons. r=jseward The sharedMemoryEnabled attribute of the module environment is not a boolean, but a true/false enum, and must be tested through an explicit comparison with one of the enum values. Differential Revision: https://phabricator.services.mozilla.com/D36619
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
@@ -10197,17 +10197,17 @@ bool BaseCompiler::emitWake() {
   }
 
   return emitInstanceCall(lineOrBytecode, SASigWake);
 }
 
 // Bulk memory must be available if shared memory is enabled.
 bool BaseCompiler::bulkmemOpsEnabled() {
 #ifndef ENABLE_WASM_BULKMEM_OPS
-  if (!env_.sharedMemoryEnabled) {
+  if (env_.sharedMemoryEnabled == Shareable::False) {
     return iter_.fail("bulk memory ops disabled");
   }
 #endif
   return true;
 }
 
 bool BaseCompiler::emitMemOrTableCopy(bool isMem) {
   if (!bulkmemOpsEnabled()) {
--- a/js/src/wasm/WasmIonCompile.cpp
+++ b/js/src/wasm/WasmIonCompile.cpp
@@ -2860,17 +2860,17 @@ static bool EmitAtomicXchg(FunctionCompi
 
   f.iter().setResult(ins);
   return true;
 }
 
 static bool EmitMemOrTableCopy(FunctionCompiler& f, bool isMem) {
   // Bulk memory must be available if shared memory is enabled.
 #ifndef ENABLE_WASM_BULKMEM_OPS
-  if (!f.env().sharedMemoryEnabled) {
+  if (f.env().sharedMemoryEnabled == Shareable::False) {
     return f.iter().fail("bulk memory ops disabled");
   }
 #endif
 
   MDefinition *dst, *src, *len;
   uint32_t dstTableIndex;
   uint32_t srcTableIndex;
   if (!f.iter().readMemOrTableCopy(isMem, &dstTableIndex, &dst, &srcTableIndex,
@@ -2921,17 +2921,17 @@ static bool EmitMemOrTableCopy(FunctionC
   }
 
   return f.builtinInstanceMethodCall(callee, lineOrBytecode, args);
 }
 
 static bool EmitDataOrElemDrop(FunctionCompiler& f, bool isData) {
   // Bulk memory must be available if shared memory is enabled.
 #ifndef ENABLE_WASM_BULKMEM_OPS
-  if (!f.env().sharedMemoryEnabled) {
+  if (f.env().sharedMemoryEnabled == Shareable::False) {
     return f.iter().fail("bulk memory ops disabled");
   }
 #endif
 
   uint32_t segIndexVal = 0;
   if (!f.iter().readDataOrElemDrop(isData, &segIndexVal)) {
     return false;
   }
@@ -2960,17 +2960,17 @@ static bool EmitDataOrElemDrop(FunctionC
   }
 
   return f.builtinInstanceMethodCall(callee, lineOrBytecode, args);
 }
 
 static bool EmitMemFill(FunctionCompiler& f) {
   // Bulk memory must be available if shared memory is enabled.
 #ifndef ENABLE_WASM_BULKMEM_OPS
-  if (!f.env().sharedMemoryEnabled) {
+  if (f.env().sharedMemoryEnabled == Shareable::False) {
     return f.iter().fail("bulk memory ops disabled");
   }
 #endif
 
   MDefinition *start, *val, *len;
   if (!f.iter().readMemFill(&start, &val, &len)) {
     return false;
   }
@@ -3002,17 +3002,17 @@ static bool EmitMemFill(FunctionCompiler
   }
 
   return f.builtinInstanceMethodCall(callee, lineOrBytecode, args);
 }
 
 static bool EmitMemOrTableInit(FunctionCompiler& f, bool isMem) {
   // Bulk memory must be available if shared memory is enabled.
 #ifndef ENABLE_WASM_BULKMEM_OPS
-  if (!f.env().sharedMemoryEnabled) {
+  if (f.env().sharedMemoryEnabled == Shareable::False) {
     return f.iter().fail("bulk memory ops disabled");
   }
 #endif
 
   uint32_t segIndexVal = 0, dstTableIndex = 0;
   MDefinition *dstOff, *srcOff, *len;
   if (!f.iter().readMemOrTableInit(isMem, &segIndexVal, &dstTableIndex, &dstOff,
                                    &srcOff, &len)) {
--- a/js/src/wasm/WasmValidate.cpp
+++ b/js/src/wasm/WasmValidate.cpp
@@ -827,84 +827,84 @@ static bool DecodeFunctionBodyExprs(cons
           case uint32_t(MiscOp::I64TruncUSatF32):
             CHECK(iter.readConversion(ValType::F32, ValType::I64, &nothing));
           case uint32_t(MiscOp::I64TruncSSatF64):
           case uint32_t(MiscOp::I64TruncUSatF64):
             CHECK(iter.readConversion(ValType::F64, ValType::I64, &nothing));
           case uint32_t(MiscOp::MemCopy): {
 #ifndef ENABLE_WASM_BULKMEM_OPS
             // Bulk memory must be available if shared memory is enabled.
-            if (!env.sharedMemoryEnabled) {
+            if (env.sharedMemoryEnabled == Shareable::False) {
               return iter.fail("bulk memory ops disabled");
             }
 #endif
             uint32_t unusedDestMemIndex;
             uint32_t unusedSrcMemIndex;
             CHECK(iter.readMemOrTableCopy(/*isMem=*/true, &unusedDestMemIndex,
                                           &nothing, &unusedSrcMemIndex,
                                           &nothing, &nothing));
           }
           case uint32_t(MiscOp::DataDrop): {
 #ifndef ENABLE_WASM_BULKMEM_OPS
             // Bulk memory must be available if shared memory is enabled.
-            if (!env.sharedMemoryEnabled) {
+            if (env.sharedMemoryEnabled == Shareable::False) {
               return iter.fail("bulk memory ops disabled");
             }
 #endif
             uint32_t unusedSegIndex;
             CHECK(iter.readDataOrElemDrop(/*isData=*/true, &unusedSegIndex));
           }
           case uint32_t(MiscOp::MemFill):
 #ifndef ENABLE_WASM_BULKMEM_OPS
             // Bulk memory must be available if shared memory is enabled.
-            if (!env.sharedMemoryEnabled) {
+            if (env.sharedMemoryEnabled == Shareable::False) {
               return iter.fail("bulk memory ops disabled");
             }
 #endif
             CHECK(iter.readMemFill(&nothing, &nothing, &nothing));
           case uint32_t(MiscOp::MemInit): {
 #ifndef ENABLE_WASM_BULKMEM_OPS
             // Bulk memory must be available if shared memory is enabled.
-            if (!env.sharedMemoryEnabled) {
+            if (env.sharedMemoryEnabled == Shareable::False) {
               return iter.fail("bulk memory ops disabled");
             }
 #endif
             uint32_t unusedSegIndex;
             uint32_t unusedTableIndex;
             CHECK(iter.readMemOrTableInit(/*isMem=*/true, &unusedSegIndex,
                                           &unusedTableIndex, &nothing, &nothing,
                                           &nothing));
           }
           case uint32_t(MiscOp::TableCopy): {
 #ifndef ENABLE_WASM_BULKMEM_OPS
             // Bulk memory must be available if shared memory is enabled.
-            if (!env.sharedMemoryEnabled) {
+            if (env.sharedMemoryEnabled == Shareable::False) {
               return iter.fail("bulk memory ops disabled");
             }
 #endif
             uint32_t unusedDestTableIndex;
             uint32_t unusedSrcTableIndex;
             CHECK(iter.readMemOrTableCopy(
                 /*isMem=*/false, &unusedDestTableIndex, &nothing,
                 &unusedSrcTableIndex, &nothing, &nothing));
           }
           case uint32_t(MiscOp::ElemDrop): {
 #ifndef ENABLE_WASM_BULKMEM_OPS
             // Bulk memory must be available if shared memory is enabled.
-            if (!env.sharedMemoryEnabled) {
+            if (env.sharedMemoryEnabled == Shareable::False) {
               return iter.fail("bulk memory ops disabled");
             }
 #endif
             uint32_t unusedSegIndex;
             CHECK(iter.readDataOrElemDrop(/*isData=*/false, &unusedSegIndex));
           }
           case uint32_t(MiscOp::TableInit): {
 #ifndef ENABLE_WASM_BULKMEM_OPS
             // Bulk memory must be available if shared memory is enabled.
-            if (!env.sharedMemoryEnabled) {
+            if (env.sharedMemoryEnabled == Shareable::False) {
               return iter.fail("bulk memory ops disabled");
             }
 #endif
             uint32_t unusedSegIndex;
             uint32_t unusedTableIndex;
             CHECK(iter.readMemOrTableInit(/*isMem=*/false, &unusedSegIndex,
                                           &unusedTableIndex, &nothing, &nothing,
                                           &nothing));
@@ -2419,17 +2419,17 @@ static bool DecodeDataCountSection(Decod
     return false;
   }
   if (!range) {
     return true;
   }
 
 #ifndef ENABLE_WASM_BULKMEM_OPS
   // Bulk memory must be available if shared memory is enabled.
-  if (!env->sharedMemoryEnabled) {
+  if (env->sharedMemoryEnabled == Shareable::False) {
     return d.fail("bulk memory ops disabled");
   }
 #endif
 
   uint32_t dataCount;
   if (!d.readVarU32(&dataCount)) {
     return d.fail("expected data segment count");
   }