Index: src/interpreter/interpreter.cc |
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc |
index 72a8a7ee8b598e859229fe4da1a9fd4b05e8b169..1e008b875f9a1c41063a310110c73e851c29e2f7 100644 |
--- a/src/interpreter/interpreter.cc |
+++ b/src/interpreter/interpreter.cc |
@@ -286,31 +286,38 @@ 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(); |
} |
- |
-// 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) { |
+ 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(); |
+} |
// LdaNull |
// |
@@ -385,8 +392,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 = |
@@ -400,10 +407,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> |
@@ -413,7 +418,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> |
@@ -423,10 +443,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 = |
@@ -454,7 +476,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); |
} |
@@ -465,21 +487,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|. |
@@ -492,8 +529,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(); |
@@ -507,7 +544,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> |
@@ -515,11 +552,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); |
@@ -537,7 +574,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); |
} |
@@ -546,10 +583,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); |
@@ -559,10 +597,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> |
@@ -572,10 +608,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(); |
+} |
+ |
+// 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(); |
} |
-void Interpreter::DoKeyedLoadIC(Callable ic, InterpreterAssembler* assembler) { |
+Node* Interpreter::BuildLoadKeyedProperty(Callable ic, |
+ InterpreterAssembler* assembler) { |
Node* code_target = __ HeapConstant(ic.code()); |
Node* reg_index = __ BytecodeOperandReg(0); |
Node* object = __ LoadRegister(reg_index); |
@@ -584,10 +636,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> |
@@ -597,7 +647,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) { |
@@ -616,7 +681,6 @@ void Interpreter::DoStoreIC(Callable ic, InterpreterAssembler* assembler) { |
__ Dispatch(); |
} |
- |
// StoreICSloppy <object> <name_index> <slot> |
// |
// Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and |
@@ -628,7 +692,6 @@ void Interpreter::DoStoreICSloppy(InterpreterAssembler* assembler) { |
DoStoreIC(ic, assembler); |
} |
- |
// StoreICStrict <object> <name_index> <slot> |
// |
// Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and |
@@ -656,7 +719,6 @@ void Interpreter::DoKeyedStoreIC(Callable ic, InterpreterAssembler* assembler) { |
__ Dispatch(); |
} |
- |
// KeyedStoreICSloppy <object> <key> <slot> |
// |
// Calls the sloppy mode KeyStoreIC at FeedBackVector slot <slot> for <object> |
@@ -667,8 +729,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. |