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

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

Issue 1503963002: [Interpreter] Adds wide variant of CreateLiterals. Adds CreateLiterals to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: renamed BuildLiteral to BuildCreateLiteral. Created 5 years 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.cc » ('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 594d8faa25e02dec182eae96e94f802eaa01dd58..01297d35ac0c2bbe9a8af5c795d4ba9cf3c12ce0 100644
--- a/src/interpreter/bytecode-array-builder.cc
+++ b/src/interpreter/bytecode-array-builder.cc
@@ -529,11 +529,17 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArguments(
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral(
- int literal_index, int flags) {
+ Handle<String> pattern, int literal_index, int flags) {
DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits.
- if (FitsInIdx8Operand(literal_index)) {
- Output(Bytecode::kCreateRegExpLiteral, static_cast<uint8_t>(literal_index),
- static_cast<uint8_t>(flags));
+ size_t pattern_entry = GetConstantPoolEntry(pattern);
+ if (FitsInIdx8Operand(literal_index) && FitsInIdx8Operand(pattern_entry)) {
+ Output(Bytecode::kCreateRegExpLiteral, static_cast<uint8_t>(pattern_entry),
+ static_cast<uint8_t>(literal_index), static_cast<uint8_t>(flags));
+ } else if (FitsInIdx16Operand(literal_index) &&
+ FitsInIdx16Operand(pattern_entry)) {
+ Output(Bytecode::kCreateRegExpLiteralWide,
+ static_cast<uint16_t>(pattern_entry),
+ static_cast<uint16_t>(literal_index), static_cast<uint8_t>(flags));
} else {
UNIMPLEMENTED();
}
@@ -542,11 +548,19 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateRegExpLiteral(
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArrayLiteral(
- int literal_index, int flags) {
+ Handle<FixedArray> constant_elements, int literal_index, int flags) {
DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits.
- if (FitsInIdx8Operand(literal_index)) {
- Output(Bytecode::kCreateArrayLiteral, static_cast<uint8_t>(literal_index),
- static_cast<uint8_t>(flags));
+ size_t constant_elements_entry = GetConstantPoolEntry(constant_elements);
+ if (FitsInIdx8Operand(literal_index) &&
+ FitsInIdx8Operand(constant_elements_entry)) {
+ Output(Bytecode::kCreateArrayLiteral,
+ static_cast<uint8_t>(constant_elements_entry),
+ static_cast<uint8_t>(literal_index), static_cast<uint8_t>(flags));
+ } else if (FitsInIdx16Operand(literal_index) &&
+ FitsInIdx16Operand(constant_elements_entry)) {
+ Output(Bytecode::kCreateArrayLiteralWide,
+ static_cast<uint16_t>(constant_elements_entry),
+ static_cast<uint16_t>(literal_index), static_cast<uint8_t>(flags));
} else {
UNIMPLEMENTED();
}
@@ -555,11 +569,19 @@ BytecodeArrayBuilder& BytecodeArrayBuilder::CreateArrayLiteral(
BytecodeArrayBuilder& BytecodeArrayBuilder::CreateObjectLiteral(
- int literal_index, int flags) {
+ Handle<FixedArray> constant_properties, int literal_index, int flags) {
DCHECK(FitsInImm8Operand(flags)); // Flags should fit in 8 bits.
- if (FitsInIdx8Operand(literal_index)) {
- Output(Bytecode::kCreateObjectLiteral, static_cast<uint8_t>(literal_index),
- static_cast<uint8_t>(flags));
+ size_t constant_properties_entry = GetConstantPoolEntry(constant_properties);
+ if (FitsInIdx8Operand(literal_index) &&
+ FitsInIdx8Operand(constant_properties_entry)) {
+ Output(Bytecode::kCreateObjectLiteral,
+ static_cast<uint8_t>(constant_properties_entry),
+ static_cast<uint8_t>(literal_index), static_cast<uint8_t>(flags));
+ } else if (FitsInIdx16Operand(literal_index) &&
+ FitsInIdx16Operand(constant_properties_entry)) {
+ Output(Bytecode::kCreateObjectLiteralWide,
+ static_cast<uint16_t>(constant_properties_entry),
+ static_cast<uint16_t>(literal_index), static_cast<uint8_t>(flags));
} else {
UNIMPLEMENTED();
}
« no previous file with comments | « src/interpreter/bytecode-array-builder.h ('k') | src/interpreter/bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698