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 713a4bc440889231b58a93f42e8490898c1442b7..97f31e9b5d6c711792b394aa69c9b840f429b548 100644 |
| --- a/test/unittests/compiler/node-test-utils.cc |
| +++ b/test/unittests/compiler/node-test-utils.cc |
| @@ -1406,6 +1406,122 @@ class IsUnopMatcher final : public NodeMatcher { |
| }; |
| +class IsJSBinopMatcher final : public NodeMatcher { |
|
mythria
2015/11/30 12:34:25
I removed this part.
|
| + public: |
| + IsJSBinopMatcher(IrOpcode::Value opcode, const Matcher<Node*>& lhs_matcher, |
| + const Matcher<Node*>& rhs_matcher, |
| + const Matcher<Node*>& effect_matcher, |
| + const Matcher<Node*>& control_matcher) |
| + : NodeMatcher(opcode), |
| + lhs_matcher_(lhs_matcher), |
| + rhs_matcher_(rhs_matcher), |
| + effect_matcher_(effect_matcher), |
| + control_matcher_(control_matcher) {} |
| + |
| + void DescribeTo(std::ostream* os) const final { |
| + NodeMatcher::DescribeTo(os); |
| + *os << " whose lhs ("; |
| + lhs_matcher_.DescribeTo(os); |
| + *os << "), and rhs ("; |
| + rhs_matcher_.DescribeTo(os); |
| + *os << "), and effect ("; |
| + rhs_matcher_.DescribeTo(os); |
| + *os << "), and control ("; |
| + rhs_matcher_.DescribeTo(os); |
| + *os << ")"; |
| + } |
| + |
| + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| + return (NodeMatcher::MatchAndExplain(node, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
| + lhs_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
| + rhs_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| + effect_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| + "control", control_matcher_, listener)); |
| + } |
| + |
| + private: |
| + const Matcher<Node*> lhs_matcher_; |
| + const Matcher<Node*> rhs_matcher_; |
| + const Matcher<Node*> effect_matcher_; |
| + const Matcher<Node*> control_matcher_; |
| +}; |
| + |
| + |
| +class IsUnopWithEffectMatcher final : public NodeMatcher { |
| + public: |
| + IsUnopWithEffectMatcher(IrOpcode::Value opcode, |
| + const Matcher<Node*>& input_matcher, |
| + const Matcher<Node*>& effect_matcher) |
| + : NodeMatcher(opcode), |
| + input_matcher_(input_matcher), |
| + effect_matcher_(effect_matcher) {} |
| + |
| + void DescribeTo(std::ostream* os) const final { |
| + NodeMatcher::DescribeTo(os); |
| + *os << " whose input ("; |
| + input_matcher_.DescribeTo(os); |
| + *os << "), effect ("; |
| + effect_matcher_.DescribeTo(os); |
| + *os << ")"; |
| + } |
| + |
| + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| + return (NodeMatcher::MatchAndExplain(node, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| + "input", input_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| + effect_matcher_, listener)); |
| + } |
| + |
| + private: |
| + const Matcher<Node*> input_matcher_; |
| + const Matcher<Node*> effect_matcher_; |
| +}; |
| + |
| + |
| +class IsUnopEffectControlMatcher final : public NodeMatcher { |
| + public: |
| + IsUnopEffectControlMatcher(IrOpcode::Value opcode, |
| + const Matcher<Node*>& input_matcher, |
| + const Matcher<Node*>& effect_matcher, |
| + const Matcher<Node*>& control_matcher) |
| + : NodeMatcher(opcode), |
| + input_matcher_(input_matcher), |
| + effect_matcher_(effect_matcher), |
| + control_matcher_(control_matcher) {} |
| + |
| + void DescribeTo(std::ostream* os) const final { |
| + NodeMatcher::DescribeTo(os); |
| + *os << " whose input ("; |
| + input_matcher_.DescribeTo(os); |
| + *os << "), effect ("; |
| + effect_matcher_.DescribeTo(os); |
| + *os << "), control ("; |
| + control_matcher_.DescribeTo(os); |
| + *os << ")"; |
| + } |
| + |
| + bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| + return (NodeMatcher::MatchAndExplain(node, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), |
| + "input", input_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| + effect_matcher_, listener) && |
| + PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| + "control", control_matcher_, listener)); |
| + } |
| + |
| + private: |
| + const Matcher<Node*> input_matcher_; |
| + const Matcher<Node*> effect_matcher_; |
| + const Matcher<Node*> control_matcher_; |
| +}; |
| + |
| + |
| class IsParameterMatcher final : public NodeMatcher { |
| public: |
| explicit IsParameterMatcher(const Matcher<int>& index_matcher) |
| @@ -2535,6 +2651,16 @@ Matcher<Node*> IsJSCallRuntime(std::vector<Matcher<Node*>> value_matchers, |
| } |
| +Matcher<Node*> IsJSBinaryOperation(IrOpcode::Value opcode, |
|
mythria
2015/11/30 12:34:25
I removed this
|
| + const Matcher<Node*>& lhs_matcher, |
| + const Matcher<Node*>& rhs_matcher, |
| + const Matcher<Node*>& effect_matcher, |
| + const Matcher<Node*>& control_matcher) { |
| + return MakeMatcher(new IsJSBinopMatcher(opcode, lhs_matcher, rhs_matcher, |
| + effect_matcher, control_matcher)); |
| +} |
| + |
| + |
| #define IS_BINOP_MATCHER(Name) \ |
| Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ |
| const Matcher<Node*>& rhs_matcher) { \ |
| @@ -2572,7 +2698,6 @@ IS_BINOP_MATCHER(Uint32LessThanOrEqual) |
| IS_BINOP_MATCHER(Int64Add) |
| IS_BINOP_MATCHER(Int64Sub) |
| IS_BINOP_MATCHER(Int64Mul) |
| -IS_BINOP_MATCHER(JSAdd) |
| IS_BINOP_MATCHER(Float32Max) |
| IS_BINOP_MATCHER(Float32Min) |
| IS_BINOP_MATCHER(Float32Equal) |
| @@ -2613,10 +2738,32 @@ IS_UNOP_MATCHER(NumberToInt32) |
| IS_UNOP_MATCHER(NumberToUint32) |
| IS_UNOP_MATCHER(ObjectIsSmi) |
| IS_UNOP_MATCHER(Word32Clz) |
| -IS_UNOP_MATCHER(JSUnaryNot) |
| -IS_UNOP_MATCHER(JSTypeOf) |
| #undef IS_UNOP_MATCHER |
| + |
|
mythria
2015/11/30 12:34:25
I removed this.
|
| +#define IS_UNOP_EFFECT_MATCHER(Name) \ |
| + Matcher<Node*> Is##Name(const Matcher<Node*>& input_matcher, \ |
| + const Matcher<Node*>& effect_matcher) { \ |
| + return MakeMatcher(new IsUnopWithEffectMatcher( \ |
| + IrOpcode::k##Name, input_matcher, effect_matcher)); \ |
| + } |
| +IS_UNOP_EFFECT_MATCHER(JSUnaryNot) |
| +IS_UNOP_EFFECT_MATCHER(JSTypeOf) |
| +IS_UNOP_EFFECT_MATCHER(JSToBoolean) |
| +#undef IS_UNOP_EFFECT_MATCHER |
| + |
| + |
| +#define IS_UNOP_EFFECT_CONTROL_MATCHER(Name) \ |
| + Matcher<Node*> Is##Name(const Matcher<Node*>& input_matcher, \ |
| + const Matcher<Node*>& effect_matcher, \ |
| + const Matcher<Node*>& control_matcher) { \ |
| + return MakeMatcher(new IsUnopEffectControlMatcher( \ |
| + IrOpcode::k##Name, input_matcher, effect_matcher, control_matcher)); \ |
| + } |
| +IS_UNOP_EFFECT_CONTROL_MATCHER(JSToName) |
| +IS_UNOP_EFFECT_CONTROL_MATCHER(JSToObject) |
| +#undef IS_UNOP_EFFECT_CONTROL_MATCHER |
| + |
| } // namespace compiler |
| } // namespace internal |
| } // namespace v8 |