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

Unified Diff: src/interpreter/bytecode-array-builder.cc

Issue 1413863010: [Interpreter] Add wide varients of bytecodes with feedback and constant pool indexes. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@int_fixbuiltinstacklimit
Patch Set: Rebased 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/bytecodes.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 7575663e0f2eda417194f89d7aeaf39b68a3623e..9be1f0ec908ca094e62259e80ff4e16843e5d9c5 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -224,6 +224,8 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadLiteral(Handle<Object> object) {
size_t entry = GetConstantPoolEntry(object);
if (FitsInIdx8Operand(entry)) {
Output(Bytecode::kLdaConstant, static_cast<uint8_t>(entry));
+ } else if (FitsInIdx16Operand(entry)) {
+ Output(Bytecode::kLdaConstantWide, static_cast<uint16_t>(entry));
} else {
UNIMPLEMENTED();
}
@@ -285,6 +287,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadGlobal(
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
+ } else if (FitsInIdx16Operand(name_index) &&
+ FitsInIdx16Operand(feedback_slot)) {
+ Output(BytecodeForWideOperands(bytecode), static_cast<uint16_t>(name_index),
+ static_cast<uint16_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
@@ -298,6 +304,10 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreGlobal(
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
+ } else if (FitsInIdx16Operand(name_index) &&
+ FitsInIdx16Operand(feedback_slot)) {
+ Output(BytecodeForWideOperands(bytecode), static_cast<uint16_t>(name_index),
+ static_cast<uint16_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
@@ -338,6 +348,11 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadNamedProperty(
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
+ } else if (FitsInIdx16Operand(name_index) &&
+ FitsInIdx16Operand(feedback_slot)) {
+ Output(BytecodeForWideOperands(bytecode), object.ToOperand(),
+ static_cast<uint16_t>(name_index),
+ static_cast<uint16_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
@@ -350,6 +365,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::LoadKeyedProperty(
Bytecode bytecode = BytecodeForKeyedLoadIC(language_mode);
if (FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, object.ToOperand(), static_cast<uint8_t>(feedback_slot));
+ } else if (FitsInIdx16Operand(feedback_slot)) {
+ Output(BytecodeForWideOperands(bytecode), object.ToOperand(),
+ static_cast<uint16_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
@@ -364,6 +382,11 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreNamedProperty(
if (FitsInIdx8Operand(name_index) && FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, object.ToOperand(), static_cast<uint8_t>(name_index),
static_cast<uint8_t>(feedback_slot));
+ } else if (FitsInIdx16Operand(name_index) &&
+ FitsInIdx16Operand(feedback_slot)) {
+ Output(BytecodeForWideOperands(bytecode), object.ToOperand(),
+ static_cast<uint16_t>(name_index),
+ static_cast<uint16_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
@@ -378,6 +401,9 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::StoreKeyedProperty(
if (FitsInIdx8Operand(feedback_slot)) {
Output(bytecode, object.ToOperand(), key.ToOperand(),
static_cast<uint8_t>(feedback_slot));
+ } else if (FitsInIdx16Operand(feedback_slot)) {
+ Output(BytecodeForWideOperands(bytecode), object.ToOperand(),
+ key.ToOperand(), static_cast<uint16_t>(feedback_slot));
} else {
UNIMPLEMENTED();
}
@@ -952,6 +978,40 @@ Bytecode BytecodeArrayBuilder::BytecodeForCompareOperation(Token::Value op) {
// static
+Bytecode BytecodeArrayBuilder::BytecodeForWideOperands(Bytecode bytecode) {
+ switch (bytecode) {
+ case Bytecode::kLoadICSloppy:
+ return Bytecode::kLoadICSloppyWide;
+ case Bytecode::kLoadICStrict:
+ return Bytecode::kLoadICStrictWide;
+ case Bytecode::kKeyedLoadICSloppy:
+ return Bytecode::kKeyedLoadICSloppyWide;
+ case Bytecode::kKeyedLoadICStrict:
+ return Bytecode::kKeyedLoadICStrictWide;
+ case Bytecode::kStoreICSloppy:
+ return Bytecode::kStoreICSloppyWide;
+ case Bytecode::kStoreICStrict:
+ return Bytecode::kStoreICStrictWide;
+ case Bytecode::kKeyedStoreICSloppy:
+ return Bytecode::kKeyedStoreICSloppyWide;
+ case Bytecode::kKeyedStoreICStrict:
+ return Bytecode::kKeyedStoreICStrictWide;
+ case Bytecode::kLdaGlobalSloppy:
+ return Bytecode::kLdaGlobalSloppyWide;
+ case Bytecode::kLdaGlobalStrict:
+ return Bytecode::kLdaGlobalStrictWide;
+ case Bytecode::kStaGlobalSloppy:
+ return Bytecode::kStaGlobalSloppyWide;
+ case Bytecode::kStaGlobalStrict:
+ return Bytecode::kStaGlobalStrictWide;
+ default:
+ UNREACHABLE();
+ return static_cast<Bytecode>(-1);
+ }
+}
+
+
+// static
Bytecode BytecodeArrayBuilder::BytecodeForLoadIC(LanguageMode language_mode) {
switch (language_mode) {
case SLOPPY:
@@ -1106,6 +1166,12 @@ bool BytecodeArrayBuilder::FitsInIdx16Operand(int value) {
}
+// static
+bool BytecodeArrayBuilder::FitsInIdx16Operand(size_t value) {
+ return value <= static_cast<size_t>(kMaxUInt16);
+}
+
+
TemporaryRegisterScope::TemporaryRegisterScope(BytecodeArrayBuilder* builder)
: builder_(builder),
allocated_(builder->zone()),
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecodes.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698