Commit f19aeae0 authored by verwaest@chromium.org's avatar verwaest@chromium.org

Unify BuildLoad/StoreNamedGeneric

R=dcarney@chromium.org

Review URL: https://codereview.chromium.org/155513008

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@19219 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 20b54eb2
...@@ -5071,7 +5071,8 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -5071,7 +5071,8 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
HInstruction* store; HInstruction* store;
if (map.is_null()) { if (map.is_null()) {
// If we don't know the monomorphic type, do a generic store. // If we don't know the monomorphic type, do a generic store.
CHECK_ALIVE(store = BuildStoreNamedGeneric(literal, name, value)); CHECK_ALIVE(store = BuildNamedGeneric(
STORE, literal, name, value));
} else { } else {
PropertyAccessInfo info(this, STORE, ToType(map), name); PropertyAccessInfo info(this, STORE, ToType(map), name);
if (info.CanAccessMonomorphic()) { if (info.CanAccessMonomorphic()) {
...@@ -5081,8 +5082,8 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { ...@@ -5081,8 +5082,8 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) {
&info, literal, checked_literal, value, &info, literal, checked_literal, value,
BailoutId::None(), BailoutId::None()); BailoutId::None(), BailoutId::None());
} else { } else {
CHECK_ALIVE( CHECK_ALIVE(store = BuildNamedGeneric(
store = BuildStoreNamedGeneric(literal, name, value)); STORE, literal, name, value));
} }
} }
AddInstruction(store); AddInstruction(store);
...@@ -5314,24 +5315,6 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField( ...@@ -5314,24 +5315,6 @@ HInstruction* HOptimizedGraphBuilder::BuildStoreNamedField(
} }
HInstruction* HOptimizedGraphBuilder::BuildStoreNamedGeneric(
HValue* object,
Handle<String> name,
HValue* value,
bool is_uninitialized) {
if (is_uninitialized) {
Add<HDeoptimize>("Insufficient type feedback for property assignment",
Deoptimizer::SOFT);
}
return New<HStoreNamedGeneric>(
object,
name,
value,
function_strict_mode_flag());
}
bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible( bool HOptimizedGraphBuilder::PropertyAccessInfo::IsCompatible(
PropertyAccessInfo* info) { PropertyAccessInfo* info) {
if (!CanInlinePropertyAccess(type_)) return false; if (!CanInlinePropertyAccess(type_)) return false;
...@@ -5709,28 +5692,11 @@ void HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess( ...@@ -5709,28 +5692,11 @@ void HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess(
// that the environment stack matches the depth on deopt that it otherwise // that the environment stack matches the depth on deopt that it otherwise
// would have had after a successful load. // would have had after a successful load.
if (!ast_context()->IsEffect()) Push(graph()->GetConstant0()); if (!ast_context()->IsEffect()) Push(graph()->GetConstant0());
const char* message = ""; FinishExitWithHardDeoptimization("Uknown map in polymorphic access", join);
switch (access_type) {
case LOAD:
message = "Unknown map in polymorphic load";
break;
case STORE:
message = "Unknown map in polymorphic store";
break;
}
FinishExitWithHardDeoptimization(message, join);
} else { } else {
HValue* result = NULL; HInstruction* instr = BuildNamedGeneric(access_type, object, name, value);
switch (access_type) { AddInstruction(instr);
case LOAD: if (!ast_context()->IsEffect()) Push(access_type == LOAD ? instr : value);
result = Add<HLoadNamedGeneric>(object, name);
break;
case STORE:
AddInstruction(BuildStoreNamedGeneric(object, name, value));
result = value;
break;
}
if (!ast_context()->IsEffect()) Push(result);
if (join != NULL) { if (join != NULL) {
Goto(join); Goto(join);
...@@ -6182,15 +6148,22 @@ HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) { ...@@ -6182,15 +6148,22 @@ HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) {
} }
HInstruction* HOptimizedGraphBuilder::BuildLoadNamedGeneric( HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric(
PropertyAccessType access_type,
HValue* object, HValue* object,
Handle<String> name, Handle<String> name,
HValue* value,
bool is_uninitialized) { bool is_uninitialized) {
if (is_uninitialized) { if (is_uninitialized) {
Add<HDeoptimize>("Insufficient type feedback for generic named load", Add<HDeoptimize>("Insufficient type feedback for generic named access",
Deoptimizer::SOFT); Deoptimizer::SOFT);
} }
if (access_type == LOAD) {
return New<HLoadNamedGeneric>(object, name); return New<HLoadNamedGeneric>(object, name);
} else {
return New<HStoreNamedGeneric>(
object, name, value, function_strict_mode_flag());
}
} }
...@@ -6636,11 +6609,7 @@ HInstruction* HOptimizedGraphBuilder::BuildNamedAccess( ...@@ -6636,11 +6609,7 @@ HInstruction* HOptimizedGraphBuilder::BuildNamedAccess(
&info, object, checked_object, value, ast_id, return_id); &info, object, checked_object, value, ast_id, return_id);
} }
if (access == LOAD) { return BuildNamedGeneric(access, object, name, value, is_uninitialized);
return BuildLoadNamedGeneric(object, name, is_uninitialized);
} else {
return BuildStoreNamedGeneric(object, name, value, is_uninitialized);
}
} }
...@@ -6992,8 +6961,8 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed( ...@@ -6992,8 +6961,8 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed(
FinishExitWithHardDeoptimization("Unknown map in polymorphic call", join); FinishExitWithHardDeoptimization("Unknown map in polymorphic call", join);
} else { } else {
Property* prop = expr->expression()->AsProperty(); Property* prop = expr->expression()->AsProperty();
HInstruction* function = BuildLoadNamedGeneric( HInstruction* function = BuildNamedGeneric(
receiver, name, prop->IsUninitialized()); LOAD, receiver, name, NULL, prop->IsUninitialized());
AddInstruction(function); AddInstruction(function);
Push(function); Push(function);
AddSimulate(prop->LoadId(), REMOVABLE_SIMULATE); AddSimulate(prop->LoadId(), REMOVABLE_SIMULATE);
......
...@@ -2474,8 +2474,10 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2474,8 +2474,10 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
bool is_store, bool is_store,
bool* has_side_effects); bool* has_side_effects);
HInstruction* BuildLoadNamedGeneric(HValue* object, HInstruction* BuildNamedGeneric(PropertyAccessType access,
HValue* object,
Handle<String> name, Handle<String> name,
HValue* value,
bool is_uninitialized = false); bool is_uninitialized = false);
HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map); HCheckMaps* AddCheckMap(HValue* object, Handle<Map> map);
...@@ -2503,10 +2505,6 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor { ...@@ -2503,10 +2505,6 @@ class HOptimizedGraphBuilder : public HGraphBuilder, public AstVisitor {
HInstruction* BuildStoreNamedField(PropertyAccessInfo* info, HInstruction* BuildStoreNamedField(PropertyAccessInfo* info,
HValue* checked_object, HValue* checked_object,
HValue* value); HValue* value);
HInstruction* BuildStoreNamedGeneric(HValue* object,
Handle<String> name,
HValue* value,
bool is_uninitialized = false);
HInstruction* BuildStoreKeyedGeneric(HValue* object, HInstruction* BuildStoreKeyedGeneric(HValue* object,
HValue* key, HValue* key,
HValue* value); HValue* value);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment