| 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 641 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 652 } | 652 } |
| 653 | 653 |
| 654 private: | 654 private: |
| 655 const Matcher<CallDescriptor*> descriptor_matcher_; | 655 const Matcher<CallDescriptor*> descriptor_matcher_; |
| 656 const std::vector<Matcher<Node*>> value_matchers_; | 656 const std::vector<Matcher<Node*>> value_matchers_; |
| 657 const Matcher<Node*> effect_matcher_; | 657 const Matcher<Node*> effect_matcher_; |
| 658 const Matcher<Node*> control_matcher_; | 658 const Matcher<Node*> control_matcher_; |
| 659 }; | 659 }; |
| 660 | 660 |
| 661 | 661 |
| 662 class IsAllocateMatcher final : public NodeMatcher { |
| 663 public: |
| 664 IsAllocateMatcher(const Matcher<Node*>& size_matcher, |
| 665 const Matcher<Node*>& effect_matcher, |
| 666 const Matcher<Node*>& control_matcher) |
| 667 : NodeMatcher(IrOpcode::kAllocate), |
| 668 size_matcher_(size_matcher), |
| 669 effect_matcher_(effect_matcher), |
| 670 control_matcher_(control_matcher) {} |
| 671 |
| 672 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 673 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 674 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "size", |
| 675 size_matcher_, listener) && |
| 676 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", |
| 677 effect_matcher_, listener) && |
| 678 PrintMatchAndExplain(NodeProperties::GetControlInput(node), |
| 679 "control", control_matcher_, listener)); |
| 680 } |
| 681 |
| 682 private: |
| 683 const Matcher<Node*> size_matcher_; |
| 684 const Matcher<Node*> effect_matcher_; |
| 685 const Matcher<Node*> control_matcher_; |
| 686 }; |
| 687 |
| 688 |
| 662 class IsLoadFieldMatcher final : public NodeMatcher { | 689 class IsLoadFieldMatcher final : public NodeMatcher { |
| 663 public: | 690 public: |
| 664 IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher, | 691 IsLoadFieldMatcher(const Matcher<FieldAccess>& access_matcher, |
| 665 const Matcher<Node*>& base_matcher, | 692 const Matcher<Node*>& base_matcher, |
| 666 const Matcher<Node*>& effect_matcher, | 693 const Matcher<Node*>& effect_matcher, |
| 667 const Matcher<Node*>& control_matcher) | 694 const Matcher<Node*>& control_matcher) |
| 668 : NodeMatcher(IrOpcode::kLoadField), | 695 : NodeMatcher(IrOpcode::kLoadField), |
| 669 access_matcher_(access_matcher), | 696 access_matcher_(access_matcher), |
| 670 base_matcher_(base_matcher), | 697 base_matcher_(base_matcher), |
| 671 effect_matcher_(effect_matcher), | 698 effect_matcher_(effect_matcher), |
| (...skipping 791 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1463 value_matchers.push_back(value2_matcher); | 1490 value_matchers.push_back(value2_matcher); |
| 1464 value_matchers.push_back(value3_matcher); | 1491 value_matchers.push_back(value3_matcher); |
| 1465 value_matchers.push_back(value4_matcher); | 1492 value_matchers.push_back(value4_matcher); |
| 1466 value_matchers.push_back(value5_matcher); | 1493 value_matchers.push_back(value5_matcher); |
| 1467 value_matchers.push_back(value6_matcher); | 1494 value_matchers.push_back(value6_matcher); |
| 1468 return MakeMatcher(new IsCallMatcher(descriptor_matcher, value_matchers, | 1495 return MakeMatcher(new IsCallMatcher(descriptor_matcher, value_matchers, |
| 1469 effect_matcher, control_matcher)); | 1496 effect_matcher, control_matcher)); |
| 1470 } | 1497 } |
| 1471 | 1498 |
| 1472 | 1499 |
| 1500 Matcher<Node*> IsAllocate(const Matcher<Node*>& size_matcher, |
| 1501 const Matcher<Node*>& effect_matcher, |
| 1502 const Matcher<Node*>& control_matcher) { |
| 1503 return MakeMatcher( |
| 1504 new IsAllocateMatcher(size_matcher, effect_matcher, control_matcher)); |
| 1505 } |
| 1506 |
| 1507 |
| 1473 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, | 1508 Matcher<Node*> IsLoadField(const Matcher<FieldAccess>& access_matcher, |
| 1474 const Matcher<Node*>& base_matcher, | 1509 const Matcher<Node*>& base_matcher, |
| 1475 const Matcher<Node*>& effect_matcher, | 1510 const Matcher<Node*>& effect_matcher, |
| 1476 const Matcher<Node*>& control_matcher) { | 1511 const Matcher<Node*>& control_matcher) { |
| 1477 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher, | 1512 return MakeMatcher(new IsLoadFieldMatcher(access_matcher, base_matcher, |
| 1478 effect_matcher, control_matcher)); | 1513 effect_matcher, control_matcher)); |
| 1479 } | 1514 } |
| 1480 | 1515 |
| 1481 | 1516 |
| 1482 Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher, | 1517 Matcher<Node*> IsStoreField(const Matcher<FieldAccess>& access_matcher, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1632 IS_UNOP_MATCHER(NumberToInt32) | 1667 IS_UNOP_MATCHER(NumberToInt32) |
| 1633 IS_UNOP_MATCHER(NumberToUint32) | 1668 IS_UNOP_MATCHER(NumberToUint32) |
| 1634 IS_UNOP_MATCHER(ObjectIsSmi) | 1669 IS_UNOP_MATCHER(ObjectIsSmi) |
| 1635 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) | 1670 IS_UNOP_MATCHER(ObjectIsNonNegativeSmi) |
| 1636 IS_UNOP_MATCHER(Word32Clz) | 1671 IS_UNOP_MATCHER(Word32Clz) |
| 1637 #undef IS_UNOP_MATCHER | 1672 #undef IS_UNOP_MATCHER |
| 1638 | 1673 |
| 1639 } // namespace compiler | 1674 } // namespace compiler |
| 1640 } // namespace internal | 1675 } // namespace internal |
| 1641 } // namespace v8 | 1676 } // namespace v8 |
| OLD | NEW |