Chromium Code Reviews| Index: src/interpreter/interpreter.cc |
| diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
| index 3d56cfb05ac4d1424323b58aae5c45e96aee80f0..26a1c791d241b97e97ef2275aff83a7823d4d578 100644 |
| --- a/src/interpreter/interpreter.cc |
| +++ b/src/interpreter/interpreter.cc |
| @@ -14,6 +14,7 @@ |
| #include "src/compilation-info.h" |
| #include "src/compiler.h" |
| #include "src/factory.h" |
| +#include "src/ic/accessor-assembler.h" |
| #include "src/interpreter/bytecode-flags.h" |
| #include "src/interpreter/bytecode-generator.h" |
| #include "src/interpreter/bytecodes.h" |
| @@ -458,16 +459,70 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) { |
| __ Dispatch(); |
| } |
| -Node* Interpreter::BuildLoadGlobal(Callable ic, Node* context, Node* name_index, |
| - Node* feedback_slot, |
| - InterpreterAssembler* assembler) { |
| +void Interpreter::BuildLoadGlobal(int slot_index, int name_index_index, |
|
rmcilroy
2017/02/09 10:30:44
name_index_index? ;) How about name_operand_index?
jgruber
2017/02/09 11:40:32
I liked name_index_index because it implies that t
|
| + TypeofMode typeof_mode, |
| + InterpreterAssembler* assembler) { |
| // Load the global via the LoadGlobalIC. |
| - Node* code_target = __ HeapConstant(ic.code()); |
| - Node* name = __ LoadConstantPoolEntry(name_index); |
| - Node* smi_slot = __ SmiTag(feedback_slot); |
| Node* feedback_vector = __ LoadFeedbackVector(); |
| - return __ CallStub(ic.descriptor(), code_target, context, name, smi_slot, |
| - feedback_vector); |
| + Node* feedback_slot = __ BytecodeOperandIdx(slot_index); |
| + |
| + AccessorAssembler accessor_asm(assembler->state()); |
| + |
| + Label try_handler(assembler, Label::kDeferred), |
| + miss(assembler, Label::kDeferred); |
| + |
| + // Fast path without frame construction for the data case. |
| + { |
| + Label done(assembler); |
| + Variable var_result(assembler, MachineRepresentation::kTagged); |
| + ExitPoint exit_point(assembler, &done, &var_result); |
| + |
| + accessor_asm.LoadGlobalIC_TryPropertyCellCase( |
| + feedback_vector, feedback_slot, &exit_point, &try_handler, &miss, |
| + CodeStubAssembler::INTPTR_PARAMETERS); |
| + |
| + __ Bind(&done); |
| + __ SetAccumulator(var_result.value()); |
| + __ Dispatch(); |
| + } |
| + |
| + // Slow path with frame construction. |
| + { |
| + Label done(assembler); |
| + Variable var_result(assembler, MachineRepresentation::kTagged); |
| + ExitPoint exit_point(assembler, &done, &var_result); |
| + |
| + __ Bind(&try_handler); |
| + { |
| + Node* context = __ GetContext(); |
| + Node* smi_slot = __ SmiTag(feedback_slot); |
| + Node* name_index = __ BytecodeOperandIdx(name_index_index); |
| + Node* name = __ LoadConstantPoolEntry(name_index); |
| + |
| + AccessorAssembler::LoadICParameters params(context, nullptr, name, |
| + smi_slot, feedback_vector); |
| + accessor_asm.LoadGlobalIC_TryHandlerCase(¶ms, typeof_mode, |
| + &exit_point, &miss); |
| + } |
| + |
| + __ Bind(&miss); |
| + { |
| + Node* context = __ GetContext(); |
| + Node* smi_slot = __ SmiTag(feedback_slot); |
| + Node* name_index = __ BytecodeOperandIdx(name_index_index); |
| + Node* name = __ LoadConstantPoolEntry(name_index); |
| + |
| + AccessorAssembler::LoadICParameters params(context, nullptr, name, |
| + smi_slot, feedback_vector); |
| + accessor_asm.LoadGlobalIC_MissCase(¶ms, &exit_point); |
| + } |
| + |
| + __ Bind(&done); |
| + { |
| + __ SetAccumulator(var_result.value()); |
| + __ Dispatch(); |
| + } |
| + } |
| } |
| // LdaGlobal <name_index> <slot> |
| @@ -475,16 +530,10 @@ Node* Interpreter::BuildLoadGlobal(Callable ic, Node* context, Node* name_index, |
| // Load the global with name in constant pool entry <name_index> into the |
| // accumulator using FeedBackVector slot <slot> outside of a typeof. |
| void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
| - Callable ic = |
| - CodeFactory::LoadGlobalICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF); |
| + static const int kNameIndexIndex = 0; |
| + static const int kSlotIndex = 1; |
| - Node* context = __ GetContext(); |
| - |
| - Node* name_index = __ BytecodeOperandIdx(0); |
| - Node* raw_slot = __ BytecodeOperandIdx(1); |
| - Node* result = BuildLoadGlobal(ic, context, name_index, raw_slot, assembler); |
| - __ SetAccumulator(result); |
| - __ Dispatch(); |
| + BuildLoadGlobal(kSlotIndex, kNameIndexIndex, NOT_INSIDE_TYPEOF, assembler); |
| } |
| // LdaGlobalInsideTypeof <name_index> <slot> |
| @@ -492,16 +541,10 @@ void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
| // Load the global with name in constant pool entry <name_index> into the |
| // accumulator using FeedBackVector slot <slot> inside of a typeof. |
| void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
| - Callable ic = |
| - CodeFactory::LoadGlobalICInOptimizedCode(isolate_, INSIDE_TYPEOF); |
| - |
| - Node* context = __ GetContext(); |
| + static const int kNameIndexIndex = 0; |
| + static const int kSlotIndex = 1; |
| - Node* name_index = __ BytecodeOperandIdx(0); |
| - Node* raw_slot = __ BytecodeOperandIdx(1); |
| - Node* result = BuildLoadGlobal(ic, context, name_index, raw_slot, assembler); |
| - __ SetAccumulator(result); |
| - __ Dispatch(); |
| + BuildLoadGlobal(kSlotIndex, kNameIndexIndex, INSIDE_TYPEOF, assembler); |
| } |
| void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { |
| @@ -689,8 +732,6 @@ void Interpreter::DoLdaLookupContextSlotInsideTypeof( |
| void Interpreter::DoLdaLookupGlobalSlot(Runtime::FunctionId function_id, |
| InterpreterAssembler* assembler) { |
| Node* context = __ GetContext(); |
| - Node* name_index = __ BytecodeOperandIdx(0); |
| - Node* feedback_slot = __ BytecodeOperandIdx(1); |
| Node* depth = __ BytecodeOperandUImm(2); |
| Label slowpath(assembler, Label::kDeferred); |
| @@ -700,19 +741,20 @@ void Interpreter::DoLdaLookupGlobalSlot(Runtime::FunctionId function_id, |
| // Fast path does a normal load global |
| { |
| - Callable ic = CodeFactory::LoadGlobalICInOptimizedCode( |
| - isolate_, function_id == Runtime::kLoadLookupSlotInsideTypeof |
| - ? INSIDE_TYPEOF |
| - : NOT_INSIDE_TYPEOF); |
| - Node* result = |
| - BuildLoadGlobal(ic, context, name_index, feedback_slot, assembler); |
| - __ SetAccumulator(result); |
| - __ Dispatch(); |
| + static const int kNameIndexIndex = 0; |
| + static const int kSlotIndex = 1; |
| + |
| + TypeofMode typeof_mode = function_id == Runtime::kLoadLookupSlotInsideTypeof |
| + ? INSIDE_TYPEOF |
| + : NOT_INSIDE_TYPEOF; |
| + |
| + BuildLoadGlobal(kSlotIndex, kNameIndexIndex, typeof_mode, assembler); |
| } |
| // Slow path when we have to call out to the runtime |
| __ Bind(&slowpath); |
| { |
| + Node* name_index = __ BytecodeOperandIdx(0); |
| Node* name = __ LoadConstantPoolEntry(name_index); |
| Node* result = __ CallRuntime(function_id, context, name); |
| __ SetAccumulator(result); |