diff --git a/js/src/wasm/WasmConstants.h b/js/src/wasm/WasmConstants.h index 73a1bbc2c350..ea759d47086a 100644 --- a/js/src/wasm/WasmConstants.h +++ b/js/src/wasm/WasmConstants.h @@ -86,6 +86,11 @@ enum class TypeCode { static constexpr TypeCode LowestPrimitiveTypeCode = TypeCode::V128; +// An arbitrary reference type used as the result of +// UnpackTypeCodeTypeAbstracted() when a value type is a reference. + +static constexpr TypeCode AbstractReferenceTypeCode = TypeCode::ExternRef; + enum class FuncTypeIdDescKind { None, Immediate, Global }; // A wasm::Trap represents a wasm-defined trap that can occur during execution diff --git a/js/src/wasm/WasmTypes.h b/js/src/wasm/WasmTypes.h index 2f9b2c6b96d9..07167df1abca 100644 --- a/js/src/wasm/WasmTypes.h +++ b/js/src/wasm/WasmTypes.h @@ -363,11 +363,11 @@ static inline uint32_t UnpackTypeCodeIndexUnchecked(PackedTypeCode ptc) { static inline TypeCode UnpackTypeCodeTypeAbstracted(PackedTypeCode ptc) { TypeCode c = UnpackTypeCodeType(ptc); - return c < LowestPrimitiveTypeCode ? TypeCode::OptRef : c; + return c < LowestPrimitiveTypeCode ? AbstractReferenceTypeCode : c; } static inline bool IsReferenceType(PackedTypeCode ptc) { - return UnpackTypeCodeTypeAbstracted(ptc) == TypeCode::OptRef; + return UnpackTypeCodeTypeAbstracted(ptc) == AbstractReferenceTypeCode; } // An enum that describes the representation classes for tables; The table @@ -488,7 +488,7 @@ class ValType { F32 = uint8_t(TypeCode::F32), F64 = uint8_t(TypeCode::F64), V128 = uint8_t(TypeCode::V128), - Ref = uint8_t(TypeCode::OptRef), + Ref = uint8_t(AbstractReferenceTypeCode), }; private: