| 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 "src/bit-vector.h" | 7 #include "src/bit-vector.h" |
| 8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
| 9 #include "src/compiler/control-equivalence.h" | 9 #include "src/compiler/control-equivalence.h" |
| 10 #include "src/compiler/graph.h" | 10 #include "src/compiler/graph.h" |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 ConnectMerge(node); | 329 ConnectMerge(node); |
| 330 break; | 330 break; |
| 331 case IrOpcode::kBranch: | 331 case IrOpcode::kBranch: |
| 332 scheduler_->UpdatePlacement(node, Scheduler::kFixed); | 332 scheduler_->UpdatePlacement(node, Scheduler::kFixed); |
| 333 ConnectBranch(node); | 333 ConnectBranch(node); |
| 334 break; | 334 break; |
| 335 case IrOpcode::kReturn: | 335 case IrOpcode::kReturn: |
| 336 scheduler_->UpdatePlacement(node, Scheduler::kFixed); | 336 scheduler_->UpdatePlacement(node, Scheduler::kFixed); |
| 337 ConnectReturn(node); | 337 ConnectReturn(node); |
| 338 break; | 338 break; |
| 339 case IrOpcode::kThrow: |
| 340 scheduler_->UpdatePlacement(node, Scheduler::kFixed); |
| 341 ConnectThrow(node); |
| 342 break; |
| 339 default: | 343 default: |
| 340 break; | 344 break; |
| 341 } | 345 } |
| 342 } | 346 } |
| 343 | 347 |
| 344 BasicBlock* BuildBlockForNode(Node* node) { | 348 BasicBlock* BuildBlockForNode(Node* node) { |
| 345 BasicBlock* block = schedule_->block(node); | 349 BasicBlock* block = schedule_->block(node); |
| 346 if (block == NULL) { | 350 if (block == NULL) { |
| 347 block = schedule_->NewBasicBlock(); | 351 block = schedule_->NewBasicBlock(); |
| 348 Trace("Create block B%d for #%d:%s\n", block->id().ToInt(), node->id(), | 352 Trace("Create block B%d for #%d:%s\n", block->id().ToInt(), node->id(), |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 440 } | 444 } |
| 441 } | 445 } |
| 442 | 446 |
| 443 void ConnectReturn(Node* ret) { | 447 void ConnectReturn(Node* ret) { |
| 444 Node* return_block_node = NodeProperties::GetControlInput(ret); | 448 Node* return_block_node = NodeProperties::GetControlInput(ret); |
| 445 BasicBlock* return_block = schedule_->block(return_block_node); | 449 BasicBlock* return_block = schedule_->block(return_block_node); |
| 446 TraceConnect(ret, return_block, NULL); | 450 TraceConnect(ret, return_block, NULL); |
| 447 schedule_->AddReturn(return_block, ret); | 451 schedule_->AddReturn(return_block, ret); |
| 448 } | 452 } |
| 449 | 453 |
| 454 void ConnectThrow(Node* thr) { |
| 455 Node* throw_block_node = NodeProperties::GetControlInput(thr); |
| 456 BasicBlock* throw_block = schedule_->block(throw_block_node); |
| 457 TraceConnect(thr, throw_block, NULL); |
| 458 schedule_->AddThrow(throw_block, thr); |
| 459 } |
| 460 |
| 450 void TraceConnect(Node* node, BasicBlock* block, BasicBlock* succ) { | 461 void TraceConnect(Node* node, BasicBlock* block, BasicBlock* succ) { |
| 451 DCHECK(block); | 462 DCHECK(block); |
| 452 if (succ == NULL) { | 463 if (succ == NULL) { |
| 453 Trace("Connect #%d:%s, B%d -> end\n", node->id(), node->op()->mnemonic(), | 464 Trace("Connect #%d:%s, B%d -> end\n", node->id(), node->op()->mnemonic(), |
| 454 block->id().ToInt()); | 465 block->id().ToInt()); |
| 455 } else { | 466 } else { |
| 456 Trace("Connect #%d:%s, B%d -> B%d\n", node->id(), node->op()->mnemonic(), | 467 Trace("Connect #%d:%s, B%d -> B%d\n", node->id(), node->op()->mnemonic(), |
| 457 block->id().ToInt(), succ->id().ToInt()); | 468 block->id().ToInt(), succ->id().ToInt()); |
| 458 } | 469 } |
| 459 } | 470 } |
| (...skipping 1006 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1466 for (Node* const node : *nodes) { | 1477 for (Node* const node : *nodes) { |
| 1467 schedule_->SetBlockForNode(to, node); | 1478 schedule_->SetBlockForNode(to, node); |
| 1468 scheduled_nodes_[to->id().ToSize()].push_back(node); | 1479 scheduled_nodes_[to->id().ToSize()].push_back(node); |
| 1469 } | 1480 } |
| 1470 nodes->clear(); | 1481 nodes->clear(); |
| 1471 } | 1482 } |
| 1472 | 1483 |
| 1473 } // namespace compiler | 1484 } // namespace compiler |
| 1474 } // namespace internal | 1485 } // namespace internal |
| 1475 } // namespace v8 | 1486 } // namespace v8 |
| OLD | NEW |