Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 6a7b6098cb8537d747f2ce674e41e56fdd0f0c7c..943d50511b8b5948eaa76ded3a46431011ae822b 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -3738,18 +3738,13 @@ void HGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
case ObjectLiteral::Property::COMPUTED: |
if (key->handle()->IsSymbol()) { |
if (property->emit_store()) { |
+ property->RecordTypeFeedback(oracle()); |
CHECK_ALIVE(VisitForValue(value)); |
HValue* value = Pop(); |
Handle<String> name = Handle<String>::cast(key->handle()); |
- HStoreNamedGeneric* store = |
- new(zone()) HStoreNamedGeneric( |
- context, |
- literal, |
- name, |
- value, |
- function_strict_mode_flag()); |
+ HInstruction* store = BuildStoreNamed(literal, value, property); |
AddInstruction(store); |
- AddSimulate(key->id()); |
+ if (store->HasObservableSideEffects()) AddSimulate(key->id()); |
} else { |
CHECK_ALIVE(VisitForEffect(value)); |
} |
@@ -3954,6 +3949,25 @@ HInstruction* HGraphBuilder::BuildStoreNamedGeneric(HValue* object, |
HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object, |
HValue* value, |
+ ObjectLiteral::Property* prop) { |
+ Literal* key = prop->key()->AsLiteral(); |
+ Handle<String> name = Handle<String>::cast(key->handle()); |
+ ASSERT(!name.is_null()); |
+ |
+ LookupResult lookup(isolate()); |
+ Handle<Map> type = prop->GetReceiverType(); |
+ bool is_monomorphic = prop->IsMonomorphic() && |
+ ComputeStoredField(type, name, &lookup); |
+ |
+ return is_monomorphic |
+ ? BuildStoreNamedField(object, name, value, type, &lookup, |
+ true) // Needs smi and map check. |
+ : BuildStoreNamedGeneric(object, name, value); |
+} |
+ |
+ |
+HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object, |
+ HValue* value, |
Expression* expr) { |
Property* prop = (expr->AsProperty() != NULL) |
? expr->AsProperty() |