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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 } | 57 } |
58 | 58 |
59 | 59 |
60 Scheduler::SchedulerData Scheduler::DefaultSchedulerData() { | 60 Scheduler::SchedulerData Scheduler::DefaultSchedulerData() { |
61 SchedulerData def = {schedule_->start(), 0, kUnknown}; | 61 SchedulerData def = {schedule_->start(), 0, kUnknown}; |
62 return def; | 62 return def; |
63 } | 63 } |
64 | 64 |
65 | 65 |
66 Scheduler::SchedulerData* Scheduler::GetData(Node* node) { | 66 Scheduler::SchedulerData* Scheduler::GetData(Node* node) { |
67 DCHECK(node->id() < static_cast<int>(node_data_.size())); | |
68 return &node_data_[node->id()]; | 67 return &node_data_[node->id()]; |
69 } | 68 } |
70 | 69 |
71 | 70 |
72 Scheduler::Placement Scheduler::GetPlacement(Node* node) { | 71 Scheduler::Placement Scheduler::GetPlacement(Node* node) { |
73 SchedulerData* data = GetData(node); | 72 SchedulerData* data = GetData(node); |
74 if (data->placement_ == kUnknown) { // Compute placement, once, on demand. | 73 if (data->placement_ == kUnknown) { // Compute placement, once, on demand. |
75 switch (node->opcode()) { | 74 switch (node->opcode()) { |
76 case IrOpcode::kParameter: | 75 case IrOpcode::kParameter: |
77 case IrOpcode::kOsrValue: | 76 case IrOpcode::kOsrValue: |
(...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1001 bool end_found; | 1000 bool end_found; |
1002 while (true) { | 1001 while (true) { |
1003 if (block == NULL || block == loop->end) { | 1002 if (block == NULL || block == loop->end) { |
1004 end_found = (loop->end == block); | 1003 end_found = (loop->end == block); |
1005 break; | 1004 break; |
1006 } | 1005 } |
1007 // The list should be in same order as the final result. | 1006 // The list should be in same order as the final result. |
1008 DCHECK(block->rpo_number() == links + header->rpo_number()); | 1007 DCHECK(block->rpo_number() == links + header->rpo_number()); |
1009 links++; | 1008 links++; |
1010 block = block->rpo_next(); | 1009 block = block->rpo_next(); |
1011 DCHECK(links < static_cast<int>(2 * order->size())); // cycle? | 1010 DCHECK_LT(links, static_cast<int>(2 * order->size())); // cycle? |
1012 } | 1011 } |
1013 DCHECK(links > 0); | 1012 DCHECK(links > 0); |
1014 DCHECK(links == end->rpo_number() - header->rpo_number()); | 1013 DCHECK(links == end->rpo_number() - header->rpo_number()); |
1015 DCHECK(end_found); | 1014 DCHECK(end_found); |
1016 | 1015 |
1017 // Check loop depth of the header. | 1016 // Check loop depth of the header. |
1018 int loop_depth = 0; | 1017 int loop_depth = 0; |
1019 for (LoopInfo* outer = loop; outer != NULL; outer = outer->prev) { | 1018 for (LoopInfo* outer = loop; outer != NULL; outer = outer->prev) { |
1020 loop_depth++; | 1019 loop_depth++; |
1021 } | 1020 } |
(...skipping 638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1660 for (Node* const node : *nodes) { | 1659 for (Node* const node : *nodes) { |
1661 schedule_->SetBlockForNode(to, node); | 1660 schedule_->SetBlockForNode(to, node); |
1662 scheduled_nodes_[to->id().ToSize()].push_back(node); | 1661 scheduled_nodes_[to->id().ToSize()].push_back(node); |
1663 } | 1662 } |
1664 nodes->clear(); | 1663 nodes->clear(); |
1665 } | 1664 } |
1666 | 1665 |
1667 } // namespace compiler | 1666 } // namespace compiler |
1668 } // namespace internal | 1667 } // namespace internal |
1669 } // namespace v8 | 1668 } // namespace v8 |
OLD | NEW |