| 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 689 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 700 } | 700 } |
| 701 for (size_t i = 0; i < value_matchers_.size(); ++i) { | 701 for (size_t i = 0; i < value_matchers_.size(); ++i) { |
| 702 std::ostringstream ost; | 702 std::ostringstream ost; |
| 703 ost << "value" << i; | 703 ost << "value" << i; |
| 704 if (!PrintMatchAndExplain( | 704 if (!PrintMatchAndExplain( |
| 705 NodeProperties::GetValueInput(node, static_cast<int>(i)), | 705 NodeProperties::GetValueInput(node, static_cast<int>(i)), |
| 706 ost.str(), value_matchers_[i], listener)) { | 706 ost.str(), value_matchers_[i], listener)) { |
| 707 return false; | 707 return false; |
| 708 } | 708 } |
| 709 } | 709 } |
| 710 return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 710 Node* effect_node = nullptr; |
| 711 effect_matcher_, listener) && | 711 Node* control_node = nullptr; |
| 712 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 712 if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) { |
| 713 "control", control_matcher_, listener)); | 713 effect_node = NodeProperties::GetEffectInput(node); |
| 714 } |
| 715 if (NodeProperties::FirstControlIndex(node) < node->InputCount()) { |
| 716 control_node = NodeProperties::GetControlInput(node); |
| 717 } |
| 718 return (PrintMatchAndExplain(effect_node, "effect", effect_matcher_, |
| 719 listener) && |
| 720 PrintMatchAndExplain(control_node, "control", control_matcher_, |
| 721 listener)); |
| 714 } | 722 } |
| 715 | 723 |
| 716 private: | 724 private: |
| 717 const Matcher<const CallDescriptor*> descriptor_matcher_; | 725 const Matcher<const CallDescriptor*> descriptor_matcher_; |
| 718 const std::vector<Matcher<Node*>> value_matchers_; | 726 const std::vector<Matcher<Node*>> value_matchers_; |
| 719 const Matcher<Node*> effect_matcher_; | 727 const Matcher<Node*> effect_matcher_; |
| 720 const Matcher<Node*> control_matcher_; | 728 const Matcher<Node*> control_matcher_; |
| 721 }; | 729 }; |
| 722 | 730 |
| 723 | 731 |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 758 } | 766 } |
| 759 for (size_t i = 0; i < value_matchers_.size(); ++i) { | 767 for (size_t i = 0; i < value_matchers_.size(); ++i) { |
| 760 std::ostringstream ost; | 768 std::ostringstream ost; |
| 761 ost << "value" << i; | 769 ost << "value" << i; |
| 762 if (!PrintMatchAndExplain( | 770 if (!PrintMatchAndExplain( |
| 763 NodeProperties::GetValueInput(node, static_cast<int>(i)), | 771 NodeProperties::GetValueInput(node, static_cast<int>(i)), |
| 764 ost.str(), value_matchers_[i], listener)) { | 772 ost.str(), value_matchers_[i], listener)) { |
| 765 return false; | 773 return false; |
| 766 } | 774 } |
| 767 } | 775 } |
| 768 return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | 776 Node* effect_node = nullptr; |
| 769 effect_matcher_, listener) && | 777 Node* control_node = nullptr; |
| 770 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | 778 if (NodeProperties::FirstEffectIndex(node) < node->InputCount()) { |
| 771 "control", control_matcher_, listener)); | 779 effect_node = NodeProperties::GetEffectInput(node); |
| 780 } |
| 781 if (NodeProperties::FirstControlIndex(node) < node->InputCount()) { |
| 782 control_node = NodeProperties::GetControlInput(node); |
| 783 } |
| 784 return (PrintMatchAndExplain(effect_node, "effect", effect_matcher_, |
| 785 listener) && |
| 786 PrintMatchAndExplain(control_node, "control", control_matcher_, |
| 787 listener)); |
| 772 } | 788 } |
| 773 | 789 |
| 774 private: | 790 private: |
| 775 const Matcher<CallDescriptor const*> descriptor_matcher_; | 791 const Matcher<CallDescriptor const*> descriptor_matcher_; |
| 776 const std::vector<Matcher<Node*>> value_matchers_; | 792 const std::vector<Matcher<Node*>> value_matchers_; |
| 777 const Matcher<Node*> effect_matcher_; | 793 const Matcher<Node*> effect_matcher_; |
| 778 const Matcher<Node*> control_matcher_; | 794 const Matcher<Node*> control_matcher_; |
| 779 }; | 795 }; |
| 780 | 796 |
| 781 | 797 |
| (...skipping 1291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2073 IS_UNOP_MATCHER(Float64ExtractHighWord32) | 2089 IS_UNOP_MATCHER(Float64ExtractHighWord32) |
| 2074 IS_UNOP_MATCHER(NumberToInt32) | 2090 IS_UNOP_MATCHER(NumberToInt32) |
| 2075 IS_UNOP_MATCHER(NumberToUint32) | 2091 IS_UNOP_MATCHER(NumberToUint32) |
| 2076 IS_UNOP_MATCHER(ObjectIsSmi) | 2092 IS_UNOP_MATCHER(ObjectIsSmi) |
| 2077 IS_UNOP_MATCHER(Word32Clz) | 2093 IS_UNOP_MATCHER(Word32Clz) |
| 2078 #undef IS_UNOP_MATCHER | 2094 #undef IS_UNOP_MATCHER |
| 2079 | 2095 |
| 2080 } // namespace compiler | 2096 } // namespace compiler |
| 2081 } // namespace internal | 2097 } // namespace internal |
| 2082 } // namespace v8 | 2098 } // namespace v8 |
| OLD | NEW |