OLD | NEW |
1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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/scheduler.h" | 5 #include "src/compiler/scheduler.h" |
6 | 6 |
7 #include <iomanip> | 7 #include <iomanip> |
8 | 8 |
9 #include "src/base/adapters.h" | 9 #include "src/base/adapters.h" |
10 #include "src/bit-vector.h" | 10 #include "src/bit-vector.h" |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
338 ConnectBranch(node); | 338 ConnectBranch(node); |
339 break; | 339 break; |
340 case IrOpcode::kSwitch: | 340 case IrOpcode::kSwitch: |
341 scheduler_->UpdatePlacement(node, Scheduler::kFixed); | 341 scheduler_->UpdatePlacement(node, Scheduler::kFixed); |
342 ConnectSwitch(node); | 342 ConnectSwitch(node); |
343 break; | 343 break; |
344 case IrOpcode::kDeoptimize: | 344 case IrOpcode::kDeoptimize: |
345 scheduler_->UpdatePlacement(node, Scheduler::kFixed); | 345 scheduler_->UpdatePlacement(node, Scheduler::kFixed); |
346 ConnectDeoptimize(node); | 346 ConnectDeoptimize(node); |
347 break; | 347 break; |
| 348 case IrOpcode::kTailCall: |
| 349 scheduler_->UpdatePlacement(node, Scheduler::kFixed); |
| 350 ConnectTailCall(node); |
| 351 break; |
348 case IrOpcode::kReturn: | 352 case IrOpcode::kReturn: |
349 scheduler_->UpdatePlacement(node, Scheduler::kFixed); | 353 scheduler_->UpdatePlacement(node, Scheduler::kFixed); |
350 ConnectReturn(node); | 354 ConnectReturn(node); |
351 break; | 355 break; |
352 case IrOpcode::kThrow: | 356 case IrOpcode::kThrow: |
353 scheduler_->UpdatePlacement(node, Scheduler::kFixed); | 357 scheduler_->UpdatePlacement(node, Scheduler::kFixed); |
354 ConnectThrow(node); | 358 ConnectThrow(node); |
355 break; | 359 break; |
356 case IrOpcode::kCall: | 360 case IrOpcode::kCall: |
357 if (NodeProperties::IsExceptionalCall(node)) { | 361 if (NodeProperties::IsExceptionalCall(node)) { |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 DCHECK_NOT_NULL(block); | 484 DCHECK_NOT_NULL(block); |
481 // For all of the merge's control inputs, add a goto at the end to the | 485 // For all of the merge's control inputs, add a goto at the end to the |
482 // merge's basic block. | 486 // merge's basic block. |
483 for (Node* const input : merge->inputs()) { | 487 for (Node* const input : merge->inputs()) { |
484 BasicBlock* predecessor_block = FindPredecessorBlock(input); | 488 BasicBlock* predecessor_block = FindPredecessorBlock(input); |
485 TraceConnect(merge, predecessor_block, block); | 489 TraceConnect(merge, predecessor_block, block); |
486 schedule_->AddGoto(predecessor_block, block); | 490 schedule_->AddGoto(predecessor_block, block); |
487 } | 491 } |
488 } | 492 } |
489 | 493 |
| 494 void ConnectTailCall(Node* call) { |
| 495 Node* call_control = NodeProperties::GetControlInput(call); |
| 496 BasicBlock* call_block = FindPredecessorBlock(call_control); |
| 497 TraceConnect(call, call_block, NULL); |
| 498 schedule_->AddTailCall(call_block, call); |
| 499 } |
| 500 |
490 void ConnectReturn(Node* ret) { | 501 void ConnectReturn(Node* ret) { |
491 Node* return_control = NodeProperties::GetControlInput(ret); | 502 Node* return_control = NodeProperties::GetControlInput(ret); |
492 BasicBlock* return_block = FindPredecessorBlock(return_control); | 503 BasicBlock* return_block = FindPredecessorBlock(return_control); |
493 TraceConnect(ret, return_block, NULL); | 504 TraceConnect(ret, return_block, NULL); |
494 schedule_->AddReturn(return_block, ret); | 505 schedule_->AddReturn(return_block, ret); |
495 } | 506 } |
496 | 507 |
497 void ConnectDeoptimize(Node* deopt) { | 508 void ConnectDeoptimize(Node* deopt) { |
498 Node* deoptimize_control = NodeProperties::GetControlInput(deopt); | 509 Node* deoptimize_control = NodeProperties::GetControlInput(deopt); |
499 BasicBlock* deoptimize_block = FindPredecessorBlock(deoptimize_control); | 510 BasicBlock* deoptimize_block = FindPredecessorBlock(deoptimize_control); |
(...skipping 1184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1684 for (Node* const node : *nodes) { | 1695 for (Node* const node : *nodes) { |
1685 schedule_->SetBlockForNode(to, node); | 1696 schedule_->SetBlockForNode(to, node); |
1686 scheduled_nodes_[to->id().ToSize()].push_back(node); | 1697 scheduled_nodes_[to->id().ToSize()].push_back(node); |
1687 } | 1698 } |
1688 nodes->clear(); | 1699 nodes->clear(); |
1689 } | 1700 } |
1690 | 1701 |
1691 } // namespace compiler | 1702 } // namespace compiler |
1692 } // namespace internal | 1703 } // namespace internal |
1693 } // namespace v8 | 1704 } // namespace v8 |
OLD | NEW |