[fullcodegen] Remove non-"static" part in VisitArrayLiteral functions.

The loop for non-"static" properties is no longer needed in
full-codegen since all computed property
names in object literals go through Ignition first.

BUG=v8:5657

Review-Url: https://codereview.chromium.org/2547433003
Cr-Commit-Position: refs/heads/master@{#41428}
This commit is contained in:
franzih 2016-12-01 05:35:56 -08:00 committed by Commit bot
parent 4292f32ed3
commit 51b32c468b
11 changed files with 61 additions and 580 deletions

View File

@ -1443,18 +1443,11 @@ class ObjectLiteral final : public MaterializedLiteral {
BailoutId CreateLiteralId() const { return BailoutId(local_id(0)); }
// Return an AST id for a property that is used in simulate instructions.
BailoutId GetIdForPropertyName(int i) {
return BailoutId(local_id(2 * i + 1));
}
BailoutId GetIdForPropertySet(int i) {
return BailoutId(local_id(2 * i + 2));
}
BailoutId GetIdForPropertySet(int i) { return BailoutId(local_id(i + 1)); }
// Unlike other AST nodes, this number of bailout IDs allocated for an
// ObjectLiteral can vary, so num_ids() is not a static method.
int num_ids() const {
return parent_num_ids() + 1 + 2 * properties()->length();
}
int num_ids() const { return parent_num_ids() + 1 + properties()->length(); }
// Object literals need one feedback slot for each non-trivial value, as well
// as some slots for home objects.

View File

@ -1372,10 +1372,9 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
environment()->Push(literal);
// Create nodes to store computed values into the literal.
int property_index = 0;
AccessorTable accessor_table(local_zone());
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
@ -1433,21 +1432,20 @@ void AstGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
javascript()->CallRuntime(Runtime::kInternalSetPrototype);
Node* set_prototype = NewNode(op, receiver, value);
// SetPrototype should not lazy deopt on an object literal.
PrepareFrameState(set_prototype,
expr->GetIdForPropertySet(property_index));
PrepareFrameState(set_prototype, expr->GetIdForPropertySet(i));
break;
}
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;

View File

@ -1225,10 +1225,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1286,21 +1285,21 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1323,62 +1322,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(r0); // Save result on the stack
result_saved = true;
}
__ ldr(r0, MemOperand(sp)); // Duplicate receiver.
PushOperand(r0);
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1212,10 +1212,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1272,20 +1271,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PushOperand(x0);
VisitForStackValue(value);
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1308,62 +1307,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(x0); // Save result on stack
result_saved = true;
}
__ Peek(x10, 0); // Duplicate receiver.
PushOperand(x10);
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1156,10 +1156,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1211,20 +1210,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1247,61 +1246,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(eax); // Save result on the stack
result_saved = true;
}
PushOperand(Operand(esp, 0)); // Duplicate receiver.
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1224,10 +1224,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1286,20 +1285,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1322,62 +1321,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(v0); // Save result on the stack
result_saved = true;
}
__ lw(a0, MemOperand(sp)); // Duplicate receiver.
PushOperand(a0);
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1226,10 +1226,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1288,20 +1287,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1324,62 +1323,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(v0); // Save result on the stack
result_saved = true;
}
__ ld(a0, MemOperand(sp)); // Duplicate receiver.
PushOperand(a0);
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1196,10 +1196,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1257,20 +1256,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1292,62 +1291,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(r3); // Save result on the stack
result_saved = true;
}
__ LoadP(r3, MemOperand(sp)); // Duplicate receiver.
PushOperand(r3);
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1159,10 +1159,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1220,20 +1219,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1255,62 +1254,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(r2); // Save result on the stack
result_saved = true;
}
__ LoadP(r2, MemOperand(sp)); // Duplicate receiver.
PushOperand(r2);
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1185,10 +1185,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1241,20 +1240,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1275,61 +1274,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(rax); // Save result on the stack
result_saved = true;
}
PushOperand(Operand(rsp, 0)); // Duplicate receiver.
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {

View File

@ -1148,10 +1148,9 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
bool result_saved = false;
AccessorTable accessor_table(zone());
int property_index = 0;
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
if (property->is_computed_name()) break;
for (int i = 0; i < expr->properties()->length(); i++) {
ObjectLiteral::Property* property = expr->properties()->at(i);
DCHECK(!property->is_computed_name());
if (property->IsCompileTimeValue()) continue;
Literal* key = property->key()->AsLiteral();
@ -1203,20 +1202,20 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
PrepareForBailoutForId(expr->GetIdForPropertySet(i),
BailoutState::NO_REGISTERS);
break;
case ObjectLiteral::Property::GETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->getter = property;
}
break;
case ObjectLiteral::Property::SETTER:
if (property->emit_store()) {
AccessorTable::Iterator it = accessor_table.lookup(key);
it->second->bailout_id = expr->GetIdForPropertySet(property_index);
it->second->bailout_id = expr->GetIdForPropertySet(i);
it->second->setter = property;
}
break;
@ -1239,61 +1238,6 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) {
PrepareForBailoutForId(it->second->bailout_id, BailoutState::NO_REGISTERS);
}
// Object literals have two parts. The "static" part on the left contains no
// computed property names, and so we can compute its map ahead of time; see
// runtime.cc::CreateObjectLiteralBoilerplate. The second "dynamic" part
// starts with the first computed property name, and continues with all
// properties to its right. All the code from above initializes the static
// component of the object literal, and arranges for the map of the result to
// reflect the static order in which the keys appear. For the dynamic
// properties, we compile them into a series of "SetOwnProperty" runtime
// calls. This will preserve insertion order.
for (; property_index < expr->properties()->length(); property_index++) {
ObjectLiteral::Property* property = expr->properties()->at(property_index);
Expression* value = property->value();
if (!result_saved) {
PushOperand(eax); // Save result on the stack
result_saved = true;
}
PushOperand(Operand(esp, 0)); // Duplicate receiver.
if (property->kind() == ObjectLiteral::Property::PROTOTYPE) {
DCHECK(!property->is_computed_name());
VisitForStackValue(value);
DCHECK(property->emit_store());
CallRuntimeWithOperands(Runtime::kInternalSetPrototype);
PrepareForBailoutForId(expr->GetIdForPropertySet(property_index),
BailoutState::NO_REGISTERS);
} else {
EmitPropertyKey(property, expr->GetIdForPropertyName(property_index));
VisitForStackValue(value);
if (NeedsHomeObject(value)) {
EmitSetHomeObject(value, 2, property->GetSlot());
}
switch (property->kind()) {
case ObjectLiteral::Property::CONSTANT:
case ObjectLiteral::Property::MATERIALIZED_LITERAL:
case ObjectLiteral::Property::COMPUTED:
case ObjectLiteral::Property::PROTOTYPE:
UNREACHABLE();
break;
case ObjectLiteral::Property::GETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineGetterPropertyUnchecked);
break;
case ObjectLiteral::Property::SETTER:
PushOperand(Smi::FromInt(NONE));
CallRuntimeWithOperands(Runtime::kDefineSetterPropertyUnchecked);
break;
}
}
}
if (result_saved) {
context()->PlugTOS();
} else {