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 f5962ef2d3f96ec94643d7f90c98e5bfe5770c44..fcc238cf83eedd31224585b2f8a1657a53007135 100644 |
| --- a/test/unittests/compiler/node-test-utils.cc |
| +++ b/test/unittests/compiler/node-test-utils.cc |
| @@ -7,6 +7,7 @@ |
| #include <vector> |
| #include "src/assembler.h" |
| +#include "src/compiler/common-operator.h" |
| #include "src/compiler/js-operator.h" |
| #include "src/compiler/node-properties.h" |
| #include "src/compiler/simplified-operator.h" |
| @@ -1375,6 +1376,27 @@ class IsUnopMatcher final : public NodeMatcher { |
| const Matcher<Node*> input_matcher_; |
| }; |
| +class IsParameterMatcher final : public NodeMatcher { |
| + public: |
| + explicit IsParameterMatcher(const Matcher<int>& index_matcher) |
| + : NodeMatcher(IrOpcode::kParameter), index_matcher_(index_matcher) {} |
| + |
| + void DescribeTo(std::ostream* os) const override { |
| + *os << "is a Parameter node with index("; |
| + index_matcher_.DescribeTo(os); |
| + *os << ")"; |
| + } |
| + |
| + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| + return (NodeMatcher::MatchAndExplain(node, listener) && |
| + PrintMatchAndExplain(ParameterIndexOf(node->op()), "index", |
| + index_matcher_, listener)); |
| + } |
| + |
| + private: |
| + const Matcher<int> index_matcher_; |
| +}; |
| + |
| } // namespace |
| @@ -1678,6 +1700,20 @@ Matcher<Node*> IsTailCall( |
| } |
| +Matcher<Node*> IsTailCall( |
| + const Matcher<CallDescriptor const*>& descriptor_matcher, |
| + const Matcher<Node*>& value0_matcher, const Matcher<Node*>& value1_matcher, |
| + const Matcher<Node*>& value2_matcher, const Matcher<Node*>& effect_matcher, |
| + const Matcher<Node*>& control_matcher) { |
| + std::vector<Matcher<Node*>> value_matchers; |
| + value_matchers.push_back(value0_matcher); |
| + value_matchers.push_back(value1_matcher); |
| + value_matchers.push_back(value2_matcher); |
| + return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, |
| + effect_matcher, control_matcher)); |
| +} |
| + |
| + |
| Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, |
| const Matcher<Node*>& lhs_matcher, |
| const Matcher<Node*>& rhs_matcher) { |
| @@ -1799,6 +1835,16 @@ Matcher<Node*> IsLoadContext(const Matcher<ContextAccess>& access_matcher, |
| } |
| +Matcher<Node*> IsParameter(const Matcher<int> index_matcher) { |
| + return MakeMatcher(new IsParameterMatcher(index_matcher)); |
| +} |
| + |
| + |
| +Matcher<Node*> IsLoadFramePointer() { |
| + return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer)); |
| +} |
| + |
| + |
| #define IS_BINOP_MATCHER(Name) \ |
| Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ |
| const Matcher<Node*>& rhs_matcher) { \ |
| @@ -1842,6 +1888,16 @@ IS_BINOP_MATCHER(Float64InsertLowWord32) |
| IS_BINOP_MATCHER(Float64InsertHighWord32) |
| #undef IS_BINOP_MATCHER |
| +#define IS_INTPTR_BINOP_MATCHER(Prefix, Name) \ |
| + Matcher<Node*> IsIntPtr##Name(const Matcher<Node*>& lhs_matcher, \ |
|
Michael Starzinger
2015/07/23 11:05:04
I would be fine with having these helper based on
rmcilroy
2015/07/23 11:58:54
Done.
|
| + const Matcher<Node*>& rhs_matcher) { \ |
| + return MakeMatcher(new IsBinopMatcher(kPointerSize == 8 \ |
| + ? IrOpcode::k##Prefix##64##Name \ |
| + : IrOpcode::k##Prefix##32##Name, \ |
| + lhs_matcher, rhs_matcher)); \ |
| + } |
| +IS_INTPTR_BINOP_MATCHER(Int, Add) |
| +#undef IS_INTPTR_BINOP_MATCHER |
| #define IS_UNOP_MATCHER(Name) \ |
| Matcher<Node*> Is##Name(const Matcher<Node*>& input_matcher) { \ |