OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/compiler/access-builder.h" | 7 #include "src/compiler/access-builder.h" |
8 #include "src/compiler/common-operator.h" | 8 #include "src/compiler/common-operator.h" |
9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
10 #include "src/compiler/graph-visualizer.h" | 10 #include "src/compiler/graph-visualizer.h" |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 loop->nodes[i] = schedule->NewBasicBlock(); | 79 loop->nodes[i] = schedule->NewBasicBlock(); |
80 if (i > 0) { | 80 if (i > 0) { |
81 schedule->AddSuccessorForTesting(loop->nodes[i - 1], loop->nodes[i]); | 81 schedule->AddSuccessorForTesting(loop->nodes[i - 1], loop->nodes[i]); |
82 } | 82 } |
83 } | 83 } |
84 schedule->AddSuccessorForTesting(loop->nodes[count - 1], loop->nodes[0]); | 84 schedule->AddSuccessorForTesting(loop->nodes[count - 1], loop->nodes[0]); |
85 return loop; | 85 return loop; |
86 } | 86 } |
87 | 87 |
88 | 88 |
89 static int GetScheduledNodeCount(Schedule* schedule) { | 89 static int GetScheduledNodeCount(const Schedule* schedule) { |
90 int node_count = 0; | 90 size_t node_count = 0; |
91 for (BasicBlockVectorIter i = schedule->rpo_order()->begin(); | 91 for (auto block : *schedule->rpo_order()) { |
92 i != schedule->rpo_order()->end(); ++i) { | 92 node_count += block->NodeCount(); |
93 BasicBlock* block = *i; | 93 if (block->control() != BasicBlock::kNone) ++node_count; |
94 for (BasicBlock::const_iterator j = block->begin(); j != block->end(); | |
95 ++j) { | |
96 ++node_count; | |
97 } | |
98 BasicBlock::Control control = block->control(); | |
99 if (control != BasicBlock::kNone) { | |
100 ++node_count; | |
101 } | |
102 } | 94 } |
103 return node_count; | 95 return static_cast<int>(node_count); |
104 } | 96 } |
105 | 97 |
106 | 98 |
107 static Schedule* ComputeAndVerifySchedule(int expected, Graph* graph) { | 99 static Schedule* ComputeAndVerifySchedule(int expected, Graph* graph) { |
108 if (FLAG_trace_turbo) { | 100 if (FLAG_trace_turbo) { |
109 OFStream os(stdout); | 101 OFStream os(stdout); |
110 os << AsDOT(*graph); | 102 os << AsDOT(*graph); |
111 } | 103 } |
112 | 104 |
113 Schedule* schedule = Scheduler::ComputeSchedule(graph->zone(), graph); | 105 Schedule* schedule = Scheduler::ComputeSchedule(graph->zone(), graph); |
(...skipping 2001 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2115 graph.SetEnd(end); | 2107 graph.SetEnd(end); |
2116 | 2108 |
2117 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); | 2109 Schedule* schedule = ComputeAndVerifySchedule(6, &graph); |
2118 BasicBlock* block = schedule->block(loop); | 2110 BasicBlock* block = schedule->block(loop); |
2119 CHECK_NE(NULL, loop); | 2111 CHECK_NE(NULL, loop); |
2120 CHECK_EQ(block, schedule->block(effect)); | 2112 CHECK_EQ(block, schedule->block(effect)); |
2121 CHECK_GE(block->rpo_number(), 0); | 2113 CHECK_GE(block->rpo_number(), 0); |
2122 } | 2114 } |
2123 | 2115 |
2124 #endif | 2116 #endif |
OLD | NEW |