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 "src/compiler/node-properties-inl.h" | 7 #include "src/compiler/node-properties-inl.h" |
8 #include "src/compiler/simplified-operator.h" | 8 #include "src/compiler/simplified-operator.h" |
9 | 9 |
10 using testing::_; | 10 using testing::_; |
(...skipping 688 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
699 | 699 |
700 private: | 700 private: |
701 const Matcher<LoadRepresentation> rep_matcher_; | 701 const Matcher<LoadRepresentation> rep_matcher_; |
702 const Matcher<Node*> base_matcher_; | 702 const Matcher<Node*> base_matcher_; |
703 const Matcher<Node*> index_matcher_; | 703 const Matcher<Node*> index_matcher_; |
704 const Matcher<Node*> effect_matcher_; | 704 const Matcher<Node*> effect_matcher_; |
705 const Matcher<Node*> control_matcher_; | 705 const Matcher<Node*> control_matcher_; |
706 }; | 706 }; |
707 | 707 |
708 | 708 |
| 709 class IsToNumberMatcher FINAL : public NodeMatcher { |
| 710 public: |
| 711 IsToNumberMatcher(const Matcher<Node*>& base_matcher, |
| 712 const Matcher<Node*>& context_matcher, |
| 713 const Matcher<Node*>& effect_matcher, |
| 714 const Matcher<Node*>& control_matcher) |
| 715 : NodeMatcher(IrOpcode::kJSToNumber), |
| 716 base_matcher_(base_matcher), |
| 717 context_matcher_(context_matcher), |
| 718 effect_matcher_(effect_matcher), |
| 719 control_matcher_(control_matcher) {} |
| 720 |
| 721 virtual void DescribeTo(std::ostream* os) const OVERRIDE { |
| 722 NodeMatcher::DescribeTo(os); |
| 723 *os << " whose base ("; |
| 724 base_matcher_.DescribeTo(os); |
| 725 *os << "), context ("; |
| 726 context_matcher_.DescribeTo(os); |
| 727 *os << "), effect ("; |
| 728 effect_matcher_.DescribeTo(os); |
| 729 *os << ") and control ("; |
| 730 control_matcher_.DescribeTo(os); |
| 731 *os << ")"; |
| 732 } |
| 733 |
| 734 virtual bool MatchAndExplain(Node* node, |
| 735 MatchResultListener* listener) const OVERRIDE { |
| 736 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 737 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "base", |
| 738 base_matcher_, listener) && |
| 739 PrintMatchAndExplain(NodeProperties::GetContextInput(node), |
| 740 "context", context_matcher_, listener) && |
| 741 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 742 effect_matcher_, listener) && |
| 743 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 744 "control", control_matcher_, listener)); |
| 745 } |
| 746 |
| 747 private: |
| 748 const Matcher<Node*> base_matcher_; |
| 749 const Matcher<Node*> context_matcher_; |
| 750 const Matcher<Node*> effect_matcher_; |
| 751 const Matcher<Node*> control_matcher_; |
| 752 }; |
| 753 |
| 754 |
709 class IsStoreMatcher FINAL : public NodeMatcher { | 755 class IsStoreMatcher FINAL : public NodeMatcher { |
710 public: | 756 public: |
711 IsStoreMatcher(const Matcher<StoreRepresentation>& rep_matcher, | 757 IsStoreMatcher(const Matcher<StoreRepresentation>& rep_matcher, |
712 const Matcher<Node*>& base_matcher, | 758 const Matcher<Node*>& base_matcher, |
713 const Matcher<Node*>& index_matcher, | 759 const Matcher<Node*>& index_matcher, |
714 const Matcher<Node*>& value_matcher, | 760 const Matcher<Node*>& value_matcher, |
715 const Matcher<Node*>& effect_matcher, | 761 const Matcher<Node*>& effect_matcher, |
716 const Matcher<Node*>& control_matcher) | 762 const Matcher<Node*>& control_matcher) |
717 : NodeMatcher(IrOpcode::kStore), | 763 : NodeMatcher(IrOpcode::kStore), |
718 rep_matcher_(rep_matcher), | 764 rep_matcher_(rep_matcher), |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
993 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, | 1039 Matcher<Node*> IsLoad(const Matcher<LoadRepresentation>& rep_matcher, |
994 const Matcher<Node*>& base_matcher, | 1040 const Matcher<Node*>& base_matcher, |
995 const Matcher<Node*>& index_matcher, | 1041 const Matcher<Node*>& index_matcher, |
996 const Matcher<Node*>& effect_matcher, | 1042 const Matcher<Node*>& effect_matcher, |
997 const Matcher<Node*>& control_matcher) { | 1043 const Matcher<Node*>& control_matcher) { |
998 return MakeMatcher(new IsLoadMatcher(rep_matcher, base_matcher, index_matcher, | 1044 return MakeMatcher(new IsLoadMatcher(rep_matcher, base_matcher, index_matcher, |
999 effect_matcher, control_matcher)); | 1045 effect_matcher, control_matcher)); |
1000 } | 1046 } |
1001 | 1047 |
1002 | 1048 |
| 1049 Matcher<Node*> IsToNumber(const Matcher<Node*>& base_matcher, |
| 1050 const Matcher<Node*>& context_matcher, |
| 1051 const Matcher<Node*>& effect_matcher, |
| 1052 const Matcher<Node*>& control_matcher) { |
| 1053 return MakeMatcher(new IsToNumberMatcher(base_matcher, context_matcher, |
| 1054 effect_matcher, control_matcher)); |
| 1055 } |
| 1056 |
| 1057 |
1003 Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher, | 1058 Matcher<Node*> IsStore(const Matcher<StoreRepresentation>& rep_matcher, |
1004 const Matcher<Node*>& base_matcher, | 1059 const Matcher<Node*>& base_matcher, |
1005 const Matcher<Node*>& index_matcher, | 1060 const Matcher<Node*>& index_matcher, |
1006 const Matcher<Node*>& value_matcher, | 1061 const Matcher<Node*>& value_matcher, |
1007 const Matcher<Node*>& effect_matcher, | 1062 const Matcher<Node*>& effect_matcher, |
1008 const Matcher<Node*>& control_matcher) { | 1063 const Matcher<Node*>& control_matcher) { |
1009 return MakeMatcher(new IsStoreMatcher(rep_matcher, base_matcher, | 1064 return MakeMatcher(new IsStoreMatcher(rep_matcher, base_matcher, |
1010 index_matcher, value_matcher, | 1065 index_matcher, value_matcher, |
1011 effect_matcher, control_matcher)); | 1066 effect_matcher, control_matcher)); |
1012 } | 1067 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1056 IS_UNOP_MATCHER(ChangeUint32ToFloat64) | 1111 IS_UNOP_MATCHER(ChangeUint32ToFloat64) |
1057 IS_UNOP_MATCHER(ChangeUint32ToUint64) | 1112 IS_UNOP_MATCHER(ChangeUint32ToUint64) |
1058 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) | 1113 IS_UNOP_MATCHER(TruncateFloat64ToFloat32) |
1059 IS_UNOP_MATCHER(TruncateFloat64ToInt32) | 1114 IS_UNOP_MATCHER(TruncateFloat64ToInt32) |
1060 IS_UNOP_MATCHER(TruncateInt64ToInt32) | 1115 IS_UNOP_MATCHER(TruncateInt64ToInt32) |
1061 IS_UNOP_MATCHER(Float64Sqrt) | 1116 IS_UNOP_MATCHER(Float64Sqrt) |
1062 IS_UNOP_MATCHER(Float64Floor) | 1117 IS_UNOP_MATCHER(Float64Floor) |
1063 IS_UNOP_MATCHER(Float64Ceil) | 1118 IS_UNOP_MATCHER(Float64Ceil) |
1064 IS_UNOP_MATCHER(Float64RoundTruncate) | 1119 IS_UNOP_MATCHER(Float64RoundTruncate) |
1065 IS_UNOP_MATCHER(Float64RoundTiesAway) | 1120 IS_UNOP_MATCHER(Float64RoundTiesAway) |
| 1121 IS_UNOP_MATCHER(NumberToInt32) |
| 1122 IS_UNOP_MATCHER(NumberToUint32) |
1066 #undef IS_UNOP_MATCHER | 1123 #undef IS_UNOP_MATCHER |
1067 | 1124 |
1068 } // namespace compiler | 1125 } // namespace compiler |
1069 } // namespace internal | 1126 } // namespace internal |
1070 } // namespace v8 | 1127 } // namespace v8 |
OLD | NEW |