Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 8037c8d1bf67d484addadcd6ad3f51dfe848a2a5..f0d49a7434b0744c11a1d2263da6c946237b0a61 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -5071,7 +5071,8 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
HInstruction* store; |
if (map.is_null()) { |
// 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 { |
PropertyAccessInfo info(this, STORE, ToType(map), name); |
if (info.CanAccessMonomorphic()) { |
@@ -5081,8 +5082,8 @@ void HOptimizedGraphBuilder::VisitObjectLiteral(ObjectLiteral* expr) { |
&info, literal, checked_literal, value, |
BailoutId::None(), BailoutId::None()); |
} else { |
- CHECK_ALIVE( |
- store = BuildStoreNamedGeneric(literal, name, value)); |
+ CHECK_ALIVE(store = BuildNamedGeneric( |
+ STORE, literal, name, value)); |
} |
} |
AddInstruction(store); |
@@ -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( |
PropertyAccessInfo* info) { |
if (!CanInlinePropertyAccess(type_)) return false; |
@@ -5721,28 +5704,11 @@ void HOptimizedGraphBuilder::HandlePolymorphicNamedFieldAccess( |
// that the environment stack matches the depth on deopt that it otherwise |
// would have had after a successful load. |
if (!ast_context()->IsEffect()) Push(graph()->GetConstant0()); |
- const char* message = ""; |
- switch (access_type) { |
- case LOAD: |
- message = "Unknown map in polymorphic load"; |
- break; |
- case STORE: |
- message = "Unknown map in polymorphic store"; |
- break; |
- } |
- FinishExitWithHardDeoptimization(message, join); |
+ FinishExitWithHardDeoptimization("Uknown map in polymorphic access", join); |
} else { |
- HValue* result = NULL; |
- switch (access_type) { |
- case LOAD: |
- result = Add<HLoadNamedGeneric>(object, name); |
- break; |
- case STORE: |
- AddInstruction(BuildStoreNamedGeneric(object, name, value)); |
- result = value; |
- break; |
- } |
- if (!ast_context()->IsEffect()) Push(result); |
+ HInstruction* instr = BuildNamedGeneric(access_type, object, name, value); |
+ AddInstruction(instr); |
+ if (!ast_context()->IsEffect()) Push(access_type == LOAD ? instr : value); |
if (join != NULL) { |
Goto(join); |
@@ -6194,15 +6160,22 @@ HInstruction* HGraphBuilder::AddLoadStringLength(HValue* string) { |
} |
-HInstruction* HOptimizedGraphBuilder::BuildLoadNamedGeneric( |
+HInstruction* HOptimizedGraphBuilder::BuildNamedGeneric( |
+ PropertyAccessType access_type, |
HValue* object, |
Handle<String> name, |
+ HValue* value, |
bool 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); |
} |
- return New<HLoadNamedGeneric>(object, name); |
+ if (access_type == LOAD) { |
+ return New<HLoadNamedGeneric>(object, name); |
+ } else { |
+ return New<HStoreNamedGeneric>( |
+ object, name, value, function_strict_mode_flag()); |
+ } |
} |
@@ -6648,11 +6621,7 @@ HInstruction* HOptimizedGraphBuilder::BuildNamedAccess( |
&info, object, checked_object, value, ast_id, return_id); |
} |
- if (access == LOAD) { |
- return BuildLoadNamedGeneric(object, name, is_uninitialized); |
- } else { |
- return BuildStoreNamedGeneric(object, name, value, is_uninitialized); |
- } |
+ return BuildNamedGeneric(access, object, name, value, is_uninitialized); |
} |
@@ -7004,8 +6973,8 @@ void HOptimizedGraphBuilder::HandlePolymorphicCallNamed( |
FinishExitWithHardDeoptimization("Unknown map in polymorphic call", join); |
} else { |
Property* prop = expr->expression()->AsProperty(); |
- HInstruction* function = BuildLoadNamedGeneric( |
- receiver, name, prop->IsUninitialized()); |
+ HInstruction* function = BuildNamedGeneric( |
+ LOAD, receiver, name, NULL, prop->IsUninitialized()); |
AddInstruction(function); |
Push(function); |
AddSimulate(prop->LoadId(), REMOVABLE_SIMULATE); |