Chromium Code Reviews| Index: src/interpreter/interpreter.cc |
| diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
| index 49152a2022e3b45a6f6848d7c84260b006130bed..0ec93bae7eea94de34aa081e1a65858aeaf19832 100644 |
| --- a/src/interpreter/interpreter.cc |
| +++ b/src/interpreter/interpreter.cc |
| @@ -286,27 +286,36 @@ void Interpreter::DoLdaSmi(InterpreterAssembler* assembler) { |
| __ Dispatch(); |
| } |
| -void Interpreter::DoLoadConstant(InterpreterAssembler* assembler) { |
| +// LdaConstant <idx> |
| +// |
| +// Load constant literal at |idx| in the constant pool into the accumulator. |
| +void Interpreter::DoLdaConstant(InterpreterAssembler* assembler) { |
| Node* index = __ BytecodeOperandIdx(0); |
| Node* constant = __ LoadConstantPoolEntry(index); |
| __ SetAccumulator(constant); |
| __ Dispatch(); |
| } |
|
rmcilroy
2016/05/24 10:53:56
Thanks for the cleanup!
oth
2016/05/24 13:37:12
Acknowledged.
|
| -// LdaConstant <idx> |
| -// |
| -// Load constant literal at |idx| in the constant pool into the accumulator. |
| -void Interpreter::DoLdaConstant(InterpreterAssembler* assembler) { |
| - DoLoadConstant(assembler); |
| +Node* Interpreter::BuildLoadUndefined(InterpreterAssembler* assembler) { |
|
rmcilroy
2016/05/24 10:53:56
nit - I think we could just inline this
oth
2016/05/24 13:37:12
Done.
|
| + return __ HeapConstant(isolate_->factory()->undefined_value()); |
| } |
| // LdaUndefined |
| // |
| // Load Undefined into the accumulator. |
| void Interpreter::DoLdaUndefined(InterpreterAssembler* assembler) { |
| - Node* undefined_value = |
| - __ HeapConstant(isolate_->factory()->undefined_value()); |
| - __ SetAccumulator(undefined_value); |
| + Node* result = BuildLoadUndefined(assembler); |
| + __ SetAccumulator(result); |
| + __ Dispatch(); |
| +} |
| + |
| +// LdrUndefined <reg> |
| +// |
| +// Loads undefined into the accumulator and |reg|. |
| +void Interpreter::DoLdrUndefined(InterpreterAssembler* assembler) { |
| + Node* result = BuildLoadUndefined(assembler); |
| + Node* destination = __ BytecodeOperandReg(0); |
| + __ StoreRegister(result, destination); |
| __ Dispatch(); |
| } |
| @@ -377,7 +386,8 @@ void Interpreter::DoMov(InterpreterAssembler* assembler) { |
| __ Dispatch(); |
| } |
| -void Interpreter::DoLoadGlobal(Callable ic, InterpreterAssembler* assembler) { |
| +Node* Interpreter::BuildLoadGlobal(Callable ic, |
| + InterpreterAssembler* assembler) { |
| // Get the global object. |
| Node* context = __ GetContext(); |
| Node* native_context = |
| @@ -391,10 +401,8 @@ void Interpreter::DoLoadGlobal(Callable ic, InterpreterAssembler* assembler) { |
| Node* raw_slot = __ BytecodeOperandIdx(1); |
| Node* smi_slot = __ SmiTag(raw_slot); |
| Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| - Node* result = __ CallStub(ic.descriptor(), code_target, context, global, |
| - name, smi_slot, type_feedback_vector); |
| - __ SetAccumulator(result); |
| - __ Dispatch(); |
| + return __ CallStub(ic.descriptor(), code_target, context, global, name, |
| + smi_slot, type_feedback_vector); |
| } |
| // LdaGlobal <name_index> <slot> |
| @@ -404,7 +412,22 @@ void Interpreter::DoLoadGlobal(Callable ic, InterpreterAssembler* assembler) { |
| void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
| Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| UNINITIALIZED); |
| - DoLoadGlobal(ic, assembler); |
| + Node* result = BuildLoadGlobal(ic, assembler); |
| + __ SetAccumulator(result); |
| + __ Dispatch(); |
| +} |
| + |
| +// LdrGlobal <name_index> <slot> <reg> |
| +// |
| +// Load the global with name in constant pool entry <name_index> into |
| +// register <reg> using FeedBackVector slot <slot> outside of a typeof. |
| +void Interpreter::DoLdrGlobal(InterpreterAssembler* assembler) { |
| + Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| + UNINITIALIZED); |
| + Node* result = BuildLoadGlobal(ic, assembler); |
| + Node* destination = __ BytecodeOperandReg(2); |
| + __ StoreRegister(result, destination); |
| + __ Dispatch(); |
| } |
| // LdaGlobalInsideTypeof <name_index> <slot> |
| @@ -414,10 +437,12 @@ void Interpreter::DoLdaGlobal(InterpreterAssembler* assembler) { |
| void Interpreter::DoLdaGlobalInsideTypeof(InterpreterAssembler* assembler) { |
| Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, INSIDE_TYPEOF, |
| UNINITIALIZED); |
| - DoLoadGlobal(ic, assembler); |
| + Node* result = BuildLoadGlobal(ic, assembler); |
| + __ SetAccumulator(result); |
| + __ Dispatch(); |
| } |
| -void Interpreter::DoStoreGlobal(Callable ic, InterpreterAssembler* assembler) { |
| +void Interpreter::DoStaGlobal(Callable ic, InterpreterAssembler* assembler) { |
| // Get the global object. |
| Node* context = __ GetContext(); |
| Node* native_context = |
| @@ -444,7 +469,7 @@ void Interpreter::DoStoreGlobal(Callable ic, InterpreterAssembler* assembler) { |
| void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { |
| Callable ic = |
| CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED); |
| - DoStoreGlobal(ic, assembler); |
| + DoStaGlobal(ic, assembler); |
| } |
| // StaGlobalStrict <name_index> <slot> |
| @@ -454,21 +479,36 @@ void Interpreter::DoStaGlobalSloppy(InterpreterAssembler* assembler) { |
| void Interpreter::DoStaGlobalStrict(InterpreterAssembler* assembler) { |
| Callable ic = |
| CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED); |
| - DoStoreGlobal(ic, assembler); |
| + DoStaGlobal(ic, assembler); |
| +} |
| + |
| +compiler::Node* Interpreter::BuildLoadContextSlot( |
| + InterpreterAssembler* assembler) { |
| + Node* reg_index = __ BytecodeOperandReg(0); |
| + Node* context = __ LoadRegister(reg_index); |
| + Node* slot_index = __ BytecodeOperandIdx(1); |
| + return __ LoadContextSlot(context, slot_index); |
| } |
| // LdaContextSlot <context> <slot_index> |
| // |
| // Load the object in |slot_index| of |context| into the accumulator. |
| void Interpreter::DoLdaContextSlot(InterpreterAssembler* assembler) { |
| - Node* reg_index = __ BytecodeOperandReg(0); |
| - Node* context = __ LoadRegister(reg_index); |
| - Node* slot_index = __ BytecodeOperandIdx(1); |
| - Node* result = __ LoadContextSlot(context, slot_index); |
| + Node* result = BuildLoadContextSlot(assembler); |
| __ SetAccumulator(result); |
| __ Dispatch(); |
| } |
| +// LdrContextSlot <context> <slot_index> <reg> |
| +// |
| +// Load the object in <slot_index> of <context> into register <reg>. |
| +void Interpreter::DoLdrContextSlot(InterpreterAssembler* assembler) { |
| + Node* result = BuildLoadContextSlot(assembler); |
| + Node* destination = __ BytecodeOperandReg(2); |
| + __ StoreRegister(result, destination); |
| + __ Dispatch(); |
| +} |
| + |
| // StaContextSlot <context> <slot_index> |
| // |
| // Stores the object in the accumulator into |slot_index| of |context|. |
| @@ -481,8 +521,8 @@ void Interpreter::DoStaContextSlot(InterpreterAssembler* assembler) { |
| __ Dispatch(); |
| } |
| -void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id, |
| - InterpreterAssembler* assembler) { |
| +void Interpreter::DoLdaLookupSlot(Runtime::FunctionId function_id, |
| + InterpreterAssembler* assembler) { |
| Node* index = __ BytecodeOperandIdx(0); |
| Node* name = __ LoadConstantPoolEntry(index); |
| Node* context = __ GetContext(); |
| @@ -496,7 +536,7 @@ void Interpreter::DoLoadLookupSlot(Runtime::FunctionId function_id, |
| // Lookup the object with the name in constant pool entry |name_index| |
| // dynamically. |
| void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { |
| - DoLoadLookupSlot(Runtime::kLoadLookupSlot, assembler); |
| + DoLdaLookupSlot(Runtime::kLoadLookupSlot, assembler); |
| } |
| // LdaLookupSlotInsideTypeof <name_index> |
| @@ -504,11 +544,11 @@ void Interpreter::DoLdaLookupSlot(InterpreterAssembler* assembler) { |
| // Lookup the object with the name in constant pool entry |name_index| |
| // dynamically without causing a NoReferenceError. |
| void Interpreter::DoLdaLookupSlotInsideTypeof(InterpreterAssembler* assembler) { |
| - DoLoadLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); |
| + DoLdaLookupSlot(Runtime::kLoadLookupSlotInsideTypeof, assembler); |
| } |
| -void Interpreter::DoStoreLookupSlot(LanguageMode language_mode, |
| - InterpreterAssembler* assembler) { |
| +void Interpreter::DoStaLookupSlot(LanguageMode language_mode, |
| + InterpreterAssembler* assembler) { |
| Node* value = __ GetAccumulator(); |
| Node* index = __ BytecodeOperandIdx(0); |
| Node* name = __ LoadConstantPoolEntry(index); |
| @@ -526,7 +566,7 @@ void Interpreter::DoStoreLookupSlot(LanguageMode language_mode, |
| // Store the object in accumulator to the object with the name in constant |
| // pool entry |name_index| in sloppy mode. |
| void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { |
| - DoStoreLookupSlot(LanguageMode::SLOPPY, assembler); |
| + DoStaLookupSlot(LanguageMode::SLOPPY, assembler); |
| } |
| // StaLookupSlotStrict <name_index> |
| @@ -534,10 +574,11 @@ void Interpreter::DoStaLookupSlotSloppy(InterpreterAssembler* assembler) { |
| // Store the object in accumulator to the object with the name in constant |
| // pool entry |name_index| in strict mode. |
| void Interpreter::DoStaLookupSlotStrict(InterpreterAssembler* assembler) { |
| - DoStoreLookupSlot(LanguageMode::STRICT, assembler); |
| + DoStaLookupSlot(LanguageMode::STRICT, assembler); |
| } |
| -void Interpreter::DoLoadIC(Callable ic, InterpreterAssembler* assembler) { |
| +Node* Interpreter::BuildLoadNamedProperty(Callable ic, |
| + InterpreterAssembler* assembler) { |
| Node* code_target = __ HeapConstant(ic.code()); |
| Node* register_index = __ BytecodeOperandReg(0); |
| Node* object = __ LoadRegister(register_index); |
| @@ -547,10 +588,8 @@ void Interpreter::DoLoadIC(Callable ic, InterpreterAssembler* assembler) { |
| Node* smi_slot = __ SmiTag(raw_slot); |
| Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| Node* context = __ GetContext(); |
| - Node* result = __ CallStub(ic.descriptor(), code_target, context, object, |
| - name, smi_slot, type_feedback_vector); |
| - __ SetAccumulator(result); |
| - __ Dispatch(); |
| + return __ CallStub(ic.descriptor(), code_target, context, object, name, |
| + smi_slot, type_feedback_vector); |
| } |
| // LoadIC <object> <name_index> <slot> |
| @@ -560,10 +599,26 @@ void Interpreter::DoLoadIC(Callable ic, InterpreterAssembler* assembler) { |
| void Interpreter::DoLoadIC(InterpreterAssembler* assembler) { |
| Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| UNINITIALIZED); |
| - DoLoadIC(ic, assembler); |
| + Node* result = BuildLoadNamedProperty(ic, assembler); |
| + __ SetAccumulator(result); |
| + __ Dispatch(); |
| } |
| -void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { |
| +// LdrNamedProperty <object> <name_index> <slot> <reg> |
| +// |
| +// Calls the LoadIC at FeedBackVector slot <slot> for <object> and the name at |
| +// constant pool entry <name_index> and puts the result into register <reg>. |
| +void Interpreter::DoLdrNamedProperty(InterpreterAssembler* assembler) { |
| + Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF, |
| + UNINITIALIZED); |
| + Node* result = BuildLoadNamedProperty(ic, assembler); |
| + Node* destination = __ BytecodeOperandReg(3); |
| + __ StoreRegister(result, destination); |
| + __ Dispatch(); |
| +} |
| + |
| +Node* Interpreter::BuildLoadKeyedProperty(Callable ic, |
| + InterpreterAssembler* assembler) { |
| Node* code_target = __ HeapConstant(ic.code()); |
| Node* reg_index = __ BytecodeOperandReg(0); |
| Node* object = __ LoadRegister(reg_index); |
| @@ -572,10 +627,8 @@ void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { |
| Node* smi_slot = __ SmiTag(raw_slot); |
| Node* type_feedback_vector = __ LoadTypeFeedbackVector(); |
| Node* context = __ GetContext(); |
| - Node* result = __ CallStub(ic.descriptor(), code_target, context, object, |
| - name, smi_slot, type_feedback_vector); |
| - __ SetAccumulator(result); |
| - __ Dispatch(); |
| + return __ CallStub(ic.descriptor(), code_target, context, object, name, |
| + smi_slot, type_feedback_vector); |
| } |
| // KeyedLoadIC <object> <slot> |
| @@ -585,7 +638,22 @@ void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { |
| void Interpreter::DoKeyedLoadIC(InterpreterAssembler* assembler) { |
| Callable ic = |
| CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); |
| - DoKeyedLoadIC(ic, assembler); |
| + Node* result = BuildLoadKeyedProperty(ic, assembler); |
| + __ SetAccumulator(result); |
| + __ Dispatch(); |
| +} |
| + |
| +// LdrKeyedProperty <object> <slot> <reg> |
| +// |
| +// Calls the KeyedLoadIC at FeedBackVector slot <slot> for <object> and the key |
| +// in the accumulator and puts the result in register <reg>. |
| +void Interpreter::DoLdrKeyedProperty(InterpreterAssembler* assembler) { |
| + Callable ic = |
| + CodeFactory::KeyedLoadICInOptimizedCode(isolate_, UNINITIALIZED); |
| + Node* result = BuildLoadKeyedProperty(ic, assembler); |
| + Node* destination = __ BytecodeOperandReg(2); |
| + __ StoreRegister(result, destination); |
| + __ Dispatch(); |
| } |
| void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { |
| @@ -652,7 +720,7 @@ void Interpreter::DoKeyedStoreICSloppy(InterpreterAssembler* assembler) { |
| DoKeyedStoreIC(ic, assembler); |
| } |
| -// KeyedStoreICStore <object> <key> <slot> |
| +// KeyedStoreICStrict <object> <key> <slot> |
| // |
| // Calls the strict mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
| // and the key <key> with the value in the accumulator. |