Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(113)

Unified Diff: src/compiler/loop-analysis.h

Issue 816053002: [turbofan] First version of loop peeling. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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

Powered by Google App Engine
This is Rietveld 408576698