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 713a4bc440889231b58a93f42e8490898c1442b7..b2c6d527911452aca945f146942d161ddc2c7768 100644 |
--- a/test/unittests/compiler/node-test-utils.cc |
+++ b/test/unittests/compiler/node-test-utils.cc |
@@ -1858,6 +1858,46 @@ class IsJSCallMatcher final : public NodeMatcher { |
const Matcher<Node*> control_matcher_; |
}; |
+ |
+class IsCreateClosureMatcher final : public NodeMatcher { |
+ public: |
+ IsCreateClosureMatcher(const Matcher<CreateClosureParameters>& value_matcher, |
+ const Matcher<Node*>& effect_matcher, |
+ const Matcher<Node*>& control_matcher) |
+ : NodeMatcher(IrOpcode::Value::kJSCreateClosure), |
+ value_matcher_(value_matcher), |
+ effect_matcher_(effect_matcher), |
+ control_matcher_(control_matcher) {} |
+ |
+ void DescribeTo(std::ostream* os) const final { |
+ NodeMatcher::DescribeTo(os); |
+ *os << " whose value ("; |
+ value_matcher_.DescribeTo(os); |
+ *os << "), effect ("; |
+ effect_matcher_.DescribeTo(os); |
+ *os << ") and control ("; |
+ control_matcher_.DescribeTo(os); |
+ *os << ")"; |
+ } |
+ |
+ bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
+ if (!NodeMatcher::MatchAndExplain(node, listener)) { |
+ return false; |
+ } |
+ return (PrintMatchAndExplain(OpParameter<CreateClosureParameters>(node), |
+ "value", value_matcher_, listener) && |
+ PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
+ effect_matcher_, listener) && |
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
+ "control", control_matcher_, listener)); |
+ } |
+ |
+ private: |
+ const Matcher<CreateClosureParameters> value_matcher_; |
+ const Matcher<Node*> effect_matcher_; |
+ const Matcher<Node*> control_matcher_; |
+}; |
+ |
} // namespace |
@@ -2535,6 +2575,15 @@ Matcher<Node*> IsJSCallRuntime(std::vector<Matcher<Node*>> value_matchers, |
} |
+Matcher<Node*> IsCreateClosure( |
+ const Matcher<CreateClosureParameters>& closure_parameter_matcher, |
+ const Matcher<Node*>& effect_matcher, |
+ const Matcher<Node*>& control_matcher) { |
+ return MakeMatcher(new IsCreateClosureMatcher( |
+ closure_parameter_matcher, effect_matcher, control_matcher)); |
+} |
+ |
+ |
#define IS_BINOP_MATCHER(Name) \ |
Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ |
const Matcher<Node*>& rhs_matcher) { \ |