| 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 1409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1420 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | 1420 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { |
| 1421 return (NodeMatcher::MatchAndExplain(node, listener) && | 1421 return (NodeMatcher::MatchAndExplain(node, listener) && |
| 1422 PrintMatchAndExplain(ParameterIndexOf(node->op()), "index", | 1422 PrintMatchAndExplain(ParameterIndexOf(node->op()), "index", |
| 1423 index_matcher_, listener)); | 1423 index_matcher_, listener)); |
| 1424 } | 1424 } |
| 1425 | 1425 |
| 1426 private: | 1426 private: |
| 1427 const Matcher<int> index_matcher_; | 1427 const Matcher<int> index_matcher_; |
| 1428 }; | 1428 }; |
| 1429 | 1429 |
| 1430 | |
| 1431 class IsJSDeletePropertyMatcher final : public NodeMatcher { | |
| 1432 public: | |
| 1433 IsJSDeletePropertyMatcher(const Matcher<Node*>& object_value_matcher, | |
| 1434 const Matcher<Node*>& key_matcher, | |
| 1435 const Matcher<Node*>& effect_matcher, | |
| 1436 const Matcher<Node*>& control_matcher) | |
| 1437 : NodeMatcher(IrOpcode::kJSDeleteProperty), | |
| 1438 object_value_matcher_(object_value_matcher), | |
| 1439 key_matcher_(key_matcher), | |
| 1440 effect_matcher_(effect_matcher), | |
| 1441 control_matcher_(control_matcher) {} | |
| 1442 | |
| 1443 void DescribeTo(std::ostream* os) const final { | |
| 1444 NodeMatcher::DescribeTo(os); | |
| 1445 *os << " whose object ("; | |
| 1446 object_value_matcher_.DescribeTo(os); | |
| 1447 *os << "), key ("; | |
| 1448 key_matcher_.DescribeTo(os); | |
| 1449 *os << "), effect ("; | |
| 1450 effect_matcher_.DescribeTo(os); | |
| 1451 *os << "), and control ("; | |
| 1452 control_matcher_.DescribeTo(os); | |
| 1453 *os << ")"; | |
| 1454 } | |
| 1455 | |
| 1456 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
| 1457 return (NodeMatcher::MatchAndExplain(node, listener) && | |
| 1458 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | |
| 1459 "object", object_value_matcher_, listener) && | |
| 1460 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "key", | |
| 1461 key_matcher_, listener) && | |
| 1462 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | |
| 1463 effect_matcher_, listener) && | |
| 1464 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | |
| 1465 "control", control_matcher_, listener)); | |
| 1466 } | |
| 1467 | |
| 1468 private: | |
| 1469 const Matcher<Node*> object_value_matcher_; | |
| 1470 const Matcher<Node*> key_matcher_; | |
| 1471 const Matcher<Node*> effect_matcher_; | |
| 1472 const Matcher<Node*> control_matcher_; | |
| 1473 }; | |
| 1474 | |
| 1475 | |
| 1476 class IsJSLoadGlobalMatcher final : public NodeMatcher { | |
| 1477 public: | |
| 1478 IsJSLoadGlobalMatcher(const Matcher<Handle<Name>>& name_matcher, | |
| 1479 const Matcher<TypeofMode> typeof_mode_matcher, | |
| 1480 const Matcher<Node*>& feedback_vector_matcher, | |
| 1481 const Matcher<Node*>& effect_matcher, | |
| 1482 const Matcher<Node*>& control_matcher) | |
| 1483 : NodeMatcher(IrOpcode::kJSLoadGlobal), | |
| 1484 name_matcher_(name_matcher), | |
| 1485 typeof_mode_matcher_(typeof_mode_matcher), | |
| 1486 feedback_vector_matcher_(feedback_vector_matcher), | |
| 1487 effect_matcher_(effect_matcher), | |
| 1488 control_matcher_(control_matcher) {} | |
| 1489 | |
| 1490 void DescribeTo(std::ostream* os) const final { | |
| 1491 NodeMatcher::DescribeTo(os); | |
| 1492 *os << " whose name ("; | |
| 1493 name_matcher_.DescribeTo(os); | |
| 1494 *os << "), typeof mode ("; | |
| 1495 typeof_mode_matcher_.DescribeTo(os); | |
| 1496 *os << "), feedback vector ("; | |
| 1497 feedback_vector_matcher_.DescribeTo(os); | |
| 1498 *os << "), effect ("; | |
| 1499 effect_matcher_.DescribeTo(os); | |
| 1500 *os << "), and control ("; | |
| 1501 control_matcher_.DescribeTo(os); | |
| 1502 *os << ")"; | |
| 1503 } | |
| 1504 | |
| 1505 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
| 1506 return (NodeMatcher::MatchAndExplain(node, listener) && | |
| 1507 PrintMatchAndExplain(OpParameter<LoadGlobalParameters>(node).name(), | |
| 1508 "name", name_matcher_, listener) && | |
| 1509 PrintMatchAndExplain( | |
| 1510 OpParameter<LoadGlobalParameters>(node).typeof_mode(), | |
| 1511 "typeof mode", typeof_mode_matcher_, listener) && | |
| 1512 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | |
| 1513 "feedback vector", feedback_vector_matcher_, | |
| 1514 listener) && | |
| 1515 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | |
| 1516 effect_matcher_, listener) && | |
| 1517 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | |
| 1518 "control", control_matcher_, listener)); | |
| 1519 } | |
| 1520 | |
| 1521 private: | |
| 1522 const Matcher<Handle<Name>> name_matcher_; | |
| 1523 const Matcher<TypeofMode> typeof_mode_matcher_; | |
| 1524 const Matcher<Node*> feedback_vector_matcher_; | |
| 1525 const Matcher<Node*> effect_matcher_; | |
| 1526 const Matcher<Node*> control_matcher_; | |
| 1527 }; | |
| 1528 | |
| 1529 | |
| 1530 class IsJSStoreGlobalMatcher final : public NodeMatcher { | |
| 1531 public: | |
| 1532 IsJSStoreGlobalMatcher(const Matcher<Handle<Name>>& name_matcher, | |
| 1533 const Matcher<Node*>& value_matcher, | |
| 1534 const Matcher<Node*>& feedback_vector_matcher, | |
| 1535 const Matcher<Node*>& effect_matcher, | |
| 1536 const Matcher<Node*>& control_matcher) | |
| 1537 : NodeMatcher(IrOpcode::kJSStoreGlobal), | |
| 1538 name_matcher_(name_matcher), | |
| 1539 value_matcher_(value_matcher), | |
| 1540 feedback_vector_matcher_(feedback_vector_matcher), | |
| 1541 effect_matcher_(effect_matcher), | |
| 1542 control_matcher_(control_matcher) {} | |
| 1543 | |
| 1544 void DescribeTo(std::ostream* os) const final { | |
| 1545 NodeMatcher::DescribeTo(os); | |
| 1546 *os << " whose name ("; | |
| 1547 name_matcher_.DescribeTo(os); | |
| 1548 *os << "), value ("; | |
| 1549 value_matcher_.DescribeTo(os); | |
| 1550 *os << "), feedback vector ("; | |
| 1551 feedback_vector_matcher_.DescribeTo(os); | |
| 1552 *os << "), effect ("; | |
| 1553 effect_matcher_.DescribeTo(os); | |
| 1554 *os << "), and control ("; | |
| 1555 control_matcher_.DescribeTo(os); | |
| 1556 *os << ")"; | |
| 1557 } | |
| 1558 | |
| 1559 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
| 1560 return ( | |
| 1561 NodeMatcher::MatchAndExplain(node, listener) && | |
| 1562 PrintMatchAndExplain(OpParameter<StoreGlobalParameters>(node).name(), | |
| 1563 "name", name_matcher_, listener) && | |
| 1564 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), "value", | |
| 1565 value_matcher_, listener) && | |
| 1566 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | |
| 1567 "feedback vector", feedback_vector_matcher_, | |
| 1568 listener) && | |
| 1569 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | |
| 1570 effect_matcher_, listener) && | |
| 1571 PrintMatchAndExplain(NodeProperties::GetControlInput(node), "control", | |
| 1572 control_matcher_, listener)); | |
| 1573 } | |
| 1574 | |
| 1575 private: | |
| 1576 const Matcher<Handle<Name>> name_matcher_; | |
| 1577 const Matcher<Node*> value_matcher_; | |
| 1578 const Matcher<Node*> feedback_vector_matcher_; | |
| 1579 const Matcher<Node*> effect_matcher_; | |
| 1580 const Matcher<Node*> control_matcher_; | |
| 1581 }; | |
| 1582 | |
| 1583 | |
| 1584 class IsJSLoadNamedMatcher final : public NodeMatcher { | |
| 1585 public: | |
| 1586 IsJSLoadNamedMatcher(const Matcher<Handle<Name>>& name_matcher, | |
| 1587 const Matcher<Node*>& object_value_matcher, | |
| 1588 const Matcher<Node*>& feedback_vector_matcher, | |
| 1589 const Matcher<Node*>& effect_matcher, | |
| 1590 const Matcher<Node*>& control_matcher) | |
| 1591 : NodeMatcher(IrOpcode::kJSLoadNamed), | |
| 1592 name_matcher_(name_matcher), | |
| 1593 object_value_matcher_(object_value_matcher), | |
| 1594 feedback_vector_matcher_(feedback_vector_matcher), | |
| 1595 effect_matcher_(effect_matcher), | |
| 1596 control_matcher_(control_matcher) {} | |
| 1597 | |
| 1598 void DescribeTo(std::ostream* os) const final { | |
| 1599 NodeMatcher::DescribeTo(os); | |
| 1600 *os << " whose object ("; | |
| 1601 object_value_matcher_.DescribeTo(os); | |
| 1602 *os << "), name ("; | |
| 1603 name_matcher_.DescribeTo(os); | |
| 1604 *os << "), feedback vector ("; | |
| 1605 feedback_vector_matcher_.DescribeTo(os); | |
| 1606 *os << "), effect ("; | |
| 1607 effect_matcher_.DescribeTo(os); | |
| 1608 *os << "), and control ("; | |
| 1609 control_matcher_.DescribeTo(os); | |
| 1610 *os << ")"; | |
| 1611 } | |
| 1612 | |
| 1613 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
| 1614 return (NodeMatcher::MatchAndExplain(node, listener) && | |
| 1615 PrintMatchAndExplain(OpParameter<NamedAccess>(node).name(), "Name", | |
| 1616 name_matcher_, listener) && | |
| 1617 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | |
| 1618 "object", object_value_matcher_, listener) && | |
| 1619 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | |
| 1620 "feedback vector", feedback_vector_matcher_, | |
| 1621 listener) && | |
| 1622 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | |
| 1623 effect_matcher_, listener) && | |
| 1624 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | |
| 1625 "control", control_matcher_, listener)); | |
| 1626 } | |
| 1627 | |
| 1628 private: | |
| 1629 const Matcher<Handle<Name>> name_matcher_; | |
| 1630 const Matcher<Node*> object_value_matcher_; | |
| 1631 const Matcher<Node*> feedback_vector_matcher_; | |
| 1632 const Matcher<Node*> effect_matcher_; | |
| 1633 const Matcher<Node*> control_matcher_; | |
| 1634 }; | |
| 1635 | |
| 1636 | |
| 1637 class IsJSLoadPropertyMatcher final : public NodeMatcher { | |
| 1638 public: | |
| 1639 IsJSLoadPropertyMatcher(const Matcher<Node*>& object_matcher, | |
| 1640 const Matcher<Node*>& key_matcher, | |
| 1641 const Matcher<Node*>& feedback_vector_matcher, | |
| 1642 const Matcher<Node*>& effect_matcher, | |
| 1643 const Matcher<Node*>& control_matcher) | |
| 1644 : NodeMatcher(IrOpcode::kJSLoadProperty), | |
| 1645 object_matcher_(object_matcher), | |
| 1646 key_matcher_(key_matcher), | |
| 1647 feedback_vector_matcher_(feedback_vector_matcher), | |
| 1648 effect_matcher_(effect_matcher), | |
| 1649 control_matcher_(control_matcher) {} | |
| 1650 | |
| 1651 void DescribeTo(std::ostream* os) const final { | |
| 1652 NodeMatcher::DescribeTo(os); | |
| 1653 *os << " whose object ("; | |
| 1654 object_matcher_.DescribeTo(os); | |
| 1655 *os << "), key ("; | |
| 1656 key_matcher_.DescribeTo(os); | |
| 1657 *os << "), feedback vector ("; | |
| 1658 feedback_vector_matcher_.DescribeTo(os); | |
| 1659 *os << "), effect ("; | |
| 1660 effect_matcher_.DescribeTo(os); | |
| 1661 *os << "), and control ("; | |
| 1662 control_matcher_.DescribeTo(os); | |
| 1663 *os << ")"; | |
| 1664 } | |
| 1665 | |
| 1666 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
| 1667 return (NodeMatcher::MatchAndExplain(node, listener) && | |
| 1668 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | |
| 1669 "object", object_matcher_, listener) && | |
| 1670 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "key", | |
| 1671 key_matcher_, listener) && | |
| 1672 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | |
| 1673 "feedback vector", feedback_vector_matcher_, | |
| 1674 listener) && | |
| 1675 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | |
| 1676 effect_matcher_, listener) && | |
| 1677 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | |
| 1678 "control", control_matcher_, listener)); | |
| 1679 } | |
| 1680 | |
| 1681 private: | |
| 1682 const Matcher<Node*> object_matcher_; | |
| 1683 const Matcher<Node*> key_matcher_; | |
| 1684 const Matcher<Node*> feedback_vector_matcher_; | |
| 1685 const Matcher<Node*> effect_matcher_; | |
| 1686 const Matcher<Node*> control_matcher_; | |
| 1687 }; | |
| 1688 | |
| 1689 | |
| 1690 class IsJSStoreNamedMatcher final : public NodeMatcher { | |
| 1691 public: | |
| 1692 IsJSStoreNamedMatcher(const Matcher<Handle<Name>>& name_matcher, | |
| 1693 const Matcher<Node*>& object_matcher, | |
| 1694 const Matcher<Node*>& value_matcher, | |
| 1695 const Matcher<Node*>& feedback_vector_matcher, | |
| 1696 const Matcher<Node*>& effect_matcher, | |
| 1697 const Matcher<Node*>& control_matcher) | |
| 1698 : NodeMatcher(IrOpcode::kJSStoreNamed), | |
| 1699 name_matcher_(name_matcher), | |
| 1700 object_matcher_(object_matcher), | |
| 1701 value_matcher_(value_matcher), | |
| 1702 feedback_vector_matcher_(feedback_vector_matcher), | |
| 1703 effect_matcher_(effect_matcher), | |
| 1704 control_matcher_(control_matcher) {} | |
| 1705 | |
| 1706 void DescribeTo(std::ostream* os) const final { | |
| 1707 NodeMatcher::DescribeTo(os); | |
| 1708 *os << " whose object ("; | |
| 1709 object_matcher_.DescribeTo(os); | |
| 1710 *os << "), name ("; | |
| 1711 name_matcher_.DescribeTo(os); | |
| 1712 *os << "), value ("; | |
| 1713 value_matcher_.DescribeTo(os); | |
| 1714 *os << "), feedback vector ("; | |
| 1715 feedback_vector_matcher_.DescribeTo(os); | |
| 1716 *os << "), effect ("; | |
| 1717 effect_matcher_.DescribeTo(os); | |
| 1718 *os << "), and control ("; | |
| 1719 control_matcher_.DescribeTo(os); | |
| 1720 *os << ")"; | |
| 1721 } | |
| 1722 | |
| 1723 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
| 1724 return (NodeMatcher::MatchAndExplain(node, listener) && | |
| 1725 PrintMatchAndExplain(OpParameter<NamedAccess>(node).name(), "Name", | |
| 1726 name_matcher_, listener) && | |
| 1727 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | |
| 1728 "object", object_matcher_, listener) && | |
| 1729 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), | |
| 1730 "value", value_matcher_, listener) && | |
| 1731 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | |
| 1732 "feedback vector", feedback_vector_matcher_, | |
| 1733 listener) && | |
| 1734 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | |
| 1735 effect_matcher_, listener) && | |
| 1736 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | |
| 1737 "control", control_matcher_, listener)); | |
| 1738 } | |
| 1739 | |
| 1740 private: | |
| 1741 const Matcher<Handle<Name>> name_matcher_; | |
| 1742 const Matcher<Node*> object_matcher_; | |
| 1743 const Matcher<Node*> value_matcher_; | |
| 1744 const Matcher<Node*> feedback_vector_matcher_; | |
| 1745 const Matcher<Node*> effect_matcher_; | |
| 1746 const Matcher<Node*> control_matcher_; | |
| 1747 }; | |
| 1748 | |
| 1749 | |
| 1750 class IsJSStorePropertyMatcher final : public NodeMatcher { | |
| 1751 public: | |
| 1752 IsJSStorePropertyMatcher(const Matcher<Node*>& object_matcher, | |
| 1753 const Matcher<Node*>& key_matcher, | |
| 1754 const Matcher<Node*>& value_matcher, | |
| 1755 const Matcher<Node*>& feedback_vector_matcher, | |
| 1756 const Matcher<Node*>& effect_matcher, | |
| 1757 const Matcher<Node*>& control_matcher) | |
| 1758 : NodeMatcher(IrOpcode::kJSStoreProperty), | |
| 1759 object_matcher_(object_matcher), | |
| 1760 key_matcher_(key_matcher), | |
| 1761 value_matcher_(value_matcher), | |
| 1762 feedback_vector_matcher_(feedback_vector_matcher), | |
| 1763 effect_matcher_(effect_matcher), | |
| 1764 control_matcher_(control_matcher) {} | |
| 1765 | |
| 1766 void DescribeTo(std::ostream* os) const final { | |
| 1767 NodeMatcher::DescribeTo(os); | |
| 1768 *os << " whose object ("; | |
| 1769 object_matcher_.DescribeTo(os); | |
| 1770 *os << "), key ("; | |
| 1771 key_matcher_.DescribeTo(os); | |
| 1772 *os << "), value ("; | |
| 1773 value_matcher_.DescribeTo(os); | |
| 1774 *os << "), feedback vector ("; | |
| 1775 feedback_vector_matcher_.DescribeTo(os); | |
| 1776 *os << "), effect ("; | |
| 1777 effect_matcher_.DescribeTo(os); | |
| 1778 *os << "), and control ("; | |
| 1779 } | |
| 1780 | |
| 1781 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
| 1782 return (NodeMatcher::MatchAndExplain(node, listener) && | |
| 1783 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 0), | |
| 1784 "object", object_matcher_, listener) && | |
| 1785 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 1), "key", | |
| 1786 key_matcher_, listener) && | |
| 1787 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 2), | |
| 1788 "value", value_matcher_, listener) && | |
| 1789 PrintMatchAndExplain(NodeProperties::GetValueInput(node, 3), | |
| 1790 "feedback vector", feedback_vector_matcher_, | |
| 1791 listener) && | |
| 1792 PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | |
| 1793 effect_matcher_, listener) && | |
| 1794 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | |
| 1795 "control", control_matcher_, listener)); | |
| 1796 } | |
| 1797 | |
| 1798 private: | |
| 1799 const Matcher<Node*> object_matcher_; | |
| 1800 const Matcher<Node*> key_matcher_; | |
| 1801 const Matcher<Node*> value_matcher_; | |
| 1802 const Matcher<Node*> feedback_vector_matcher_; | |
| 1803 const Matcher<Node*> effect_matcher_; | |
| 1804 const Matcher<Node*> control_matcher_; | |
| 1805 }; | |
| 1806 | |
| 1807 | |
| 1808 class IsJSCallMatcher final : public NodeMatcher { | |
| 1809 public: | |
| 1810 IsJSCallMatcher(IrOpcode::Value op_code, | |
| 1811 const std::vector<Matcher<Node*>>& value_matchers, | |
| 1812 const Matcher<Node*>& effect_matcher, | |
| 1813 const Matcher<Node*>& control_matcher) | |
| 1814 : NodeMatcher(op_code), | |
| 1815 value_matchers_(value_matchers), | |
| 1816 effect_matcher_(effect_matcher), | |
| 1817 control_matcher_(control_matcher) {} | |
| 1818 | |
| 1819 void DescribeTo(std::ostream* os) const final { | |
| 1820 NodeMatcher::DescribeTo(os); | |
| 1821 for (size_t i = 0; i < value_matchers_.size(); ++i) { | |
| 1822 if (i == 0) { | |
| 1823 *os << " whose value0 ("; | |
| 1824 } else { | |
| 1825 *os << "), value" << i << " ("; | |
| 1826 } | |
| 1827 value_matchers_[i].DescribeTo(os); | |
| 1828 } | |
| 1829 *os << "), effect ("; | |
| 1830 effect_matcher_.DescribeTo(os); | |
| 1831 *os << ") and control ("; | |
| 1832 control_matcher_.DescribeTo(os); | |
| 1833 *os << ")"; | |
| 1834 } | |
| 1835 | |
| 1836 bool MatchAndExplain(Node* node, MatchResultListener* listener) const final { | |
| 1837 if (!NodeMatcher::MatchAndExplain(node, listener)) { | |
| 1838 return false; | |
| 1839 } | |
| 1840 for (size_t i = 0; i < value_matchers_.size(); ++i) { | |
| 1841 std::ostringstream ost; | |
| 1842 ost << "value" << i; | |
| 1843 if (!PrintMatchAndExplain( | |
| 1844 NodeProperties::GetValueInput(node, static_cast<int>(i)), | |
| 1845 ost.str(), value_matchers_[i], listener)) { | |
| 1846 return false; | |
| 1847 } | |
| 1848 } | |
| 1849 return (PrintMatchAndExplain(NodeProperties::GetEffectInput(node), "effect", | |
| 1850 effect_matcher_, listener) && | |
| 1851 PrintMatchAndExplain(NodeProperties::GetControlInput(node), | |
| 1852 "control", control_matcher_, listener)); | |
| 1853 } | |
| 1854 | |
| 1855 private: | |
| 1856 const std::vector<Matcher<Node*>> value_matchers_; | |
| 1857 const Matcher<Node*> effect_matcher_; | |
| 1858 const Matcher<Node*> control_matcher_; | |
| 1859 }; | |
| 1860 | |
| 1861 } // namespace | 1430 } // namespace |
| 1862 | 1431 |
| 1863 | 1432 |
| 1864 Matcher<Node*> IsDead() { | 1433 Matcher<Node*> IsDead() { |
| 1865 return MakeMatcher(new NodeMatcher(IrOpcode::kDead)); | 1434 return MakeMatcher(new NodeMatcher(IrOpcode::kDead)); |
| 1866 } | 1435 } |
| 1867 | 1436 |
| 1868 | 1437 |
| 1869 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) { | 1438 Matcher<Node*> IsEnd(const Matcher<Node*>& control0_matcher) { |
| 1870 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher)); | 1439 return MakeMatcher(new IsControl1Matcher(IrOpcode::kEnd, control0_matcher)); |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2424 Matcher<Node*> IsParameter(const Matcher<int> index_matcher) { | 1993 Matcher<Node*> IsParameter(const Matcher<int> index_matcher) { |
| 2425 return MakeMatcher(new IsParameterMatcher(index_matcher)); | 1994 return MakeMatcher(new IsParameterMatcher(index_matcher)); |
| 2426 } | 1995 } |
| 2427 | 1996 |
| 2428 | 1997 |
| 2429 Matcher<Node*> IsLoadFramePointer() { | 1998 Matcher<Node*> IsLoadFramePointer() { |
| 2430 return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer)); | 1999 return MakeMatcher(new NodeMatcher(IrOpcode::kLoadFramePointer)); |
| 2431 } | 2000 } |
| 2432 | 2001 |
| 2433 | 2002 |
| 2434 Matcher<Node*> IsJSDeleteProperty(const Matcher<Node*>& object_value_matcher, | |
| 2435 const Matcher<Node*>& key_matcher, | |
| 2436 const Matcher<Node*>& effect_matcher, | |
| 2437 const Matcher<Node*>& control_matcher) { | |
| 2438 return MakeMatcher(new IsJSDeletePropertyMatcher( | |
| 2439 object_value_matcher, key_matcher, effect_matcher, control_matcher)); | |
| 2440 } | |
| 2441 | |
| 2442 | |
| 2443 Matcher<Node*> IsJSLoadNamed(const Handle<Name> name, | |
| 2444 const Matcher<Node*>& object_value_matcher, | |
| 2445 const Matcher<Node*>& feedback_vector_matcher, | |
| 2446 const Matcher<Node*>& effect_matcher, | |
| 2447 const Matcher<Node*>& control_matcher) { | |
| 2448 return MakeMatcher(new IsJSLoadNamedMatcher(name, object_value_matcher, | |
| 2449 feedback_vector_matcher, | |
| 2450 effect_matcher, control_matcher)); | |
| 2451 } | |
| 2452 | |
| 2453 | |
| 2454 Matcher<Node*> IsJSLoadGlobal(const Handle<Name> name, | |
| 2455 const TypeofMode typeof_mode, | |
| 2456 const Matcher<Node*>& feedback_vector_matcher, | |
| 2457 const Matcher<Node*>& effect_matcher, | |
| 2458 const Matcher<Node*>& control_matcher) { | |
| 2459 return MakeMatcher( | |
| 2460 new IsJSLoadGlobalMatcher(name, typeof_mode, feedback_vector_matcher, | |
| 2461 effect_matcher, control_matcher)); | |
| 2462 } | |
| 2463 | |
| 2464 | |
| 2465 Matcher<Node*> IsJSStoreGlobal(const Handle<Name> name, | |
| 2466 const Matcher<Node*>& value_matcher, | |
| 2467 const Matcher<Node*>& feedback_vector_matcher, | |
| 2468 const Matcher<Node*>& effect_matcher, | |
| 2469 const Matcher<Node*>& control_matcher) { | |
| 2470 return MakeMatcher( | |
| 2471 new IsJSStoreGlobalMatcher(name, value_matcher, feedback_vector_matcher, | |
| 2472 effect_matcher, control_matcher)); | |
| 2473 } | |
| 2474 | |
| 2475 | |
| 2476 Matcher<Node*> IsJSCallConstruct(std::vector<Matcher<Node*>> value_matchers, | |
| 2477 const Matcher<Node*>& effect_matcher, | |
| 2478 const Matcher<Node*>& control_matcher) { | |
| 2479 return MakeMatcher(new IsJSCallMatcher(IrOpcode::kJSCallConstruct, | |
| 2480 value_matchers, effect_matcher, | |
| 2481 control_matcher)); | |
| 2482 } | |
| 2483 | |
| 2484 | |
| 2485 Matcher<Node*> IsJSCallFunction(std::vector<Matcher<Node*>> value_matchers, | |
| 2486 const Matcher<Node*>& effect_matcher, | |
| 2487 const Matcher<Node*>& control_matcher) { | |
| 2488 return MakeMatcher(new IsJSCallMatcher(IrOpcode::kJSCallFunction, | |
| 2489 value_matchers, effect_matcher, | |
| 2490 control_matcher)); | |
| 2491 } | |
| 2492 | |
| 2493 | |
| 2494 Matcher<Node*> IsJSLoadProperty(const Matcher<Node*>& object_matcher, | |
| 2495 const Matcher<Node*>& key_matcher, | |
| 2496 const Matcher<Node*>& feedback_vector_matcher, | |
| 2497 const Matcher<Node*>& effect_matcher, | |
| 2498 const Matcher<Node*>& control_matcher) { | |
| 2499 return MakeMatcher(new IsJSLoadPropertyMatcher( | |
| 2500 object_matcher, key_matcher, feedback_vector_matcher, effect_matcher, | |
| 2501 control_matcher)); | |
| 2502 } | |
| 2503 | |
| 2504 | |
| 2505 Matcher<Node*> IsJSStoreNamed(const Handle<Name> name, | |
| 2506 const Matcher<Node*>& object_matcher, | |
| 2507 const Matcher<Node*>& value_matcher, | |
| 2508 const Matcher<Node*>& feedback_vector_matcher, | |
| 2509 const Matcher<Node*>& effect_matcher, | |
| 2510 const Matcher<Node*>& control_matcher) { | |
| 2511 return MakeMatcher(new IsJSStoreNamedMatcher( | |
| 2512 _, object_matcher, value_matcher, feedback_vector_matcher, effect_matcher, | |
| 2513 control_matcher)); | |
| 2514 } | |
| 2515 | |
| 2516 | |
| 2517 Matcher<Node*> IsJSStoreProperty(const Matcher<Node*>& object_matcher, | |
| 2518 const Matcher<Node*>& key_matcher, | |
| 2519 const Matcher<Node*>& value_matcher, | |
| 2520 const Matcher<Node*>& feedback_vector_matcher, | |
| 2521 const Matcher<Node*>& effect_matcher, | |
| 2522 const Matcher<Node*>& control_matcher) { | |
| 2523 return MakeMatcher(new IsJSStorePropertyMatcher( | |
| 2524 object_matcher, key_matcher, value_matcher, feedback_vector_matcher, | |
| 2525 effect_matcher, control_matcher)); | |
| 2526 } | |
| 2527 | |
| 2528 | |
| 2529 Matcher<Node*> IsJSCallRuntime(std::vector<Matcher<Node*>> value_matchers, | |
| 2530 const Matcher<Node*>& effect_matcher, | |
| 2531 const Matcher<Node*>& control_matcher) { | |
| 2532 return MakeMatcher(new IsJSCallMatcher(IrOpcode::kJSCallRuntime, | |
| 2533 value_matchers, effect_matcher, | |
| 2534 control_matcher)); | |
| 2535 } | |
| 2536 | |
| 2537 | |
| 2538 #define IS_BINOP_MATCHER(Name) \ | 2003 #define IS_BINOP_MATCHER(Name) \ |
| 2539 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ | 2004 Matcher<Node*> Is##Name(const Matcher<Node*>& lhs_matcher, \ |
| 2540 const Matcher<Node*>& rhs_matcher) { \ | 2005 const Matcher<Node*>& rhs_matcher) { \ |
| 2541 return MakeMatcher( \ | 2006 return MakeMatcher( \ |
| 2542 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ | 2007 new IsBinopMatcher(IrOpcode::k##Name, lhs_matcher, rhs_matcher)); \ |
| 2543 } | 2008 } |
| 2544 IS_BINOP_MATCHER(NumberEqual) | 2009 IS_BINOP_MATCHER(NumberEqual) |
| 2545 IS_BINOP_MATCHER(NumberLessThan) | 2010 IS_BINOP_MATCHER(NumberLessThan) |
| 2546 IS_BINOP_MATCHER(NumberSubtract) | 2011 IS_BINOP_MATCHER(NumberSubtract) |
| 2547 IS_BINOP_MATCHER(NumberMultiply) | 2012 IS_BINOP_MATCHER(NumberMultiply) |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2610 IS_UNOP_MATCHER(NumberToUint32) | 2075 IS_UNOP_MATCHER(NumberToUint32) |
| 2611 IS_UNOP_MATCHER(ObjectIsSmi) | 2076 IS_UNOP_MATCHER(ObjectIsSmi) |
| 2612 IS_UNOP_MATCHER(Word32Clz) | 2077 IS_UNOP_MATCHER(Word32Clz) |
| 2613 IS_UNOP_MATCHER(JSUnaryNot) | 2078 IS_UNOP_MATCHER(JSUnaryNot) |
| 2614 IS_UNOP_MATCHER(JSTypeOf) | 2079 IS_UNOP_MATCHER(JSTypeOf) |
| 2615 #undef IS_UNOP_MATCHER | 2080 #undef IS_UNOP_MATCHER |
| 2616 | 2081 |
| 2617 } // namespace compiler | 2082 } // namespace compiler |
| 2618 } // namespace internal | 2083 } // namespace internal |
| 2619 } // namespace v8 | 2084 } // namespace v8 |
| OLD | NEW |