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

Unified Diff: src/interpreter/bytecode-generator.cc

Issue 1546643002: [Interpreter] Updates load/store global and named property to accept variable name. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: 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.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/interpreter/bytecode-generator.cc
diff --git a/src/interpreter/bytecode-generator.cc b/src/interpreter/bytecode-generator.cc
index 35739f2889c4caa9eaa6020298b4815c29a12b1a..751acdf0c287c5241c5c3a526fabac7baa3695ba 100644
--- a/src/interpreter/bytecode-generator.cc
+++ b/src/interpreter/bytecode-generator.cc
@@ -844,9 +844,8 @@ void BytecodeGenerator::VisitForInAssignment(Expression* expr,
Register value = temporary_register_scope.NewRegister();
builder()->StoreAccumulatorInRegister(value);
Register object = VisitForRegisterValue(property->obj());
- size_t name_index = builder()->GetConstantPoolEntry(
- property->key()->AsLiteral()->AsPropertyName());
- builder()->StoreNamedProperty(object, name_index, feedback_index(slot),
+ Handle<String> name = property->key()->AsLiteral()->AsPropertyName();
+ builder()->StoreNamedProperty(object, name, feedback_index(slot),
language_mode());
break;
}
@@ -1064,12 +1063,10 @@ void BytecodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
// contains computed properties with an uninitialized value.
if (literal_key->value()->IsInternalizedString()) {
if (property->emit_store()) {
- size_t name_index =
- builder()->GetConstantPoolEntry(literal_key->AsPropertyName());
VisitForAccumulatorValue(property->value());
- builder()->StoreNamedProperty(literal, name_index,
- feedback_index(property->GetSlot(0)),
- language_mode());
+ builder()->StoreNamedProperty(
+ literal, literal_key->AsPropertyName(),
+ feedback_index(property->GetSlot(0)), language_mode());
} else {
VisitForEffect(property->value());
}
@@ -1291,9 +1288,8 @@ void BytecodeGenerator::VisitVariableLoad(Variable* variable,
}
case VariableLocation::GLOBAL:
case VariableLocation::UNALLOCATED: {
- size_t name_index = builder()->GetConstantPoolEntry(variable->name());
- builder()->LoadGlobal(name_index, feedback_index(slot), language_mode(),
- typeof_mode);
+ builder()->LoadGlobal(variable->name(), feedback_index(slot),
+ language_mode(), typeof_mode);
execution_result()->SetResultInAccumulator();
break;
}
@@ -1372,8 +1368,8 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
}
case VariableLocation::GLOBAL:
case VariableLocation::UNALLOCATED: {
- size_t name_index = builder()->GetConstantPoolEntry(variable->name());
- builder()->StoreGlobal(name_index, feedback_index(slot), language_mode());
+ builder()->StoreGlobal(variable->name(), feedback_index(slot),
+ language_mode());
break;
}
case VariableLocation::CONTEXT: {
@@ -1416,7 +1412,7 @@ void BytecodeGenerator::VisitVariableAssignment(Variable* variable,
void BytecodeGenerator::VisitAssignment(Assignment* expr) {
DCHECK(expr->target()->IsValidReferenceExpression());
Register object, key;
- size_t name_index = kMaxUInt32;
+ Handle<String> name;
// Left-hand side can only be a property, a global or a variable slot.
Property* property = expr->target()->AsProperty();
@@ -1429,8 +1425,7 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
break;
case NAMED_PROPERTY: {
object = VisitForRegisterValue(property->obj());
- name_index = builder()->GetConstantPoolEntry(
- property->key()->AsLiteral()->AsPropertyName());
+ name = property->key()->AsLiteral()->AsPropertyName();
break;
}
case KEYED_PROPERTY: {
@@ -1466,7 +1461,7 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
FeedbackVectorSlot slot = property->PropertyFeedbackSlot();
old_value = execution_result()->NewRegister();
builder()
- ->LoadNamedProperty(object, name_index, feedback_index(slot),
+ ->LoadNamedProperty(object, name, feedback_index(slot),
language_mode())
.StoreAccumulatorInRegister(old_value);
break;
@@ -1504,7 +1499,7 @@ void BytecodeGenerator::VisitAssignment(Assignment* expr) {
break;
}
case NAMED_PROPERTY:
- builder()->StoreNamedProperty(object, name_index, feedback_index(slot),
+ builder()->StoreNamedProperty(object, name, feedback_index(slot),
language_mode());
break;
case KEYED_PROPERTY:
@@ -1535,10 +1530,9 @@ void BytecodeGenerator::VisitPropertyLoad(Register obj, Property* expr) {
case VARIABLE:
UNREACHABLE();
case NAMED_PROPERTY: {
- size_t name_index = builder()->GetConstantPoolEntry(
- expr->key()->AsLiteral()->AsPropertyName());
- builder()->LoadNamedProperty(obj, name_index, feedback_index(slot),
- language_mode());
+ builder()->LoadNamedProperty(obj,
+ expr->key()->AsLiteral()->AsPropertyName(),
+ feedback_index(slot), language_mode());
break;
}
case KEYED_PROPERTY: {
@@ -1824,7 +1818,7 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
// Evaluate LHS expression and get old value.
Register obj, key, old_value;
- size_t name_index = kMaxUInt32;
+ Handle<String> name;
switch (assign_type) {
case VARIABLE: {
VariableProxy* proxy = expr->expression()->AsVariableProxy();
@@ -1835,9 +1829,8 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
case NAMED_PROPERTY: {
FeedbackVectorSlot slot = property->PropertyFeedbackSlot();
obj = VisitForRegisterValue(property->obj());
- name_index = builder()->GetConstantPoolEntry(
- property->key()->AsLiteral()->AsPropertyName());
- builder()->LoadNamedProperty(obj, name_index, feedback_index(slot),
+ name = property->key()->AsLiteral()->AsPropertyName();
+ builder()->LoadNamedProperty(obj, name, feedback_index(slot),
language_mode());
break;
}
@@ -1880,8 +1873,8 @@ void BytecodeGenerator::VisitCountOperation(CountOperation* expr) {
break;
}
case NAMED_PROPERTY: {
- builder()->StoreNamedProperty(
- obj, name_index, feedback_index(feedback_slot), language_mode());
+ builder()->StoreNamedProperty(obj, name, feedback_index(feedback_slot),
+ language_mode());
break;
}
case KEYED_PROPERTY: {
« no previous file with comments | « src/interpreter/bytecode-array-builder.cc ('k') | test/cctest/interpreter/test-bytecode-generator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698