| Index: src/hydrogen.cc
|
| diff --git a/src/hydrogen.cc b/src/hydrogen.cc
|
| index 7c42a3bcd63c0eb952d133a2c4e64863e5be2056..371ecaef126a65aab926c194ea6279745ad8b8f4 100644
|
| --- a/src/hydrogen.cc
|
| +++ b/src/hydrogen.cc
|
| @@ -2378,7 +2378,7 @@ HGraphBuilder::JSArrayBuilder::JSArrayBuilder(HGraphBuilder* builder,
|
|
|
|
|
| HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() {
|
| - if (kind_ == GetInitialFastElementsKind()) {
|
| + if (constructor_function_ != NULL && kind_ == GetInitialFastElementsKind()) {
|
| // No need for a context lookup if the kind_ matches the initial
|
| // map, because we can just load the map in that case.
|
| HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap();
|
| @@ -7355,18 +7355,30 @@ 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);
|
| -
|
| + Push(Add<HPushArgument>(receiver));
|
| CHECK_ALIVE(VisitArgumentList(expr->arguments()));
|
|
|
| - call = New<HCallKeyed>(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 {
|
| + call = New<HCallKeyed>(key, argument_count);
|
| + }
|
| Drop(argument_count + 1); // 1 is the key.
|
| return ast_context()->ReturnInstruction(call, expr->id());
|
| }
|
|
|