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/assembler.h" | 7 #include "src/assembler.h" |
8 #include "src/compiler/node-properties.h" | 8 #include "src/compiler/node-properties.h" |
9 #include "src/compiler/simplified-operator.h" | 9 #include "src/compiler/simplified-operator.h" |
10 #include "src/unique.h" | 10 #include "src/unique.h" |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 void DescribeTo(std::ostream* os) const FINAL { | 536 void DescribeTo(std::ostream* os) const FINAL { |
537 NodeMatcher::DescribeTo(os); | 537 NodeMatcher::DescribeTo(os); |
538 *os << "), effect0 ("; | 538 *os << "), effect0 ("; |
539 effect0_matcher_.DescribeTo(os); | 539 effect0_matcher_.DescribeTo(os); |
540 *os << ") and effect1 ("; | 540 *os << ") and effect1 ("; |
541 effect1_matcher_.DescribeTo(os); | 541 effect1_matcher_.DescribeTo(os); |
542 *os << ")"; | 542 *os << ")"; |
543 } | 543 } |
544 | 544 |
545 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { | 545 bool MatchAndExplain(Node* node, MatchResultListener* listener) const FINAL { |
546 return (NodeMatcher::MatchAndExplain(node, listener) && | 546 if (!NodeMatcher::MatchAndExplain(node, listener)) return false; |
547 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 0), | 547 |
548 "effect0", effect0_matcher_, listener) && | 548 Node* effect0 = NodeProperties::GetEffectInput(node, 0); |
549 PrintMatchAndExplain(NodeProperties::GetEffectInput(node, 1), | 549 Node* effect1 = NodeProperties::GetEffectInput(node, 1); |
550 "effect1", effect1_matcher_, listener)); | 550 |
| 551 { |
| 552 // Try matching in the reverse order first. |
| 553 StringMatchResultListener value_listener; |
| 554 if (effect0_matcher_.MatchAndExplain(effect1, &value_listener) && |
| 555 effect1_matcher_.MatchAndExplain(effect0, &value_listener)) { |
| 556 return true; |
| 557 } |
| 558 } |
| 559 |
| 560 return PrintMatchAndExplain(effect0, "effect0", effect0_matcher_, |
| 561 listener) && |
| 562 PrintMatchAndExplain(effect1, "effect1", effect1_matcher_, listener); |
551 } | 563 } |
552 | 564 |
553 private: | 565 private: |
554 const Matcher<Node*> effect0_matcher_; | 566 const Matcher<Node*> effect0_matcher_; |
555 const Matcher<Node*> effect1_matcher_; | 567 const Matcher<Node*> effect1_matcher_; |
556 }; | 568 }; |
557 | 569 |
558 | 570 |
559 class IsProjectionMatcher FINAL : public NodeMatcher { | 571 class IsProjectionMatcher FINAL : public NodeMatcher { |
560 public: | 572 public: |
(...skipping 1059 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1620 IS_UNOP_MATCHER(Float64ExtractHighWord32) | 1632 IS_UNOP_MATCHER(Float64ExtractHighWord32) |
1621 IS_UNOP_MATCHER(NumberToInt32) | 1633 IS_UNOP_MATCHER(NumberToInt32) |
1622 IS_UNOP_MATCHER(NumberToUint32) | 1634 IS_UNOP_MATCHER(NumberToUint32) |
1623 IS_UNOP_MATCHER(ObjectIsSmi) | 1635 IS_UNOP_MATCHER(ObjectIsSmi) |
1624 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) | 1636 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) |
1625 #undef IS_UNOP_MATCHER | 1637 #undef IS_UNOP_MATCHER |
1626 | 1638 |
1627 } // namespace compiler | 1639 } // namespace compiler |
1628 } // namespace internal | 1640 } // namespace internal |
1629 } // namespace v8 | 1641 } // namespace v8 |
OLD | NEW |