| 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 2496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 = | 2515 const Operator* call = |
| 2516 javascript()->CallConstruct(args->length() + 2, VectorSlotPair()); | 2516 javascript()->CallConstruct(args->length() + 2, VectorSlotPair()); |
| 2517 FrameStateBeforeAndAfter states(this, super->new_target_var()->id()); |
| 2517 Node* value = ProcessArguments(call, args->length() + 2); | 2518 Node* value = ProcessArguments(call, args->length() + 2); |
| 2518 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2519 states.AddToNode(value, expr->ReturnId(), OutputFrameStateCombine::Push()); |
| 2519 ast_context()->ProduceValue(value); | 2520 ast_context()->ProduceValue(value); |
| 2520 } | 2521 } |
| 2521 | 2522 |
| 2522 | 2523 |
| 2523 void AstGraphBuilder::VisitCallNew(CallNew* expr) { | 2524 void AstGraphBuilder::VisitCallNew(CallNew* expr) { |
| 2524 VisitForValue(expr->expression()); | 2525 VisitForValue(expr->expression()); |
| 2525 | 2526 |
| 2526 // Evaluate all arguments to the construct call. | 2527 // Evaluate all arguments to the construct call. |
| 2527 ZoneList<Expression*>* args = expr->arguments(); | 2528 ZoneList<Expression*>* args = expr->arguments(); |
| 2528 VisitForValues(args); | 2529 VisitForValues(args); |
| 2529 | 2530 |
| 2531 // The baseline compiler doesn't push the new.target, so we need to record |
| 2532 // the frame state before the push. |
| 2533 FrameStateBeforeAndAfter states( |
| 2534 this, args->is_empty() ? expr->expression()->id() : args->last()->id()); |
| 2535 |
| 2530 // The new target is the same as the callee. | 2536 // The new target is the same as the callee. |
| 2531 environment()->Push(environment()->Peek(args->length())); | 2537 environment()->Push(environment()->Peek(args->length())); |
| 2532 | 2538 |
| 2533 // Create node to perform the construct call. | 2539 // Create node to perform the construct call. |
| 2534 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallNewFeedbackSlot()); | 2540 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallNewFeedbackSlot()); |
| 2535 const Operator* call = | 2541 const Operator* call = |
| 2536 javascript()->CallConstruct(args->length() + 2, feedback); | 2542 javascript()->CallConstruct(args->length() + 2, feedback); |
| 2537 Node* value = ProcessArguments(call, args->length() + 2); | 2543 Node* value = ProcessArguments(call, args->length() + 2); |
| 2538 PrepareFrameState(value, expr->id(), ast_context()->GetStateCombine()); | 2544 states.AddToNode(value, expr->ReturnId(), OutputFrameStateCombine::Push()); |
| 2539 ast_context()->ProduceValue(value); | 2545 ast_context()->ProduceValue(value); |
| 2540 } | 2546 } |
| 2541 | 2547 |
| 2542 | 2548 |
| 2543 void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { | 2549 void AstGraphBuilder::VisitCallJSRuntime(CallRuntime* expr) { |
| 2544 // The callee and the receiver both have to be pushed onto the operand stack | 2550 // The callee and the receiver both have to be pushed onto the operand stack |
| 2545 // before arguments are being evaluated. | 2551 // before arguments are being evaluated. |
| 2546 Node* callee_value = BuildLoadNativeContextField(expr->context_index()); | 2552 Node* callee_value = BuildLoadNativeContextField(expr->context_index()); |
| 2547 Node* receiver_value = jsgraph()->UndefinedConstant(); | 2553 Node* receiver_value = jsgraph()->UndefinedConstant(); |
| 2548 | 2554 |
| (...skipping 1754 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4303 // Phi does not exist yet, introduce one. | 4309 // Phi does not exist yet, introduce one. |
| 4304 value = NewPhi(inputs, value, control); | 4310 value = NewPhi(inputs, value, control); |
| 4305 value->ReplaceInput(inputs - 1, other); | 4311 value->ReplaceInput(inputs - 1, other); |
| 4306 } | 4312 } |
| 4307 return value; | 4313 return value; |
| 4308 } | 4314 } |
| 4309 | 4315 |
| 4310 } // namespace compiler | 4316 } // namespace compiler |
| 4311 } // namespace internal | 4317 } // namespace internal |
| 4312 } // namespace v8 | 4318 } // namespace v8 |
| OLD | NEW |