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 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 : BasicBlock::GetCommonDominator(block, use_block); | 1531 : BasicBlock::GetCommonDominator(block, use_block); |
1532 } | 1532 } |
1533 return block; | 1533 return block; |
1534 } | 1534 } |
1535 | 1535 |
1536 BasicBlock* FindPredecessorBlock(Node* node) { | 1536 BasicBlock* FindPredecessorBlock(Node* node) { |
1537 return scheduler_->control_flow_builder_->FindPredecessorBlock(node); | 1537 return scheduler_->control_flow_builder_->FindPredecessorBlock(node); |
1538 } | 1538 } |
1539 | 1539 |
1540 BasicBlock* GetBlockForUse(Edge edge) { | 1540 BasicBlock* GetBlockForUse(Edge edge) { |
| 1541 // TODO(titzer): ignore uses from dead nodes (not visited in PrepareUses()). |
| 1542 // Dead uses only occur if the graph is not trimmed before scheduling. |
1541 Node* use = edge.from(); | 1543 Node* use = edge.from(); |
1542 if (IrOpcode::IsPhiOpcode(use->opcode())) { | 1544 if (IrOpcode::IsPhiOpcode(use->opcode())) { |
1543 // If the use is from a coupled (i.e. floating) phi, compute the common | 1545 // If the use is from a coupled (i.e. floating) phi, compute the common |
1544 // dominator of its uses. This will not recurse more than one level. | 1546 // dominator of its uses. This will not recurse more than one level. |
1545 if (scheduler_->GetPlacement(use) == Scheduler::kCoupled) { | 1547 if (scheduler_->GetPlacement(use) == Scheduler::kCoupled) { |
1546 TRACE(" inspecting uses of coupled #%d:%s\n", use->id(), | 1548 TRACE(" inspecting uses of coupled #%d:%s\n", use->id(), |
1547 use->op()->mnemonic()); | 1549 use->op()->mnemonic()); |
1548 DCHECK_EQ(edge.to(), NodeProperties::GetControlInput(use)); | 1550 // TODO(titzer): reenable once above TODO is addressed. |
| 1551 // DCHECK_EQ(edge.to(), NodeProperties::GetControlInput(use)); |
1549 return GetCommonDominatorOfUses(use); | 1552 return GetCommonDominatorOfUses(use); |
1550 } | 1553 } |
1551 // If the use is from a fixed (i.e. non-floating) phi, we use the | 1554 // If the use is from a fixed (i.e. non-floating) phi, we use the |
1552 // predecessor block of the corresponding control input to the merge. | 1555 // predecessor block of the corresponding control input to the merge. |
1553 if (scheduler_->GetPlacement(use) == Scheduler::kFixed) { | 1556 if (scheduler_->GetPlacement(use) == Scheduler::kFixed) { |
1554 TRACE(" input@%d into a fixed phi #%d:%s\n", edge.index(), use->id(), | 1557 TRACE(" input@%d into a fixed phi #%d:%s\n", edge.index(), use->id(), |
1555 use->op()->mnemonic()); | 1558 use->op()->mnemonic()); |
1556 Node* merge = NodeProperties::GetControlInput(use, 0); | 1559 Node* merge = NodeProperties::GetControlInput(use, 0); |
1557 DCHECK(IrOpcode::IsMergeOpcode(merge->opcode())); | 1560 DCHECK(IrOpcode::IsMergeOpcode(merge->opcode())); |
1558 Node* input = NodeProperties::GetControlInput(merge, edge.index()); | 1561 Node* input = NodeProperties::GetControlInput(merge, edge.index()); |
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1734 for (Node* const node : *nodes) { | 1737 for (Node* const node : *nodes) { |
1735 schedule_->SetBlockForNode(to, node); | 1738 schedule_->SetBlockForNode(to, node); |
1736 scheduled_nodes_[to->id().ToSize()].push_back(node); | 1739 scheduled_nodes_[to->id().ToSize()].push_back(node); |
1737 } | 1740 } |
1738 nodes->clear(); | 1741 nodes->clear(); |
1739 } | 1742 } |
1740 | 1743 |
1741 } // namespace compiler | 1744 } // namespace compiler |
1742 } // namespace internal | 1745 } // namespace internal |
1743 } // namespace v8 | 1746 } // namespace v8 |
OLD | NEW |