Chromium Code Reviews| 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 bfb9c06960c0424db611e33a32217dbd96882af4..41f6778f1df4a2c3f371237d618862cbe992d458 100644 |
| --- a/test/unittests/compiler/node-test-utils.cc |
| +++ b/test/unittests/compiler/node-test-utils.cc |
| @@ -1404,6 +1404,7 @@ class IsUnopMatcher final : public NodeMatcher { |
| const Matcher<Node*> input_matcher_; |
| }; |
| + |
| class IsParameterMatcher final : public NodeMatcher { |
| public: |
| explicit IsParameterMatcher(const Matcher<int>& index_matcher) |
| @@ -1425,6 +1426,60 @@ class IsParameterMatcher final : public NodeMatcher { |
| const Matcher<int> index_matcher_; |
| }; |
| + |
| +// TODO(mythria): Check if we can use the same matcher for Load and Store |
| +class IsNamedLoadMatcher final : public NodeMatcher { |
|
rmcilroy
2015/11/11 14:23:51
/s/IsNamedLoadMatcher/IsJsLoadNamedMatcher/
rmcilroy
2015/11/11 14:24:56
Actually to correct case: IsJSLoadNamedMatcher
mythria
2015/11/11 15:32:50
Done.
|
| + public: |
| + IsNamedLoadMatcher(const Matcher<Handle<Name>>& name_matcher, |
| + const Matcher<Node*>& object_value_matcher, |
| + const Matcher<Node*>& feedback_vector_matcher, |
| + const Matcher<Node*>& effect_matcher, |
| + const Matcher<Node*>& control_matcher) |
| + : NodeMatcher(IrOpcode::kJSLoadNamed), |
| + name_matcher_(name_matcher), |
| + object_value_matcher_(object_value_matcher), |
| + feedback_vector_matcher_(feedback_vector_matcher), |
| + effect_matcher_(effect_matcher), |
| + control_matcher_(control_matcher) {} |
| + |
| + void DescribeTo(std::ostream* os) const final { |
| + NodeMatcher::DescribeTo(os); |
| + *os << " whose object ("; |
| + object_value_matcher_.DescribeTo(os); |
| + *os << "), name ("; |
| + name_matcher_.DescribeTo(os); |
| + *os << "), feedback vector ("; |
| + feedback_vector_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 { |
| + return (NodeMatcher::MatchAndExplain(node, listener) && |
| + PrintMatchAndExplain(OpParameter<const NamedAccess>(node).name(), |
| + "descriptor", name_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| + "object", object_value_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), |
| + "feedback vector", feedback_vector_matcher_, |
| + listener) && |
| + PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| + effect_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| + "control", control_matcher_, listener)); |
| + } |
| + |
| + private: |
| + const Matcher<Handle<Name>> name_matcher_; |
| + const Matcher<Node*> object_value_matcher_; |
| + const Matcher<Node*> feedback_vector_matcher_; |
| + const Matcher<Node*> effect_matcher_; |
| + const Matcher<Node*> control_matcher_; |
| +}; |
| + |
| } // namespace |
| @@ -1998,6 +2053,17 @@ Matcher<Node*> IsLoadFramePointer() { |
| } |
| +Matcher<Node*> IsJSLoadNamed(const Handle<Name> name, |
| + const Matcher<Node*>& object_value_matcher, |
| + const Matcher<Node*>& feedback_vector_matcher, |
| + const Matcher<Node*>& effect_matcher, |
| + const Matcher<Node*>& control_matcher) { |
| + return MakeMatcher(new IsNamedLoadMatcher(name, object_value_matcher, |
| + feedback_vector_matcher, |
| + effect_matcher, control_matcher)); |
| +} |
| + |
| + |
| #define IS_BINOP_MATCHER(Name) \ |
| Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ |
| const Matcher<Node*>& rhs_matcher) { \ |