Chromium Code Reviews| Index: src/interpreter/interpreter.cc |
| diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
| index 3d56cfb05ac4d1424323b58aae5c45e96aee80f0..ac7dfa71ce809c6973fd5cc46ba65536a18fca36 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,65 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) { |
| __ Dispatch(); |
| } |
| -Node* Interpreter::BuildLoadGlobal(Callable ic, Node* context, Node* name_index, |
| - Node* feedback_slot, |
| - InterpreterAssembler* assembler) { |
| +void Interpreter::BuildLoadGlobal( |
| + const std::function<compiler::Node*()>& gen_name_index, Node* feedback_slot, |
|
Igor Sheludko
2017/02/08 15:42:20
Given that you already sawed LoadGlobalIC into bui
rmcilroy
2017/02/08 17:39:14
+1 I think you should be able to just pass the nam
Igor Sheludko
2017/02/08 17:44:40
The idea is to remove everything related to name f
Igor Sheludko
2017/02/08 17:46:25
And in my comment above I meant to pass indices as
rmcilroy
2017/02/08 18:38:21
I see. I could live with the bytecode operand inde
jgruber
2017/02/09 09:32:51
This is what I went with, BuildLoadGlobal now take
|
| + 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); |
| + |
| + 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 out(assembler); |
|
rmcilroy
2017/02/08 18:38:21
nit - "done" is used more commonly.
jgruber
2017/02/09 09:32:51
Done.
|
| + Variable var_result(assembler, MachineRepresentation::kTagged); |
| + ExitPoint exit_point(assembler, &out, &var_result); |
| + |
| + AccessorAssembler::LoadICParameters p(nullptr, nullptr, nullptr, smi_slot, |
|
rmcilroy
2017/02/08 18:38:21
nit - params
jgruber
2017/02/09 09:32:51
These have been removed.
|
| + feedback_vector); |
| + accessor_asm.LoadGlobalICData(&p, &exit_point, &try_handler, &miss); |
|
Igor Sheludko
2017/02/08 15:42:20
s/&p/feedback_vector, smi_slot/
jgruber
2017/02/09 09:32:51
Done. Also removed smi tagging for the fast path.
|
| + |
| + __ Bind(&out); |
| + __ SetAccumulator(var_result.value()); |
| + __ Dispatch(); |
| + } |
| + |
| + // Slow path with frame construction. |
| + { |
| + Label out(assembler); |
|
rmcilroy
2017/02/08 18:38:21
ditto.
jgruber
2017/02/09 09:32:51
Done.
|
| + Variable var_result(assembler, MachineRepresentation::kTagged); |
| + ExitPoint exit_point(assembler, &out, &var_result); |
| + |
| + __ Bind(&try_handler); |
| + { |
| + Node* context = __ GetContext(); |
| + Node* name = __ LoadConstantPoolEntry(gen_name_index()); |
| + |
| + AccessorAssembler::LoadICParameters p(context, nullptr, name, smi_slot, |
|
rmcilroy
2017/02/08 18:38:21
ditto
jgruber
2017/02/09 09:32:51
Done.
|
| + feedback_vector); |
| + accessor_asm.LoadGlobalICHandler(&p, typeof_mode, &exit_point, &miss); |
| + } |
| + |
| + __ Bind(&miss); |
| + { |
| + Node* context = __ GetContext(); |
| + Node* name = __ LoadConstantPoolEntry(gen_name_index()); |
| + |
| + AccessorAssembler::LoadICParameters p(context, nullptr, name, smi_slot, |
| + feedback_vector); |
| + accessor_asm.LoadGlobalICMiss(&p, &exit_point); |
| + } |
| + |
| + __ Bind(&out); |
| + { |
| + __ SetAccumulator(var_result.value()); |
| + __ Dispatch(); |
| + } |
| + } |
| } |
| // LdaGlobal <name_index> <slot> |
| @@ -475,16 +525,11 @@ 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); |
| + Node* raw_slot = __ BytecodeOperandIdx(1); |
| - Node* context = __ GetContext(); |
| + auto gen_name_index = [=]() { return __ BytecodeOperandIdx(0); }; |
| - Node* name_index = __ BytecodeOperandIdx(0); |
| - Node* raw_slot = __ BytecodeOperandIdx(1); |
| - Node* result = BuildLoadGlobal(ic, context, name_index, raw_slot, assembler); |
| - __ SetAccumulator(result); |
| - __ Dispatch(); |
| + BuildLoadGlobal(gen_name_index, raw_slot, NOT_INSIDE_TYPEOF, assembler); |
| } |
| // LdaGlobalInsideTypeof <name_index> <slot> |
| @@ -492,16 +537,11 @@ 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* raw_slot = __ BytecodeOperandIdx(1); |
| - Node* context = __ GetContext(); |
| + auto gen_name_index = [=]() { return __ BytecodeOperandIdx(0); }; |
| - Node* name_index = __ BytecodeOperandIdx(0); |
| - Node* raw_slot = __ BytecodeOperandIdx(1); |
| - Node* result = BuildLoadGlobal(ic, context, name_index, raw_slot, assembler); |
| - __ SetAccumulator(result); |
| - __ Dispatch(); |
| + BuildLoadGlobal(gen_name_index, raw_slot, INSIDE_TYPEOF, assembler); |
| } |
| void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { |
| @@ -689,7 +729,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); |
| @@ -700,19 +739,19 @@ 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(); |
| + auto gen_name_index = [=]() { return __ BytecodeOperandIdx(0); }; |
| + |
| + TypeofMode typeof_mode = function_id == Runtime::kLoadLookupSlotInsideTypeof |
| + ? INSIDE_TYPEOF |
| + : NOT_INSIDE_TYPEOF; |
| + |
| + BuildLoadGlobal(gen_name_index, feedback_slot, 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); |