Revert "Removed one copy-n-paste clone of HGraphBuilder::BuildStoreNamed."
It inadvertently introduced some performance regressions, e.g. for the 'richards' benchmark. Review URL: https://chromiumcodereview.appspot.com/10704127 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@12023 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
parent
75407ae2b7
commit
5b69228e56
@ -1325,6 +1325,7 @@ class ObjectLiteral: public MaterializedLiteral {
|
|||||||
|
|
||||||
// Type feedback information.
|
// Type feedback information.
|
||||||
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
|
void RecordTypeFeedback(TypeFeedbackOracle* oracle);
|
||||||
|
bool IsMonomorphic() { return !receiver_type_.is_null(); }
|
||||||
Handle<Map> GetReceiverType() { return receiver_type_; }
|
Handle<Map> GetReceiverType() { return receiver_type_; }
|
||||||
|
|
||||||
bool IsCompileTimeValue();
|
bool IsCompileTimeValue();
|
||||||
@ -1528,11 +1529,6 @@ class Property: public Expression {
|
|||||||
void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
|
void RecordTypeFeedback(TypeFeedbackOracle* oracle, Zone* zone);
|
||||||
virtual bool IsMonomorphic() { return is_monomorphic_; }
|
virtual bool IsMonomorphic() { return is_monomorphic_; }
|
||||||
virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
|
virtual SmallMapList* GetReceiverTypes() { return &receiver_types_; }
|
||||||
|
|
||||||
Handle<Map> GetReceiverType() {
|
|
||||||
return IsMonomorphic() ? GetReceiverTypes()->first() : Handle<Map>();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsArrayLength() { return is_array_length_; }
|
bool IsArrayLength() { return is_array_length_; }
|
||||||
bool IsUninitialized() { return is_uninitialized_; }
|
bool IsUninitialized() { return is_uninitialized_; }
|
||||||
|
|
||||||
|
@ -4778,10 +4778,7 @@ void HGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
|
|||||||
CHECK_ALIVE(VisitForValue(value));
|
CHECK_ALIVE(VisitForValue(value));
|
||||||
HValue* value = Pop();
|
HValue* value = Pop();
|
||||||
HInstruction* store;
|
HInstruction* store;
|
||||||
CHECK_ALIVE(store = BuildStoreNamed(literal,
|
CHECK_ALIVE(store = BuildStoreNamed(literal, value, property));
|
||||||
value,
|
|
||||||
property->GetReceiverType(),
|
|
||||||
property->key()));
|
|
||||||
AddInstruction(store);
|
AddInstruction(store);
|
||||||
if (store->HasObservableSideEffects()) AddSimulate(key->id());
|
if (store->HasObservableSideEffects()) AddSimulate(key->id());
|
||||||
} else {
|
} else {
|
||||||
@ -5019,13 +5016,14 @@ HInstruction* HGraphBuilder::BuildStoreNamedGeneric(HValue* object,
|
|||||||
|
|
||||||
HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object,
|
HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object,
|
||||||
HValue* value,
|
HValue* value,
|
||||||
Handle<Map> type,
|
ObjectLiteral::Property* prop) {
|
||||||
Expression* key) {
|
Literal* key = prop->key()->AsLiteral();
|
||||||
Handle<String> name = Handle<String>::cast(key->AsLiteral()->handle());
|
Handle<String> name = Handle<String>::cast(key->handle());
|
||||||
ASSERT(!name.is_null());
|
ASSERT(!name.is_null());
|
||||||
|
|
||||||
LookupResult lookup(isolate());
|
LookupResult lookup(isolate());
|
||||||
bool is_monomorphic = !type.is_null() &&
|
Handle<Map> type = prop->GetReceiverType();
|
||||||
|
bool is_monomorphic = prop->IsMonomorphic() &&
|
||||||
ComputeLoadStoreField(type, name, &lookup, true);
|
ComputeLoadStoreField(type, name, &lookup, true);
|
||||||
|
|
||||||
return is_monomorphic
|
return is_monomorphic
|
||||||
@ -5035,6 +5033,28 @@ HInstruction* HGraphBuilder::BuildStoreNamed(HValue* object,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
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,
|
void HGraphBuilder::HandlePolymorphicLoadNamedField(Property* expr,
|
||||||
HValue* object,
|
HValue* object,
|
||||||
SmallMapList* types,
|
SmallMapList* types,
|
||||||
@ -5186,12 +5206,7 @@ void HGraphBuilder::HandlePropertyAssignment(Assignment* expr) {
|
|||||||
|
|
||||||
SmallMapList* types = expr->GetReceiverTypes();
|
SmallMapList* types = expr->GetReceiverTypes();
|
||||||
if (expr->IsMonomorphic()) {
|
if (expr->IsMonomorphic()) {
|
||||||
CHECK(expr->AsProperty() == NULL);
|
CHECK_ALIVE(instr = BuildStoreNamed(object, value, expr));
|
||||||
Property* prop = expr->AsAssignment()->target()->AsProperty();
|
|
||||||
CHECK_ALIVE(instr = BuildStoreNamed(object,
|
|
||||||
value,
|
|
||||||
prop->GetReceiverType(),
|
|
||||||
prop->key()));
|
|
||||||
|
|
||||||
} else if (types != NULL && types->length() > 1) {
|
} else if (types != NULL && types->length() > 1) {
|
||||||
HandlePolymorphicStoreNamedField(expr, object, value, types, name);
|
HandlePolymorphicStoreNamedField(expr, object, value, types, name);
|
||||||
@ -5371,10 +5386,7 @@ void HGraphBuilder::HandleCompoundAssignment(Assignment* expr) {
|
|||||||
if (instr->HasObservableSideEffects()) AddSimulate(operation->id());
|
if (instr->HasObservableSideEffects()) AddSimulate(operation->id());
|
||||||
|
|
||||||
HInstruction* store;
|
HInstruction* store;
|
||||||
CHECK_ALIVE(store = BuildStoreNamed(obj,
|
CHECK_ALIVE(store = BuildStoreNamed(obj, instr, prop));
|
||||||
instr,
|
|
||||||
prop->GetReceiverType(),
|
|
||||||
prop->key()));
|
|
||||||
AddInstruction(store);
|
AddInstruction(store);
|
||||||
// Drop the simulated receiver and value. Return the value.
|
// Drop the simulated receiver and value. Return the value.
|
||||||
Drop(2);
|
Drop(2);
|
||||||
@ -7775,10 +7787,7 @@ void HGraphBuilder::VisitCountOperation(CountOperation* expr) {
|
|||||||
input = Pop();
|
input = Pop();
|
||||||
|
|
||||||
HInstruction* store;
|
HInstruction* store;
|
||||||
CHECK_ALIVE(store = BuildStoreNamed(obj,
|
CHECK_ALIVE(store = BuildStoreNamed(obj, after, prop));
|
||||||
after,
|
|
||||||
prop->GetReceiverType(),
|
|
||||||
prop->key()));
|
|
||||||
AddInstruction(store);
|
AddInstruction(store);
|
||||||
|
|
||||||
// Overwrite the receiver in the bailout environment with the result
|
// Overwrite the receiver in the bailout environment with the result
|
||||||
|
@ -1149,8 +1149,10 @@ class HGraphBuilder: public AstVisitor {
|
|||||||
Handle<String> name);
|
Handle<String> name);
|
||||||
HInstruction* BuildStoreNamed(HValue* object,
|
HInstruction* BuildStoreNamed(HValue* object,
|
||||||
HValue* value,
|
HValue* value,
|
||||||
Handle<Map> type,
|
Expression* expr);
|
||||||
Expression* key);
|
HInstruction* BuildStoreNamed(HValue* object,
|
||||||
|
HValue* value,
|
||||||
|
ObjectLiteral::Property* prop);
|
||||||
HInstruction* BuildStoreNamedField(HValue* object,
|
HInstruction* BuildStoreNamedField(HValue* object,
|
||||||
Handle<String> name,
|
Handle<String> name,
|
||||||
HValue* value,
|
HValue* value,
|
||||||
|
Loading…
Reference in New Issue
Block a user