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

Unified Diff: src/interpreter/bytecode-array-builder.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/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
}
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698