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

Unified Diff: src/compiler/node-matchers.h

Issue 1054963002: [turbofan] Introduce BranchMatcher and DiamondMatcher helpers. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 8 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/control-reducer.cc ('k') | src/compiler/node-matchers.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/compiler/node-matchers.h
diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h
index 1cdb6547f4e7d831c616d8ec5c337d64a25c7449..627829f4b56976a99e35a9ed23767995e1e821e9 100644
--- a/src/compiler/node-matchers.h
+++ b/src/compiler/node-matchers.h
@@ -542,6 +542,40 @@ typedef BaseWithIndexAndDisplacementMatcher<Int32AddMatcher>
typedef BaseWithIndexAndDisplacementMatcher<Int64AddMatcher>
BaseWithIndexAndDisplacement64Matcher;
+struct BranchMatcher : public NodeMatcher {
+ explicit BranchMatcher(Node* branch);
+
+ bool Matched() const { return if_true_ && if_false_; }
+
+ Node* Branch() const { return node(); }
+ Node* IfTrue() const { return if_true_; }
+ Node* IfFalse() const { return if_false_; }
+
+ private:
+ Node* if_true_;
+ Node* if_false_;
+};
+
+
+struct DiamondMatcher : public NodeMatcher {
+ explicit DiamondMatcher(Node* merge);
+
+ bool Matched() const { return branch_; }
+ bool IfProjectionsAreOwned() const {
+ return if_true_->OwnedBy(node()) && if_false_->OwnedBy(node());
+ }
+
+ Node* Branch() const { return branch_; }
+ Node* IfTrue() const { return if_true_; }
+ Node* IfFalse() const { return if_false_; }
+ Node* Merge() const { return node(); }
+
+ private:
+ Node* branch_;
+ Node* if_true_;
+ Node* if_false_;
+};
+
} // namespace compiler
} // namespace internal
} // namespace v8
« no previous file with comments | « src/compiler/control-reducer.cc ('k') | src/compiler/node-matchers.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698