OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 2408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2419 | 2419 |
2420 | 2420 |
2421 HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() { | 2421 HValue* HGraphBuilder::JSArrayBuilder::EmitMapCode() { |
2422 if (!builder()->top_info()->IsStub()) { | 2422 if (!builder()->top_info()->IsStub()) { |
2423 // A constant map is fine. | 2423 // A constant map is fine. |
2424 Handle<Map> map(builder()->isolate()->get_initial_js_array_map(kind_), | 2424 Handle<Map> map(builder()->isolate()->get_initial_js_array_map(kind_), |
2425 builder()->isolate()); | 2425 builder()->isolate()); |
2426 return builder()->Add<HConstant>(map); | 2426 return builder()->Add<HConstant>(map); |
2427 } | 2427 } |
2428 | 2428 |
2429 if (constructor_function_ != NULL && kind_ == GetInitialFastElementsKind()) { | 2429 if (kind_ == GetInitialFastElementsKind()) { |
2430 // No need for a context lookup if the kind_ matches the initial | 2430 // No need for a context lookup if the kind_ matches the initial |
2431 // map, because we can just load the map in that case. | 2431 // map, because we can just load the map in that case. |
2432 HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap(); | 2432 HObjectAccess access = HObjectAccess::ForPrototypeOrInitialMap(); |
2433 return builder()->AddLoadNamedField(constructor_function_, access); | 2433 return builder()->AddLoadNamedField(constructor_function_, access); |
2434 } | 2434 } |
2435 | 2435 |
2436 HInstruction* native_context = builder()->BuildGetNativeContext(); | 2436 HInstruction* native_context = builder()->BuildGetNativeContext(); |
2437 HInstruction* index = builder()->Add<HConstant>( | 2437 HInstruction* index = builder()->Add<HConstant>( |
2438 static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX)); | 2438 static_cast<int32_t>(Context::JS_ARRAY_MAPS_INDEX)); |
2439 | 2439 |
(...skipping 4957 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
7397 ASSERT(current_block() != NULL); | 7397 ASSERT(current_block() != NULL); |
7398 ASSERT(current_block()->HasPredecessor()); | 7398 ASSERT(current_block()->HasPredecessor()); |
7399 Expression* callee = expr->expression(); | 7399 Expression* callee = expr->expression(); |
7400 int argument_count = expr->arguments()->length() + 1; // Plus receiver. | 7400 int argument_count = expr->arguments()->length() + 1; // Plus receiver. |
7401 HInstruction* call = NULL; | 7401 HInstruction* call = NULL; |
7402 | 7402 |
7403 Property* prop = callee->AsProperty(); | 7403 Property* prop = callee->AsProperty(); |
7404 if (prop != NULL) { | 7404 if (prop != NULL) { |
7405 if (!prop->key()->IsPropertyName()) { | 7405 if (!prop->key()->IsPropertyName()) { |
7406 // Keyed function call. | 7406 // Keyed function call. |
7407 CHECK_ALIVE(VisitForValue(prop->obj())); | 7407 CHECK_ALIVE(VisitArgument(prop->obj())); |
| 7408 |
7408 CHECK_ALIVE(VisitForValue(prop->key())); | 7409 CHECK_ALIVE(VisitForValue(prop->key())); |
7409 | |
7410 // Push receiver and key like the non-optimized code generator expects it. | 7410 // Push receiver and key like the non-optimized code generator expects it. |
7411 HValue* key = Pop(); | 7411 HValue* key = Pop(); |
7412 HValue* receiver = Pop(); | 7412 HValue* receiver = Pop(); |
7413 Push(key); | 7413 Push(key); |
7414 Push(Add<HPushArgument>(receiver)); | 7414 Push(receiver); |
| 7415 |
7415 CHECK_ALIVE(VisitArgumentList(expr->arguments())); | 7416 CHECK_ALIVE(VisitArgumentList(expr->arguments())); |
7416 | 7417 |
7417 if (expr->IsMonomorphic()) { | 7418 call = New<HCallKeyed>(key, argument_count); |
7418 BuildCheckHeapObject(receiver); | |
7419 ElementsKind kind = expr->KeyedArrayCallIsHoley() | |
7420 ? FAST_HOLEY_ELEMENTS : FAST_ELEMENTS; | |
7421 | |
7422 Handle<Map> map(isolate()->get_initial_js_array_map(kind)); | |
7423 | |
7424 HValue* function = BuildMonomorphicElementAccess( | |
7425 receiver, key, NULL, NULL, map, false, STANDARD_STORE); | |
7426 | |
7427 call = New<HCallFunction>(function, argument_count); | |
7428 } else { | |
7429 call = New<HCallKeyed>(key, argument_count); | |
7430 } | |
7431 Drop(argument_count + 1); // 1 is the key. | 7419 Drop(argument_count + 1); // 1 is the key. |
7432 return ast_context()->ReturnInstruction(call, expr->id()); | 7420 return ast_context()->ReturnInstruction(call, expr->id()); |
7433 } | 7421 } |
7434 | 7422 |
7435 // Named function call. | 7423 // Named function call. |
7436 if (TryCallApply(expr)) return; | 7424 if (TryCallApply(expr)) return; |
7437 | 7425 |
7438 CHECK_ALIVE(VisitForValue(prop->obj())); | 7426 CHECK_ALIVE(VisitForValue(prop->obj())); |
7439 CHECK_ALIVE(VisitExpressions(expr->arguments())); | 7427 CHECK_ALIVE(VisitExpressions(expr->arguments())); |
7440 | 7428 |
(...skipping 2903 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
10344 if (ShouldProduceTraceOutput()) { | 10332 if (ShouldProduceTraceOutput()) { |
10345 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); | 10333 isolate()->GetHTracer()->TraceHydrogen(name(), graph_); |
10346 } | 10334 } |
10347 | 10335 |
10348 #ifdef DEBUG | 10336 #ifdef DEBUG |
10349 graph_->Verify(false); // No full verify. | 10337 graph_->Verify(false); // No full verify. |
10350 #endif | 10338 #endif |
10351 } | 10339 } |
10352 | 10340 |
10353 } } // namespace v8::internal | 10341 } } // namespace v8::internal |
OLD | NEW |