Index: src/interpreter/bytecode-array-builder.cc |
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc |
index c9ea2a68302af0c2d5211659f895eef833ad7699..a41d332a307db4f2e6e57d1bde2f6fcb3873f996 100644 |
--- a/src/interpreter/bytecode-array-builder.cc |
+++ b/src/interpreter/bytecode-array-builder.cc |
@@ -264,6 +264,32 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister( |
} |
+BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal( |
+ size_t name_index, int feedback_slot, LanguageMode language_mode) { |
+ Bytecode bytecode = BytecodeForLoadGlobal(language_mode); |
+ if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
+ Output(bytecode, static_cast<uint8_t>(name_index), |
+ static_cast<uint8_t>(feedback_slot)); |
+ } else { |
+ UNIMPLEMENTED(); |
+ } |
+ return *this; |
+} |
+ |
+ |
+BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal( |
+ size_t name_index, int feedback_slot, LanguageMode language_mode) { |
+ Bytecode bytecode = BytecodeForStoreGlobal(language_mode); |
+ if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
+ Output(bytecode, static_cast<uint8_t>(name_index), |
+ static_cast<uint8_t>(feedback_slot)); |
+ } else { |
+ UNIMPLEMENTED(); |
+ } |
+ return *this; |
+} |
+ |
+ |
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadContextSlot(Register context, |
int slot_index) { |
DCHECK(slot_index >= 0); |
@@ -291,10 +317,12 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreContextSlot(Register context, |
BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty( |
- Register object, int feedback_slot, LanguageMode language_mode) { |
+ Register object, size_t name_index, int feedback_slot, |
+ LanguageMode language_mode) { |
Bytecode bytecode = BytecodeForLoadIC(language_mode); |
- if (FitsInIdx8Operand(feedback_slot)) { |
- Output(bytecode, object.ToOperand(), static_cast<uint8_t>(feedback_slot)); |
+ if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
+ Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index), |
+ static_cast<uint8_t>(feedback_slot)); |
} else { |
UNIMPLEMENTED(); |
} |
@@ -315,11 +343,11 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty( |
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty( |
- Register object, Register name, int feedback_slot, |
+ Register object, size_t name_index, int feedback_slot, |
LanguageMode language_mode) { |
Bytecode bytecode = BytecodeForStoreIC(language_mode); |
- if (FitsInIdx8Operand(feedback_slot)) { |
- Output(bytecode, object.ToOperand(), name.ToOperand(), |
+ if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) { |
+ Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index), |
static_cast<uint8_t>(feedback_slot)); |
} else { |
UNIMPLEMENTED(); |
@@ -895,6 +923,40 @@ Bytecode BytecodeArrayBuilder::BytecodeForKeyedStoreIC( |
// static |
+Bytecode BytecodeArrayBuilder::BytecodeForLoadGlobal( |
+ LanguageMode language_mode) { |
+ switch (language_mode) { |
+ case SLOPPY: |
+ return Bytecode::kLdaGlobalSloppy; |
+ case STRICT: |
+ return Bytecode::kLdaGlobalStrict; |
+ case STRONG: |
+ UNIMPLEMENTED(); |
+ default: |
+ UNREACHABLE(); |
+ } |
+ return static_cast<Bytecode>(-1); |
+} |
+ |
+ |
+// static |
+Bytecode BytecodeArrayBuilder::BytecodeForStoreGlobal( |
+ LanguageMode language_mode) { |
+ switch (language_mode) { |
+ case SLOPPY: |
+ return Bytecode::kStaGlobalSloppy; |
+ case STRICT: |
+ return Bytecode::kStaGlobalStrict; |
+ case STRONG: |
+ UNIMPLEMENTED(); |
+ default: |
+ UNREACHABLE(); |
+ } |
+ return static_cast<Bytecode>(-1); |
+} |
+ |
+ |
+// static |
bool BytecodeArrayBuilder::FitsInIdx8Operand(int value) { |
return kMinUInt8 <= value && value <= kMaxUInt8; |
} |