Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(325)

Unified Diff: src/interpreter/interpreter.cc

Issue 1419003002: [Interpreter] Unify global and unallocated variable access. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Fix unallocated variable error Created 5 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/interpreter/interpreter.h ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/interpreter.cc
diff --git a/src/interpreter/interpreter.cc b/src/interpreter/interpreter.cc
index 4226158bd8753b3c3e2c18fd64a6e242c7615114..7f9bf8129895501462a08fedfcb1acec1d97bd95 100644
--- a/src/interpreter/interpreter.cc
+++ b/src/interpreter/interpreter.cc
@@ -184,6 +184,92 @@ void Interpreter::DoStar(compiler::InterpreterAssembler* assembler) {
}
+void Interpreter::DoLoadGlobal(Callable ic,
+ compiler::InterpreterAssembler* assembler) {
+ // Get the global object.
+ Node* context = __ GetContext();
+ Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX);
+
+ // Load the global via the LoadIC.
+ Node* code_target = __ HeapConstant(ic.code());
+ Node* constant_index = __ BytecodeOperandIdx8(0);
+ Node* name = __ LoadConstantPoolEntry(constant_index);
+ Node* raw_slot = __ BytecodeOperandIdx8(1);
+ Node* smi_slot = __ SmiTag(raw_slot);
+ Node* type_feedback_vector = __ LoadTypeFeedbackVector();
+ Node* result = __ CallIC(ic.descriptor(), code_target, global, name, smi_slot,
+ type_feedback_vector);
+ __ SetAccumulator(result);
+
+ __ Dispatch();
+}
+
+
+// LdaGlobalSloppy <name_index> <slot>
+//
+// Load the global with name in constant pool entry <name_index> into the
+// accumulator using FeedBackVector slot <slot> in sloppy mode.
+void Interpreter::DoLdaGlobalSloppy(compiler::InterpreterAssembler* assembler) {
+ Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
+ SLOPPY, UNINITIALIZED);
+ DoLoadGlobal(ic, assembler);
+}
+
+
+// LdaGlobalSloppy <name_index> <slot>
+//
+// Load the global with name in constant pool entry <name_index> into the
+// accumulator using FeedBackVector slot <slot> in strict mode.
+void Interpreter::DoLdaGlobalStrict(compiler::InterpreterAssembler* assembler) {
+ Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
+ STRICT, UNINITIALIZED);
+ DoLoadGlobal(ic, assembler);
+}
+
+
+void Interpreter::DoStoreGlobal(Callable ic,
+ compiler::InterpreterAssembler* assembler) {
+ // Get the global object.
+ Node* context = __ GetContext();
+ Node* global = __ LoadContextSlot(context, Context::GLOBAL_OBJECT_INDEX);
+
+ // Store the global via the StoreIC.
+ Node* code_target = __ HeapConstant(ic.code());
+ Node* constant_index = __ BytecodeOperandIdx8(0);
+ Node* name = __ LoadConstantPoolEntry(constant_index);
+ Node* value = __ GetAccumulator();
+ Node* raw_slot = __ BytecodeOperandIdx8(1);
+ Node* smi_slot = __ SmiTag(raw_slot);
+ Node* type_feedback_vector = __ LoadTypeFeedbackVector();
+ __ CallIC(ic.descriptor(), code_target, global, name, value, smi_slot,
+ type_feedback_vector);
+
+ __ Dispatch();
+}
+
+
+// StaGlobalSloppy <name_index> <slot>
+//
+// Store the value in the accumulator into the global with name in constant pool
+// entry <name_index> using FeedBackVector slot <slot> in sloppy mode.
+void Interpreter::DoStaGlobalSloppy(compiler::InterpreterAssembler* assembler) {
+ Callable ic =
+ CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
+ DoStoreGlobal(ic, assembler);
+}
+
+
+// StaGlobalStrict <name_index> <slot>
+//
+// Store the value in the accumulator into the global with name in constant pool
+// entry <name_index> using FeedBackVector slot <slot> in strict mode.
+void Interpreter::DoStaGlobalStrict(compiler::InterpreterAssembler* assembler) {
+ Callable ic =
+ CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
+ DoStoreGlobal(ic, assembler);
+}
+
+
// LdaContextSlot <context> <slot_index>
//
// Load the object in |slot_index| of |context| into the accumulator.
@@ -210,13 +296,14 @@ void Interpreter::DoStaContextSlot(compiler::InterpreterAssembler* assembler) {
}
-void Interpreter::DoPropertyLoadIC(Callable ic,
- compiler::InterpreterAssembler* assembler) {
+void Interpreter::DoLoadIC(Callable ic,
+ compiler::InterpreterAssembler* assembler) {
Node* code_target = __ HeapConstant(ic.code());
- Node* reg_index = __ BytecodeOperandReg8(0);
- Node* object = __ LoadRegister(reg_index);
- Node* name = __ GetAccumulator();
- Node* raw_slot = __ BytecodeOperandIdx8(1);
+ Node* register_index = __ BytecodeOperandReg8(0);
+ Node* object = __ LoadRegister(register_index);
+ Node* constant_index = __ BytecodeOperandIdx8(1);
+ Node* name = __ LoadConstantPoolEntry(constant_index);
+ Node* raw_slot = __ BytecodeOperandIdx8(2);
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot,
@@ -226,25 +313,41 @@ void Interpreter::DoPropertyLoadIC(Callable ic,
}
-// LoadICSloppy <object> <slot>
+// LoadICSloppy <object> <name_index> <slot>
//
// Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and
-// the name in the accumulator.
+// the name at constant pool entry <name_index>.
void Interpreter::DoLoadICSloppy(compiler::InterpreterAssembler* assembler) {
Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
SLOPPY, UNINITIALIZED);
- DoPropertyLoadIC(ic, assembler);
+ DoLoadIC(ic, assembler);
}
-// LoadICStrict <object> <slot>
+// LoadICStrict <object> <name_index> <slot>
//
-// Calls the strict mode LoadIC at FeedBackVector slot <slot> for <object> and
-// the name in the accumulator.
+// Calls the sloppy mode LoadIC at FeedBackVector slot <slot> for <object> and
+// the name at constant pool entry <name_index>.
void Interpreter::DoLoadICStrict(compiler::InterpreterAssembler* assembler) {
Callable ic = CodeFactory::LoadICInOptimizedCode(isolate_, NOT_INSIDE_TYPEOF,
STRICT, UNINITIALIZED);
- DoPropertyLoadIC(ic, assembler);
+ DoLoadIC(ic, assembler);
+}
+
+
+void Interpreter::DoKeyedLoadIC(Callable ic,
+ compiler::InterpreterAssembler* assembler) {
+ Node* code_target = __ HeapConstant(ic.code());
+ Node* reg_index = __ BytecodeOperandReg8(0);
+ Node* object = __ LoadRegister(reg_index);
+ Node* name = __ GetAccumulator();
+ Node* raw_slot = __ BytecodeOperandIdx8(1);
+ Node* smi_slot = __ SmiTag(raw_slot);
+ Node* type_feedback_vector = __ LoadTypeFeedbackVector();
+ Node* result = __ CallIC(ic.descriptor(), code_target, object, name, smi_slot,
+ type_feedback_vector);
+ __ SetAccumulator(result);
+ __ Dispatch();
}
@@ -256,7 +359,7 @@ void Interpreter::DoKeyedLoadICSloppy(
compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::KeyedLoadICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
- DoPropertyLoadIC(ic, assembler);
+ DoKeyedLoadIC(ic, assembler);
}
@@ -268,47 +371,65 @@ void Interpreter::DoKeyedLoadICStrict(
compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::KeyedLoadICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
- DoPropertyLoadIC(ic, assembler);
+ DoKeyedLoadIC(ic, assembler);
}
-void Interpreter::DoPropertyStoreIC(Callable ic,
- compiler::InterpreterAssembler* assembler) {
+void Interpreter::DoStoreIC(Callable ic,
+ compiler::InterpreterAssembler* assembler) {
Node* code_target = __ HeapConstant(ic.code());
Node* object_reg_index = __ BytecodeOperandReg8(0);
Node* object = __ LoadRegister(object_reg_index);
- Node* name_reg_index = __ BytecodeOperandReg8(1);
- Node* name = __ LoadRegister(name_reg_index);
+ Node* constant_index = __ BytecodeOperandIdx8(1);
+ Node* name = __ LoadConstantPoolEntry(constant_index);
Node* value = __ GetAccumulator();
Node* raw_slot = __ BytecodeOperandIdx8(2);
Node* smi_slot = __ SmiTag(raw_slot);
Node* type_feedback_vector = __ LoadTypeFeedbackVector();
- Node* result = __ CallIC(ic.descriptor(), code_target, object, name, value,
- smi_slot, type_feedback_vector);
- __ SetAccumulator(result);
+ __ CallIC(ic.descriptor(), code_target, object, name, value, smi_slot,
+ type_feedback_vector);
__ Dispatch();
}
-// StoreICSloppy <object> <name> <slot>
+// StoreICSloppy <object> <name_index> <slot>
//
// Calls the sloppy mode StoreIC at FeedBackVector slot <slot> for <object> and
-// the name <name> with the value in the accumulator.
+// the name in constant pool entry <name_index> with the value in the
+// accumulator.
void Interpreter::DoStoreICSloppy(compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::StoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
- DoPropertyStoreIC(ic, assembler);
+ DoStoreIC(ic, assembler);
}
-// StoreICStrict <object> <name> <slot>
+// StoreICStrict <object> <name_index> <slot>
//
// Calls the strict mode StoreIC at FeedBackVector slot <slot> for <object> and
-// the name <name> with the value in the accumulator.
+// the name in constant pool entry <name_index> with the value in the
+// accumulator.
void Interpreter::DoStoreICStrict(compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::StoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
- DoPropertyStoreIC(ic, assembler);
+ DoStoreIC(ic, assembler);
+}
+
+
+void Interpreter::DoKeyedStoreIC(Callable ic,
+ compiler::InterpreterAssembler* assembler) {
+ Node* code_target = __ HeapConstant(ic.code());
+ Node* object_reg_index = __ BytecodeOperandReg8(0);
+ Node* object = __ LoadRegister(object_reg_index);
+ Node* name_reg_index = __ BytecodeOperandReg8(1);
+ Node* name = __ LoadRegister(name_reg_index);
+ Node* value = __ GetAccumulator();
+ Node* raw_slot = __ BytecodeOperandIdx8(2);
+ Node* smi_slot = __ SmiTag(raw_slot);
+ Node* type_feedback_vector = __ LoadTypeFeedbackVector();
+ __ CallIC(ic.descriptor(), code_target, object, name, value, smi_slot,
+ type_feedback_vector);
+ __ Dispatch();
}
@@ -320,7 +441,7 @@ void Interpreter::DoKeyedStoreICSloppy(
compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::KeyedStoreICInOptimizedCode(isolate_, SLOPPY, UNINITIALIZED);
- DoPropertyStoreIC(ic, assembler);
+ DoKeyedStoreIC(ic, assembler);
}
@@ -332,7 +453,7 @@ void Interpreter::DoKeyedStoreICStrict(
compiler::InterpreterAssembler* assembler) {
Callable ic =
CodeFactory::KeyedStoreICInOptimizedCode(isolate_, STRICT, UNINITIALIZED);
- DoPropertyStoreIC(ic, assembler);
+ DoKeyedStoreIC(ic, assembler);
}
« no previous file with comments | « src/interpreter/interpreter.h ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698