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 782 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
793 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", | 793 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
794 rhs_matcher_, listener)); | 794 rhs_matcher_, listener)); |
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 { |
| 804 public: |
| 805 IsSpeculativeBinopMatcher( |
| 806 IrOpcode::Value opcode, |
| 807 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
| 808 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
| 809 const Matcher<Node*>& frame_state_matcher, |
| 810 const Matcher<Node*>& effect_matcher, |
| 811 const Matcher<Node*>& control_matcher) |
| 812 : NodeMatcher(opcode), |
| 813 lhs_matcher_(lhs_matcher), |
| 814 rhs_matcher_(rhs_matcher), |
| 815 frame_state_matcher_(frame_state_matcher), |
| 816 effect_matcher_(effect_matcher), |
| 817 control_matcher_(control_matcher) {} |
| 818 |
| 819 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 820 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 821 // TODO(bmeurer): The type parameter is currently ignored. |
| 822 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
| 823 lhs_matcher_, listener) && |
| 824 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
| 825 rhs_matcher_, listener) && |
| 826 PrintMatchAndExplain(NodeProperties::GetFrameStateInput(node, 0), |
| 827 "frame state", frame_state_matcher_, |
| 828 listener) && |
| 829 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 830 effect_matcher_, listener) && |
| 831 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 832 "control", control_matcher_, listener)); |
| 833 } |
| 834 |
| 835 private: |
| 836 const Matcher<Type*> type_matcher_; |
| 837 const Matcher<Node*> lhs_matcher_; |
| 838 const Matcher<Node*> rhs_matcher_; |
| 839 const Matcher<Node*> frame_state_matcher_; |
| 840 const Matcher<Node*> effect_matcher_; |
| 841 const Matcher<Node*> control_matcher_; |
| 842 }; |
803 | 843 |
804 class IsAllocateMatcher final : public NodeMatcher { | 844 class IsAllocateMatcher final : public NodeMatcher { |
805 public: | 845 public: |
806 IsAllocateMatcher(const Matcher<Node*>& size_matcher, | 846 IsAllocateMatcher(const Matcher<Node*>& size_matcher, |
807 const Matcher<Node*>& effect_matcher, | 847 const Matcher<Node*>& effect_matcher, |
808 const Matcher<Node*>& control_matcher) | 848 const Matcher<Node*>& control_matcher) |
809 : NodeMatcher(IrOpcode::kAllocate), | 849 : NodeMatcher(IrOpcode::kAllocate), |
810 size_matcher_(size_matcher), | 850 size_matcher_(size_matcher), |
811 effect_matcher_(effect_matcher), | 851 effect_matcher_(effect_matcher), |
812 control_matcher_(control_matcher) {} | 852 control_matcher_(control_matcher) {} |
(...skipping 1209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2022 new IsTypeGuardMatcher(type_matcher, value_matcher, control_matcher)); | 2062 new IsTypeGuardMatcher(type_matcher, value_matcher, control_matcher)); |
2023 } | 2063 } |
2024 | 2064 |
2025 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, | 2065 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, |
2026 const Matcher<Node*>& lhs_matcher, | 2066 const Matcher<Node*>& lhs_matcher, |
2027 const Matcher<Node*>& rhs_matcher) { | 2067 const Matcher<Node*>& rhs_matcher) { |
2028 return MakeMatcher( | 2068 return MakeMatcher( |
2029 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); | 2069 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); |
2030 } | 2070 } |
2031 | 2071 |
| 2072 Matcher<Node*> IsSpeculativeNumberAdd( |
| 2073 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
| 2074 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
| 2075 const Matcher<Node*>& frame_state_matcher, |
| 2076 const Matcher<Node*>& effect_matcher, |
| 2077 const Matcher<Node*>& control_matcher) { |
| 2078 return MakeMatcher(new IsSpeculativeBinopMatcher( |
| 2079 IrOpcode::kSpeculativeNumberAdd, hint_matcher, lhs_matcher, rhs_matcher, |
| 2080 frame_state_matcher, effect_matcher, control_matcher)); |
| 2081 } |
| 2082 |
| 2083 Matcher<Node*> IsSpeculativeNumberSubtract( |
| 2084 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
| 2085 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
| 2086 const Matcher<Node*>& frame_state_matcher, |
| 2087 const Matcher<Node*>& effect_matcher, |
| 2088 const Matcher<Node*>& control_matcher) { |
| 2089 return MakeMatcher(new IsSpeculativeBinopMatcher( |
| 2090 IrOpcode::kSpeculativeNumberSubtract, hint_matcher, lhs_matcher, |
| 2091 rhs_matcher, frame_state_matcher, effect_matcher, control_matcher)); |
| 2092 } |
2032 | 2093 |
2033 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, | 2094 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, |
2034 const Matcher<Node*>& effect_matcher, | 2095 const Matcher<Node*>& effect_matcher, |
2035 const Matcher<Node*>& control_matcher) { | 2096 const Matcher<Node*>& control_matcher) { |
2036 return MakeMatcher( | 2097 return MakeMatcher( |
2037 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); | 2098 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); |
2038 } | 2099 } |
2039 | 2100 |
2040 | 2101 |
2041 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, | 2102 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2262 IS_UNOP_MATCHER(ObjectIsSmi) | 2323 IS_UNOP_MATCHER(ObjectIsSmi) |
2263 IS_UNOP_MATCHER(StringFromCharCode) | 2324 IS_UNOP_MATCHER(StringFromCharCode) |
2264 IS_UNOP_MATCHER(Word32Clz) | 2325 IS_UNOP_MATCHER(Word32Clz) |
2265 IS_UNOP_MATCHER(Word32Ctz) | 2326 IS_UNOP_MATCHER(Word32Ctz) |
2266 IS_UNOP_MATCHER(Word32Popcnt) | 2327 IS_UNOP_MATCHER(Word32Popcnt) |
2267 #undef IS_UNOP_MATCHER | 2328 #undef IS_UNOP_MATCHER |
2268 | 2329 |
2269 } // namespace compiler | 2330 } // namespace compiler |
2270 } // namespace internal | 2331 } // namespace internal |
2271 } // namespace v8 | 2332 } // namespace v8 |
OLD | NEW |