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

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
« no previous file with comments | « src/compiler/graph-visualizer.cc ('k') | src/compiler/loop-analysis.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « src/compiler/graph-visualizer.cc ('k') | src/compiler/loop-analysis.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698