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

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: 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
Index: src/interpreter/bytecode-array-builder.cc
diff --git a/src/interpreter/bytecode-array-builder.cc b/src/interpreter/bytecode-array-builder.cc
index 1e7f824a4a97e349a98fb8e43f5877456f66ba0f..a41d332a307db4f2e6e57d1bde2f6fcb3873f996 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -264,10 +264,12 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreAccumulatorInRegister(
}
-BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(int slot_index) {
- DCHECK(slot_index >= 0);
- if (FitsInIdx8Operand(slot_index)) {
- Output(Bytecode::kLdaGlobal, static_cast<uint8_t>(slot_index));
+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();
}
@@ -276,11 +278,11 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(int slot_index) {
BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
- int slot_index, LanguageMode language_mode) {
- DCHECK(slot_index >= 0);
+ size_t name_index, int feedback_slot, LanguageMode language_mode) {
Bytecode bytecode = BytecodeForStoreGlobal(language_mode);
- if (FitsInIdx8Operand(slot_index)) {
- Output(bytecode, static_cast<uint8_t>(slot_index));
+ if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
+ Output(bytecode, static_cast<uint8_t>(name_index),
+ static_cast<uint8_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
@@ -315,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();
}
@@ -339,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();
@@ -919,6 +923,23 @@ Bytecode BytecodeArrayBuilder::BytecodeForKeyedStoreIC(
// static
+Bytecode BytecodeArrayBuilder::BytecodeForLoadGlobal(
Igor Sheludko 2015/10/22 09:58:36 It would be necessary to also propagate a TypeofMo
rmcilroy 2015/10/22 10:13:20 What does TypeofMode get used for, I can't see it
rmcilroy 2015/10/22 13:27:48 Added a TODO in BytecodeGenerator VisitTypeOf for
Igor Sheludko 2015/11/03 17:52:56 See LoadIC::ShoudlThrowReferenceError(). Referenci
rmcilroy 2015/11/03 18:26:12 Yeah, I figured this out and landed the fix in htt
+ 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) {

Powered by Google App Engine
This is Rietveld 408576698