Bug 1637564 - Conditionally compile reference-types global initializers. r=lth
authorRyan Hunt <rhunt@eqrion.net>
Wed, 13 May 2020 17:05:13 +0000
changeset 529690 454c02806bd2323e71e0d05ec5f892ab32caacb6
parent 529689 bcc9d956f49a9e58140943bbd5235e6d89bd4e74
child 529691 941aaea7104eb93ff0f767c7ced85152128f2590
push id37414
push usernbeleuzu@mozilla.com
push dateThu, 14 May 2020 02:40:10 +0000
treeherdermozilla-central@045d696faa87 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerslth
bugs1637564
milestone78.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 1637564 - Conditionally compile reference-types global initializers. r=lth We rejected ref.null/func when reference-types is disabled because we'll never get a reference-type value type. This commit moves this further to be conditionally compiled so we can use conditionally compiled reference-types code. Differential Revision: https://phabricator.services.mozilla.com/D75129
js/src/wasm/WasmValidate.cpp
--- a/js/src/wasm/WasmValidate.cpp
+++ b/js/src/wasm/WasmValidate.cpp
@@ -2275,16 +2275,17 @@ static bool DecodeInitializerExpression(
       V128 v128;
       if (!d.readFixedV128(&v128)) {
         return d.fail("failed to read initializer v128 expression");
       }
       *init = InitExpr::fromConstant(LitVal(v128));
       break;
     }
 #endif
+#ifdef ENABLE_WASM_REFTYPES
     case uint16_t(Op::RefNull): {
       MOZ_ASSERT_IF(env->isStructType(expected), env->gcTypesEnabled());
       RefType initType;
       if (!d.readRefType(env->types, env->gcTypesEnabled(), &initType)) {
         return false;
       }
       if (!expected.isReference() ||
           !env->isRefSubtypeOf(ValType(initType), ValType(expected))) {
@@ -2303,16 +2304,17 @@ static bool DecodeInitializerExpression(
       if (!d.readVarU32(&i)) {
         return d.fail(
             "failed to read ref.func index in initializer expression");
       }
       env->validForRefFunc.setBit(i);
       *init = InitExpr::fromRefFunc(i);
       break;
     }
+#endif
     case uint16_t(Op::GetGlobal): {
       uint32_t i;
       const GlobalDescVector& globals = env->globals;
       if (!d.readVarU32(&i)) {
         return d.fail(
             "failed to read global.get index in initializer expression");
       }
       if (i >= globals.length()) {