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/node-properties.h" | 10 #include "src/compiler/node-properties.h" |
(...skipping 730 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
741 } | 741 } |
742 | 742 |
743 private: | 743 private: |
744 const Matcher<CallDescriptor const*> descriptor_matcher_; | 744 const Matcher<CallDescriptor const*> descriptor_matcher_; |
745 const std::vector<Matcher<Node*>> value_matchers_; | 745 const std::vector<Matcher<Node*>> value_matchers_; |
746 const Matcher<Node*> effect_matcher_; | 746 const Matcher<Node*> effect_matcher_; |
747 const Matcher<Node*> control_matcher_; | 747 const Matcher<Node*> control_matcher_; |
748 }; | 748 }; |
749 | 749 |
750 | 750 |
| 751 class IsReferenceEqualMatcher final : public NodeMatcher { |
| 752 public: |
| 753 IsReferenceEqualMatcher(const Matcher<Type*>& type_matcher, |
| 754 const Matcher<Node*>& lhs_matcher, |
| 755 const Matcher<Node*>& rhs_matcher) |
| 756 : NodeMatcher(IrOpcode::kReferenceEqual), |
| 757 type_matcher_(type_matcher), |
| 758 lhs_matcher_(lhs_matcher), |
| 759 rhs_matcher_(rhs_matcher) {} |
| 760 |
| 761 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 762 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 763 // TODO(bmeurer): The type parameter is currently ignored. |
| 764 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "lhs", |
| 765 lhs_matcher_, listener) && |
| 766 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "rhs", |
| 767 rhs_matcher_, listener)); |
| 768 } |
| 769 |
| 770 private: |
| 771 const Matcher<Type*> type_matcher_; |
| 772 const Matcher<Node*> lhs_matcher_; |
| 773 const Matcher<Node*> rhs_matcher_; |
| 774 }; |
| 775 |
| 776 |
751 class IsAllocateMatcher final : public NodeMatcher { | 777 class IsAllocateMatcher final : public NodeMatcher { |
752 public: | 778 public: |
753 IsAllocateMatcher(const Matcher<Node*>& size_matcher, | 779 IsAllocateMatcher(const Matcher<Node*>& size_matcher, |
754 const Matcher<Node*>& effect_matcher, | 780 const Matcher<Node*>& effect_matcher, |
755 const Matcher<Node*>& control_matcher) | 781 const Matcher<Node*>& control_matcher) |
756 : NodeMatcher(IrOpcode::kAllocate), | 782 : NodeMatcher(IrOpcode::kAllocate), |
757 size_matcher_(size_matcher), | 783 size_matcher_(size_matcher), |
758 effect_matcher_(effect_matcher), | 784 effect_matcher_(effect_matcher), |
759 control_matcher_(control_matcher) {} | 785 control_matcher_(control_matcher) {} |
760 | 786 |
(...skipping 839 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1600 const Matcher<Node*>& effect_matcher, | 1626 const Matcher<Node*>& effect_matcher, |
1601 const Matcher<Node*>& control_matcher) { | 1627 const Matcher<Node*>& control_matcher) { |
1602 std::vector<Matcher<Node*>> value_matchers; | 1628 std::vector<Matcher<Node*>> value_matchers; |
1603 value_matchers.push_back(value0_matcher); | 1629 value_matchers.push_back(value0_matcher); |
1604 value_matchers.push_back(value1_matcher); | 1630 value_matchers.push_back(value1_matcher); |
1605 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, | 1631 return MakeMatcher(new IsTailCallMatcher(descriptor_matcher, value_matchers, |
1606 effect_matcher, control_matcher)); | 1632 effect_matcher, control_matcher)); |
1607 } | 1633 } |
1608 | 1634 |
1609 | 1635 |
| 1636 Matcher<Node*> IsReferenceEqual(const Matcher<Type*>& type_matcher, |
| 1637 const Matcher<Node*>& lhs_matcher, |
| 1638 const Matcher<Node*>& rhs_matcher) { |
| 1639 return MakeMatcher( |
| 1640 new IsReferenceEqualMatcher(type_matcher, lhs_matcher, rhs_matcher)); |
| 1641 } |
| 1642 |
| 1643 |
1610 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, | 1644 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, |
1611 const Matcher<Node*>& effect_matcher, | 1645 const Matcher<Node*>& effect_matcher, |
1612 const Matcher<Node*>& control_matcher) { | 1646 const Matcher<Node*>& control_matcher) { |
1613 return MakeMatcher( | 1647 return MakeMatcher( |
1614 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); | 1648 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); |
1615 } | 1649 } |
1616 | 1650 |
1617 | 1651 |
1618 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, | 1652 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, |
1619 const Matcher<Node*>& base_matcher, | 1653 const Matcher<Node*>& base_matcher, |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1777 IS_UNOP_MATCHER(NumberToInt32) | 1811 IS_UNOP_MATCHER(NumberToInt32) |
1778 IS_UNOP_MATCHER(NumberToUint32) | 1812 IS_UNOP_MATCHER(NumberToUint32) |
1779 IS_UNOP_MATCHER(ObjectIsSmi) | 1813 IS_UNOP_MATCHER(ObjectIsSmi) |
1780 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) | 1814 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) |
1781 IS_UNOP_MATCHER(Word32Clz) | 1815 IS_UNOP_MATCHER(Word32Clz) |
1782 #undef IS_UNOP_MATCHER | 1816 #undef IS_UNOP_MATCHER |
1783 | 1817 |
1784 } // namespace compiler | 1818 } // namespace compiler |
1785 } // namespace internal | 1819 } // namespace internal |
1786 } // namespace v8 | 1820 } // namespace v8 |
OLD | NEW |