Index: src/compiler/node-matchers.h |
diff --git a/src/compiler/node-matchers.h b/src/compiler/node-matchers.h |
index 627829f4b56976a99e35a9ed23767995e1e821e9..6beca7c2c898f32ca0b6df06daddc5b31e0f2a23 100644 |
--- a/src/compiler/node-matchers.h |
+++ b/src/compiler/node-matchers.h |
@@ -570,6 +570,20 @@ struct DiamondMatcher : public NodeMatcher { |
Node* IfFalse() const { return if_false_; } |
Node* Merge() const { return node(); } |
+ Node* TrueInputOf(Node* phi) const { |
+ DCHECK(IrOpcode::IsPhiOpcode(phi->opcode())); |
+ DCHECK_EQ(3, phi->InputCount()); |
+ DCHECK_EQ(Merge(), phi->InputAt(2)); |
+ return phi->InputAt(if_true_ == Merge()->InputAt(0) ? 0 : 1); |
+ } |
+ |
+ Node* FalseInputOf(Node* phi) const { |
+ DCHECK(IrOpcode::IsPhiOpcode(phi->opcode())); |
+ DCHECK_EQ(3, phi->InputCount()); |
+ DCHECK_EQ(Merge(), phi->InputAt(2)); |
+ return phi->InputAt(if_true_ == Merge()->InputAt(0) ? 1 : 0); |
+ } |
+ |
private: |
Node* branch_; |
Node* if_true_; |