diff options
author | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:39:11 +0100 |
---|---|---|
committer | Michaël Zasso <targos@protonmail.com> | 2019-11-08 15:46:25 +0100 |
commit | 6ca81ad72a3c6fdf16c683335be748f22aaa9a0d (patch) | |
tree | 33c8ee75f729aed76c2c0b89c63f9bf1b4dd66aa /deps/v8/src/interpreter/interpreter-generator.cc | |
parent | 1eee0b8bf8bba39b600fb16a9223e545e3bac2bc (diff) | |
download | android-node-v8-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.tar.gz android-node-v8-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.tar.bz2 android-node-v8-6ca81ad72a3c6fdf16c683335be748f22aaa9a0d.zip |
deps: update V8 to 7.9.317.20
PR-URL: https://github.com/nodejs/node/pull/30020
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Diffstat (limited to 'deps/v8/src/interpreter/interpreter-generator.cc')
-rw-r--r-- | deps/v8/src/interpreter/interpreter-generator.cc | 601 |
1 files changed, 311 insertions, 290 deletions
diff --git a/deps/v8/src/interpreter/interpreter-generator.cc b/deps/v8/src/interpreter/interpreter-generator.cc index e8569ecd55..5f686f86b8 100644 --- a/deps/v8/src/interpreter/interpreter-generator.cc +++ b/deps/v8/src/interpreter/interpreter-generator.cc @@ -35,7 +35,6 @@ namespace { using compiler::Node; using Label = CodeStubAssembler::Label; -using Variable = CodeStubAssembler::Variable; #define IGNITION_HANDLER(Name, BaseAssembler) \ class Name##Assembler : public BaseAssembler { \ @@ -71,7 +70,7 @@ IGNITION_HANDLER(LdaZero, InterpreterAssembler) { // // Load an integer literal into the accumulator as a Smi. IGNITION_HANDLER(LdaSmi, InterpreterAssembler) { - Node* smi_int = BytecodeOperandImmSmi(0); + TNode<Smi> smi_int = BytecodeOperandImmSmi(0); SetAccumulator(smi_int); Dispatch(); } @@ -80,7 +79,7 @@ IGNITION_HANDLER(LdaSmi, InterpreterAssembler) { // // Load constant literal at |idx| in the constant pool into the accumulator. IGNITION_HANDLER(LdaConstant, InterpreterAssembler) { - Node* constant = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Object> constant = LoadConstantPoolEntryAtOperandIndex(0); SetAccumulator(constant); Dispatch(); } @@ -161,7 +160,6 @@ class InterpreterLoadGlobalAssembler : public InterpreterAssembler { void LdaGlobal(int slot_operand_index, int name_operand_index, TypeofMode typeof_mode) { TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); - Node* feedback_slot = BytecodeOperandIdx(slot_operand_index); AccessorAssembler accessor_asm(state()); ExitPoint exit_point(this, [=](Node* result) { @@ -169,17 +167,25 @@ class InterpreterLoadGlobalAssembler : public InterpreterAssembler { Dispatch(); }); + LazyNode<Smi> lazy_smi_slot = [=] { + return SmiTag(Signed(BytecodeOperandIdx(slot_operand_index))); + }; + + LazyNode<UintPtrT> lazy_slot = [=] { + return BytecodeOperandIdx(slot_operand_index); + }; + LazyNode<Context> lazy_context = [=] { return GetContext(); }; LazyNode<Name> lazy_name = [=] { - Node* name = LoadConstantPoolEntryAtOperandIndex(name_operand_index); - return CAST(name); + TNode<Name> name = + CAST(LoadConstantPoolEntryAtOperandIndex(name_operand_index)); + return name; }; - ParameterMode slot_mode = CodeStubAssembler::INTPTR_PARAMETERS; - accessor_asm.LoadGlobalIC(maybe_feedback_vector, feedback_slot, - lazy_context, lazy_name, typeof_mode, &exit_point, - slot_mode); + accessor_asm.LoadGlobalIC(maybe_feedback_vector, lazy_smi_slot, lazy_slot, + lazy_context, lazy_name, typeof_mode, + &exit_point); } }; @@ -213,9 +219,9 @@ IGNITION_HANDLER(StaGlobal, InterpreterAssembler) { TNode<Context> context = GetContext(); // Store the global via the StoreGlobalIC. - Node* name = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0)); TNode<Object> value = GetAccumulator(); - Node* raw_slot = BytecodeOperandIdx(1); + TNode<IntPtrT> raw_slot = Signed(BytecodeOperandIdx(1)); TNode<Smi> smi_slot = SmiTag(raw_slot); TNode<HeapObject> maybe_vector = LoadFeedbackVector(); @@ -240,9 +246,9 @@ IGNITION_HANDLER(StaGlobal, InterpreterAssembler) { // chain starting at |context| into the accumulator. IGNITION_HANDLER(LdaContextSlot, InterpreterAssembler) { TNode<Context> context = CAST(LoadRegisterAtOperandIndex(0)); - Node* slot_index = BytecodeOperandIdx(1); + TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(1)); TNode<Uint32T> depth = BytecodeOperandUImm(2); - Node* slot_context = GetContextAtDepth(context, depth); + TNode<Context> slot_context = GetContextAtDepth(context, depth); TNode<Object> result = LoadContextElement(slot_context, slot_index); SetAccumulator(result); Dispatch(); @@ -254,9 +260,9 @@ IGNITION_HANDLER(LdaContextSlot, InterpreterAssembler) { // chain starting at |context| into the accumulator. IGNITION_HANDLER(LdaImmutableContextSlot, InterpreterAssembler) { TNode<Context> context = CAST(LoadRegisterAtOperandIndex(0)); - Node* slot_index = BytecodeOperandIdx(1); + TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(1)); TNode<Uint32T> depth = BytecodeOperandUImm(2); - Node* slot_context = GetContextAtDepth(context, depth); + TNode<Context> slot_context = GetContextAtDepth(context, depth); TNode<Object> result = LoadContextElement(slot_context, slot_index); SetAccumulator(result); Dispatch(); @@ -266,7 +272,7 @@ IGNITION_HANDLER(LdaImmutableContextSlot, InterpreterAssembler) { // // Load the object in |slot_index| of the current context into the accumulator. IGNITION_HANDLER(LdaCurrentContextSlot, InterpreterAssembler) { - Node* slot_index = BytecodeOperandIdx(0); + TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(0)); TNode<Context> slot_context = GetContext(); TNode<Object> result = LoadContextElement(slot_context, slot_index); SetAccumulator(result); @@ -277,7 +283,7 @@ IGNITION_HANDLER(LdaCurrentContextSlot, InterpreterAssembler) { // // Load the object in |slot_index| of the current context into the accumulator. IGNITION_HANDLER(LdaImmutableCurrentContextSlot, InterpreterAssembler) { - Node* slot_index = BytecodeOperandIdx(0); + TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(0)); TNode<Context> slot_context = GetContext(); TNode<Object> result = LoadContextElement(slot_context, slot_index); SetAccumulator(result); @@ -291,9 +297,9 @@ IGNITION_HANDLER(LdaImmutableCurrentContextSlot, InterpreterAssembler) { IGNITION_HANDLER(StaContextSlot, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); TNode<Context> context = CAST(LoadRegisterAtOperandIndex(0)); - Node* slot_index = BytecodeOperandIdx(1); + TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(1)); TNode<Uint32T> depth = BytecodeOperandUImm(2); - Node* slot_context = GetContextAtDepth(context, depth); + TNode<Context> slot_context = GetContextAtDepth(context, depth); StoreContextElement(slot_context, slot_index, value); Dispatch(); } @@ -304,7 +310,7 @@ IGNITION_HANDLER(StaContextSlot, InterpreterAssembler) { // context. IGNITION_HANDLER(StaCurrentContextSlot, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); - Node* slot_index = BytecodeOperandIdx(0); + TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(0)); TNode<Context> slot_context = GetContext(); StoreContextElement(slot_context, slot_index, value); Dispatch(); @@ -315,7 +321,7 @@ IGNITION_HANDLER(StaCurrentContextSlot, InterpreterAssembler) { // Lookup the object with the name in constant pool entry |name_index| // dynamically. IGNITION_HANDLER(LdaLookupSlot, InterpreterAssembler) { - Node* name = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0)); TNode<Context> context = GetContext(); TNode<Object> result = CallRuntime(Runtime::kLoadLookupSlot, context, name); SetAccumulator(result); @@ -327,7 +333,7 @@ IGNITION_HANDLER(LdaLookupSlot, InterpreterAssembler) { // Lookup the object with the name in constant pool entry |name_index| // dynamically without causing a NoReferenceError. IGNITION_HANDLER(LdaLookupSlotInsideTypeof, InterpreterAssembler) { - Node* name = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0)); TNode<Context> context = GetContext(); TNode<Object> result = CallRuntime(Runtime::kLoadLookupSlotInsideTypeof, context, name); @@ -344,7 +350,7 @@ class InterpreterLookupContextSlotAssembler : public InterpreterAssembler { void LookupContextSlot(Runtime::FunctionId function_id) { TNode<Context> context = GetContext(); - Node* slot_index = BytecodeOperandIdx(1); + TNode<IntPtrT> slot_index = Signed(BytecodeOperandIdx(1)); TNode<Uint32T> depth = BytecodeOperandUImm(2); Label slowpath(this, Label::kDeferred); @@ -354,7 +360,7 @@ class InterpreterLookupContextSlotAssembler : public InterpreterAssembler { // Fast path does a normal load context. { - Node* slot_context = GetContextAtDepth(context, depth); + TNode<Context> slot_context = GetContextAtDepth(context, depth); TNode<Object> result = LoadContextElement(slot_context, slot_index); SetAccumulator(result); Dispatch(); @@ -363,7 +369,7 @@ class InterpreterLookupContextSlotAssembler : public InterpreterAssembler { // Slow path when we have to call out to the runtime. BIND(&slowpath); { - Node* name = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0)); TNode<Object> result = CallRuntime(function_id, context, name); SetAccumulator(result); Dispatch(); @@ -419,7 +425,7 @@ class InterpreterLookupGlobalAssembler : public InterpreterLoadGlobalAssembler { // Slow path when we have to call out to the runtime BIND(&slowpath); { - Node* name = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0)); TNode<Object> result = CallRuntime(function_id, context, name); SetAccumulator(result); Dispatch(); @@ -450,10 +456,10 @@ IGNITION_HANDLER(LdaLookupGlobalSlotInsideTypeof, // pool entry |name_index|. IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); - Node* name = LoadConstantPoolEntryAtOperandIndex(0); - Node* bytecode_flags = BytecodeOperandFlag(1); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0)); + TNode<Uint32T> bytecode_flags = BytecodeOperandFlag(1); TNode<Context> context = GetContext(); - Variable var_result(this, MachineRepresentation::kTagged); + TVARIABLE(Object, var_result); Label sloppy(this), strict(this), end(this); DCHECK_EQ(0, LanguageMode::kSloppy); @@ -467,8 +473,8 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) { { CSA_ASSERT(this, IsClearWord32<StoreLookupSlotFlags::LookupHoistingModeBit>( bytecode_flags)); - var_result.Bind( - CallRuntime(Runtime::kStoreLookupSlot_Strict, context, name, value)); + var_result = + CallRuntime(Runtime::kStoreLookupSlot_Strict, context, name, value); Goto(&end); } @@ -481,15 +487,15 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) { BIND(&hoisting); { - var_result.Bind(CallRuntime(Runtime::kStoreLookupSlot_SloppyHoisting, - context, name, value)); + var_result = CallRuntime(Runtime::kStoreLookupSlot_SloppyHoisting, + context, name, value); Goto(&end); } BIND(&ordinary); { - var_result.Bind( - CallRuntime(Runtime::kStoreLookupSlot_Sloppy, context, name, value)); + var_result = + CallRuntime(Runtime::kStoreLookupSlot_Sloppy, context, name, value); Goto(&end); } } @@ -507,24 +513,24 @@ IGNITION_HANDLER(StaLookupSlot, InterpreterAssembler) { // constant pool entry <name_index>. IGNITION_HANDLER(LdaNamedProperty, InterpreterAssembler) { TNode<HeapObject> feedback_vector = LoadFeedbackVector(); - Node* feedback_slot = BytecodeOperandIdx(2); - TNode<Smi> smi_slot = SmiTag(feedback_slot); + TNode<UintPtrT> feedback_slot = BytecodeOperandIdx(2); // Load receiver. TNode<Object> recv = LoadRegisterAtOperandIndex(0); // Load the name and context lazily. - LazyNode<Name> name = [=] { + LazyNode<Smi> lazy_smi_slot = [=] { return SmiTag(Signed(feedback_slot)); }; + LazyNode<Name> lazy_name = [=] { return CAST(LoadConstantPoolEntryAtOperandIndex(1)); }; - LazyNode<Context> context = [=] { return GetContext(); }; + LazyNode<Context> lazy_context = [=] { return GetContext(); }; Label done(this); - Variable var_result(this, MachineRepresentation::kTagged); + TVARIABLE(Object, var_result); ExitPoint exit_point(this, &done, &var_result); - AccessorAssembler::LazyLoadICParameters params(context, recv, name, smi_slot, - feedback_vector); + AccessorAssembler::LazyLoadICParameters params( + lazy_context, recv, lazy_name, lazy_smi_slot, feedback_vector); AccessorAssembler accessor_asm(state()); accessor_asm.LoadIC_BytecodeHandler(¶ms, &exit_point); @@ -540,7 +546,7 @@ IGNITION_HANDLER(LdaNamedProperty, InterpreterAssembler) { // Calls the GetProperty builtin for <object> and the key in the accumulator. IGNITION_HANDLER(LdaNamedPropertyNoFeedback, InterpreterAssembler) { TNode<Object> object = LoadRegisterAtOperandIndex(0); - Node* name = LoadConstantPoolEntryAtOperandIndex(1); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(1)); TNode<Context> context = GetContext(); TNode<Object> result = CallBuiltin(Builtins::kGetProperty, context, object, name); @@ -555,14 +561,14 @@ IGNITION_HANDLER(LdaNamedPropertyNoFeedback, InterpreterAssembler) { IGNITION_HANDLER(LdaKeyedProperty, InterpreterAssembler) { TNode<Object> object = LoadRegisterAtOperandIndex(0); TNode<Object> name = GetAccumulator(); - Node* raw_slot = BytecodeOperandIdx(1); + TNode<IntPtrT> raw_slot = Signed(BytecodeOperandIdx(1)); TNode<Smi> smi_slot = SmiTag(raw_slot); TNode<HeapObject> feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - VARIABLE(var_result, MachineRepresentation::kTagged); - var_result.Bind(CallBuiltin(Builtins::kKeyedLoadIC, context, object, name, - smi_slot, feedback_vector)); + TVARIABLE(Object, var_result); + var_result = CallBuiltin(Builtins::kKeyedLoadIC, context, object, name, + smi_slot, feedback_vector); SetAccumulator(var_result.value()); Dispatch(); } @@ -577,16 +583,16 @@ class InterpreterStoreNamedPropertyAssembler : public InterpreterAssembler { void StaNamedProperty(Callable ic, NamedPropertyType property_type) { TNode<Code> code_target = HeapConstant(ic.code()); TNode<Object> object = LoadRegisterAtOperandIndex(0); - Node* name = LoadConstantPoolEntryAtOperandIndex(1); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(1)); TNode<Object> value = GetAccumulator(); - Node* raw_slot = BytecodeOperandIdx(2); + TNode<IntPtrT> raw_slot = Signed(BytecodeOperandIdx(2)); TNode<Smi> smi_slot = SmiTag(raw_slot); TNode<HeapObject> maybe_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - VARIABLE(var_result, MachineRepresentation::kTagged); - var_result.Bind(CallStub(ic.descriptor(), code_target, context, object, - name, value, smi_slot, maybe_vector)); + TVARIABLE(Object, var_result); + var_result = CallStub(ic.descriptor(), code_target, context, object, name, + value, smi_slot, maybe_vector); // To avoid special logic in the deoptimizer to re-materialize the value in // the accumulator, we overwrite the accumulator after the IC call. It // doesn't really matter what we write to the accumulator here, since we @@ -624,7 +630,7 @@ IGNITION_HANDLER(StaNamedOwnProperty, InterpreterStoreNamedPropertyAssembler) { IGNITION_HANDLER(StaNamedPropertyNoFeedback, InterpreterStoreNamedPropertyAssembler) { TNode<Object> object = LoadRegisterAtOperandIndex(0); - Node* name = LoadConstantPoolEntryAtOperandIndex(1); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(1)); TNode<Object> value = GetAccumulator(); TNode<Context> context = GetContext(); @@ -642,14 +648,14 @@ IGNITION_HANDLER(StaKeyedProperty, InterpreterAssembler) { TNode<Object> object = LoadRegisterAtOperandIndex(0); TNode<Object> name = LoadRegisterAtOperandIndex(1); TNode<Object> value = GetAccumulator(); - Node* raw_slot = BytecodeOperandIdx(2); + TNode<IntPtrT> raw_slot = Signed(BytecodeOperandIdx(2)); TNode<Smi> smi_slot = SmiTag(raw_slot); TNode<HeapObject> maybe_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - VARIABLE(var_result, MachineRepresentation::kTagged); - var_result.Bind(CallBuiltin(Builtins::kKeyedStoreIC, context, object, name, - value, smi_slot, maybe_vector)); + TVARIABLE(Object, var_result); + var_result = CallBuiltin(Builtins::kKeyedStoreIC, context, object, name, + value, smi_slot, maybe_vector); // To avoid special logic in the deoptimizer to re-materialize the value in // the accumulator, we overwrite the accumulator after the IC call. It // doesn't really matter what we write to the accumulator here, since we @@ -667,14 +673,14 @@ IGNITION_HANDLER(StaInArrayLiteral, InterpreterAssembler) { TNode<Object> array = LoadRegisterAtOperandIndex(0); TNode<Object> index = LoadRegisterAtOperandIndex(1); TNode<Object> value = GetAccumulator(); - Node* raw_slot = BytecodeOperandIdx(2); + TNode<IntPtrT> raw_slot = Signed(BytecodeOperandIdx(2)); TNode<Smi> smi_slot = SmiTag(raw_slot); TNode<HeapObject> feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - VARIABLE(var_result, MachineRepresentation::kTagged); - var_result.Bind(CallBuiltin(Builtins::kStoreInArrayLiteralIC, context, array, - index, value, smi_slot, feedback_vector)); + TVARIABLE(Object, var_result); + var_result = CallBuiltin(Builtins::kStoreInArrayLiteralIC, context, array, + index, value, smi_slot, feedback_vector); // To avoid special logic in the deoptimizer to re-materialize the value in // the accumulator, we overwrite the accumulator after the IC call. It // doesn't really matter what we write to the accumulator here, since we @@ -696,8 +702,9 @@ IGNITION_HANDLER(StaDataPropertyInLiteral, InterpreterAssembler) { TNode<Object> object = LoadRegisterAtOperandIndex(0); TNode<Object> name = LoadRegisterAtOperandIndex(1); TNode<Object> value = GetAccumulator(); - TNode<Smi> flags = SmiFromInt32(BytecodeOperandFlag(2)); - TNode<Smi> vector_index = SmiTag(BytecodeOperandIdx(3)); + TNode<Smi> flags = + SmiFromInt32(UncheckedCast<Int32T>(BytecodeOperandFlag(2))); + TNode<Smi> vector_index = BytecodeOperandIdxSmi(3); TNode<HeapObject> feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); @@ -708,7 +715,7 @@ IGNITION_HANDLER(StaDataPropertyInLiteral, InterpreterAssembler) { } IGNITION_HANDLER(CollectTypeProfile, InterpreterAssembler) { - Node* position = BytecodeOperandImmSmi(0); + TNode<Smi> position = BytecodeOperandImmSmi(0); TNode<Object> value = GetAccumulator(); TNode<HeapObject> feedback_vector = LoadFeedbackVector(); @@ -725,10 +732,10 @@ IGNITION_HANDLER(CollectTypeProfile, InterpreterAssembler) { // identified by <cell_index>. <depth> is the depth of the current context // relative to the module context. IGNITION_HANDLER(LdaModuleVariable, InterpreterAssembler) { - Node* cell_index = BytecodeOperandImmIntPtr(0); + TNode<IntPtrT> cell_index = BytecodeOperandImmIntPtr(0); TNode<Uint32T> depth = BytecodeOperandUImm(1); - Node* module_context = GetContextAtDepth(GetContext(), depth); + TNode<Context> module_context = GetContextAtDepth(GetContext(), depth); TNode<SourceTextModule> module = CAST(LoadContextElement(module_context, Context::EXTENSION_INDEX)); @@ -741,7 +748,7 @@ IGNITION_HANDLER(LdaModuleVariable, InterpreterAssembler) { TNode<FixedArray> regular_exports = LoadObjectField<FixedArray>( module, SourceTextModule::kRegularExportsOffset); // The actual array index is (cell_index - 1). - TNode<WordT> export_index = IntPtrSub(cell_index, IntPtrConstant(1)); + TNode<IntPtrT> export_index = IntPtrSub(cell_index, IntPtrConstant(1)); TNode<Cell> cell = CAST(LoadFixedArrayElement(regular_exports, export_index)); SetAccumulator(LoadObjectField(cell, Cell::kValueOffset)); @@ -753,7 +760,7 @@ IGNITION_HANDLER(LdaModuleVariable, InterpreterAssembler) { TNode<FixedArray> regular_imports = LoadObjectField<FixedArray>( module, SourceTextModule::kRegularImportsOffset); // The actual array index is (-cell_index - 1). - TNode<WordT> import_index = IntPtrSub(IntPtrConstant(-1), cell_index); + TNode<IntPtrT> import_index = IntPtrSub(IntPtrConstant(-1), cell_index); TNode<Cell> cell = CAST(LoadFixedArrayElement(regular_imports, import_index)); SetAccumulator(LoadObjectField(cell, Cell::kValueOffset)); @@ -770,10 +777,10 @@ IGNITION_HANDLER(LdaModuleVariable, InterpreterAssembler) { // <depth> is the depth of the current context relative to the module context. IGNITION_HANDLER(StaModuleVariable, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); - Node* cell_index = BytecodeOperandImmIntPtr(0); + TNode<IntPtrT> cell_index = BytecodeOperandImmIntPtr(0); TNode<Uint32T> depth = BytecodeOperandUImm(1); - Node* module_context = GetContextAtDepth(GetContext(), depth); + TNode<Context> module_context = GetContextAtDepth(GetContext(), depth); TNode<SourceTextModule> module = CAST(LoadContextElement(module_context, Context::EXTENSION_INDEX)); @@ -786,7 +793,7 @@ IGNITION_HANDLER(StaModuleVariable, InterpreterAssembler) { TNode<FixedArray> regular_exports = LoadObjectField<FixedArray>( module, SourceTextModule::kRegularExportsOffset); // The actual array index is (cell_index - 1). - TNode<WordT> export_index = IntPtrSub(cell_index, IntPtrConstant(1)); + TNode<IntPtrT> export_index = IntPtrSub(cell_index, IntPtrConstant(1)); TNode<Object> cell = LoadFixedArrayElement(regular_exports, export_index); StoreObjectField(cell, Cell::kValueOffset, value); Goto(&end); @@ -830,34 +837,35 @@ class InterpreterBinaryOpAssembler : public InterpreterAssembler { OperandScale operand_scale) : InterpreterAssembler(state, bytecode, operand_scale) {} - using BinaryOpGenerator = - Node* (BinaryOpAssembler::*)(Node* context, Node* left, Node* right, - Node* slot, Node* vector, bool lhs_is_smi); + using BinaryOpGenerator = TNode<Object> (BinaryOpAssembler::*)( + TNode<Context> context, TNode<Object> left, TNode<Object> right, + TNode<UintPtrT> slot, TNode<HeapObject> maybe_feedback_vector, + bool rhs_known_smi); void BinaryOpWithFeedback(BinaryOpGenerator generator) { TNode<Object> lhs = LoadRegisterAtOperandIndex(0); TNode<Object> rhs = GetAccumulator(); TNode<Context> context = GetContext(); - Node* slot_index = BytecodeOperandIdx(1); + TNode<UintPtrT> slot_index = BytecodeOperandIdx(1); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); BinaryOpAssembler binop_asm(state()); - Node* result = (binop_asm.*generator)(context, lhs, rhs, slot_index, - maybe_feedback_vector, false); + TNode<Object> result = (binop_asm.*generator)(context, lhs, rhs, slot_index, + maybe_feedback_vector, false); SetAccumulator(result); Dispatch(); } void BinaryOpSmiWithFeedback(BinaryOpGenerator generator) { TNode<Object> lhs = GetAccumulator(); - Node* rhs = BytecodeOperandImmSmi(0); + TNode<Smi> rhs = BytecodeOperandImmSmi(0); TNode<Context> context = GetContext(); - Node* slot_index = BytecodeOperandIdx(1); + TNode<UintPtrT> slot_index = BytecodeOperandIdx(1); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); BinaryOpAssembler binop_asm(state()); - Node* result = (binop_asm.*generator)(context, lhs, rhs, slot_index, - maybe_feedback_vector, true); + TNode<Object> result = (binop_asm.*generator)(context, lhs, rhs, slot_index, + maybe_feedback_vector, true); SetAccumulator(result); Dispatch(); } @@ -959,15 +967,15 @@ class InterpreterBitwiseBinaryOpAssembler : public InterpreterAssembler { TNode<Object> left = LoadRegisterAtOperandIndex(0); TNode<Object> right = GetAccumulator(); TNode<Context> context = GetContext(); - Node* slot_index = BytecodeOperandIdx(1); + TNode<UintPtrT> slot_index = BytecodeOperandIdx(1); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TVARIABLE(Smi, var_left_feedback); TVARIABLE(Smi, var_right_feedback); - VARIABLE(var_left_word32, MachineRepresentation::kWord32); - VARIABLE(var_right_word32, MachineRepresentation::kWord32); - VARIABLE(var_left_bigint, MachineRepresentation::kTagged, left); - VARIABLE(var_right_bigint, MachineRepresentation::kTagged); + TVARIABLE(Word32T, var_left_word32); + TVARIABLE(Word32T, var_right_word32); + TVARIABLE(Object, var_left_bigint, left); + TVARIABLE(Object, var_right_bigint); Label if_left_number(this), do_number_op(this); Label if_left_bigint(this), do_bigint_op(this); @@ -1007,14 +1015,16 @@ class InterpreterBitwiseBinaryOpAssembler : public InterpreterAssembler { void BitwiseBinaryOpWithSmi(Operation bitwise_op) { TNode<Object> left = GetAccumulator(); - Node* right = BytecodeOperandImmSmi(0); - Node* slot_index = BytecodeOperandIdx(1); + TNode<Smi> right = BytecodeOperandImmSmi(0); + TNode<UintPtrT> slot_index = BytecodeOperandIdx(1); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); TVARIABLE(Smi, var_left_feedback); - VARIABLE(var_left_word32, MachineRepresentation::kWord32); - VARIABLE(var_left_bigint, MachineRepresentation::kTagged); + TVARIABLE(Word32T, var_left_word32); + // TODO(v8:6949): var_left_bigint should be BigInt, but before that we need + // to clean up TaggedToWord32OrBigIntWithFeedback and related methods. + TVARIABLE(Object, var_left_bigint); Label do_smi_op(this), if_bigint_mix(this); TaggedToWord32OrBigIntWithFeedback(context, left, &do_smi_op, @@ -1115,13 +1125,15 @@ IGNITION_HANDLER(BitwiseAndSmi, InterpreterBitwiseBinaryOpAssembler) { // Perform bitwise-not on the accumulator. IGNITION_HANDLER(BitwiseNot, InterpreterAssembler) { TNode<Object> operand = GetAccumulator(); - Node* slot_index = BytecodeOperandIdx(0); + TNode<UintPtrT> slot_index = BytecodeOperandIdx(0); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - VARIABLE(var_word32, MachineRepresentation::kWord32); + TVARIABLE(Word32T, var_word32); TVARIABLE(Smi, var_feedback); - VARIABLE(var_bigint, MachineRepresentation::kTagged); + // TODO(v8:6949): var_bigint should be BigInt, but before that we need to + // clean up TaggedToWord32OrBigIntWithFeedback and related methods. + TVARIABLE(Object, var_bigint); Label if_number(this), if_bigint(this); TaggedToWord32OrBigIntWithFeedback(context, operand, &if_number, &var_word32, &if_bigint, &var_bigint, &var_feedback); @@ -1184,20 +1196,20 @@ class UnaryNumericOpAssembler : public InterpreterAssembler { virtual ~UnaryNumericOpAssembler() = default; // Must return a tagged value. - virtual TNode<Number> SmiOp(TNode<Smi> smi_value, Variable* var_feedback, - Label* do_float_op, Variable* var_float) = 0; + virtual TNode<Number> SmiOp(TNode<Smi> smi_value, + TVariable<Smi>* var_feedback, Label* do_float_op, + TVariable<Float64T>* var_float) = 0; // Must return a Float64 value. - virtual Node* FloatOp(Node* float_value) = 0; + virtual TNode<Float64T> FloatOp(TNode<Float64T> float_value) = 0; // Must return a tagged value. - virtual Node* BigIntOp(Node* bigint_value) = 0; + virtual TNode<HeapObject> BigIntOp(TNode<HeapObject> bigint_value) = 0; void UnaryOpWithFeedback() { - VARIABLE(var_value, MachineRepresentation::kTagged, GetAccumulator()); - VARIABLE(var_result, MachineRepresentation::kTagged); - VARIABLE(var_float_value, MachineRepresentation::kFloat64); + TVARIABLE(Object, var_value, GetAccumulator()); + TVARIABLE(Object, var_result); + TVARIABLE(Float64T, var_float_value); TVARIABLE(Smi, var_feedback, SmiConstant(BinaryOperationFeedback::kNone)); - Variable* loop_vars[] = {&var_value, &var_feedback}; - Label start(this, arraysize(loop_vars), loop_vars), end(this); + Label start(this, {&var_value, &var_feedback}), end(this); Label do_float_op(this, &var_float_value); Goto(&start); // We might have to try again after ToNumeric conversion. @@ -1206,9 +1218,11 @@ class UnaryNumericOpAssembler : public InterpreterAssembler { Label if_smi(this), if_heapnumber(this), if_oddball(this); Label if_bigint(this, Label::kDeferred); Label if_other(this, Label::kDeferred); - Node* value = var_value.value(); + TNode<Object> value = var_value.value(); GotoIf(TaggedIsSmi(value), &if_smi); - TNode<Map> map = LoadMap(value); + + TNode<HeapObject> value_heap_object = CAST(value); + TNode<Map> map = LoadMap(value_heap_object); GotoIf(IsHeapNumberMap(map), &if_heapnumber); TNode<Uint16T> instance_type = LoadMapInstanceType(map); GotoIf(IsBigIntInstanceType(instance_type), &if_bigint); @@ -1217,20 +1231,20 @@ class UnaryNumericOpAssembler : public InterpreterAssembler { BIND(&if_smi); { - var_result.Bind( - SmiOp(CAST(value), &var_feedback, &do_float_op, &var_float_value)); + var_result = + SmiOp(CAST(value), &var_feedback, &do_float_op, &var_float_value); Goto(&end); } BIND(&if_heapnumber); { - var_float_value.Bind(LoadHeapNumberValue(value)); + var_float_value = LoadHeapNumberValue(value_heap_object); Goto(&do_float_op); } BIND(&if_bigint); { - var_result.Bind(BigIntOp(value)); + var_result = BigIntOp(value_heap_object); CombineFeedback(&var_feedback, BinaryOperationFeedback::kBigInt); Goto(&end); } @@ -1244,7 +1258,8 @@ class UnaryNumericOpAssembler : public InterpreterAssembler { SmiConstant(BinaryOperationFeedback::kNone))); OverwriteFeedback(&var_feedback, BinaryOperationFeedback::kNumberOrOddball); - var_value.Bind(LoadObjectField(value, Oddball::kToNumberOffset)); + var_value = + LoadObjectField(value_heap_object, Oddball::kToNumberOffset); Goto(&start); } @@ -1256,8 +1271,8 @@ class UnaryNumericOpAssembler : public InterpreterAssembler { CSA_ASSERT(this, SmiEqual(var_feedback.value(), SmiConstant(BinaryOperationFeedback::kNone))); OverwriteFeedback(&var_feedback, BinaryOperationFeedback::kAny); - var_value.Bind( - CallBuiltin(Builtins::kNonNumberToNumeric, GetContext(), value)); + var_value = CallBuiltin(Builtins::kNonNumberToNumeric, GetContext(), + value_heap_object); Goto(&start); } } @@ -1265,13 +1280,13 @@ class UnaryNumericOpAssembler : public InterpreterAssembler { BIND(&do_float_op); { CombineFeedback(&var_feedback, BinaryOperationFeedback::kNumber); - var_result.Bind( - AllocateHeapNumberWithValue(FloatOp(var_float_value.value()))); + var_result = + AllocateHeapNumberWithValue(FloatOp(var_float_value.value())); Goto(&end); } BIND(&end); - Node* slot_index = BytecodeOperandIdx(0); + TNode<UintPtrT> slot_index = BytecodeOperandIdx(0); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); UpdateFeedback(var_feedback.value(), maybe_feedback_vector, slot_index); SetAccumulator(var_result.value()); @@ -1285,8 +1300,9 @@ class NegateAssemblerImpl : public UnaryNumericOpAssembler { OperandScale operand_scale) : UnaryNumericOpAssembler(state, bytecode, operand_scale) {} - TNode<Number> SmiOp(TNode<Smi> smi_value, Variable* var_feedback, - Label* do_float_op, Variable* var_float) override { + TNode<Number> SmiOp(TNode<Smi> smi_value, TVariable<Smi>* var_feedback, + Label* do_float_op, + TVariable<Float64T>* var_float) override { TVARIABLE(Number, var_result); Label if_zero(this), if_min_smi(this), end(this); // Return -0 if operand is 0. @@ -1306,18 +1322,20 @@ class NegateAssemblerImpl : public UnaryNumericOpAssembler { Goto(&end); BIND(&if_min_smi); - var_float->Bind(SmiToFloat64(smi_value)); + *var_float = SmiToFloat64(smi_value); Goto(do_float_op); BIND(&end); return var_result.value(); } - Node* FloatOp(Node* float_value) override { return Float64Neg(float_value); } + TNode<Float64T> FloatOp(TNode<Float64T> float_value) override { + return Float64Neg(float_value); + } - Node* BigIntOp(Node* bigint_value) override { - return CallRuntime(Runtime::kBigIntUnaryOp, GetContext(), bigint_value, - SmiConstant(Operation::kNegate)); + TNode<HeapObject> BigIntOp(TNode<HeapObject> bigint_value) override { + return CAST(CallRuntime(Runtime::kBigIntUnaryOp, GetContext(), bigint_value, + SmiConstant(Operation::kNegate))); } }; @@ -1381,8 +1399,9 @@ class IncDecAssembler : public UnaryNumericOpAssembler { return op_; } - TNode<Number> SmiOp(TNode<Smi> value, Variable* var_feedback, - Label* do_float_op, Variable* var_float) override { + TNode<Number> SmiOp(TNode<Smi> value, TVariable<Smi>* var_feedback, + Label* do_float_op, + TVariable<Float64T>* var_float) override { TNode<Smi> one = SmiConstant(1); Label if_overflow(this), if_notoverflow(this); TNode<Smi> result = op() == Operation::kIncrement @@ -1392,7 +1411,7 @@ class IncDecAssembler : public UnaryNumericOpAssembler { BIND(&if_overflow); { - var_float->Bind(SmiToFloat64(value)); + *var_float = SmiToFloat64(value); Goto(do_float_op); } @@ -1401,15 +1420,15 @@ class IncDecAssembler : public UnaryNumericOpAssembler { return result; } - Node* FloatOp(Node* float_value) override { + TNode<Float64T> FloatOp(TNode<Float64T> float_value) override { return op() == Operation::kIncrement ? Float64Add(float_value, Float64Constant(1.0)) : Float64Sub(float_value, Float64Constant(1.0)); } - Node* BigIntOp(Node* bigint_value) override { - return CallRuntime(Runtime::kBigIntUnaryOp, GetContext(), bigint_value, - SmiConstant(op())); + TNode<HeapObject> BigIntOp(TNode<HeapObject> bigint_value) override { + return CAST(CallRuntime(Runtime::kBigIntUnaryOp, GetContext(), bigint_value, + SmiConstant(op()))); } void IncWithFeedback() { @@ -1442,17 +1461,17 @@ IGNITION_HANDLER(Dec, IncDecAssembler) { DecWithFeedback(); } // accumulator to a boolean value if required. IGNITION_HANDLER(ToBooleanLogicalNot, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); - Variable result(this, MachineRepresentation::kTagged); + TVARIABLE(Oddball, result); Label if_true(this), if_false(this), end(this); BranchIfToBooleanIsTrue(value, &if_true, &if_false); BIND(&if_true); { - result.Bind(FalseConstant()); + result = FalseConstant(); Goto(&end); } BIND(&if_false); { - result.Bind(TrueConstant()); + result = TrueConstant(); Goto(&end); } BIND(&end); @@ -1466,20 +1485,20 @@ IGNITION_HANDLER(ToBooleanLogicalNot, InterpreterAssembler) { // value. IGNITION_HANDLER(LogicalNot, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); - Variable result(this, MachineRepresentation::kTagged); + TVARIABLE(Oddball, result); Label if_true(this), if_false(this), end(this); TNode<Oddball> true_value = TrueConstant(); TNode<Oddball> false_value = FalseConstant(); Branch(TaggedEqual(value, true_value), &if_true, &if_false); BIND(&if_true); { - result.Bind(false_value); + result = false_value; Goto(&end); } BIND(&if_false); { CSA_ASSERT(this, TaggedEqual(value, false_value)); - result.Bind(true_value); + result = true_value; Goto(&end); } BIND(&end); @@ -1493,7 +1512,7 @@ IGNITION_HANDLER(LogicalNot, InterpreterAssembler) { // object in the accumulator. IGNITION_HANDLER(TypeOf, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); - Node* result = Typeof(value); + TNode<String> result = Typeof(value); SetAccumulator(result); Dispatch(); } @@ -1550,7 +1569,7 @@ class InterpreterJSCallAssembler : public InterpreterAssembler { void JSCall(ConvertReceiverMode receiver_mode) { TNode<Object> function = LoadRegisterAtOperandIndex(0); RegListNodePair args = GetRegisterListAtOperandIndex(1); - Node* slot_id = BytecodeOperandIdx(3); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(3); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); @@ -1583,7 +1602,7 @@ class InterpreterJSCallAssembler : public InterpreterAssembler { kFirstArgumentOperandIndex + kRecieverAndArgOperandCount; TNode<Object> function = LoadRegisterAtOperandIndex(0); - Node* slot_id = BytecodeOperandIdx(kSlotOperandIndex); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(kSlotOperandIndex); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); @@ -1598,26 +1617,20 @@ class InterpreterJSCallAssembler : public InterpreterAssembler { case 1: CallJSAndDispatch( function, context, Int32Constant(arg_count), receiver_mode, - static_cast<Node*>( - LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex))); + LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex)); break; case 2: CallJSAndDispatch( function, context, Int32Constant(arg_count), receiver_mode, - static_cast<Node*>( - LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex)), - static_cast<Node*>( - LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex + 1))); + LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex), + LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex + 1)); break; case 3: CallJSAndDispatch( function, context, Int32Constant(arg_count), receiver_mode, - static_cast<Node*>( - LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex)), - static_cast<Node*>( - LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex + 1)), - static_cast<Node*>( - LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex + 2))); + LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex), + LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex + 1), + LoadRegisterAtOperandIndex(kFirstArgumentOperandIndex + 2)); break; default: UNREACHABLE(); @@ -1676,7 +1689,7 @@ IGNITION_HANDLER(CallNoFeedback, InterpreterJSCallAssembler) { // register |first_arg| and |arg_count| arguments in subsequent // registers. IGNITION_HANDLER(CallRuntime, InterpreterAssembler) { - Node* function_id = BytecodeOperandRuntimeId(0); + TNode<Uint32T> function_id = BytecodeOperandRuntimeId(0); RegListNodePair args = GetRegisterListAtOperandIndex(1); TNode<Context> context = GetContext(); Node* result = CallRuntimeN(function_id, context, args); @@ -1690,10 +1703,11 @@ IGNITION_HANDLER(CallRuntime, InterpreterAssembler) { // |function_id| with the first argument in |first_arg| and |arg_count| // arguments in subsequent registers. IGNITION_HANDLER(InvokeIntrinsic, InterpreterAssembler) { - Node* function_id = BytecodeOperandIntrinsicId(0); + TNode<Uint32T> function_id = BytecodeOperandIntrinsicId(0); RegListNodePair args = GetRegisterListAtOperandIndex(1); TNode<Context> context = GetContext(); - Node* result = GenerateInvokeIntrinsic(this, function_id, context, args); + TNode<Object> result = + GenerateInvokeIntrinsic(this, function_id, context, args); SetAccumulator(result); Dispatch(); } @@ -1706,13 +1720,13 @@ IGNITION_HANDLER(InvokeIntrinsic, InterpreterAssembler) { // <first_return + 1> IGNITION_HANDLER(CallRuntimeForPair, InterpreterAssembler) { // Call the runtime function. - Node* function_id = BytecodeOperandRuntimeId(0); + TNode<Uint32T> function_id = BytecodeOperandRuntimeId(0); RegListNodePair args = GetRegisterListAtOperandIndex(1); TNode<Context> context = GetContext(); Node* result_pair = CallRuntimeN(function_id, context, args, 2); // Store the results in <first_return> and <first_return + 1> - Node* result0 = Projection(0, result_pair); - Node* result1 = Projection(1, result_pair); + TNode<Object> result0 = CAST(Projection(0, result_pair)); + TNode<Object> result1 = CAST(Projection(1, result_pair)); StoreRegisterPairAtOperandIndex(result0, result1, 3); Dispatch(); } @@ -1722,12 +1736,12 @@ IGNITION_HANDLER(CallRuntimeForPair, InterpreterAssembler) { // Call the JS runtime function that has the |context_index| with the receiver // in register |receiver| and |arg_count| arguments in subsequent registers. IGNITION_HANDLER(CallJSRuntime, InterpreterAssembler) { - Node* context_index = BytecodeOperandNativeContextIndex(0); + TNode<IntPtrT> context_index = Signed(BytecodeOperandNativeContextIndex(0)); RegListNodePair args = GetRegisterListAtOperandIndex(1); // Get the function to call from the native context. TNode<Context> context = GetContext(); - TNode<Context> native_context = LoadNativeContext(context); + TNode<NativeContext> native_context = LoadNativeContext(context); TNode<Object> function = LoadContextElement(native_context, context_index); // Call the function. @@ -1744,7 +1758,7 @@ IGNITION_HANDLER(CallJSRuntime, InterpreterAssembler) { IGNITION_HANDLER(CallWithSpread, InterpreterAssembler) { TNode<Object> callable = LoadRegisterAtOperandIndex(0); RegListNodePair args = GetRegisterListAtOperandIndex(1); - Node* slot_id = BytecodeOperandIdx(3); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(3); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); @@ -1763,11 +1777,11 @@ IGNITION_HANDLER(ConstructWithSpread, InterpreterAssembler) { TNode<Object> new_target = GetAccumulator(); TNode<Object> constructor = LoadRegisterAtOperandIndex(0); RegListNodePair args = GetRegisterListAtOperandIndex(1); - Node* slot_id = BytecodeOperandIdx(3); - TNode<HeapObject> feedback_vector = LoadFeedbackVector(); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(3); + TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - Node* result = ConstructWithSpread(constructor, context, new_target, args, - slot_id, feedback_vector); + TNode<Object> result = ConstructWithSpread( + constructor, context, new_target, args, slot_id, maybe_feedback_vector); SetAccumulator(result); Dispatch(); } @@ -1782,11 +1796,11 @@ IGNITION_HANDLER(Construct, InterpreterAssembler) { TNode<Object> new_target = GetAccumulator(); TNode<Object> constructor = LoadRegisterAtOperandIndex(0); RegListNodePair args = GetRegisterListAtOperandIndex(1); - Node* slot_id = BytecodeOperandIdx(3); - TNode<HeapObject> feedback_vector = LoadFeedbackVector(); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(3); + TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - Node* result = Construct(constructor, context, new_target, args, slot_id, - feedback_vector); + TNode<Object> result = Construct(constructor, context, new_target, args, + slot_id, maybe_feedback_vector); SetAccumulator(result); Dispatch(); } @@ -1802,8 +1816,8 @@ class InterpreterCompareOpAssembler : public InterpreterAssembler { TNode<Object> rhs = GetAccumulator(); TNode<Context> context = GetContext(); - Variable var_type_feedback(this, MachineRepresentation::kTagged); - Node* result; + TVARIABLE(Smi, var_type_feedback); + TNode<Oddball> result; switch (compare_op) { case Operation::kEqual: result = Equal(lhs, rhs, context, &var_type_feedback); @@ -1822,7 +1836,7 @@ class InterpreterCompareOpAssembler : public InterpreterAssembler { UNREACHABLE(); } - Node* slot_index = BytecodeOperandIdx(1); + TNode<UintPtrT> slot_index = BytecodeOperandIdx(1); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); UpdateFeedback(var_type_feedback.value(), maybe_feedback_vector, slot_index); @@ -1894,14 +1908,14 @@ IGNITION_HANDLER(TestReferenceEqual, InterpreterAssembler) { IGNITION_HANDLER(TestIn, InterpreterAssembler) { TNode<Object> name = LoadRegisterAtOperandIndex(0); TNode<Object> object = GetAccumulator(); - Node* raw_slot = BytecodeOperandIdx(1); + TNode<IntPtrT> raw_slot = Signed(BytecodeOperandIdx(1)); TNode<Smi> smi_slot = SmiTag(raw_slot); TNode<HeapObject> feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - VARIABLE(var_result, MachineRepresentation::kTagged); - var_result.Bind(CallBuiltin(Builtins::kKeyedHasIC, context, object, name, - smi_slot, feedback_vector)); + TVARIABLE(Object, var_result); + var_result = CallBuiltin(Builtins::kKeyedHasIC, context, object, name, + smi_slot, feedback_vector); SetAccumulator(var_result.value()); Dispatch(); } @@ -1913,15 +1927,16 @@ IGNITION_HANDLER(TestIn, InterpreterAssembler) { IGNITION_HANDLER(TestInstanceOf, InterpreterAssembler) { TNode<Object> object = LoadRegisterAtOperandIndex(0); TNode<Object> callable = GetAccumulator(); - Node* slot_id = BytecodeOperandIdx(1); - TNode<HeapObject> feedback_vector = LoadFeedbackVector(); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(1); + TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); Label feedback_done(this); - GotoIf(IsUndefined(feedback_vector), &feedback_done); + GotoIf(IsUndefined(maybe_feedback_vector), &feedback_done); // Record feedback for the {callable} in the {feedback_vector}. - CollectCallableFeedback(callable, context, feedback_vector, slot_id); + CollectCallableFeedback(callable, context, CAST(maybe_feedback_vector), + slot_id); Goto(&feedback_done); BIND(&feedback_done); @@ -1980,7 +1995,7 @@ IGNITION_HANDLER(TestUndefined, InterpreterAssembler) { // by |literal_flag|. IGNITION_HANDLER(TestTypeOf, InterpreterAssembler) { TNode<Object> object = GetAccumulator(); - Node* literal_flag = BytecodeOperandFlag(0); + TNode<Uint32T> literal_flag = BytecodeOperandFlag(0); #define MAKE_LABEL(name, lower_case) Label if_##lower_case(this); TYPEOF_LITERAL_LIST(MAKE_LABEL) @@ -2097,7 +2112,7 @@ IGNITION_HANDLER(TestTypeOf, InterpreterAssembler) { // // Jump by the number of bytes represented by the immediate operand |imm|. IGNITION_HANDLER(Jump, InterpreterAssembler) { - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); Jump(relative_jump); } @@ -2117,7 +2132,7 @@ IGNITION_HANDLER(JumpConstant, InterpreterAssembler) { // will misbehave if passed arbitrary input values. IGNITION_HANDLER(JumpIfTrue, InterpreterAssembler) { TNode<Object> accumulator = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); CSA_ASSERT(this, IsBoolean(CAST(accumulator))); JumpIfTaggedEqual(accumulator, TrueConstant(), relative_jump); } @@ -2141,7 +2156,7 @@ IGNITION_HANDLER(JumpIfTrueConstant, InterpreterAssembler) { // will misbehave if passed arbitrary input values. IGNITION_HANDLER(JumpIfFalse, InterpreterAssembler) { TNode<Object> accumulator = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); CSA_ASSERT(this, IsBoolean(CAST(accumulator))); JumpIfTaggedEqual(accumulator, FalseConstant(), relative_jump); } @@ -2164,7 +2179,7 @@ IGNITION_HANDLER(JumpIfFalseConstant, InterpreterAssembler) { // referenced by the accumulator is true when the object is cast to boolean. IGNITION_HANDLER(JumpIfToBooleanTrue, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); Label if_true(this), if_false(this); BranchIfToBooleanIsTrue(value, &if_true, &if_false); BIND(&if_true); @@ -2195,7 +2210,7 @@ IGNITION_HANDLER(JumpIfToBooleanTrueConstant, InterpreterAssembler) { // referenced by the accumulator is false when the object is cast to boolean. IGNITION_HANDLER(JumpIfToBooleanFalse, InterpreterAssembler) { TNode<Object> value = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); Label if_true(this), if_false(this); BranchIfToBooleanIsTrue(value, &if_true, &if_false); BIND(&if_true); @@ -2226,7 +2241,7 @@ IGNITION_HANDLER(JumpIfToBooleanFalseConstant, InterpreterAssembler) { // referenced by the accumulator is the null constant. IGNITION_HANDLER(JumpIfNull, InterpreterAssembler) { TNode<Object> accumulator = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); JumpIfTaggedEqual(accumulator, NullConstant(), relative_jump); } @@ -2246,7 +2261,7 @@ IGNITION_HANDLER(JumpIfNullConstant, InterpreterAssembler) { // referenced by the accumulator is not the null constant. IGNITION_HANDLER(JumpIfNotNull, InterpreterAssembler) { TNode<Object> accumulator = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); JumpIfTaggedNotEqual(accumulator, NullConstant(), relative_jump); } @@ -2266,7 +2281,7 @@ IGNITION_HANDLER(JumpIfNotNullConstant, InterpreterAssembler) { // referenced by the accumulator is the undefined constant. IGNITION_HANDLER(JumpIfUndefined, InterpreterAssembler) { TNode<Object> accumulator = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); JumpIfTaggedEqual(accumulator, UndefinedConstant(), relative_jump); } @@ -2286,7 +2301,7 @@ IGNITION_HANDLER(JumpIfUndefinedConstant, InterpreterAssembler) { // referenced by the accumulator is not the undefined constant. IGNITION_HANDLER(JumpIfNotUndefined, InterpreterAssembler) { TNode<Object> accumulator = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); JumpIfTaggedNotEqual(accumulator, UndefinedConstant(), relative_jump); } @@ -2314,7 +2329,7 @@ IGNITION_HANDLER(JumpIfUndefinedOrNull, InterpreterAssembler) { Dispatch(); BIND(&do_jump); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); Jump(relative_jump); } @@ -2342,7 +2357,7 @@ IGNITION_HANDLER(JumpIfUndefinedOrNullConstant, InterpreterAssembler) { // referenced by the accumulator is a JSReceiver. IGNITION_HANDLER(JumpIfJSReceiver, InterpreterAssembler) { TNode<Object> accumulator = GetAccumulator(); - Node* relative_jump = BytecodeOperandUImmWord(0); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); Label if_object(this), if_notobject(this, Label::kDeferred), if_notsmi(this); Branch(TaggedIsSmi(accumulator), &if_notobject, &if_notsmi); @@ -2383,9 +2398,9 @@ IGNITION_HANDLER(JumpIfJSReceiverConstant, InterpreterAssembler) { // performs a loop nesting check and potentially triggers OSR in case the // current OSR level matches (or exceeds) the specified |loop_depth|. IGNITION_HANDLER(JumpLoop, InterpreterAssembler) { - Node* relative_jump = BytecodeOperandUImmWord(0); - Node* loop_depth = BytecodeOperandImm(1); - Node* osr_level = LoadOsrNestingLevel(); + TNode<IntPtrT> relative_jump = Signed(BytecodeOperandUImmWord(0)); + TNode<Int32T> loop_depth = BytecodeOperandImm(1); + TNode<Int8T> osr_level = LoadOsrNestingLevel(); // Check if OSR points at the given {loop_depth} are armed by comparing it to // the current {osr_level} loaded from the header of the BytecodeArray. @@ -2415,9 +2430,9 @@ IGNITION_HANDLER(JumpLoop, InterpreterAssembler) { // next bytecode. IGNITION_HANDLER(SwitchOnSmiNoFeedback, InterpreterAssembler) { TNode<Object> acc = GetAccumulator(); - Node* table_start = BytecodeOperandIdx(0); - Node* table_length = BytecodeOperandUImmWord(1); - Node* case_value_base = BytecodeOperandImmIntPtr(2); + TNode<UintPtrT> table_start = BytecodeOperandIdx(0); + TNode<UintPtrT> table_length = BytecodeOperandUImmWord(1); + TNode<IntPtrT> case_value_base = BytecodeOperandImmIntPtr(2); Label fall_through(this); @@ -2426,7 +2441,7 @@ IGNITION_HANDLER(SwitchOnSmiNoFeedback, InterpreterAssembler) { // accumulator values. CSA_ASSERT(this, TaggedIsSmi(acc)); - TNode<WordT> case_value = IntPtrSub(SmiUntag(CAST(acc)), case_value_base); + TNode<IntPtrT> case_value = IntPtrSub(SmiUntag(CAST(acc)), case_value_base); GotoIf(IntPtrLessThan(case_value, IntPtrConstant(0)), &fall_through); GotoIf(IntPtrGreaterThanOrEqual(case_value, table_length), &fall_through); TNode<WordT> entry = IntPtrAdd(table_start, case_value); @@ -2442,17 +2457,18 @@ IGNITION_HANDLER(SwitchOnSmiNoFeedback, InterpreterAssembler) { // Creates a regular expression literal for literal index <literal_idx> with // <flags> and the pattern in <pattern_idx>. IGNITION_HANDLER(CreateRegExpLiteral, InterpreterAssembler) { - Node* pattern = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Object> pattern = LoadConstantPoolEntryAtOperandIndex(0); TNode<HeapObject> feedback_vector = LoadFeedbackVector(); - Node* slot_id = BytecodeOperandIdx(1); - TNode<Smi> flags = SmiFromInt32(BytecodeOperandFlag(2)); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(1); + TNode<Smi> flags = + SmiFromInt32(UncheckedCast<Int32T>(BytecodeOperandFlag(2))); TNode<Context> context = GetContext(); - VARIABLE(result, MachineRepresentation::kTagged); + TVARIABLE(JSRegExp, result); ConstructorBuiltinsAssembler constructor_assembler(state()); - result.Bind(constructor_assembler.EmitCreateRegExpLiteral( - feedback_vector, slot_id, pattern, flags, context)); + result = constructor_assembler.EmitCreateRegExpLiteral( + feedback_vector, slot_id, pattern, flags, context); SetAccumulator(result.value()); Dispatch(); } @@ -2463,9 +2479,9 @@ IGNITION_HANDLER(CreateRegExpLiteral, InterpreterAssembler) { // CreateArrayLiteral flags <flags> and constant elements in <element_idx>. IGNITION_HANDLER(CreateArrayLiteral, InterpreterAssembler) { TNode<HeapObject> feedback_vector = LoadFeedbackVector(); - Node* slot_id = BytecodeOperandIdx(1); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(1); TNode<Context> context = GetContext(); - Node* bytecode_flags = BytecodeOperandFlag(2); + TNode<Uint32T> bytecode_flags = BytecodeOperandFlag(2); Label fast_shallow_clone(this), call_runtime(this, Label::kDeferred); // No feedback, so handle it as a slow case. @@ -2478,8 +2494,8 @@ IGNITION_HANDLER(CreateArrayLiteral, InterpreterAssembler) { BIND(&fast_shallow_clone); { ConstructorBuiltinsAssembler constructor_assembler(state()); - Node* result = constructor_assembler.EmitCreateShallowArrayLiteral( - feedback_vector, slot_id, context, &call_runtime, + TNode<JSArray> result = constructor_assembler.EmitCreateShallowArrayLiteral( + CAST(feedback_vector), slot_id, context, &call_runtime, TRACK_ALLOCATION_SITE); SetAccumulator(result); Dispatch(); @@ -2487,14 +2503,14 @@ IGNITION_HANDLER(CreateArrayLiteral, InterpreterAssembler) { BIND(&call_runtime); { - TNode<WordT> flags_raw = + TNode<UintPtrT> flags_raw = DecodeWordFromWord32<CreateArrayLiteralFlags::FlagsBits>( bytecode_flags); TNode<Smi> flags = SmiTag(Signed(flags_raw)); - Node* constant_elements = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Object> constant_elements = LoadConstantPoolEntryAtOperandIndex(0); TNode<Object> result = CallRuntime(Runtime::kCreateArrayLiteral, context, feedback_vector, - SmiTag(slot_id), constant_elements, flags); + SmiTag(Signed(slot_id)), constant_elements, flags); SetAccumulator(result); Dispatch(); } @@ -2504,26 +2520,26 @@ IGNITION_HANDLER(CreateArrayLiteral, InterpreterAssembler) { // // Creates an empty JSArray literal for literal index <literal_idx>. IGNITION_HANDLER(CreateEmptyArrayLiteral, InterpreterAssembler) { - TNode<HeapObject> feedback_vector = LoadFeedbackVector(); - Node* slot_id = BytecodeOperandIdx(0); + TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(0); TNode<Context> context = GetContext(); Label no_feedback(this, Label::kDeferred), end(this); - VARIABLE(result, MachineRepresentation::kTagged); - GotoIf(IsUndefined(feedback_vector), &no_feedback); + TVARIABLE(JSArray, result); + GotoIf(IsUndefined(maybe_feedback_vector), &no_feedback); ConstructorBuiltinsAssembler constructor_assembler(state()); - result.Bind(constructor_assembler.EmitCreateEmptyArrayLiteral( - feedback_vector, slot_id, context)); + result = constructor_assembler.EmitCreateEmptyArrayLiteral( + CAST(maybe_feedback_vector), slot_id, context); Goto(&end); BIND(&no_feedback); { TNode<Map> array_map = LoadJSArrayElementsMap(GetInitialFastElementsKind(), LoadNativeContext(context)); - result.Bind(AllocateJSArray(GetInitialFastElementsKind(), array_map, - SmiConstant(0), SmiConstant(0), nullptr, - ParameterMode::SMI_PARAMETERS)); + result = + AllocateJSArray(GetInitialFastElementsKind(), array_map, SmiConstant(0), + SmiConstant(0), {}, ParameterMode::SMI_PARAMETERS); Goto(&end); } @@ -2551,8 +2567,8 @@ IGNITION_HANDLER(CreateArrayFromIterable, InterpreterAssembler) { // CreateObjectLiteralFlags <flags> and constant elements in <element_idx>. IGNITION_HANDLER(CreateObjectLiteral, InterpreterAssembler) { TNode<HeapObject> feedback_vector = LoadFeedbackVector(); - Node* slot_id = BytecodeOperandIdx(1); - Node* bytecode_flags = BytecodeOperandFlag(2); + TNode<UintPtrT> slot_id = BytecodeOperandIdx(1); + TNode<Uint32T> bytecode_flags = BytecodeOperandFlag(2); Label if_fast_clone(this), if_not_fast_clone(this, Label::kDeferred); // No feedback, so handle it as a slow case. @@ -2567,8 +2583,9 @@ IGNITION_HANDLER(CreateObjectLiteral, InterpreterAssembler) { { // If we can do a fast clone do the fast-path in CreateShallowObjectLiteral. ConstructorBuiltinsAssembler constructor_assembler(state()); - Node* result = constructor_assembler.EmitCreateShallowObjectLiteral( - feedback_vector, slot_id, &if_not_fast_clone); + TNode<HeapObject> result = + constructor_assembler.EmitCreateShallowObjectLiteral( + CAST(feedback_vector), slot_id, &if_not_fast_clone); SetAccumulator(result); Dispatch(); } @@ -2576,18 +2593,18 @@ IGNITION_HANDLER(CreateObjectLiteral, InterpreterAssembler) { BIND(&if_not_fast_clone); { // If we can't do a fast clone, call into the runtime. - Node* object_boilerplate_description = - LoadConstantPoolEntryAtOperandIndex(0); + TNode<ObjectBoilerplateDescription> object_boilerplate_description = + CAST(LoadConstantPoolEntryAtOperandIndex(0)); TNode<Context> context = GetContext(); - TNode<WordT> flags_raw = + TNode<UintPtrT> flags_raw = DecodeWordFromWord32<CreateObjectLiteralFlags::FlagsBits>( bytecode_flags); TNode<Smi> flags = SmiTag(Signed(flags_raw)); - TNode<Object> result = - CallRuntime(Runtime::kCreateObjectLiteral, context, feedback_vector, - SmiTag(slot_id), object_boilerplate_description, flags); + TNode<Object> result = CallRuntime(Runtime::kCreateObjectLiteral, context, + feedback_vector, SmiTag(Signed(slot_id)), + object_boilerplate_description, flags); SetAccumulator(result); // TODO(klaasb) build a single dispatch once the call is inlined Dispatch(); @@ -2600,7 +2617,8 @@ IGNITION_HANDLER(CreateObjectLiteral, InterpreterAssembler) { IGNITION_HANDLER(CreateEmptyObjectLiteral, InterpreterAssembler) { TNode<Context> context = GetContext(); ConstructorBuiltinsAssembler constructor_assembler(state()); - Node* result = constructor_assembler.EmitCreateEmptyObjectLiteral(context); + TNode<JSObject> result = + constructor_assembler.EmitCreateEmptyObjectLiteral(context); SetAccumulator(result); Dispatch(); } @@ -2611,18 +2629,18 @@ IGNITION_HANDLER(CreateEmptyObjectLiteral, InterpreterAssembler) { // {source}, converting getters into data properties. IGNITION_HANDLER(CloneObject, InterpreterAssembler) { TNode<Object> source = LoadRegisterAtOperandIndex(0); - Node* bytecode_flags = BytecodeOperandFlag(1); - TNode<WordT> raw_flags = + TNode<Uint32T> bytecode_flags = BytecodeOperandFlag(1); + TNode<UintPtrT> raw_flags = DecodeWordFromWord32<CreateObjectLiteralFlags::FlagsBits>(bytecode_flags); TNode<Smi> smi_flags = SmiTag(Signed(raw_flags)); - Node* raw_slot = BytecodeOperandIdx(2); + TNode<IntPtrT> raw_slot = Signed(BytecodeOperandIdx(2)); TNode<Smi> smi_slot = SmiTag(raw_slot); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); TNode<Context> context = GetContext(); - Variable var_result(this, MachineRepresentation::kTagged); - var_result.Bind(CallBuiltin(Builtins::kCloneObjectIC, context, source, - smi_flags, smi_slot, maybe_feedback_vector)); + TVARIABLE(Object, var_result); + var_result = CallBuiltin(Builtins::kCloneObjectIC, context, source, smi_flags, + smi_slot, maybe_feedback_vector); SetAccumulator(var_result.value()); Dispatch(); } @@ -2633,14 +2651,14 @@ IGNITION_HANDLER(CloneObject, InterpreterAssembler) { // accumulator, creating and caching the site object on-demand as per the // specification. IGNITION_HANDLER(GetTemplateObject, InterpreterAssembler) { - TNode<HeapObject> feedback_vector = LoadFeedbackVector(); - Node* slot = BytecodeOperandIdx(1); + TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); + TNode<UintPtrT> slot = BytecodeOperandIdx(1); Label call_runtime(this, Label::kDeferred); - GotoIf(IsUndefined(feedback_vector), &call_runtime); + GotoIf(IsUndefined(maybe_feedback_vector), &call_runtime); TNode<Object> cached_value = - CAST(LoadFeedbackVectorSlot(feedback_vector, slot, 0, INTPTR_PARAMETERS)); + CAST(LoadFeedbackVectorSlot(CAST(maybe_feedback_vector), slot)); GotoIf(TaggedEqual(cached_value, SmiConstant(0)), &call_runtime); @@ -2649,8 +2667,8 @@ IGNITION_HANDLER(GetTemplateObject, InterpreterAssembler) { BIND(&call_runtime); { - Node* description = LoadConstantPoolEntryAtOperandIndex(0); - TNode<Smi> slot_smi = SmiTag(slot); + TNode<Object> description = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Smi> slot_smi = SmiTag(Signed(slot)); TNode<JSFunction> closure = CAST(LoadRegister(Register::function_closure())); TNode<SharedFunctionInfo> shared_info = LoadObjectField<SharedFunctionInfo>( @@ -2660,8 +2678,8 @@ IGNITION_HANDLER(GetTemplateObject, InterpreterAssembler) { description, shared_info, slot_smi); Label end(this); - GotoIf(IsUndefined(feedback_vector), &end); - StoreFeedbackVectorSlot(feedback_vector, slot, result); + GotoIf(IsUndefined(maybe_feedback_vector), &end); + StoreFeedbackVectorSlot(CAST(maybe_feedback_vector), slot, result); Goto(&end); Bind(&end); @@ -2675,10 +2693,10 @@ IGNITION_HANDLER(GetTemplateObject, InterpreterAssembler) { // Creates a new closure for SharedFunctionInfo at position |index| in the // constant pool and with pretenuring controlled by |flags|. IGNITION_HANDLER(CreateClosure, InterpreterAssembler) { - Node* shared = LoadConstantPoolEntryAtOperandIndex(0); - Node* flags = BytecodeOperandFlag(2); + TNode<Object> shared = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Uint32T> flags = BytecodeOperandFlag(2); TNode<Context> context = GetContext(); - Node* slot = BytecodeOperandIdx(1); + TNode<UintPtrT> slot = BytecodeOperandIdx(1); Label if_undefined(this); TNode<ClosureFeedbackCellArray> feedback_cell_array = @@ -2727,7 +2745,7 @@ IGNITION_HANDLER(CreateClosure, InterpreterAssembler) { // // Creates a new block context with the scope info constant at |index|. IGNITION_HANDLER(CreateBlockContext, InterpreterAssembler) { - Node* scope_info = LoadConstantPoolEntryAtOperandIndex(0); + TNode<ScopeInfo> scope_info = CAST(LoadConstantPoolEntryAtOperandIndex(0)); TNode<Context> context = GetContext(); SetAccumulator(CallRuntime(Runtime::kPushBlockContext, context, scope_info)); Dispatch(); @@ -2739,7 +2757,7 @@ IGNITION_HANDLER(CreateBlockContext, InterpreterAssembler) { // and the ScopeInfo at |scope_info_idx|. IGNITION_HANDLER(CreateCatchContext, InterpreterAssembler) { TNode<Object> exception = LoadRegisterAtOperandIndex(0); - Node* scope_info = LoadConstantPoolEntryAtOperandIndex(1); + TNode<ScopeInfo> scope_info = CAST(LoadConstantPoolEntryAtOperandIndex(1)); TNode<Context> context = GetContext(); SetAccumulator( CallRuntime(Runtime::kPushCatchContext, context, exception, scope_info)); @@ -2750,8 +2768,8 @@ IGNITION_HANDLER(CreateCatchContext, InterpreterAssembler) { // // Creates a new context with number of |slots| for the function closure. IGNITION_HANDLER(CreateFunctionContext, InterpreterAssembler) { - Node* scope_info_idx = BytecodeOperandIdx(0); - Node* scope_info = LoadConstantPoolEntry(scope_info_idx); + TNode<UintPtrT> scope_info_idx = BytecodeOperandIdx(0); + TNode<ScopeInfo> scope_info = CAST(LoadConstantPoolEntry(scope_info_idx)); TNode<Uint32T> slots = BytecodeOperandUImm(1); TNode<Context> context = GetContext(); ConstructorBuiltinsAssembler constructor_assembler(state()); @@ -2764,8 +2782,8 @@ IGNITION_HANDLER(CreateFunctionContext, InterpreterAssembler) { // // Creates a new context with number of |slots| for an eval closure. IGNITION_HANDLER(CreateEvalContext, InterpreterAssembler) { - Node* scope_info_idx = BytecodeOperandIdx(0); - Node* scope_info = LoadConstantPoolEntry(scope_info_idx); + TNode<UintPtrT> scope_info_idx = BytecodeOperandIdx(0); + TNode<ScopeInfo> scope_info = CAST(LoadConstantPoolEntry(scope_info_idx)); TNode<Uint32T> slots = BytecodeOperandUImm(1); TNode<Context> context = GetContext(); ConstructorBuiltinsAssembler constructor_assembler(state()); @@ -2780,7 +2798,7 @@ IGNITION_HANDLER(CreateEvalContext, InterpreterAssembler) { // with-statement with the object in |register|. IGNITION_HANDLER(CreateWithContext, InterpreterAssembler) { TNode<Object> object = LoadRegisterAtOperandIndex(0); - Node* scope_info = LoadConstantPoolEntryAtOperandIndex(1); + TNode<ScopeInfo> scope_info = CAST(LoadConstantPoolEntryAtOperandIndex(1)); TNode<Context> context = GetContext(); SetAccumulator( CallRuntime(Runtime::kPushWithContext, context, object, scope_info)); @@ -2802,8 +2820,8 @@ IGNITION_HANDLER(CreateMappedArguments, InterpreterAssembler) { // duplicate parameters. TNode<SharedFunctionInfo> shared_info = LoadObjectField<SharedFunctionInfo>( closure, JSFunction::kSharedFunctionInfoOffset); - Node* flags = LoadObjectField(shared_info, SharedFunctionInfo::kFlagsOffset, - MachineType::Uint32()); + TNode<Uint32T> flags = + LoadObjectField<Uint32T>(shared_info, SharedFunctionInfo::kFlagsOffset); TNode<BoolT> has_duplicate_parameters = IsSetWord32<SharedFunctionInfo::HasDuplicateParametersBit>(flags); Branch(has_duplicate_parameters, &if_duplicate_parameters, @@ -2812,7 +2830,7 @@ IGNITION_HANDLER(CreateMappedArguments, InterpreterAssembler) { BIND(&if_not_duplicate_parameters); { ArgumentsBuiltinsAssembler constructor_assembler(state()); - Node* result = + TNode<JSObject> result = constructor_assembler.EmitFastNewSloppyArguments(context, closure); SetAccumulator(result); Dispatch(); @@ -2832,9 +2850,9 @@ IGNITION_HANDLER(CreateMappedArguments, InterpreterAssembler) { // Creates a new unmapped arguments object. IGNITION_HANDLER(CreateUnmappedArguments, InterpreterAssembler) { TNode<Context> context = GetContext(); - TNode<Object> closure = LoadRegister(Register::function_closure()); + TNode<JSFunction> closure = CAST(LoadRegister(Register::function_closure())); ArgumentsBuiltinsAssembler builtins_assembler(state()); - Node* result = + TNode<JSObject> result = builtins_assembler.EmitFastNewStrictArguments(context, closure); SetAccumulator(result); Dispatch(); @@ -2844,10 +2862,11 @@ IGNITION_HANDLER(CreateUnmappedArguments, InterpreterAssembler) { // // Creates a new rest parameter array. IGNITION_HANDLER(CreateRestParameter, InterpreterAssembler) { - TNode<Object> closure = LoadRegister(Register::function_closure()); + TNode<JSFunction> closure = CAST(LoadRegister(Register::function_closure())); TNode<Context> context = GetContext(); ArgumentsBuiltinsAssembler builtins_assembler(state()); - Node* result = builtins_assembler.EmitFastNewRestParameter(context, closure); + TNode<JSObject> result = + builtins_assembler.EmitFastNewRestParameter(context, closure); SetAccumulator(result); Dispatch(); } @@ -2868,7 +2887,7 @@ IGNITION_HANDLER(StackCheck, InterpreterAssembler) { IGNITION_HANDLER(SetPendingMessage, InterpreterAssembler) { TNode<ExternalReference> pending_message = ExternalConstant( ExternalReference::address_of_pending_message_obj(isolate())); - Node* previous_message = Load(MachineType::TaggedPointer(), pending_message); + TNode<HeapObject> previous_message = Load<HeapObject>(pending_message); TNode<Object> new_message = GetAccumulator(); StoreFullTaggedNoWriteBarrier(pending_message, new_message); SetAccumulator(previous_message); @@ -2903,8 +2922,8 @@ IGNITION_HANDLER(ReThrow, InterpreterAssembler) { // // Aborts execution (via a call to the runtime function). IGNITION_HANDLER(Abort, InterpreterAssembler) { - Node* reason = BytecodeOperandIdx(0); - CallRuntime(Runtime::kAbort, NoContextConstant(), SmiTag(reason)); + TNode<UintPtrT> reason = BytecodeOperandIdx(0); + CallRuntime(Runtime::kAbort, NoContextConstant(), SmiTag(Signed(reason))); Unreachable(); } @@ -2929,7 +2948,7 @@ IGNITION_HANDLER(ThrowReferenceErrorIfHole, InterpreterAssembler) { BIND(&throw_error); { - Node* name = LoadConstantPoolEntryAtOperandIndex(0); + TNode<Name> name = CAST(LoadConstantPoolEntryAtOperandIndex(0)); CallRuntime(Runtime::kThrowAccessedUninitializedVariable, GetContext(), name); // We shouldn't ever return from a throw. @@ -2995,7 +3014,7 @@ IGNITION_HANDLER(Debugger, InterpreterAssembler) { TNode<Object> accumulator = GetAccumulator(); \ TNode<Object> result_pair = \ CallRuntime(Runtime::kDebugBreakOnBytecode, context, accumulator); \ - Node* return_value = Projection(0, result_pair); \ + TNode<Object> return_value = CAST(Projection(0, result_pair)); \ TNode<IntPtrT> original_bytecode = SmiUntag(Projection(1, result_pair)); \ MaybeDropFrames(context); \ SetAccumulator(return_value); \ @@ -3010,7 +3029,7 @@ DEBUG_BREAK_BYTECODE_LIST(DEBUG_BREAK) // coverage. IGNITION_HANDLER(IncBlockCounter, InterpreterAssembler) { TNode<Object> closure = LoadRegister(Register::function_closure()); - Node* coverage_array_slot = BytecodeOperandIdxSmi(0); + TNode<Smi> coverage_array_slot = BytecodeOperandIdxSmi(0); TNode<Context> context = GetContext(); CallBuiltin(Builtins::kIncBlockCounter, context, closure, @@ -3025,11 +3044,11 @@ IGNITION_HANDLER(IncBlockCounter, InterpreterAssembler) { // map of the |receiver| if it has a usable enum cache or a fixed array // with the keys to enumerate in the accumulator. IGNITION_HANDLER(ForInEnumerate, InterpreterAssembler) { - TNode<Object> receiver = LoadRegisterAtOperandIndex(0); + TNode<HeapObject> receiver = CAST(LoadRegisterAtOperandIndex(0)); TNode<Context> context = GetContext(); Label if_empty(this), if_runtime(this, Label::kDeferred); - Node* receiver_map = CheckEnumCache(receiver, &if_empty, &if_runtime); + TNode<Map> receiver_map = CheckEnumCache(receiver, &if_empty, &if_runtime); SetAccumulator(receiver_map); Dispatch(); @@ -3060,7 +3079,7 @@ IGNITION_HANDLER(ForInEnumerate, InterpreterAssembler) { IGNITION_HANDLER(ForInPrepare, InterpreterAssembler) { // The {enumerator} is either a Map or a FixedArray. TNode<HeapObject> enumerator = CAST(GetAccumulator()); - Node* vector_index = BytecodeOperandIdx(1); + TNode<UintPtrT> vector_index = BytecodeOperandIdx(1); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); // Check if we're using an enum cache. @@ -3091,8 +3110,8 @@ IGNITION_HANDLER(ForInPrepare, InterpreterAssembler) { UpdateFeedback(feedback, maybe_feedback_vector, vector_index); // Construct the cache info triple. - Node* cache_type = enumerator; - Node* cache_array = enum_keys; + TNode<Map> cache_type = map_enumerator; + TNode<FixedArray> cache_array = enum_keys; TNode<Smi> cache_length = SmiTag(Signed(enum_length)); StoreRegisterTripleAtOperandIndex(cache_type, cache_array, cache_length, 0); Dispatch(); @@ -3108,8 +3127,8 @@ IGNITION_HANDLER(ForInPrepare, InterpreterAssembler) { vector_index); // Construct the cache info triple. - Node* cache_type = array_enumerator; - Node* cache_array = array_enumerator; + TNode<FixedArray> cache_type = array_enumerator; + TNode<FixedArray> cache_array = array_enumerator; TNode<Smi> cache_length = LoadFixedArrayBaseLength(array_enumerator); StoreRegisterTripleAtOperandIndex(cache_type, cache_array, cache_length, 0); Dispatch(); @@ -3125,7 +3144,7 @@ IGNITION_HANDLER(ForInNext, InterpreterAssembler) { TNode<Object> cache_type; TNode<Object> cache_array; std::tie(cache_type, cache_array) = LoadRegisterPairAtOperandIndex(2); - Node* vector_index = BytecodeOperandIdx(3); + TNode<UintPtrT> vector_index = BytecodeOperandIdx(3); TNode<HeapObject> maybe_feedback_vector = LoadFeedbackVector(); // Load the next key from the enumeration array. @@ -3195,21 +3214,22 @@ IGNITION_HANDLER(ForInStep, InterpreterAssembler) { // GetIterator <object> // -// Retrieves the object[Symbol.iterator] method and stores the result -// in the accumulator -// TODO(swapnilgaikwad): Extend the functionality of the bytecode to call -// iterator method for an object +// Retrieves the object[Symbol.iterator] method, calls it and stores +// the result in the accumulator. If the result is not a JSReceiver, throws +// SymbolIteratorInvalid runtime exception. IGNITION_HANDLER(GetIterator, InterpreterAssembler) { TNode<Object> receiver = LoadRegisterAtOperandIndex(0); TNode<Context> context = GetContext(); TNode<HeapObject> feedback_vector = LoadFeedbackVector(); - Node* feedback_slot = BytecodeOperandIdx(1); - TNode<Smi> smi_slot = SmiTag(feedback_slot); + TNode<IntPtrT> load_feedback_slot = Signed(BytecodeOperandIdx(1)); + TNode<IntPtrT> call_feedback_slot = Signed(BytecodeOperandIdx(2)); + TNode<Smi> load_slot_smi = SmiTag(load_feedback_slot); + TNode<Smi> call_slot_smi = SmiTag(call_feedback_slot); - TNode<Object> result = + TNode<Object> iterator = CallBuiltin(Builtins::kGetIteratorWithFeedback, context, receiver, - smi_slot, feedback_vector); - SetAccumulator(result); + load_slot_smi, call_slot_smi, feedback_vector); + SetAccumulator(iterator); Dispatch(); } @@ -3249,7 +3269,7 @@ IGNITION_HANDLER(SuspendGenerator, InterpreterAssembler) { TNode<JSFunction> closure = CAST(LoadRegister(Register::function_closure())); TNode<Context> context = GetContext(); RegListNodePair registers = GetRegisterListAtOperandIndex(1); - Node* suspend_id = BytecodeOperandUImmSmi(3); + TNode<Smi> suspend_id = BytecodeOperandUImmSmi(3); TNode<SharedFunctionInfo> shared = CAST(LoadObjectField(closure, JSFunction::kSharedFunctionInfoOffset)); @@ -3297,10 +3317,10 @@ IGNITION_HANDLER(SwitchOnGeneratorState, InterpreterAssembler) { CAST(LoadObjectField(generator, JSGeneratorObject::kContextOffset)); SetContext(context); - Node* table_start = BytecodeOperandIdx(1); + TNode<UintPtrT> table_start = BytecodeOperandIdx(1); // TODO(leszeks): table_length is only used for a CSA_ASSERT, we don't // actually need it otherwise. - Node* table_length = BytecodeOperandUImmWord(2); + TNode<UintPtrT> table_length = BytecodeOperandUImmWord(2); // The state must be a Smi. CSA_ASSERT(this, TaggedIsSmi(state)); @@ -3350,14 +3370,15 @@ IGNITION_HANDLER(ResumeGenerator, InterpreterAssembler) { } // namespace -Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode, +Handle<Code> GenerateBytecodeHandler(Isolate* isolate, const char* debug_name, + Bytecode bytecode, OperandScale operand_scale, int builtin_index, const AssemblerOptions& options) { Zone zone(isolate->allocator(), ZONE_NAME); compiler::CodeAssemblerState state( isolate, &zone, InterpreterDispatchDescriptor{}, Code::BYTECODE_HANDLER, - Bytecodes::ToString(bytecode), + debug_name, FLAG_untrusted_code_mitigations ? PoisoningMitigationLevel::kPoisonCriticalOnly : PoisoningMitigationLevel::kDontPoison, @@ -3377,7 +3398,7 @@ Handle<Code> GenerateBytecodeHandler(Isolate* isolate, Bytecode bytecode, #ifdef ENABLE_DISASSEMBLER if (FLAG_trace_ignition_codegen) { StdoutStream os; - code->Disassemble(Bytecodes::ToString(bytecode), os); + code->Disassemble(Bytecodes::ToString(bytecode), os, isolate); os << std::flush; } #endif // ENABLE_DISASSEMBLER |