| 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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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( |
| 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*>& frame_state_matcher, | |
| 810 const Matcher<Node*>& effect_matcher, | 809 const Matcher<Node*>& effect_matcher, |
| 811 const Matcher<Node*>& control_matcher) | 810 const Matcher<Node*>& control_matcher) |
| 812 : NodeMatcher(opcode), | 811 : NodeMatcher(opcode), |
| 813 lhs_matcher_(lhs_matcher), | 812 lhs_matcher_(lhs_matcher), |
| 814 rhs_matcher_(rhs_matcher), | 813 rhs_matcher_(rhs_matcher), |
| 815 frame_state_matcher_(frame_state_matcher), | |
| 816 effect_matcher_(effect_matcher), | 814 effect_matcher_(effect_matcher), |
| 817 control_matcher_(control_matcher) {} | 815 control_matcher_(control_matcher) {} |
| 818 | 816 |
| 819 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 817 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 820 return (NodeMatcher::MatchAndExplain(node, listener) && | 818 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 821 // TODO(bmeurer): The type parameter is currently ignored. | 819 // TODO(bmeurer): The type parameter is currently ignored. |
| 822 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", | 820 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
| 823 lhs_matcher_, listener) && | 821 lhs_matcher_, listener) && |
| 824 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", | 822 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
| 825 rhs_matcher_, listener) && | 823 rhs_matcher_, listener) && |
| 826 PrintMatchAndExplain(NodeProperties::GetFrameStateInput(node, 0), | |
| 827 "frame state", frame_state_matcher_, | |
| 828 listener) && | |
| 829 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 824 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 830 effect_matcher_, listener) && | 825 effect_matcher_, listener) && |
| 831 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 826 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 832 "control", control_matcher_, listener)); | 827 "control", control_matcher_, listener)); |
| 833 } | 828 } |
| 834 | 829 |
| 835 private: | 830 private: |
| 836 const Matcher<Type*> type_matcher_; | 831 const Matcher<Type*> type_matcher_; |
| 837 const Matcher<Node*> lhs_matcher_; | 832 const Matcher<Node*> lhs_matcher_; |
| 838 const Matcher<Node*> rhs_matcher_; | 833 const Matcher<Node*> rhs_matcher_; |
| 839 const Matcher<Node*> frame_state_matcher_; | |
| 840 const Matcher<Node*> effect_matcher_; | 834 const Matcher<Node*> effect_matcher_; |
| 841 const Matcher<Node*> control_matcher_; | 835 const Matcher<Node*> control_matcher_; |
| 842 }; | 836 }; |
| 843 | 837 |
| 844 class IsAllocateMatcher final : public NodeMatcher { | 838 class IsAllocateMatcher final : public NodeMatcher { |
| 845 public: | 839 public: |
| 846 IsAllocateMatcher(const Matcher<Node*>& size_matcher, | 840 IsAllocateMatcher(const Matcher<Node*>& size_matcher, |
| 847 const Matcher<Node*>& effect_matcher, | 841 const Matcher<Node*>& effect_matcher, |
| 848 const Matcher<Node*>& control_matcher) | 842 const Matcher<Node*>& control_matcher) |
| 849 : NodeMatcher(IrOpcode::kAllocate), | 843 : NodeMatcher(IrOpcode::kAllocate), |
| (...skipping 1215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2065 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, | 2059 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, |
| 2066 const Matcher<Node*>& lhs_matcher, | 2060 const Matcher<Node*>& lhs_matcher, |
| 2067 const Matcher<Node*>& rhs_matcher) { | 2061 const Matcher<Node*>& rhs_matcher) { |
| 2068 return MakeMatcher( | 2062 return MakeMatcher( |
| 2069 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); | 2063 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); |
| 2070 } | 2064 } |
| 2071 | 2065 |
| 2072 Matcher<Node*> IsSpeculativeNumberAdd( | 2066 Matcher<Node*> IsSpeculativeNumberAdd( |
| 2073 const Matcher<BinaryOperationHints::Hint>& hint_matcher, | 2067 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
| 2074 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, | 2068 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
| 2075 const Matcher<Node*>& frame_state_matcher, | |
| 2076 const Matcher<Node*>& effect_matcher, | 2069 const Matcher<Node*>& effect_matcher, |
| 2077 const Matcher<Node*>& control_matcher) { | 2070 const Matcher<Node*>& control_matcher) { |
| 2078 return MakeMatcher(new IsSpeculativeBinopMatcher( | 2071 return MakeMatcher(new IsSpeculativeBinopMatcher( |
| 2079 IrOpcode::kSpeculativeNumberAdd, hint_matcher, lhs_matcher, rhs_matcher, | 2072 IrOpcode::kSpeculativeNumberAdd, hint_matcher, lhs_matcher, rhs_matcher, |
| 2080 frame_state_matcher, effect_matcher, control_matcher)); | 2073 effect_matcher, control_matcher)); |
| 2081 } | 2074 } |
| 2082 | 2075 |
| 2083 Matcher<Node*> IsSpeculativeNumberSubtract( | 2076 Matcher<Node*> IsSpeculativeNumberSubtract( |
| 2084 const Matcher<BinaryOperationHints::Hint>& hint_matcher, | 2077 const Matcher<BinaryOperationHints::Hint>& hint_matcher, |
| 2085 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, | 2078 const Matcher<Node*>& lhs_matcher, const Matcher<Node*>& rhs_matcher, |
| 2086 const Matcher<Node*>& frame_state_matcher, | |
| 2087 const Matcher<Node*>& effect_matcher, | 2079 const Matcher<Node*>& effect_matcher, |
| 2088 const Matcher<Node*>& control_matcher) { | 2080 const Matcher<Node*>& control_matcher) { |
| 2089 return MakeMatcher(new IsSpeculativeBinopMatcher( | 2081 return MakeMatcher(new IsSpeculativeBinopMatcher( |
| 2090 IrOpcode::kSpeculativeNumberSubtract, hint_matcher, lhs_matcher, | 2082 IrOpcode::kSpeculativeNumberSubtract, hint_matcher, lhs_matcher, |
| 2091 rhs_matcher, frame_state_matcher, effect_matcher, control_matcher)); | 2083 rhs_matcher, effect_matcher, control_matcher)); |
| 2092 } | 2084 } |
| 2093 | 2085 |
| 2094 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, | 2086 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, |
| 2095 const Matcher<Node*>& effect_matcher, | 2087 const Matcher<Node*>& effect_matcher, |
| 2096 const Matcher<Node*>& control_matcher) { | 2088 const Matcher<Node*>& control_matcher) { |
| 2097 return MakeMatcher( | 2089 return MakeMatcher( |
| 2098 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); | 2090 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); |
| 2099 } | 2091 } |
| 2100 | 2092 |
| 2101 | 2093 |
| (...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2323 IS_UNOP_MATCHER(ObjectIsSmi) | 2315 IS_UNOP_MATCHER(ObjectIsSmi) |
| 2324 IS_UNOP_MATCHER(StringFromCharCode) | 2316 IS_UNOP_MATCHER(StringFromCharCode) |
| 2325 IS_UNOP_MATCHER(Word32Clz) | 2317 IS_UNOP_MATCHER(Word32Clz) |
| 2326 IS_UNOP_MATCHER(Word32Ctz) | 2318 IS_UNOP_MATCHER(Word32Ctz) |
| 2327 IS_UNOP_MATCHER(Word32Popcnt) | 2319 IS_UNOP_MATCHER(Word32Popcnt) |
| 2328 #undef IS_UNOP_MATCHER | 2320 #undef IS_UNOP_MATCHER |
| 2329 | 2321 |
| 2330 } // namespace compiler | 2322 } // namespace compiler |
| 2331 } // namespace internal | 2323 } // namespace internal |
| 2332 } // namespace v8 | 2324 } // namespace v8 |
| OLD | NEW |