OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 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/common-operator.h" | 5 #include "src/compiler/common-operator.h" |
6 #include "src/compiler/graph.h" | 6 #include "src/compiler/graph.h" |
7 #include "src/compiler/loop-peeling.h" | 7 #include "src/compiler/loop-peeling.h" |
8 #include "src/compiler/node.h" | 8 #include "src/compiler/node.h" |
9 #include "src/compiler/node-marker.h" | 9 #include "src/compiler/node-marker.h" |
10 #include "src/compiler/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 unmarked_exit = (node->InputAt(1) != loop_node); | 179 unmarked_exit = (node->InputAt(1) != loop_node); |
180 break; | 180 break; |
181 case IrOpcode::kLoopExitValue: | 181 case IrOpcode::kLoopExitValue: |
182 case IrOpcode::kLoopExitEffect: | 182 case IrOpcode::kLoopExitEffect: |
183 unmarked_exit = (node->InputAt(1)->InputAt(1) != loop_node); | 183 unmarked_exit = (node->InputAt(1)->InputAt(1) != loop_node); |
184 break; | 184 break; |
185 default: | 185 default: |
186 unmarked_exit = (use->opcode() != IrOpcode::kTerminate); | 186 unmarked_exit = (use->opcode() != IrOpcode::kTerminate); |
187 } | 187 } |
188 if (unmarked_exit) { | 188 if (unmarked_exit) { |
189 if (FLAG_trace_turbo_graph) { | 189 if (FLAG_trace_turbo_loop) { |
190 Node* loop_node = loop_tree->GetLoopControl(loop); | 190 Node* loop_node = loop_tree->GetLoopControl(loop); |
191 PrintF( | 191 PrintF( |
192 "Cannot peel loop %i. Loop exit without explicit mark: Node %i " | 192 "Cannot peel loop %i. Loop exit without explicit mark: Node %i " |
193 "(%s) is inside " | 193 "(%s) is inside " |
194 "loop, but its use %i (%s) is outside.\n", | 194 "loop, but its use %i (%s) is outside.\n", |
195 loop_node->id(), node->id(), node->op()->mnemonic(), use->id(), | 195 loop_node->id(), node->id(), node->op()->mnemonic(), use->id(), |
196 use->op()->mnemonic()); | 196 use->op()->mnemonic()); |
197 } | 197 } |
198 return false; | 198 return false; |
199 } | 199 } |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 Zone* temp_zone) { | 305 Zone* temp_zone) { |
306 // If the loop has nested loops, peel inside those. | 306 // If the loop has nested loops, peel inside those. |
307 if (!loop->children().empty()) { | 307 if (!loop->children().empty()) { |
308 for (LoopTree::Loop* inner_loop : loop->children()) { | 308 for (LoopTree::Loop* inner_loop : loop->children()) { |
309 PeelInnerLoops(graph, common, loop_tree, inner_loop, temp_zone); | 309 PeelInnerLoops(graph, common, loop_tree, inner_loop, temp_zone); |
310 } | 310 } |
311 return; | 311 return; |
312 } | 312 } |
313 // Only peel small-enough loops. | 313 // Only peel small-enough loops. |
314 if (loop->TotalSize() > LoopPeeler::kMaxPeeledNodes) return; | 314 if (loop->TotalSize() > LoopPeeler::kMaxPeeledNodes) return; |
315 if (FLAG_trace_turbo_graph) { | 315 if (FLAG_trace_turbo_loop) { |
316 PrintF("Peeling loop with header: "); | 316 PrintF("Peeling loop with header: "); |
317 for (Node* node : loop_tree->HeaderNodes(loop)) { | 317 for (Node* node : loop_tree->HeaderNodes(loop)) { |
318 PrintF("%i ", node->id()); | 318 PrintF("%i ", node->id()); |
319 } | 319 } |
| 320 PrintF("\n"); |
320 } | 321 } |
321 | 322 |
322 LoopPeeler::Peel(graph, common, loop_tree, loop, temp_zone); | 323 LoopPeeler::Peel(graph, common, loop_tree, loop, temp_zone); |
323 } | 324 } |
324 | 325 |
325 void EliminateLoopExit(Node* node) { | 326 void EliminateLoopExit(Node* node) { |
326 DCHECK_EQ(IrOpcode::kLoopExit, node->opcode()); | 327 DCHECK_EQ(IrOpcode::kLoopExit, node->opcode()); |
327 // The exit markers take the loop exit as input. We iterate over uses | 328 // The exit markers take the loop exit as input. We iterate over uses |
328 // and remove all the markers from the graph. | 329 // and remove all the markers from the graph. |
329 for (Edge edge : node->use_edges()) { | 330 for (Edge edge : node->use_edges()) { |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
381 queue.push(control); | 382 queue.push(control); |
382 } | 383 } |
383 } | 384 } |
384 } | 385 } |
385 } | 386 } |
386 } | 387 } |
387 | 388 |
388 } // namespace compiler | 389 } // namespace compiler |
389 } // namespace internal | 390 } // namespace internal |
390 } // namespace v8 | 391 } // namespace v8 |
OLD | NEW |