зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1561521 - Add constant for abstracting reference-types values. r=lth
TypeCode::OptRef is currently used to represent any reference-typed value for UnpackTypeCodeTypeAbstracted and IsReferenceType. I think it's actually clearer to have this behind a named constant. Differential Revision: https://phabricator.services.mozilla.com/D85066
This commit is contained in:
Родитель
4d72ca080e
Коммит
f6c4069dce
|
@ -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
|
||||
|
|
|
@ -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:
|
||||
|
|
Загрузка…
Ссылка в новой задаче