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 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
802 | 802 |
803 class IsSpeculativeBinopMatcher final : public NodeMatcher { | 803 class IsSpeculativeBinopMatcher final : public NodeMatcher { |
804 public: | 804 public: |
805 IsSpeculativeBinopMatcher( | 805 IsSpeculativeBinopMatcher( |
806 IrOpcode::Value opcode, | 806 IrOpcode::Value opcode, |
807 const Matcher<BinaryOperationHints::Hint>& hint_matcher, | 807 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
808 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, | 808 const Matcher<Node*>& lhs_matcher, 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 lhs_matcher_(lhs_matcher), | 813 lhs_matcher_(lhs_matcher), |
813 rhs_matcher_(rhs_matcher), | 814 rhs_matcher_(rhs_matcher), |
814 effect_matcher_(effect_matcher), | 815 effect_matcher_(effect_matcher), |
815 control_matcher_(control_matcher) {} | 816 control_matcher_(control_matcher) {} |
816 | 817 |
817 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 818 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
818 return (NodeMatcher::MatchAndExplain(node, listener) && | 819 return (NodeMatcher::MatchAndExplain(node, listener) && |
819 // TODO(bmeurer): The type parameter is currently ignored. | 820 // TODO(bmeurer): The type parameter is currently ignored. |
| 821 PrintMatchAndExplain( |
| 822 OpParameter<BinaryOperationHints::Hint>(node->op()), "hints", |
| 823 hint_matcher_, listener) && |
820 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", | 824 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
821 lhs_matcher_, listener) && | 825 lhs_matcher_, listener) && |
822 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", | 826 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
823 rhs_matcher_, listener) && | 827 rhs_matcher_, listener) && |
824 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 828 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
825 effect_matcher_, listener) && | 829 effect_matcher_, listener) && |
826 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 830 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
827 "control", control_matcher_, listener)); | 831 "control", control_matcher_, listener)); |
828 } | 832 } |
829 | 833 |
830 private: | 834 private: |
| 835 const Matcher<BinaryOperationHints::Hint> hint_matcher_; |
831 const Matcher<Type*> type_matcher_; | 836 const Matcher<Type*> type_matcher_; |
832 const Matcher<Node*> lhs_matcher_; | 837 const Matcher<Node*> lhs_matcher_; |
833 const Matcher<Node*> rhs_matcher_; | 838 const Matcher<Node*> rhs_matcher_; |
834 const Matcher<Node*> effect_matcher_; | 839 const Matcher<Node*> effect_matcher_; |
835 const Matcher<Node*> control_matcher_; | 840 const Matcher<Node*> control_matcher_; |
836 }; | 841 }; |
837 | 842 |
838 class IsAllocateMatcher final : public NodeMatcher { | 843 class IsAllocateMatcher final : public NodeMatcher { |
839 public: | 844 public: |
840 IsAllocateMatcher(const Matcher<Node*>& size_matcher, | 845 IsAllocateMatcher(const Matcher<Node*>& size_matcher, |
(...skipping 1220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2061 Matcher<Node*> IsSpeculativeNumberShiftLeft( | 2066 Matcher<Node*> IsSpeculativeNumberShiftLeft( |
2062 const Matcher<BinaryOperationHints::Hint>& hint_matcher, | 2067 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
2063 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, | 2068 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
2064 const Matcher<Node*>& effect_matcher, | 2069 const Matcher<Node*>& effect_matcher, |
2065 const Matcher<Node*>& control_matcher) { | 2070 const Matcher<Node*>& control_matcher) { |
2066 return MakeMatcher(new IsSpeculativeBinopMatcher( | 2071 return MakeMatcher(new IsSpeculativeBinopMatcher( |
2067 IrOpcode::kSpeculativeNumberShiftLeft, hint_matcher, lhs_matcher, | 2072 IrOpcode::kSpeculativeNumberShiftLeft, hint_matcher, lhs_matcher, |
2068 rhs_matcher, effect_matcher, control_matcher)); | 2073 rhs_matcher, effect_matcher, control_matcher)); |
2069 } | 2074 } |
2070 | 2075 |
| 2076 Matcher<Node*> IsSpeculativeNumberShiftRight( |
| 2077 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
| 2078 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
| 2079 const Matcher<Node*>& effect_matcher, |
| 2080 const Matcher<Node*>& control_matcher) { |
| 2081 return MakeMatcher(new IsSpeculativeBinopMatcher( |
| 2082 IrOpcode::kSpeculativeNumberShiftRight, hint_matcher, lhs_matcher, |
| 2083 rhs_matcher, effect_matcher, control_matcher)); |
| 2084 } |
| 2085 |
| 2086 Matcher<Node*> IsSpeculativeNumberShiftRightLogical( |
| 2087 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
| 2088 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
| 2089 const Matcher<Node*>& effect_matcher, |
| 2090 const Matcher<Node*>& control_matcher) { |
| 2091 return MakeMatcher(new IsSpeculativeBinopMatcher( |
| 2092 IrOpcode::kSpeculativeNumberShiftRightLogical, hint_matcher, lhs_matcher, |
| 2093 rhs_matcher, effect_matcher, control_matcher)); |
| 2094 } |
| 2095 |
2071 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, | 2096 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, |
2072 const Matcher<Node*>& effect_matcher, | 2097 const Matcher<Node*>& effect_matcher, |
2073 const Matcher<Node*>& control_matcher) { | 2098 const Matcher<Node*>& control_matcher) { |
2074 return MakeMatcher( | 2099 return MakeMatcher( |
2075 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); | 2100 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); |
2076 } | 2101 } |
2077 | 2102 |
2078 | 2103 |
2079 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, | 2104 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, |
2080 const Matcher<Node*>& base_matcher, | 2105 const Matcher<Node*>& base_matcher, |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2350 IS_UNOP_MATCHER(ObjectIsSmi) | 2375 IS_UNOP_MATCHER(ObjectIsSmi) |
2351 IS_UNOP_MATCHER(StringFromCharCode) | 2376 IS_UNOP_MATCHER(StringFromCharCode) |
2352 IS_UNOP_MATCHER(Word32Clz) | 2377 IS_UNOP_MATCHER(Word32Clz) |
2353 IS_UNOP_MATCHER(Word32Ctz) | 2378 IS_UNOP_MATCHER(Word32Ctz) |
2354 IS_UNOP_MATCHER(Word32Popcnt) | 2379 IS_UNOP_MATCHER(Word32Popcnt) |
2355 #undef IS_UNOP_MATCHER | 2380 #undef IS_UNOP_MATCHER |
2356 | 2381 |
2357 } // namespace compiler | 2382 } // namespace compiler |
2358 } // namespace internal | 2383 } // namespace internal |
2359 } // namespace v8 | 2384 } // namespace v8 |
OLD | NEW |