// Type feedback information.
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
- bool IsMonomorphic() { return !receiver_type_.is_null(); }
Handle<Map> GetReceiverType() { return receiver_type_; }
bool IsCompileTimeValue();
void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
virtual bool IsMonomorphic() { return is_monomorphic_; }
virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
+
+ Handle<Map> GetReceiverType() {
+ return IsMonomorphic() ? GetReceiverTypes()->first() : Handle<Map>();
+ }
+
bool IsArrayLength() { return is_array_length_; }
bool IsUninitialized() { return is_uninitialized_; }
CHECK_ALIVE(VisitForValue(value));
HValue* value = Pop();
HInstruction* store;
- CHECK_ALIVE(store = BuildStoreNamed(literal, value, property));
+ CHECK_ALIVE(store = BuildStoreNamed(literal,
+ value,
+ property->GetReceiverType(),
+ property->key()));
AddInstruction(store);
if (store->HasObservableSideEffects()) AddSimulate(key->id());
} else {
HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object,
HValue* value,
- ObjectLiteral::Property* prop) {
- Literal* key = prop->key()->AsLiteral();
- Handle<String> name = Handle<String>::cast(key->handle());
+ Handle<Map> type,
+ Expression* key) {
+ Handle<String> name = Handle<String>::cast(key->AsLiteral()->handle());
ASSERT(!name.is_null());
LookupResult lookup(isolate());
- Handle<Map> type = prop->GetReceiverType();
- bool is_monomorphic = prop->IsMonomorphic() &&
+ bool is_monomorphic = !type.is_null() &&
ComputeLoadStoreField(type, name, &lookup, true);
return is_monomorphic
}
-HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object,
- HValue* value,
- Expression* expr) {
- Property* prop = (expr->AsProperty() != NULL)
- ? expr->AsProperty()
- : expr->AsAssignment()->target()->AsProperty();
- Literal* key = prop->key()->AsLiteral();
- Handle<String> name = Handle<String>::cast(key->handle());
- ASSERT(!name.is_null());
-
- LookupResult lookup(isolate());
- SmallMapList* types = expr->GetReceiverTypes();
- bool is_monomorphic = expr->IsMonomorphic() &&
- ComputeLoadStoreField(types->first(), name, &lookup, true);
-
- return is_monomorphic
- ? BuildStoreNamedField(object, name, value, types->first(), &lookup,
- true) // Needs smi and map check.
- : BuildStoreNamedGeneric(object, name, value);
-}
-
-
void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr,
HValue* object,
SmallMapList* types,
SmallMapList* types = expr->GetReceiverTypes();
if (expr->IsMonomorphic()) {
- CHECK_ALIVE(instr = BuildStoreNamed(object, value, expr));
+ CHECK(expr->AsProperty() == NULL);
+ Property* prop = expr->AsAssignment()->target()->AsProperty();
+ CHECK_ALIVE(instr = BuildStoreNamed(object,
+ value,
+ prop->GetReceiverType(),
+ prop->key()));
} else if (types != NULL && types->length() > 1) {
HandlePolymorphicStoreNamedField(expr, object, value, types, name);
if (instr->HasObservableSideEffects()) AddSimulate(operation->id());
HInstruction* store;
- CHECK_ALIVE(store = BuildStoreNamed(obj, instr, prop));
+ CHECK_ALIVE(store = BuildStoreNamed(obj,
+ instr,
+ prop->GetReceiverType(),
+ prop->key()));
AddInstruction(store);
// Drop the simulated receiver and value. Return the value.
Drop(2);
input = Pop();
HInstruction* store;
- CHECK_ALIVE(store = BuildStoreNamed(obj, after, prop));
+ CHECK_ALIVE(store = BuildStoreNamed(obj,
+ after,
+ prop->GetReceiverType(),
+ prop->key()));
AddInstruction(store);
// Overwrite the receiver in the bailout environment with the result