Index: src/hydrogen.cc |
diff --git a/src/hydrogen.cc b/src/hydrogen.cc |
index 0a7e9f05752988b27e36a6e0ff0c3d1f99684af5..8308ece255ffe4e1da07719557690a9a1dbfbd4c 100644 |
--- a/src/hydrogen.cc |
+++ b/src/hydrogen.cc |
@@ -7041,19 +7041,31 @@ void HOptimizedGraphBuilder::VisitCall(Call* expr) { |
if (prop != NULL) { |
if (!prop->key()->IsPropertyName()) { |
// Keyed function call. |
- CHECK_ALIVE(VisitArgument(prop->obj())); |
- |
+ CHECK_ALIVE(VisitForValue(prop->obj())); |
CHECK_ALIVE(VisitForValue(prop->key())); |
+ |
// Push receiver and key like the non-optimized code generator expects it. |
HValue* key = Pop(); |
HValue* receiver = Pop(); |
Push(key); |
- Push(receiver); |
- |
+ PushAndAdd(New<HPushArgument>(receiver)); |
CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
- HValue* context = environment()->context(); |
- call = new(zone()) HCallKeyed(context, key, argument_count); |
+ if (expr->IsMonomorphic()) { |
+ BuildCheckHeapObject(receiver); |
+ ElementsKind kind = expr->KeyedArrayCallIsHoley() |
+ ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS; |
+ |
+ Handle<Map> map(isolate()->get_initial_js_array_map(kind)); |
+ |
+ HValue* function = BuildMonomorphicElementAccess( |
+ receiver, key, NULL, NULL, map, false, STANDARD_STORE); |
+ |
+ call = New<HCallFunction>(function, argument_count); |
+ } else { |
+ HValue* context = environment()->context(); |
+ call = new(zone()) HCallKeyed(context, key, argument_count); |
+ } |
call->set_position(expr->position()); |
Drop(argument_count + 1); // 1 is the key. |
return ast_context()->ReturnInstruction(call, expr->id()); |