Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 675b61155ba937a9c518bfb5cd16cbfa3be39306..10fcdeb6fbf5d7cd87ac8a03ce678ecca3102bde 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -6430,8 +6430,8 @@ void HOptimizedGraphBuilder::BuildStore(Expression* expr, |
HValue* key = environment()->ExpressionStackAt(1); |
HValue* object = environment()->ExpressionStackAt(2); |
bool has_side_effects = false; |
- HandleKeyedElementAccess(object, key, value, expr, |
- STORE, &has_side_effects); |
+ HandleKeyedElementAccess(object, key, value, expr, return_id, STORE, |
+ &has_side_effects); |
Drop(3); |
Push(value); |
Add<HSimulate>(return_id, REMOVABLE_SIMULATE); |
@@ -7123,12 +7123,28 @@ HValue* HOptimizedGraphBuilder::HandlePolymorphicElementAccess( |
HValue* HOptimizedGraphBuilder::HandleKeyedElementAccess( |
- HValue* obj, |
- HValue* key, |
- HValue* val, |
- Expression* expr, |
- PropertyAccessType access_type, |
+ HValue* obj, HValue* key, HValue* val, Expression* expr, |
+ BailoutId return_id, PropertyAccessType access_type, |
bool* has_side_effects) { |
+ if (key->ActualValue()->IsConstant()) { |
+ Handle<Object> constant = |
+ HConstant::cast(key->ActualValue())->handle(isolate()); |
+ uint32_t array_index; |
+ if (constant->IsString() && |
+ !Handle<String>::cast(constant)->AsArrayIndex(&array_index)) { |
+ HInstruction* instr = |
+ BuildNamedAccess(access_type, expr->id(), expr->id(), expr, obj, |
Igor Sheludko
2014/09/18 11:25:37
As you noticed you didn't use return_id here.
|
+ Handle<String>::cast(constant), val, false); |
Igor Sheludko
2014/09/18 11:25:37
If instr really can't be null here then consider a
|
+ if (instr->IsLinked()) { |
+ *has_side_effects = false; |
+ } else { |
+ AddInstruction(instr); |
+ *has_side_effects = instr->HasObservableSideEffects(); |
+ } |
+ return instr; |
+ } |
+ } |
+ |
DCHECK(!expr->IsPropertyName()); |
HInstruction* instr = NULL; |
@@ -7339,7 +7355,7 @@ void HOptimizedGraphBuilder::BuildLoad(Property* expr, |
bool has_side_effects = false; |
HValue* load = HandleKeyedElementAccess( |
- obj, key, NULL, expr, LOAD, &has_side_effects); |
+ obj, key, NULL, expr, expr->LoadId(), LOAD, &has_side_effects); |
if (has_side_effects) { |
if (ast_context()->IsEffect()) { |
Add<HSimulate>(ast_id, REMOVABLE_SIMULATE); |