| 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 #ifndef V8_COMPILER_LOOP_ANALYSIS_H_ | 5 #ifndef V8_COMPILER_LOOP_ANALYSIS_H_ |
| 6 #define V8_COMPILER_LOOP_ANALYSIS_H_ | 6 #define V8_COMPILER_LOOP_ANALYSIS_H_ |
| 7 | 7 |
| 8 #include "src/base/iterator.h" | 8 #include "src/base/iterator.h" |
| 9 #include "src/compiler/graph.h" | 9 #include "src/compiler/graph.h" |
| 10 #include "src/compiler/node.h" | 10 #include "src/compiler/node.h" |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 // Return the node that represents the control, i.e. the loop node itself. | 109 // Return the node that represents the control, i.e. the loop node itself. |
| 110 Node* GetLoopControl(Loop* loop) { | 110 Node* GetLoopControl(Loop* loop) { |
| 111 // TODO(turbofan): make the loop control node always first? | 111 // TODO(turbofan): make the loop control node always first? |
| 112 for (Node* node : HeaderNodes(loop)) { | 112 for (Node* node : HeaderNodes(loop)) { |
| 113 if (node->opcode() == IrOpcode::kLoop) return node; | 113 if (node->opcode() == IrOpcode::kLoop) return node; |
| 114 } | 114 } |
| 115 UNREACHABLE(); | 115 UNREACHABLE(); |
| 116 return nullptr; | 116 return nullptr; |
| 117 } | 117 } |
| 118 | 118 |
| 119 Zone* zone() const { return zone_; } |
| 120 |
| 119 private: | 121 private: |
| 120 friend class LoopFinderImpl; | 122 friend class LoopFinderImpl; |
| 121 | 123 |
| 122 Loop* NewLoop() { | 124 Loop* NewLoop() { |
| 123 all_loops_.push_back(Loop(zone_)); | 125 all_loops_.push_back(Loop(zone_)); |
| 124 Loop* result = &all_loops_.back(); | 126 Loop* result = &all_loops_.back(); |
| 125 return result; | 127 return result; |
| 126 } | 128 } |
| 127 | 129 |
| 128 void SetParent(Loop* parent, Loop* child) { | 130 void SetParent(Loop* parent, Loop* child) { |
| (...skipping 18 matching lines...) Expand all Loading... |
| 147 // Build a loop tree for the entire graph. | 149 // Build a loop tree for the entire graph. |
| 148 static LoopTree* BuildLoopTree(Graph* graph, Zone* temp_zone); | 150 static LoopTree* BuildLoopTree(Graph* graph, Zone* temp_zone); |
| 149 }; | 151 }; |
| 150 | 152 |
| 151 | 153 |
| 152 } // namespace compiler | 154 } // namespace compiler |
| 153 } // namespace internal | 155 } // namespace internal |
| 154 } // namespace v8 | 156 } // namespace v8 |
| 155 | 157 |
| 156 #endif // V8_COMPILER_LOOP_ANALYSIS_H_ | 158 #endif // V8_COMPILER_LOOP_ANALYSIS_H_ |
| OLD | NEW |