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

Unified Diff: test/unittests/compiler/node-test-utils.cc

Issue 1458603012: [Interpreter] Add CreateClosure to BytecodeGraphBuilder. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Revised to avoid CreateClosureParameters in unittest. Created 5 years, 1 month 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
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..638e9f77df72510ac4474f4d569d286713ac337f 100644
--- a/test/unittests/compiler/node-test-utils.cc
+++ b/test/unittests/compiler/node-test-utils.cc
@@ -1858,6 +1858,56 @@ class IsJSCallMatcher final : public NodeMatcher {
const Matcher<Node*> control_matcher_;
};
+
+class IsCreateClosureMatcher final : public NodeMatcher {
+ public:
+ IsCreateClosureMatcher(
+ const Matcher<SharedFunctionInfo*>& shared_function_info_matcher,
+ const Matcher<PretenureFlag>& pretenure_flag_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher)
+ : NodeMatcher(IrOpcode::Value::kJSCreateClosure),
+ shared_function_info_matcher_(shared_function_info_matcher),
+ pretenure_flag_matcher_(pretenure_flag_matcher),
+ effect_matcher_(effect_matcher),
+ control_matcher_(control_matcher) {}
+
+ void DescribeTo(std::ostream* os) const final {
+ NodeMatcher::DescribeTo(os);
+ *os << " whose value (";
+ shared_function_info_matcher_.DescribeTo(os);
+ *os << ", ";
+ pretenure_flag_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).shared_info(),
+ "value.shared_info", shared_function_info_matcher_, listener) &&
+ PrintMatchAndExplain(
+ OpParameter<CreateClosureParameters>(node).pretenure(),
+ "value.pretenure", pretenure_flag_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect",
+ effect_matcher_, listener) &&
+ PrintMatchAndExplain(NodeProperties::GetControlInput(node),
+ "control", control_matcher_, listener));
+ }
+
+ private:
+ const Matcher<SharedFunctionInfo*> shared_function_info_matcher_;
+ const Matcher<PretenureFlag> pretenure_flag_matcher_;
+ const Matcher<Node*> effect_matcher_;
+ const Matcher<Node*> control_matcher_;
+};
+
} // namespace
@@ -2535,6 +2585,17 @@ Matcher<Node*> IsJSCallRuntime(std::vector<Matcher<Node*>> value_matchers,
}
+Matcher<Node*> IsCreateClosure(
+ const Matcher<SharedFunctionInfo*>& shared_function_info_matcher,
+ const Matcher<PretenureFlag>& pretenure_flag_matcher,
+ const Matcher<Node*>& effect_matcher,
+ const Matcher<Node*>& control_matcher) {
+ return MakeMatcher(new IsCreateClosureMatcher(
+ shared_function_info_matcher, pretenure_flag_matcher, effect_matcher,
+ control_matcher));
+}
+
+
#define IS_BINOP_MATCHER(Name) \
Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \
const Matcher<Node*>& rhs_matcher) { \
« src/compiler/bytecode-graph-builder.cc ('K') | « test/unittests/compiler/node-test-utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698