| 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 2465 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2476 NewNode(op, callee, source, function, language, position); | 2476 NewNode(op, callee, source, function, language, position); |
| 2477 PrepareFrameState(new_callee, expr->EvalId(), | 2477 PrepareFrameState(new_callee, expr->EvalId(), |
| 2478 OutputFrameStateCombine::PokeAt(arg_count + 1)); | 2478 OutputFrameStateCombine::PokeAt(arg_count + 1)); |
| 2479 | 2479 |
| 2480 // Patch callee on the environment. | 2480 // Patch callee on the environment. |
| 2481 environment()->Poke(arg_count + 1, new_callee); | 2481 environment()->Poke(arg_count + 1, new_callee); |
| 2482 } | 2482 } |
| 2483 | 2483 |
| 2484 // Create node to perform the function call. | 2484 // Create node to perform the function call. |
| 2485 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot()); | 2485 VectorSlotPair feedback = CreateVectorSlotPair(expr->CallFeedbackICSlot()); |
| 2486 const Operator* call = | 2486 const Operator* call = javascript()->CallFunction( |
| 2487 javascript()->CallFunction(args->length() + 2, language_mode(), feedback, | 2487 args->length() + 2, feedback, receiver_hint, expr->tail_call_mode()); |
| 2488 receiver_hint, expr->tail_call_mode()); | |
| 2489 FrameStateBeforeAndAfter states(this, expr->CallId()); | 2488 FrameStateBeforeAndAfter states(this, expr->CallId()); |
| 2490 Node* value = ProcessArguments(call, args->length() + 2); | 2489 Node* value = ProcessArguments(call, args->length() + 2); |
| 2491 environment()->Push(value->InputAt(0)); // The callee passed to the call. | 2490 environment()->Push(value->InputAt(0)); // The callee passed to the call. |
| 2492 states.AddToNode(value, expr->ReturnId(), OutputFrameStateCombine::Push()); | 2491 states.AddToNode(value, expr->ReturnId(), OutputFrameStateCombine::Push()); |
| 2493 environment()->Drop(1); | 2492 environment()->Drop(1); |
| 2494 ast_context()->ProduceValue(value); | 2493 ast_context()->ProduceValue(value); |
| 2495 } | 2494 } |
| 2496 | 2495 |
| 2497 | 2496 |
| 2498 void AstGraphBuilder::VisitCallSuper(Call* expr) { | 2497 void AstGraphBuilder::VisitCallSuper(Call* expr) { |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2556 Node* receiver_value = jsgraph()->UndefinedConstant(); | 2555 Node* receiver_value = jsgraph()->UndefinedConstant(); |
| 2557 | 2556 |
| 2558 environment()->Push(callee_value); | 2557 environment()->Push(callee_value); |
| 2559 environment()->Push(receiver_value); | 2558 environment()->Push(receiver_value); |
| 2560 | 2559 |
| 2561 // Evaluate all arguments to the JS runtime call. | 2560 // Evaluate all arguments to the JS runtime call. |
| 2562 ZoneList<Expression*>* args = expr->arguments(); | 2561 ZoneList<Expression*>* args = expr->arguments(); |
| 2563 VisitForValues(args); | 2562 VisitForValues(args); |
| 2564 | 2563 |
| 2565 // Create node to perform the JS runtime call. | 2564 // Create node to perform the JS runtime call. |
| 2566 const Operator* call = | 2565 const Operator* call = javascript()->CallFunction(args->length() + 2); |
| 2567 javascript()->CallFunction(args->length() + 2, language_mode()); | |
| 2568 FrameStateBeforeAndAfter states(this, expr->CallId()); | 2566 FrameStateBeforeAndAfter states(this, expr->CallId()); |
| 2569 Node* value = ProcessArguments(call, args->length() + 2); | 2567 Node* value = ProcessArguments(call, args->length() + 2); |
| 2570 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); | 2568 states.AddToNode(value, expr->id(), ast_context()->GetStateCombine()); |
| 2571 ast_context()->ProduceValue(value); | 2569 ast_context()->ProduceValue(value); |
| 2572 } | 2570 } |
| 2573 | 2571 |
| 2574 | 2572 |
| 2575 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { | 2573 void AstGraphBuilder::VisitCallRuntime(CallRuntime* expr) { |
| 2576 // Handle calls to runtime functions implemented in JavaScript separately as | 2574 // Handle calls to runtime functions implemented in JavaScript separately as |
| 2577 // the call follows JavaScript ABI and the callee is statically unknown. | 2575 // the call follows JavaScript ABI and the callee is statically unknown. |
| (...skipping 1769 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4347 // Phi does not exist yet, introduce one. | 4345 // Phi does not exist yet, introduce one. |
| 4348 value = NewPhi(inputs, value, control); | 4346 value = NewPhi(inputs, value, control); |
| 4349 value->ReplaceInput(inputs - 1, other); | 4347 value->ReplaceInput(inputs - 1, other); |
| 4350 } | 4348 } |
| 4351 return value; | 4349 return value; |
| 4352 } | 4350 } |
| 4353 | 4351 |
| 4354 } // namespace compiler | 4352 } // namespace compiler |
| 4355 } // namespace internal | 4353 } // namespace internal |
| 4356 } // namespace v8 | 4354 } // namespace v8 |
| OLD | NEW |