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 347 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
358 block = schedule_->NewBasicBlock(); | 358 block = schedule_->NewBasicBlock(); |
359 Trace("Create block B%d for #%d:%s\n", block->id().ToInt(), node->id(), | 359 Trace("Create block B%d for #%d:%s\n", block->id().ToInt(), node->id(), |
360 node->op()->mnemonic()); | 360 node->op()->mnemonic()); |
361 FixNode(block, node); | 361 FixNode(block, node); |
362 } | 362 } |
363 return block; | 363 return block; |
364 } | 364 } |
365 | 365 |
366 void BuildBlocksForSuccessors(Node* node) { | 366 void BuildBlocksForSuccessors(Node* node) { |
367 size_t const successor_count = node->op()->ControlOutputCount(); | 367 size_t const successor_count = node->op()->ControlOutputCount(); |
368 Node** successors = | 368 Node** successors = zone_->NewArray<Node*>(successor_count); |
369 zone_->NewArray<Node*>(static_cast<int>(successor_count)); | |
370 CollectSuccessorProjections(node, successors, successor_count); | 369 CollectSuccessorProjections(node, successors, successor_count); |
371 for (size_t index = 0; index < successor_count; ++index) { | 370 for (size_t index = 0; index < successor_count; ++index) { |
372 BuildBlockForNode(successors[index]); | 371 BuildBlockForNode(successors[index]); |
373 } | 372 } |
374 } | 373 } |
375 | 374 |
376 // Collect the branch-related projections from a node, such as IfTrue, | 375 // Collect the branch-related projections from a node, such as IfTrue, |
377 // IfFalse, and Case. | 376 // IfFalse, and Case. |
378 void CollectSuccessorProjections(Node* node, Node** successors, | 377 void CollectSuccessorProjections(Node* node, Node** successors, |
379 size_t successor_count) { | 378 size_t successor_count) { |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
450 TraceConnect(branch, branch_block, successor_blocks[0]); | 449 TraceConnect(branch, branch_block, successor_blocks[0]); |
451 TraceConnect(branch, branch_block, successor_blocks[1]); | 450 TraceConnect(branch, branch_block, successor_blocks[1]); |
452 schedule_->AddBranch(branch_block, branch, successor_blocks[0], | 451 schedule_->AddBranch(branch_block, branch, successor_blocks[0], |
453 successor_blocks[1]); | 452 successor_blocks[1]); |
454 } | 453 } |
455 } | 454 } |
456 | 455 |
457 void ConnectSwitch(Node* sw) { | 456 void ConnectSwitch(Node* sw) { |
458 size_t const successor_count = sw->op()->ControlOutputCount(); | 457 size_t const successor_count = sw->op()->ControlOutputCount(); |
459 BasicBlock** successor_blocks = | 458 BasicBlock** successor_blocks = |
460 zone_->NewArray<BasicBlock*>(static_cast<int>(successor_count)); | 459 zone_->NewArray<BasicBlock*>(successor_count); |
461 CollectSuccessorBlocks(sw, successor_blocks, successor_count); | 460 CollectSuccessorBlocks(sw, successor_blocks, successor_count); |
462 | 461 |
463 if (sw == component_entry_) { | 462 if (sw == component_entry_) { |
464 for (size_t index = 0; index < successor_count; ++index) { | 463 for (size_t index = 0; index < successor_count; ++index) { |
465 TraceConnect(sw, component_start_, successor_blocks[index]); | 464 TraceConnect(sw, component_start_, successor_blocks[index]); |
466 } | 465 } |
467 schedule_->InsertSwitch(component_start_, component_end_, sw, | 466 schedule_->InsertSwitch(component_start_, component_end_, sw, |
468 successor_blocks, successor_count); | 467 successor_blocks, successor_count); |
469 } else { | 468 } else { |
470 Node* sw_block_node = NodeProperties::GetControlInput(sw); | 469 Node* sw_block_node = NodeProperties::GetControlInput(sw); |
(...skipping 1178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1649 for (Node* const node : *nodes) { | 1648 for (Node* const node : *nodes) { |
1650 schedule_->SetBlockForNode(to, node); | 1649 schedule_->SetBlockForNode(to, node); |
1651 scheduled_nodes_[to->id().ToSize()].push_back(node); | 1650 scheduled_nodes_[to->id().ToSize()].push_back(node); |
1652 } | 1651 } |
1653 nodes->clear(); | 1652 nodes->clear(); |
1654 } | 1653 } |
1655 | 1654 |
1656 } // namespace compiler | 1655 } // namespace compiler |
1657 } // namespace internal | 1656 } // namespace internal |
1658 } // namespace v8 | 1657 } // namespace v8 |
OLD | NEW |