Index: src/compiler/loop-analysis.h |
diff --git a/src/compiler/loop-analysis.h b/src/compiler/loop-analysis.h |
index 8c8d19ac690ebc30231fe662b11a4c8b149b70a2..f58ab5b0b23c14451316bcb2ae6966d0920e151d 100644 |
--- a/src/compiler/loop-analysis.h |
+++ b/src/compiler/loop-analysis.h |
@@ -37,6 +37,7 @@ class LoopTree : public ZoneObject { |
size_t HeaderSize() const { return body_start_ - header_start_; } |
size_t BodySize() const { return body_end_ - body_start_; } |
size_t TotalSize() const { return body_end_ - header_start_; } |
+ size_t depth() const { return static_cast<size_t>(depth_); } |
private: |
friend class LoopTree; |
@@ -94,6 +95,22 @@ class LoopTree : public ZoneObject { |
&loop_nodes_[0] + loop->body_end_); |
} |
+ // Return a range which can iterate over the nodes of {loop}. |
+ NodeRange LoopNodes(Loop* loop) { |
+ return NodeRange(&loop_nodes_[0] + loop->header_start_, |
+ &loop_nodes_[0] + loop->body_end_); |
+ } |
+ |
+ // Return the node that represents the control, i.e. the loop node itself. |
+ Node* GetLoopControl(Loop* loop) { |
+ // TODO(turbofan): make the loop control node always first? |
+ for (Node* node : HeaderNodes(loop)) { |
+ if (node->opcode() == IrOpcode::kLoop) return node; |
+ } |
+ UNREACHABLE(); |
+ return NULL; |
+ } |
+ |
private: |
friend class LoopFinderImpl; |
@@ -128,6 +145,7 @@ class LoopFinder { |
static LoopTree* BuildLoopTree(Graph* graph, Zone* temp_zone); |
}; |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |