From 1b3c4afcadf1a794e9f54800b1f0ce36ea5d7461 Mon Sep 17 00:00:00 2001 From: danno Date: Mon, 20 Feb 2017 01:51:19 -0800 Subject: [PATCH] Revert of [interpreter] Create custom call opcodes for specific argument counts (patchset #13 id:240001 of https://codereview.chromium.org/2684993002/ ) Reason for revert: Due to arm64 failures Original issue's description: > [interpreter] Create custom call opcodes for specific argument counts > > Specifically, add bytecodes for Call0, Call1, Call2, CallProperty0, CallProperty1, > and CallProperty2. Also share the bytecode handler code between between > equivalent CallX and CallPropertyX handlers. > > Review-Url: https://codereview.chromium.org/2684993002 > Cr-Commit-Position: refs/heads/master@{#43290} > Committed: https://chromium.googlesource.com/v8/v8/+/00d6f1f80a00c4ac398af588dbd6815395791015 TBR=rmcilroy@chromium.org # Not skipping CQ checks because original CL landed more than 1 days ago. Review-Url: https://codereview.chromium.org/2709533002 Cr-Commit-Position: refs/heads/master@{#43308} --- src/compiler/bytecode-graph-builder.cc | 144 +++--------------- src/compiler/bytecode-graph-builder.h | 21 +-- src/interpreter/bytecode-array-builder.cc | 21 +-- src/interpreter/bytecode-pipeline.h | 41 +---- src/interpreter/bytecodes.h | 21 +-- src/interpreter/interpreter-assembler.cc | 9 +- src/interpreter/interpreter-assembler.h | 3 - src/interpreter/interpreter.cc | 100 ++---------- src/interpreter/interpreter.h | 8 - .../bytecode_expectations/CallGlobal.golden | 4 +- .../CallLookupSlot.golden | 6 +- .../ClassAndSuperClass.golden | 4 +- .../ContextVariables.golden | 8 +- .../DeclareGlobals.golden | 4 +- .../bytecode_expectations/Eval.golden | 2 +- .../bytecode_expectations/ForOf.golden | 52 +++---- .../FunctionLiterals.golden | 6 +- .../bytecode_expectations/Generators.golden | 22 +-- .../bytecode_expectations/LookupSlot.golden | 10 +- .../bytecode_expectations/Modules.golden | 8 +- .../bytecode_expectations/PropertyCall.golden | 34 +++-- .../RegExpLiterals.golden | 2 +- .../bytecode-array-builder-unittest.cc | 8 +- 23 files changed, 131 insertions(+), 407 deletions(-) diff --git a/src/compiler/bytecode-graph-builder.cc b/src/compiler/bytecode-graph-builder.cc index 5494664d34..aaeee666aa 100644 --- a/src/compiler/bytecode-graph-builder.cc +++ b/src/compiler/bytecode-graph-builder.cc @@ -1293,8 +1293,10 @@ void BytecodeGraphBuilder::VisitCreateObjectLiteral() { literal, Environment::kAttachFrameState); } -Node* const* BytecodeGraphBuilder::GetCallArgumentsFromRegister( - Node* callee, interpreter::Register receiver, size_t arity) { +Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, + Node* callee, + interpreter::Register receiver, + size_t arity) { Node** all = local_zone()->NewArray(static_cast(arity)); all[0] = callee; all[1] = environment()->LookupRegister(receiver); @@ -1303,133 +1305,34 @@ Node* const* BytecodeGraphBuilder::GetCallArgumentsFromRegister( all[i] = environment()->LookupRegister( interpreter::Register(receiver_index + i - 1)); } - return all; -} - -Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, - Node* const* args, - size_t arg_count) { - return MakeNode(call_op, static_cast(arg_count), args, false); -} - -Node* BytecodeGraphBuilder::ProcessCallArguments(const Operator* call_op, - Node* callee, - interpreter::Register receiver, - size_t arg_count) { - return ProcessCallArguments( - call_op, GetCallArgumentsFromRegister(callee, receiver, arg_count), - arg_count); + Node* value = MakeNode(call_op, static_cast(arity), all, false); + return value; } void BytecodeGraphBuilder::BuildCall(TailCallMode tail_call_mode, - ConvertReceiverMode receiver_hint, - Node* const* args, size_t arg_count, - int slot_id) { + ConvertReceiverMode receiver_hint) { PrepareEagerCheckpoint(); - // Slot index of 0 is used indicate no feedback slot is available. Assert - // the assumption that slot index 0 is never a valid feedback slot. - STATIC_ASSERT(FeedbackVector::kReservedIndexCount > 0); - VectorSlotPair feedback = CreateVectorSlotPair(slot_id); - - float const frequency = ComputeCallFrequency(slot_id); - const Operator* call = javascript()->Call(arg_count, frequency, feedback, - receiver_hint, tail_call_mode); - Node* value = ProcessCallArguments(call, args, arg_count); - environment()->BindAccumulator(value, Environment::kAttachFrameState); -} - -void BytecodeGraphBuilder::BuildCallVarArgs(TailCallMode tail_call_mode, - ConvertReceiverMode receiver_hint) { Node* callee = environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); interpreter::Register receiver = bytecode_iterator().GetRegisterOperand(1); size_t arg_count = bytecode_iterator().GetRegisterCountOperand(2); + + // Slot index of 0 is used indicate no feedback slot is available. Assert + // the assumption that slot index 0 is never a valid feedback slot. + STATIC_ASSERT(FeedbackVector::kReservedIndexCount > 0); int const slot_id = bytecode_iterator().GetIndexOperand(3); - BuildCall(tail_call_mode, receiver_hint, - GetCallArgumentsFromRegister(callee, receiver, arg_count + 1), - arg_count + 1, slot_id); + VectorSlotPair feedback = CreateVectorSlotPair(slot_id); + + float const frequency = ComputeCallFrequency(slot_id); + const Operator* call = javascript()->Call(arg_count + 1, frequency, feedback, + receiver_hint, tail_call_mode); + Node* value = ProcessCallArguments(call, callee, receiver, arg_count + 1); + environment()->BindAccumulator(value, Environment::kAttachFrameState); } void BytecodeGraphBuilder::VisitCall() { - BuildCallVarArgs(TailCallMode::kDisallow, ConvertReceiverMode::kAny); -} - -void BytecodeGraphBuilder::VisitCall0() { - Node* callee = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); - Node* receiver = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); - int const slot_id = bytecode_iterator().GetIndexOperand(2); - BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kAny, - {callee, receiver}, slot_id); -} - -void BytecodeGraphBuilder::VisitCall1() { - Node* callee = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); - Node* receiver = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); - Node* arg0 = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(2)); - int const slot_id = bytecode_iterator().GetIndexOperand(3); - BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kAny, - {callee, receiver, arg0}, slot_id); -} - -void BytecodeGraphBuilder::VisitCall2() { - Node* callee = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); - Node* receiver = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); - Node* arg0 = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(2)); - Node* arg1 = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(3)); - int const slot_id = bytecode_iterator().GetIndexOperand(4); - BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kAny, - {callee, receiver, arg0, arg1}, slot_id); -} - -void BytecodeGraphBuilder::VisitCallProperty() { - BuildCallVarArgs(TailCallMode::kDisallow, - ConvertReceiverMode::kNotNullOrUndefined); -} - -void BytecodeGraphBuilder::VisitCallProperty0() { - Node* callee = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); - Node* receiver = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); - int const slot_id = bytecode_iterator().GetIndexOperand(2); - BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kNotNullOrUndefined, - {callee, receiver}, slot_id); -} - -void BytecodeGraphBuilder::VisitCallProperty1() { - Node* callee = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); - Node* receiver = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); - Node* arg0 = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(2)); - int const slot_id = bytecode_iterator().GetIndexOperand(3); - BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kNotNullOrUndefined, - {callee, receiver, arg0}, slot_id); -} - -void BytecodeGraphBuilder::VisitCallProperty2() { - Node* callee = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(0)); - Node* receiver = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(1)); - Node* arg0 = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(2)); - Node* arg1 = - environment()->LookupRegister(bytecode_iterator().GetRegisterOperand(3)); - int const slot_id = bytecode_iterator().GetIndexOperand(4); - BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kNotNullOrUndefined, - {callee, receiver, arg0, arg1}, slot_id); + BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kAny); } void BytecodeGraphBuilder::VisitCallWithSpread() { @@ -1445,12 +1348,16 @@ void BytecodeGraphBuilder::VisitCallWithSpread() { environment()->BindAccumulator(value, Environment::kAttachFrameState); } +void BytecodeGraphBuilder::VisitCallProperty() { + BuildCall(TailCallMode::kDisallow, ConvertReceiverMode::kNotNullOrUndefined); +} + void BytecodeGraphBuilder::VisitTailCall() { TailCallMode tail_call_mode = bytecode_array_->GetIsolate()->is_tail_call_elimination_enabled() ? TailCallMode::kAllow : TailCallMode::kDisallow; - BuildCallVarArgs(tail_call_mode, ConvertReceiverMode::kAny); + BuildCall(tail_call_mode, ConvertReceiverMode::kAny); } void BytecodeGraphBuilder::VisitCallJSRuntime() { @@ -2340,8 +2247,7 @@ void BytecodeGraphBuilder::EnterAndExitExceptionHandlers(int current_offset) { } Node* BytecodeGraphBuilder::MakeNode(const Operator* op, int value_input_count, - Node* const* value_inputs, - bool incomplete) { + Node** value_inputs, bool incomplete) { DCHECK_EQ(op->ValueInputCount(), value_input_count); bool has_context = OperatorProperties::HasContextInput(op); diff --git a/src/compiler/bytecode-graph-builder.h b/src/compiler/bytecode-graph-builder.h index 55a345643b..41fcf6851f 100644 --- a/src/compiler/bytecode-graph-builder.h +++ b/src/compiler/bytecode-graph-builder.h @@ -104,16 +104,11 @@ class BytecodeGraphBuilder { // The main node creation chokepoint. Adds context, frame state, effect, // and control dependencies depending on the operator. - Node* MakeNode(const Operator* op, int value_input_count, - Node* const* value_inputs, bool incomplete); + Node* MakeNode(const Operator* op, int value_input_count, Node** value_inputs, + bool incomplete); Node** EnsureInputBufferSize(int size); - Node* const* GetCallArgumentsFromRegister(Node* callee, - interpreter::Register first_arg, - size_t arity); - Node* ProcessCallArguments(const Operator* call_op, Node* const* args, - size_t arg_count); Node* ProcessCallArguments(const Operator* call_op, Node* callee, interpreter::Register receiver, size_t arity); Node* ProcessConstructArguments(const Operator* call_new_op, Node* callee, @@ -155,16 +150,8 @@ class BytecodeGraphBuilder { void BuildLdaLookupContextSlot(TypeofMode typeof_mode); void BuildLdaLookupGlobalSlot(TypeofMode typeof_mode); void BuildStaLookupSlot(LanguageMode language_mode); - void BuildCallVarArgs(TailCallMode tail_call_mode, - ConvertReceiverMode receiver_hint); - void BuildCall(TailCallMode tail_call_mode, ConvertReceiverMode receiver_hint, - Node* const* args, size_t arg_count, int slot_id); - void BuildCall(TailCallMode tail_call_mode, ConvertReceiverMode receiver_hint, - std::initializer_list args, int slot_id) { - BuildCall(tail_call_mode, receiver_hint, args.begin(), args.size(), - slot_id); - } - void BuildThrow(); + void BuildCall(TailCallMode tail_call_mode, + ConvertReceiverMode receiver_hint); void BuildBinaryOp(const Operator* op); void BuildBinaryOpWithImmediate(const Operator* op); void BuildCompareOp(const Operator* op); diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc index 6d8bed57a6..e42d3925df 100644 --- a/src/interpreter/bytecode-array-builder.cc +++ b/src/interpreter/bytecode-array-builder.cc @@ -1005,26 +1005,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::Call(Register callable, if (tail_call_mode == TailCallMode::kDisallow) { if (call_type == Call::NAMED_PROPERTY_CALL || call_type == Call::KEYED_PROPERTY_CALL) { - if (args.register_count() == 1) { - OutputCallProperty0(callable, args[0], feedback_slot); - } else if (args.register_count() == 2) { - OutputCallProperty1(callable, args[0], args[1], feedback_slot); - } else if (args.register_count() == 3) { - OutputCallProperty2(callable, args[0], args[1], args[2], feedback_slot); - } else { - OutputCallProperty(callable, args, args.register_count(), - feedback_slot); - } + OutputCallProperty(callable, args, args.register_count(), feedback_slot); } else { - if (args.register_count() == 1) { - OutputCall0(callable, args[0], feedback_slot); - } else if (args.register_count() == 2) { - OutputCall1(callable, args[0], args[1], feedback_slot); - } else if (args.register_count() == 3) { - OutputCall2(callable, args[0], args[1], args[2], feedback_slot); - } else { - OutputCall(callable, args, args.register_count(), feedback_slot); - } + OutputCall(callable, args, args.register_count(), feedback_slot); } } else { DCHECK(tail_call_mode == TailCallMode::kAllow); diff --git a/src/interpreter/bytecode-pipeline.h b/src/interpreter/bytecode-pipeline.h index 23cad237dd..03d40f7344 100644 --- a/src/interpreter/bytecode-pipeline.h +++ b/src/interpreter/bytecode-pipeline.h @@ -191,21 +191,6 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) { SetOperand(3, operand3); } - INLINE(BytecodeNode(Bytecode bytecode, uint32_t operand0, uint32_t operand1, - uint32_t operand2, uint32_t operand3, uint32_t operand4, - BytecodeSourceInfo source_info = BytecodeSourceInfo())) - : bytecode_(bytecode), - operand_count_(5), - operand_scale_(OperandScale::kSingle), - source_info_(source_info) { - DCHECK_EQ(Bytecodes::NumberOfOperands(bytecode), operand_count()); - SetOperand(0, operand0); - SetOperand(1, operand1); - SetOperand(2, operand2); - SetOperand(3, operand3); - SetOperand(4, operand4); - } - #define DEFINE_BYTECODE_NODE_CREATOR(Name, ...) \ template \ INLINE(static BytecodeNode Name(BytecodeSourceInfo source_info, \ @@ -276,7 +261,7 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) { OperandScale operand_scale, BytecodeSourceInfo source_info, uint32_t operand0 = 0, uint32_t operand1 = 0, uint32_t operand2 = 0, - uint32_t operand3 = 0, uint32_t operand4 = 0)) + uint32_t operand3 = 0)) : bytecode_(bytecode), operand_count_(operand_count), operand_scale_(operand_scale), @@ -286,7 +271,6 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) { operands_[1] = operand1; operands_[2] = operand2; operands_[3] = operand3; - operands_[4] = operand4; } template @@ -352,29 +336,6 @@ class V8_EXPORT_PRIVATE BytecodeNode final : NON_EXPORTED_BASE(ZoneObject) { operand2, operand3); } - template - INLINE(static BytecodeNode Create(BytecodeSourceInfo source_info, - uint32_t operand0, uint32_t operand1, - uint32_t operand2, uint32_t operand3, - uint32_t operand4)) { - DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 0), operand0_type); - DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 1), operand1_type); - DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 2), operand2_type); - DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 3), operand3_type); - DCHECK_EQ(Bytecodes::GetOperandType(bytecode, 4), operand4_type); - OperandScale scale = OperandScale::kSingle; - scale = std::max(scale, ScaleForOperand(operand0)); - scale = std::max(scale, ScaleForOperand(operand1)); - scale = std::max(scale, ScaleForOperand(operand2)); - scale = std::max(scale, ScaleForOperand(operand3)); - scale = std::max(scale, ScaleForOperand(operand4)); - return BytecodeNode(bytecode, 5, scale, source_info, operand0, operand1, - operand2, operand3, operand4); - } - template INLINE(static OperandScale ScaleForOperand(uint32_t operand)) { if (BytecodeOperands::IsScalableUnsignedByte(operand_type)) { diff --git a/src/interpreter/bytecodes.h b/src/interpreter/bytecodes.h index 834205a4ed..f6085269ff 100644 --- a/src/interpreter/bytecodes.h +++ b/src/interpreter/bytecodes.h @@ -154,21 +154,8 @@ namespace interpreter { /* Call operations */ \ V(Call, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kRegList, \ OperandType::kRegCount, OperandType::kIdx) \ - V(Call0, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ - OperandType::kIdx) \ - V(Call1, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ - OperandType::kReg, OperandType::kIdx) \ - V(Call2, AccumulatorUse::kWrite, OperandType::kReg, OperandType::kReg, \ - OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ V(CallProperty, AccumulatorUse::kWrite, OperandType::kReg, \ OperandType::kRegList, OperandType::kRegCount, OperandType::kIdx) \ - V(CallProperty0, AccumulatorUse::kWrite, OperandType::kReg, \ - OperandType::kReg, OperandType::kIdx) \ - V(CallProperty1, AccumulatorUse::kWrite, OperandType::kReg, \ - OperandType::kReg, OperandType::kReg, OperandType::kIdx) \ - V(CallProperty2, AccumulatorUse::kWrite, OperandType::kReg, \ - OperandType::kReg, OperandType::kReg, OperandType::kReg, \ - OperandType::kIdx) \ V(CallWithSpread, AccumulatorUse::kWrite, OperandType::kReg, \ OperandType::kRegList, OperandType::kRegCount) \ V(TailCall, AccumulatorUse::kWrite, OperandType::kReg, \ @@ -420,7 +407,7 @@ enum class Bytecode : uint8_t { class V8_EXPORT_PRIVATE Bytecodes final { public: // The maximum number of operands a bytecode may have. - static const int kMaxOperands = 5; + static const int kMaxOperands = 4; // Returns string representation of |bytecode|. static const char* ToString(Bytecode bytecode); @@ -634,12 +621,6 @@ class V8_EXPORT_PRIVATE Bytecodes final { // Returns true if the bytecode is a call or a constructor call. static constexpr bool IsCallOrConstruct(Bytecode bytecode) { return bytecode == Bytecode::kCall || bytecode == Bytecode::kCallProperty || - bytecode == Bytecode::kCall0 || - bytecode == Bytecode::kCallProperty0 || - bytecode == Bytecode::kCall1 || - bytecode == Bytecode::kCallProperty1 || - bytecode == Bytecode::kCall2 || - bytecode == Bytecode::kCallProperty2 || bytecode == Bytecode::kTailCall || bytecode == Bytecode::kConstruct || bytecode == Bytecode::kCallWithSpread || diff --git a/src/interpreter/interpreter-assembler.cc b/src/interpreter/interpreter-assembler.cc index 88070fc3b7..e0da660850 100644 --- a/src/interpreter/interpreter-assembler.cc +++ b/src/interpreter/interpreter-assembler.cc @@ -451,16 +451,13 @@ Node* InterpreterAssembler::BytecodeOperandImmSmi(int operand_index) { return SmiFromWord32(BytecodeOperandImm(operand_index)); } -Node* InterpreterAssembler::BytecodeOperandIdxInt32(int operand_index) { +Node* InterpreterAssembler::BytecodeOperandIdx(int operand_index) { DCHECK(OperandType::kIdx == Bytecodes::GetOperandType(bytecode_, operand_index)); OperandSize operand_size = Bytecodes::GetOperandSize(bytecode_, operand_index, operand_scale()); - return BytecodeUnsignedOperand(operand_index, operand_size); -} - -Node* InterpreterAssembler::BytecodeOperandIdx(int operand_index) { - return ChangeUint32ToWord(BytecodeOperandIdxInt32(operand_index)); + return ChangeUint32ToWord( + BytecodeUnsignedOperand(operand_index, operand_size)); } Node* InterpreterAssembler::BytecodeOperandIdxSmi(int operand_index) { diff --git a/src/interpreter/interpreter-assembler.h b/src/interpreter/interpreter-assembler.h index 363672104f..1317f377f4 100644 --- a/src/interpreter/interpreter-assembler.h +++ b/src/interpreter/interpreter-assembler.h @@ -32,9 +32,6 @@ class V8_EXPORT_PRIVATE InterpreterAssembler : public CodeStubAssembler { compiler::Node* BytecodeOperandFlag(int operand_index); // Returns the 32-bit zero-extended index immediate for bytecode operand // |operand_index| in the current bytecode. - compiler::Node* BytecodeOperandIdxInt32(int operand_index); - // Returns the word zero-extended index immediate for bytecode operand - // |operand_index| in the current bytecode. compiler::Node* BytecodeOperandIdx(int operand_index); // Returns the smi index immediate for bytecode operand |operand_index| // in the current bytecode. diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc index 263d9405a1..fb78dbd240 100644 --- a/src/interpreter/interpreter.cc +++ b/src/interpreter/interpreter.cc @@ -4,7 +4,6 @@ #include "src/interpreter/interpreter.h" -#include #include #include @@ -130,42 +129,11 @@ void Interpreter::Initialize() { DCHECK(IsDispatchTableInitialized()); } -bool Interpreter::ReuseExistingHandler(Bytecode bytecode, - OperandScale operand_scale) { - size_t index = GetDispatchTableIndex(bytecode, operand_scale); - switch (bytecode) { - case Bytecode::kCallProperty: - case Bytecode::kCallProperty0: - case Bytecode::kCallProperty1: - case Bytecode::kCallProperty2: { - const int offset = static_cast(Bytecode::kCallProperty) - - static_cast(Bytecode::kCall); - STATIC_ASSERT(offset == - static_cast(Bytecode::kCallProperty0) - - static_cast(Bytecode::kCall0)); - STATIC_ASSERT(offset == - static_cast(Bytecode::kCallProperty1) - - static_cast(Bytecode::kCall1)); - STATIC_ASSERT(offset == - static_cast(Bytecode::kCallProperty2) - - static_cast(Bytecode::kCall2)); - CHECK_LT(offset, index); - dispatch_table_[index] = dispatch_table_[index - offset]; - return true; - break; - } - default: - return false; - } -} - void Interpreter::InstallBytecodeHandler(Zone* zone, Bytecode bytecode, OperandScale operand_scale, BytecodeGeneratorFunc generator) { if (!Bytecodes::BytecodeHasHandler(bytecode, operand_scale)) return; - if (ReuseExistingHandler(bytecode, operand_scale)) return; - size_t index = GetDispatchTableIndex(bytecode, operand_scale); InterpreterDispatchDescriptor descriptor(isolate_); compiler::CodeAssemblerState state( isolate_, zone, descriptor, Code::ComputeFlags(Code::BYTECODE_HANDLER), @@ -176,6 +144,7 @@ void Interpreter::InstallBytecodeHandler(Zone* zone, Bytecode bytecode, } (this->*generator)(&assembler); Handle code = compiler::CodeAssembler::GenerateCode(&state); + size_t index = GetDispatchTableIndex(bytecode, operand_scale); dispatch_table_[index] = code->entry(); TraceCodegen(code); PROFILE(isolate_, CodeCreateEvent( @@ -2192,35 +2161,6 @@ void Interpreter::DoJSCall(InterpreterAssembler* assembler, __ Dispatch(); } -void Interpreter::DoJSCallN(InterpreterAssembler* assembler, int arg_count) { - const int kReceiverOperandIndex = 1; - const int kReceiverOperandCount = 1; - const int kSlotOperandIndex = - kReceiverOperandIndex + kReceiverOperandCount + arg_count; - const int kBoilerplatParameterCount = 7; - const int kReceiverParameterIndex = 5; - - Node* function_reg = __ BytecodeOperandReg(0); - Node* function = __ LoadRegister(function_reg); - std::array temp; - Callable call_ic = CodeFactory::CallIC(isolate_); - temp[0] = __ HeapConstant(call_ic.code()); - temp[1] = function; - temp[2] = __ Int32Constant(arg_count); - temp[3] = __ BytecodeOperandIdxInt32(kSlotOperandIndex); - temp[4] = __ LoadFeedbackVector(); - for (int i = 0; i < (arg_count + kReceiverOperandCount); ++i) { - Node* reg = __ BytecodeOperandReg(i + kReceiverOperandIndex); - temp[kReceiverParameterIndex + i] = __ LoadRegister(reg); - } - temp[kReceiverParameterIndex + arg_count + kReceiverOperandCount] = - __ GetContext(); - Node* result = __ CallStubN(call_ic.descriptor(), 1, - arg_count + kBoilerplatParameterCount, &temp[0]); - __ SetAccumulator(result); - __ Dispatch(); -} - // Call // // Call a JSfunction or Callable in |callable| with the |receiver| and @@ -2230,36 +2170,15 @@ void Interpreter::DoCall(InterpreterAssembler* assembler) { DoJSCall(assembler, TailCallMode::kDisallow); } -void Interpreter::DoCall0(InterpreterAssembler* assembler) { - DoJSCallN(assembler, 0); -} - -void Interpreter::DoCall1(InterpreterAssembler* assembler) { - DoJSCallN(assembler, 1); -} - -void Interpreter::DoCall2(InterpreterAssembler* assembler) { - DoJSCallN(assembler, 2); -} - +// CallProperty +// +// Call a JSfunction or Callable in |callable| with the |receiver| and +// |arg_count| arguments in subsequent registers. Collect type feedback into +// |feedback_slot_id|. The callable is known to be a property of the receiver. void Interpreter::DoCallProperty(InterpreterAssembler* assembler) { - // Same as Call - UNREACHABLE(); -} - -void Interpreter::DoCallProperty0(InterpreterAssembler* assembler) { - // Same as Call0 - UNREACHABLE(); -} - -void Interpreter::DoCallProperty1(InterpreterAssembler* assembler) { - // Same as Call1 - UNREACHABLE(); -} - -void Interpreter::DoCallProperty2(InterpreterAssembler* assembler) { - // Same as Call2 - UNREACHABLE(); + // TODO(leszeks): Look into making the interpreter use the fact that the + // receiver is non-null. + DoJSCall(assembler, TailCallMode::kDisallow); } // TailCall @@ -2319,6 +2238,7 @@ void Interpreter::DoCallRuntimeForPair(InterpreterAssembler* assembler) { Node* context = __ GetContext(); Node* result_pair = __ CallRuntimeN(function_id, context, first_arg, args_count, 2); + // Store the results in and Node* first_return_reg = __ BytecodeOperandReg(3); Node* second_return_reg = __ NextRegister(first_return_reg); diff --git a/src/interpreter/interpreter.h b/src/interpreter/interpreter.h index 8e87f84dc6..ac36815f14 100644 --- a/src/interpreter/interpreter.h +++ b/src/interpreter/interpreter.h @@ -78,10 +78,6 @@ class Interpreter { typedef void (Interpreter::*BytecodeGeneratorFunc)(InterpreterAssembler*); - // In the case of bytecodes that share handler implementations, copy the code - // into the bytecode's dispatcher table entry and return true. - bool ReuseExistingHandler(Bytecode bytecode, OperandScale operand_scale); - // Generates handler for given |bytecode| and |operand_scale| using // |generator| and installs it into the dispatch table. void InstallBytecodeHandler(Zone* zone, Bytecode bytecode, @@ -128,10 +124,6 @@ class Interpreter { // Generates code to perform a JS call that collects type feedback. void DoJSCall(InterpreterAssembler* assembler, TailCallMode tail_call_mode); - // Generates code to perform a JS call with a known number of arguments that - // collects type feedback. - void DoJSCallN(InterpreterAssembler* assembler, int n); - // Generates code to perform delete via function_id. void DoDelete(Runtime::FunctionId function_id, InterpreterAssembler* assembler); diff --git a/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden b/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden index 6555c650c3..88bf4420f2 100644 --- a/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden +++ b/test/cctest/interpreter/bytecode_expectations/CallGlobal.golden @@ -14,14 +14,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 14 +bytecode array length: 15 bytecodes: [ /* 27 E> */ B(StackCheck), /* 32 S> */ B(LdaUndefined), B(Star), R(1), B(LdaGlobal), U8(0), U8(4), B(Star), R(0), - /* 39 E> */ B(Call0), R(0), R(1), U8(2), + /* 39 E> */ B(Call), R(0), R(1), U8(1), U8(2), /* 44 S> */ B(Return), ] constant pool: [ diff --git a/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden b/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden index 7625179120..fc7a6f7843 100644 --- a/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden +++ b/test/cctest/interpreter/bytecode_expectations/CallLookupSlot.golden @@ -11,7 +11,7 @@ snippet: " " frame size: 10 parameter count: 1 -bytecode array length: 81 +bytecode array length: 82 bytecodes: [ B(CreateFunctionContext), U8(3), B(PushContext), R(0), @@ -41,12 +41,12 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 52 E> */ B(Call1), R(1), R(2), R(3), U8(3), + /* 52 E> */ B(Call), R(1), R(2), U8(2), U8(3), /* 62 S> */ B(LdaUndefined), B(Star), R(2), /* 69 E> */ B(LdaLookupGlobalSlot), U8(1), U8(9), U8(1), B(Star), R(1), - /* 69 E> */ B(Call0), R(1), R(2), U8(7), + /* 69 E> */ B(Call), R(1), R(2), U8(1), U8(7), /* 74 S> */ B(Return), ] constant pool: [ diff --git a/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden b/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden index 305a6c62c6..9316f65b3f 100644 --- a/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden +++ b/test/cctest/interpreter/bytecode_expectations/ClassAndSuperClass.golden @@ -22,7 +22,7 @@ snippet: " " frame size: 6 parameter count: 1 -bytecode array length: 36 +bytecode array length: 37 bytecodes: [ B(Mov), R(closure), R(0), /* 99 E> */ B(StackCheck), @@ -34,7 +34,7 @@ bytecodes: [ B(Mov), R(this), R(3), B(CallRuntime), U16(Runtime::kLoadFromSuper), R(3), U8(3), B(Star), R(1), - /* 117 E> */ B(Call0), R(1), R(this), U8(2), + /* 117 E> */ B(Call), R(1), R(this), U8(1), U8(2), B(Star), R(1), /* 126 E> */ B(AddSmi), I8(1), R(1), U8(8), /* 131 S> */ B(Return), diff --git a/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden b/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden index 671c4c7fc3..dc8d7f67f2 100644 --- a/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden +++ b/test/cctest/interpreter/bytecode_expectations/ContextVariables.golden @@ -77,7 +77,7 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 21 +bytecode array length: 22 bytecodes: [ B(CreateFunctionContext), U8(1), B(PushContext), R(0), @@ -86,7 +86,7 @@ bytecodes: [ B(Star), R(2), B(CreateClosure), U8(0), U8(4), U8(2), B(Star), R(1), - /* 64 E> */ B(Call0), R(1), R(2), U8(2), + /* 64 E> */ B(Call), R(1), R(2), U8(1), U8(2), /* 68 S> */ B(LdaCurrentContextSlot), U8(4), /* 78 S> */ B(Return), ] @@ -390,7 +390,7 @@ snippet: " " frame size: 3 parameter count: 1 -bytecode array length: 791 +bytecode array length: 792 bytecodes: [ B(CreateFunctionContext), U8(254), B(PushContext), R(0), @@ -905,7 +905,7 @@ bytecodes: [ B(Star), R(2), B(LdaGlobal), U8(0), U8(4), B(Star), R(1), - /* 3438 E> */ B(Call0), R(1), R(2), U8(2), + /* 3438 E> */ B(Call), R(1), R(2), U8(1), U8(2), /* 3454 S> */ B(LdaSmi), I8(100), /* 3454 E> */ B(Wide), B(StaCurrentContextSlot), U16(256), /* 3459 S> */ B(Wide), B(LdaCurrentContextSlot), U16(256), diff --git a/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden b/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden index 1b3ce9a1fd..62dc163a70 100644 --- a/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden +++ b/test/cctest/interpreter/bytecode_expectations/DeclareGlobals.golden @@ -104,7 +104,7 @@ snippet: " " frame size: 4 parameter count: 1 -bytecode array length: 31 +bytecode array length: 32 bytecodes: [ B(LdaConstant), U8(0), B(Star), R(1), @@ -117,7 +117,7 @@ bytecodes: [ B(Star), R(2), B(LdaGlobal), U8(1), U8(2), B(Star), R(1), - /* 16 E> */ B(Call0), R(1), R(2), U8(5), + /* 16 E> */ B(Call), R(1), R(2), U8(1), U8(5), B(Star), R(0), /* 20 S> */ B(Return), ] diff --git a/test/cctest/interpreter/bytecode_expectations/Eval.golden b/test/cctest/interpreter/bytecode_expectations/Eval.golden index 05e9517392..3a865c65db 100644 --- a/test/cctest/interpreter/bytecode_expectations/Eval.golden +++ b/test/cctest/interpreter/bytecode_expectations/Eval.golden @@ -39,7 +39,7 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 41 E> */ B(Call1), R(1), R(2), R(3), U8(2), + /* 41 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 53 S> */ B(Return), ] constant pool: [ diff --git a/test/cctest/interpreter/bytecode_expectations/ForOf.golden b/test/cctest/interpreter/bytecode_expectations/ForOf.golden index a61dc5bf5e..a5f7f6e683 100644 --- a/test/cctest/interpreter/bytecode_expectations/ForOf.golden +++ b/test/cctest/interpreter/bytecode_expectations/ForOf.golden @@ -11,7 +11,7 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 270 +bytecode array length: 272 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), @@ -22,13 +22,13 @@ bytecodes: [ B(Star), R(13), B(LdaNamedProperty), R(13), U8(1), U8(3), B(Star), R(14), - B(CallProperty0), R(14), R(13), U8(5), + B(CallProperty), R(14), R(13), U8(1), U8(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(2), /* 45 S> */ B(LdaNamedProperty), R(2), U8(2), U8(9), B(Star), R(13), - /* 45 E> */ B(CallProperty0), R(13), R(2), U8(7), + /* 45 E> */ B(CallProperty), R(13), R(2), U8(1), U8(7), B(Star), R(3), /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), B(ToBooleanLogicalNot), @@ -45,7 +45,7 @@ bytecodes: [ B(Mov), R(0), R(1), B(LdaZero), B(Star), R(4), - B(JumpLoop), U8(50), I8(0), + B(JumpLoop), U8(51), I8(0), B(Jump), U8(36), B(Star), R(13), B(Ldar), R(closure), @@ -142,9 +142,9 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [7, 124, 130], - [10, 88, 90], - [197, 207, 209], + [7, 126, 132], + [10, 90, 92], + [199, 209, 211], ] --- @@ -154,7 +154,7 @@ snippet: " " frame size: 16 parameter count: 1 -bytecode array length: 284 +bytecode array length: 286 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(LdaConstant), U8(0), @@ -165,14 +165,14 @@ bytecodes: [ B(Mov), R(context), R(13), /* 68 S> */ B(LdaNamedProperty), R(0), U8(1), U8(2), B(Star), R(15), - B(CallProperty0), R(15), R(0), U8(4), + B(CallProperty), R(15), R(0), U8(1), U8(4), B(Mov), R(0), R(14), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(3), /* 65 S> */ B(LdaNamedProperty), R(3), U8(2), U8(8), B(Star), R(14), - /* 65 E> */ B(CallProperty0), R(14), R(3), U8(6), + /* 65 E> */ B(CallProperty), R(14), R(3), U8(1), U8(6), B(Star), R(4), /* 65 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(4), U8(1), B(ToBooleanLogicalNot), @@ -292,9 +292,9 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [11, 127, 133], - [14, 91, 93], - [201, 211, 213], + [11, 129, 135], + [14, 93, 95], + [203, 213, 215], ] --- @@ -306,7 +306,7 @@ snippet: " " frame size: 15 parameter count: 1 -bytecode array length: 288 +bytecode array length: 290 bytecodes: [ /* 30 E> */ B(StackCheck), B(LdaZero), @@ -317,13 +317,13 @@ bytecodes: [ B(Star), R(13), B(LdaNamedProperty), R(13), U8(1), U8(3), B(Star), R(14), - B(CallProperty0), R(14), R(13), U8(5), + B(CallProperty), R(14), R(13), U8(1), U8(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(2), /* 45 S> */ B(LdaNamedProperty), R(2), U8(2), U8(9), B(Star), R(13), - /* 45 E> */ B(CallProperty0), R(13), R(2), U8(7), + /* 45 E> */ B(CallProperty), R(13), R(2), U8(1), U8(7), B(Star), R(3), /* 45 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(3), U8(1), B(ToBooleanLogicalNot), @@ -348,7 +348,7 @@ bytecodes: [ /* 104 S> */ B(Jump), U8(8), B(LdaZero), B(Star), R(4), - B(JumpLoop), U8(68), I8(0), + B(JumpLoop), U8(69), I8(0), B(Jump), U8(36), B(Star), R(13), B(Ldar), R(closure), @@ -445,9 +445,9 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [7, 142, 148], - [10, 106, 108], - [215, 225, 227], + [7, 144, 150], + [10, 108, 110], + [217, 227, 229], ] --- @@ -457,7 +457,7 @@ snippet: " " frame size: 14 parameter count: 1 -bytecode array length: 295 +bytecode array length: 297 bytecodes: [ /* 30 E> */ B(StackCheck), /* 42 S> */ B(CreateObjectLiteral), U8(0), U8(2), U8(1), R(8), @@ -470,13 +470,13 @@ bytecodes: [ B(Star), R(12), B(LdaNamedProperty), R(12), U8(2), U8(4), B(Star), R(13), - B(CallProperty0), R(13), R(12), U8(6), + B(CallProperty), R(13), R(12), U8(1), U8(6), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), B(Star), R(1), /* 74 S> */ B(LdaNamedProperty), R(1), U8(3), U8(10), B(Star), R(12), - /* 74 E> */ B(CallProperty0), R(12), R(1), U8(8), + /* 74 E> */ B(CallProperty), R(12), R(1), U8(1), U8(8), B(Star), R(2), /* 74 E> */ B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(2), U8(1), B(ToBooleanLogicalNot), @@ -600,8 +600,8 @@ constant pool: [ FIXED_ARRAY_TYPE, ] handlers: [ - [15, 138, 144], - [18, 102, 104], - [212, 222, 224], + [15, 140, 146], + [18, 104, 106], + [214, 224, 226], ] diff --git a/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden b/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden index a9590edeeb..7d55ebf94c 100644 --- a/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden +++ b/test/cctest/interpreter/bytecode_expectations/FunctionLiterals.golden @@ -29,14 +29,14 @@ snippet: " " frame size: 2 parameter count: 1 -bytecode array length: 15 +bytecode array length: 16 bytecodes: [ /* 30 E> */ B(StackCheck), /* 34 S> */ B(LdaUndefined), B(Star), R(1), B(CreateClosure), U8(0), U8(4), U8(2), B(Star), R(0), - /* 56 E> */ B(Call0), R(0), R(1), U8(2), + /* 56 E> */ B(Call), R(0), R(1), U8(1), U8(2), /* 59 S> */ B(Return), ] constant pool: [ @@ -60,7 +60,7 @@ bytecodes: [ B(Star), R(0), B(LdaSmi), I8(1), B(Star), R(2), - /* 67 E> */ B(Call1), R(0), R(1), R(2), U8(2), + /* 67 E> */ B(Call), R(0), R(1), U8(2), U8(2), /* 71 S> */ B(Return), ] constant pool: [ diff --git a/test/cctest/interpreter/bytecode_expectations/Generators.golden b/test/cctest/interpreter/bytecode_expectations/Generators.golden index 1af5eaf500..1a542b8aec 100644 --- a/test/cctest/interpreter/bytecode_expectations/Generators.golden +++ b/test/cctest/interpreter/bytecode_expectations/Generators.golden @@ -280,7 +280,7 @@ snippet: " " frame size: 18 parameter count: 1 -bytecode array length: 773 +bytecode array length: 775 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(35), @@ -293,7 +293,7 @@ bytecodes: [ B(JumpIfTrue), U8(60), B(LdaSmi), I8(1), B(TestEqualStrict), R(3), U8(0), - B(JumpIfTrue), U8(153), + B(JumpIfTrue), U8(154), B(LdaSmi), I8(78), B(Star), R(5), B(CallRuntime), U16(Runtime::kAbort), R(5), U8(1), @@ -353,7 +353,7 @@ bytecodes: [ B(Star), R(12), B(LdaNamedProperty), R(12), U8(2), U8(3), B(Star), R(13), - B(CallProperty0), R(13), R(12), U8(5), + B(CallProperty), R(13), R(12), U8(1), U8(5), B(JumpIfJSReceiver), U8(7), B(CallRuntime), U16(Runtime::kThrowSymbolIteratorInvalid), R(0), U8(0), /* 30 E> */ B(StaContextSlot), R(1), U8(7), U8(0), @@ -362,7 +362,7 @@ bytecodes: [ B(JumpIfTrue), U8(18), B(LdaSmi), I8(1), B(TestEqualStrict), R(3), U8(0), - B(JumpIfTrue), U8(133), + B(JumpIfTrue), U8(134), B(LdaSmi), I8(78), B(Star), R(12), B(CallRuntime), U16(Runtime::kAbort), R(12), U8(1), @@ -370,7 +370,7 @@ bytecodes: [ B(Star), R(13), B(LdaNamedProperty), R(13), U8(3), U8(9), B(Star), R(12), - /* 27 E> */ B(CallProperty0), R(12), R(13), U8(7), + /* 27 E> */ B(CallProperty), R(12), R(13), U8(1), U8(7), /* 27 E> */ B(StaContextSlot), R(1), U8(8), U8(0), B(Star), R(12), B(InvokeIntrinsic), U8(Runtime::k_IsJSReceiver), R(12), U8(1), @@ -443,7 +443,7 @@ bytecodes: [ B(PopContext), R(2), B(LdaZero), B(StaContextSlot), R(1), U8(9), U8(0), - B(JumpLoop), U8(217), I8(0), + B(JumpLoop), U8(218), I8(0), B(Jump), U8(44), B(Star), R(12), B(Ldar), R(closure), @@ -621,12 +621,12 @@ constant pool: [ ONE_BYTE_INTERNALIZED_STRING_TYPE ["function"], ONE_BYTE_INTERNALIZED_STRING_TYPE [""], FIXED_ARRAY_TYPE, - Smi [577], + Smi [579], ] handlers: [ - [53, 692, 698], - [149, 443, 449], - [152, 399, 401], - [545, 561, 563], + [53, 694, 700], + [149, 445, 451], + [152, 401, 403], + [547, 563, 565], ] diff --git a/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden b/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden index 4256c16a75..fdfe86481c 100644 --- a/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden +++ b/test/cctest/interpreter/bytecode_expectations/LookupSlot.golden @@ -40,7 +40,7 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 14 E> */ B(Call1), R(1), R(2), R(3), U8(2), + /* 14 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 35 S> */ B(LdaLookupGlobalSlot), U8(2), U8(6), U8(1), /* 45 S> */ B(Return), ] @@ -86,7 +86,7 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 14 E> */ B(Call1), R(1), R(2), R(3), U8(2), + /* 14 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 35 S> */ B(LdaLookupGlobalSlotInsideTypeof), U8(2), U8(6), U8(1), B(TypeOf), /* 52 S> */ B(Return), @@ -135,7 +135,7 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 29 E> */ B(Call1), R(1), R(2), R(3), U8(2), + /* 29 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 39 S> */ B(Return), ] constant pool: [ @@ -185,7 +185,7 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 44 E> */ B(Call1), R(1), R(2), R(3), U8(2), + /* 44 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 66 S> */ B(LdaLookupContextSlot), U8(2), U8(6), U8(1), /* 76 S> */ B(Return), ] @@ -236,7 +236,7 @@ bytecodes: [ B(Mov), R(closure), R(6), B(CallRuntime), U16(Runtime::kResolvePossiblyDirectEval), R(4), U8(6), B(Star), R(1), - /* 40 E> */ B(Call1), R(1), R(2), R(3), U8(2), + /* 40 E> */ B(Call), R(1), R(2), U8(2), U8(2), /* 62 S> */ B(LdaLookupGlobalSlot), U8(2), U8(6), U8(1), /* 72 S> */ B(Return), ] diff --git a/test/cctest/interpreter/bytecode_expectations/Modules.golden b/test/cctest/interpreter/bytecode_expectations/Modules.golden index 45b01bc913..f8c4df6b30 100644 --- a/test/cctest/interpreter/bytecode_expectations/Modules.golden +++ b/test/cctest/interpreter/bytecode_expectations/Modules.golden @@ -226,7 +226,7 @@ bytecodes: [ B(Star), R(4), B(LdaSmi), I8(42), B(Star), R(6), - /* 32 E> */ B(Call1), R(4), R(5), R(6), U8(2), + /* 32 E> */ B(Call), R(4), R(5), U8(2), U8(2), B(Ldar), R(closure), B(CreateBlockContext), U8(2), B(PushContext), R(1), @@ -244,7 +244,7 @@ bytecodes: [ B(Star), R(4), B(LdaSmi), I8(42), B(Star), R(6), - /* 52 E> */ B(Call1), R(4), R(5), R(6), U8(4), + /* 52 E> */ B(Call), R(4), R(5), U8(2), U8(4), B(PopContext), R(1), B(LdaUndefined), /* 64 S> */ B(Return), @@ -853,7 +853,7 @@ snippet: " " frame size: 9 parameter count: 2 -bytecode array length: 171 +bytecode array length: 170 bytecodes: [ B(Ldar), R(new_target), B(JumpIfUndefined), U8(28), @@ -924,7 +924,7 @@ bytecodes: [ B(Star), R(6), /* 41 E> */ B(LdaNamedProperty), R(6), U8(2), U8(6), B(Star), R(6), - /* 31 E> */ B(CallProperty2), R(3), R(4), R(5), R(6), U8(2), + /* 31 E> */ B(CallProperty), R(3), R(4), U8(3), U8(2), B(LdaUndefined), /* 45 S> */ B(Return), ] diff --git a/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden b/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden index 2feef5ed76..38ef6a3fc4 100644 --- a/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden +++ b/test/cctest/interpreter/bytecode_expectations/PropertyCall.golden @@ -13,13 +13,13 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 13 +bytecode array length: 14 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(Nop), /* 24 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), B(Star), R(0), - /* 25 E> */ B(CallProperty0), R(0), R(arg0), U8(2), + /* 25 E> */ B(CallProperty), R(0), R(arg0), U8(1), U8(2), /* 33 S> */ B(Return), ] constant pool: [ @@ -33,15 +33,18 @@ snippet: " function f(a, b, c) { return a.func(b, c); } f(new (function Obj() { this.func = function() { return; }})(), 1, 2) " -frame size: 1 +frame size: 4 parameter count: 4 -bytecode array length: 15 +bytecode array length: 23 bytecodes: [ /* 10 E> */ B(StackCheck), /* 22 S> */ B(Nop), /* 30 E> */ B(LdaNamedProperty), R(arg0), U8(0), U8(4), B(Star), R(0), - /* 31 E> */ B(CallProperty2), R(0), R(arg0), R(arg1), R(arg2), U8(2), + B(Mov), R(arg0), R(1), + B(Mov), R(arg1), R(2), + B(Mov), R(arg2), R(3), + /* 31 E> */ B(CallProperty), R(0), R(1), U8(3), U8(2), /* 43 S> */ B(Return), ] constant pool: [ @@ -55,9 +58,9 @@ snippet: " function f(a, b) { return a.func(b + b, b); } f(new (function Obj() { this.func = function() { return; }})(), 1) " -frame size: 3 +frame size: 4 parameter count: 3 -bytecode array length: 22 +bytecode array length: 27 bytecodes: [ /* 10 E> */ B(StackCheck), /* 19 S> */ B(Nop), @@ -66,7 +69,9 @@ bytecodes: [ B(Ldar), R(arg1), /* 35 E> */ B(Add), R(arg1), U8(6), B(Star), R(2), - /* 28 E> */ B(CallProperty2), R(0), R(arg0), R(2), R(arg1), U8(2), + B(Mov), R(arg0), R(1), + B(Mov), R(arg1), R(3), + /* 28 E> */ B(CallProperty), R(0), R(1), U8(3), U8(2), /* 44 S> */ B(Return), ] constant pool: [ @@ -211,7 +216,7 @@ snippet: " " frame size: 1 parameter count: 2 -bytecode array length: 665 +bytecode array length: 667 bytecodes: [ /* 10 E> */ B(StackCheck), /* 17 S> */ B(Nop), @@ -473,7 +478,7 @@ bytecodes: [ /* 1169 S> */ B(Nop), /* 1177 E> */ B(Wide), B(LdaNamedProperty), R16(arg0), U16(0), U16(260), B(Star), R(0), - /* 1178 E> */ B(Wide), B(CallProperty0), R16(0), R16(arg0), U16(258), + /* 1178 E> */ B(Wide), B(CallProperty), R16(0), R16(arg0), U16(1), U16(258), /* 1186 S> */ B(Return), ] constant pool: [ @@ -489,7 +494,7 @@ snippet: " " frame size: 5 parameter count: 2 -bytecode array length: 52 +bytecode array length: 55 bytecodes: [ /* 10 E> */ B(StackCheck), /* 16 S> */ B(Nop), @@ -497,19 +502,20 @@ bytecodes: [ B(Star), R(2), B(LdaSmi), I8(1), B(Star), R(4), - /* 25 E> */ B(CallProperty1), R(2), R(arg0), R(4), U8(6), + B(Mov), R(arg0), R(3), + /* 25 E> */ B(CallProperty), R(2), R(3), U8(2), U8(6), B(Star), R(2), /* 32 E> */ B(LdaNamedProperty), R(2), U8(0), U8(10), B(Star), R(1), B(LdaSmi), I8(2), B(Star), R(3), - /* 33 E> */ B(CallProperty1), R(1), R(2), R(3), U8(4), + /* 33 E> */ B(CallProperty), R(1), R(2), U8(2), U8(4), B(Star), R(1), /* 40 E> */ B(LdaNamedProperty), R(1), U8(0), U8(12), B(Star), R(0), B(LdaSmi), I8(3), B(Star), R(2), - /* 41 E> */ B(CallProperty1), R(0), R(1), R(2), U8(2), + /* 41 E> */ B(CallProperty), R(0), R(1), U8(2), U8(2), /* 50 S> */ B(Return), ] constant pool: [ diff --git a/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden b/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden index 4c98cea746..61b3b242b7 100644 --- a/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden +++ b/test/cctest/interpreter/bytecode_expectations/RegExpLiterals.golden @@ -56,7 +56,7 @@ bytecodes: [ B(Star), R(0), B(LdaConstant), U8(2), B(Star), R(2), - /* 48 E> */ B(CallProperty1), R(0), R(1), R(2), U8(2), + /* 48 E> */ B(CallProperty), R(0), R(1), U8(2), U8(2), /* 62 S> */ B(Return), ] constant pool: [ diff --git a/test/unittests/interpreter/bytecode-array-builder-unittest.cc b/test/unittests/interpreter/bytecode-array-builder-unittest.cc index fd119e8e34..9f8a2d4dbe 100644 --- a/test/unittests/interpreter/bytecode-array-builder-unittest.cc +++ b/test/unittests/interpreter/bytecode-array-builder-unittest.cc @@ -38,7 +38,7 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { Register other(reg.index() + 1); Register wide(128); RegisterList reg_list; - RegisterList single(0, 1), pair(0, 2), triple(0, 3); + RegisterList pair(0, 2), triple(0, 3); // Emit argument creation operations. builder.CreateArguments(CreateArgumentsType::kMappedArguments) @@ -144,14 +144,8 @@ TEST_F(BytecodeArrayBuilderTest, AllBytecodesGenerated) { // Call operations. builder.Call(reg, reg_list, 1, Call::GLOBAL_CALL) - .Call(reg, single, 1, Call::GLOBAL_CALL) - .Call(reg, pair, 1, Call::GLOBAL_CALL) - .Call(reg, triple, 1, Call::GLOBAL_CALL) .Call(reg, reg_list, 1, Call::NAMED_PROPERTY_CALL, TailCallMode::kDisallow) - .Call(reg, single, 1, Call::NAMED_PROPERTY_CALL) - .Call(reg, pair, 1, Call::NAMED_PROPERTY_CALL) - .Call(reg, triple, 1, Call::NAMED_PROPERTY_CALL) .Call(reg, reg_list, 1, Call::GLOBAL_CALL, TailCallMode::kAllow) .CallRuntime(Runtime::kIsArray, reg) .CallRuntimeForPair(Runtime::kLoadLookupSlotForCall, reg_list, pair)