Index: src/ia32/full-codegen-ia32.cc |
diff --git a/src/ia32/full-codegen-ia32.cc b/src/ia32/full-codegen-ia32.cc |
index 030e6f6265f87040bf9218549a803c636416a826..7a533cbf39652d5b87a26a6bfe52a832b25ec7fa 100644 |
--- a/src/ia32/full-codegen-ia32.cc |
+++ b/src/ia32/full-codegen-ia32.cc |
@@ -1600,8 +1600,7 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
: ObjectLiteral::kNoFlags; |
int properties_count = constant_properties->length() / 2; |
if (expr->may_store_doubles() || expr->depth() > 1 || |
- masm()->serializer_enabled() || |
- flags != ObjectLiteral::kFastElements || |
+ masm()->serializer_enabled() || flags != ObjectLiteral::kFastElements || |
properties_count > FastCloneShallowObjectStub::kMaximumClonedProperties) { |
__ mov(edi, Operand(ebp, JavaScriptFrameConstants::kFunctionOffset)); |
__ push(FieldOperand(edi, JSFunction::kLiteralsOffset)); |
@@ -1629,11 +1628,18 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
expr->CalculateEmitStore(zone()); |
AccessorTable accessor_table(zone()); |
+ bool has_seen_computed_name = false; |
for (int i = 0; i < expr->properties()->length(); i++) { |
ObjectLiteral::Property* property = expr->properties()->at(i); |
- if (property->IsCompileTimeValue()) continue; |
- Literal* key = property->key(); |
+ if (!has_seen_computed_name && property->IsCompileTimeValue()) { |
+ continue; |
+ } |
+ if (property->kind() == ObjectLiteral::Property::COMPUTED_NAME) { |
+ has_seen_computed_name = true; |
+ } |
+ |
+ Literal* literal_key = property->key()->AsLiteral(); |
Expression* value = property->value(); |
if (!result_saved) { |
__ push(eax); // Save result on the stack |
@@ -1641,25 +1647,29 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
} |
switch (property->kind()) { |
case ObjectLiteral::Property::CONSTANT: |
- UNREACHABLE(); |
+ ASSERT(has_seen_computed_name); |
+ // Fall through. |
case ObjectLiteral::Property::MATERIALIZED_LITERAL: |
- ASSERT(!CompileTimeValue::IsCompileTimeValue(value)); |
+ ASSERT(has_seen_computed_name || |
+ !CompileTimeValue::IsCompileTimeValue(value)); |
// Fall through. |
case ObjectLiteral::Property::COMPUTED: |
- if (key->value()->IsInternalizedString()) { |
+ if (literal_key->value()->IsInternalizedString()) { |
if (property->emit_store()) { |
VisitForAccumulatorValue(value); |
- __ mov(ecx, Immediate(key->value())); |
+ __ mov(ecx, Immediate(literal_key->value())); |
__ mov(edx, Operand(esp, 0)); |
- CallStoreIC(key->LiteralFeedbackId()); |
- PrepareForBailoutForId(key->id(), NO_REGISTERS); |
+ CallStoreIC(literal_key->LiteralFeedbackId()); |
+ PrepareForBailoutForId(literal_key->id(), NO_REGISTERS); |
} else { |
VisitForEffect(value); |
} |
break; |
} |
+ // Fall through. |
+ case ObjectLiteral::Property::COMPUTED_NAME: |
__ push(Operand(esp, 0)); // Duplicate receiver. |
- VisitForStackValue(key); |
+ VisitForStackValue(property->key()); |
VisitForStackValue(value); |
if (property->emit_store()) { |
__ push(Immediate(Smi::FromInt(NONE))); // PropertyAttributes |
@@ -1678,10 +1688,10 @@ void FullCodeGenerator::VisitObjectLiteral(ObjectLiteral* expr) { |
} |
break; |
case ObjectLiteral::Property::GETTER: |
- accessor_table.lookup(key)->second->getter = value; |
+ accessor_table.lookup(literal_key)->second->getter = value; |
break; |
case ObjectLiteral::Property::SETTER: |
- accessor_table.lookup(key)->second->setter = value; |
+ accessor_table.lookup(literal_key)->second->setter = value; |
break; |
} |
} |