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/ast/scopes.h" | 7 #include "src/ast/scopes.h" |
8 #include "src/compiler.h" | 8 #include "src/compiler.h" |
9 #include "src/compiler/ast-loop-assignment-analyzer.h" | 9 #include "src/compiler/ast-loop-assignment-analyzer.h" |
10 #include "src/compiler/control-builders.h" | 10 #include "src/compiler/control-builders.h" |
(...skipping 2483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2494 states.AddToNode(value, expr->ReturnId(), OutputFrameStateCombine::Push()); | 2494 states.AddToNode(value, expr->ReturnId(), OutputFrameStateCombine::Push()); |
2495 environment()->Drop(1); | 2495 environment()->Drop(1); |
2496 ast_context()->ProduceValue(value); | 2496 ast_context()->ProduceValue(value); |
2497 } | 2497 } |
2498 | 2498 |
2499 | 2499 |
2500 void AstGraphBuilder::VisitCallSuper(Call* expr) { | 2500 void AstGraphBuilder::VisitCallSuper(Call* expr) { |
2501 SuperCallReference* super = expr->expression()->AsSuperCallReference(); | 2501 SuperCallReference* super = expr->expression()->AsSuperCallReference(); |
2502 DCHECK_NOT_NULL(super); | 2502 DCHECK_NOT_NULL(super); |
2503 | 2503 |
2504 // Prepare the callee to the super call. The super constructor is stored as | 2504 // Prepare the callee to the super call. |
2505 // the prototype of the constructor we are currently executing. | |
2506 VisitForValue(super->this_function_var()); | 2505 VisitForValue(super->this_function_var()); |
2507 Node* this_function = environment()->Pop(); | 2506 Node* this_function = environment()->Pop(); |
2508 const Operator* op = javascript()->CallRuntime(Runtime::kGetPrototype, 1); | 2507 const Operator* op = |
| 2508 javascript()->CallRuntime(Runtime::kInlineGetSuperConstructor, 1); |
2509 Node* super_function = NewNode(op, this_function); | 2509 Node* super_function = NewNode(op, this_function); |
2510 // TODO(mstarzinger): This probably needs a proper bailout id. | |
2511 PrepareFrameState(super_function, BailoutId::None()); | |
2512 environment()->Push(super_function); | 2510 environment()->Push(super_function); |
2513 | 2511 |
2514 // Evaluate all arguments to the super call. | 2512 // Evaluate all arguments to the super call. |
2515 ZoneList<Expression*>* args = expr->arguments(); | 2513 ZoneList<Expression*>* args = expr->arguments(); |
2516 VisitForValues(args); | 2514 VisitForValues(args); |
2517 | 2515 |
2518 // The new target is loaded from the {new.target} variable. | 2516 // The new target is loaded from the {new.target} variable. |
2519 VisitForValue(super->new_target_var()); | 2517 VisitForValue(super->new_target_var()); |
2520 | 2518 |
2521 // Create node to perform the super call. | 2519 // Create node to perform the super call. |
(...skipping 1812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4334 // Phi does not exist yet, introduce one. | 4332 // Phi does not exist yet, introduce one. |
4335 value = NewPhi(inputs, value, control); | 4333 value = NewPhi(inputs, value, control); |
4336 value->ReplaceInput(inputs - 1, other); | 4334 value->ReplaceInput(inputs - 1, other); |
4337 } | 4335 } |
4338 return value; | 4336 return value; |
4339 } | 4337 } |
4340 | 4338 |
4341 } // namespace compiler | 4339 } // namespace compiler |
4342 } // namespace internal | 4340 } // namespace internal |
4343 } // namespace v8 | 4341 } // namespace v8 |
OLD | NEW |