Index: test/unittests/compiler/node-test-utils.cc |
diff --git a/test/unittests/compiler/node-test-utils.cc b/test/unittests/compiler/node-test-utils.cc |
index 9b8d19eea276ac58bbefe04819de987b789db518..06b4ebecb30f2db1fb5eddb39afd5db98524183f 100644 |
--- a/test/unittests/compiler/node-test-utils.cc |
+++ b/test/unittests/compiler/node-test-utils.cc |
@@ -800,6 +800,46 @@ class IsReferenceEqualMatcher final : public NodeMatcher { |
const Matcher<Node*> rhs_matcher_; |
}; |
+class IsSpeculativeBinopMatcher final : public NodeMatcher { |
+ public: |
+ IsSpeculativeBinopMatcher( |
+ IrOpcode::Value opcode, |
+ const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
+ const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
+ const Matcher<Node*>& frame_state_matcher, |
+ const Matcher<Node*>& effect_matcher, |
+ const Matcher<Node*>& control_matcher) |
+ : NodeMatcher(opcode), |
+ lhs_matcher_(lhs_matcher), |
+ rhs_matcher_(rhs_matcher), |
+ frame_state_matcher_(frame_state_matcher), |
+ effect_matcher_(effect_matcher), |
+ control_matcher_(control_matcher) {} |
+ |
+ bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
+ return (NodeMatcher::MatchAndExplain(node, listener) && |
+ // TODO(bmeurer): The type parameter is currently ignored. |
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
+ lhs_matcher_, listener) && |
+ PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
+ rhs_matcher_, listener) && |
+ PrintMatchAndExplain(NodeProperties::GetFrameStateInput(node, 0), |
+ "frame state", frame_state_matcher_, |
+ listener) && |
+ PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
+ effect_matcher_, listener) && |
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
+ "control", control_matcher_, listener)); |
+ } |
+ |
+ private: |
+ const Matcher<Type*> type_matcher_; |
+ const Matcher<Node*> lhs_matcher_; |
+ const Matcher<Node*> rhs_matcher_; |
+ const Matcher<Node*> frame_state_matcher_; |
+ const Matcher<Node*> effect_matcher_; |
+ const Matcher<Node*> control_matcher_; |
+}; |
class IsAllocateMatcher final : public NodeMatcher { |
public: |
@@ -2029,6 +2069,27 @@ Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, |
new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); |
} |
+Matcher<Node*> IsSpeculativeNumberAdd( |
+ const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
+ const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
+ const Matcher<Node*>& frame_state_matcher, |
+ const Matcher<Node*>& effect_matcher, |
+ const Matcher<Node*>& control_matcher) { |
+ return MakeMatcher(new IsSpeculativeBinopMatcher( |
+ IrOpcode::kSpeculativeNumberAdd, hint_matcher, lhs_matcher, rhs_matcher, |
+ frame_state_matcher, effect_matcher, control_matcher)); |
+} |
+ |
+Matcher<Node*> IsSpeculativeNumberSubtract( |
+ const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
+ const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
+ const Matcher<Node*>& frame_state_matcher, |
+ const Matcher<Node*>& effect_matcher, |
+ const Matcher<Node*>& control_matcher) { |
+ return MakeMatcher(new IsSpeculativeBinopMatcher( |
+ IrOpcode::kSpeculativeNumberSubtract, hint_matcher, lhs_matcher, |
+ rhs_matcher, frame_state_matcher, effect_matcher, control_matcher)); |
+} |
Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, |
const Matcher<Node*>& effect_matcher, |