Chromium Code Reviews| Index: src/compiler/node-matchers.h |
| diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h |
| index 1cdb6547f4e7d831c616d8ec5c337d64a25c7449..e0c90051cc47604a54a60566c48870b95797c1d8 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 IfProjsAreOwned() const { |
|
Benedikt Meurer
2015/04/07 07:19:01
Nit: Please rename to ProjectionsAreOwned() or IsP
titzer
2015/04/07 08:41:00
Done.
|
| + 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 |