OLD | NEW |
1 // Copyright 2014 the V8 project authors. All rights reserved. | 1 // Copyright 2014 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "test/unittests/compiler/node-test-utils.h" | 5 #include "test/unittests/compiler/node-test-utils.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "src/assembler.h" | 9 #include "src/assembler.h" |
10 #include "src/compiler/common-operator.h" | 10 #include "src/compiler/common-operator.h" |
(...skipping 784 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
795 } | 795 } |
796 | 796 |
797 private: | 797 private: |
798 const Matcher<Type*> type_matcher_; | 798 const Matcher<Type*> type_matcher_; |
799 const Matcher<Node*> lhs_matcher_; | 799 const Matcher<Node*> lhs_matcher_; |
800 const Matcher<Node*> rhs_matcher_; | 800 const Matcher<Node*> rhs_matcher_; |
801 }; | 801 }; |
802 | 802 |
803 class IsSpeculativeBinopMatcher final : public NodeMatcher { | 803 class IsSpeculativeBinopMatcher final : public NodeMatcher { |
804 public: | 804 public: |
805 IsSpeculativeBinopMatcher( | 805 IsSpeculativeBinopMatcher(IrOpcode::Value opcode, |
806 IrOpcode::Value opcode, | 806 const Matcher<NumberOperationHint>& hint_matcher, |
807 const Matcher<BinaryOperationHints::Hint>& hint_matcher, | 807 const Matcher<Node*>& lhs_matcher, |
808 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, | 808 const Matcher<Node*>& rhs_matcher, |
809 const Matcher<Node*>& effect_matcher, | 809 const Matcher<Node*>& effect_matcher, |
810 const Matcher<Node*>& control_matcher) | 810 const Matcher<Node*>& control_matcher) |
811 : NodeMatcher(opcode), | 811 : NodeMatcher(opcode), |
812 hint_matcher_(hint_matcher), | 812 hint_matcher_(hint_matcher), |
813 lhs_matcher_(lhs_matcher), | 813 lhs_matcher_(lhs_matcher), |
814 rhs_matcher_(rhs_matcher), | 814 rhs_matcher_(rhs_matcher), |
815 effect_matcher_(effect_matcher), | 815 effect_matcher_(effect_matcher), |
816 control_matcher_(control_matcher) {} | 816 control_matcher_(control_matcher) {} |
817 | 817 |
818 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 818 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
819 return (NodeMatcher::MatchAndExplain(node, listener) && | 819 return (NodeMatcher::MatchAndExplain(node, listener) && |
820 // TODO(bmeurer): The type parameter is currently ignored. | 820 // TODO(bmeurer): The type parameter is currently ignored. |
821 PrintMatchAndExplain( | 821 PrintMatchAndExplain(OpParameter<NumberOperationHint>(node->op()), |
822 OpParameter<BinaryOperationHints::Hint>(node->op()), "hints", | 822 "hints", hint_matcher_, listener) && |
823 hint_matcher_, listener) && | |
824 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", | 823 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
825 lhs_matcher_, listener) && | 824 lhs_matcher_, listener) && |
826 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", | 825 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
827 rhs_matcher_, listener) && | 826 rhs_matcher_, listener) && |
828 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 827 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
829 effect_matcher_, listener) && | 828 effect_matcher_, listener) && |
830 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 829 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
831 "control", control_matcher_, listener)); | 830 "control", control_matcher_, listener)); |
832 } | 831 } |
833 | 832 |
834 private: | 833 private: |
835 const Matcher<BinaryOperationHints::Hint> hint_matcher_; | 834 const Matcher<NumberOperationHint> hint_matcher_; |
836 const Matcher<Type*> type_matcher_; | 835 const Matcher<Type*> type_matcher_; |
837 const Matcher<Node*> lhs_matcher_; | 836 const Matcher<Node*> lhs_matcher_; |
838 const Matcher<Node*> rhs_matcher_; | 837 const Matcher<Node*> rhs_matcher_; |
839 const Matcher<Node*> effect_matcher_; | 838 const Matcher<Node*> effect_matcher_; |
840 const Matcher<Node*> control_matcher_; | 839 const Matcher<Node*> control_matcher_; |
841 }; | 840 }; |
842 | 841 |
843 class IsAllocateMatcher final : public NodeMatcher { | 842 class IsAllocateMatcher final : public NodeMatcher { |
844 public: | 843 public: |
845 IsAllocateMatcher(const Matcher<Node*>& size_matcher, | 844 IsAllocateMatcher(const Matcher<Node*>& size_matcher, |
(...skipping 1190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2036 effect_matcher, control_matcher)); | 2035 effect_matcher, control_matcher)); |
2037 } | 2036 } |
2038 | 2037 |
2039 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, | 2038 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, |
2040 const Matcher<Node*>& lhs_matcher, | 2039 const Matcher<Node*>& lhs_matcher, |
2041 const Matcher<Node*>& rhs_matcher) { | 2040 const Matcher<Node*>& rhs_matcher) { |
2042 return MakeMatcher( | 2041 return MakeMatcher( |
2043 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); | 2042 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); |
2044 } | 2043 } |
2045 | 2044 |
2046 #define DEFINE_SPECULATIVE_BINOP_MATCHER(opcode) \ | 2045 #define DEFINE_SPECULATIVE_BINOP_MATCHER(opcode) \ |
2047 Matcher<Node*> Is##opcode( \ | 2046 Matcher<Node*> Is##opcode(const Matcher<NumberOperationHint>& hint_matcher, \ |
2048 const Matcher<BinaryOperationHints::Hint>& hint_matcher, \ | 2047 const Matcher<Node*>& lhs_matcher, \ |
2049 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, \ | 2048 const Matcher<Node*>& rhs_matcher, \ |
2050 const Matcher<Node*>& effect_matcher, \ | 2049 const Matcher<Node*>& effect_matcher, \ |
2051 const Matcher<Node*>& control_matcher) { \ | 2050 const Matcher<Node*>& control_matcher) { \ |
2052 return MakeMatcher(new IsSpeculativeBinopMatcher( \ | 2051 return MakeMatcher(new IsSpeculativeBinopMatcher( \ |
2053 IrOpcode::k##opcode, hint_matcher, lhs_matcher, rhs_matcher, \ | 2052 IrOpcode::k##opcode, hint_matcher, lhs_matcher, rhs_matcher, \ |
2054 effect_matcher, control_matcher)); \ | 2053 effect_matcher, control_matcher)); \ |
2055 } | 2054 } |
2056 SPECULATIVE_BINOPS(DEFINE_SPECULATIVE_BINOP_MATCHER); | 2055 SPECULATIVE_BINOPS(DEFINE_SPECULATIVE_BINOP_MATCHER); |
2057 #undef DEFINE_SPECULATIVE_BINOP_MATCHER | 2056 #undef DEFINE_SPECULATIVE_BINOP_MATCHER |
2058 | 2057 |
2059 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, | 2058 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, |
2060 const Matcher<Node*>& effect_matcher, | 2059 const Matcher<Node*>& effect_matcher, |
2061 const Matcher<Node*>& control_matcher) { | 2060 const Matcher<Node*>& control_matcher) { |
2062 return MakeMatcher( | 2061 return MakeMatcher( |
2063 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); | 2062 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); |
2064 } | 2063 } |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2339 IS_UNOP_MATCHER(StringFromCharCode) | 2338 IS_UNOP_MATCHER(StringFromCharCode) |
2340 IS_UNOP_MATCHER(Word32Clz) | 2339 IS_UNOP_MATCHER(Word32Clz) |
2341 IS_UNOP_MATCHER(Word32Ctz) | 2340 IS_UNOP_MATCHER(Word32Ctz) |
2342 IS_UNOP_MATCHER(Word32Popcnt) | 2341 IS_UNOP_MATCHER(Word32Popcnt) |
2343 IS_UNOP_MATCHER(Word32ReverseBytes) | 2342 IS_UNOP_MATCHER(Word32ReverseBytes) |
2344 #undef IS_UNOP_MATCHER | 2343 #undef IS_UNOP_MATCHER |
2345 | 2344 |
2346 } // namespace compiler | 2345 } // namespace compiler |
2347 } // namespace internal | 2346 } // namespace internal |
2348 } // namespace v8 | 2347 } // namespace v8 |
OLD | NEW |