Index: src/compiler/loop-analysis.h |
diff --git a/src/compiler/loop-analysis.h b/src/compiler/loop-analysis.h |
index 030c93d0ead6e0f7f4c003a5324fdf5017e73080..cd6cd98c331192829a41b6038293de000b53baf6 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; |
@@ -127,6 +144,7 @@ class LoopFinder { |
static LoopTree* BuildLoopTree(Graph* graph, Zone* temp_zone); |
}; |
+ |
} // namespace compiler |
} // namespace internal |
} // namespace v8 |