diff --git a/js/src/wasm/WasmConstants.h b/js/src/wasm/WasmConstants.h index 2a9e97ef0529..140cb55495a5 100644 --- a/js/src/wasm/WasmConstants.h +++ b/js/src/wasm/WasmConstants.h @@ -578,9 +578,11 @@ static const unsigned MaxElemSegments = 10000000; static const unsigned MaxTableLength = 10000000; static const unsigned MaxLocals = 50000; static const unsigned MaxParams = 1000; -// The actual maximum results may be `1` if multi-value is not enabled. Check -// `env->funcMaxResults()` to get the correct value for a module. +#ifdef ENABLE_WASM_MULTI_VALUE static const unsigned MaxResults = 1000; +#else +static const unsigned MaxResults = 1; +#endif static const unsigned MaxStructFields = 1000; static const unsigned MaxMemoryMaximumPages = 65536; static const unsigned MaxStringBytes = 100000; diff --git a/js/src/wasm/WasmValidate.cpp b/js/src/wasm/WasmValidate.cpp index bd6a6dda0366..1b8cebc8547c 100644 --- a/js/src/wasm/WasmValidate.cpp +++ b/js/src/wasm/WasmValidate.cpp @@ -1328,7 +1328,7 @@ static bool DecodeFuncType(Decoder& d, ModuleEnvironment* env, if (!d.readVarU32(&numResults)) { return d.fail("bad number of function returns"); } - if (numResults > env->funcMaxResults()) { + if (numResults > MaxResults) { return d.fail("too many returns in signature"); } ValTypeVector results; diff --git a/js/src/wasm/WasmValidate.h b/js/src/wasm/WasmValidate.h index c7a2a5adb55d..cf82ef954666 100644 --- a/js/src/wasm/WasmValidate.h +++ b/js/src/wasm/WasmValidate.h @@ -224,9 +224,6 @@ struct ModuleEnvironment { bool hugeMemoryEnabled() const { return !isAsmJS() && compilerEnv->hugeMemory(); } - uint32_t funcMaxResults() const { - return multiValuesEnabled() ? MaxResults : 1; - } bool funcIsImport(uint32_t funcIndex) const { return funcIndex < funcImportGlobalDataOffsets.length(); }