OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/compiler/ast-graph-builder.h" | 5 #include "src/compiler/ast-graph-builder.h" |
6 | 6 |
7 #include "src/compiler.h" | 7 #include "src/compiler.h" |
8 #include "src/compiler/ast-loop-assignment-analyzer.h" | 8 #include "src/compiler/ast-loop-assignment-analyzer.h" |
9 #include "src/compiler/control-builders.h" | 9 #include "src/compiler/control-builders.h" |
10 #include "src/compiler/linkage.h" | 10 #include "src/compiler/linkage.h" |
(...skipping 2494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2505 environment()->Push(super_function); | 2505 environment()->Push(super_function); |
2506 | 2506 |
2507 // Evaluate all arguments to the super call. | 2507 // Evaluate all arguments to the super call. |
2508 ZoneList<Expression*>* args = expr->arguments(); | 2508 ZoneList<Expression*>* args = expr->arguments(); |
2509 VisitForValues(args); | 2509 VisitForValues(args); |
2510 | 2510 |
2511 // The new target is loaded from the {new.target} variable. | 2511 // The new target is loaded from the {new.target} variable. |
2512 VisitForValue(super->new_target_var()); | 2512 VisitForValue(super->new_target_var()); |
2513 | 2513 |
2514 // Create node to perform the super call. | 2514 // Create node to perform the super call. |
2515 const Operator* call = javascript()->CallConstruct(args->length() + 2); | 2515 const Operator* call = |
| 2516 javascript()->CallConstruct(args->length() + 2, VectorSlotPair()); |
2516 Node* value = ProcessArguments(call, args->length() + 2); | 2517 Node* value = ProcessArguments(call, args->length() + 2); |
2517 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2518 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
2518 ast_context()->ProduceValue(value); | 2519 ast_context()->ProduceValue(value); |
2519 } | 2520 } |
2520 | 2521 |
2521 | 2522 |
2522 void AstGraphBuilder::VisitCallNew(CallNew* expr) { | 2523 void AstGraphBuilder::VisitCallNew(CallNew* expr) { |
2523 VisitForValue(expr->expression()); | 2524 VisitForValue(expr->expression()); |
2524 | 2525 |
2525 // Evaluate all arguments to the construct call. | 2526 // Evaluate all arguments to the construct call. |
2526 ZoneList<Expression*>* args = expr->arguments(); | 2527 ZoneList<Expression*>* args = expr->arguments(); |
2527 VisitForValues(args); | 2528 VisitForValues(args); |
2528 | 2529 |
2529 // The new target is the same as the callee. | 2530 // The new target is the same as the callee. |
2530 environment()->Push(environment()->Peek(args->length())); | 2531 environment()->Push(environment()->Peek(args->length())); |
2531 | 2532 |
2532 // Create node to perform the construct call. | 2533 // Create node to perform the construct call. |
2533 const Operator* call = javascript()->CallConstruct(args->length() + 2); | 2534 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallNewFeedbackSlot()); |
| 2535 const Operator* call = |
| 2536 javascript()->CallConstruct(args->length() + 2, feedback); |
2534 Node* value = ProcessArguments(call, args->length() + 2); | 2537 Node* value = ProcessArguments(call, args->length() + 2); |
2535 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2538 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); |
2536 ast_context()->ProduceValue(value); | 2539 ast_context()->ProduceValue(value); |
2537 } | 2540 } |
2538 | 2541 |
2539 | 2542 |
2540 void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { | 2543 void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { |
2541 // The callee and the receiver both have to be pushed onto the operand stack | 2544 // The callee and the receiver both have to be pushed onto the operand stack |
2542 // before arguments are being evaluated. | 2545 // before arguments are being evaluated. |
2543 Node* callee_value = BuildLoadNativeContextField(expr->context_index()); | 2546 Node* callee_value = BuildLoadNativeContextField(expr->context_index()); |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3645 | 3648 |
3646 Node* AstGraphBuilder::BuildLoadGlobalObject() { | 3649 Node* AstGraphBuilder::BuildLoadGlobalObject() { |
3647 const Operator* load_op = | 3650 const Operator* load_op = |
3648 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true); | 3651 javascript()->LoadContext(0, Context::GLOBAL_OBJECT_INDEX, true); |
3649 return NewNode(load_op, GetFunctionContext()); | 3652 return NewNode(load_op, GetFunctionContext()); |
3650 } | 3653 } |
3651 | 3654 |
3652 | 3655 |
3653 Node* AstGraphBuilder::BuildLoadNativeContextField(int index) { | 3656 Node* AstGraphBuilder::BuildLoadNativeContextField(int index) { |
3654 Node* global = BuildLoadGlobalObject(); | 3657 Node* global = BuildLoadGlobalObject(); |
3655 Node* native_context = | 3658 Node* native_context = NewNode(javascript()->LoadNativeContext(), global); |
3656 BuildLoadObjectField(global, JSGlobalObject::kNativeContextOffset); | |
3657 return NewNode(javascript()->LoadContext(0, index, true), native_context); | 3659 return NewNode(javascript()->LoadContext(0, index, true), native_context); |
3658 } | 3660 } |
3659 | 3661 |
3660 | 3662 |
3661 Node* AstGraphBuilder::BuildLoadFeedbackVector() { | 3663 Node* AstGraphBuilder::BuildLoadFeedbackVector() { |
3662 if (!feedback_vector_.is_set()) { | 3664 if (!feedback_vector_.is_set()) { |
3663 Node* closure = GetFunctionClosure(); | 3665 Node* closure = GetFunctionClosure(); |
3664 Node* shared = BuildLoadImmutableObjectField( | 3666 Node* shared = BuildLoadImmutableObjectField( |
3665 closure, JSFunction::kSharedFunctionInfoOffset); | 3667 closure, JSFunction::kSharedFunctionInfoOffset); |
3666 Node* vector = BuildLoadImmutableObjectField( | 3668 Node* vector = BuildLoadImmutableObjectField( |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4301 // Phi does not exist yet, introduce one. | 4303 // Phi does not exist yet, introduce one. |
4302 value = NewPhi(inputs, value, control); | 4304 value = NewPhi(inputs, value, control); |
4303 value->ReplaceInput(inputs - 1, other); | 4305 value->ReplaceInput(inputs - 1, other); |
4304 } | 4306 } |
4305 return value; | 4307 return value; |
4306 } | 4308 } |
4307 | 4309 |
4308 } // namespace compiler | 4310 } // namespace compiler |
4309 } // namespace internal | 4311 } // namespace internal |
4310 } // namespace v8 | 4312 } // namespace v8 |
OLD | NEW |