diff --git a/BUILD.gn b/BUILD.gn index 024740c429..769b8da429 100644 --- a/BUILD.gn +++ b/BUILD.gn @@ -557,7 +557,8 @@ if (v8_enable_static_roots == "") { assert(!v8_enable_static_roots || (v8_enable_pointer_compression && v8_enable_shared_ro_heap && v8_enable_pointer_compression_shared_cage && - v8_enable_webassembly && v8_enable_i18n_support), + v8_enable_external_code_space && v8_enable_webassembly && + v8_enable_i18n_support), "Trying to enable static roots in a configuration that is not supported") if (v8_enable_webassembly && !target_is_simulator && v8_current_cpu == "x64") { diff --git a/include/v8-value.h b/include/v8-value.h index 866da20124..d3208f17d2 100644 --- a/include/v8-value.h +++ b/include/v8-value.h @@ -344,6 +344,11 @@ class V8_EXPORT Value : public Data { */ bool IsWasmModuleObject() const; + /** + * Returns true if this value is the WasmNull object. + */ + bool IsWasmNull() const; + /** * Returns true if the value is a Module Namespace Object. */ diff --git a/src/api/api.cc b/src/api/api.cc index ee0ac18dc3..3f1fcc65c5 100644 --- a/src/api/api.cc +++ b/src/api/api.cc @@ -3827,9 +3827,11 @@ VALUE_IS_SPECIFIC_TYPE(Set, JSSet) #if V8_ENABLE_WEBASSEMBLY VALUE_IS_SPECIFIC_TYPE(WasmMemoryObject, WasmMemoryObject) VALUE_IS_SPECIFIC_TYPE(WasmModuleObject, WasmModuleObject) +VALUE_IS_SPECIFIC_TYPE(WasmNull, WasmNull) #else bool Value::IsWasmMemoryObject() const { return false; } bool Value::IsWasmModuleObject() const { return false; } +bool Value::IsWasmNull() const { return false; } #endif // V8_ENABLE_WEBASSEMBLY VALUE_IS_SPECIFIC_TYPE(WeakMap, JSWeakMap) VALUE_IS_SPECIFIC_TYPE(WeakSet, JSWeakSet) diff --git a/src/builtins/wasm.tq b/src/builtins/wasm.tq index e53e3c0a20..b9fff66c65 100644 --- a/src/builtins/wasm.tq +++ b/src/builtins/wasm.tq @@ -97,10 +97,10 @@ builtin WasmInt32ToHeapNumber(val: int32): HeapNumber { return AllocateHeapNumberWithValue(Convert(val)); } -builtin WasmFuncRefToJS(val: WasmInternalFunction|Null): JSFunction|Null| +builtin WasmFuncRefToJS(val: WasmInternalFunction|WasmNull): JSFunction|Null| Undefined { typeswitch (val) { - case (Null): { + case (WasmNull): { return Null; } case (func: WasmInternalFunction): { diff --git a/src/codegen/code-stub-assembler.h b/src/codegen/code-stub-assembler.h index 1890d37719..166e0d3576 100644 --- a/src/codegen/code-stub-assembler.h +++ b/src/codegen/code-stub-assembler.h @@ -186,6 +186,7 @@ enum class PrimitiveType { kBoolean, kNumber, kString, kSymbol }; V(NoClosuresCellMap, no_closures_cell_map, NoClosuresCellMap) \ V(null_to_string, null_to_string, NullToString) \ V(NullValue, null_value, Null) \ + IF_WASM(V, WasmNull, wasm_null, WasmNull) \ V(number_string, number_string, NumberString) \ V(number_to_string, number_to_string, NumberToString) \ V(Object_string, Object_string, ObjectString) \ diff --git a/src/compiler/common-operator.cc b/src/compiler/common-operator.cc index c12604eba8..a763595f7e 100644 --- a/src/compiler/common-operator.cc +++ b/src/compiler/common-operator.cc @@ -55,15 +55,8 @@ std::ostream& operator<<(std::ostream& os, TrapId trap_id) { } TrapId TrapIdOf(const Operator* const op) { -#if V8_ENABLE_WEBASSEMBLY - // Combining this with the #else into a single DCHECK() does not with MSVC. - DCHECK(op->opcode() == IrOpcode::kTrapIf || - op->opcode() == IrOpcode::kTrapUnless || - op->opcode() == IrOpcode::kAssertNotNull); -#else DCHECK(op->opcode() == IrOpcode::kTrapIf || op->opcode() == IrOpcode::kTrapUnless); -#endif return OpParameter(op); } diff --git a/src/compiler/simplified-operator.cc b/src/compiler/simplified-operator.cc index be1dba82cd..40fed56ec1 100644 --- a/src/compiler/simplified-operator.cc +++ b/src/compiler/simplified-operator.cc @@ -740,6 +740,22 @@ bool operator==(CheckMinusZeroParameters const& lhs, return lhs.mode() == rhs.mode() && lhs.feedback() == rhs.feedback(); } +#if V8_ENABLE_WEBASSEMBLY +V8_EXPORT_PRIVATE std::ostream& operator<<( + std::ostream& os, AssertNotNullParameters const& params) { + return os << params.type << ", " << params.trap_id; +} + +size_t hash_value(AssertNotNullParameters const& params) { + return base::hash_combine(params.type, params.trap_id); +} + +bool operator==(AssertNotNullParameters const& lhs, + AssertNotNullParameters const& rhs) { + return lhs.type == rhs.type && lhs.trap_id == rhs.trap_id; +} +#endif + #define PURE_OP_LIST(V) \ V(BooleanNot, Operator::kNoProperties, 1, 0) \ V(NumberEqual, Operator::kCommutative, 2, 0) \ @@ -1238,40 +1254,6 @@ struct SimplifiedOperatorGlobalCache final { LoadStackArgumentOperator kLoadStackArgument; #if V8_ENABLE_WEBASSEMBLY - // Note: The following two operators have a control input solely to find the - // typing context from the control path in wasm-gc-operator-reducer. - struct IsNullOperator final : public Operator { - IsNullOperator() - : Operator(IrOpcode::kIsNull, Operator::kPure, "IsNull", 1, 0, 1, 1, 0, - 0) {} - }; - IsNullOperator kIsNull; - - struct IsNotNullOperator final : public Operator { - IsNotNullOperator() - : Operator(IrOpcode::kIsNotNull, Operator::kPure, "IsNotNull", 1, 0, 1, - 1, 0, 0) {} - }; - IsNotNullOperator kIsNotNull; - - struct NullOperator final : public Operator { - NullOperator() - : Operator(IrOpcode::kNull, Operator::kPure, "Null", 0, 0, 0, 1, 0, 0) { - } - }; - NullOperator kNull; - - struct AssertNotNullOperator final : public Operator1 { - explicit AssertNotNullOperator(TrapId trap_id) - : Operator1( - IrOpcode::kAssertNotNull, - Operator::kNoWrite | Operator::kNoThrow | Operator::kIdempotent, - "AssertNotNull", 1, 1, 1, 1, 1, 1, trap_id) {} - }; - AssertNotNullOperator kAssertNotNullIllegalCast{TrapId::kTrapIllegalCast}; - AssertNotNullOperator kAssertNotNullNullDereference{ - TrapId::kTrapNullDereference}; - struct WasmArrayLengthOperator final : public Operator { WasmArrayLengthOperator() : Operator(IrOpcode::kWasmArrayLength, Operator::kEliminatable, @@ -1517,22 +1499,48 @@ const Operator* SimplifiedOperatorBuilder::RttCanon(int index) { "RttCanon", 0, 0, 0, 1, 0, 0, index); } -const Operator* SimplifiedOperatorBuilder::Null() { return &cache_.kNull; } +// Note: The following two operators have a control input solely to find the +// typing context from the control path in wasm-gc-operator-reducer. +struct IsNullOperator final : public Operator1 { + explicit IsNullOperator(wasm::ValueType type) + : Operator1(IrOpcode::kIsNull, Operator::kPure, "IsNull", 1, 0, 1, 1, 0, + 0, type) {} +}; -const Operator* SimplifiedOperatorBuilder::AssertNotNull(TrapId trap_id) { - switch (trap_id) { - case TrapId::kTrapNullDereference: - return &cache_.kAssertNotNullNullDereference; - case TrapId::kTrapIllegalCast: - return &cache_.kAssertNotNullIllegalCast; - default: - UNREACHABLE(); - } +struct IsNotNullOperator final : public Operator1 { + explicit IsNotNullOperator(wasm::ValueType type) + : Operator1(IrOpcode::kIsNotNull, Operator::kPure, "IsNotNull", 1, 0, 1, + 1, 0, 0, type) {} +}; + +struct NullOperator final : public Operator1 { + explicit NullOperator(wasm::ValueType type) + : Operator1(IrOpcode::kNull, Operator::kPure, "Null", 0, 0, 0, 1, 0, 0, + type) {} +}; + +struct AssertNotNullOperator final : public Operator1 { + explicit AssertNotNullOperator(wasm::ValueType type, TrapId trap_id) + : Operator1( + IrOpcode::kAssertNotNull, + Operator::kNoWrite | Operator::kNoThrow | Operator::kIdempotent, + "AssertNotNull", 1, 1, 1, 1, 1, 1, {type, trap_id}) {} +}; + +const Operator* SimplifiedOperatorBuilder::Null(wasm::ValueType type) { + return zone()->New(type); } -const Operator* SimplifiedOperatorBuilder::IsNull() { return &cache_.kIsNull; } -const Operator* SimplifiedOperatorBuilder::IsNotNull() { - return &cache_.kIsNotNull; +const Operator* SimplifiedOperatorBuilder::AssertNotNull(wasm::ValueType type, + TrapId trap_id) { + return zone()->New(type, trap_id); +} + +const Operator* SimplifiedOperatorBuilder::IsNull(wasm::ValueType type) { + return zone()->New(type); +} +const Operator* SimplifiedOperatorBuilder::IsNotNull(wasm::ValueType type) { + return zone()->New(type); } const Operator* SimplifiedOperatorBuilder::StringAsWtf16() { diff --git a/src/compiler/simplified-operator.h b/src/compiler/simplified-operator.h index 52dbcbab49..97931d65de 100644 --- a/src/compiler/simplified-operator.h +++ b/src/compiler/simplified-operator.h @@ -743,6 +743,21 @@ size_t hash_value(FastApiCallParameters const&); bool operator==(FastApiCallParameters const&, FastApiCallParameters const&); +#if V8_ENABLE_WEBASSEMBLY +struct AssertNotNullParameters { + wasm::ValueType type; + TrapId trap_id; +}; + +V8_EXPORT_PRIVATE std::ostream& operator<<(std::ostream&, + AssertNotNullParameters const&); + +size_t hash_value(AssertNotNullParameters const&); + +bool operator==(AssertNotNullParameters const&, AssertNotNullParameters const&); + +#endif + // Interface for building simplified operators, which represent the // medium-level operations of V8, including adding numbers, allocating objects, // indexing into objects and arrays, etc. @@ -1146,10 +1161,10 @@ class V8_EXPORT_PRIVATE SimplifiedOperatorBuilder final const Operator* CheckTurboshaftTypeOf(); #if V8_ENABLE_WEBASSEMBLY - const Operator* AssertNotNull(TrapId trap_id); - const Operator* IsNull(); - const Operator* IsNotNull(); - const Operator* Null(); + const Operator* AssertNotNull(wasm::ValueType type, TrapId trap_id); + const Operator* IsNull(wasm::ValueType type); + const Operator* IsNotNull(wasm::ValueType type); + const Operator* Null(wasm::ValueType type); const Operator* RttCanon(int index); const Operator* WasmTypeCheck(WasmTypeCheckConfig config); const Operator* WasmTypeCast(WasmTypeCheckConfig config); diff --git a/src/compiler/wasm-compiler.cc b/src/compiler/wasm-compiler.cc index 21a3f6da00..8d3b5742eb 100644 --- a/src/compiler/wasm-compiler.cc +++ b/src/compiler/wasm-compiler.cc @@ -278,10 +278,12 @@ Node* WasmGraphBuilder::EffectPhi(unsigned count, Node** effects_and_control) { effects_and_control); } -Node* WasmGraphBuilder::RefNull() { +Node* WasmGraphBuilder::RefNull(wasm::ValueType type) { return (v8_flags.experimental_wasm_gc && parameter_mode_ == kInstanceMode) - ? gasm_->Null() - : LOAD_ROOT(NullValue, null_value); + ? gasm_->Null(type) + : (type == wasm::kWasmExternRef || type == wasm::kWasmNullExternRef) + ? LOAD_ROOT(NullValue, null_value) + : LOAD_ROOT(WasmNull, wasm_null); } Node* WasmGraphBuilder::RefFunc(uint32_t function_index) { @@ -752,6 +754,7 @@ Node* WasmGraphBuilder::Binop(wasm::WasmOpcode opcode, Node* left, Node* right, } Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input, + wasm::ValueType type, wasm::WasmCodePosition position) { const Operator* op; MachineOperatorBuilder* m = mcgraph()->machine(); @@ -1013,11 +1016,11 @@ Node* WasmGraphBuilder::Unop(wasm::WasmOpcode opcode, Node* input, ? BuildCcallConvertFloat(input, position, opcode) : BuildIntConvertFloat(input, position, opcode); case wasm::kExprRefIsNull: - return IsNull(input); + return IsNull(input, type); // We abuse ref.as_non_null, which isn't otherwise used in this switch, as // a sentinel for the negation of ref.is_null. case wasm::kExprRefAsNonNull: - return gasm_->Int32Sub(gasm_->Int32Constant(1), IsNull(input)); + return gasm_->Word32Equal(gasm_->Int32Constant(0), IsNull(input, type)); case wasm::kExprI32AsmjsLoadMem8S: return BuildAsmjsLoadMem(MachineType::Int8(), input); case wasm::kExprI32AsmjsLoadMem8U: @@ -1144,11 +1147,11 @@ void WasmGraphBuilder::TrapIfFalse(wasm::TrapReason reason, Node* cond, SetSourcePosition(control(), position); } -Node* WasmGraphBuilder::AssertNotNull(Node* object, +Node* WasmGraphBuilder::AssertNotNull(Node* object, wasm::ValueType type, wasm::WasmCodePosition position, wasm::TrapReason reason) { TrapId trap_id = GetTrapIdForTrap(reason); - Node* result = gasm_->AssertNotNull(object, trap_id); + Node* result = gasm_->AssertNotNull(object, type, trap_id); SetSourcePosition(result, position); return result; } @@ -2608,10 +2611,10 @@ Node* WasmGraphBuilder::BuildDiv64Call(Node* left, Node* right, return gasm_->Load(result_type, stack_slot, 0); } -Node* WasmGraphBuilder::IsNull(Node* object) { +Node* WasmGraphBuilder::IsNull(Node* object, wasm::ValueType type) { return (v8_flags.experimental_wasm_gc && parameter_mode_ == kInstanceMode) - ? gasm_->IsNull(object) - : gasm_->TaggedEqual(object, RefNull()); + ? gasm_->IsNull(object, type) + : gasm_->TaggedEqual(object, RefNull(type)); } template @@ -2985,7 +2988,8 @@ Node* WasmGraphBuilder::BuildCallRef(const wasm::FunctionSig* sig, IsReturnCall continuation, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - args[0] = AssertNotNull(args[0], position); + args[0] = + AssertNotNull(args[0], wasm::kWasmFuncRef /* good enough */, position); } Node* function = args[0]; @@ -3091,9 +3095,9 @@ Node* WasmGraphBuilder::ReturnCallIndirect(uint32_t table_index, kReturnCall); } -void WasmGraphBuilder::BrOnNull(Node* ref_object, Node** null_node, - Node** non_null_node) { - BranchExpectFalse(IsNull(ref_object), null_node, non_null_node); +void WasmGraphBuilder::BrOnNull(Node* ref_object, wasm::ValueType type, + Node** null_node, Node** non_null_node) { + BranchExpectFalse(IsNull(ref_object, type), null_node, non_null_node); } Node* WasmGraphBuilder::BuildI32Rol(Node* left, Node* right) { @@ -5259,7 +5263,7 @@ Node* WasmGraphBuilder::DefaultValue(wasm::ValueType type) { case wasm::kS128: return S128Zero(); case wasm::kRefNull: - return RefNull(); + return RefNull(type); case wasm::kRtt: case wasm::kVoid: case wasm::kBottom: @@ -5363,8 +5367,9 @@ Node* WasmGraphBuilder::ArrayNew(uint32_t array_index, mcgraph()->machine()->BitcastFloat64ToInt64(), initial_value); break; case wasm::kRefNull: - initial_value_i64 = - initial_value == nullptr ? gasm_->Null() : initial_value; + initial_value_i64 = initial_value == nullptr + ? gasm_->Null(type->element_type()) + : initial_value; if (kSystemPointerSize == 4) { initial_value_i64 = graph()->NewNode( mcgraph()->machine()->ChangeInt32ToInt64(), initial_value_i64); @@ -5511,9 +5516,10 @@ void WasmGraphBuilder::EqCheck(Node* object, bool object_can_be_null, // TODO(7748): Is the extra null check actually beneficial for performance? if (object_can_be_null) { if (null_succeeds) { - callbacks.succeed_if(IsNull(object), BranchHint::kFalse); + callbacks.succeed_if(IsNull(object, wasm::kWasmAnyRef), + BranchHint::kFalse); } else { - callbacks.fail_if(IsNull(object), BranchHint::kFalse); + callbacks.fail_if(IsNull(object, wasm::kWasmAnyRef), BranchHint::kFalse); } } callbacks.succeed_if(gasm_->IsI31(object), BranchHint::kFalse); @@ -5528,9 +5534,10 @@ void WasmGraphBuilder::ManagedObjectInstanceCheck(Node* object, bool null_succeeds) { if (object_can_be_null) { if (null_succeeds) { - callbacks.succeed_if(IsNull(object), BranchHint::kFalse); + callbacks.succeed_if(IsNull(object, wasm::kWasmAnyRef), + BranchHint::kFalse); } else { - callbacks.fail_if(IsNull(object), BranchHint::kFalse); + callbacks.fail_if(IsNull(object, wasm::kWasmAnyRef), BranchHint::kFalse); } } callbacks.fail_if(gasm_->IsI31(object), BranchHint::kFalse); @@ -5599,7 +5606,7 @@ Node* WasmGraphBuilder::RefTestAbstract(Node* object, wasm::HeapType type, case wasm::HeapType::kNoExtern: case wasm::HeapType::kNoFunc: DCHECK(null_succeeds); - return IsNull(object); + return IsNull(object, wasm::ValueType::RefNull(type)); case wasm::HeapType::kAny: // Any may never need a cast as it is either implicitly convertible or // never convertible for any given type. @@ -5632,7 +5639,8 @@ Node* WasmGraphBuilder::RefCastAbstract(Node* object, wasm::HeapType type, case wasm::HeapType::kNoExtern: case wasm::HeapType::kNoFunc: { DCHECK(null_succeeds); - TrapIfFalse(wasm::kTrapIllegalCast, IsNull(object), position); + TrapIfFalse(wasm::kTrapIllegalCast, + IsNull(object, wasm::ValueType::RefNull(type)), position); return object; } case wasm::HeapType::kAny: @@ -5686,10 +5694,10 @@ void WasmGraphBuilder::BrOnEq(Node* object, Node* /*rtt*/, [=](Callbacks callbacks) -> void { if (config.from.is_nullable()) { if (config.to.is_nullable()) { - callbacks.succeed_if(gasm_->IsNull(object), + callbacks.succeed_if(gasm_->IsNull(object, config.from), BranchHint::kFalse); } else { - callbacks.fail_if(gasm_->IsNull(object), + callbacks.fail_if(gasm_->IsNull(object, config.from), BranchHint::kFalse); } } @@ -5775,7 +5783,7 @@ Node* WasmGraphBuilder::RefIsI31(Node* object, bool null_succeeds) { auto done = gasm_->MakeLabel(MachineRepresentation::kWord32); gasm_->GotoIf(gasm_->IsI31(object), &done, BranchHint::kTrue, Int32Constant(1)); - gasm_->Goto(&done, gasm_->IsNull(object)); + gasm_->Goto(&done, gasm_->IsNull(object, wasm::kWasmAnyRef)); gasm_->Bind(&done); return done.PhiAt(0); } @@ -5786,7 +5794,7 @@ Node* WasmGraphBuilder::RefAsI31(Node* object, wasm::WasmCodePosition position, bool null_succeeds) { if (null_succeeds) { auto done = gasm_->MakeLabel(); - gasm_->GotoIf(gasm_->IsNull(object), &done); + gasm_->GotoIf(gasm_->IsNull(object, wasm::kWasmAnyRef), &done); TrapIfFalse(wasm::kTrapIllegalCast, gasm_->IsI31(object), position); gasm_->Goto(&done); gasm_->Bind(&done); @@ -5805,9 +5813,11 @@ void WasmGraphBuilder::BrOnI31(Node* object, Node* /* rtt */, [=](Callbacks callbacks) -> void { if (config.from.is_nullable()) { if (config.to.is_nullable()) { - callbacks.succeed_if(gasm_->IsNull(object), BranchHint::kFalse); + callbacks.succeed_if(gasm_->IsNull(object, config.from), + BranchHint::kFalse); } else { - callbacks.fail_if(gasm_->IsNull(object), BranchHint::kFalse); + callbacks.fail_if(gasm_->IsNull(object, config.from), + BranchHint::kFalse); } } callbacks.fail_if_not(gasm_->IsI31(object), BranchHint::kTrue); @@ -5827,7 +5837,8 @@ Node* WasmGraphBuilder::StructGet(Node* struct_object, bool is_signed, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - struct_object = AssertNotNull(struct_object, position); + struct_object = + AssertNotNull(struct_object, wasm::kWasmStructRef, position); } return gasm_->StructGet(struct_object, struct_type, field_index, is_signed); } @@ -5838,7 +5849,8 @@ void WasmGraphBuilder::StructSet(Node* struct_object, CheckForNull null_check, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - struct_object = AssertNotNull(struct_object, position); + struct_object = + AssertNotNull(struct_object, wasm::kWasmStructRef, position); } gasm_->StructSet(struct_object, field_value, struct_type, field_index); } @@ -5868,7 +5880,7 @@ Node* WasmGraphBuilder::ArrayGet(Node* array_object, CheckForNull null_check, bool is_signed, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - array_object = AssertNotNull(array_object, position); + array_object = AssertNotNull(array_object, wasm::kWasmArrayRef, position); } BoundsCheckArray(array_object, index, position); return gasm_->ArrayGet(array_object, index, type, is_signed); @@ -5879,7 +5891,7 @@ void WasmGraphBuilder::ArraySet(Node* array_object, const wasm::ArrayType* type, CheckForNull null_check, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - array_object = AssertNotNull(array_object, position); + array_object = AssertNotNull(array_object, wasm::kWasmArrayRef, position); } BoundsCheckArray(array_object, index, position); gasm_->ArraySet(array_object, index, value, type); @@ -5888,7 +5900,7 @@ void WasmGraphBuilder::ArraySet(Node* array_object, const wasm::ArrayType* type, Node* WasmGraphBuilder::ArrayLen(Node* array_object, CheckForNull null_check, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - array_object = AssertNotNull(array_object, position); + array_object = AssertNotNull(array_object, wasm::kWasmArrayRef, position); } return gasm_->ArrayLength(array_object); } @@ -5901,10 +5913,10 @@ void WasmGraphBuilder::ArrayCopy(Node* dst_array, Node* dst_index, Node* length, wasm::WasmCodePosition position) { if (dst_null_check == kWithNullCheck) { - dst_array = AssertNotNull(dst_array, position); + dst_array = AssertNotNull(dst_array, wasm::kWasmArrayRef, position); } if (src_null_check == kWithNullCheck) { - src_array = AssertNotNull(src_array, position); + src_array = AssertNotNull(src_array, wasm::kWasmArrayRef, position); } BoundsCheckArrayCopy(dst_array, dst_index, length, position); BoundsCheckArrayCopy(src_array, src_index, length, position); @@ -5976,7 +5988,7 @@ Node* WasmGraphBuilder::StringConst(uint32_t index) { Node* WasmGraphBuilder::StringMeasureUtf8(Node* string, CheckForNull null_check, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringMeasureUtf8, Operator::kEliminatable, string); @@ -5985,7 +5997,7 @@ Node* WasmGraphBuilder::StringMeasureUtf8(Node* string, CheckForNull null_check, Node* WasmGraphBuilder::StringMeasureWtf8(Node* string, CheckForNull null_check, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringMeasureWtf8, Operator::kEliminatable, string); @@ -5995,7 +6007,7 @@ Node* WasmGraphBuilder::StringMeasureWtf16(Node* string, CheckForNull null_check, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } return gasm_->LoadImmutableFromObject( MachineType::Int32(), string, @@ -6008,7 +6020,7 @@ Node* WasmGraphBuilder::StringEncodeWtf8(uint32_t memory, Node* offset, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringEncodeWtf8, Operator::kNoDeopt | Operator::kNoThrow, string, @@ -6021,10 +6033,10 @@ Node* WasmGraphBuilder::StringEncodeWtf8Array( Node* array, CheckForNull array_null_check, Node* start, wasm::WasmCodePosition position) { if (string_null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } if (array_null_check == kWithNullCheck) { - array = AssertNotNull(array, position); + array = AssertNotNull(array, wasm::kWasmArrayRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringEncodeWtf8Array, Operator::kNoDeopt | Operator::kNoThrow, string, @@ -6036,7 +6048,7 @@ Node* WasmGraphBuilder::StringEncodeWtf16(uint32_t memory, Node* string, CheckForNull null_check, Node* offset, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringEncodeWtf16, Operator::kNoDeopt | Operator::kNoThrow, string, @@ -6046,7 +6058,7 @@ Node* WasmGraphBuilder::StringEncodeWtf16(uint32_t memory, Node* string, Node* WasmGraphBuilder::StringAsWtf16(Node* string, CheckForNull null_check, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } return gasm_->StringAsWtf16(string); } @@ -6056,10 +6068,10 @@ Node* WasmGraphBuilder::StringEncodeWtf16Array( CheckForNull array_null_check, Node* start, wasm::WasmCodePosition position) { if (string_null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } if (array_null_check == kWithNullCheck) { - array = AssertNotNull(array, position); + array = AssertNotNull(array, wasm::kWasmArrayRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringEncodeWtf16Array, Operator::kNoDeopt | Operator::kNoThrow, string, @@ -6069,8 +6081,12 @@ Node* WasmGraphBuilder::StringEncodeWtf16Array( Node* WasmGraphBuilder::StringConcat(Node* head, CheckForNull head_null_check, Node* tail, CheckForNull tail_null_check, wasm::WasmCodePosition position) { - if (head_null_check == kWithNullCheck) head = AssertNotNull(head, position); - if (tail_null_check == kWithNullCheck) tail = AssertNotNull(tail, position); + if (head_null_check == kWithNullCheck) { + head = AssertNotNull(head, wasm::kWasmStringRef, position); + } + if (tail_null_check == kWithNullCheck) { + tail = AssertNotNull(tail, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin( Builtin::kStringAdd_CheckNone, Operator::kNoDeopt | Operator::kNoThrow, head, tail, @@ -6084,10 +6100,12 @@ Node* WasmGraphBuilder::StringEqual(Node* a, CheckForNull a_null_check, Node* b, // Covers "identical string pointer" and "both are null" cases. gasm_->GotoIf(gasm_->TaggedEqual(a, b), &done, Int32Constant(1)); if (a_null_check == kWithNullCheck) { - gasm_->GotoIf(gasm_->IsNull(a), &done, Int32Constant(0)); + gasm_->GotoIf(gasm_->IsNull(a, wasm::kWasmStringRef), &done, + Int32Constant(0)); } if (b_null_check == kWithNullCheck) { - gasm_->GotoIf(gasm_->IsNull(b), &done, Int32Constant(0)); + gasm_->GotoIf(gasm_->IsNull(b, wasm::kWasmStringRef), &done, + Int32Constant(0)); } gasm_->Goto(&done, gasm_->CallBuiltin(Builtin::kWasmStringEqual, Operator::kEliminatable, a, b)); @@ -6097,7 +6115,9 @@ Node* WasmGraphBuilder::StringEqual(Node* a, CheckForNull a_null_check, Node* b, Node* WasmGraphBuilder::StringIsUSVSequence(Node* str, CheckForNull null_check, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) str = AssertNotNull(str, position); + if (null_check == kWithNullCheck) { + str = AssertNotNull(str, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin(Builtin::kWasmStringIsUSVSequence, Operator::kEliminatable, str); @@ -6105,7 +6125,9 @@ Node* WasmGraphBuilder::StringIsUSVSequence(Node* str, CheckForNull null_check, Node* WasmGraphBuilder::StringAsWtf8(Node* str, CheckForNull null_check, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) str = AssertNotNull(str, position); + if (null_check == kWithNullCheck) { + str = AssertNotNull(str, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin(Builtin::kWasmStringAsWtf8, Operator::kEliminatable, str); @@ -6115,7 +6137,9 @@ Node* WasmGraphBuilder::StringViewWtf8Advance(Node* view, CheckForNull null_check, Node* pos, Node* bytes, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) view = AssertNotNull(view, position); + if (null_check == kWithNullCheck) { + view = AssertNotNull(view, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin(Builtin::kWasmStringViewWtf8Advance, Operator::kEliminatable, view, pos, bytes); @@ -6126,7 +6150,7 @@ void WasmGraphBuilder::StringViewWtf8Encode( CheckForNull null_check, Node* addr, Node* pos, Node* bytes, Node** next_pos, Node** bytes_written, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - view = AssertNotNull(view, position); + view = AssertNotNull(view, wasm::kWasmStringRef, position); } Node* pair = gasm_->CallBuiltin(Builtin::kWasmStringViewWtf8Encode, @@ -6141,7 +6165,7 @@ Node* WasmGraphBuilder::StringViewWtf8Slice(Node* view, CheckForNull null_check, Node* pos, Node* bytes, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - view = AssertNotNull(view, position); + view = AssertNotNull(view, wasm::kWasmStringRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringViewWtf8Slice, Operator::kEliminatable, view, pos, bytes); @@ -6151,7 +6175,7 @@ Node* WasmGraphBuilder::StringViewWtf16GetCodeUnit( Node* string, CheckForNull null_check, Node* offset, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } Node* prepare = gasm_->StringPrepareForGetCodeunit(string); Node* base = gasm_->Projection(0, prepare); @@ -6211,7 +6235,7 @@ Node* WasmGraphBuilder::StringViewWtf16Encode(uint32_t memory, Node* string, Node* codeunits, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringViewWtf16Encode, Operator::kNoDeopt | Operator::kNoThrow, offset, @@ -6224,7 +6248,7 @@ Node* WasmGraphBuilder::StringViewWtf16Slice(Node* string, Node* start, Node* end, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } return gasm_->CallBuiltin(Builtin::kWasmStringViewWtf16Slice, Operator::kEliminatable, string, start, end); @@ -6232,7 +6256,9 @@ Node* WasmGraphBuilder::StringViewWtf16Slice(Node* string, Node* WasmGraphBuilder::StringAsIter(Node* str, CheckForNull null_check, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) str = AssertNotNull(str, position); + if (null_check == kWithNullCheck) { + str = AssertNotNull(str, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin(Builtin::kWasmStringAsIter, Operator::kEliminatable, str); @@ -6240,7 +6266,9 @@ Node* WasmGraphBuilder::StringAsIter(Node* str, CheckForNull null_check, Node* WasmGraphBuilder::StringViewIterNext(Node* view, CheckForNull null_check, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) view = AssertNotNull(view, position); + if (null_check == kWithNullCheck) { + view = AssertNotNull(view, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin(Builtin::kWasmStringViewIterNext, Operator::kEliminatable, view); @@ -6250,7 +6278,9 @@ Node* WasmGraphBuilder::StringViewIterAdvance(Node* view, CheckForNull null_check, Node* codepoints, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) view = AssertNotNull(view, position); + if (null_check == kWithNullCheck) { + view = AssertNotNull(view, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin(Builtin::kWasmStringViewIterAdvance, Operator::kEliminatable, view, codepoints); @@ -6260,7 +6290,9 @@ Node* WasmGraphBuilder::StringViewIterRewind(Node* view, CheckForNull null_check, Node* codepoints, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) view = AssertNotNull(view, position); + if (null_check == kWithNullCheck) { + view = AssertNotNull(view, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin(Builtin::kWasmStringViewIterRewind, Operator::kEliminatable, view, codepoints); @@ -6269,7 +6301,9 @@ Node* WasmGraphBuilder::StringViewIterRewind(Node* view, Node* WasmGraphBuilder::StringViewIterSlice(Node* view, CheckForNull null_check, Node* codepoints, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) view = AssertNotNull(view, position); + if (null_check == kWithNullCheck) { + view = AssertNotNull(view, wasm::kWasmStringRef, position); + } return gasm_->CallBuiltin(Builtin::kWasmStringViewIterSlice, Operator::kEliminatable, view, codepoints); @@ -6278,8 +6312,12 @@ Node* WasmGraphBuilder::StringViewIterSlice(Node* view, CheckForNull null_check, Node* WasmGraphBuilder::StringCompare(Node* lhs, CheckForNull null_check_lhs, Node* rhs, CheckForNull null_check_rhs, wasm::WasmCodePosition position) { - if (null_check_lhs == kWithNullCheck) lhs = AssertNotNull(lhs, position); - if (null_check_rhs == kWithNullCheck) rhs = AssertNotNull(rhs, position); + if (null_check_lhs == kWithNullCheck) { + lhs = AssertNotNull(lhs, wasm::kWasmStringRef, position); + } + if (null_check_rhs == kWithNullCheck) { + rhs = AssertNotNull(rhs, wasm::kWasmStringRef, position); + } return gasm_->BuildChangeSmiToInt32(gasm_->CallBuiltin( Builtin::kWasmStringCompare, Operator::kEliminatable, lhs, rhs)); } @@ -6292,7 +6330,7 @@ Node* WasmGraphBuilder::StringFromCodePoint(Node* code_point) { Node* WasmGraphBuilder::StringHash(Node* string, CheckForNull null_check, wasm::WasmCodePosition position) { if (null_check == kWithNullCheck) { - string = AssertNotNull(string, position); + string = AssertNotNull(string, wasm::kWasmStringRef, position); } auto runtime_label = gasm_->MakeLabel(); @@ -6341,7 +6379,9 @@ Node* WasmGraphBuilder::I31New(Node* input) { Node* WasmGraphBuilder::I31GetS(Node* input, CheckForNull null_check, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) input = AssertNotNull(input, position); + if (null_check == kWithNullCheck) { + input = AssertNotNull(input, wasm::kWasmI31Ref, position); + } if constexpr (SmiValuesAre31Bits()) { input = gasm_->BuildTruncateIntPtrToInt32(input); return gasm_->Word32SarShiftOutZeros(input, @@ -6356,7 +6396,9 @@ Node* WasmGraphBuilder::I31GetS(Node* input, CheckForNull null_check, Node* WasmGraphBuilder::I31GetU(Node* input, CheckForNull null_check, wasm::WasmCodePosition position) { - if (null_check == kWithNullCheck) input = AssertNotNull(input, position); + if (null_check == kWithNullCheck) { + input = AssertNotNull(input, wasm::kWasmI31Ref, position); + } if constexpr (SmiValuesAre31Bits()) { input = gasm_->BuildTruncateIntPtrToInt32(input); return gasm_->Word32Shr(input, gasm_->BuildSmiShiftBitsConstant32()); @@ -6593,63 +6635,80 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { case wasm::kF64: return BuildChangeFloat64ToNumber(node); case wasm::kRef: + switch (type.heap_representation()) { + case wasm::HeapType::kEq: + case wasm::HeapType::kI31: + case wasm::HeapType::kStruct: + case wasm::HeapType::kArray: + case wasm::HeapType::kAny: + case wasm::HeapType::kExtern: + case wasm::HeapType::kString: + case wasm::HeapType::kNone: + case wasm::HeapType::kNoFunc: + case wasm::HeapType::kNoExtern: + return node; + case wasm::HeapType::kBottom: + case wasm::HeapType::kStringViewWtf8: + case wasm::HeapType::kStringViewWtf16: + case wasm::HeapType::kStringViewIter: + UNREACHABLE(); + case wasm::HeapType::kFunc: + default: + if (type.heap_representation() == wasm::HeapType::kFunc || + module_->has_signature(type.ref_index())) { + // Typed function. Extract the external function. + return gasm_->LoadFromObject( + MachineType::TaggedPointer(), node, + wasm::ObjectAccess::ToTagged( + WasmInternalFunction::kExternalOffset)); + } else { + return node; + } + } case wasm::kRefNull: switch (type.heap_representation()) { - case wasm::HeapType::kFunc: { - if (type.kind() == wasm::kRefNull) { + case wasm::HeapType::kExtern: + case wasm::HeapType::kNoExtern: + return node; + case wasm::HeapType::kNone: + case wasm::HeapType::kNoFunc: + return LOAD_ROOT(NullValue, null_value); + case wasm::HeapType::kEq: + case wasm::HeapType::kStruct: + case wasm::HeapType::kArray: + case wasm::HeapType::kString: + case wasm::HeapType::kI31: + case wasm::HeapType::kAny: { + auto done = gasm_->MakeLabel(MachineRepresentation::kTaggedPointer); + gasm_->GotoIfNot(IsNull(node, type), &done, node); + gasm_->Goto(&done, LOAD_ROOT(NullValue, null_value)); + gasm_->Bind(&done); + return done.PhiAt(0); + } + case wasm::HeapType::kFunc: + default: { + if (type == wasm::kWasmFuncRef || + module_->has_signature(type.ref_index())) { auto done = gasm_->MakeLabel(MachineRepresentation::kTaggedPointer); - // Null gets passed as-is. - gasm_->GotoIf(IsNull(node), &done, node); + auto null_label = gasm_->MakeLabel(); + gasm_->GotoIf(IsNull(node, type), &null_label); gasm_->Goto(&done, gasm_->LoadFromObject( MachineType::TaggedPointer(), node, wasm::ObjectAccess::ToTagged( WasmInternalFunction::kExternalOffset))); + gasm_->Bind(&null_label); + gasm_->Goto(&done, LOAD_ROOT(NullValue, null_value)); gasm_->Bind(&done); return done.PhiAt(0); } else { - return gasm_->LoadFromObject( - MachineType::TaggedPointer(), node, - wasm::ObjectAccess::ToTagged( - WasmInternalFunction::kExternalOffset)); - } - } - case wasm::HeapType::kEq: - case wasm::HeapType::kStruct: - case wasm::HeapType::kArray: - case wasm::HeapType::kString: - case wasm::HeapType::kExtern: - case wasm::HeapType::kAny: - case wasm::HeapType::kNone: - case wasm::HeapType::kNoFunc: - case wasm::HeapType::kNoExtern: - case wasm::HeapType::kI31: - return node; - default: { - DCHECK(type.has_index()); - if (module_->has_signature(type.ref_index())) { - // Typed function. Extract the external function. - if (type.kind() == wasm::kRefNull) { - auto done = - gasm_->MakeLabel(MachineRepresentation::kTaggedPointer); - // Null gets passed as-is. - gasm_->GotoIf(IsNull(node), &done, node); - gasm_->Goto(&done, - gasm_->LoadFromObject( - MachineType::TaggedPointer(), node, - wasm::ObjectAccess::ToTagged( - WasmInternalFunction::kExternalOffset))); - gasm_->Bind(&done); - return done.PhiAt(0); - } else { - return gasm_->LoadFromObject( - MachineType::TaggedPointer(), node, - wasm::ObjectAccess::ToTagged( - WasmInternalFunction::kExternalOffset)); - } - } else { - return node; + auto done = + gasm_->MakeLabel(MachineRepresentation::kTaggedPointer); + gasm_->GotoIfNot(IsNull(node, type), &done, node); + gasm_->Goto(&done, LOAD_ROOT(NullValue, null_value)); + gasm_->Bind(&done); + return done.PhiAt(0); } } } @@ -6689,7 +6748,10 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { auto done = gasm_->MakeLabel(MachineRepresentation::kTagged); auto type_error = gasm_->MakeLabel(); gasm_->GotoIf(IsSmi(input), &type_error, BranchHint::kFalse); - if (type.is_nullable()) gasm_->GotoIf(IsNull(input), &done, input); + if (type.is_nullable()) { + gasm_->GotoIf(IsNull(input, wasm::kWasmExternRef), &done, + LOAD_ROOT(WasmNull, wasm_null)); + } Node* map = gasm_->LoadMap(input); Node* instance_type = gasm_->LoadInstanceType(map); Node* check = gasm_->Uint32LessThan( @@ -6710,15 +6772,14 @@ class WasmWrapperGraphBuilder : public WasmGraphBuilder { case wasm::kRef: case wasm::kRefNull: { switch (type.heap_representation()) { - // Fast paths for extern and string. - // TODO(7748): Add more/all fast paths? + // TODO(7748): Add more fast paths? case wasm::HeapType::kExtern: + case wasm::HeapType::kNoExtern: return input; case wasm::HeapType::kString: return BuildCheckString(input, js_context, type); case wasm::HeapType::kNone: case wasm::HeapType::kNoFunc: - case wasm::HeapType::kNoExtern: case wasm::HeapType::kI31: case wasm::HeapType::kAny: case wasm::HeapType::kFunc: diff --git a/src/compiler/wasm-compiler.h b/src/compiler/wasm-compiler.h index 826fd8507b..b79046a45e 100644 --- a/src/compiler/wasm-compiler.h +++ b/src/compiler/wasm-compiler.h @@ -253,10 +253,10 @@ class WasmGraphBuilder { Node* tnode, Node* fnode); Node* CreateOrMergeIntoEffectPhi(Node* merge, Node* tnode, Node* fnode); Node* EffectPhi(unsigned count, Node** effects_and_control); - Node* RefNull(); + Node* RefNull(wasm::ValueType type); Node* RefFunc(uint32_t function_index); Node* AssertNotNull( - Node* object, wasm::WasmCodePosition position, + Node* object, wasm::ValueType type, wasm::WasmCodePosition position, wasm::TrapReason reason = wasm::TrapReason::kTrapNullDereference); Node* TraceInstruction(uint32_t mark_id); Node* Int32Constant(int32_t value); @@ -266,7 +266,9 @@ class WasmGraphBuilder { Node* Simd128Constant(const uint8_t value[16]); Node* Binop(wasm::WasmOpcode opcode, Node* left, Node* right, wasm::WasmCodePosition position = wasm::kNoCodePosition); + // The {type} argument is only required for null-checking operations. Node* Unop(wasm::WasmOpcode opcode, Node* input, + wasm::ValueType type = wasm::kWasmBottom, wasm::WasmCodePosition position = wasm::kNoCodePosition); Node* MemoryGrow(Node* input); Node* Throw(uint32_t tag_index, const wasm::WasmTag* tag, @@ -352,7 +354,8 @@ class WasmGraphBuilder { Node** failure_control, bool is_last_case); - void BrOnNull(Node* ref_object, Node** non_null_node, Node** null_node); + void BrOnNull(Node* ref_object, wasm::ValueType type, Node** non_null_node, + Node** null_node); Node* Invert(Node* node); @@ -600,7 +603,7 @@ class WasmGraphBuilder { Node* StringFromCodePoint(Node* code_point); Node* StringHash(Node* string, CheckForNull null_check, wasm::WasmCodePosition position); - Node* IsNull(Node* object); + Node* IsNull(Node* object, wasm::ValueType type); Node* TypeGuard(Node* value, wasm::ValueType type); bool has_simd() const { return has_simd_; } diff --git a/src/compiler/wasm-gc-lowering.cc b/src/compiler/wasm-gc-lowering.cc index 80dd35c5f1..35ea3cd051 100644 --- a/src/compiler/wasm-gc-lowering.cc +++ b/src/compiler/wasm-gc-lowering.cc @@ -96,12 +96,19 @@ Node* WasmGCLowering::RootNode(RootIndex index) { IsolateData::root_slot_offset(index)); } -Node* WasmGCLowering::Null() { return RootNode(RootIndex::kNullValue); } +Node* WasmGCLowering::Null(wasm::ValueType type) { + return wasm::IsSubtypeOf(type, wasm::kWasmExternRef, module_) + ? RootNode(RootIndex::kNullValue) + : RootNode(RootIndex::kWasmNull); +} -Node* WasmGCLowering::IsNull(Node* object) { - Tagged_t static_null = wasm::GetWasmEngine()->compressed_null_value_or_zero(); - Node* null_value = - static_null != 0 ? gasm_.UintPtrConstant(static_null) : Null(); +Node* WasmGCLowering::IsNull(Node* object, wasm::ValueType type) { + Tagged_t static_null = + wasm::GetWasmEngine()->compressed_wasm_null_value_or_zero(); + Node* null_value = !wasm::IsSubtypeOf(type, wasm::kWasmExternRef, module_) && + static_null != 0 + ? gasm_.UintPtrConstant(static_null) + : Null(type); return gasm_.TaggedEqual(object, null_value); } @@ -131,8 +138,8 @@ Reduction WasmGCLowering::ReduceWasmTypeCheck(Node* node) { // being a wasm object and return 0 (failure). if (object_can_be_null && (!is_cast_from_any || config.to.is_nullable())) { const int kResult = config.to.is_nullable() ? 1 : 0; - gasm_.GotoIf(IsNull(object), &end_label, BranchHint::kFalse, - gasm_.Int32Constant(kResult)); + gasm_.GotoIf(IsNull(object, wasm::kWasmAnyRef), &end_label, + BranchHint::kFalse, gasm_.Int32Constant(kResult)); } if (object_can_be_i31) { @@ -209,7 +216,7 @@ Reduction WasmGCLowering::ReduceWasmTypeCast(Node* node) { // failure. In that case the instance type check will identify null as not // being a wasm object and trap. if (object_can_be_null && (!is_cast_from_any || config.to.is_nullable())) { - Node* is_null = IsNull(object); + Node* is_null = IsNull(object, wasm::kWasmAnyRef); if (config.to.is_nullable()) { gasm_.GotoIf(is_null, &end_label, BranchHint::kFalse); } else if (!v8_flags.experimental_wasm_skip_null_checks) { @@ -276,8 +283,9 @@ Reduction WasmGCLowering::ReduceAssertNotNull(Node* node) { Node* control = NodeProperties::GetControlInput(node); Node* object = NodeProperties::GetValueInput(node, 0); gasm_.InitializeEffectControl(effect, control); + auto op_parameter = OpParameter(node->op()); if (!v8_flags.experimental_wasm_skip_null_checks) { - gasm_.TrapIf(IsNull(object), TrapIdOf(node->op())); + gasm_.TrapIf(IsNull(object, op_parameter.type), op_parameter.trap_id); } ReplaceWithValue(node, object, gasm_.effect(), gasm_.control()); @@ -287,19 +295,23 @@ Reduction WasmGCLowering::ReduceAssertNotNull(Node* node) { Reduction WasmGCLowering::ReduceNull(Node* node) { DCHECK_EQ(node->opcode(), IrOpcode::kNull); - return Replace(Null()); + auto type = OpParameter(node->op()); + return Replace(Null(type)); } Reduction WasmGCLowering::ReduceIsNull(Node* node) { DCHECK_EQ(node->opcode(), IrOpcode::kIsNull); Node* object = NodeProperties::GetValueInput(node, 0); - return Replace(IsNull(object)); + auto type = OpParameter(node->op()); + return Replace(IsNull(object, type)); } Reduction WasmGCLowering::ReduceIsNotNull(Node* node) { DCHECK_EQ(node->opcode(), IrOpcode::kIsNotNull); Node* object = NodeProperties::GetValueInput(node, 0); - return Replace(gasm_.Word32Equal(IsNull(object), gasm_.Int32Constant(0))); + auto type = OpParameter(node->op()); + return Replace( + gasm_.Word32Equal(IsNull(object, type), gasm_.Int32Constant(0))); } Reduction WasmGCLowering::ReduceRttCanon(Node* node) { @@ -328,13 +340,18 @@ Reduction WasmGCLowering::ReduceWasmExternInternalize(Node* node) { UNREACHABLE(); } -// TODO(7748): WasmExternExternalize is a no-op. Consider removing it. Reduction WasmGCLowering::ReduceWasmExternExternalize(Node* node) { DCHECK_EQ(node->opcode(), IrOpcode::kWasmExternExternalize); - Node* object = NodeProperties::GetValueInput(node, 0); - ReplaceWithValue(node, object); + Node* object = node->InputAt(0); + gasm_.InitializeEffectControl(NodeProperties::GetEffectInput(node), + NodeProperties::GetControlInput(node)); + auto label = gasm_.MakeLabel(MachineRepresentation::kTagged); + gasm_.GotoIfNot(IsNull(object, wasm::kWasmAnyRef), &label, object); + gasm_.Goto(&label, Null(wasm::kWasmExternRef)); + gasm_.Bind(&label); + ReplaceWithValue(node, label.PhiAt(0), gasm_.effect(), gasm_.control()); node->Kill(); - return Replace(object); + return Replace(label.PhiAt(0)); } Reduction WasmGCLowering::ReduceWasmStructGet(Node* node) { diff --git a/src/compiler/wasm-gc-lowering.h b/src/compiler/wasm-gc-lowering.h index 24f4468220..8401ecb2fe 100644 --- a/src/compiler/wasm-gc-lowering.h +++ b/src/compiler/wasm-gc-lowering.h @@ -49,8 +49,8 @@ class WasmGCLowering final : public AdvancedReducer { Reduction ReduceStringPrepareForGetCodeunit(Node* node); Node* IsolateRoot(); Node* RootNode(RootIndex index); - Node* Null(); - Node* IsNull(Node* object); + Node* Null(wasm::ValueType type); + Node* IsNull(Node* object, wasm::ValueType type); Node* BuildLoadExternalPointerFromObject(Node* object, int offset, ExternalPointerTag tag); WasmGraphAssembler gasm_; diff --git a/src/compiler/wasm-gc-operator-reducer.cc b/src/compiler/wasm-gc-operator-reducer.cc index c01b2b0854..0249f81677 100644 --- a/src/compiler/wasm-gc-operator-reducer.cc +++ b/src/compiler/wasm-gc-operator-reducer.cc @@ -301,9 +301,9 @@ Reduction WasmGCOperatorReducer::ReduceWasmTypeCast(Node* node) { return Changed(node); } else { gasm_.InitializeEffectControl(effect, control); - return Replace( - SetType(gasm_.AssertNotNull(object, TrapId::kTrapIllegalCast), - object_type.type.AsNonNull())); + return Replace(SetType(gasm_.AssertNotNull(object, object_type.type, + TrapId::kTrapIllegalCast), + object_type.type.AsNonNull())); } } @@ -314,11 +314,12 @@ Reduction WasmGCOperatorReducer::ReduceWasmTypeCast(Node* node) { // A cast between unrelated types can only succeed if the argument is null. // Otherwise, it always fails. Node* non_trapping_condition = object_type.type.is_nullable() && to_nullable - ? gasm_.IsNull(object) + ? gasm_.IsNull(object, object_type.type) : gasm_.Int32Constant(0); gasm_.TrapUnless(SetType(non_trapping_condition, wasm::kWasmI32), TrapId::kTrapIllegalCast); - Node* null_node = SetType(gasm_.Null(), wasm::ToNullSentinel(object_type)); + Node* null_node = SetType(gasm_.Null(object_type.type), + wasm::ToNullSentinel(object_type)); ReplaceWithValue(node, null_node, gasm_.effect(), gasm_.control()); node->Kill(); return Replace(null_node); @@ -360,7 +361,7 @@ Reduction WasmGCOperatorReducer::ReduceWasmTypeCheck(Node* node) { // Type cast will fail only on null. gasm_.InitializeEffectControl(effect, control); Node* condition = SetType(object_type.type.is_nullable() && !null_succeeds - ? gasm_.IsNotNull(object) + ? gasm_.IsNotNull(object, object_type.type) : gasm_.Int32Constant(1), wasm::kWasmI32); ReplaceWithValue(node, condition); @@ -377,7 +378,8 @@ Reduction WasmGCOperatorReducer::ReduceWasmTypeCheck(Node* node) { if (null_succeeds && object_type.type.is_nullable()) { // The cast only succeeds in case of null. gasm_.InitializeEffectControl(effect, control); - condition = SetType(gasm_.IsNull(object), wasm::kWasmI32); + condition = + SetType(gasm_.IsNull(object, object_type.type), wasm::kWasmI32); } else { // The cast never succeeds. condition = SetType(gasm_.Int32Constant(0), wasm::kWasmI32); diff --git a/src/compiler/wasm-graph-assembler.cc b/src/compiler/wasm-graph-assembler.cc index a45f8f0594..0e0db337d3 100644 --- a/src/compiler/wasm-graph-assembler.cc +++ b/src/compiler/wasm-graph-assembler.cc @@ -375,21 +375,23 @@ Node* WasmGraphAssembler::WasmTypeCast(Node* object, Node* rtt, effect(), control())); } -Node* WasmGraphAssembler::Null() { - return AddNode(graph()->NewNode(simplified_.Null())); +Node* WasmGraphAssembler::Null(wasm::ValueType type) { + return AddNode(graph()->NewNode(simplified_.Null(type))); } -Node* WasmGraphAssembler::IsNull(Node* object) { - return AddNode(graph()->NewNode(simplified_.IsNull(), object, control())); +Node* WasmGraphAssembler::IsNull(Node* object, wasm::ValueType type) { + return AddNode(graph()->NewNode(simplified_.IsNull(type), object, control())); } -Node* WasmGraphAssembler::IsNotNull(Node* object) { - return AddNode(graph()->NewNode(simplified_.IsNotNull(), object, control())); +Node* WasmGraphAssembler::IsNotNull(Node* object, wasm::ValueType type) { + return AddNode( + graph()->NewNode(simplified_.IsNotNull(type), object, control())); } -Node* WasmGraphAssembler::AssertNotNull(Node* object, TrapId trap_id) { - return AddNode(graph()->NewNode(simplified_.AssertNotNull(trap_id), object, - effect(), control())); +Node* WasmGraphAssembler::AssertNotNull(Node* object, wasm::ValueType type, + TrapId trap_id) { + return AddNode(graph()->NewNode(simplified_.AssertNotNull(type, trap_id), + object, effect(), control())); } Node* WasmGraphAssembler::WasmExternInternalize(Node* object) { diff --git a/src/compiler/wasm-graph-assembler.h b/src/compiler/wasm-graph-assembler.h index bf8017d1e6..b557782be2 100644 --- a/src/compiler/wasm-graph-assembler.h +++ b/src/compiler/wasm-graph-assembler.h @@ -246,13 +246,13 @@ class WasmGraphAssembler : public GraphAssembler { Node* WasmTypeCast(Node* object, Node* rtt, WasmTypeCheckConfig config); - Node* Null(); + Node* Null(wasm::ValueType type); - Node* IsNull(Node* object); + Node* IsNull(Node* object, wasm::ValueType type); - Node* IsNotNull(Node* object); + Node* IsNotNull(Node* object, wasm::ValueType type); - Node* AssertNotNull(Node* object, TrapId trap_id); + Node* AssertNotNull(Node* object, wasm::ValueType type, TrapId trap_id); Node* WasmExternInternalize(Node* object); diff --git a/src/debug/debug-wasm-objects.cc b/src/debug/debug-wasm-objects.cc index 1a4eca61fc..22d7c26a49 100644 --- a/src/debug/debug-wasm-objects.cc +++ b/src/debug/debug-wasm-objects.cc @@ -948,6 +948,10 @@ Handle WasmValueObject::New( isolate); } t = GetRefTypeName(isolate, value.type(), module_object); + } else if (ref->IsWasmNull()) { + // TODO(manoskouk): Is this value correct? + v = isolate->factory()->null_value(); + t = GetRefTypeName(isolate, value.type(), module_object); } else if (ref->IsJSFunction() || ref->IsSmi() || ref->IsNull() || ref->IsString() || value.type().is_reference_to(wasm::HeapType::kExtern) || diff --git a/src/heap/objects-visiting.h b/src/heap/objects-visiting.h index dc842db106..758f219342 100644 --- a/src/heap/objects-visiting.h +++ b/src/heap/objects-visiting.h @@ -70,7 +70,8 @@ namespace internal { IF_WASM(V, WasmSuspenderObject) \ IF_WASM(V, WasmResumeData) \ IF_WASM(V, WasmTypeInfo) \ - IF_WASM(V, WasmContinuationObject) + IF_WASM(V, WasmContinuationObject) \ + IF_WASM(V, WasmNull) #define FORWARD_DECLARE(TypeName) class TypeName; TYPED_VISITOR_ID_LIST(FORWARD_DECLARE) diff --git a/src/heap/read-only-spaces.h b/src/heap/read-only-spaces.h index 58ae60aaa4..b18197a66a 100644 --- a/src/heap/read-only-spaces.h +++ b/src/heap/read-only-spaces.h @@ -274,6 +274,8 @@ class ReadOnlySpace : public BaseSpace { size_t capacity_; const size_t area_size_; + + friend class Heap; }; class SharedReadOnlySpace : public ReadOnlySpace { diff --git a/src/heap/setup-heap-internal.cc b/src/heap/setup-heap-internal.cc index 9a1d68a1b1..0aec2758af 100644 --- a/src/heap/setup-heap-internal.cc +++ b/src/heap/setup-heap-internal.cc @@ -588,6 +588,7 @@ bool Heap::CreateInitialReadOnlyMaps() { wasm_type_info) IF_WASM(ALLOCATE_MAP, WASM_CONTINUATION_OBJECT_TYPE, WasmContinuationObject::kSize, wasm_continuation_object) + IF_WASM(ALLOCATE_MAP, WASM_NULL_TYPE, kVariableSizeSentinel, wasm_null); ALLOCATE_MAP(WEAK_CELL_TYPE, WeakCell::kSize, weak_cell) } @@ -984,6 +985,53 @@ void Heap::CreateInitialReadOnlyObjects() { Handle shadow_realm_scope_info = ScopeInfo::CreateForShadowRealmNativeContext(isolate()); set_shadow_realm_scope_info(*shadow_realm_scope_info); + + // Initialize the wasm null_value. + +#ifdef V8_ENABLE_WEBASSEMBLY + // Allocate the wasm-null object. It is a regular V8 heap object contained in + // a V8 page. It is large enough so that its payload (other than its map word) + // can be mprotected on OS page granularity. + // We adjust the layout such that we have a filler object in the current OS + // page, and the wasm-null map word at the end of the current OS page. The + // payload then is contained on a separate OS page which can be protected. + + // Ensure all of the following lands on the same V8 page. + constexpr int kOffsetAfterMapWord = HeapObject::kMapOffset + kTaggedSize; + constexpr size_t kLargestPossibleOSPageSize = 64 * KB; + static_assert(kLargestPossibleOSPageSize >= kMinimumOSPageSize); + read_only_space_->EnsureSpaceForAllocation( + kLargestPossibleOSPageSize + WasmNull::kSize - kOffsetAfterMapWord); + Address next_page = + RoundUp(read_only_space_->top(), kLargestPossibleOSPageSize); + CHECK_EQ(kOffsetAfterMapWord % kObjectAlignment, 0); + + // Add some filler to end up right before an OS page boundary. + { + int filler_size = static_cast(next_page - read_only_space_->top() - + kOffsetAfterMapWord); + HeapObject filler = + allocator()->AllocateRawWith( + filler_size, AllocationType::kReadOnly, AllocationOrigin::kRuntime, + AllocationAlignment::kTaggedAligned); + CreateFillerObjectAt(filler.address(), filler_size, + ClearFreedMemoryMode::kClearFreedMemory); + CHECK_EQ(read_only_space_->top() + kOffsetAfterMapWord, next_page); + } + + // Finally, allocate the wasm-null object. + { + HeapObject obj; + CHECK(AllocateRaw(WasmNull::kSize, AllocationType::kReadOnly).To(&obj)); + obj.set_map_after_allocation(roots.wasm_null_map(), SKIP_WRITE_BARRIER); + set_wasm_null(WasmNull::cast(obj)); + + CHECK_EQ(read_only_space_->top() % kLargestPossibleOSPageSize, 0); + } +#endif + + // We prefer to fit all of read-only space in one page. + CHECK_EQ(read_only_space_->pages().size(), 1); } void Heap::CreateInitialMutableObjects() { diff --git a/src/maglev/maglev-ir.cc b/src/maglev/maglev-ir.cc index 0cacb959d3..c47de6d9b3 100644 --- a/src/maglev/maglev-ir.cc +++ b/src/maglev/maglev-ir.cc @@ -142,6 +142,9 @@ bool RootToBoolean(RootIndex index) { case RootIndex::kHoleNanValue: case RootIndex::kMinusZeroValue: case RootIndex::kempty_string: +#ifdef V8_ENABLE_WEBASSEMBLY + case RootIndex::kWasmNull: +#endif return false; default: return true; diff --git a/src/objects/map.cc b/src/objects/map.cc index b29db773e4..872d2c429c 100644 --- a/src/objects/map.cc +++ b/src/objects/map.cc @@ -411,6 +411,8 @@ VisitorId Map::GetVisitorId(Map map) { return kVisitWasmCapiFunctionData; case WASM_SUSPENDER_OBJECT_TYPE: return kVisitWasmSuspenderObject; + case WASM_NULL_TYPE: + return kVisitWasmNull; #endif // V8_ENABLE_WEBASSEMBLY #define MAKE_TQ_CASE(TYPE, Name) \ diff --git a/src/objects/map.h b/src/objects/map.h index 4f2462c715..6eed7996c1 100644 --- a/src/objects/map.h +++ b/src/objects/map.h @@ -30,7 +30,8 @@ enum InstanceType : uint16_t; V(CoverageInfo) \ V(DataObject) \ V(FeedbackMetadata) \ - V(FixedDoubleArray) + V(FixedDoubleArray) \ + IF_WASM(V, WasmNull) #define POINTER_VISITOR_ID_LIST(V) \ V(AccessorInfo) \ diff --git a/src/objects/object-list-macros.h b/src/objects/object-list-macros.h index 56ae2d0da7..342274de05 100644 --- a/src/objects/object-list-macros.h +++ b/src/objects/object-list-macros.h @@ -280,6 +280,7 @@ class ZoneForwardList; IF_WASM(V, WasmValueObject) \ IF_WASM(V, WasmSuspenderObject) \ IF_WASM(V, WasmContinuationObject) \ + IF_WASM(V, WasmNull) \ V(WeakFixedArray) \ V(WeakArrayList) \ V(WeakCell) \ diff --git a/src/objects/objects-body-descriptors-inl.h b/src/objects/objects-body-descriptors-inl.h index 7eae0e20c6..feae1b5543 100644 --- a/src/objects/objects-body-descriptors-inl.h +++ b/src/objects/objects-body-descriptors-inl.h @@ -881,6 +881,19 @@ class WasmStruct::BodyDescriptor final : public BodyDescriptorBase { } }; +class WasmNull::BodyDescriptor final : public BodyDescriptorBase { + public: + static bool IsValidSlot(Map map, HeapObject obj, int offset) { + UNREACHABLE(); + } + + template + static inline void IterateBody(Map map, HeapObject obj, int object_size, + ObjectVisitor* v) {} + + static inline int SizeOf(Map map, HeapObject obj) { return WasmNull::kSize; } +}; + #endif // V8_ENABLE_WEBASSEMBLY class ExternalOneByteString::BodyDescriptor final : public BodyDescriptorBase { @@ -1306,6 +1319,8 @@ auto BodyDescriptorApply(InstanceType type, Args&&... args) { #if V8_ENABLE_WEBASSEMBLY case WASM_INSTANCE_OBJECT_TYPE: return CALL_APPLY(WasmInstanceObject); + case WASM_NULL_TYPE: + return CALL_APPLY(WasmNull); #endif // V8_ENABLE_WEBASSEMBLY case JS_WEAK_MAP_TYPE: case JS_WEAK_SET_TYPE: diff --git a/src/objects/objects.cc b/src/objects/objects.cc index 1483f71924..0e2c15bc7c 100644 --- a/src/objects/objects.cc +++ b/src/objects/objects.cc @@ -651,6 +651,9 @@ bool Object::BooleanValue(IsolateT* isolate) { DCHECK(IsHeapObject()); if (IsBoolean()) return IsTrue(isolate); if (IsNullOrUndefined(isolate)) return false; +#ifdef V8_ENABLE_WEBASSEMBLY + if (IsWasmNull()) return false; +#endif if (IsUndetectable()) return false; // Undetectable object is false. if (IsString()) return String::cast(*this).length() != 0; if (IsHeapNumber()) return DoubleToBoolean(HeapNumber::cast(*this).value()); @@ -2292,6 +2295,9 @@ int HeapObject::SizeFromMap(Map map) const { if (instance_type == WASM_ARRAY_TYPE) { return WasmArray::SizeFor(map, WasmArray::unchecked_cast(*this).length()); } + if (instance_type == WASM_NULL_TYPE) { + return WasmNull::kSize; + } #endif // V8_ENABLE_WEBASSEMBLY DCHECK_EQ(instance_type, EMBEDDER_DATA_ARRAY_TYPE); return EmbedderDataArray::SizeFor( diff --git a/src/roots/roots-inl.h b/src/roots/roots-inl.h index e20affe608..8487783d66 100644 --- a/src/roots/roots-inl.h +++ b/src/roots/roots-inl.h @@ -27,6 +27,10 @@ #include "src/roots/roots.h" #include "src/roots/static-roots.h" +#if V8_ENABLE_WEBASSEMBLY +#include "src/wasm/wasm-objects.h" +#endif + namespace v8 { namespace internal { diff --git a/src/roots/roots.h b/src/roots/roots.h index cf3d930d1e..177a9523f4 100644 --- a/src/roots/roots.h +++ b/src/roots/roots.h @@ -139,6 +139,7 @@ class Symbol; IF_WASM(V, Map, wasm_resume_data_map, WasmResumeDataMap) \ IF_WASM(V, Map, wasm_type_info_map, WasmTypeInfoMap) \ IF_WASM(V, Map, wasm_continuation_object_map, WasmContinuationObjectMap) \ + IF_WASM(V, Map, wasm_null_map, WasmNullMap) \ V(Map, weak_fixed_array_map, WeakFixedArrayMap) \ V(Map, weak_array_list_map, WeakArrayListMap) \ V(Map, ephemeron_hash_table_map, EphemeronHashTableMap) \ @@ -225,7 +226,8 @@ class Symbol; V(ScopeInfo, shadow_realm_scope_info, ShadowRealmScopeInfo) \ V(RegisteredSymbolTable, empty_symbol_table, EmptySymbolTable) \ /* Hash seed */ \ - V(ByteArray, hash_seed, HashSeed) + V(ByteArray, hash_seed, HashSeed) \ + IF_WASM(V, WasmNull, wasm_null, WasmNull) // Mutable roots that are known to be immortal immovable, for which we can // safely skip write barriers. diff --git a/src/roots/static-roots.h b/src/roots/static-roots.h index 4e8188c891..1166a777b2 100644 --- a/src/roots/static-roots.h +++ b/src/roots/static-roots.h @@ -222,552 +222,554 @@ struct StaticReadOnlyRoot { static constexpr Tagged_t kWasmResumeDataMap = 0x3e6d; static constexpr Tagged_t kWasmTypeInfoMap = 0x3e95; static constexpr Tagged_t kWasmContinuationObjectMap = 0x3ebd; - static constexpr Tagged_t kWeakCellMap = 0x3ee5; - static constexpr Tagged_t kEmptyArrayList = 0x3f0d; - static constexpr Tagged_t kEmptyScopeInfo = 0x3f19; - static constexpr Tagged_t kEmptyObjectBoilerplateDescription = 0x3f29; - static constexpr Tagged_t kEmptyArrayBoilerplateDescription = 0x3f35; - static constexpr Tagged_t kTrueValue = 0x3f41; - static constexpr Tagged_t kFalseValue = 0x3f5d; - static constexpr Tagged_t kEmptyByteArray = 0x3f79; - static constexpr Tagged_t kEmptyPropertyArray = 0x3f81; - static constexpr Tagged_t kEmptyClosureFeedbackCellArray = 0x3f89; - static constexpr Tagged_t kNoOpInterceptorInfo = 0x3f91; - static constexpr Tagged_t kMinusZeroValue = 0x3fb9; - static constexpr Tagged_t kNanValue = 0x3fc5; - static constexpr Tagged_t kHoleNanValue = 0x3fd1; - static constexpr Tagged_t kInfinityValue = 0x3fdd; - static constexpr Tagged_t kMinusInfinityValue = 0x3fe9; - static constexpr Tagged_t kMaxSafeInteger = 0x3ff5; - static constexpr Tagged_t kMaxUInt32 = 0x4001; - static constexpr Tagged_t kSmiMinValue = 0x400d; - static constexpr Tagged_t kSmiMaxValuePlusOne = 0x4019; - static constexpr Tagged_t kHashSeed = 0x4025; - static constexpr Tagged_t kSingleCharacterStringTable = 0x4035; - static constexpr Tagged_t kdot_string = 0x471d; - static constexpr Tagged_t kzero_string = 0x473d; - static constexpr Tagged_t kone_string = 0x474d; - static constexpr Tagged_t kempty_string = 0x543d; - static constexpr Tagged_t kadoptText_string = 0x5449; - static constexpr Tagged_t kapproximatelySign_string = 0x5461; - static constexpr Tagged_t kbaseName_string = 0x5481; - static constexpr Tagged_t kaccounting_string = 0x5495; - static constexpr Tagged_t kbreakType_string = 0x54ad; - static constexpr Tagged_t kcalendars_string = 0x54c5; - static constexpr Tagged_t kcardinal_string = 0x54dd; - static constexpr Tagged_t kcaseFirst_string = 0x54f1; - static constexpr Tagged_t kceil_string = 0x5509; - static constexpr Tagged_t kcompare_string = 0x5519; - static constexpr Tagged_t kcollation_string = 0x552d; - static constexpr Tagged_t kcollations_string = 0x5545; - static constexpr Tagged_t kcompact_string = 0x555d; - static constexpr Tagged_t kcompactDisplay_string = 0x5571; - static constexpr Tagged_t kcurrency_string = 0x558d; - static constexpr Tagged_t kcurrencyDisplay_string = 0x55a1; - static constexpr Tagged_t kcurrencySign_string = 0x55bd; - static constexpr Tagged_t kdateStyle_string = 0x55d5; - static constexpr Tagged_t kdateTimeField_string = 0x55ed; - static constexpr Tagged_t kdayPeriod_string = 0x5609; - static constexpr Tagged_t kdaysDisplay_string = 0x5621; - static constexpr Tagged_t kdecimal_string = 0x5639; - static constexpr Tagged_t kdialect_string = 0x564d; - static constexpr Tagged_t kdigital_string = 0x5661; - static constexpr Tagged_t kdirection_string = 0x5675; - static constexpr Tagged_t kendRange_string = 0x568d; - static constexpr Tagged_t kengineering_string = 0x56a1; - static constexpr Tagged_t kexceptZero_string = 0x56b9; - static constexpr Tagged_t kexpand_string = 0x56d1; - static constexpr Tagged_t kexponentInteger_string = 0x56e5; - static constexpr Tagged_t kexponentMinusSign_string = 0x5701; - static constexpr Tagged_t kexponentSeparator_string = 0x5721; - static constexpr Tagged_t kfallback_string = 0x5741; - static constexpr Tagged_t kfirst_string = 0x5755; - static constexpr Tagged_t kfirstDay_string = 0x5769; - static constexpr Tagged_t kfloor_string = 0x577d; - static constexpr Tagged_t kformat_string = 0x5791; - static constexpr Tagged_t kfraction_string = 0x57a5; - static constexpr Tagged_t kfractionalDigits_string = 0x57b9; - static constexpr Tagged_t kfractionalSecond_string = 0x57d5; - static constexpr Tagged_t kfull_string = 0x57f1; - static constexpr Tagged_t kgranularity_string = 0x5801; - static constexpr Tagged_t kgrapheme_string = 0x5819; - static constexpr Tagged_t kgroup_string = 0x582d; - static constexpr Tagged_t kh11_string = 0x5841; - static constexpr Tagged_t kh12_string = 0x5851; - static constexpr Tagged_t kh23_string = 0x5861; - static constexpr Tagged_t kh24_string = 0x5871; - static constexpr Tagged_t khalfCeil_string = 0x5881; - static constexpr Tagged_t khalfEven_string = 0x5895; - static constexpr Tagged_t khalfExpand_string = 0x58a9; - static constexpr Tagged_t khalfFloor_string = 0x58c1; - static constexpr Tagged_t khalfTrunc_string = 0x58d9; - static constexpr Tagged_t khour12_string = 0x58f1; - static constexpr Tagged_t khourCycle_string = 0x5905; - static constexpr Tagged_t khourCycles_string = 0x591d; - static constexpr Tagged_t khoursDisplay_string = 0x5935; - static constexpr Tagged_t kideo_string = 0x594d; - static constexpr Tagged_t kignorePunctuation_string = 0x595d; - static constexpr Tagged_t kInvalid_Date_string = 0x597d; - static constexpr Tagged_t kinteger_string = 0x5995; - static constexpr Tagged_t kisWordLike_string = 0x59a9; - static constexpr Tagged_t kkana_string = 0x59c1; - static constexpr Tagged_t klanguage_string = 0x59d1; - static constexpr Tagged_t klanguageDisplay_string = 0x59e5; - static constexpr Tagged_t klessPrecision_string = 0x5a01; - static constexpr Tagged_t kletter_string = 0x5a1d; - static constexpr Tagged_t klist_string = 0x5a31; - static constexpr Tagged_t kliteral_string = 0x5a41; - static constexpr Tagged_t klocale_string = 0x5a55; - static constexpr Tagged_t kloose_string = 0x5a69; - static constexpr Tagged_t klower_string = 0x5a7d; - static constexpr Tagged_t kltr_string = 0x5a91; - static constexpr Tagged_t kmaximumFractionDigits_string = 0x5aa1; - static constexpr Tagged_t kmaximumSignificantDigits_string = 0x5ac5; - static constexpr Tagged_t kmicrosecondsDisplay_string = 0x5ae9; - static constexpr Tagged_t kmillisecondsDisplay_string = 0x5b09; - static constexpr Tagged_t kmin2_string = 0x5b29; - static constexpr Tagged_t kminimalDays_string = 0x5b39; - static constexpr Tagged_t kminimumFractionDigits_string = 0x5b51; - static constexpr Tagged_t kminimumIntegerDigits_string = 0x5b75; - static constexpr Tagged_t kminimumSignificantDigits_string = 0x5b95; - static constexpr Tagged_t kminus_0 = 0x5bb9; - static constexpr Tagged_t kminusSign_string = 0x5bc9; - static constexpr Tagged_t kminutesDisplay_string = 0x5be1; - static constexpr Tagged_t kmonthsDisplay_string = 0x5bfd; - static constexpr Tagged_t kmorePrecision_string = 0x5c19; - static constexpr Tagged_t knan_string = 0x5c35; - static constexpr Tagged_t knanosecondsDisplay_string = 0x5c45; - static constexpr Tagged_t knarrowSymbol_string = 0x5c65; - static constexpr Tagged_t knegative_string = 0x5c7d; - static constexpr Tagged_t knever_string = 0x5c91; - static constexpr Tagged_t knone_string = 0x5ca5; - static constexpr Tagged_t knotation_string = 0x5cb5; - static constexpr Tagged_t knormal_string = 0x5cc9; - static constexpr Tagged_t knumberingSystem_string = 0x5cdd; - static constexpr Tagged_t knumberingSystems_string = 0x5cf9; - static constexpr Tagged_t knumeric_string = 0x5d15; - static constexpr Tagged_t kordinal_string = 0x5d29; - static constexpr Tagged_t kpercentSign_string = 0x5d3d; - static constexpr Tagged_t kplusSign_string = 0x5d55; - static constexpr Tagged_t kquarter_string = 0x5d69; - static constexpr Tagged_t kregion_string = 0x5d7d; - static constexpr Tagged_t krelatedYear_string = 0x5d91; - static constexpr Tagged_t kroundingMode_string = 0x5da9; - static constexpr Tagged_t kroundingPriority_string = 0x5dc1; - static constexpr Tagged_t krtl_string = 0x5ddd; - static constexpr Tagged_t kscientific_string = 0x5ded; - static constexpr Tagged_t ksecondsDisplay_string = 0x5e05; - static constexpr Tagged_t ksegment_string = 0x5e21; - static constexpr Tagged_t kSegmentIterator_string = 0x5e35; - static constexpr Tagged_t kSegments_string = 0x5e51; - static constexpr Tagged_t ksensitivity_string = 0x5e65; - static constexpr Tagged_t ksep_string = 0x5e7d; - static constexpr Tagged_t kshared_string = 0x5e8d; - static constexpr Tagged_t ksignDisplay_string = 0x5ea1; - static constexpr Tagged_t kstandard_string = 0x5eb9; - static constexpr Tagged_t kstartRange_string = 0x5ecd; - static constexpr Tagged_t kstrict_string = 0x5ee5; - static constexpr Tagged_t kstripIfInteger_string = 0x5ef9; - static constexpr Tagged_t kstyle_string = 0x5f15; - static constexpr Tagged_t kterm_string = 0x5f29; - static constexpr Tagged_t ktextInfo_string = 0x5f39; - static constexpr Tagged_t ktimeStyle_string = 0x5f4d; - static constexpr Tagged_t ktimeZones_string = 0x5f65; - static constexpr Tagged_t ktimeZoneName_string = 0x5f7d; - static constexpr Tagged_t ktrailingZeroDisplay_string = 0x5f95; - static constexpr Tagged_t ktrunc_string = 0x5fb5; - static constexpr Tagged_t ktwo_digit_string = 0x5fc9; - static constexpr Tagged_t ktype_string = 0x5fdd; - static constexpr Tagged_t kunknown_string = 0x5fed; - static constexpr Tagged_t kupper_string = 0x6001; - static constexpr Tagged_t kusage_string = 0x6015; - static constexpr Tagged_t kuseGrouping_string = 0x6029; - static constexpr Tagged_t kunitDisplay_string = 0x6041; - static constexpr Tagged_t kweekday_string = 0x6059; - static constexpr Tagged_t kweekend_string = 0x606d; - static constexpr Tagged_t kweeksDisplay_string = 0x6081; - static constexpr Tagged_t kweekInfo_string = 0x6099; - static constexpr Tagged_t kyearName_string = 0x60ad; - static constexpr Tagged_t kyearsDisplay_string = 0x60c1; - static constexpr Tagged_t kadd_string = 0x60d9; - static constexpr Tagged_t kAggregateError_string = 0x60e9; - static constexpr Tagged_t kalways_string = 0x6105; - static constexpr Tagged_t kanonymous_function_string = 0x6119; - static constexpr Tagged_t kanonymous_string = 0x6139; - static constexpr Tagged_t kapply_string = 0x6151; - static constexpr Tagged_t kArguments_string = 0x6165; - static constexpr Tagged_t karguments_string = 0x617d; - static constexpr Tagged_t karguments_to_string = 0x6195; - static constexpr Tagged_t kArray_string = 0x61b5; - static constexpr Tagged_t karray_to_string = 0x61c9; - static constexpr Tagged_t kArrayBuffer_string = 0x61e5; - static constexpr Tagged_t kArrayIterator_string = 0x61fd; - static constexpr Tagged_t kas_string = 0x6219; - static constexpr Tagged_t kassert_string = 0x6229; - static constexpr Tagged_t kasync_string = 0x623d; - static constexpr Tagged_t kAtomicsCondition_string = 0x6251; - static constexpr Tagged_t kAtomicsMutex_string = 0x6271; - static constexpr Tagged_t kauto_string = 0x628d; - static constexpr Tagged_t kawait_string = 0x629d; - static constexpr Tagged_t kBigInt_string = 0x62b1; - static constexpr Tagged_t kbigint_string = 0x62c5; - static constexpr Tagged_t kBigInt64Array_string = 0x62d9; - static constexpr Tagged_t kBigUint64Array_string = 0x62f5; - static constexpr Tagged_t kbind_string = 0x6311; - static constexpr Tagged_t kblank_string = 0x6321; - static constexpr Tagged_t kBoolean_string = 0x6335; - static constexpr Tagged_t kboolean_string = 0x6349; - static constexpr Tagged_t kboolean_to_string = 0x635d; - static constexpr Tagged_t kbound__string = 0x6379; - static constexpr Tagged_t kbuffer_string = 0x638d; - static constexpr Tagged_t kbyte_length_string = 0x63a1; - static constexpr Tagged_t kbyte_offset_string = 0x63b9; - static constexpr Tagged_t kCompileError_string = 0x63d1; - static constexpr Tagged_t kcalendar_string = 0x63e9; - static constexpr Tagged_t kcallee_string = 0x63fd; - static constexpr Tagged_t kcaller_string = 0x6411; - static constexpr Tagged_t kcause_string = 0x6425; - static constexpr Tagged_t kcharacter_string = 0x6439; - static constexpr Tagged_t kclosure_string = 0x6451; - static constexpr Tagged_t kcode_string = 0x6469; - static constexpr Tagged_t kcolumn_string = 0x6479; - static constexpr Tagged_t kcomputed_string = 0x648d; - static constexpr Tagged_t kconfigurable_string = 0x64a5; - static constexpr Tagged_t kconjunction_string = 0x64bd; - static constexpr Tagged_t kconsole_string = 0x64d5; - static constexpr Tagged_t kconstrain_string = 0x64e9; - static constexpr Tagged_t kconstruct_string = 0x6501; - static constexpr Tagged_t kcurrent_string = 0x6519; - static constexpr Tagged_t kDate_string = 0x652d; - static constexpr Tagged_t kdate_to_string = 0x653d; - static constexpr Tagged_t kdateAdd_string = 0x6559; - static constexpr Tagged_t kdateFromFields_string = 0x656d; - static constexpr Tagged_t kdateUntil_string = 0x6589; - static constexpr Tagged_t kday_string = 0x65a1; - static constexpr Tagged_t kdayOfWeek_string = 0x65b1; - static constexpr Tagged_t kdayOfYear_string = 0x65c9; - static constexpr Tagged_t kdays_string = 0x65e1; - static constexpr Tagged_t kdaysInMonth_string = 0x65f1; - static constexpr Tagged_t kdaysInWeek_string = 0x6609; - static constexpr Tagged_t kdaysInYear_string = 0x6621; - static constexpr Tagged_t kdefault_string = 0x6639; - static constexpr Tagged_t kdefineProperty_string = 0x664d; - static constexpr Tagged_t kdeleteProperty_string = 0x6669; - static constexpr Tagged_t kdisjunction_string = 0x6685; - static constexpr Tagged_t kdone_string = 0x669d; - static constexpr Tagged_t kdot_brand_string = 0x66ad; - static constexpr Tagged_t kdot_catch_string = 0x66c1; - static constexpr Tagged_t kdot_default_string = 0x66d5; - static constexpr Tagged_t kdot_for_string = 0x66e9; - static constexpr Tagged_t kdot_generator_object_string = 0x66f9; - static constexpr Tagged_t kdot_home_object_string = 0x6719; - static constexpr Tagged_t kdot_new_target_string = 0x6731; - static constexpr Tagged_t knew_target_string = 0x6731; - static constexpr Tagged_t kdot_result_string = 0x6749; - static constexpr Tagged_t kdot_repl_result_string = 0x675d; - static constexpr Tagged_t kdot_static_home_object_string = 0x6775; - static constexpr Tagged_t kdot_switch_tag_string = 0x6795; - static constexpr Tagged_t kdotAll_string = 0x67ad; - static constexpr Tagged_t kError_string = 0x67c1; - static constexpr Tagged_t kEvalError_string = 0x67d5; - static constexpr Tagged_t kenumerable_string = 0x67ed; - static constexpr Tagged_t kelement_string = 0x6805; - static constexpr Tagged_t kepochMicroseconds_string = 0x6819; - static constexpr Tagged_t kepochMilliseconds_string = 0x6839; - static constexpr Tagged_t kepochNanoseconds_string = 0x6859; - static constexpr Tagged_t kepochSeconds_string = 0x6875; - static constexpr Tagged_t kera_string = 0x688d; - static constexpr Tagged_t keraYear_string = 0x689d; - static constexpr Tagged_t kerrors_string = 0x68b1; - static constexpr Tagged_t kerror_to_string = 0x68c5; - static constexpr Tagged_t keval_string = 0x68e1; - static constexpr Tagged_t kexception_string = 0x68f1; - static constexpr Tagged_t kexec_string = 0x6909; - static constexpr Tagged_t kfalse_string = 0x6919; - static constexpr Tagged_t kfields_string = 0x692d; - static constexpr Tagged_t kFinalizationRegistry_string = 0x6941; - static constexpr Tagged_t kflags_string = 0x6961; - static constexpr Tagged_t kFloat32Array_string = 0x6975; - static constexpr Tagged_t kFloat64Array_string = 0x698d; - static constexpr Tagged_t kfractionalSecondDigits_string = 0x69a5; - static constexpr Tagged_t kfrom_string = 0x69c9; - static constexpr Tagged_t kFunction_string = 0x69d9; - static constexpr Tagged_t kfunction_native_code_string = 0x69ed; - static constexpr Tagged_t kfunction_string = 0x6a19; - static constexpr Tagged_t kfunction_to_string = 0x6a2d; - static constexpr Tagged_t kGenerator_string = 0x6a4d; - static constexpr Tagged_t kget_space_string = 0x6a65; - static constexpr Tagged_t kget_string = 0x6a75; - static constexpr Tagged_t kgetOffsetNanosecondsFor_string = 0x6a85; - static constexpr Tagged_t kgetOwnPropertyDescriptor_string = 0x6aa9; - static constexpr Tagged_t kgetPossibleInstantsFor_string = 0x6acd; - static constexpr Tagged_t kgetPrototypeOf_string = 0x6af1; - static constexpr Tagged_t kglobal_string = 0x6b0d; - static constexpr Tagged_t kglobalThis_string = 0x6b21; - static constexpr Tagged_t kgroups_string = 0x6b39; - static constexpr Tagged_t kgrowable_string = 0x6b4d; - static constexpr Tagged_t khas_string = 0x6b61; - static constexpr Tagged_t khasIndices_string = 0x6b71; - static constexpr Tagged_t khour_string = 0x6b89; - static constexpr Tagged_t khours_string = 0x6b99; - static constexpr Tagged_t khoursInDay_string = 0x6bad; - static constexpr Tagged_t kignoreCase_string = 0x6bc5; - static constexpr Tagged_t kid_string = 0x6bdd; - static constexpr Tagged_t killegal_access_string = 0x6bed; - static constexpr Tagged_t killegal_argument_string = 0x6c09; - static constexpr Tagged_t kinLeapYear_string = 0x6c25; - static constexpr Tagged_t kindex_string = 0x6c3d; - static constexpr Tagged_t kindices_string = 0x6c51; - static constexpr Tagged_t kInfinity_string = 0x6c65; - static constexpr Tagged_t kinfinity_string = 0x6c79; - static constexpr Tagged_t kinput_string = 0x6c8d; - static constexpr Tagged_t kInt16Array_string = 0x6ca1; - static constexpr Tagged_t kInt32Array_string = 0x6cb9; - static constexpr Tagged_t kInt8Array_string = 0x6cd1; - static constexpr Tagged_t kisExtensible_string = 0x6ce9; - static constexpr Tagged_t kiso8601_string = 0x6d01; - static constexpr Tagged_t kisoDay_string = 0x6d15; - static constexpr Tagged_t kisoHour_string = 0x6d29; - static constexpr Tagged_t kisoMicrosecond_string = 0x6d3d; - static constexpr Tagged_t kisoMillisecond_string = 0x6d59; - static constexpr Tagged_t kisoMinute_string = 0x6d75; - static constexpr Tagged_t kisoMonth_string = 0x6d8d; - static constexpr Tagged_t kisoNanosecond_string = 0x6da1; - static constexpr Tagged_t kisoSecond_string = 0x6dbd; - static constexpr Tagged_t kisoYear_string = 0x6dd5; - static constexpr Tagged_t kjsMemoryEstimate_string = 0x6de9; - static constexpr Tagged_t kjsMemoryRange_string = 0x6e05; - static constexpr Tagged_t kkeys_string = 0x6e21; - static constexpr Tagged_t klargestUnit_string = 0x6e31; - static constexpr Tagged_t klastIndex_string = 0x6e49; - static constexpr Tagged_t klength_string = 0x6e61; - static constexpr Tagged_t klet_string = 0x6e75; - static constexpr Tagged_t kline_string = 0x6e85; - static constexpr Tagged_t klinear_string = 0x6e95; - static constexpr Tagged_t kLinkError_string = 0x6ea9; - static constexpr Tagged_t klong_string = 0x6ec1; - static constexpr Tagged_t kMap_string = 0x6ed1; - static constexpr Tagged_t kMapIterator_string = 0x6ee1; - static constexpr Tagged_t kmax_byte_length_string = 0x6ef9; - static constexpr Tagged_t kmedium_string = 0x6f15; - static constexpr Tagged_t kmergeFields_string = 0x6f29; - static constexpr Tagged_t kmessage_string = 0x6f41; - static constexpr Tagged_t kmeta_string = 0x6f55; - static constexpr Tagged_t kminus_Infinity_string = 0x6f65; - static constexpr Tagged_t kmicrosecond_string = 0x6f7d; - static constexpr Tagged_t kmicroseconds_string = 0x6f95; - static constexpr Tagged_t kmillisecond_string = 0x6fad; - static constexpr Tagged_t kmilliseconds_string = 0x6fc5; - static constexpr Tagged_t kminute_string = 0x6fdd; - static constexpr Tagged_t kminutes_string = 0x6ff1; - static constexpr Tagged_t kModule_string = 0x7005; - static constexpr Tagged_t kmonth_string = 0x7019; - static constexpr Tagged_t kmonthDayFromFields_string = 0x702d; - static constexpr Tagged_t kmonths_string = 0x704d; - static constexpr Tagged_t kmonthsInYear_string = 0x7061; - static constexpr Tagged_t kmonthCode_string = 0x7079; - static constexpr Tagged_t kmultiline_string = 0x7091; - static constexpr Tagged_t kname_string = 0x70a9; - static constexpr Tagged_t kNaN_string = 0x70b9; - static constexpr Tagged_t knanosecond_string = 0x70c9; - static constexpr Tagged_t knanoseconds_string = 0x70e1; - static constexpr Tagged_t knarrow_string = 0x70f9; - static constexpr Tagged_t knative_string = 0x710d; - static constexpr Tagged_t kNFC_string = 0x7121; - static constexpr Tagged_t kNFD_string = 0x7131; - static constexpr Tagged_t kNFKC_string = 0x7141; - static constexpr Tagged_t kNFKD_string = 0x7151; - static constexpr Tagged_t knot_equal_string = 0x7161; - static constexpr Tagged_t knull_string = 0x7179; - static constexpr Tagged_t knull_to_string = 0x7189; - static constexpr Tagged_t kNumber_string = 0x71a5; - static constexpr Tagged_t knumber_string = 0x71b9; - static constexpr Tagged_t knumber_to_string = 0x71cd; - static constexpr Tagged_t kObject_string = 0x71e9; - static constexpr Tagged_t kobject_string = 0x71fd; - static constexpr Tagged_t kobject_to_string = 0x7211; - static constexpr Tagged_t kof_string = 0x722d; - static constexpr Tagged_t koffset_string = 0x723d; - static constexpr Tagged_t koffsetNanoseconds_string = 0x7251; - static constexpr Tagged_t kok_string = 0x7271; - static constexpr Tagged_t kother_string = 0x7281; - static constexpr Tagged_t koverflow_string = 0x7295; - static constexpr Tagged_t kownKeys_string = 0x72a9; - static constexpr Tagged_t kpercent_string = 0x72bd; - static constexpr Tagged_t kplainDate_string = 0x72d1; - static constexpr Tagged_t kplainTime_string = 0x72e9; - static constexpr Tagged_t kposition_string = 0x7301; - static constexpr Tagged_t kpreventExtensions_string = 0x7315; - static constexpr Tagged_t kprivate_constructor_string = 0x7335; - static constexpr Tagged_t kPromise_string = 0x734d; - static constexpr Tagged_t kproto_string = 0x7361; - static constexpr Tagged_t kprototype_string = 0x7379; - static constexpr Tagged_t kproxy_string = 0x7391; - static constexpr Tagged_t kProxy_string = 0x73a5; - static constexpr Tagged_t kquery_colon_string = 0x73b9; - static constexpr Tagged_t kRangeError_string = 0x73c9; - static constexpr Tagged_t kraw_json_string = 0x73e1; - static constexpr Tagged_t kraw_string = 0x73f5; - static constexpr Tagged_t kReferenceError_string = 0x7405; - static constexpr Tagged_t kReflectGet_string = 0x7421; - static constexpr Tagged_t kReflectHas_string = 0x7439; - static constexpr Tagged_t kRegExp_string = 0x7451; - static constexpr Tagged_t kregexp_to_string = 0x7465; - static constexpr Tagged_t kreject_string = 0x7481; - static constexpr Tagged_t krelativeTo_string = 0x7495; - static constexpr Tagged_t kresizable_string = 0x74ad; - static constexpr Tagged_t kResizableArrayBuffer_string = 0x74c5; - static constexpr Tagged_t kreturn_string = 0x74e5; - static constexpr Tagged_t krevoke_string = 0x74f9; - static constexpr Tagged_t kroundingIncrement_string = 0x750d; - static constexpr Tagged_t kRuntimeError_string = 0x752d; - static constexpr Tagged_t kWebAssemblyException_string = 0x7545; - static constexpr Tagged_t kScript_string = 0x7569; - static constexpr Tagged_t kscript_string = 0x757d; - static constexpr Tagged_t ksecond_string = 0x7591; - static constexpr Tagged_t kseconds_string = 0x75a5; - static constexpr Tagged_t kshort_string = 0x75b9; - static constexpr Tagged_t kSet_string = 0x75cd; - static constexpr Tagged_t ksentence_string = 0x75dd; - static constexpr Tagged_t kset_space_string = 0x75f1; - static constexpr Tagged_t kset_string = 0x7601; - static constexpr Tagged_t kSetIterator_string = 0x7611; - static constexpr Tagged_t ksetPrototypeOf_string = 0x7629; - static constexpr Tagged_t kShadowRealm_string = 0x7645; - static constexpr Tagged_t kSharedArray_string = 0x765d; - static constexpr Tagged_t kSharedArrayBuffer_string = 0x7675; - static constexpr Tagged_t kSharedStruct_string = 0x7695; - static constexpr Tagged_t ksign_string = 0x76ad; - static constexpr Tagged_t ksmallestUnit_string = 0x76bd; - static constexpr Tagged_t ksource_string = 0x76d5; - static constexpr Tagged_t ksourceText_string = 0x76e9; - static constexpr Tagged_t kstack_string = 0x7701; - static constexpr Tagged_t kstackTraceLimit_string = 0x7715; - static constexpr Tagged_t ksticky_string = 0x7731; - static constexpr Tagged_t kString_string = 0x7745; - static constexpr Tagged_t kstring_string = 0x7759; - static constexpr Tagged_t kstring_to_string = 0x776d; - static constexpr Tagged_t kSymbol_iterator_string = 0x7789; - static constexpr Tagged_t kSymbol_replace_string = 0x77a5; - static constexpr Tagged_t ksymbol_species_string = 0x77c1; - static constexpr Tagged_t kSymbol_species_string = 0x77dd; - static constexpr Tagged_t kSymbol_string = 0x77f9; - static constexpr Tagged_t ksymbol_string = 0x780d; - static constexpr Tagged_t kSyntaxError_string = 0x7821; - static constexpr Tagged_t ktarget_string = 0x7839; - static constexpr Tagged_t kthis_function_string = 0x784d; - static constexpr Tagged_t kthis_string = 0x7869; - static constexpr Tagged_t kthrow_string = 0x7879; - static constexpr Tagged_t ktimed_out_string = 0x788d; - static constexpr Tagged_t ktimeZone_string = 0x78a5; - static constexpr Tagged_t ktoJSON_string = 0x78b9; - static constexpr Tagged_t ktoString_string = 0x78cd; - static constexpr Tagged_t ktrue_string = 0x78e1; - static constexpr Tagged_t ktotal_string = 0x78f1; - static constexpr Tagged_t kTypeError_string = 0x7905; - static constexpr Tagged_t kUint16Array_string = 0x791d; - static constexpr Tagged_t kUint32Array_string = 0x7935; - static constexpr Tagged_t kUint8Array_string = 0x794d; - static constexpr Tagged_t kUint8ClampedArray_string = 0x7965; - static constexpr Tagged_t kundefined_string = 0x7985; - static constexpr Tagged_t kundefined_to_string = 0x799d; - static constexpr Tagged_t kunicode_string = 0x79bd; - static constexpr Tagged_t kunicodeSets_string = 0x79d1; - static constexpr Tagged_t kunit_string = 0x79e9; - static constexpr Tagged_t kURIError_string = 0x79f9; - static constexpr Tagged_t kUTC_string = 0x7a0d; - static constexpr Tagged_t kvalue_string = 0x7a1d; - static constexpr Tagged_t kvalueOf_string = 0x7a31; - static constexpr Tagged_t kWeakMap_string = 0x7a45; - static constexpr Tagged_t kWeakRef_string = 0x7a59; - static constexpr Tagged_t kWeakSet_string = 0x7a6d; - static constexpr Tagged_t kweek_string = 0x7a81; - static constexpr Tagged_t kweeks_string = 0x7a91; - static constexpr Tagged_t kweekOfYear_string = 0x7aa5; - static constexpr Tagged_t kword_string = 0x7abd; - static constexpr Tagged_t kwritable_string = 0x7acd; - static constexpr Tagged_t kyearMonthFromFields_string = 0x7ae1; - static constexpr Tagged_t kyear_string = 0x7b01; - static constexpr Tagged_t kyears_string = 0x7b11; - static constexpr Tagged_t kUninitializedValue = 0x7b35; - static constexpr Tagged_t kArgumentsMarker = 0x7b6d; - static constexpr Tagged_t kTerminationException = 0x7ba5; - static constexpr Tagged_t kException = 0x7be5; - static constexpr Tagged_t kOptimizedOut = 0x7c01; - static constexpr Tagged_t kStaleRegister = 0x7c39; - static constexpr Tagged_t kSelfReferenceMarker = 0x7c71; - static constexpr Tagged_t kBasicBlockCountersMarker = 0x7cb1; - static constexpr Tagged_t karray_buffer_wasm_memory_symbol = 0x7cf5; - static constexpr Tagged_t kcall_site_info_symbol = 0x7d05; - static constexpr Tagged_t kconsole_context_id_symbol = 0x7d15; - static constexpr Tagged_t kconsole_context_name_symbol = 0x7d25; - static constexpr Tagged_t kclass_fields_symbol = 0x7d35; - static constexpr Tagged_t kclass_positions_symbol = 0x7d45; - static constexpr Tagged_t kelements_transition_symbol = 0x7d55; - static constexpr Tagged_t kerror_end_pos_symbol = 0x7d65; - static constexpr Tagged_t kerror_script_symbol = 0x7d75; - static constexpr Tagged_t kerror_stack_symbol = 0x7d85; - static constexpr Tagged_t kerror_start_pos_symbol = 0x7d95; - static constexpr Tagged_t kfrozen_symbol = 0x7da5; - static constexpr Tagged_t kinterpreter_trampoline_symbol = 0x7db5; - static constexpr Tagged_t kmega_dom_symbol = 0x7dc5; - static constexpr Tagged_t kmegamorphic_symbol = 0x7dd5; - static constexpr Tagged_t knative_context_index_symbol = 0x7de5; - static constexpr Tagged_t knonextensible_symbol = 0x7df5; - static constexpr Tagged_t knot_mapped_symbol = 0x7e05; - static constexpr Tagged_t kpromise_debug_marker_symbol = 0x7e15; - static constexpr Tagged_t kpromise_debug_message_symbol = 0x7e25; - static constexpr Tagged_t kpromise_forwarding_handler_symbol = 0x7e35; - static constexpr Tagged_t kpromise_handled_by_symbol = 0x7e45; - static constexpr Tagged_t kpromise_awaited_by_symbol = 0x7e55; - static constexpr Tagged_t kregexp_result_names_symbol = 0x7e65; - static constexpr Tagged_t kregexp_result_regexp_input_symbol = 0x7e75; - static constexpr Tagged_t kregexp_result_regexp_last_index_symbol = 0x7e85; - static constexpr Tagged_t ksealed_symbol = 0x7e95; - static constexpr Tagged_t kstrict_function_transition_symbol = 0x7ea5; + static constexpr Tagged_t kWasmNullMap = 0x3ee5; + static constexpr Tagged_t kWeakCellMap = 0x3f0d; + static constexpr Tagged_t kEmptyArrayList = 0x3f35; + static constexpr Tagged_t kEmptyScopeInfo = 0x3f41; + static constexpr Tagged_t kEmptyObjectBoilerplateDescription = 0x3f51; + static constexpr Tagged_t kEmptyArrayBoilerplateDescription = 0x3f5d; + static constexpr Tagged_t kTrueValue = 0x3f69; + static constexpr Tagged_t kFalseValue = 0x3f85; + static constexpr Tagged_t kEmptyByteArray = 0x3fa1; + static constexpr Tagged_t kEmptyPropertyArray = 0x3fa9; + static constexpr Tagged_t kEmptyClosureFeedbackCellArray = 0x3fb1; + static constexpr Tagged_t kNoOpInterceptorInfo = 0x3fb9; + static constexpr Tagged_t kMinusZeroValue = 0x3fe1; + static constexpr Tagged_t kNanValue = 0x3fed; + static constexpr Tagged_t kHoleNanValue = 0x3ff9; + static constexpr Tagged_t kInfinityValue = 0x4005; + static constexpr Tagged_t kMinusInfinityValue = 0x4011; + static constexpr Tagged_t kMaxSafeInteger = 0x401d; + static constexpr Tagged_t kMaxUInt32 = 0x4029; + static constexpr Tagged_t kSmiMinValue = 0x4035; + static constexpr Tagged_t kSmiMaxValuePlusOne = 0x4041; + static constexpr Tagged_t kHashSeed = 0x404d; + static constexpr Tagged_t kSingleCharacterStringTable = 0x405d; + static constexpr Tagged_t kdot_string = 0x4745; + static constexpr Tagged_t kzero_string = 0x4765; + static constexpr Tagged_t kone_string = 0x4775; + static constexpr Tagged_t kempty_string = 0x5465; + static constexpr Tagged_t kadoptText_string = 0x5471; + static constexpr Tagged_t kapproximatelySign_string = 0x5489; + static constexpr Tagged_t kbaseName_string = 0x54a9; + static constexpr Tagged_t kaccounting_string = 0x54bd; + static constexpr Tagged_t kbreakType_string = 0x54d5; + static constexpr Tagged_t kcalendars_string = 0x54ed; + static constexpr Tagged_t kcardinal_string = 0x5505; + static constexpr Tagged_t kcaseFirst_string = 0x5519; + static constexpr Tagged_t kceil_string = 0x5531; + static constexpr Tagged_t kcompare_string = 0x5541; + static constexpr Tagged_t kcollation_string = 0x5555; + static constexpr Tagged_t kcollations_string = 0x556d; + static constexpr Tagged_t kcompact_string = 0x5585; + static constexpr Tagged_t kcompactDisplay_string = 0x5599; + static constexpr Tagged_t kcurrency_string = 0x55b5; + static constexpr Tagged_t kcurrencyDisplay_string = 0x55c9; + static constexpr Tagged_t kcurrencySign_string = 0x55e5; + static constexpr Tagged_t kdateStyle_string = 0x55fd; + static constexpr Tagged_t kdateTimeField_string = 0x5615; + static constexpr Tagged_t kdayPeriod_string = 0x5631; + static constexpr Tagged_t kdaysDisplay_string = 0x5649; + static constexpr Tagged_t kdecimal_string = 0x5661; + static constexpr Tagged_t kdialect_string = 0x5675; + static constexpr Tagged_t kdigital_string = 0x5689; + static constexpr Tagged_t kdirection_string = 0x569d; + static constexpr Tagged_t kendRange_string = 0x56b5; + static constexpr Tagged_t kengineering_string = 0x56c9; + static constexpr Tagged_t kexceptZero_string = 0x56e1; + static constexpr Tagged_t kexpand_string = 0x56f9; + static constexpr Tagged_t kexponentInteger_string = 0x570d; + static constexpr Tagged_t kexponentMinusSign_string = 0x5729; + static constexpr Tagged_t kexponentSeparator_string = 0x5749; + static constexpr Tagged_t kfallback_string = 0x5769; + static constexpr Tagged_t kfirst_string = 0x577d; + static constexpr Tagged_t kfirstDay_string = 0x5791; + static constexpr Tagged_t kfloor_string = 0x57a5; + static constexpr Tagged_t kformat_string = 0x57b9; + static constexpr Tagged_t kfraction_string = 0x57cd; + static constexpr Tagged_t kfractionalDigits_string = 0x57e1; + static constexpr Tagged_t kfractionalSecond_string = 0x57fd; + static constexpr Tagged_t kfull_string = 0x5819; + static constexpr Tagged_t kgranularity_string = 0x5829; + static constexpr Tagged_t kgrapheme_string = 0x5841; + static constexpr Tagged_t kgroup_string = 0x5855; + static constexpr Tagged_t kh11_string = 0x5869; + static constexpr Tagged_t kh12_string = 0x5879; + static constexpr Tagged_t kh23_string = 0x5889; + static constexpr Tagged_t kh24_string = 0x5899; + static constexpr Tagged_t khalfCeil_string = 0x58a9; + static constexpr Tagged_t khalfEven_string = 0x58bd; + static constexpr Tagged_t khalfExpand_string = 0x58d1; + static constexpr Tagged_t khalfFloor_string = 0x58e9; + static constexpr Tagged_t khalfTrunc_string = 0x5901; + static constexpr Tagged_t khour12_string = 0x5919; + static constexpr Tagged_t khourCycle_string = 0x592d; + static constexpr Tagged_t khourCycles_string = 0x5945; + static constexpr Tagged_t khoursDisplay_string = 0x595d; + static constexpr Tagged_t kideo_string = 0x5975; + static constexpr Tagged_t kignorePunctuation_string = 0x5985; + static constexpr Tagged_t kInvalid_Date_string = 0x59a5; + static constexpr Tagged_t kinteger_string = 0x59bd; + static constexpr Tagged_t kisWordLike_string = 0x59d1; + static constexpr Tagged_t kkana_string = 0x59e9; + static constexpr Tagged_t klanguage_string = 0x59f9; + static constexpr Tagged_t klanguageDisplay_string = 0x5a0d; + static constexpr Tagged_t klessPrecision_string = 0x5a29; + static constexpr Tagged_t kletter_string = 0x5a45; + static constexpr Tagged_t klist_string = 0x5a59; + static constexpr Tagged_t kliteral_string = 0x5a69; + static constexpr Tagged_t klocale_string = 0x5a7d; + static constexpr Tagged_t kloose_string = 0x5a91; + static constexpr Tagged_t klower_string = 0x5aa5; + static constexpr Tagged_t kltr_string = 0x5ab9; + static constexpr Tagged_t kmaximumFractionDigits_string = 0x5ac9; + static constexpr Tagged_t kmaximumSignificantDigits_string = 0x5aed; + static constexpr Tagged_t kmicrosecondsDisplay_string = 0x5b11; + static constexpr Tagged_t kmillisecondsDisplay_string = 0x5b31; + static constexpr Tagged_t kmin2_string = 0x5b51; + static constexpr Tagged_t kminimalDays_string = 0x5b61; + static constexpr Tagged_t kminimumFractionDigits_string = 0x5b79; + static constexpr Tagged_t kminimumIntegerDigits_string = 0x5b9d; + static constexpr Tagged_t kminimumSignificantDigits_string = 0x5bbd; + static constexpr Tagged_t kminus_0 = 0x5be1; + static constexpr Tagged_t kminusSign_string = 0x5bf1; + static constexpr Tagged_t kminutesDisplay_string = 0x5c09; + static constexpr Tagged_t kmonthsDisplay_string = 0x5c25; + static constexpr Tagged_t kmorePrecision_string = 0x5c41; + static constexpr Tagged_t knan_string = 0x5c5d; + static constexpr Tagged_t knanosecondsDisplay_string = 0x5c6d; + static constexpr Tagged_t knarrowSymbol_string = 0x5c8d; + static constexpr Tagged_t knegative_string = 0x5ca5; + static constexpr Tagged_t knever_string = 0x5cb9; + static constexpr Tagged_t knone_string = 0x5ccd; + static constexpr Tagged_t knotation_string = 0x5cdd; + static constexpr Tagged_t knormal_string = 0x5cf1; + static constexpr Tagged_t knumberingSystem_string = 0x5d05; + static constexpr Tagged_t knumberingSystems_string = 0x5d21; + static constexpr Tagged_t knumeric_string = 0x5d3d; + static constexpr Tagged_t kordinal_string = 0x5d51; + static constexpr Tagged_t kpercentSign_string = 0x5d65; + static constexpr Tagged_t kplusSign_string = 0x5d7d; + static constexpr Tagged_t kquarter_string = 0x5d91; + static constexpr Tagged_t kregion_string = 0x5da5; + static constexpr Tagged_t krelatedYear_string = 0x5db9; + static constexpr Tagged_t kroundingMode_string = 0x5dd1; + static constexpr Tagged_t kroundingPriority_string = 0x5de9; + static constexpr Tagged_t krtl_string = 0x5e05; + static constexpr Tagged_t kscientific_string = 0x5e15; + static constexpr Tagged_t ksecondsDisplay_string = 0x5e2d; + static constexpr Tagged_t ksegment_string = 0x5e49; + static constexpr Tagged_t kSegmentIterator_string = 0x5e5d; + static constexpr Tagged_t kSegments_string = 0x5e79; + static constexpr Tagged_t ksensitivity_string = 0x5e8d; + static constexpr Tagged_t ksep_string = 0x5ea5; + static constexpr Tagged_t kshared_string = 0x5eb5; + static constexpr Tagged_t ksignDisplay_string = 0x5ec9; + static constexpr Tagged_t kstandard_string = 0x5ee1; + static constexpr Tagged_t kstartRange_string = 0x5ef5; + static constexpr Tagged_t kstrict_string = 0x5f0d; + static constexpr Tagged_t kstripIfInteger_string = 0x5f21; + static constexpr Tagged_t kstyle_string = 0x5f3d; + static constexpr Tagged_t kterm_string = 0x5f51; + static constexpr Tagged_t ktextInfo_string = 0x5f61; + static constexpr Tagged_t ktimeStyle_string = 0x5f75; + static constexpr Tagged_t ktimeZones_string = 0x5f8d; + static constexpr Tagged_t ktimeZoneName_string = 0x5fa5; + static constexpr Tagged_t ktrailingZeroDisplay_string = 0x5fbd; + static constexpr Tagged_t ktrunc_string = 0x5fdd; + static constexpr Tagged_t ktwo_digit_string = 0x5ff1; + static constexpr Tagged_t ktype_string = 0x6005; + static constexpr Tagged_t kunknown_string = 0x6015; + static constexpr Tagged_t kupper_string = 0x6029; + static constexpr Tagged_t kusage_string = 0x603d; + static constexpr Tagged_t kuseGrouping_string = 0x6051; + static constexpr Tagged_t kunitDisplay_string = 0x6069; + static constexpr Tagged_t kweekday_string = 0x6081; + static constexpr Tagged_t kweekend_string = 0x6095; + static constexpr Tagged_t kweeksDisplay_string = 0x60a9; + static constexpr Tagged_t kweekInfo_string = 0x60c1; + static constexpr Tagged_t kyearName_string = 0x60d5; + static constexpr Tagged_t kyearsDisplay_string = 0x60e9; + static constexpr Tagged_t kadd_string = 0x6101; + static constexpr Tagged_t kAggregateError_string = 0x6111; + static constexpr Tagged_t kalways_string = 0x612d; + static constexpr Tagged_t kanonymous_function_string = 0x6141; + static constexpr Tagged_t kanonymous_string = 0x6161; + static constexpr Tagged_t kapply_string = 0x6179; + static constexpr Tagged_t kArguments_string = 0x618d; + static constexpr Tagged_t karguments_string = 0x61a5; + static constexpr Tagged_t karguments_to_string = 0x61bd; + static constexpr Tagged_t kArray_string = 0x61dd; + static constexpr Tagged_t karray_to_string = 0x61f1; + static constexpr Tagged_t kArrayBuffer_string = 0x620d; + static constexpr Tagged_t kArrayIterator_string = 0x6225; + static constexpr Tagged_t kas_string = 0x6241; + static constexpr Tagged_t kassert_string = 0x6251; + static constexpr Tagged_t kasync_string = 0x6265; + static constexpr Tagged_t kAtomicsCondition_string = 0x6279; + static constexpr Tagged_t kAtomicsMutex_string = 0x6299; + static constexpr Tagged_t kauto_string = 0x62b5; + static constexpr Tagged_t kawait_string = 0x62c5; + static constexpr Tagged_t kBigInt_string = 0x62d9; + static constexpr Tagged_t kbigint_string = 0x62ed; + static constexpr Tagged_t kBigInt64Array_string = 0x6301; + static constexpr Tagged_t kBigUint64Array_string = 0x631d; + static constexpr Tagged_t kbind_string = 0x6339; + static constexpr Tagged_t kblank_string = 0x6349; + static constexpr Tagged_t kBoolean_string = 0x635d; + static constexpr Tagged_t kboolean_string = 0x6371; + static constexpr Tagged_t kboolean_to_string = 0x6385; + static constexpr Tagged_t kbound__string = 0x63a1; + static constexpr Tagged_t kbuffer_string = 0x63b5; + static constexpr Tagged_t kbyte_length_string = 0x63c9; + static constexpr Tagged_t kbyte_offset_string = 0x63e1; + static constexpr Tagged_t kCompileError_string = 0x63f9; + static constexpr Tagged_t kcalendar_string = 0x6411; + static constexpr Tagged_t kcallee_string = 0x6425; + static constexpr Tagged_t kcaller_string = 0x6439; + static constexpr Tagged_t kcause_string = 0x644d; + static constexpr Tagged_t kcharacter_string = 0x6461; + static constexpr Tagged_t kclosure_string = 0x6479; + static constexpr Tagged_t kcode_string = 0x6491; + static constexpr Tagged_t kcolumn_string = 0x64a1; + static constexpr Tagged_t kcomputed_string = 0x64b5; + static constexpr Tagged_t kconfigurable_string = 0x64cd; + static constexpr Tagged_t kconjunction_string = 0x64e5; + static constexpr Tagged_t kconsole_string = 0x64fd; + static constexpr Tagged_t kconstrain_string = 0x6511; + static constexpr Tagged_t kconstruct_string = 0x6529; + static constexpr Tagged_t kcurrent_string = 0x6541; + static constexpr Tagged_t kDate_string = 0x6555; + static constexpr Tagged_t kdate_to_string = 0x6565; + static constexpr Tagged_t kdateAdd_string = 0x6581; + static constexpr Tagged_t kdateFromFields_string = 0x6595; + static constexpr Tagged_t kdateUntil_string = 0x65b1; + static constexpr Tagged_t kday_string = 0x65c9; + static constexpr Tagged_t kdayOfWeek_string = 0x65d9; + static constexpr Tagged_t kdayOfYear_string = 0x65f1; + static constexpr Tagged_t kdays_string = 0x6609; + static constexpr Tagged_t kdaysInMonth_string = 0x6619; + static constexpr Tagged_t kdaysInWeek_string = 0x6631; + static constexpr Tagged_t kdaysInYear_string = 0x6649; + static constexpr Tagged_t kdefault_string = 0x6661; + static constexpr Tagged_t kdefineProperty_string = 0x6675; + static constexpr Tagged_t kdeleteProperty_string = 0x6691; + static constexpr Tagged_t kdisjunction_string = 0x66ad; + static constexpr Tagged_t kdone_string = 0x66c5; + static constexpr Tagged_t kdot_brand_string = 0x66d5; + static constexpr Tagged_t kdot_catch_string = 0x66e9; + static constexpr Tagged_t kdot_default_string = 0x66fd; + static constexpr Tagged_t kdot_for_string = 0x6711; + static constexpr Tagged_t kdot_generator_object_string = 0x6721; + static constexpr Tagged_t kdot_home_object_string = 0x6741; + static constexpr Tagged_t kdot_new_target_string = 0x6759; + static constexpr Tagged_t knew_target_string = 0x6759; + static constexpr Tagged_t kdot_result_string = 0x6771; + static constexpr Tagged_t kdot_repl_result_string = 0x6785; + static constexpr Tagged_t kdot_static_home_object_string = 0x679d; + static constexpr Tagged_t kdot_switch_tag_string = 0x67bd; + static constexpr Tagged_t kdotAll_string = 0x67d5; + static constexpr Tagged_t kError_string = 0x67e9; + static constexpr Tagged_t kEvalError_string = 0x67fd; + static constexpr Tagged_t kenumerable_string = 0x6815; + static constexpr Tagged_t kelement_string = 0x682d; + static constexpr Tagged_t kepochMicroseconds_string = 0x6841; + static constexpr Tagged_t kepochMilliseconds_string = 0x6861; + static constexpr Tagged_t kepochNanoseconds_string = 0x6881; + static constexpr Tagged_t kepochSeconds_string = 0x689d; + static constexpr Tagged_t kera_string = 0x68b5; + static constexpr Tagged_t keraYear_string = 0x68c5; + static constexpr Tagged_t kerrors_string = 0x68d9; + static constexpr Tagged_t kerror_to_string = 0x68ed; + static constexpr Tagged_t keval_string = 0x6909; + static constexpr Tagged_t kexception_string = 0x6919; + static constexpr Tagged_t kexec_string = 0x6931; + static constexpr Tagged_t kfalse_string = 0x6941; + static constexpr Tagged_t kfields_string = 0x6955; + static constexpr Tagged_t kFinalizationRegistry_string = 0x6969; + static constexpr Tagged_t kflags_string = 0x6989; + static constexpr Tagged_t kFloat32Array_string = 0x699d; + static constexpr Tagged_t kFloat64Array_string = 0x69b5; + static constexpr Tagged_t kfractionalSecondDigits_string = 0x69cd; + static constexpr Tagged_t kfrom_string = 0x69f1; + static constexpr Tagged_t kFunction_string = 0x6a01; + static constexpr Tagged_t kfunction_native_code_string = 0x6a15; + static constexpr Tagged_t kfunction_string = 0x6a41; + static constexpr Tagged_t kfunction_to_string = 0x6a55; + static constexpr Tagged_t kGenerator_string = 0x6a75; + static constexpr Tagged_t kget_space_string = 0x6a8d; + static constexpr Tagged_t kget_string = 0x6a9d; + static constexpr Tagged_t kgetOffsetNanosecondsFor_string = 0x6aad; + static constexpr Tagged_t kgetOwnPropertyDescriptor_string = 0x6ad1; + static constexpr Tagged_t kgetPossibleInstantsFor_string = 0x6af5; + static constexpr Tagged_t kgetPrototypeOf_string = 0x6b19; + static constexpr Tagged_t kglobal_string = 0x6b35; + static constexpr Tagged_t kglobalThis_string = 0x6b49; + static constexpr Tagged_t kgroups_string = 0x6b61; + static constexpr Tagged_t kgrowable_string = 0x6b75; + static constexpr Tagged_t khas_string = 0x6b89; + static constexpr Tagged_t khasIndices_string = 0x6b99; + static constexpr Tagged_t khour_string = 0x6bb1; + static constexpr Tagged_t khours_string = 0x6bc1; + static constexpr Tagged_t khoursInDay_string = 0x6bd5; + static constexpr Tagged_t kignoreCase_string = 0x6bed; + static constexpr Tagged_t kid_string = 0x6c05; + static constexpr Tagged_t killegal_access_string = 0x6c15; + static constexpr Tagged_t killegal_argument_string = 0x6c31; + static constexpr Tagged_t kinLeapYear_string = 0x6c4d; + static constexpr Tagged_t kindex_string = 0x6c65; + static constexpr Tagged_t kindices_string = 0x6c79; + static constexpr Tagged_t kInfinity_string = 0x6c8d; + static constexpr Tagged_t kinfinity_string = 0x6ca1; + static constexpr Tagged_t kinput_string = 0x6cb5; + static constexpr Tagged_t kInt16Array_string = 0x6cc9; + static constexpr Tagged_t kInt32Array_string = 0x6ce1; + static constexpr Tagged_t kInt8Array_string = 0x6cf9; + static constexpr Tagged_t kisExtensible_string = 0x6d11; + static constexpr Tagged_t kiso8601_string = 0x6d29; + static constexpr Tagged_t kisoDay_string = 0x6d3d; + static constexpr Tagged_t kisoHour_string = 0x6d51; + static constexpr Tagged_t kisoMicrosecond_string = 0x6d65; + static constexpr Tagged_t kisoMillisecond_string = 0x6d81; + static constexpr Tagged_t kisoMinute_string = 0x6d9d; + static constexpr Tagged_t kisoMonth_string = 0x6db5; + static constexpr Tagged_t kisoNanosecond_string = 0x6dc9; + static constexpr Tagged_t kisoSecond_string = 0x6de5; + static constexpr Tagged_t kisoYear_string = 0x6dfd; + static constexpr Tagged_t kjsMemoryEstimate_string = 0x6e11; + static constexpr Tagged_t kjsMemoryRange_string = 0x6e2d; + static constexpr Tagged_t kkeys_string = 0x6e49; + static constexpr Tagged_t klargestUnit_string = 0x6e59; + static constexpr Tagged_t klastIndex_string = 0x6e71; + static constexpr Tagged_t klength_string = 0x6e89; + static constexpr Tagged_t klet_string = 0x6e9d; + static constexpr Tagged_t kline_string = 0x6ead; + static constexpr Tagged_t klinear_string = 0x6ebd; + static constexpr Tagged_t kLinkError_string = 0x6ed1; + static constexpr Tagged_t klong_string = 0x6ee9; + static constexpr Tagged_t kMap_string = 0x6ef9; + static constexpr Tagged_t kMapIterator_string = 0x6f09; + static constexpr Tagged_t kmax_byte_length_string = 0x6f21; + static constexpr Tagged_t kmedium_string = 0x6f3d; + static constexpr Tagged_t kmergeFields_string = 0x6f51; + static constexpr Tagged_t kmessage_string = 0x6f69; + static constexpr Tagged_t kmeta_string = 0x6f7d; + static constexpr Tagged_t kminus_Infinity_string = 0x6f8d; + static constexpr Tagged_t kmicrosecond_string = 0x6fa5; + static constexpr Tagged_t kmicroseconds_string = 0x6fbd; + static constexpr Tagged_t kmillisecond_string = 0x6fd5; + static constexpr Tagged_t kmilliseconds_string = 0x6fed; + static constexpr Tagged_t kminute_string = 0x7005; + static constexpr Tagged_t kminutes_string = 0x7019; + static constexpr Tagged_t kModule_string = 0x702d; + static constexpr Tagged_t kmonth_string = 0x7041; + static constexpr Tagged_t kmonthDayFromFields_string = 0x7055; + static constexpr Tagged_t kmonths_string = 0x7075; + static constexpr Tagged_t kmonthsInYear_string = 0x7089; + static constexpr Tagged_t kmonthCode_string = 0x70a1; + static constexpr Tagged_t kmultiline_string = 0x70b9; + static constexpr Tagged_t kname_string = 0x70d1; + static constexpr Tagged_t kNaN_string = 0x70e1; + static constexpr Tagged_t knanosecond_string = 0x70f1; + static constexpr Tagged_t knanoseconds_string = 0x7109; + static constexpr Tagged_t knarrow_string = 0x7121; + static constexpr Tagged_t knative_string = 0x7135; + static constexpr Tagged_t kNFC_string = 0x7149; + static constexpr Tagged_t kNFD_string = 0x7159; + static constexpr Tagged_t kNFKC_string = 0x7169; + static constexpr Tagged_t kNFKD_string = 0x7179; + static constexpr Tagged_t knot_equal_string = 0x7189; + static constexpr Tagged_t knull_string = 0x71a1; + static constexpr Tagged_t knull_to_string = 0x71b1; + static constexpr Tagged_t kNumber_string = 0x71cd; + static constexpr Tagged_t knumber_string = 0x71e1; + static constexpr Tagged_t knumber_to_string = 0x71f5; + static constexpr Tagged_t kObject_string = 0x7211; + static constexpr Tagged_t kobject_string = 0x7225; + static constexpr Tagged_t kobject_to_string = 0x7239; + static constexpr Tagged_t kof_string = 0x7255; + static constexpr Tagged_t koffset_string = 0x7265; + static constexpr Tagged_t koffsetNanoseconds_string = 0x7279; + static constexpr Tagged_t kok_string = 0x7299; + static constexpr Tagged_t kother_string = 0x72a9; + static constexpr Tagged_t koverflow_string = 0x72bd; + static constexpr Tagged_t kownKeys_string = 0x72d1; + static constexpr Tagged_t kpercent_string = 0x72e5; + static constexpr Tagged_t kplainDate_string = 0x72f9; + static constexpr Tagged_t kplainTime_string = 0x7311; + static constexpr Tagged_t kposition_string = 0x7329; + static constexpr Tagged_t kpreventExtensions_string = 0x733d; + static constexpr Tagged_t kprivate_constructor_string = 0x735d; + static constexpr Tagged_t kPromise_string = 0x7375; + static constexpr Tagged_t kproto_string = 0x7389; + static constexpr Tagged_t kprototype_string = 0x73a1; + static constexpr Tagged_t kproxy_string = 0x73b9; + static constexpr Tagged_t kProxy_string = 0x73cd; + static constexpr Tagged_t kquery_colon_string = 0x73e1; + static constexpr Tagged_t kRangeError_string = 0x73f1; + static constexpr Tagged_t kraw_json_string = 0x7409; + static constexpr Tagged_t kraw_string = 0x741d; + static constexpr Tagged_t kReferenceError_string = 0x742d; + static constexpr Tagged_t kReflectGet_string = 0x7449; + static constexpr Tagged_t kReflectHas_string = 0x7461; + static constexpr Tagged_t kRegExp_string = 0x7479; + static constexpr Tagged_t kregexp_to_string = 0x748d; + static constexpr Tagged_t kreject_string = 0x74a9; + static constexpr Tagged_t krelativeTo_string = 0x74bd; + static constexpr Tagged_t kresizable_string = 0x74d5; + static constexpr Tagged_t kResizableArrayBuffer_string = 0x74ed; + static constexpr Tagged_t kreturn_string = 0x750d; + static constexpr Tagged_t krevoke_string = 0x7521; + static constexpr Tagged_t kroundingIncrement_string = 0x7535; + static constexpr Tagged_t kRuntimeError_string = 0x7555; + static constexpr Tagged_t kWebAssemblyException_string = 0x756d; + static constexpr Tagged_t kScript_string = 0x7591; + static constexpr Tagged_t kscript_string = 0x75a5; + static constexpr Tagged_t ksecond_string = 0x75b9; + static constexpr Tagged_t kseconds_string = 0x75cd; + static constexpr Tagged_t kshort_string = 0x75e1; + static constexpr Tagged_t kSet_string = 0x75f5; + static constexpr Tagged_t ksentence_string = 0x7605; + static constexpr Tagged_t kset_space_string = 0x7619; + static constexpr Tagged_t kset_string = 0x7629; + static constexpr Tagged_t kSetIterator_string = 0x7639; + static constexpr Tagged_t ksetPrototypeOf_string = 0x7651; + static constexpr Tagged_t kShadowRealm_string = 0x766d; + static constexpr Tagged_t kSharedArray_string = 0x7685; + static constexpr Tagged_t kSharedArrayBuffer_string = 0x769d; + static constexpr Tagged_t kSharedStruct_string = 0x76bd; + static constexpr Tagged_t ksign_string = 0x76d5; + static constexpr Tagged_t ksmallestUnit_string = 0x76e5; + static constexpr Tagged_t ksource_string = 0x76fd; + static constexpr Tagged_t ksourceText_string = 0x7711; + static constexpr Tagged_t kstack_string = 0x7729; + static constexpr Tagged_t kstackTraceLimit_string = 0x773d; + static constexpr Tagged_t ksticky_string = 0x7759; + static constexpr Tagged_t kString_string = 0x776d; + static constexpr Tagged_t kstring_string = 0x7781; + static constexpr Tagged_t kstring_to_string = 0x7795; + static constexpr Tagged_t kSymbol_iterator_string = 0x77b1; + static constexpr Tagged_t kSymbol_replace_string = 0x77cd; + static constexpr Tagged_t ksymbol_species_string = 0x77e9; + static constexpr Tagged_t kSymbol_species_string = 0x7805; + static constexpr Tagged_t kSymbol_string = 0x7821; + static constexpr Tagged_t ksymbol_string = 0x7835; + static constexpr Tagged_t kSyntaxError_string = 0x7849; + static constexpr Tagged_t ktarget_string = 0x7861; + static constexpr Tagged_t kthis_function_string = 0x7875; + static constexpr Tagged_t kthis_string = 0x7891; + static constexpr Tagged_t kthrow_string = 0x78a1; + static constexpr Tagged_t ktimed_out_string = 0x78b5; + static constexpr Tagged_t ktimeZone_string = 0x78cd; + static constexpr Tagged_t ktoJSON_string = 0x78e1; + static constexpr Tagged_t ktoString_string = 0x78f5; + static constexpr Tagged_t ktrue_string = 0x7909; + static constexpr Tagged_t ktotal_string = 0x7919; + static constexpr Tagged_t kTypeError_string = 0x792d; + static constexpr Tagged_t kUint16Array_string = 0x7945; + static constexpr Tagged_t kUint32Array_string = 0x795d; + static constexpr Tagged_t kUint8Array_string = 0x7975; + static constexpr Tagged_t kUint8ClampedArray_string = 0x798d; + static constexpr Tagged_t kundefined_string = 0x79ad; + static constexpr Tagged_t kundefined_to_string = 0x79c5; + static constexpr Tagged_t kunicode_string = 0x79e5; + static constexpr Tagged_t kunicodeSets_string = 0x79f9; + static constexpr Tagged_t kunit_string = 0x7a11; + static constexpr Tagged_t kURIError_string = 0x7a21; + static constexpr Tagged_t kUTC_string = 0x7a35; + static constexpr Tagged_t kvalue_string = 0x7a45; + static constexpr Tagged_t kvalueOf_string = 0x7a59; + static constexpr Tagged_t kWeakMap_string = 0x7a6d; + static constexpr Tagged_t kWeakRef_string = 0x7a81; + static constexpr Tagged_t kWeakSet_string = 0x7a95; + static constexpr Tagged_t kweek_string = 0x7aa9; + static constexpr Tagged_t kweeks_string = 0x7ab9; + static constexpr Tagged_t kweekOfYear_string = 0x7acd; + static constexpr Tagged_t kword_string = 0x7ae5; + static constexpr Tagged_t kwritable_string = 0x7af5; + static constexpr Tagged_t kyearMonthFromFields_string = 0x7b09; + static constexpr Tagged_t kyear_string = 0x7b29; + static constexpr Tagged_t kyears_string = 0x7b39; + static constexpr Tagged_t kUninitializedValue = 0x7b5d; + static constexpr Tagged_t kArgumentsMarker = 0x7b95; + static constexpr Tagged_t kTerminationException = 0x7bcd; + static constexpr Tagged_t kException = 0x7c0d; + static constexpr Tagged_t kOptimizedOut = 0x7c29; + static constexpr Tagged_t kStaleRegister = 0x7c61; + static constexpr Tagged_t kSelfReferenceMarker = 0x7c99; + static constexpr Tagged_t kBasicBlockCountersMarker = 0x7cd9; + static constexpr Tagged_t karray_buffer_wasm_memory_symbol = 0x7d1d; + static constexpr Tagged_t kcall_site_info_symbol = 0x7d2d; + static constexpr Tagged_t kconsole_context_id_symbol = 0x7d3d; + static constexpr Tagged_t kconsole_context_name_symbol = 0x7d4d; + static constexpr Tagged_t kclass_fields_symbol = 0x7d5d; + static constexpr Tagged_t kclass_positions_symbol = 0x7d6d; + static constexpr Tagged_t kelements_transition_symbol = 0x7d7d; + static constexpr Tagged_t kerror_end_pos_symbol = 0x7d8d; + static constexpr Tagged_t kerror_script_symbol = 0x7d9d; + static constexpr Tagged_t kerror_stack_symbol = 0x7dad; + static constexpr Tagged_t kerror_start_pos_symbol = 0x7dbd; + static constexpr Tagged_t kfrozen_symbol = 0x7dcd; + static constexpr Tagged_t kinterpreter_trampoline_symbol = 0x7ddd; + static constexpr Tagged_t kmega_dom_symbol = 0x7ded; + static constexpr Tagged_t kmegamorphic_symbol = 0x7dfd; + static constexpr Tagged_t knative_context_index_symbol = 0x7e0d; + static constexpr Tagged_t knonextensible_symbol = 0x7e1d; + static constexpr Tagged_t knot_mapped_symbol = 0x7e2d; + static constexpr Tagged_t kpromise_debug_marker_symbol = 0x7e3d; + static constexpr Tagged_t kpromise_debug_message_symbol = 0x7e4d; + static constexpr Tagged_t kpromise_forwarding_handler_symbol = 0x7e5d; + static constexpr Tagged_t kpromise_handled_by_symbol = 0x7e6d; + static constexpr Tagged_t kpromise_awaited_by_symbol = 0x7e7d; + static constexpr Tagged_t kregexp_result_names_symbol = 0x7e8d; + static constexpr Tagged_t kregexp_result_regexp_input_symbol = 0x7e9d; + static constexpr Tagged_t kregexp_result_regexp_last_index_symbol = 0x7ead; + static constexpr Tagged_t ksealed_symbol = 0x7ebd; + static constexpr Tagged_t kstrict_function_transition_symbol = 0x7ecd; static constexpr Tagged_t ktemplate_literal_function_literal_id_symbol = - 0x7eb5; - static constexpr Tagged_t ktemplate_literal_slot_id_symbol = 0x7ec5; - static constexpr Tagged_t kwasm_exception_tag_symbol = 0x7ed5; - static constexpr Tagged_t kwasm_exception_values_symbol = 0x7ee5; - static constexpr Tagged_t kwasm_uncatchable_symbol = 0x7ef5; - static constexpr Tagged_t kwasm_wrapped_object_symbol = 0x7f05; - static constexpr Tagged_t kwasm_debug_proxy_cache_symbol = 0x7f15; - static constexpr Tagged_t kwasm_debug_proxy_names_symbol = 0x7f25; - static constexpr Tagged_t kuninitialized_symbol = 0x7f35; - static constexpr Tagged_t kasync_iterator_symbol = 0x7f45; - static constexpr Tagged_t kintl_fallback_symbol = 0x7f75; - static constexpr Tagged_t kmatch_all_symbol = 0x7fad; - static constexpr Tagged_t kmatch_symbol = 0x7fd9; - static constexpr Tagged_t ksearch_symbol = 0x8001; - static constexpr Tagged_t ksplit_symbol = 0x802d; - static constexpr Tagged_t kto_primitive_symbol = 0x8055; - static constexpr Tagged_t kunscopables_symbol = 0x8085; - static constexpr Tagged_t khas_instance_symbol = 0x80b5; - static constexpr Tagged_t kto_string_tag_symbol = 0x80e5; - static constexpr Tagged_t kconstructor_string = 0x813d; - static constexpr Tagged_t knext_string = 0x8155; - static constexpr Tagged_t kresolve_string = 0x8165; - static constexpr Tagged_t kthen_string = 0x8179; - static constexpr Tagged_t kiterator_symbol = 0x8189; - static constexpr Tagged_t kreplace_symbol = 0x8199; - static constexpr Tagged_t kspecies_symbol = 0x81a9; - static constexpr Tagged_t kis_concat_spreadable_symbol = 0x81b9; - static constexpr Tagged_t kEmptyPropertyDictionary = 0x81c9; - static constexpr Tagged_t kEmptySymbolTable = 0x81f1; - static constexpr Tagged_t kEmptySlowElementDictionary = 0x820d; - static constexpr Tagged_t kEmptyOrderedHashMap = 0x8231; - static constexpr Tagged_t kEmptyOrderedHashSet = 0x8245; - static constexpr Tagged_t kEmptyOrderedPropertyDictionary = 0x8259; - static constexpr Tagged_t kEmptySwissPropertyDictionary = 0x827d; - static constexpr Tagged_t kEmptyFeedbackMetadata = 0x829d; - static constexpr Tagged_t kGlobalThisBindingScopeInfo = 0x82a9; - static constexpr Tagged_t kEmptyFunctionScopeInfo = 0x82c9; - static constexpr Tagged_t kNativeScopeInfo = 0x82ed; - static constexpr Tagged_t kShadowRealmScopeInfo = 0x8305; + 0x7edd; + static constexpr Tagged_t ktemplate_literal_slot_id_symbol = 0x7eed; + static constexpr Tagged_t kwasm_exception_tag_symbol = 0x7efd; + static constexpr Tagged_t kwasm_exception_values_symbol = 0x7f0d; + static constexpr Tagged_t kwasm_uncatchable_symbol = 0x7f1d; + static constexpr Tagged_t kwasm_wrapped_object_symbol = 0x7f2d; + static constexpr Tagged_t kwasm_debug_proxy_cache_symbol = 0x7f3d; + static constexpr Tagged_t kwasm_debug_proxy_names_symbol = 0x7f4d; + static constexpr Tagged_t kuninitialized_symbol = 0x7f5d; + static constexpr Tagged_t kasync_iterator_symbol = 0x7f6d; + static constexpr Tagged_t kintl_fallback_symbol = 0x7f9d; + static constexpr Tagged_t kmatch_all_symbol = 0x7fd5; + static constexpr Tagged_t kmatch_symbol = 0x8001; + static constexpr Tagged_t ksearch_symbol = 0x8029; + static constexpr Tagged_t ksplit_symbol = 0x8055; + static constexpr Tagged_t kto_primitive_symbol = 0x807d; + static constexpr Tagged_t kunscopables_symbol = 0x80ad; + static constexpr Tagged_t khas_instance_symbol = 0x80dd; + static constexpr Tagged_t kto_string_tag_symbol = 0x810d; + static constexpr Tagged_t kconstructor_string = 0x8165; + static constexpr Tagged_t knext_string = 0x817d; + static constexpr Tagged_t kresolve_string = 0x818d; + static constexpr Tagged_t kthen_string = 0x81a1; + static constexpr Tagged_t kiterator_symbol = 0x81b1; + static constexpr Tagged_t kreplace_symbol = 0x81c1; + static constexpr Tagged_t kspecies_symbol = 0x81d1; + static constexpr Tagged_t kis_concat_spreadable_symbol = 0x81e1; + static constexpr Tagged_t kEmptyPropertyDictionary = 0x81f1; + static constexpr Tagged_t kEmptySymbolTable = 0x8219; + static constexpr Tagged_t kEmptySlowElementDictionary = 0x8235; + static constexpr Tagged_t kEmptyOrderedHashMap = 0x8259; + static constexpr Tagged_t kEmptyOrderedHashSet = 0x826d; + static constexpr Tagged_t kEmptyOrderedPropertyDictionary = 0x8281; + static constexpr Tagged_t kEmptySwissPropertyDictionary = 0x82a5; + static constexpr Tagged_t kEmptyFeedbackMetadata = 0x82c5; + static constexpr Tagged_t kGlobalThisBindingScopeInfo = 0x82d1; + static constexpr Tagged_t kEmptyFunctionScopeInfo = 0x82f1; + static constexpr Tagged_t kNativeScopeInfo = 0x8315; + static constexpr Tagged_t kShadowRealmScopeInfo = 0x832d; + static constexpr Tagged_t kWasmNull = 0xfffd; }; -static constexpr std::array StaticReadOnlyRootsPointerTable = { +static constexpr std::array StaticReadOnlyRootsPointerTable = { StaticReadOnlyRoot::kFreeSpaceMap, StaticReadOnlyRoot::kOnePointerFillerMap, StaticReadOnlyRoot::kTwoPointerFillerMap, @@ -848,6 +850,7 @@ static constexpr std::array StaticReadOnlyRootsPointerTable = { StaticReadOnlyRoot::kWasmResumeDataMap, StaticReadOnlyRoot::kWasmTypeInfoMap, StaticReadOnlyRoot::kWasmContinuationObjectMap, + StaticReadOnlyRoot::kWasmNullMap, StaticReadOnlyRoot::kWeakFixedArrayMap, StaticReadOnlyRoot::kWeakArrayListMap, StaticReadOnlyRoot::kEphemeronHashTableMap, @@ -924,6 +927,7 @@ static constexpr std::array StaticReadOnlyRootsPointerTable = { StaticReadOnlyRoot::kShadowRealmScopeInfo, StaticReadOnlyRoot::kEmptySymbolTable, StaticReadOnlyRoot::kHashSeed, + StaticReadOnlyRoot::kWasmNull, StaticReadOnlyRoot::kadoptText_string, StaticReadOnlyRoot::kapproximatelySign_string, StaticReadOnlyRoot::kbaseName_string, @@ -1533,7 +1537,7 @@ StaticReadOnlyRootMapRange(InstanceType first, InstanceType last) { return {}; } -static constexpr size_t kStaticReadOnlyRootRangesHash = 4014968950881612012UL; +static constexpr size_t kStaticReadOnlyRootRangesHash = 5915114177648558262UL; } // namespace internal } // namespace v8 diff --git a/src/runtime/runtime-wasm.cc b/src/runtime/runtime-wasm.cc index 95078dd1d2..41e64ca89f 100644 --- a/src/runtime/runtime-wasm.cc +++ b/src/runtime/runtime-wasm.cc @@ -951,7 +951,7 @@ RUNTIME_FUNCTION(Runtime_WasmStringNewWtf8) { if (utf8_variant == unibrow::Utf8Variant::kUtf8NoTrap) { DCHECK(!isolate->has_pending_exception()); if (result_string.is_null()) { - return *isolate->factory()->null_value(); + return *isolate->factory()->wasm_null(); } return *result_string.ToHandleChecked(); } @@ -976,7 +976,7 @@ RUNTIME_FUNCTION(Runtime_WasmStringNewWtf8Array) { if (utf8_variant == unibrow::Utf8Variant::kUtf8NoTrap) { DCHECK(!isolate->has_pending_exception()); if (result_string.is_null()) { - return *isolate->factory()->null_value(); + return *isolate->factory()->wasm_null(); } return *result_string.ToHandleChecked(); } diff --git a/src/wasm/baseline/liftoff-compiler.cc b/src/wasm/baseline/liftoff-compiler.cc index 01017c117d..0e0b96566e 100644 --- a/src/wasm/baseline/liftoff-compiler.cc +++ b/src/wasm/baseline/liftoff-compiler.cc @@ -923,14 +923,22 @@ class LiftoffCompiler { // Initialize all reference type locals with ref.null. if (has_refs) { - Register null_ref_reg = __ GetUnusedRegister(kGpReg, {}).gp(); - LoadNullValue(null_ref_reg, {}); + LiftoffRegList pinned; + Register null_ref_reg = + pinned.set(__ GetUnusedRegister(kGpReg, pinned).gp()); + Register wasm_null_ref_reg = + pinned.set(__ GetUnusedRegister(kGpReg, pinned).gp()); + LoadNullValue(null_ref_reg, pinned, kWasmExternRef); + LoadNullValue(wasm_null_ref_reg, pinned, kWasmAnyRef); for (uint32_t local_index = num_params; local_index < __ num_locals(); ++local_index) { - ValueKind kind = __ local_kind(local_index); - if (is_reference(kind)) { + ValueType type = decoder->local_types_[local_index]; + if (type.is_reference()) { __ Spill(__ cache_state()->stack_state[local_index].offset(), - LiftoffRegister(null_ref_reg), kind); + IsSubtypeOf(type, kWasmExternRef, decoder->module_) + ? LiftoffRegister(null_ref_reg) + : LiftoffRegister(wasm_null_ref_reg), + type.kind()); } } } @@ -1705,11 +1713,11 @@ class LiftoffCompiler { __ PushRegister(dst_kind, dst); } - void EmitIsNull(WasmOpcode opcode) { + void EmitIsNull(WasmOpcode opcode, ValueType type) { LiftoffRegList pinned; LiftoffRegister ref = pinned.set(__ PopToRegister()); LiftoffRegister null = __ GetUnusedRegister(kGpReg, pinned); - LoadNullValueForCompare(null.gp(), pinned); + LoadNullValueForCompare(null.gp(), pinned, type); // Prefer to overwrite one of the input registers with the result // of the comparison. LiftoffRegister dst = __ GetUnusedRegister(kGpReg, {ref, null}, {}); @@ -1854,7 +1862,7 @@ class LiftoffCompiler { // We abuse ref.as_non_null, which isn't otherwise used in this switch, as // a sentinel for the negation of ref.is_null. case kExprRefAsNonNull: - return EmitIsNull(opcode); + return EmitIsNull(opcode, value.type); case kExprExternInternalize: { LiftoffAssembler::VarState input_state = __ cache_state()->stack_state.back(); @@ -1865,9 +1873,22 @@ class LiftoffCompiler { __ PushRegister(kRef, LiftoffRegister(kReturnRegister0)); return; } - case kExprExternExternalize: - // This is a no-op. + case kExprExternExternalize: { + LiftoffRegList pinned; + LiftoffRegister ref = pinned.set(__ PopToRegister(pinned)); + LiftoffRegister null = __ GetUnusedRegister(kGpReg, pinned); + LoadNullValueForCompare(null.gp(), pinned, kWasmAnyRef); + Label label; + { + FREEZE_STATE(frozen); + __ emit_cond_jump(kNotEqual, &label, kRefNull, ref.gp(), null.gp(), + frozen); + LoadNullValue(ref.gp(), pinned, kWasmExternRef); + __ bind(&label); + } + __ PushRegister(kRefNull, ref); return; + } default: UNREACHABLE(); } @@ -2294,7 +2315,7 @@ class LiftoffCompiler { void RefNull(FullDecoder* decoder, ValueType type, Value*) { LiftoffRegister null = __ GetUnusedRegister(kGpReg, {}); - LoadNullValue(null.gp(), {}); + LoadNullValue(null.gp(), {}, type); __ PushRegister(type.kind(), null); } @@ -2663,7 +2684,7 @@ class LiftoffCompiler { Label* trap_label = AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapIllegalCast); LiftoffRegister null = __ GetUnusedRegister(kGpReg, pinned); - LoadNullValueForCompare(null.gp(), pinned); + LoadNullValueForCompare(null.gp(), pinned, arg.type); { FREEZE_STATE(trapping); __ emit_cond_jump(cond, trap_label, kRefNull, obj.gp(), null.gp(), @@ -3580,7 +3601,7 @@ class LiftoffCompiler { Register tmp = NeedsTierupCheck(decoder, depth) ? pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp() : no_reg; - LoadNullValueForCompare(null, pinned); + LoadNullValueForCompare(null, pinned, ref_object.type); { FREEZE_STATE(frozen); __ emit_cond_jump(kNotEqual, &cont_false, ref_object.type.kind(), @@ -3610,7 +3631,7 @@ class LiftoffCompiler { Register tmp = NeedsTierupCheck(decoder, depth) ? pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp() : no_reg; - LoadNullValueForCompare(null, pinned); + LoadNullValueForCompare(null, pinned, ref_object.type); { FREEZE_STATE(frozen); __ emit_cond_jump(kEqual, &cont_false, ref_object.type.kind(), ref.gp(), @@ -5538,16 +5559,19 @@ class LiftoffCompiler { for (uint32_t i = imm.struct_type->field_count(); i > 0;) { i--; int offset = StructFieldOffset(imm.struct_type, i); - ValueKind field_kind = imm.struct_type->field(i).kind(); + ValueType field_type = imm.struct_type->field(i); LiftoffRegister value = pinned.set( initial_values_on_stack ? __ PopToRegister(pinned) - : __ GetUnusedRegister(reg_class_for(field_kind), pinned)); + : __ GetUnusedRegister(reg_class_for(field_type.kind()), pinned)); if (!initial_values_on_stack) { - if (!CheckSupportedType(decoder, field_kind, "default value")) return; - SetDefaultValue(value, field_kind, pinned); + if (!CheckSupportedType(decoder, field_type.kind(), "default value")) { + return; + } + SetDefaultValue(value, field_type, pinned); } - StoreObjectField(obj.gp(), no_reg, offset, value, pinned, field_kind); + StoreObjectField(obj.gp(), no_reg, offset, value, pinned, + field_type.kind()); pinned.clear(value); } // If this assert fails then initialization of padding field might be @@ -5608,7 +5632,8 @@ class LiftoffCompiler { __ emit_i32_cond_jumpi(kUnsignedGreaterThan, trap_label, length.gp(), WasmArray::MaxLength(imm.array_type), trapping); } - ValueKind elem_kind = imm.array_type->element_type().kind(); + ValueType elem_type = imm.array_type->element_type(); + ValueKind elem_kind = elem_type.kind(); int elem_size = value_kind_size(elem_kind); // Allocate the array. { @@ -5636,7 +5661,7 @@ class LiftoffCompiler { __ PopToFixedRegister(value); } else { if (!CheckSupportedType(decoder, elem_kind, "default value")) return; - SetDefaultValue(value, elem_kind, pinned); + SetDefaultValue(value, elem_type, pinned); } // Initialize the array's elements. LiftoffRegister offset = pinned.set(__ GetUnusedRegister(kGpReg, pinned)); @@ -5994,7 +6019,9 @@ class LiftoffCompiler { Register scratch_null = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); LiftoffRegister result = pinned.set(__ GetUnusedRegister(kGpReg, pinned)); - if (obj.type.is_nullable()) LoadNullValueForCompare(scratch_null, pinned); + if (obj.type.is_nullable()) { + LoadNullValueForCompare(scratch_null, pinned, obj.type); + } { FREEZE_STATE(frozen); @@ -6028,7 +6055,7 @@ class LiftoffCompiler { case HeapType::kNoExtern: case HeapType::kNoFunc: DCHECK(null_succeeds); - return EmitIsNull(kExprRefIsNull); + return EmitIsNull(kExprRefIsNull, obj.type); case HeapType::kAny: // Any may never need a cast as it is either implicitly convertible or // never convertible for any given type. @@ -6052,7 +6079,9 @@ class LiftoffCompiler { Register scratch_null = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); Register scratch2 = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); - if (obj.type.is_nullable()) LoadNullValueForCompare(scratch_null, pinned); + if (obj.type.is_nullable()) { + LoadNullValueForCompare(scratch_null, pinned, obj.type); + } { FREEZE_STATE(frozen); @@ -6103,7 +6132,9 @@ class LiftoffCompiler { Register scratch_null = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); Register scratch2 = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); - if (obj.type.is_nullable()) LoadNullValue(scratch_null, pinned); + if (obj.type.is_nullable()) { + LoadNullValue(scratch_null, pinned, kWasmAnyRef); + } FREEZE_STATE(frozen); NullSucceeds null_handling = null_succeeds ? kNullSucceeds : kNullFails; @@ -6131,7 +6162,9 @@ class LiftoffCompiler { Register scratch_null = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); Register scratch2 = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); - if (obj.type.is_nullable()) LoadNullValue(scratch_null, pinned); + if (obj.type.is_nullable()) { + LoadNullValue(scratch_null, pinned, kWasmAnyRef); + } FREEZE_STATE(frozen); NullSucceeds null_handling = null_succeeds ? kNullSucceeds : kNullFails; @@ -6219,7 +6252,7 @@ class LiftoffCompiler { enum PopOrPeek { kPop, kPeek }; - void Initialize(TypeCheck& check, PopOrPeek pop_or_peek) { + void Initialize(TypeCheck& check, PopOrPeek pop_or_peek, ValueType type) { LiftoffRegList pinned; if (pop_or_peek == kPop) { check.obj_reg = pinned.set(__ PopToRegister(pinned)).gp(); @@ -6229,7 +6262,7 @@ class LiftoffCompiler { check.tmp1 = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); check.tmp2 = pinned.set(__ GetUnusedRegister(kGpReg, pinned)).gp(); if (check.obj_type.is_nullable()) { - LoadNullValue(check.null_reg(), pinned); + LoadNullValue(check.null_reg(), pinned, type); } } void LoadInstanceType(TypeCheck& check, const FreezeCacheState& frozen, @@ -6289,7 +6322,7 @@ class LiftoffCompiler { void AbstractTypeCheck(const Value& object, bool null_succeeds) { Label match, no_match, done; TypeCheck check(object.type, &no_match, null_succeeds); - Initialize(check, kPop); + Initialize(check, kPop, object.type); LiftoffRegister result(check.tmp1); { FREEZE_STATE(frozen); @@ -6340,7 +6373,7 @@ class LiftoffCompiler { Label* trap_label = AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapIllegalCast); TypeCheck check(object.type, trap_label, null_succeeds); - Initialize(check, kPeek); + Initialize(check, kPeek, object.type); FREEZE_STATE(frozen); if (null_succeeds && check.obj_type.is_nullable()) { @@ -6385,7 +6418,7 @@ class LiftoffCompiler { Label no_match, match; TypeCheck check(object.type, &no_match, null_succeeds); - Initialize(check, kPeek); + Initialize(check, kPeek, object.type); FREEZE_STATE(frozen); if (null_succeeds && check.obj_type.is_nullable()) { @@ -6410,7 +6443,7 @@ class LiftoffCompiler { Label no_match, end; TypeCheck check(object.type, &no_match, null_succeeds); - Initialize(check, kPeek); + Initialize(check, kPeek, object.type); FREEZE_STATE(frozen); if (null_succeeds && check.obj_type.is_nullable()) { @@ -6844,7 +6877,7 @@ class LiftoffCompiler { LiftoffRegister null = pinned.set(__ GetUnusedRegister(kGpReg, pinned)); bool check_for_null = a.type.is_nullable() || b.type.is_nullable(); if (check_for_null) { - LoadNullValueForCompare(null.gp(), pinned); + LoadNullValueForCompare(null.gp(), pinned, kWasmStringRef); } FREEZE_STATE(frozen); @@ -7758,25 +7791,30 @@ class LiftoffCompiler { } } - void LoadNullValue(Register null, LiftoffRegList pinned) { - __ LoadFullPointer(null, kRootRegister, - IsolateData::root_slot_offset(RootIndex::kNullValue)); + void LoadNullValue(Register null, LiftoffRegList pinned, ValueType type) { + __ LoadFullPointer( + null, kRootRegister, + type == kWasmExternRef || type == kWasmNullExternRef + ? IsolateData::root_slot_offset(RootIndex::kNullValue) + : IsolateData::root_slot_offset(RootIndex::kWasmNull)); } // Stores the null value representation in the passed register. // If pointer compression is active, only the compressed tagged pointer // will be stored. Any operations with this register therefore must // not compare this against 64 bits using quadword instructions. - void LoadNullValueForCompare(Register null, LiftoffRegList pinned) { + void LoadNullValueForCompare(Register null, LiftoffRegList pinned, + ValueType type) { Tagged_t static_null = - wasm::GetWasmEngine()->compressed_null_value_or_zero(); - if (static_null != 0) { + wasm::GetWasmEngine()->compressed_wasm_null_value_or_zero(); + if (type != kWasmExternRef && type != kWasmNullExternRef && + static_null != 0) { // static_null is only set for builds with pointer compression. DCHECK_LE(static_null, std::numeric_limits::max()); __ LoadConstant(LiftoffRegister(null), WasmValue(static_cast(static_null))); } else { - LoadNullValue(null, pinned); + LoadNullValue(null, pinned, type); } } @@ -7794,7 +7832,7 @@ class LiftoffCompiler { Label* trap_label = AddOutOfLineTrap(decoder, WasmCode::kThrowWasmTrapNullDereference); LiftoffRegister null = __ GetUnusedRegister(kGpReg, pinned); - LoadNullValueForCompare(null.gp(), pinned); + LoadNullValueForCompare(null.gp(), pinned, type); FREEZE_STATE(trapping); __ emit_cond_jump(kEqual, trap_label, kRefNull, object, null.gp(), trapping); @@ -7843,10 +7881,10 @@ class LiftoffCompiler { } } - void SetDefaultValue(LiftoffRegister reg, ValueKind kind, + void SetDefaultValue(LiftoffRegister reg, ValueType type, LiftoffRegList pinned) { - DCHECK(is_defaultable(kind)); - switch (kind) { + DCHECK(is_defaultable(type.kind())); + switch (type.kind()) { case kI8: case kI16: case kI32: @@ -7861,7 +7899,7 @@ class LiftoffCompiler { DCHECK(CpuFeatures::SupportsWasmSimd128()); return __ emit_s128_xor(reg, reg, reg); case kRefNull: - return LoadNullValue(reg.gp(), pinned); + return LoadNullValue(reg.gp(), pinned, type); case kRtt: case kVoid: case kBottom: diff --git a/src/wasm/c-api.cc b/src/wasm/c-api.cc index b1c6374e45..c930b588a6 100644 --- a/src/wasm/c-api.cc +++ b/src/wasm/c-api.cc @@ -1884,6 +1884,9 @@ auto Global::get() const -> Val { handle(i::Handle::cast(result)->external(), v8_global->GetIsolate()); } + if (result->IsWasmNull()) { + result = v8_global->GetIsolate()->factory()->null_value(); + } return Val(V8RefValueToWasm(store, result)); } case i::wasm::kS128: @@ -2023,6 +2026,9 @@ auto Table::get(size_t index) const -> own { result = handle( i::Handle::cast(result)->external(), isolate); } + if (result->IsWasmNull()) { + result = isolate->factory()->null_value(); + } DCHECK(result->IsNull(isolate) || result->IsJSReceiver()); return V8RefValueToWasm(impl(this)->store(), result); } diff --git a/src/wasm/constant-expression-interface.cc b/src/wasm/constant-expression-interface.cc index b7e34e2886..b3eac177bd 100644 --- a/src/wasm/constant-expression-interface.cc +++ b/src/wasm/constant-expression-interface.cc @@ -106,7 +106,11 @@ void ConstantExpressionInterface::BinOp(FullDecoder* decoder, WasmOpcode opcode, void ConstantExpressionInterface::RefNull(FullDecoder* decoder, ValueType type, Value* result) { if (!generate_value()) return; - result->runtime_value = WasmValue(isolate_->factory()->null_value(), type); + result->runtime_value = + WasmValue(type == kWasmExternRef || type == kWasmNullExternRef + ? Handle::cast(isolate_->factory()->null_value()) + : Handle::cast(isolate_->factory()->wasm_null()), + type); } void ConstantExpressionInterface::RefFunc(FullDecoder* decoder, diff --git a/src/wasm/constant-expression.cc b/src/wasm/constant-expression.cc index 6b6c69ad75..0459d2240a 100644 --- a/src/wasm/constant-expression.cc +++ b/src/wasm/constant-expression.cc @@ -35,8 +35,11 @@ ValueOrError EvaluateConstantExpression(Zone* zone, ConstantExpression expr, case ConstantExpression::kI32Const: return WasmValue(expr.i32_value()); case ConstantExpression::kRefNull: - return WasmValue(isolate->factory()->null_value(), - ValueType::RefNull(expr.repr())); + return WasmValue( + expected == kWasmExternRef || expected == kWasmNullExternRef + ? Handle::cast(isolate->factory()->null_value()) + : Handle::cast(isolate->factory()->wasm_null()), + ValueType::RefNull(expr.repr())); case ConstantExpression::kRefFunc: { uint32_t index = expr.index(); Handle value = diff --git a/src/wasm/graph-builder-interface.cc b/src/wasm/graph-builder-interface.cc index 3a176604ee..ebe8784378 100644 --- a/src/wasm/graph-builder-interface.cc +++ b/src/wasm/graph-builder-interface.cc @@ -233,7 +233,7 @@ class WasmGraphBuildingInterface { DCHECK(type.is_reference()); // TODO(jkummerow): Consider using "the hole" instead, to make any // illegal uses more obvious. - node = builder_->SetType(builder_->RefNull(), type); + node = builder_->SetType(builder_->RefNull(type), type); } else { node = builder_->SetType(builder_->DefaultValue(type), type); } @@ -444,8 +444,8 @@ class WasmGraphBuildingInterface { void UnOp(FullDecoder* decoder, WasmOpcode opcode, const Value& value, Value* result) { - SetAndTypeNode(result, - builder_->Unop(opcode, value.node, decoder->position())); + SetAndTypeNode(result, builder_->Unop(opcode, value.node, value.type, + decoder->position())); } void BinOp(FullDecoder* decoder, WasmOpcode opcode, const Value& lhs, @@ -481,7 +481,7 @@ class WasmGraphBuildingInterface { } void RefNull(FullDecoder* decoder, ValueType type, Value* result) { - SetAndTypeNode(result, builder_->RefNull()); + SetAndTypeNode(result, builder_->RefNull(type)); } void RefFunc(FullDecoder* decoder, uint32_t function_index, Value* result) { @@ -489,7 +489,8 @@ class WasmGraphBuildingInterface { } void RefAsNonNull(FullDecoder* decoder, const Value& arg, Value* result) { - TFNode* cast_node = builder_->AssertNotNull(arg.node, decoder->position()); + TFNode* cast_node = + builder_->AssertNotNull(arg.node, arg.type, decoder->position()); SetAndTypeNode(result, cast_node); } @@ -539,15 +540,16 @@ class WasmGraphBuildingInterface { void AssertNullTypecheck(FullDecoder* decoder, const Value& obj, Value* result) { builder_->TrapIfFalse(wasm::TrapReason::kTrapIllegalCast, - builder_->IsNull(obj.node), decoder->position()); + builder_->IsNull(obj.node, obj.type), + decoder->position()); Forward(decoder, obj, result); } void AssertNotNullTypecheck(FullDecoder* decoder, const Value& obj, Value* result) { - SetAndTypeNode(result, - builder_->AssertNotNull(obj.node, decoder->position(), - TrapReason::kTrapIllegalCast)); + SetAndTypeNode( + result, builder_->AssertNotNull(obj.node, obj.type, decoder->position(), + TrapReason::kTrapIllegalCast)); } void NopForTestingUnsupportedInLiftoff(FullDecoder* decoder) {} @@ -915,7 +917,7 @@ class WasmGraphBuildingInterface { SsaEnv* false_env = ssa_env_; SsaEnv* true_env = Split(decoder->zone(), false_env); false_env->SetNotMerged(); - builder_->BrOnNull(ref_object.node, &true_env->control, + builder_->BrOnNull(ref_object.node, ref_object.type, &true_env->control, &false_env->control); builder_->SetControl(false_env->control); { @@ -934,7 +936,7 @@ class WasmGraphBuildingInterface { SsaEnv* false_env = ssa_env_; SsaEnv* true_env = Split(decoder->zone(), false_env); false_env->SetNotMerged(); - builder_->BrOnNull(ref_object.node, &false_env->control, + builder_->BrOnNull(ref_object.node, ref_object.type, &false_env->control, &true_env->control); builder_->SetControl(false_env->control); ScopedSsaEnv scoped_env(this, true_env); diff --git a/src/wasm/module-instantiate.cc b/src/wasm/module-instantiate.cc index 030d81cdcd..1fdecee0a1 100644 --- a/src/wasm/module-instantiate.cc +++ b/src/wasm/module-instantiate.cc @@ -680,7 +680,9 @@ MaybeHandle InstanceBuilder::Build() { Handle table_obj = WasmTableObject::New( isolate_, instance, table.type, table.initial_size, table.has_maximum_size, table.maximum_size, nullptr, - isolate_->factory()->null_value()); + IsSubtypeOf(table.type, kWasmExternRef, module_) + ? Handle::cast(isolate_->factory()->null_value()) + : Handle::cast(isolate_->factory()->wasm_null())); tables->set(i, *table_obj); } instance->set_tables(*tables); @@ -1967,7 +1969,7 @@ V8_INLINE void SetFunctionTablePlaceholder(Isolate* isolate, V8_INLINE void SetFunctionTableNullEntry(Isolate* isolate, Handle table_object, uint32_t entry_index) { - table_object->entries().set(entry_index, *isolate->factory()->null_value()); + table_object->entries().set(entry_index, *isolate->factory()->wasm_null()); WasmTableObject::ClearDispatchTables(isolate, table_object, entry_index); } } // namespace diff --git a/src/wasm/wasm-engine.cc b/src/wasm/wasm-engine.cc index 0b00fc1886..8454ab47df 100644 --- a/src/wasm/wasm-engine.cc +++ b/src/wasm/wasm-engine.cc @@ -1041,8 +1041,8 @@ void WasmEngine::AddIsolate(Isolate* isolate) { #if defined(V8_COMPRESS_POINTERS) // The null value is not accessible on mksnapshot runs. if (isolate->snapshot_available()) { - null_tagged_compressed_ = V8HeapCompressionScheme::CompressTagged( - isolate->factory()->null_value()->ptr()); + wasm_null_tagged_compressed_ = V8HeapCompressionScheme::CompressTagged( + isolate->factory()->wasm_null()->ptr()); } #endif diff --git a/src/wasm/wasm-engine.h b/src/wasm/wasm-engine.h index 1f13f9cfa3..d18e4868f9 100644 --- a/src/wasm/wasm-engine.h +++ b/src/wasm/wasm-engine.h @@ -371,8 +371,8 @@ class V8_EXPORT_PRIVATE WasmEngine { // Returns either the compressed tagged pointer representing a null value or // 0 if pointer compression is not available. - Tagged_t compressed_null_value_or_zero() const { - return null_tagged_compressed_; + Tagged_t compressed_wasm_null_value_or_zero() const { + return wasm_null_tagged_compressed_; } // Call on process start and exit. @@ -411,7 +411,7 @@ class V8_EXPORT_PRIVATE WasmEngine { std::atomic next_compilation_id_{0}; // Compressed tagged pointer to null value. - std::atomic null_tagged_compressed_{0}; + std::atomic wasm_null_tagged_compressed_{0}; TypeCanonicalizer type_canonicalizer_; diff --git a/src/wasm/wasm-js.cc b/src/wasm/wasm-js.cc index 82a151a961..d206334afc 100644 --- a/src/wasm/wasm-js.cc +++ b/src/wasm/wasm-js.cc @@ -1135,15 +1135,13 @@ bool GetInitialOrMinimumProperty(v8::Isolate* isolate, ErrorThrower* thrower, namespace { i::Handle DefaultReferenceValue(i::Isolate* isolate, i::wasm::ValueType type) { - if (type.is_reference()) { - // Use undefined for JS type (externref) but null for wasm types as wasm - // does not know undefined. - if (type.heap_representation() == i::wasm::HeapType::kExtern) { - return isolate->factory()->undefined_value(); - } - return isolate->factory()->null_value(); + DCHECK(type.is_object_reference()); + // Use undefined for JS type (externref) but null for wasm types as wasm does + // not know undefined. + if (type.heap_representation() == i::wasm::HeapType::kExtern) { + return isolate->factory()->undefined_value(); } - UNREACHABLE(); + return isolate->factory()->wasm_null(); } } // namespace @@ -2335,6 +2333,13 @@ void WebAssemblyTableSet(const v8::FunctionCallbackInfo& args) { i::Handle element; if (args.Length() >= 2) { element = Utils::OpenHandle(*args[1]); + const char* error_message; + if (!i::WasmTableObject::JSToWasmElement(i_isolate, table_object, element, + &error_message) + .ToHandle(&element)) { + thrower.TypeError("Argument 1 is invalid for table: %s", error_message); + return; + } } else if (table_object->type().is_defaultable()) { element = DefaultReferenceValue(i_isolate, table_object->type()); } else { @@ -2343,14 +2348,6 @@ void WebAssemblyTableSet(const v8::FunctionCallbackInfo& args) { return; } - const char* error_message; - if (!i::WasmTableObject::JSToWasmElement(i_isolate, table_object, element, - &error_message) - .ToHandle(&element)) { - thrower.TypeError("Argument 1 is invalid for table: %s", error_message); - return; - } - i::WasmTableObject::Set(i_isolate, table_object, index, element); } diff --git a/src/wasm/wasm-objects-inl.h b/src/wasm/wasm-objects-inl.h index a73bb9a76a..b6f62206c5 100644 --- a/src/wasm/wasm-objects-inl.h +++ b/src/wasm/wasm-objects-inl.h @@ -56,6 +56,7 @@ TQ_OBJECT_CONSTRUCTORS_IMPL(WasmArray) TQ_OBJECT_CONSTRUCTORS_IMPL(WasmContinuationObject) TQ_OBJECT_CONSTRUCTORS_IMPL(WasmSuspenderObject) TQ_OBJECT_CONSTRUCTORS_IMPL(WasmResumeData) +TQ_OBJECT_CONSTRUCTORS_IMPL(WasmNull) CAST_ACCESSOR(WasmInstanceObject) diff --git a/src/wasm/wasm-objects.cc b/src/wasm/wasm-objects.cc index 6355bb24fd..f65c305192 100644 --- a/src/wasm/wasm-objects.cc +++ b/src/wasm/wasm-objects.cc @@ -280,9 +280,9 @@ void WasmTableObject::SetFunctionTableEntry(Isolate* isolate, Handle entries, int entry_index, Handle entry) { - if (entry->IsNull(isolate)) { + if (entry->IsWasmNull(isolate)) { ClearDispatchTables(isolate, table, entry_index); // Degenerate case. - entries->set(entry_index, ReadOnlyRoots(isolate).null_value()); + entries->set(entry_index, ReadOnlyRoots(isolate).wasm_null()); return; } Handle external = @@ -362,7 +362,7 @@ Handle WasmTableObject::Get(Isolate* isolate, Handle entry(entries->get(entry_index), isolate); - if (entry->IsNull(isolate)) { + if (entry->IsWasmNull(isolate)) { return entry; } @@ -598,7 +598,7 @@ void WasmTableObject::GetFunctionTableEntry( *is_valid = true; Handle element(table->entries().get(entry_index), isolate); - *is_null = element->IsNull(isolate); + *is_null = element->IsWasmNull(isolate); if (*is_null) return; if (element->IsWasmInternalFunction()) { @@ -2249,7 +2249,10 @@ MaybeHandle JSToWasmObject(Isolate* isolate, Handle value, *error_message = "stringview_iter has no JS representation"; return {}; default: - return value; + bool is_extern_subtype = + expected_canonical.heap_representation() == HeapType::kExtern || + expected_canonical.heap_representation() == HeapType::kNoExtern; + return is_extern_subtype ? value : isolate->factory()->wasm_null(); } } @@ -2425,15 +2428,15 @@ MaybeHandle WasmToJSObject(Isolate* isolate, Handle value, case i::wasm::HeapType::kArray: case i::wasm::HeapType::kEq: case i::wasm::HeapType::kAny: - return value; + return value->IsWasmNull() ? isolate->factory()->null_value() : value; case i::wasm::HeapType::kFunc: { - if (!value->IsNull()) { + if (value->IsWasmNull()) { + return isolate->factory()->null_value(); + } else { DCHECK(value->IsWasmInternalFunction()); return handle( i::Handle::cast(value)->external(), isolate); - } else { - return value; } } case i::wasm::HeapType::kStringViewWtf8: @@ -2448,7 +2451,9 @@ MaybeHandle WasmToJSObject(Isolate* isolate, Handle value, case i::wasm::HeapType::kBottom: UNREACHABLE(); default: - if (value->IsWasmInternalFunction()) { + if (value->IsWasmNull()) { + return isolate->factory()->null_value(); + } else if (value->IsWasmInternalFunction()) { return handle( i::Handle::cast(value)->external(), isolate); diff --git a/src/wasm/wasm-objects.h b/src/wasm/wasm-objects.h index 6026aa6669..9f49126564 100644 --- a/src/wasm/wasm-objects.h +++ b/src/wasm/wasm-objects.h @@ -1063,6 +1063,20 @@ class WasmSuspenderObject TQ_OBJECT_CONSTRUCTORS(WasmSuspenderObject) }; +class WasmNull : public TorqueGeneratedWasmNull { + public: + // TODO(manoskouk): Make it smaller if able and needed. + static constexpr int kSize = 64 * KB + kTaggedSize; + // Payload should be a multiple of page size. + static_assert((kSize - kTaggedSize) % kMinimumOSPageSize == 0); + // Any wasm struct offset should fit in the object. + static_assert(kSize >= WasmStruct::kHeaderSize + + wasm::kV8MaxWasmStructFields * kSimd128Size); + class BodyDescriptor; + + TQ_OBJECT_CONSTRUCTORS(WasmNull) +}; + #undef DECL_OPTIONAL_ACCESSORS namespace wasm { diff --git a/src/wasm/wasm-objects.tq b/src/wasm/wasm-objects.tq index 929bea6c79..2eecde31cd 100644 --- a/src/wasm/wasm-objects.tq +++ b/src/wasm/wasm-objects.tq @@ -220,3 +220,8 @@ class WasmStringViewIter extends HeapObject { string: String; offset: uint32; // Index into string. } + +extern class WasmNull extends HeapObject {} + +extern macro WasmNullConstant(): WasmNull; +const kWasmNull: WasmNull = WasmNullConstant(); diff --git a/test/cctest/wasm/test-gc.cc b/test/cctest/wasm/test-gc.cc index f2d50d0f10..f0b58782e9 100644 --- a/test/cctest/wasm/test-gc.cc +++ b/test/cctest/wasm/test-gc.cc @@ -386,7 +386,7 @@ WASM_COMPILED_EXEC_TEST(WasmRefAsNonNullSkipCheck) { tester.CompileModule(); Handle result = tester.GetResultObject(kFunc).ToHandleChecked(); // Without null checks, ref.as_non_null can actually return null. - CHECK(result->IsNull()); + CHECK(result->IsWasmNull()); } WASM_COMPILED_EXEC_TEST(WasmBrOnNull) { @@ -1145,7 +1145,7 @@ WASM_COMPILED_EXEC_TEST(WasmArrayCopy) { { Handle result5 = tester.GetResultObject(kCopyRef, 5).ToHandleChecked(); - CHECK(result5->IsNull()); + CHECK(result5->IsWasmNull()); for (int i = 6; i <= 9; i++) { Handle res = tester.GetResultObject(kCopyRef, i).ToHandleChecked(); @@ -1156,7 +1156,7 @@ WASM_COMPILED_EXEC_TEST(WasmArrayCopy) { } CHECK(tester.GetResultObject(kCopyRefOverlapping, 6) .ToHandleChecked() - ->IsNull()); + ->IsWasmNull()); Handle res0 = tester.GetResultObject(kCopyRefOverlapping, 0).ToHandleChecked(); CHECK(res0->IsWasmArray()); diff --git a/test/cctest/wasm/wasm-run-utils.cc b/test/cctest/wasm/wasm-run-utils.cc index 9b3b6b78c8..0c8535827b 100644 --- a/test/cctest/wasm/wasm-run-utils.cc +++ b/test/cctest/wasm/wasm-run-utils.cc @@ -18,6 +18,7 @@ #include "src/wasm/wasm-import-wrapper-cache.h" #include "src/wasm/wasm-objects-inl.h" #include "src/wasm/wasm-opcodes.h" +#include "src/wasm/wasm-subtyping.h" namespace v8 { namespace internal { @@ -241,10 +242,12 @@ void TestingModuleBuilder::AddIndirectFunctionTable( WasmInstanceObject::EnsureIndirectFunctionTableWithMinimumSize( instance_object(), table_index, table_size); - Handle table_obj = - WasmTableObject::New(isolate_, instance, table.type, table.initial_size, - table.has_maximum_size, table.maximum_size, nullptr, - isolate_->factory()->null_value()); + Handle table_obj = WasmTableObject::New( + isolate_, instance, table.type, table.initial_size, + table.has_maximum_size, table.maximum_size, nullptr, + IsSubtypeOf(table.type, kWasmExternRef, test_module_.get()) + ? Handle::cast(isolate_->factory()->null_value()) + : Handle::cast(isolate_->factory()->wasm_null())); WasmTableObject::AddDispatchTable(isolate_, table_obj, instance_object_, table_index); diff --git a/test/mjsunit/wasm/table-grow-from-wasm.js b/test/mjsunit/wasm/table-grow-from-wasm.js index 49fced9588..d386e67a55 100644 --- a/test/mjsunit/wasm/table-grow-from-wasm.js +++ b/test/mjsunit/wasm/table-grow-from-wasm.js @@ -25,7 +25,7 @@ function testGrowInternalExternRefTable(table_index) { const initial_size = 5; // Add 10 tables, we only test one. for (let i = 0; i < 10; ++i) { - builder.addTable(kWasmExternRef, initial_size).index; + builder.addTable(kWasmExternRef, initial_size); } builder.addFunction('grow', kSig_i_ri) .addBody([kExprLocalGet, 0, diff --git a/tools/v8heapconst.py b/tools/v8heapconst.py index 4572bd2658..823c7d148c 100644 --- a/tools/v8heapconst.py +++ b/tools/v8heapconst.py @@ -178,18 +178,19 @@ INSTANCE_TYPES = { 267: "WASM_API_FUNCTION_REF_TYPE", 268: "WASM_CONTINUATION_OBJECT_TYPE", 269: "WASM_INTERNAL_FUNCTION_TYPE", - 270: "WASM_RESUME_DATA_TYPE", - 271: "WASM_STRING_VIEW_ITER_TYPE", - 272: "WASM_TYPE_INFO_TYPE", - 273: "WEAK_ARRAY_LIST_TYPE", - 274: "WEAK_CELL_TYPE", - 275: "WASM_ARRAY_TYPE", - 276: "WASM_STRUCT_TYPE", - 277: "JS_PROXY_TYPE", + 270: "WASM_NULL_TYPE", + 271: "WASM_RESUME_DATA_TYPE", + 272: "WASM_STRING_VIEW_ITER_TYPE", + 273: "WASM_TYPE_INFO_TYPE", + 274: "WEAK_ARRAY_LIST_TYPE", + 275: "WEAK_CELL_TYPE", + 276: "WASM_ARRAY_TYPE", + 277: "WASM_STRUCT_TYPE", + 278: "JS_PROXY_TYPE", 1057: "JS_OBJECT_TYPE", - 278: "JS_GLOBAL_OBJECT_TYPE", - 279: "JS_GLOBAL_PROXY_TYPE", - 280: "JS_MODULE_NAMESPACE_TYPE", + 279: "JS_GLOBAL_OBJECT_TYPE", + 280: "JS_GLOBAL_PROXY_TYPE", + 281: "JS_MODULE_NAMESPACE_TYPE", 1040: "JS_SPECIAL_API_OBJECT_TYPE", 1041: "JS_PRIMITIVE_WRAPPER_TYPE", 1058: "JS_API_OBJECT_TYPE", @@ -297,7 +298,7 @@ KNOWN_MAPS = { ("read_only_space", 0x02141): (255, "MetaMap"), ("read_only_space", 0x02169): (175, "FixedArrayMap"), ("read_only_space", 0x02191): (240, "WeakFixedArrayMap"), - ("read_only_space", 0x021b9): (273, "WeakArrayListMap"), + ("read_only_space", 0x021b9): (274, "WeakArrayListMap"), ("read_only_space", 0x021e1): (175, "FixedCOWArrayMap"), ("read_only_space", 0x02209): (236, "DescriptorArrayMap"), ("read_only_space", 0x02231): (131, "UndefinedMap"), @@ -429,7 +430,7 @@ KNOWN_MAPS = { ("read_only_space", 0x0366d): (235, "AbstractInternalClassSubclass2Map"), ("read_only_space", 0x03695): (230, "ExportedSubClass2Map"), ("read_only_space", 0x036bd): (265, "SortStateMap"), - ("read_only_space", 0x036e5): (271, "WasmStringViewIterMap"), + ("read_only_space", 0x036e5): (272, "WasmStringViewIterMap"), ("read_only_space", 0x0370d): (194, "SloppyArgumentsElementsMap"), ("read_only_space", 0x03735): (237, "StrongDescriptorArrayMap"), ("read_only_space", 0x0375d): (200, "TurboshaftWord32SetTypeMap"), @@ -477,10 +478,11 @@ KNOWN_MAPS = { ("read_only_space", 0x03df5): (226, "WasmExportedFunctionDataMap"), ("read_only_space", 0x03e1d): (269, "WasmInternalFunctionMap"), ("read_only_space", 0x03e45): (227, "WasmJSFunctionDataMap"), - ("read_only_space", 0x03e6d): (270, "WasmResumeDataMap"), - ("read_only_space", 0x03e95): (272, "WasmTypeInfoMap"), + ("read_only_space", 0x03e6d): (271, "WasmResumeDataMap"), + ("read_only_space", 0x03e95): (273, "WasmTypeInfoMap"), ("read_only_space", 0x03ebd): (268, "WasmContinuationObjectMap"), - ("read_only_space", 0x03ee5): (274, "WeakCellMap"), + ("read_only_space", 0x03ee5): (270, "WasmNullMap"), + ("read_only_space", 0x03f0d): (275, "WeakCellMap"), ("old_space", 0x043bd): (2118, "ExternalMap"), ("old_space", 0x043e5): (2122, "JSMessageObjectMap"), } @@ -496,48 +498,49 @@ KNOWN_OBJECTS = { ("read_only_space", 0x02a99): "EmptyEnumCache", ("read_only_space", 0x02aa5): "EmptyDescriptorArray", ("read_only_space", 0x03875): "InvalidPrototypeValidityCell", - ("read_only_space", 0x03f0d): "EmptyArrayList", - ("read_only_space", 0x03f19): "EmptyScopeInfo", - ("read_only_space", 0x03f29): "EmptyObjectBoilerplateDescription", - ("read_only_space", 0x03f35): "EmptyArrayBoilerplateDescription", - ("read_only_space", 0x03f41): "TrueValue", - ("read_only_space", 0x03f5d): "FalseValue", - ("read_only_space", 0x03f79): "EmptyByteArray", - ("read_only_space", 0x03f81): "EmptyPropertyArray", - ("read_only_space", 0x03f89): "EmptyClosureFeedbackCellArray", - ("read_only_space", 0x03f91): "NoOpInterceptorInfo", - ("read_only_space", 0x03fb9): "MinusZeroValue", - ("read_only_space", 0x03fc5): "NanValue", - ("read_only_space", 0x03fd1): "HoleNanValue", - ("read_only_space", 0x03fdd): "InfinityValue", - ("read_only_space", 0x03fe9): "MinusInfinityValue", - ("read_only_space", 0x03ff5): "MaxSafeInteger", - ("read_only_space", 0x04001): "MaxUInt32", - ("read_only_space", 0x0400d): "SmiMinValue", - ("read_only_space", 0x04019): "SmiMaxValuePlusOne", - ("read_only_space", 0x04025): "HashSeed", - ("read_only_space", 0x04035): "SingleCharacterStringTable", - ("read_only_space", 0x0543d): "empty_string", - ("read_only_space", 0x07b35): "UninitializedValue", - ("read_only_space", 0x07b6d): "ArgumentsMarker", - ("read_only_space", 0x07ba5): "TerminationException", - ("read_only_space", 0x07be5): "Exception", - ("read_only_space", 0x07c01): "OptimizedOut", - ("read_only_space", 0x07c39): "StaleRegister", - ("read_only_space", 0x07c71): "SelfReferenceMarker", - ("read_only_space", 0x07cb1): "BasicBlockCountersMarker", - ("read_only_space", 0x081c9): "EmptyPropertyDictionary", - ("read_only_space", 0x081f1): "EmptySymbolTable", - ("read_only_space", 0x0820d): "EmptySlowElementDictionary", - ("read_only_space", 0x08231): "EmptyOrderedHashMap", - ("read_only_space", 0x08245): "EmptyOrderedHashSet", - ("read_only_space", 0x08259): "EmptyOrderedPropertyDictionary", - ("read_only_space", 0x0827d): "EmptySwissPropertyDictionary", - ("read_only_space", 0x0829d): "EmptyFeedbackMetadata", - ("read_only_space", 0x082a9): "GlobalThisBindingScopeInfo", - ("read_only_space", 0x082c9): "EmptyFunctionScopeInfo", - ("read_only_space", 0x082ed): "NativeScopeInfo", - ("read_only_space", 0x08305): "ShadowRealmScopeInfo", + ("read_only_space", 0x03f35): "EmptyArrayList", + ("read_only_space", 0x03f41): "EmptyScopeInfo", + ("read_only_space", 0x03f51): "EmptyObjectBoilerplateDescription", + ("read_only_space", 0x03f5d): "EmptyArrayBoilerplateDescription", + ("read_only_space", 0x03f69): "TrueValue", + ("read_only_space", 0x03f85): "FalseValue", + ("read_only_space", 0x03fa1): "EmptyByteArray", + ("read_only_space", 0x03fa9): "EmptyPropertyArray", + ("read_only_space", 0x03fb1): "EmptyClosureFeedbackCellArray", + ("read_only_space", 0x03fb9): "NoOpInterceptorInfo", + ("read_only_space", 0x03fe1): "MinusZeroValue", + ("read_only_space", 0x03fed): "NanValue", + ("read_only_space", 0x03ff9): "HoleNanValue", + ("read_only_space", 0x04005): "InfinityValue", + ("read_only_space", 0x04011): "MinusInfinityValue", + ("read_only_space", 0x0401d): "MaxSafeInteger", + ("read_only_space", 0x04029): "MaxUInt32", + ("read_only_space", 0x04035): "SmiMinValue", + ("read_only_space", 0x04041): "SmiMaxValuePlusOne", + ("read_only_space", 0x0404d): "HashSeed", + ("read_only_space", 0x0405d): "SingleCharacterStringTable", + ("read_only_space", 0x05465): "empty_string", + ("read_only_space", 0x07b5d): "UninitializedValue", + ("read_only_space", 0x07b95): "ArgumentsMarker", + ("read_only_space", 0x07bcd): "TerminationException", + ("read_only_space", 0x07c0d): "Exception", + ("read_only_space", 0x07c29): "OptimizedOut", + ("read_only_space", 0x07c61): "StaleRegister", + ("read_only_space", 0x07c99): "SelfReferenceMarker", + ("read_only_space", 0x07cd9): "BasicBlockCountersMarker", + ("read_only_space", 0x081f1): "EmptyPropertyDictionary", + ("read_only_space", 0x08219): "EmptySymbolTable", + ("read_only_space", 0x08235): "EmptySlowElementDictionary", + ("read_only_space", 0x08259): "EmptyOrderedHashMap", + ("read_only_space", 0x0826d): "EmptyOrderedHashSet", + ("read_only_space", 0x08281): "EmptyOrderedPropertyDictionary", + ("read_only_space", 0x082a5): "EmptySwissPropertyDictionary", + ("read_only_space", 0x082c5): "EmptyFeedbackMetadata", + ("read_only_space", 0x082d1): "GlobalThisBindingScopeInfo", + ("read_only_space", 0x082f1): "EmptyFunctionScopeInfo", + ("read_only_space", 0x08315): "NativeScopeInfo", + ("read_only_space", 0x0832d): "ShadowRealmScopeInfo", + ("read_only_space", 0x0fffd): "WasmNull", ("old_space", 0x0426d): "ArgumentsIteratorAccessor", ("old_space", 0x04285): "ArrayLengthAccessor", ("old_space", 0x0429d): "BoundFunctionLengthAccessor",