OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 1290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1301 int flags_; | 1301 int flags_; |
1302 GVNFlagSet gvn_flags_; | 1302 GVNFlagSet gvn_flags_; |
1303 | 1303 |
1304 private: | 1304 private: |
1305 virtual bool IsDeletable() const { return false; } | 1305 virtual bool IsDeletable() const { return false; } |
1306 | 1306 |
1307 DISALLOW_COPY_AND_ASSIGN(HValue); | 1307 DISALLOW_COPY_AND_ASSIGN(HValue); |
1308 }; | 1308 }; |
1309 | 1309 |
1310 | 1310 |
1311 #define DECLARE_INSTRUCTION_FACTORY_P0(I) \ | |
1312 static I* New(Zone* zone, HValue* context) { \ | |
1313 return new(zone) I(); \ | |
1314 } | |
1315 | |
1316 #define DECLARE_INSTRUCTION_FACTORY_P1(I, P1) \ | |
1317 static I* New(Zone* zone, HValue* context, P1 p1) { \ | |
1318 return new(zone) I(p1); \ | |
1319 } | |
1320 | |
1321 #define DECLARE_INSTRUCTION_FACTORY_P2(I, P1, P2) \ | |
1322 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2) { \ | |
1323 return new(zone) I(p1, p2); \ | |
1324 } | |
1325 | |
1326 #define DECLARE_INSTRUCTION_FACTORY_P3(I, P1, P2, P3) \ | |
1327 static I* New(Zone* zone, HValue* context, P1 p1, P2 p2, P3 p3) { \ | |
1328 return new(zone) I(p1, p2, p3); \ | |
1329 } | |
1330 | |
1331 #define DECLARE_INSTRUCTION_FACTORY_P4(I, P1, P2, P3, P4) \ | |
1332 static I* New(Zone* zone, \ | |
1333 HValue* context, \ | |
Toon Verwaest
2013/07/31 12:56:37
Weird indentation.
danno
2013/07/31 14:10:09
Done.
| |
1334 P1 p1, \ | |
1335 P2 p2, \ | |
1336 P3 p3, \ | |
1337 P4 p4) { \ | |
1338 return new(zone) I(p1, p2, p3, p4); \ | |
1339 } | |
1340 | |
1341 #define DECLARE_INSTRUCTION_FACTORY_P5(I, P1, P2, P3, P4, P5) \ | |
1342 static I* New(Zone* zone, \ | |
Toon Verwaest
2013/07/31 12:56:37
Weird indentation.
danno
2013/07/31 14:10:09
Done.
| |
1343 HValue* context, \ | |
1344 P1 p1, \ | |
1345 P2 p2, \ | |
1346 P3 p3, \ | |
1347 P4 p4, \ | |
1348 P5 p5) { \ | |
1349 return new(zone) I(p1, p2, p3, p4, p5); \ | |
1350 } | |
1351 | |
1352 | |
1311 class HInstruction: public HValue { | 1353 class HInstruction: public HValue { |
1312 public: | 1354 public: |
1313 HInstruction* next() const { return next_; } | 1355 HInstruction* next() const { return next_; } |
1314 HInstruction* previous() const { return previous_; } | 1356 HInstruction* previous() const { return previous_; } |
1315 | 1357 |
1316 virtual void PrintTo(StringStream* stream); | 1358 virtual void PrintTo(StringStream* stream); |
1317 virtual void PrintDataTo(StringStream* stream); | 1359 virtual void PrintDataTo(StringStream* stream); |
1318 | 1360 |
1319 bool IsLinked() const { return block() != NULL; } | 1361 bool IsLinked() const { return block() != NULL; } |
1320 void Unlink(); | 1362 void Unlink(); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1510 SetOperandAt(0, constrained_value); | 1552 SetOperandAt(0, constrained_value); |
1511 SetOperandAt(1, related_value); | 1553 SetOperandAt(1, related_value); |
1512 } | 1554 } |
1513 | 1555 |
1514 NumericRelation relation_; | 1556 NumericRelation relation_; |
1515 }; | 1557 }; |
1516 | 1558 |
1517 | 1559 |
1518 class HDeoptimize: public HTemplateInstruction<0> { | 1560 class HDeoptimize: public HTemplateInstruction<0> { |
1519 public: | 1561 public: |
1520 explicit HDeoptimize(Deoptimizer::BailoutType type) : type_(type) {} | 1562 DECLARE_INSTRUCTION_FACTORY_P1(HDeoptimize, Deoptimizer::BailoutType); |
1521 | 1563 |
1522 virtual Representation RequiredInputRepresentation(int index) { | 1564 virtual Representation RequiredInputRepresentation(int index) { |
1523 return Representation::None(); | 1565 return Representation::None(); |
1524 } | 1566 } |
1525 | 1567 |
1526 Deoptimizer::BailoutType type() { return type_; } | 1568 Deoptimizer::BailoutType type() { return type_; } |
1527 | 1569 |
1528 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) | 1570 DECLARE_CONCRETE_INSTRUCTION(Deoptimize) |
1529 | 1571 |
1530 private: | 1572 private: |
1573 explicit HDeoptimize(Deoptimizer::BailoutType type) : type_(type) {} | |
1574 | |
1531 Deoptimizer::BailoutType type_; | 1575 Deoptimizer::BailoutType type_; |
1532 }; | 1576 }; |
1533 | 1577 |
1534 | 1578 |
1535 // Inserts an int3/stop break instruction for debugging purposes. | 1579 // Inserts an int3/stop break instruction for debugging purposes. |
1536 class HDebugBreak: public HTemplateInstruction<0> { | 1580 class HDebugBreak: public HTemplateInstruction<0> { |
1537 public: | 1581 public: |
1538 virtual Representation RequiredInputRepresentation(int index) { | 1582 virtual Representation RequiredInputRepresentation(int index) { |
1539 return Representation::None(); | 1583 return Representation::None(); |
1540 } | 1584 } |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1621 return Representation::Tagged(); | 1665 return Representation::Tagged(); |
1622 } | 1666 } |
1623 | 1667 |
1624 DECLARE_CONCRETE_INSTRUCTION(CompareMap) | 1668 DECLARE_CONCRETE_INSTRUCTION(CompareMap) |
1625 | 1669 |
1626 private: | 1670 private: |
1627 Handle<Map> map_; | 1671 Handle<Map> map_; |
1628 }; | 1672 }; |
1629 | 1673 |
1630 | 1674 |
1675 class HContext: public HTemplateInstruction<0> { | |
1676 public: | |
1677 static HContext* New(Zone* zone) { | |
1678 return new(zone) HContext(); | |
1679 } | |
1680 | |
1681 virtual Representation RequiredInputRepresentation(int index) { | |
1682 return Representation::None(); | |
1683 } | |
1684 | |
1685 DECLARE_CONCRETE_INSTRUCTION(Context) | |
1686 | |
1687 protected: | |
1688 virtual bool DataEquals(HValue* other) { return true; } | |
1689 | |
1690 private: | |
1691 HContext() { | |
1692 set_representation(Representation::Tagged()); | |
1693 SetFlag(kUseGVN); | |
1694 } | |
1695 | |
1696 virtual bool IsDeletable() const { return true; } | |
1697 }; | |
1698 | |
1699 | |
1631 class HReturn: public HTemplateControlInstruction<0, 3> { | 1700 class HReturn: public HTemplateControlInstruction<0, 3> { |
1632 public: | 1701 public: |
1633 HReturn(HValue* value, HValue* context, HValue* parameter_count) { | 1702 static HInstruction* New(Zone* zone, |
1634 SetOperandAt(0, value); | 1703 HValue* context, |
1635 SetOperandAt(1, context); | 1704 HValue* value, |
1636 SetOperandAt(2, parameter_count); | 1705 HValue* parameter_count) { |
1706 return new(zone) HReturn(value, context, parameter_count); | |
1707 } | |
1708 | |
1709 static HInstruction* New(Zone* zone, | |
1710 HValue* context, | |
1711 HValue* value) { | |
1712 return new(zone) HReturn(value, context, 0); | |
1637 } | 1713 } |
1638 | 1714 |
1639 virtual Representation RequiredInputRepresentation(int index) { | 1715 virtual Representation RequiredInputRepresentation(int index) { |
1640 return Representation::Tagged(); | 1716 return Representation::Tagged(); |
1641 } | 1717 } |
1642 | 1718 |
1643 virtual void PrintDataTo(StringStream* stream); | 1719 virtual void PrintDataTo(StringStream* stream); |
1644 | 1720 |
1645 HValue* value() { return OperandAt(0); } | 1721 HValue* value() { return OperandAt(0); } |
1646 HValue* context() { return OperandAt(1); } | 1722 HValue* context() { return OperandAt(1); } |
1647 HValue* parameter_count() { return OperandAt(2); } | 1723 HValue* parameter_count() { return OperandAt(2); } |
1648 | 1724 |
1649 DECLARE_CONCRETE_INSTRUCTION(Return) | 1725 DECLARE_CONCRETE_INSTRUCTION(Return) |
1726 | |
1727 private: | |
1728 HReturn(HValue* value, HValue* context, HValue* parameter_count) { | |
1729 SetOperandAt(0, value); | |
1730 SetOperandAt(1, context); | |
1731 SetOperandAt(2, parameter_count); | |
1732 } | |
1650 }; | 1733 }; |
1651 | 1734 |
1652 | 1735 |
1653 class HAbnormalExit: public HTemplateControlInstruction<0, 0> { | 1736 class HAbnormalExit: public HTemplateControlInstruction<0, 0> { |
1654 public: | 1737 public: |
1655 virtual Representation RequiredInputRepresentation(int index) { | 1738 virtual Representation RequiredInputRepresentation(int index) { |
1656 return Representation::None(); | 1739 return Representation::None(); |
1657 } | 1740 } |
1658 | 1741 |
1659 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) | 1742 DECLARE_CONCRETE_INSTRUCTION(AbnormalExit) |
(...skipping 10 matching lines...) Expand all Loading... | |
1670 return reinterpret_cast<HUnaryOperation*>(value); | 1753 return reinterpret_cast<HUnaryOperation*>(value); |
1671 } | 1754 } |
1672 | 1755 |
1673 HValue* value() const { return OperandAt(0); } | 1756 HValue* value() const { return OperandAt(0); } |
1674 virtual void PrintDataTo(StringStream* stream); | 1757 virtual void PrintDataTo(StringStream* stream); |
1675 }; | 1758 }; |
1676 | 1759 |
1677 | 1760 |
1678 class HThrow: public HTemplateInstruction<2> { | 1761 class HThrow: public HTemplateInstruction<2> { |
1679 public: | 1762 public: |
1680 HThrow(HValue* context, HValue* value) { | 1763 static HThrow* New(Zone* zone, |
1681 SetOperandAt(0, context); | 1764 HValue* context, |
1682 SetOperandAt(1, value); | 1765 HValue* value) { |
1683 SetAllSideEffects(); | 1766 return new(zone) HThrow(context, value); |
1684 } | 1767 } |
1685 | 1768 |
1686 virtual Representation RequiredInputRepresentation(int index) { | 1769 virtual Representation RequiredInputRepresentation(int index) { |
1687 return Representation::Tagged(); | 1770 return Representation::Tagged(); |
1688 } | 1771 } |
1689 | 1772 |
1690 HValue* context() { return OperandAt(0); } | 1773 HValue* context() { return OperandAt(0); } |
1691 HValue* value() { return OperandAt(1); } | 1774 HValue* value() { return OperandAt(1); } |
1692 | 1775 |
1693 DECLARE_CONCRETE_INSTRUCTION(Throw) | 1776 DECLARE_CONCRETE_INSTRUCTION(Throw) |
1777 | |
1778 private: | |
1779 HThrow(HValue* context, HValue* value) { | |
1780 SetOperandAt(0, context); | |
1781 SetOperandAt(1, value); | |
1782 SetAllSideEffects(); | |
1783 } | |
1694 }; | 1784 }; |
1695 | 1785 |
1696 | 1786 |
1697 class HUseConst: public HUnaryOperation { | 1787 class HUseConst: public HUnaryOperation { |
1698 public: | 1788 public: |
1699 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } | 1789 DECLARE_INSTRUCTION_FACTORY_P1(HUseConst, HValue*); |
1700 | 1790 |
1701 virtual Representation RequiredInputRepresentation(int index) { | 1791 virtual Representation RequiredInputRepresentation(int index) { |
1702 return Representation::None(); | 1792 return Representation::None(); |
1703 } | 1793 } |
1704 | 1794 |
1705 DECLARE_CONCRETE_INSTRUCTION(UseConst) | 1795 DECLARE_CONCRETE_INSTRUCTION(UseConst) |
1796 | |
1797 private: | |
1798 explicit HUseConst(HValue* old_value) : HUnaryOperation(old_value) { } | |
1706 }; | 1799 }; |
1707 | 1800 |
1708 | 1801 |
1709 class HForceRepresentation: public HTemplateInstruction<1> { | 1802 class HForceRepresentation: public HTemplateInstruction<1> { |
1710 public: | 1803 public: |
1711 HForceRepresentation(HValue* value, Representation required_representation) { | 1804 DECLARE_INSTRUCTION_FACTORY_P2(HForceRepresentation, HValue*, Representation); |
1712 SetOperandAt(0, value); | |
1713 set_representation(required_representation); | |
1714 } | |
1715 | 1805 |
1716 HValue* value() { return OperandAt(0); } | 1806 HValue* value() { return OperandAt(0); } |
1717 | 1807 |
1718 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 1808 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
1719 | 1809 |
1720 virtual Representation RequiredInputRepresentation(int index) { | 1810 virtual Representation RequiredInputRepresentation(int index) { |
1721 return representation(); // Same as the output representation. | 1811 return representation(); // Same as the output representation. |
1722 } | 1812 } |
1723 | 1813 |
1724 virtual void PrintDataTo(StringStream* stream); | 1814 virtual void PrintDataTo(StringStream* stream); |
1725 | 1815 |
1726 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) | 1816 DECLARE_CONCRETE_INSTRUCTION(ForceRepresentation) |
1817 | |
1818 private: | |
1819 HForceRepresentation(HValue* value, Representation required_representation) { | |
1820 SetOperandAt(0, value); | |
1821 set_representation(required_representation); | |
1822 } | |
1727 }; | 1823 }; |
1728 | 1824 |
1729 | 1825 |
1730 class HChange: public HUnaryOperation { | 1826 class HChange: public HUnaryOperation { |
1731 public: | 1827 public: |
1732 HChange(HValue* value, | 1828 HChange(HValue* value, |
1733 Representation to, | 1829 Representation to, |
1734 bool is_truncating_to_smi, | 1830 bool is_truncating_to_smi, |
1735 bool is_truncating_to_int32, | 1831 bool is_truncating_to_int32, |
1736 bool allow_undefined_as_nan) | 1832 bool allow_undefined_as_nan) |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1778 | 1874 |
1779 private: | 1875 private: |
1780 virtual bool IsDeletable() const { | 1876 virtual bool IsDeletable() const { |
1781 return !from().IsTagged() || value()->type().IsSmi(); | 1877 return !from().IsTagged() || value()->type().IsSmi(); |
1782 } | 1878 } |
1783 }; | 1879 }; |
1784 | 1880 |
1785 | 1881 |
1786 class HClampToUint8: public HUnaryOperation { | 1882 class HClampToUint8: public HUnaryOperation { |
1787 public: | 1883 public: |
1788 explicit HClampToUint8(HValue* value) | 1884 DECLARE_INSTRUCTION_FACTORY_P1(HClampToUint8, HValue*); |
1789 : HUnaryOperation(value) { | |
1790 set_representation(Representation::Integer32()); | |
1791 SetFlag(kAllowUndefinedAsNaN); | |
1792 SetFlag(kUseGVN); | |
1793 } | |
1794 | 1885 |
1795 virtual Representation RequiredInputRepresentation(int index) { | 1886 virtual Representation RequiredInputRepresentation(int index) { |
1796 return Representation::None(); | 1887 return Representation::None(); |
1797 } | 1888 } |
1798 | 1889 |
1799 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) | 1890 DECLARE_CONCRETE_INSTRUCTION(ClampToUint8) |
1800 | 1891 |
1801 protected: | 1892 protected: |
1802 virtual bool DataEquals(HValue* other) { return true; } | 1893 virtual bool DataEquals(HValue* other) { return true; } |
1803 | 1894 |
1804 private: | 1895 private: |
1896 explicit HClampToUint8(HValue* value) | |
1897 : HUnaryOperation(value) { | |
1898 set_representation(Representation::Integer32()); | |
1899 SetFlag(kAllowUndefinedAsNaN); | |
1900 SetFlag(kUseGVN); | |
1901 } | |
1902 | |
1805 virtual bool IsDeletable() const { return true; } | 1903 virtual bool IsDeletable() const { return true; } |
1806 }; | 1904 }; |
1807 | 1905 |
1808 | 1906 |
1809 enum RemovableSimulate { | 1907 enum RemovableSimulate { |
1810 REMOVABLE_SIMULATE, | 1908 REMOVABLE_SIMULATE, |
1811 FIXED_SIMULATE | 1909 FIXED_SIMULATE |
1812 }; | 1910 }; |
1813 | 1911 |
1814 | 1912 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1951 }; | 2049 }; |
1952 | 2050 |
1953 | 2051 |
1954 class HStackCheck: public HTemplateInstruction<1> { | 2052 class HStackCheck: public HTemplateInstruction<1> { |
1955 public: | 2053 public: |
1956 enum Type { | 2054 enum Type { |
1957 kFunctionEntry, | 2055 kFunctionEntry, |
1958 kBackwardsBranch | 2056 kBackwardsBranch |
1959 }; | 2057 }; |
1960 | 2058 |
1961 HStackCheck(HValue* context, Type type) : type_(type) { | 2059 DECLARE_INSTRUCTION_FACTORY_P2(HStackCheck, HValue*, Type); |
1962 SetOperandAt(0, context); | |
1963 SetGVNFlag(kChangesNewSpacePromotion); | |
1964 } | |
1965 | 2060 |
1966 HValue* context() { return OperandAt(0); } | 2061 HValue* context() { return OperandAt(0); } |
1967 | 2062 |
1968 virtual Representation RequiredInputRepresentation(int index) { | 2063 virtual Representation RequiredInputRepresentation(int index) { |
1969 return Representation::Tagged(); | 2064 return Representation::Tagged(); |
1970 } | 2065 } |
1971 | 2066 |
1972 void Eliminate() { | 2067 void Eliminate() { |
1973 // The stack check eliminator might try to eliminate the same stack | 2068 // The stack check eliminator might try to eliminate the same stack |
1974 // check instruction multiple times. | 2069 // check instruction multiple times. |
1975 if (IsLinked()) { | 2070 if (IsLinked()) { |
1976 DeleteAndReplaceWith(NULL); | 2071 DeleteAndReplaceWith(NULL); |
1977 } | 2072 } |
1978 } | 2073 } |
1979 | 2074 |
1980 bool is_function_entry() { return type_ == kFunctionEntry; } | 2075 bool is_function_entry() { return type_ == kFunctionEntry; } |
1981 bool is_backwards_branch() { return type_ == kBackwardsBranch; } | 2076 bool is_backwards_branch() { return type_ == kBackwardsBranch; } |
1982 | 2077 |
1983 DECLARE_CONCRETE_INSTRUCTION(StackCheck) | 2078 DECLARE_CONCRETE_INSTRUCTION(StackCheck) |
1984 | 2079 |
1985 private: | 2080 private: |
2081 HStackCheck(HValue* context, Type type) : type_(type) { | |
2082 SetOperandAt(0, context); | |
2083 SetGVNFlag(kChangesNewSpacePromotion); | |
2084 } | |
2085 | |
1986 Type type_; | 2086 Type type_; |
1987 }; | 2087 }; |
1988 | 2088 |
1989 | 2089 |
1990 enum InliningKind { | 2090 enum InliningKind { |
1991 NORMAL_RETURN, // Normal function/method call and return. | 2091 NORMAL_RETURN, // Normal function/method call and return. |
1992 DROP_EXTRA_ON_RETURN, // Drop an extra value from the environment on return. | 2092 DROP_EXTRA_ON_RETURN, // Drop an extra value from the environment on return. |
1993 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. | 2093 CONSTRUCT_CALL_RETURN, // Either use allocated receiver or return value. |
1994 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. | 2094 GETTER_CALL_RETURN, // Returning from a getter, need to restore context. |
1995 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. | 2095 SETTER_CALL_RETURN // Use the RHS of the assignment as the return value. |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2062 virtual Representation RequiredInputRepresentation(int index) { | 2162 virtual Representation RequiredInputRepresentation(int index) { |
2063 return Representation::None(); | 2163 return Representation::None(); |
2064 } | 2164 } |
2065 | 2165 |
2066 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) | 2166 DECLARE_CONCRETE_INSTRUCTION(LeaveInlined) |
2067 }; | 2167 }; |
2068 | 2168 |
2069 | 2169 |
2070 class HPushArgument: public HUnaryOperation { | 2170 class HPushArgument: public HUnaryOperation { |
2071 public: | 2171 public: |
2072 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { | 2172 DECLARE_INSTRUCTION_FACTORY_P1(HPushArgument, HValue*); |
2073 set_representation(Representation::Tagged()); | |
2074 } | |
2075 | 2173 |
2076 virtual Representation RequiredInputRepresentation(int index) { | 2174 virtual Representation RequiredInputRepresentation(int index) { |
2077 return Representation::Tagged(); | 2175 return Representation::Tagged(); |
2078 } | 2176 } |
2079 | 2177 |
2080 HValue* argument() { return OperandAt(0); } | 2178 HValue* argument() { return OperandAt(0); } |
2081 | 2179 |
2082 DECLARE_CONCRETE_INSTRUCTION(PushArgument) | 2180 DECLARE_CONCRETE_INSTRUCTION(PushArgument) |
2181 | |
2182 private: | |
2183 explicit HPushArgument(HValue* value) : HUnaryOperation(value) { | |
2184 set_representation(Representation::Tagged()); | |
2185 } | |
2083 }; | 2186 }; |
2084 | 2187 |
2085 | 2188 |
2086 class HThisFunction: public HTemplateInstruction<0> { | 2189 class HThisFunction: public HTemplateInstruction<0> { |
2087 public: | 2190 public: |
2088 HThisFunction() { | 2191 HThisFunction() { |
2089 set_representation(Representation::Tagged()); | 2192 set_representation(Representation::Tagged()); |
2090 SetFlag(kUseGVN); | 2193 SetFlag(kUseGVN); |
2091 } | 2194 } |
2092 | 2195 |
2093 virtual Representation RequiredInputRepresentation(int index) { | 2196 virtual Representation RequiredInputRepresentation(int index) { |
2094 return Representation::None(); | 2197 return Representation::None(); |
2095 } | 2198 } |
2096 | 2199 |
2097 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) | 2200 DECLARE_CONCRETE_INSTRUCTION(ThisFunction) |
2098 | 2201 |
2099 protected: | 2202 protected: |
2100 virtual bool DataEquals(HValue* other) { return true; } | 2203 virtual bool DataEquals(HValue* other) { return true; } |
2101 | 2204 |
2102 private: | 2205 private: |
2103 virtual bool IsDeletable() const { return true; } | 2206 virtual bool IsDeletable() const { return true; } |
2104 }; | 2207 }; |
2105 | 2208 |
2106 | 2209 |
2107 class HContext: public HTemplateInstruction<0> { | |
2108 public: | |
2109 HContext() { | |
2110 set_representation(Representation::Tagged()); | |
2111 SetFlag(kUseGVN); | |
2112 } | |
2113 | |
2114 virtual Representation RequiredInputRepresentation(int index) { | |
2115 return Representation::None(); | |
2116 } | |
2117 | |
2118 DECLARE_CONCRETE_INSTRUCTION(Context) | |
2119 | |
2120 protected: | |
2121 virtual bool DataEquals(HValue* other) { return true; } | |
2122 | |
2123 private: | |
2124 virtual bool IsDeletable() const { return true; } | |
2125 }; | |
2126 | |
2127 | |
2128 class HOuterContext: public HUnaryOperation { | 2210 class HOuterContext: public HUnaryOperation { |
2129 public: | 2211 public: |
2130 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { | 2212 DECLARE_INSTRUCTION_FACTORY_P1(HOuterContext, HValue*); |
2131 set_representation(Representation::Tagged()); | |
2132 SetFlag(kUseGVN); | |
2133 } | |
2134 | 2213 |
2135 DECLARE_CONCRETE_INSTRUCTION(OuterContext); | 2214 DECLARE_CONCRETE_INSTRUCTION(OuterContext); |
2136 | 2215 |
2137 virtual Representation RequiredInputRepresentation(int index) { | 2216 virtual Representation RequiredInputRepresentation(int index) { |
2138 return Representation::Tagged(); | 2217 return Representation::Tagged(); |
2139 } | 2218 } |
2140 | 2219 |
2141 protected: | 2220 protected: |
2142 virtual bool DataEquals(HValue* other) { return true; } | 2221 virtual bool DataEquals(HValue* other) { return true; } |
2143 | 2222 |
2144 private: | 2223 private: |
2224 explicit HOuterContext(HValue* inner) : HUnaryOperation(inner) { | |
2225 set_representation(Representation::Tagged()); | |
2226 SetFlag(kUseGVN); | |
2227 } | |
2228 | |
2145 virtual bool IsDeletable() const { return true; } | 2229 virtual bool IsDeletable() const { return true; } |
2146 }; | 2230 }; |
2147 | 2231 |
2148 | 2232 |
2149 class HDeclareGlobals: public HUnaryOperation { | 2233 class HDeclareGlobals: public HUnaryOperation { |
2150 public: | 2234 public: |
2151 HDeclareGlobals(HValue* context, | 2235 HDeclareGlobals(HValue* context, |
2152 Handle<FixedArray> pairs, | 2236 Handle<FixedArray> pairs, |
2153 int flags) | 2237 int flags) |
2154 : HUnaryOperation(context), | 2238 : HUnaryOperation(context), |
2155 pairs_(pairs), | 2239 pairs_(pairs), |
2156 flags_(flags) { | 2240 flags_(flags) { |
2157 set_representation(Representation::Tagged()); | 2241 set_representation(Representation::Tagged()); |
2158 SetAllSideEffects(); | 2242 SetAllSideEffects(); |
2159 } | 2243 } |
2160 | 2244 |
2245 static HDeclareGlobals* New(Zone* zone, | |
2246 HValue* context, | |
2247 Handle<FixedArray> pairs, | |
2248 int flags) { | |
2249 return new(zone) HDeclareGlobals(context, pairs, flags); | |
2250 } | |
2251 | |
2161 HValue* context() { return OperandAt(0); } | 2252 HValue* context() { return OperandAt(0); } |
2162 Handle<FixedArray> pairs() const { return pairs_; } | 2253 Handle<FixedArray> pairs() const { return pairs_; } |
2163 int flags() const { return flags_; } | 2254 int flags() const { return flags_; } |
2164 | 2255 |
2165 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) | 2256 DECLARE_CONCRETE_INSTRUCTION(DeclareGlobals) |
2166 | 2257 |
2167 virtual Representation RequiredInputRepresentation(int index) { | 2258 virtual Representation RequiredInputRepresentation(int index) { |
2168 return Representation::Tagged(); | 2259 return Representation::Tagged(); |
2169 } | 2260 } |
2261 | |
2170 private: | 2262 private: |
2171 Handle<FixedArray> pairs_; | 2263 Handle<FixedArray> pairs_; |
2172 int flags_; | 2264 int flags_; |
2173 }; | 2265 }; |
2174 | 2266 |
2175 | 2267 |
2176 class HGlobalObject: public HUnaryOperation { | 2268 class HGlobalObject: public HUnaryOperation { |
2177 public: | 2269 public: |
2178 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { | 2270 explicit HGlobalObject(HValue* context) : HUnaryOperation(context) { |
2179 set_representation(Representation::Tagged()); | 2271 set_representation(Representation::Tagged()); |
2180 SetFlag(kUseGVN); | 2272 SetFlag(kUseGVN); |
2181 } | 2273 } |
2182 | 2274 |
2275 static HGlobalObject* New(Zone* zone, HValue* context) { | |
2276 return new(zone) HGlobalObject(context); | |
2277 } | |
2278 | |
2183 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) | 2279 DECLARE_CONCRETE_INSTRUCTION(GlobalObject) |
2184 | 2280 |
2185 virtual Representation RequiredInputRepresentation(int index) { | 2281 virtual Representation RequiredInputRepresentation(int index) { |
2186 return Representation::Tagged(); | 2282 return Representation::Tagged(); |
2187 } | 2283 } |
2188 | 2284 |
2189 protected: | 2285 protected: |
2190 virtual bool DataEquals(HValue* other) { return true; } | 2286 virtual bool DataEquals(HValue* other) { return true; } |
2191 | 2287 |
2192 private: | 2288 private: |
2193 virtual bool IsDeletable() const { return true; } | 2289 virtual bool IsDeletable() const { return true; } |
2194 }; | 2290 }; |
2195 | 2291 |
2196 | 2292 |
2197 class HGlobalReceiver: public HUnaryOperation { | 2293 class HGlobalReceiver: public HUnaryOperation { |
2198 public: | 2294 public: |
2199 explicit HGlobalReceiver(HValue* global_object) | 2295 DECLARE_INSTRUCTION_FACTORY_P1(HGlobalReceiver, HValue*); |
2200 : HUnaryOperation(global_object) { | |
2201 set_representation(Representation::Tagged()); | |
2202 SetFlag(kUseGVN); | |
2203 } | |
2204 | 2296 |
2205 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) | 2297 DECLARE_CONCRETE_INSTRUCTION(GlobalReceiver) |
2206 | 2298 |
2207 virtual Representation RequiredInputRepresentation(int index) { | 2299 virtual Representation RequiredInputRepresentation(int index) { |
2208 return Representation::Tagged(); | 2300 return Representation::Tagged(); |
2209 } | 2301 } |
2210 | 2302 |
2211 protected: | 2303 protected: |
2212 virtual bool DataEquals(HValue* other) { return true; } | 2304 virtual bool DataEquals(HValue* other) { return true; } |
2213 | 2305 |
2214 private: | 2306 private: |
2307 explicit HGlobalReceiver(HValue* global_object) | |
2308 : HUnaryOperation(global_object) { | |
2309 set_representation(Representation::Tagged()); | |
2310 SetFlag(kUseGVN); | |
2311 } | |
2312 | |
2215 virtual bool IsDeletable() const { return true; } | 2313 virtual bool IsDeletable() const { return true; } |
2216 }; | 2314 }; |
2217 | 2315 |
2218 | 2316 |
2219 template <int V> | 2317 template <int V> |
2220 class HCall: public HTemplateInstruction<V> { | 2318 class HCall: public HTemplateInstruction<V> { |
2221 public: | 2319 public: |
2222 // The argument count includes the receiver. | 2320 // The argument count includes the receiver. |
2223 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { | 2321 explicit HCall<V>(int argument_count) : argument_count_(argument_count) { |
2224 this->set_representation(Representation::Tagged()); | 2322 this->set_representation(Representation::Tagged()); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2271 HValue* second() { return OperandAt(1); } | 2369 HValue* second() { return OperandAt(1); } |
2272 }; | 2370 }; |
2273 | 2371 |
2274 | 2372 |
2275 class HInvokeFunction: public HBinaryCall { | 2373 class HInvokeFunction: public HBinaryCall { |
2276 public: | 2374 public: |
2277 HInvokeFunction(HValue* context, HValue* function, int argument_count) | 2375 HInvokeFunction(HValue* context, HValue* function, int argument_count) |
2278 : HBinaryCall(context, function, argument_count) { | 2376 : HBinaryCall(context, function, argument_count) { |
2279 } | 2377 } |
2280 | 2378 |
2379 static HInvokeFunction* New(Zone* zone, | |
2380 HValue* context, | |
2381 HValue* function, | |
2382 int argument_count) { | |
2383 return new(zone) HInvokeFunction(context, function, argument_count); | |
2384 } | |
2385 | |
2281 HInvokeFunction(HValue* context, | 2386 HInvokeFunction(HValue* context, |
2282 HValue* function, | 2387 HValue* function, |
2283 Handle<JSFunction> known_function, | 2388 Handle<JSFunction> known_function, |
2284 int argument_count) | 2389 int argument_count) |
2285 : HBinaryCall(context, function, argument_count), | 2390 : HBinaryCall(context, function, argument_count), |
2286 known_function_(known_function) { | 2391 known_function_(known_function) { |
2287 formal_parameter_count_ = known_function.is_null() | 2392 formal_parameter_count_ = known_function.is_null() |
2288 ? 0 : known_function->shared()->formal_parameter_count(); | 2393 ? 0 : known_function->shared()->formal_parameter_count(); |
2289 } | 2394 } |
2290 | 2395 |
2396 static HInvokeFunction* New(Zone* zone, | |
2397 HValue* context, | |
2398 HValue* function, | |
2399 Handle<JSFunction> known_function, | |
2400 int argument_count) { | |
2401 return new(zone) HInvokeFunction(context, function, | |
2402 known_function, argument_count); | |
2403 } | |
2404 | |
2291 virtual Representation RequiredInputRepresentation(int index) { | 2405 virtual Representation RequiredInputRepresentation(int index) { |
2292 return Representation::Tagged(); | 2406 return Representation::Tagged(); |
2293 } | 2407 } |
2294 | 2408 |
2295 HValue* context() { return first(); } | 2409 HValue* context() { return first(); } |
2296 HValue* function() { return second(); } | 2410 HValue* function() { return second(); } |
2297 Handle<JSFunction> known_function() { return known_function_; } | 2411 Handle<JSFunction> known_function() { return known_function_; } |
2298 int formal_parameter_count() const { return formal_parameter_count_; } | 2412 int formal_parameter_count() const { return formal_parameter_count_; } |
2299 | 2413 |
2300 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) | 2414 DECLARE_CONCRETE_INSTRUCTION(InvokeFunction) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2372 Handle<String> name_; | 2486 Handle<String> name_; |
2373 }; | 2487 }; |
2374 | 2488 |
2375 | 2489 |
2376 class HCallFunction: public HBinaryCall { | 2490 class HCallFunction: public HBinaryCall { |
2377 public: | 2491 public: |
2378 HCallFunction(HValue* context, HValue* function, int argument_count) | 2492 HCallFunction(HValue* context, HValue* function, int argument_count) |
2379 : HBinaryCall(context, function, argument_count) { | 2493 : HBinaryCall(context, function, argument_count) { |
2380 } | 2494 } |
2381 | 2495 |
2496 static HCallFunction* New(Zone* zone, | |
2497 HValue* context, | |
2498 HValue* function, | |
2499 int argument_count) { | |
2500 return new(zone) HCallFunction(context, function, argument_count); | |
2501 } | |
2502 | |
2382 HValue* context() { return first(); } | 2503 HValue* context() { return first(); } |
2383 HValue* function() { return second(); } | 2504 HValue* function() { return second(); } |
2384 | 2505 |
2385 virtual Representation RequiredInputRepresentation(int index) { | 2506 virtual Representation RequiredInputRepresentation(int index) { |
2386 return Representation::Tagged(); | 2507 return Representation::Tagged(); |
2387 } | 2508 } |
2388 | 2509 |
2389 DECLARE_CONCRETE_INSTRUCTION(CallFunction) | 2510 DECLARE_CONCRETE_INSTRUCTION(CallFunction) |
2390 }; | 2511 }; |
2391 | 2512 |
2392 | 2513 |
2393 class HCallGlobal: public HUnaryCall { | 2514 class HCallGlobal: public HUnaryCall { |
2394 public: | 2515 public: |
2395 HCallGlobal(HValue* context, Handle<String> name, int argument_count) | 2516 HCallGlobal(HValue* context, Handle<String> name, int argument_count) |
2396 : HUnaryCall(context, argument_count), name_(name) { | 2517 : HUnaryCall(context, argument_count), name_(name) { |
2397 } | 2518 } |
2398 | 2519 |
2520 static HCallGlobal* New(Zone* zone, | |
2521 HValue* context, | |
2522 Handle<String> name, | |
2523 int argument_count) { | |
2524 return new(zone) HCallGlobal(context, name, argument_count); | |
2525 } | |
2526 | |
2399 virtual void PrintDataTo(StringStream* stream); | 2527 virtual void PrintDataTo(StringStream* stream); |
2400 | 2528 |
2401 HValue* context() { return value(); } | 2529 HValue* context() { return value(); } |
2402 Handle<String> name() const { return name_; } | 2530 Handle<String> name() const { return name_; } |
2403 | 2531 |
2404 virtual Representation RequiredInputRepresentation(int index) { | 2532 virtual Representation RequiredInputRepresentation(int index) { |
2405 return Representation::Tagged(); | 2533 return Representation::Tagged(); |
2406 } | 2534 } |
2407 | 2535 |
2408 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) | 2536 DECLARE_CONCRETE_INSTRUCTION(CallGlobal) |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2472 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) | 2600 DECLARE_CONCRETE_INSTRUCTION(CallNewArray) |
2473 | 2601 |
2474 private: | 2602 private: |
2475 ElementsKind elements_kind_; | 2603 ElementsKind elements_kind_; |
2476 Handle<Cell> type_cell_; | 2604 Handle<Cell> type_cell_; |
2477 }; | 2605 }; |
2478 | 2606 |
2479 | 2607 |
2480 class HCallRuntime: public HCall<1> { | 2608 class HCallRuntime: public HCall<1> { |
2481 public: | 2609 public: |
2482 HCallRuntime(HValue* context, | 2610 static HCallRuntime* New(Zone* zone, |
2483 Handle<String> name, | 2611 HValue* context, |
2484 const Runtime::Function* c_function, | 2612 Handle<String> name, |
2485 int argument_count) | 2613 const Runtime::Function* c_function, |
2486 : HCall<1>(argument_count), c_function_(c_function), name_(name) { | 2614 int argument_count) { |
2487 SetOperandAt(0, context); | 2615 return new(zone) HCallRuntime(context, name, c_function, argument_count); |
2488 } | 2616 } |
2489 | 2617 |
2490 virtual void PrintDataTo(StringStream* stream); | 2618 virtual void PrintDataTo(StringStream* stream); |
2491 | 2619 |
2492 HValue* context() { return OperandAt(0); } | 2620 HValue* context() { return OperandAt(0); } |
2493 const Runtime::Function* function() const { return c_function_; } | 2621 const Runtime::Function* function() const { return c_function_; } |
2494 Handle<String> name() const { return name_; } | 2622 Handle<String> name() const { return name_; } |
2495 | 2623 |
2496 virtual Representation RequiredInputRepresentation(int index) { | 2624 virtual Representation RequiredInputRepresentation(int index) { |
2497 return Representation::Tagged(); | 2625 return Representation::Tagged(); |
2498 } | 2626 } |
2499 | 2627 |
2500 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) | 2628 DECLARE_CONCRETE_INSTRUCTION(CallRuntime) |
2501 | 2629 |
2502 private: | 2630 private: |
2631 HCallRuntime(HValue* context, | |
2632 Handle<String> name, | |
2633 const Runtime::Function* c_function, | |
2634 int argument_count) | |
2635 : HCall<1>(argument_count), c_function_(c_function), name_(name) { | |
2636 SetOperandAt(0, context); | |
2637 } | |
2638 | |
2503 const Runtime::Function* c_function_; | 2639 const Runtime::Function* c_function_; |
2504 Handle<String> name_; | 2640 Handle<String> name_; |
2505 }; | 2641 }; |
2506 | 2642 |
2507 | 2643 |
2508 class HMapEnumLength: public HUnaryOperation { | 2644 class HMapEnumLength: public HUnaryOperation { |
2509 public: | 2645 public: |
2510 explicit HMapEnumLength(HValue* value) : HUnaryOperation(value) { | 2646 DECLARE_INSTRUCTION_FACTORY_P1(HMapEnumLength, HValue*); |
2511 set_type(HType::Smi()); | |
2512 set_representation(Representation::Smi()); | |
2513 SetFlag(kUseGVN); | |
2514 SetGVNFlag(kDependsOnMaps); | |
2515 } | |
2516 | 2647 |
2517 virtual Representation RequiredInputRepresentation(int index) { | 2648 virtual Representation RequiredInputRepresentation(int index) { |
2518 return Representation::Tagged(); | 2649 return Representation::Tagged(); |
2519 } | 2650 } |
2520 | 2651 |
2521 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) | 2652 DECLARE_CONCRETE_INSTRUCTION(MapEnumLength) |
2522 | 2653 |
2523 protected: | 2654 protected: |
2524 virtual bool DataEquals(HValue* other) { return true; } | 2655 virtual bool DataEquals(HValue* other) { return true; } |
2525 | 2656 |
2526 private: | 2657 private: |
2658 explicit HMapEnumLength(HValue* value) : HUnaryOperation(value) { | |
2659 set_type(HType::Smi()); | |
2660 set_representation(Representation::Smi()); | |
2661 SetFlag(kUseGVN); | |
2662 SetGVNFlag(kDependsOnMaps); | |
2663 } | |
2664 | |
2527 virtual bool IsDeletable() const { return true; } | 2665 virtual bool IsDeletable() const { return true; } |
2528 }; | 2666 }; |
2529 | 2667 |
2530 | 2668 |
2531 class HElementsKind: public HUnaryOperation { | 2669 class HElementsKind: public HUnaryOperation { |
2532 public: | 2670 public: |
2533 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { | 2671 explicit HElementsKind(HValue* value) : HUnaryOperation(value) { |
2534 set_representation(Representation::Integer32()); | 2672 set_representation(Representation::Integer32()); |
2535 SetFlag(kUseGVN); | 2673 SetFlag(kUseGVN); |
2536 SetGVNFlag(kDependsOnElementsKind); | 2674 SetGVNFlag(kDependsOnElementsKind); |
2537 } | 2675 } |
2538 | 2676 |
2539 virtual Representation RequiredInputRepresentation(int index) { | 2677 virtual Representation RequiredInputRepresentation(int index) { |
2540 return Representation::Tagged(); | 2678 return Representation::Tagged(); |
2541 } | 2679 } |
2542 | 2680 |
2543 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) | 2681 DECLARE_CONCRETE_INSTRUCTION(ElementsKind) |
2544 | 2682 |
2545 protected: | 2683 protected: |
2546 virtual bool DataEquals(HValue* other) { return true; } | 2684 virtual bool DataEquals(HValue* other) { return true; } |
2547 | 2685 |
2548 private: | 2686 private: |
2549 virtual bool IsDeletable() const { return true; } | 2687 virtual bool IsDeletable() const { return true; } |
2550 }; | 2688 }; |
2551 | 2689 |
2552 | 2690 |
2553 class HBitNot: public HUnaryOperation { | 2691 class HBitNot: public HUnaryOperation { |
2554 public: | 2692 public: |
2555 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | 2693 DECLARE_INSTRUCTION_FACTORY_P1(HBitNot, HValue*); |
2556 set_representation(Representation::Integer32()); | |
2557 SetFlag(kUseGVN); | |
2558 SetFlag(kTruncatingToInt32); | |
2559 SetFlag(kAllowUndefinedAsNaN); | |
2560 } | |
2561 | 2694 |
2562 virtual Representation RequiredInputRepresentation(int index) { | 2695 virtual Representation RequiredInputRepresentation(int index) { |
2563 return Representation::Integer32(); | 2696 return Representation::Integer32(); |
2564 } | 2697 } |
2565 virtual Representation observed_input_representation(int index) { | 2698 virtual Representation observed_input_representation(int index) { |
2566 return Representation::Integer32(); | 2699 return Representation::Integer32(); |
2567 } | 2700 } |
2568 virtual HType CalculateInferredType(); | 2701 virtual HType CalculateInferredType(); |
2569 | 2702 |
2570 virtual HValue* Canonicalize(); | 2703 virtual HValue* Canonicalize(); |
2571 | 2704 |
2572 DECLARE_CONCRETE_INSTRUCTION(BitNot) | 2705 DECLARE_CONCRETE_INSTRUCTION(BitNot) |
2573 | 2706 |
2574 protected: | 2707 protected: |
2575 virtual bool DataEquals(HValue* other) { return true; } | 2708 virtual bool DataEquals(HValue* other) { return true; } |
2576 | 2709 |
2577 private: | 2710 private: |
2711 explicit HBitNot(HValue* value) : HUnaryOperation(value) { | |
2712 set_representation(Representation::Integer32()); | |
2713 SetFlag(kUseGVN); | |
2714 SetFlag(kTruncatingToInt32); | |
2715 SetFlag(kAllowUndefinedAsNaN); | |
2716 } | |
2717 | |
2578 virtual bool IsDeletable() const { return true; } | 2718 virtual bool IsDeletable() const { return true; } |
2579 }; | 2719 }; |
2580 | 2720 |
2581 | 2721 |
2582 class HUnaryMathOperation: public HTemplateInstruction<2> { | 2722 class HUnaryMathOperation: public HTemplateInstruction<2> { |
2583 public: | 2723 public: |
2584 static HInstruction* New(Zone* zone, | 2724 static HInstruction* New(Zone* zone, |
2585 HValue* context, | 2725 HValue* context, |
2586 HValue* value, | 2726 HValue* value, |
2587 BuiltinFunctionId op); | 2727 BuiltinFunctionId op); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2674 } | 2814 } |
2675 | 2815 |
2676 virtual bool IsDeletable() const { return true; } | 2816 virtual bool IsDeletable() const { return true; } |
2677 | 2817 |
2678 BuiltinFunctionId op_; | 2818 BuiltinFunctionId op_; |
2679 }; | 2819 }; |
2680 | 2820 |
2681 | 2821 |
2682 class HLoadExternalArrayPointer: public HUnaryOperation { | 2822 class HLoadExternalArrayPointer: public HUnaryOperation { |
2683 public: | 2823 public: |
2684 explicit HLoadExternalArrayPointer(HValue* value) | 2824 DECLARE_INSTRUCTION_FACTORY_P1(HLoadExternalArrayPointer, HValue*); |
2685 : HUnaryOperation(value) { | |
2686 set_representation(Representation::External()); | |
2687 // The result of this instruction is idempotent as long as its inputs don't | |
2688 // change. The external array of a specialized array elements object cannot | |
2689 // change once set, so it's no necessary to introduce any additional | |
2690 // dependencies on top of the inputs. | |
2691 SetFlag(kUseGVN); | |
2692 } | |
2693 | 2825 |
2694 virtual Representation RequiredInputRepresentation(int index) { | 2826 virtual Representation RequiredInputRepresentation(int index) { |
2695 return Representation::Tagged(); | 2827 return Representation::Tagged(); |
2696 } | 2828 } |
2697 | 2829 |
2698 virtual HType CalculateInferredType() { | 2830 virtual HType CalculateInferredType() { |
2699 return HType::None(); | 2831 return HType::None(); |
2700 } | 2832 } |
2701 | 2833 |
2702 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) | 2834 DECLARE_CONCRETE_INSTRUCTION(LoadExternalArrayPointer) |
2703 | 2835 |
2704 protected: | 2836 protected: |
2705 virtual bool DataEquals(HValue* other) { return true; } | 2837 virtual bool DataEquals(HValue* other) { return true; } |
2706 | 2838 |
2707 private: | 2839 private: |
2840 explicit HLoadExternalArrayPointer(HValue* value) | |
2841 : HUnaryOperation(value) { | |
2842 set_representation(Representation::External()); | |
2843 // The result of this instruction is idempotent as long as its inputs don't | |
2844 // change. The external array of a specialized array elements object cannot | |
2845 // change once set, so it's no necessary to introduce any additional | |
2846 // dependencies on top of the inputs. | |
2847 SetFlag(kUseGVN); | |
2848 } | |
2849 | |
2708 virtual bool IsDeletable() const { return true; } | 2850 virtual bool IsDeletable() const { return true; } |
2709 }; | 2851 }; |
2710 | 2852 |
2711 | 2853 |
2712 class HCheckMaps: public HTemplateInstruction<2> { | 2854 class HCheckMaps: public HTemplateInstruction<2> { |
2713 public: | 2855 public: |
2714 static HCheckMaps* New(HValue* value, Handle<Map> map, Zone* zone, | 2856 static HCheckMaps* New(HValue* value, Handle<Map> map, Zone* zone, |
2715 CompilationInfo* info, HValue *typecheck = NULL); | 2857 CompilationInfo* info, HValue *typecheck = NULL); |
2716 static HCheckMaps* New(HValue* value, SmallMapList* maps, Zone* zone, | 2858 static HCheckMaps* New(HValue* value, SmallMapList* maps, Zone* zone, |
2717 HValue *typecheck = NULL) { | 2859 HValue *typecheck = NULL) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2785 } | 2927 } |
2786 | 2928 |
2787 bool omit_; | 2929 bool omit_; |
2788 SmallMapList map_set_; | 2930 SmallMapList map_set_; |
2789 ZoneList<UniqueValueId> map_unique_ids_; | 2931 ZoneList<UniqueValueId> map_unique_ids_; |
2790 }; | 2932 }; |
2791 | 2933 |
2792 | 2934 |
2793 class HCheckFunction: public HUnaryOperation { | 2935 class HCheckFunction: public HUnaryOperation { |
2794 public: | 2936 public: |
2795 HCheckFunction(HValue* value, Handle<JSFunction> function) | 2937 DECLARE_INSTRUCTION_FACTORY_P2(HCheckFunction, HValue*, Handle<JSFunction>); |
2796 : HUnaryOperation(value), target_(function), target_unique_id_() { | |
2797 set_representation(Representation::Tagged()); | |
2798 SetFlag(kUseGVN); | |
2799 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); | |
2800 } | |
2801 | 2938 |
2802 virtual Representation RequiredInputRepresentation(int index) { | 2939 virtual Representation RequiredInputRepresentation(int index) { |
2803 return Representation::Tagged(); | 2940 return Representation::Tagged(); |
2804 } | 2941 } |
2805 virtual void PrintDataTo(StringStream* stream); | 2942 virtual void PrintDataTo(StringStream* stream); |
2806 virtual HType CalculateInferredType(); | 2943 virtual HType CalculateInferredType(); |
2807 | 2944 |
2808 virtual HValue* Canonicalize(); | 2945 virtual HValue* Canonicalize(); |
2809 | 2946 |
2810 #ifdef DEBUG | 2947 #ifdef DEBUG |
2811 virtual void Verify(); | 2948 virtual void Verify(); |
2812 #endif | 2949 #endif |
2813 | 2950 |
2814 virtual void FinalizeUniqueValueId() { | 2951 virtual void FinalizeUniqueValueId() { |
2815 target_unique_id_ = UniqueValueId(target_); | 2952 target_unique_id_ = UniqueValueId(target_); |
2816 } | 2953 } |
2817 | 2954 |
2818 Handle<JSFunction> target() const { return target_; } | 2955 Handle<JSFunction> target() const { return target_; } |
2819 bool target_in_new_space() const { return target_in_new_space_; } | 2956 bool target_in_new_space() const { return target_in_new_space_; } |
2820 | 2957 |
2821 DECLARE_CONCRETE_INSTRUCTION(CheckFunction) | 2958 DECLARE_CONCRETE_INSTRUCTION(CheckFunction) |
2822 | 2959 |
2823 protected: | 2960 protected: |
2824 virtual bool DataEquals(HValue* other) { | 2961 virtual bool DataEquals(HValue* other) { |
2825 HCheckFunction* b = HCheckFunction::cast(other); | 2962 HCheckFunction* b = HCheckFunction::cast(other); |
2826 return target_unique_id_ == b->target_unique_id_; | 2963 return target_unique_id_ == b->target_unique_id_; |
2827 } | 2964 } |
2828 | 2965 |
2829 private: | 2966 private: |
2967 HCheckFunction(HValue* value, Handle<JSFunction> function) | |
2968 : HUnaryOperation(value), target_(function), target_unique_id_() { | |
2969 set_representation(Representation::Tagged()); | |
2970 SetFlag(kUseGVN); | |
2971 target_in_new_space_ = Isolate::Current()->heap()->InNewSpace(*function); | |
2972 } | |
2973 | |
2830 Handle<JSFunction> target_; | 2974 Handle<JSFunction> target_; |
2831 UniqueValueId target_unique_id_; | 2975 UniqueValueId target_unique_id_; |
2832 bool target_in_new_space_; | 2976 bool target_in_new_space_; |
2833 }; | 2977 }; |
2834 | 2978 |
2835 | 2979 |
2836 class HCheckInstanceType: public HUnaryOperation { | 2980 class HCheckInstanceType: public HUnaryOperation { |
2837 public: | 2981 public: |
2838 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { | 2982 static HCheckInstanceType* NewIsSpecObject(HValue* value, Zone* zone) { |
2839 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); | 2983 return new(zone) HCheckInstanceType(value, IS_SPEC_OBJECT); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2888 set_representation(Representation::Tagged()); | 3032 set_representation(Representation::Tagged()); |
2889 SetFlag(kUseGVN); | 3033 SetFlag(kUseGVN); |
2890 } | 3034 } |
2891 | 3035 |
2892 const Check check_; | 3036 const Check check_; |
2893 }; | 3037 }; |
2894 | 3038 |
2895 | 3039 |
2896 class HCheckSmi: public HUnaryOperation { | 3040 class HCheckSmi: public HUnaryOperation { |
2897 public: | 3041 public: |
2898 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { | 3042 DECLARE_INSTRUCTION_FACTORY_P1(HCheckSmi, HValue*); |
2899 set_representation(Representation::Smi()); | |
2900 SetFlag(kUseGVN); | |
2901 } | |
2902 | 3043 |
2903 virtual Representation RequiredInputRepresentation(int index) { | 3044 virtual Representation RequiredInputRepresentation(int index) { |
2904 return Representation::Tagged(); | 3045 return Representation::Tagged(); |
2905 } | 3046 } |
2906 | 3047 |
2907 virtual HType CalculateInferredType(); | 3048 virtual HType CalculateInferredType(); |
2908 | 3049 |
2909 virtual HValue* Canonicalize() { | 3050 virtual HValue* Canonicalize() { |
2910 HType value_type = value()->type(); | 3051 HType value_type = value()->type(); |
2911 if (value_type.IsSmi()) { | 3052 if (value_type.IsSmi()) { |
2912 return NULL; | 3053 return NULL; |
2913 } | 3054 } |
2914 return this; | 3055 return this; |
2915 } | 3056 } |
2916 | 3057 |
2917 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) | 3058 DECLARE_CONCRETE_INSTRUCTION(CheckSmi) |
2918 | 3059 |
2919 protected: | 3060 protected: |
2920 virtual bool DataEquals(HValue* other) { return true; } | 3061 virtual bool DataEquals(HValue* other) { return true; } |
3062 | |
3063 private: | |
3064 explicit HCheckSmi(HValue* value) : HUnaryOperation(value) { | |
3065 set_representation(Representation::Smi()); | |
3066 SetFlag(kUseGVN); | |
3067 } | |
2921 }; | 3068 }; |
2922 | 3069 |
2923 | 3070 |
2924 class HIsNumberAndBranch: public HUnaryControlInstruction { | 3071 class HIsNumberAndBranch: public HUnaryControlInstruction { |
2925 public: | 3072 public: |
2926 explicit HIsNumberAndBranch(HValue* value) | 3073 explicit HIsNumberAndBranch(HValue* value) |
2927 : HUnaryControlInstruction(value, NULL, NULL) { | 3074 : HUnaryControlInstruction(value, NULL, NULL) { |
2928 SetFlag(kFlexibleRepresentation); | 3075 SetFlag(kFlexibleRepresentation); |
2929 } | 3076 } |
2930 | 3077 |
2931 virtual Representation RequiredInputRepresentation(int index) { | 3078 virtual Representation RequiredInputRepresentation(int index) { |
2932 return Representation::None(); | 3079 return Representation::None(); |
2933 } | 3080 } |
2934 | 3081 |
2935 DECLARE_CONCRETE_INSTRUCTION(IsNumberAndBranch) | 3082 DECLARE_CONCRETE_INSTRUCTION(IsNumberAndBranch) |
2936 }; | 3083 }; |
2937 | 3084 |
2938 | 3085 |
2939 class HCheckHeapObject: public HUnaryOperation { | 3086 class HCheckHeapObject: public HUnaryOperation { |
2940 public: | 3087 public: |
2941 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { | 3088 DECLARE_INSTRUCTION_FACTORY_P1(HCheckHeapObject, HValue*); |
2942 set_representation(Representation::Tagged()); | |
2943 SetFlag(kUseGVN); | |
2944 } | |
2945 | 3089 |
2946 virtual Representation RequiredInputRepresentation(int index) { | 3090 virtual Representation RequiredInputRepresentation(int index) { |
2947 return Representation::Tagged(); | 3091 return Representation::Tagged(); |
2948 } | 3092 } |
2949 | 3093 |
2950 virtual HType CalculateInferredType(); | 3094 virtual HType CalculateInferredType(); |
2951 | 3095 |
2952 #ifdef DEBUG | 3096 #ifdef DEBUG |
2953 virtual void Verify(); | 3097 virtual void Verify(); |
2954 #endif | 3098 #endif |
2955 | 3099 |
2956 virtual HValue* Canonicalize() { | 3100 virtual HValue* Canonicalize() { |
2957 return value()->type().IsHeapObject() ? NULL : this; | 3101 return value()->type().IsHeapObject() ? NULL : this; |
2958 } | 3102 } |
2959 | 3103 |
2960 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) | 3104 DECLARE_CONCRETE_INSTRUCTION(CheckHeapObject) |
2961 | 3105 |
2962 protected: | 3106 protected: |
2963 virtual bool DataEquals(HValue* other) { return true; } | 3107 virtual bool DataEquals(HValue* other) { return true; } |
3108 | |
3109 private: | |
3110 explicit HCheckHeapObject(HValue* value) : HUnaryOperation(value) { | |
3111 set_representation(Representation::Tagged()); | |
3112 SetFlag(kUseGVN); | |
3113 } | |
2964 }; | 3114 }; |
2965 | 3115 |
2966 | 3116 |
2967 class HCheckPrototypeMaps: public HTemplateInstruction<0> { | 3117 class HCheckPrototypeMaps: public HTemplateInstruction<0> { |
2968 public: | 3118 public: |
2969 HCheckPrototypeMaps(Handle<JSObject> prototype, | 3119 static HCheckPrototypeMaps* New(Zone* zone, |
2970 Handle<JSObject> holder, | 3120 HValue* context, |
2971 Zone* zone, | 3121 Handle<JSObject> prototype, |
2972 CompilationInfo* info) | 3122 Handle<JSObject> holder, |
2973 : prototypes_(2, zone), | 3123 CompilationInfo* info) { |
2974 maps_(2, zone), | 3124 return new(zone) HCheckPrototypeMaps(prototype, holder, zone, info); |
2975 first_prototype_unique_id_(), | |
2976 last_prototype_unique_id_(), | |
2977 can_omit_prototype_maps_(true) { | |
2978 SetFlag(kUseGVN); | |
2979 SetGVNFlag(kDependsOnMaps); | |
2980 // Keep a list of all objects on the prototype chain up to the holder | |
2981 // and the expected maps. | |
2982 while (true) { | |
2983 prototypes_.Add(prototype, zone); | |
2984 Handle<Map> map(prototype->map()); | |
2985 maps_.Add(map, zone); | |
2986 can_omit_prototype_maps_ &= map->CanOmitPrototypeChecks(); | |
2987 if (prototype.is_identical_to(holder)) break; | |
2988 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); | |
2989 } | |
2990 if (can_omit_prototype_maps_) { | |
2991 // Mark in-flight compilation as dependent on those maps. | |
2992 for (int i = 0; i < maps()->length(); i++) { | |
2993 Handle<Map> map = maps()->at(i); | |
2994 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup, | |
2995 info); | |
2996 } | |
2997 } | |
2998 } | 3125 } |
2999 | 3126 |
3000 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; } | 3127 ZoneList<Handle<JSObject> >* prototypes() { return &prototypes_; } |
3001 | 3128 |
3002 ZoneList<Handle<Map> >* maps() { return &maps_; } | 3129 ZoneList<Handle<Map> >* maps() { return &maps_; } |
3003 | 3130 |
3004 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) | 3131 DECLARE_CONCRETE_INSTRUCTION(CheckPrototypeMaps) |
3005 | 3132 |
3006 virtual Representation RequiredInputRepresentation(int index) { | 3133 virtual Representation RequiredInputRepresentation(int index) { |
3007 return Representation::None(); | 3134 return Representation::None(); |
(...skipping 14 matching lines...) Expand all Loading... | |
3022 bool CanOmitPrototypeChecks() { return can_omit_prototype_maps_; } | 3149 bool CanOmitPrototypeChecks() { return can_omit_prototype_maps_; } |
3023 | 3150 |
3024 protected: | 3151 protected: |
3025 virtual bool DataEquals(HValue* other) { | 3152 virtual bool DataEquals(HValue* other) { |
3026 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); | 3153 HCheckPrototypeMaps* b = HCheckPrototypeMaps::cast(other); |
3027 return first_prototype_unique_id_ == b->first_prototype_unique_id_ && | 3154 return first_prototype_unique_id_ == b->first_prototype_unique_id_ && |
3028 last_prototype_unique_id_ == b->last_prototype_unique_id_; | 3155 last_prototype_unique_id_ == b->last_prototype_unique_id_; |
3029 } | 3156 } |
3030 | 3157 |
3031 private: | 3158 private: |
3159 HCheckPrototypeMaps(Handle<JSObject> prototype, | |
3160 Handle<JSObject> holder, | |
3161 Zone* zone, | |
3162 CompilationInfo* info) | |
3163 : prototypes_(2, zone), | |
3164 maps_(2, zone), | |
3165 first_prototype_unique_id_(), | |
3166 last_prototype_unique_id_(), | |
3167 can_omit_prototype_maps_(true) { | |
3168 SetFlag(kUseGVN); | |
3169 SetGVNFlag(kDependsOnMaps); | |
3170 // Keep a list of all objects on the prototype chain up to the holder | |
3171 // and the expected maps. | |
3172 while (true) { | |
3173 prototypes_.Add(prototype, zone); | |
3174 Handle<Map> map(prototype->map()); | |
3175 maps_.Add(map, zone); | |
3176 can_omit_prototype_maps_ &= map->CanOmitPrototypeChecks(); | |
3177 if (prototype.is_identical_to(holder)) break; | |
3178 prototype = Handle<JSObject>(JSObject::cast(prototype->GetPrototype())); | |
3179 } | |
3180 if (can_omit_prototype_maps_) { | |
3181 // Mark in-flight compilation as dependent on those maps. | |
3182 for (int i = 0; i < maps()->length(); i++) { | |
3183 Handle<Map> map = maps()->at(i); | |
3184 map->AddDependentCompilationInfo(DependentCode::kPrototypeCheckGroup, | |
3185 info); | |
3186 } | |
3187 } | |
3188 } | |
3189 | |
3032 ZoneList<Handle<JSObject> > prototypes_; | 3190 ZoneList<Handle<JSObject> > prototypes_; |
3033 ZoneList<Handle<Map> > maps_; | 3191 ZoneList<Handle<Map> > maps_; |
3034 UniqueValueId first_prototype_unique_id_; | 3192 UniqueValueId first_prototype_unique_id_; |
3035 UniqueValueId last_prototype_unique_id_; | 3193 UniqueValueId last_prototype_unique_id_; |
3036 bool can_omit_prototype_maps_; | 3194 bool can_omit_prototype_maps_; |
3037 }; | 3195 }; |
3038 | 3196 |
3039 | 3197 |
3040 class InductionVariableData; | 3198 class InductionVariableData; |
3041 | 3199 |
(...skipping 381 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3423 // the operand can change if a new idef of the phi is added between the phi | 3581 // the operand can change if a new idef of the phi is added between the phi |
3424 // and this instruction (inserting an idef updates every use). | 3582 // and this instruction (inserting an idef updates every use). |
3425 HPhi* phi_; | 3583 HPhi* phi_; |
3426 NumericRelation relation_; | 3584 NumericRelation relation_; |
3427 int operand_index_; | 3585 int operand_index_; |
3428 }; | 3586 }; |
3429 | 3587 |
3430 | 3588 |
3431 class HArgumentsObject: public HTemplateInstruction<0> { | 3589 class HArgumentsObject: public HTemplateInstruction<0> { |
3432 public: | 3590 public: |
3433 HArgumentsObject(int count, Zone* zone) : values_(count, zone) { | 3591 static HArgumentsObject* New(Zone* zone, |
3434 set_representation(Representation::Tagged()); | 3592 HValue* context, |
3435 SetFlag(kIsArguments); | 3593 int count) { |
3594 return new(zone) HArgumentsObject(count, zone); | |
3436 } | 3595 } |
3437 | 3596 |
3438 const ZoneList<HValue*>* arguments_values() const { return &values_; } | 3597 const ZoneList<HValue*>* arguments_values() const { return &values_; } |
3439 int arguments_count() const { return values_.length(); } | 3598 int arguments_count() const { return values_.length(); } |
3440 | 3599 |
3441 void AddArgument(HValue* argument, Zone* zone) { | 3600 void AddArgument(HValue* argument, Zone* zone) { |
3442 values_.Add(NULL, zone); // Resize list. | 3601 values_.Add(NULL, zone); // Resize list. |
3443 SetOperandAt(values_.length() - 1, argument); | 3602 SetOperandAt(values_.length() - 1, argument); |
3444 } | 3603 } |
3445 | 3604 |
3446 virtual int OperandCount() { return values_.length(); } | 3605 virtual int OperandCount() { return values_.length(); } |
3447 virtual HValue* OperandAt(int index) const { return values_[index]; } | 3606 virtual HValue* OperandAt(int index) const { return values_[index]; } |
3448 | 3607 |
3449 virtual bool HasEscapingOperandAt(int index) { return false; } | 3608 virtual bool HasEscapingOperandAt(int index) { return false; } |
3450 virtual Representation RequiredInputRepresentation(int index) { | 3609 virtual Representation RequiredInputRepresentation(int index) { |
3451 return Representation::None(); | 3610 return Representation::None(); |
3452 } | 3611 } |
3453 | 3612 |
3454 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) | 3613 DECLARE_CONCRETE_INSTRUCTION(ArgumentsObject) |
3455 | 3614 |
3456 protected: | 3615 protected: |
3457 virtual void InternalSetOperandAt(int index, HValue* value) { | 3616 virtual void InternalSetOperandAt(int index, HValue* value) { |
3458 values_[index] = value; | 3617 values_[index] = value; |
3459 } | 3618 } |
3460 | 3619 |
3461 private: | 3620 private: |
3621 HArgumentsObject(int count, Zone* zone) : values_(count, zone) { | |
3622 set_representation(Representation::Tagged()); | |
3623 SetFlag(kIsArguments); | |
3624 } | |
3625 | |
3462 virtual bool IsDeletable() const { return true; } | 3626 virtual bool IsDeletable() const { return true; } |
3463 | 3627 |
3464 ZoneList<HValue*> values_; | 3628 ZoneList<HValue*> values_; |
3465 }; | 3629 }; |
3466 | 3630 |
3467 | 3631 |
3468 class HConstant: public HTemplateInstruction<0> { | 3632 class HConstant: public HTemplateInstruction<0> { |
3469 public: | 3633 public: |
3470 HConstant(Handle<Object> handle, Representation r = Representation::None()); | 3634 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, int32_t); |
3471 HConstant(int32_t value, | 3635 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, double); |
3472 Representation r = Representation::None(), | 3636 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, Handle<Object>); |
3473 bool is_not_in_new_space = true, | 3637 DECLARE_INSTRUCTION_FACTORY_P1(HConstant, ExternalReference); |
3474 Handle<Object> optional_handle = Handle<Object>::null()); | |
3475 HConstant(double value, | |
3476 Representation r = Representation::None(), | |
3477 bool is_not_in_new_space = true, | |
3478 Handle<Object> optional_handle = Handle<Object>::null()); | |
3479 HConstant(Handle<Object> handle, | |
3480 UniqueValueId unique_id, | |
3481 Representation r, | |
3482 HType type, | |
3483 bool is_internalized_string, | |
3484 bool is_not_in_new_space, | |
3485 bool is_cell, | |
3486 bool boolean_value); | |
3487 explicit HConstant(ExternalReference reference); | |
3488 | 3638 |
3489 Handle<Object> handle() { | 3639 Handle<Object> handle() { |
3490 if (handle_.is_null()) { | 3640 if (handle_.is_null()) { |
3491 Factory* factory = Isolate::Current()->factory(); | 3641 Factory* factory = Isolate::Current()->factory(); |
3492 // Default arguments to is_not_in_new_space depend on this heap number | 3642 // Default arguments to is_not_in_new_space depend on this heap number |
3493 // to be tenured so that it's guaranteed not be be located in new space. | 3643 // to be tenured so that it's guaranteed not be be located in new space. |
3494 handle_ = factory->NewNumber(double_value_, TENURED); | 3644 handle_ = factory->NewNumber(double_value_, TENURED); |
3495 } | 3645 } |
3496 AllowDeferredHandleDereference smi_check; | 3646 AllowDeferredHandleDereference smi_check; |
3497 ASSERT(has_int32_value_ || !handle_->IsSmi()); | 3647 ASSERT(has_int32_value_ || !handle_->IsSmi()); |
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3658 external_reference_value_ == | 3808 external_reference_value_ == |
3659 other_constant->external_reference_value_; | 3809 other_constant->external_reference_value_; |
3660 } else { | 3810 } else { |
3661 ASSERT(!handle_.is_null()); | 3811 ASSERT(!handle_.is_null()); |
3662 return !other_constant->handle_.is_null() && | 3812 return !other_constant->handle_.is_null() && |
3663 unique_id_ == other_constant->unique_id_; | 3813 unique_id_ == other_constant->unique_id_; |
3664 } | 3814 } |
3665 } | 3815 } |
3666 | 3816 |
3667 private: | 3817 private: |
3818 friend class HGraph; | |
3819 HConstant(Handle<Object> handle, Representation r = Representation::None()); | |
3820 HConstant(int32_t value, | |
3821 Representation r = Representation::None(), | |
3822 bool is_not_in_new_space = true, | |
3823 Handle<Object> optional_handle = Handle<Object>::null()); | |
3824 HConstant(double value, | |
3825 Representation r = Representation::None(), | |
3826 bool is_not_in_new_space = true, | |
3827 Handle<Object> optional_handle = Handle<Object>::null()); | |
3828 HConstant(Handle<Object> handle, | |
3829 UniqueValueId unique_id, | |
3830 Representation r, | |
3831 HType type, | |
3832 bool is_internalized_string, | |
3833 bool is_not_in_new_space, | |
3834 bool is_cell, | |
3835 bool boolean_value); | |
3836 explicit HConstant(ExternalReference reference); | |
3837 | |
3668 void Initialize(Representation r); | 3838 void Initialize(Representation r); |
3669 | 3839 |
3670 virtual bool IsDeletable() const { return true; } | 3840 virtual bool IsDeletable() const { return true; } |
3671 | 3841 |
3672 // If this is a numerical constant, handle_ either points to to the | 3842 // If this is a numerical constant, handle_ either points to to the |
3673 // HeapObject the constant originated from or is null. If the | 3843 // HeapObject the constant originated from or is null. If the |
3674 // constant is non-numeric, handle_ always points to a valid | 3844 // constant is non-numeric, handle_ always points to a valid |
3675 // constant HeapObject. | 3845 // constant HeapObject. |
3676 Handle<Object> handle_; | 3846 Handle<Object> handle_; |
3677 UniqueValueId unique_id_; | 3847 UniqueValueId unique_id_; |
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3775 private: | 3945 private: |
3776 bool IgnoreObservedOutputRepresentation(Representation current_rep); | 3946 bool IgnoreObservedOutputRepresentation(Representation current_rep); |
3777 | 3947 |
3778 Representation observed_input_representation_[2]; | 3948 Representation observed_input_representation_[2]; |
3779 Representation observed_output_representation_; | 3949 Representation observed_output_representation_; |
3780 }; | 3950 }; |
3781 | 3951 |
3782 | 3952 |
3783 class HWrapReceiver: public HTemplateInstruction<2> { | 3953 class HWrapReceiver: public HTemplateInstruction<2> { |
3784 public: | 3954 public: |
3785 HWrapReceiver(HValue* receiver, HValue* function) { | 3955 DECLARE_INSTRUCTION_FACTORY_P2(HWrapReceiver, HValue*, HValue*); |
3786 set_representation(Representation::Tagged()); | |
3787 SetOperandAt(0, receiver); | |
3788 SetOperandAt(1, function); | |
3789 } | |
3790 | 3956 |
3791 virtual Representation RequiredInputRepresentation(int index) { | 3957 virtual Representation RequiredInputRepresentation(int index) { |
3792 return Representation::Tagged(); | 3958 return Representation::Tagged(); |
3793 } | 3959 } |
3794 | 3960 |
3795 HValue* receiver() { return OperandAt(0); } | 3961 HValue* receiver() { return OperandAt(0); } |
3796 HValue* function() { return OperandAt(1); } | 3962 HValue* function() { return OperandAt(1); } |
3797 | 3963 |
3798 virtual HValue* Canonicalize(); | 3964 virtual HValue* Canonicalize(); |
3799 | 3965 |
3800 virtual void PrintDataTo(StringStream* stream); | 3966 virtual void PrintDataTo(StringStream* stream); |
3801 | 3967 |
3802 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) | 3968 DECLARE_CONCRETE_INSTRUCTION(WrapReceiver) |
3969 | |
3970 private: | |
3971 HWrapReceiver(HValue* receiver, HValue* function) { | |
3972 set_representation(Representation::Tagged()); | |
3973 SetOperandAt(0, receiver); | |
3974 SetOperandAt(1, function); | |
3975 } | |
3803 }; | 3976 }; |
3804 | 3977 |
3805 | 3978 |
3806 class HApplyArguments: public HTemplateInstruction<4> { | 3979 class HApplyArguments: public HTemplateInstruction<4> { |
3807 public: | 3980 public: |
3808 HApplyArguments(HValue* function, | 3981 HApplyArguments(HValue* function, |
3809 HValue* receiver, | 3982 HValue* receiver, |
3810 HValue* length, | 3983 HValue* length, |
3811 HValue* elements) { | 3984 HValue* elements) { |
3812 set_representation(Representation::Tagged()); | 3985 set_representation(Representation::Tagged()); |
(...skipping 15 matching lines...) Expand all Loading... | |
3828 HValue* receiver() { return OperandAt(1); } | 4001 HValue* receiver() { return OperandAt(1); } |
3829 HValue* length() { return OperandAt(2); } | 4002 HValue* length() { return OperandAt(2); } |
3830 HValue* elements() { return OperandAt(3); } | 4003 HValue* elements() { return OperandAt(3); } |
3831 | 4004 |
3832 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) | 4005 DECLARE_CONCRETE_INSTRUCTION(ApplyArguments) |
3833 }; | 4006 }; |
3834 | 4007 |
3835 | 4008 |
3836 class HArgumentsElements: public HTemplateInstruction<0> { | 4009 class HArgumentsElements: public HTemplateInstruction<0> { |
3837 public: | 4010 public: |
3838 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { | 4011 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsElements, bool); |
3839 // The value produced by this instruction is a pointer into the stack | |
3840 // that looks as if it was a smi because of alignment. | |
3841 set_representation(Representation::Tagged()); | |
3842 SetFlag(kUseGVN); | |
3843 } | |
3844 | 4012 |
3845 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) | 4013 DECLARE_CONCRETE_INSTRUCTION(ArgumentsElements) |
3846 | 4014 |
3847 virtual Representation RequiredInputRepresentation(int index) { | 4015 virtual Representation RequiredInputRepresentation(int index) { |
3848 return Representation::None(); | 4016 return Representation::None(); |
3849 } | 4017 } |
3850 | 4018 |
3851 bool from_inlined() const { return from_inlined_; } | 4019 bool from_inlined() const { return from_inlined_; } |
3852 | 4020 |
3853 protected: | 4021 protected: |
3854 virtual bool DataEquals(HValue* other) { return true; } | 4022 virtual bool DataEquals(HValue* other) { return true; } |
3855 | 4023 |
3856 private: | 4024 private: |
4025 explicit HArgumentsElements(bool from_inlined) : from_inlined_(from_inlined) { | |
4026 // The value produced by this instruction is a pointer into the stack | |
4027 // that looks as if it was a smi because of alignment. | |
4028 set_representation(Representation::Tagged()); | |
4029 SetFlag(kUseGVN); | |
4030 } | |
4031 | |
3857 virtual bool IsDeletable() const { return true; } | 4032 virtual bool IsDeletable() const { return true; } |
3858 | 4033 |
3859 bool from_inlined_; | 4034 bool from_inlined_; |
3860 }; | 4035 }; |
3861 | 4036 |
3862 | 4037 |
3863 class HArgumentsLength: public HUnaryOperation { | 4038 class HArgumentsLength: public HUnaryOperation { |
3864 public: | 4039 public: |
3865 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | 4040 DECLARE_INSTRUCTION_FACTORY_P1(HArgumentsLength, HValue*); |
3866 set_representation(Representation::Integer32()); | |
3867 SetFlag(kUseGVN); | |
3868 } | |
3869 | 4041 |
3870 virtual Representation RequiredInputRepresentation(int index) { | 4042 virtual Representation RequiredInputRepresentation(int index) { |
3871 return Representation::Tagged(); | 4043 return Representation::Tagged(); |
3872 } | 4044 } |
3873 | 4045 |
3874 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) | 4046 DECLARE_CONCRETE_INSTRUCTION(ArgumentsLength) |
3875 | 4047 |
3876 protected: | 4048 protected: |
3877 virtual bool DataEquals(HValue* other) { return true; } | 4049 virtual bool DataEquals(HValue* other) { return true; } |
3878 | 4050 |
3879 private: | 4051 private: |
4052 explicit HArgumentsLength(HValue* value) : HUnaryOperation(value) { | |
4053 set_representation(Representation::Integer32()); | |
4054 SetFlag(kUseGVN); | |
4055 } | |
4056 | |
3880 virtual bool IsDeletable() const { return true; } | 4057 virtual bool IsDeletable() const { return true; } |
3881 }; | 4058 }; |
3882 | 4059 |
3883 | 4060 |
3884 class HAccessArgumentsAt: public HTemplateInstruction<3> { | 4061 class HAccessArgumentsAt: public HTemplateInstruction<3> { |
3885 public: | 4062 public: |
3886 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { | 4063 HAccessArgumentsAt(HValue* arguments, HValue* length, HValue* index) { |
3887 set_representation(Representation::Tagged()); | 4064 set_representation(Representation::Tagged()); |
3888 SetFlag(kUseGVN); | 4065 SetFlag(kUseGVN); |
3889 SetOperandAt(0, arguments); | 4066 SetOperandAt(0, arguments); |
(...skipping 18 matching lines...) Expand all Loading... | |
3908 | 4085 |
3909 virtual bool DataEquals(HValue* other) { return true; } | 4086 virtual bool DataEquals(HValue* other) { return true; } |
3910 }; | 4087 }; |
3911 | 4088 |
3912 | 4089 |
3913 class HBoundsCheckBaseIndexInformation; | 4090 class HBoundsCheckBaseIndexInformation; |
3914 | 4091 |
3915 | 4092 |
3916 class HBoundsCheck: public HTemplateInstruction<2> { | 4093 class HBoundsCheck: public HTemplateInstruction<2> { |
3917 public: | 4094 public: |
3918 // Normally HBoundsCheck should be created using the | 4095 DECLARE_INSTRUCTION_FACTORY_P2(HBoundsCheck, HValue*, HValue*); |
3919 // HGraphBuilder::AddBoundsCheck() helper. | |
3920 // However when building stubs, where we know that the arguments are Int32, | |
3921 // it makes sense to invoke this constructor directly. | |
3922 HBoundsCheck(HValue* index, HValue* length) | |
3923 : skip_check_(false), | |
3924 base_(NULL), offset_(0), scale_(0), | |
3925 responsibility_direction_(DIRECTION_NONE), | |
3926 allow_equality_(false) { | |
3927 SetOperandAt(0, index); | |
3928 SetOperandAt(1, length); | |
3929 SetFlag(kFlexibleRepresentation); | |
3930 SetFlag(kUseGVN); | |
3931 } | |
3932 | 4096 |
3933 bool skip_check() const { return skip_check_; } | 4097 bool skip_check() const { return skip_check_; } |
3934 void set_skip_check() { skip_check_ = true; } | 4098 void set_skip_check() { skip_check_ = true; } |
4099 | |
3935 HValue* base() { return base_; } | 4100 HValue* base() { return base_; } |
3936 int offset() { return offset_; } | 4101 int offset() { return offset_; } |
3937 int scale() { return scale_; } | 4102 int scale() { return scale_; } |
3938 bool index_can_increase() { | 4103 bool index_can_increase() { |
3939 return (responsibility_direction_ & DIRECTION_LOWER) == 0; | 4104 return (responsibility_direction_ & DIRECTION_LOWER) == 0; |
3940 } | 4105 } |
3941 bool index_can_decrease() { | 4106 bool index_can_decrease() { |
3942 return (responsibility_direction_ & DIRECTION_UPPER) == 0; | 4107 return (responsibility_direction_ & DIRECTION_UPPER) == 0; |
3943 } | 4108 } |
3944 | 4109 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
3994 virtual bool DataEquals(HValue* other) { return true; } | 4159 virtual bool DataEquals(HValue* other) { return true; } |
3995 virtual void TryGuaranteeRangeChanging(RangeEvaluationContext* context); | 4160 virtual void TryGuaranteeRangeChanging(RangeEvaluationContext* context); |
3996 bool skip_check_; | 4161 bool skip_check_; |
3997 HValue* base_; | 4162 HValue* base_; |
3998 int offset_; | 4163 int offset_; |
3999 int scale_; | 4164 int scale_; |
4000 RangeGuaranteeDirection responsibility_direction_; | 4165 RangeGuaranteeDirection responsibility_direction_; |
4001 bool allow_equality_; | 4166 bool allow_equality_; |
4002 | 4167 |
4003 private: | 4168 private: |
4169 // Normally HBoundsCheck should be created using the | |
4170 // HGraphBuilder::AddBoundsCheck() helper. | |
4171 // However when building stubs, where we know that the arguments are Int32, | |
4172 // it makes sense to invoke this constructor directly. | |
4173 HBoundsCheck(HValue* index, HValue* length) | |
4174 : skip_check_(false), | |
4175 base_(NULL), offset_(0), scale_(0), | |
4176 responsibility_direction_(DIRECTION_NONE), | |
4177 allow_equality_(false) { | |
4178 SetOperandAt(0, index); | |
4179 SetOperandAt(1, length); | |
4180 SetFlag(kFlexibleRepresentation); | |
4181 SetFlag(kUseGVN); | |
4182 } | |
4183 | |
4004 virtual bool IsDeletable() const { | 4184 virtual bool IsDeletable() const { |
4005 return skip_check() && !FLAG_debug_code; | 4185 return skip_check() && !FLAG_debug_code; |
4006 } | 4186 } |
4007 }; | 4187 }; |
4008 | 4188 |
4009 | 4189 |
4010 class HBoundsCheckBaseIndexInformation: public HTemplateInstruction<2> { | 4190 class HBoundsCheckBaseIndexInformation: public HTemplateInstruction<2> { |
4011 public: | 4191 public: |
4012 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { | 4192 explicit HBoundsCheckBaseIndexInformation(HBoundsCheck* check) { |
4013 DecompositionResult decomposition; | 4193 DecompositionResult decomposition; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4091 | 4271 |
4092 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) | 4272 DECLARE_ABSTRACT_INSTRUCTION(BitwiseBinaryOperation) |
4093 | 4273 |
4094 private: | 4274 private: |
4095 virtual bool IsDeletable() const { return true; } | 4275 virtual bool IsDeletable() const { return true; } |
4096 }; | 4276 }; |
4097 | 4277 |
4098 | 4278 |
4099 class HMathFloorOfDiv: public HBinaryOperation { | 4279 class HMathFloorOfDiv: public HBinaryOperation { |
4100 public: | 4280 public: |
4101 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | 4281 static HMathFloorOfDiv* New(Zone* zone, |
4102 : HBinaryOperation(context, left, right) { | 4282 HValue* context, |
4103 set_representation(Representation::Integer32()); | 4283 HValue* left, |
4104 SetFlag(kUseGVN); | 4284 HValue* right) { |
4105 SetFlag(kCanOverflow); | 4285 return new(zone) HMathFloorOfDiv(context, left, right); |
4106 if (!right->IsConstant()) { | |
4107 SetFlag(kCanBeDivByZero); | |
4108 } | |
4109 SetFlag(kAllowUndefinedAsNaN); | |
4110 } | 4286 } |
4111 | 4287 |
4112 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); | 4288 virtual HValue* EnsureAndPropagateNotMinusZero(BitVector* visited); |
4113 | 4289 |
4114 virtual Representation RequiredInputRepresentation(int index) { | 4290 virtual Representation RequiredInputRepresentation(int index) { |
4115 return Representation::Integer32(); | 4291 return Representation::Integer32(); |
4116 } | 4292 } |
4117 | 4293 |
4118 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) | 4294 DECLARE_CONCRETE_INSTRUCTION(MathFloorOfDiv) |
4119 | 4295 |
4120 protected: | 4296 protected: |
4121 virtual bool DataEquals(HValue* other) { return true; } | 4297 virtual bool DataEquals(HValue* other) { return true; } |
4122 | 4298 |
4123 private: | 4299 private: |
4300 HMathFloorOfDiv(HValue* context, HValue* left, HValue* right) | |
4301 : HBinaryOperation(context, left, right) { | |
4302 set_representation(Representation::Integer32()); | |
4303 SetFlag(kUseGVN); | |
4304 SetFlag(kCanOverflow); | |
4305 if (!right->IsConstant()) { | |
4306 SetFlag(kCanBeDivByZero); | |
4307 } | |
4308 SetFlag(kAllowUndefinedAsNaN); | |
4309 } | |
4310 | |
4124 virtual bool IsDeletable() const { return true; } | 4311 virtual bool IsDeletable() const { return true; } |
4125 }; | 4312 }; |
4126 | 4313 |
4127 | 4314 |
4128 class HArithmeticBinaryOperation: public HBinaryOperation { | 4315 class HArithmeticBinaryOperation: public HBinaryOperation { |
4129 public: | 4316 public: |
4130 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) | 4317 HArithmeticBinaryOperation(HValue* context, HValue* left, HValue* right) |
4131 : HBinaryOperation(context, left, right) { | 4318 : HBinaryOperation(context, left, right) { |
4132 SetAllSideEffects(); | 4319 SetAllSideEffects(); |
4133 SetFlag(kFlexibleRepresentation); | 4320 SetFlag(kFlexibleRepresentation); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4218 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) | 4405 DECLARE_CONCRETE_INSTRUCTION(CompareNumericAndBranch) |
4219 | 4406 |
4220 private: | 4407 private: |
4221 Representation observed_input_representation_[2]; | 4408 Representation observed_input_representation_[2]; |
4222 Token::Value token_; | 4409 Token::Value token_; |
4223 }; | 4410 }; |
4224 | 4411 |
4225 | 4412 |
4226 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { | 4413 class HCompareObjectEqAndBranch: public HTemplateControlInstruction<2, 2> { |
4227 public: | 4414 public: |
4228 HCompareObjectEqAndBranch(HValue* left, HValue* right) { | 4415 // TODO(danno): make this private when the IfBuilder properly constructs |
4416 // control flow instructions.lithium | |
Toon Verwaest
2013/07/31 12:56:37
Left-over "lithium" at the end of the sentence.
danno
2013/07/31 14:10:09
Done.
| |
4417 HCompareObjectEqAndBranch(HValue* left, | |
4418 HValue* right) { | |
4229 SetOperandAt(0, left); | 4419 SetOperandAt(0, left); |
4230 SetOperandAt(1, right); | 4420 SetOperandAt(1, right); |
4231 } | 4421 } |
4232 | 4422 |
4423 DECLARE_INSTRUCTION_FACTORY_P2(HCompareObjectEqAndBranch, HValue*, HValue*); | |
4424 | |
4233 HValue* left() { return OperandAt(0); } | 4425 HValue* left() { return OperandAt(0); } |
4234 HValue* right() { return OperandAt(1); } | 4426 HValue* right() { return OperandAt(1); } |
4235 | 4427 |
4236 virtual void PrintDataTo(StringStream* stream); | 4428 virtual void PrintDataTo(StringStream* stream); |
4237 | 4429 |
4238 virtual Representation RequiredInputRepresentation(int index) { | 4430 virtual Representation RequiredInputRepresentation(int index) { |
4239 return Representation::Tagged(); | 4431 return Representation::Tagged(); |
4240 } | 4432 } |
4241 | 4433 |
4242 virtual Representation observed_input_representation(int index) { | 4434 virtual Representation observed_input_representation(int index) { |
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4512 virtual Representation RequiredInputRepresentation(int index) { | 4704 virtual Representation RequiredInputRepresentation(int index) { |
4513 return Representation::Tagged(); | 4705 return Representation::Tagged(); |
4514 } | 4706 } |
4515 | 4707 |
4516 DECLARE_CONCRETE_INSTRUCTION(InstanceSize) | 4708 DECLARE_CONCRETE_INSTRUCTION(InstanceSize) |
4517 }; | 4709 }; |
4518 | 4710 |
4519 | 4711 |
4520 class HPower: public HTemplateInstruction<2> { | 4712 class HPower: public HTemplateInstruction<2> { |
4521 public: | 4713 public: |
4522 static HInstruction* New(Zone* zone, HValue* left, HValue* right); | 4714 static HInstruction* New(Zone* zone, |
4715 HValue* context, | |
4716 HValue* left, | |
4717 HValue* right); | |
4523 | 4718 |
4524 HValue* left() { return OperandAt(0); } | 4719 HValue* left() { return OperandAt(0); } |
4525 HValue* right() const { return OperandAt(1); } | 4720 HValue* right() const { return OperandAt(1); } |
4526 | 4721 |
4527 virtual Representation RequiredInputRepresentation(int index) { | 4722 virtual Representation RequiredInputRepresentation(int index) { |
4528 return index == 0 | 4723 return index == 0 |
4529 ? Representation::Double() | 4724 ? Representation::Double() |
4530 : Representation::None(); | 4725 : Representation::None(); |
4531 } | 4726 } |
4532 virtual Representation observed_input_representation(int index) { | 4727 virtual Representation observed_input_representation(int index) { |
(...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4849 : HArithmeticBinaryOperation(context, left, right), | 5044 : HArithmeticBinaryOperation(context, left, right), |
4850 operation_(op) { } | 5045 operation_(op) { } |
4851 | 5046 |
4852 Operation operation_; | 5047 Operation operation_; |
4853 }; | 5048 }; |
4854 | 5049 |
4855 | 5050 |
4856 class HBitwise: public HBitwiseBinaryOperation { | 5051 class HBitwise: public HBitwiseBinaryOperation { |
4857 public: | 5052 public: |
4858 static HInstruction* New(Zone* zone, | 5053 static HInstruction* New(Zone* zone, |
5054 HValue* context, | |
4859 Token::Value op, | 5055 Token::Value op, |
4860 HValue* context, | |
4861 HValue* left, | 5056 HValue* left, |
4862 HValue* right); | 5057 HValue* right); |
4863 | 5058 |
4864 Token::Value op() const { return op_; } | 5059 Token::Value op() const { return op_; } |
4865 | 5060 |
4866 virtual bool IsCommutative() const { return true; } | 5061 virtual bool IsCommutative() const { return true; } |
4867 | 5062 |
4868 virtual HValue* Canonicalize(); | 5063 virtual HValue* Canonicalize(); |
4869 | 5064 |
4870 virtual void PrintDataTo(StringStream* stream); | 5065 virtual void PrintDataTo(StringStream* stream); |
4871 | 5066 |
4872 DECLARE_CONCRETE_INSTRUCTION(Bitwise) | 5067 DECLARE_CONCRETE_INSTRUCTION(Bitwise) |
4873 | 5068 |
4874 protected: | 5069 protected: |
4875 virtual bool DataEquals(HValue* other) { | 5070 virtual bool DataEquals(HValue* other) { |
4876 return op() == HBitwise::cast(other)->op(); | 5071 return op() == HBitwise::cast(other)->op(); |
4877 } | 5072 } |
4878 | 5073 |
4879 virtual Range* InferRange(Zone* zone); | 5074 virtual Range* InferRange(Zone* zone); |
4880 | 5075 |
4881 private: | 5076 private: |
4882 HBitwise(Token::Value op, HValue* context, HValue* left, HValue* right) | 5077 HBitwise(HValue* context, Token::Value op, HValue* left, HValue* right) |
4883 : HBitwiseBinaryOperation(context, left, right), op_(op) { | 5078 : HBitwiseBinaryOperation(context, left, right), op_(op) { |
4884 ASSERT(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); | 5079 ASSERT(op == Token::BIT_AND || op == Token::BIT_OR || op == Token::BIT_XOR); |
4885 // BIT_AND with a smi-range positive value will always unset the | 5080 // BIT_AND with a smi-range positive value will always unset the |
4886 // entire sign-extension of the smi-sign. | 5081 // entire sign-extension of the smi-sign. |
4887 if (op == Token::BIT_AND && | 5082 if (op == Token::BIT_AND && |
4888 ((left->IsConstant() && | 5083 ((left->IsConstant() && |
4889 left->representation().IsSmi() && | 5084 left->representation().IsSmi() && |
4890 HConstant::cast(left)->Integer32Value() >= 0) || | 5085 HConstant::cast(left)->Integer32Value() >= 0) || |
4891 (right->IsConstant() && | 5086 (right->IsConstant() && |
4892 right->representation().IsSmi() && | 5087 right->representation().IsSmi() && |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5034 | 5229 |
5035 DECLARE_CONCRETE_INSTRUCTION(Ror) | 5230 DECLARE_CONCRETE_INSTRUCTION(Ror) |
5036 | 5231 |
5037 protected: | 5232 protected: |
5038 virtual bool DataEquals(HValue* other) { return true; } | 5233 virtual bool DataEquals(HValue* other) { return true; } |
5039 }; | 5234 }; |
5040 | 5235 |
5041 | 5236 |
5042 class HOsrEntry: public HTemplateInstruction<0> { | 5237 class HOsrEntry: public HTemplateInstruction<0> { |
5043 public: | 5238 public: |
5044 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { | 5239 DECLARE_INSTRUCTION_FACTORY_P1(HOsrEntry, BailoutId); |
5045 SetGVNFlag(kChangesOsrEntries); | |
5046 SetGVNFlag(kChangesNewSpacePromotion); | |
5047 } | |
5048 | 5240 |
5049 BailoutId ast_id() const { return ast_id_; } | 5241 BailoutId ast_id() const { return ast_id_; } |
5050 | 5242 |
5051 virtual Representation RequiredInputRepresentation(int index) { | 5243 virtual Representation RequiredInputRepresentation(int index) { |
5052 return Representation::None(); | 5244 return Representation::None(); |
5053 } | 5245 } |
5054 | 5246 |
5055 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) | 5247 DECLARE_CONCRETE_INSTRUCTION(OsrEntry) |
5056 | 5248 |
5057 private: | 5249 private: |
5250 explicit HOsrEntry(BailoutId ast_id) : ast_id_(ast_id) { | |
5251 SetGVNFlag(kChangesOsrEntries); | |
5252 SetGVNFlag(kChangesNewSpacePromotion); | |
5253 } | |
5254 | |
5058 BailoutId ast_id_; | 5255 BailoutId ast_id_; |
5059 }; | 5256 }; |
5060 | 5257 |
5061 | 5258 |
5062 class HParameter: public HTemplateInstruction<0> { | 5259 class HParameter: public HTemplateInstruction<0> { |
5063 public: | 5260 public: |
5064 enum ParameterKind { | 5261 enum ParameterKind { |
5065 STACK_PARAMETER, | 5262 STACK_PARAMETER, |
5066 REGISTER_PARAMETER | 5263 REGISTER_PARAMETER |
5067 }; | 5264 }; |
5068 | 5265 |
5266 DECLARE_INSTRUCTION_FACTORY_P1(HParameter, unsigned); | |
5267 DECLARE_INSTRUCTION_FACTORY_P2(HParameter, unsigned, ParameterKind); | |
5268 DECLARE_INSTRUCTION_FACTORY_P3(HParameter, unsigned, ParameterKind, | |
5269 Representation); | |
5270 | |
5271 unsigned index() const { return index_; } | |
5272 ParameterKind kind() const { return kind_; } | |
5273 | |
5274 virtual void PrintDataTo(StringStream* stream); | |
5275 | |
5276 virtual Representation RequiredInputRepresentation(int index) { | |
5277 return Representation::None(); | |
5278 } | |
5279 | |
5280 DECLARE_CONCRETE_INSTRUCTION(Parameter) | |
5281 | |
5282 private: | |
5069 explicit HParameter(unsigned index, | 5283 explicit HParameter(unsigned index, |
5070 ParameterKind kind = STACK_PARAMETER) | 5284 ParameterKind kind = STACK_PARAMETER) |
5071 : index_(index), | 5285 : index_(index), |
5072 kind_(kind) { | 5286 kind_(kind) { |
5073 set_representation(Representation::Tagged()); | 5287 set_representation(Representation::Tagged()); |
5074 } | 5288 } |
5075 | 5289 |
5076 explicit HParameter(unsigned index, | 5290 explicit HParameter(unsigned index, |
5077 ParameterKind kind, | 5291 ParameterKind kind, |
5078 Representation r) | 5292 Representation r) |
5079 : index_(index), | 5293 : index_(index), |
5080 kind_(kind) { | 5294 kind_(kind) { |
5081 set_representation(r); | 5295 set_representation(r); |
5082 } | 5296 } |
5083 | 5297 |
5084 unsigned index() const { return index_; } | |
5085 ParameterKind kind() const { return kind_; } | |
5086 | |
5087 virtual void PrintDataTo(StringStream* stream); | |
5088 | |
5089 virtual Representation RequiredInputRepresentation(int index) { | |
5090 return Representation::None(); | |
5091 } | |
5092 | |
5093 DECLARE_CONCRETE_INSTRUCTION(Parameter) | |
5094 | |
5095 private: | |
5096 unsigned index_; | 5298 unsigned index_; |
5097 ParameterKind kind_; | 5299 ParameterKind kind_; |
5098 }; | 5300 }; |
5099 | 5301 |
5100 | 5302 |
5101 class HCallStub: public HUnaryCall { | 5303 class HCallStub: public HUnaryCall { |
5102 public: | 5304 public: |
5103 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) | 5305 HCallStub(HValue* context, CodeStub::Major major_key, int argument_count) |
5104 : HUnaryCall(context, argument_count), | 5306 : HUnaryCall(context, argument_count), |
5105 major_key_(major_key), | 5307 major_key_(major_key), |
(...skipping 20 matching lines...) Expand all Loading... | |
5126 DECLARE_CONCRETE_INSTRUCTION(CallStub) | 5328 DECLARE_CONCRETE_INSTRUCTION(CallStub) |
5127 | 5329 |
5128 private: | 5330 private: |
5129 CodeStub::Major major_key_; | 5331 CodeStub::Major major_key_; |
5130 TranscendentalCache::Type transcendental_type_; | 5332 TranscendentalCache::Type transcendental_type_; |
5131 }; | 5333 }; |
5132 | 5334 |
5133 | 5335 |
5134 class HUnknownOSRValue: public HTemplateInstruction<0> { | 5336 class HUnknownOSRValue: public HTemplateInstruction<0> { |
5135 public: | 5337 public: |
5136 HUnknownOSRValue() | 5338 DECLARE_INSTRUCTION_FACTORY_P0(HUnknownOSRValue) |
5137 : incoming_value_(NULL) { | |
5138 set_representation(Representation::Tagged()); | |
5139 } | |
5140 | 5339 |
5141 virtual Representation RequiredInputRepresentation(int index) { | 5340 virtual Representation RequiredInputRepresentation(int index) { |
5142 return Representation::None(); | 5341 return Representation::None(); |
5143 } | 5342 } |
5144 | 5343 |
5145 void set_incoming_value(HPhi* value) { | 5344 void set_incoming_value(HPhi* value) { |
5146 incoming_value_ = value; | 5345 incoming_value_ = value; |
5147 } | 5346 } |
5148 | 5347 |
5149 HPhi* incoming_value() { | 5348 HPhi* incoming_value() { |
5150 return incoming_value_; | 5349 return incoming_value_; |
5151 } | 5350 } |
5152 | 5351 |
5153 virtual Representation KnownOptimalRepresentation() { | 5352 virtual Representation KnownOptimalRepresentation() { |
5154 if (incoming_value_ == NULL) return Representation::None(); | 5353 if (incoming_value_ == NULL) return Representation::None(); |
5155 return incoming_value_->KnownOptimalRepresentation(); | 5354 return incoming_value_->KnownOptimalRepresentation(); |
5156 } | 5355 } |
5157 | 5356 |
5158 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) | 5357 DECLARE_CONCRETE_INSTRUCTION(UnknownOSRValue) |
5159 | 5358 |
5160 private: | 5359 private: |
5360 HUnknownOSRValue() | |
5361 : incoming_value_(NULL) { | |
5362 set_representation(Representation::Tagged()); | |
5363 } | |
5364 | |
5161 HPhi* incoming_value_; | 5365 HPhi* incoming_value_; |
5162 }; | 5366 }; |
5163 | 5367 |
5164 | 5368 |
5165 class HLoadGlobalCell: public HTemplateInstruction<0> { | 5369 class HLoadGlobalCell: public HTemplateInstruction<0> { |
5166 public: | 5370 public: |
5167 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) | 5371 HLoadGlobalCell(Handle<Cell> cell, PropertyDetails details) |
5168 : cell_(cell), details_(details), unique_id_() { | 5372 : cell_(cell), details_(details), unique_id_() { |
5169 set_representation(Representation::Tagged()); | 5373 set_representation(Representation::Tagged()); |
5170 SetFlag(kUseGVN); | 5374 SetFlag(kUseGVN); |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5241 class HAllocate: public HTemplateInstruction<2> { | 5445 class HAllocate: public HTemplateInstruction<2> { |
5242 public: | 5446 public: |
5243 enum Flags { | 5447 enum Flags { |
5244 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0, | 5448 CAN_ALLOCATE_IN_NEW_SPACE = 1 << 0, |
5245 CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, | 5449 CAN_ALLOCATE_IN_OLD_DATA_SPACE = 1 << 1, |
5246 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, | 5450 CAN_ALLOCATE_IN_OLD_POINTER_SPACE = 1 << 2, |
5247 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, | 5451 ALLOCATE_DOUBLE_ALIGNED = 1 << 3, |
5248 PREFILL_WITH_FILLER = 1 << 4 | 5452 PREFILL_WITH_FILLER = 1 << 4 |
5249 }; | 5453 }; |
5250 | 5454 |
5251 HAllocate(HValue* context, HValue* size, HType type, Flags flags) | 5455 static HAllocate* New(Zone* zone, |
5252 : flags_(flags) { | 5456 HValue* context, |
5253 SetOperandAt(0, context); | 5457 HValue* size, |
5254 SetOperandAt(1, size); | 5458 HType type, |
5255 set_type(type); | 5459 Flags flags) { |
5256 set_representation(Representation::Tagged()); | 5460 return new(zone) HAllocate(context, size, type, flags); |
5257 SetFlag(kTrackSideEffectDominators); | |
5258 SetGVNFlag(kChangesNewSpacePromotion); | |
5259 SetGVNFlag(kDependsOnNewSpacePromotion); | |
5260 } | 5461 } |
5261 | 5462 |
5262 // Maximum instance size for which allocations will be inlined. | 5463 // Maximum instance size for which allocations will be inlined. |
5263 static const int kMaxInlineSize = 64 * kPointerSize; | 5464 static const int kMaxInlineSize = 64 * kPointerSize; |
5264 | 5465 |
5265 static Flags DefaultFlags() { | 5466 static Flags DefaultFlags() { |
5266 return CAN_ALLOCATE_IN_NEW_SPACE; | 5467 return CAN_ALLOCATE_IN_NEW_SPACE; |
5267 } | 5468 } |
5268 | 5469 |
5269 static Flags DefaultFlags(ElementsKind kind) { | 5470 static Flags DefaultFlags(ElementsKind kind) { |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5332 } | 5533 } |
5333 | 5534 |
5334 virtual void HandleSideEffectDominator(GVNFlag side_effect, | 5535 virtual void HandleSideEffectDominator(GVNFlag side_effect, |
5335 HValue* dominator); | 5536 HValue* dominator); |
5336 | 5537 |
5337 virtual void PrintDataTo(StringStream* stream); | 5538 virtual void PrintDataTo(StringStream* stream); |
5338 | 5539 |
5339 DECLARE_CONCRETE_INSTRUCTION(Allocate) | 5540 DECLARE_CONCRETE_INSTRUCTION(Allocate) |
5340 | 5541 |
5341 private: | 5542 private: |
5543 HAllocate(HValue* context, HValue* size, HType type, Flags flags) | |
5544 : flags_(flags) { | |
5545 SetOperandAt(0, context); | |
5546 SetOperandAt(1, size); | |
5547 set_type(type); | |
5548 set_representation(Representation::Tagged()); | |
5549 SetFlag(kTrackSideEffectDominators); | |
5550 SetGVNFlag(kChangesNewSpacePromotion); | |
5551 SetGVNFlag(kDependsOnNewSpacePromotion); | |
5552 } | |
5553 | |
5342 Flags flags_; | 5554 Flags flags_; |
5343 Handle<Map> known_initial_map_; | 5555 Handle<Map> known_initial_map_; |
5344 }; | 5556 }; |
5345 | 5557 |
5346 | 5558 |
5347 class HInnerAllocatedObject: public HTemplateInstruction<1> { | 5559 class HInnerAllocatedObject: public HTemplateInstruction<1> { |
5348 public: | 5560 public: |
5349 HInnerAllocatedObject(HValue* value, int offset, HType type = HType::Tagged()) | 5561 static HInnerAllocatedObject* New(Zone* zone, |
5350 : offset_(offset) { | 5562 HValue* context, |
5351 ASSERT(value->IsAllocate()); | 5563 HValue* value, |
5352 SetOperandAt(0, value); | 5564 int offset, |
5353 set_type(type); | 5565 HType type = HType::Tagged()) { |
5354 set_representation(Representation::Tagged()); | 5566 return new(zone) HInnerAllocatedObject(value, offset, type); |
5355 } | 5567 } |
5356 | 5568 |
5357 HValue* base_object() { return OperandAt(0); } | 5569 HValue* base_object() { return OperandAt(0); } |
5358 int offset() { return offset_; } | 5570 int offset() { return offset_; } |
5359 | 5571 |
5360 virtual Representation RequiredInputRepresentation(int index) { | 5572 virtual Representation RequiredInputRepresentation(int index) { |
5361 return Representation::Tagged(); | 5573 return Representation::Tagged(); |
5362 } | 5574 } |
5363 | 5575 |
5364 virtual void PrintDataTo(StringStream* stream); | 5576 virtual void PrintDataTo(StringStream* stream); |
5365 | 5577 |
5366 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) | 5578 DECLARE_CONCRETE_INSTRUCTION(InnerAllocatedObject) |
5367 | 5579 |
5368 private: | 5580 private: |
5581 HInnerAllocatedObject(HValue* value, int offset, HType type = HType::Tagged()) | |
5582 : offset_(offset) { | |
5583 ASSERT(value->IsAllocate()); | |
5584 SetOperandAt(0, value); | |
5585 set_type(type); | |
5586 set_representation(Representation::Tagged()); | |
5587 } | |
5588 | |
5369 int offset_; | 5589 int offset_; |
5370 }; | 5590 }; |
5371 | 5591 |
5372 | 5592 |
5373 inline bool StoringValueNeedsWriteBarrier(HValue* value) { | 5593 inline bool StoringValueNeedsWriteBarrier(HValue* value) { |
5374 return !value->type().IsBoolean() | 5594 return !value->type().IsBoolean() |
5375 && !value->type().IsSmi() | 5595 && !value->type().IsSmi() |
5376 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); | 5596 && !(value->IsConstant() && HConstant::cast(value)->ImmortalImmovable()); |
5377 } | 5597 } |
5378 | 5598 |
(...skipping 11 matching lines...) Expand all Loading... | |
5390 if (object != new_space_dominator) return true; | 5610 if (object != new_space_dominator) return true; |
5391 if (object->IsAllocate()) { | 5611 if (object->IsAllocate()) { |
5392 return !HAllocate::cast(object)->GuaranteedInNewSpace(); | 5612 return !HAllocate::cast(object)->GuaranteedInNewSpace(); |
5393 } | 5613 } |
5394 return true; | 5614 return true; |
5395 } | 5615 } |
5396 | 5616 |
5397 | 5617 |
5398 class HStoreGlobalCell: public HUnaryOperation { | 5618 class HStoreGlobalCell: public HUnaryOperation { |
5399 public: | 5619 public: |
5400 HStoreGlobalCell(HValue* value, | 5620 DECLARE_INSTRUCTION_FACTORY_P3(HStoreGlobalCell, HValue*, |
5401 Handle<PropertyCell> cell, | 5621 Handle<PropertyCell>, PropertyDetails); |
5402 PropertyDetails details) | |
5403 : HUnaryOperation(value), | |
5404 cell_(cell), | |
5405 details_(details) { | |
5406 SetGVNFlag(kChangesGlobalVars); | |
5407 } | |
5408 | 5622 |
5409 Handle<PropertyCell> cell() const { return cell_; } | 5623 Handle<PropertyCell> cell() const { return cell_; } |
5410 bool RequiresHoleCheck() { | 5624 bool RequiresHoleCheck() { |
5411 return !details_.IsDontDelete() || details_.IsReadOnly(); | 5625 return !details_.IsDontDelete() || details_.IsReadOnly(); |
5412 } | 5626 } |
5413 bool NeedsWriteBarrier() { | 5627 bool NeedsWriteBarrier() { |
5414 return StoringValueNeedsWriteBarrier(value()); | 5628 return StoringValueNeedsWriteBarrier(value()); |
5415 } | 5629 } |
5416 | 5630 |
5417 virtual Representation RequiredInputRepresentation(int index) { | 5631 virtual Representation RequiredInputRepresentation(int index) { |
5418 return Representation::Tagged(); | 5632 return Representation::Tagged(); |
5419 } | 5633 } |
5420 virtual void PrintDataTo(StringStream* stream); | 5634 virtual void PrintDataTo(StringStream* stream); |
5421 | 5635 |
5422 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) | 5636 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalCell) |
5423 | 5637 |
5424 private: | 5638 private: |
5639 HStoreGlobalCell(HValue* value, | |
5640 Handle<PropertyCell> cell, | |
5641 PropertyDetails details) | |
5642 : HUnaryOperation(value), | |
5643 cell_(cell), | |
5644 details_(details) { | |
5645 SetGVNFlag(kChangesGlobalVars); | |
5646 } | |
5647 | |
5425 Handle<PropertyCell> cell_; | 5648 Handle<PropertyCell> cell_; |
5426 PropertyDetails details_; | 5649 PropertyDetails details_; |
5427 }; | 5650 }; |
5428 | 5651 |
5429 | 5652 |
5430 class HStoreGlobalGeneric: public HTemplateInstruction<3> { | 5653 class HStoreGlobalGeneric: public HTemplateInstruction<3> { |
5431 public: | 5654 public: |
5432 HStoreGlobalGeneric(HValue* context, | 5655 inline static HStoreGlobalGeneric* New(Zone* zone, |
5433 HValue* global_object, | 5656 HValue* context, |
5434 Handle<Object> name, | 5657 HValue* global_object, |
5435 HValue* value, | 5658 Handle<Object> name, |
5436 StrictModeFlag strict_mode_flag) | 5659 HValue* value, |
5437 : name_(name), | 5660 StrictModeFlag strict_mode_flag) { |
5438 strict_mode_flag_(strict_mode_flag) { | 5661 return new(zone) HStoreGlobalGeneric(context, global_object, |
5439 SetOperandAt(0, context); | 5662 name, value, strict_mode_flag); |
5440 SetOperandAt(1, global_object); | |
5441 SetOperandAt(2, value); | |
5442 set_representation(Representation::Tagged()); | |
5443 SetAllSideEffects(); | |
5444 } | 5663 } |
5445 | 5664 |
5446 HValue* context() { return OperandAt(0); } | 5665 HValue* context() { return OperandAt(0); } |
5447 HValue* global_object() { return OperandAt(1); } | 5666 HValue* global_object() { return OperandAt(1); } |
5448 Handle<Object> name() const { return name_; } | 5667 Handle<Object> name() const { return name_; } |
5449 HValue* value() { return OperandAt(2); } | 5668 HValue* value() { return OperandAt(2); } |
5450 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } | 5669 StrictModeFlag strict_mode_flag() { return strict_mode_flag_; } |
5451 | 5670 |
5452 virtual void PrintDataTo(StringStream* stream); | 5671 virtual void PrintDataTo(StringStream* stream); |
5453 | 5672 |
5454 virtual Representation RequiredInputRepresentation(int index) { | 5673 virtual Representation RequiredInputRepresentation(int index) { |
5455 return Representation::Tagged(); | 5674 return Representation::Tagged(); |
5456 } | 5675 } |
5457 | 5676 |
5458 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) | 5677 DECLARE_CONCRETE_INSTRUCTION(StoreGlobalGeneric) |
5459 | 5678 |
5460 private: | 5679 private: |
5680 HStoreGlobalGeneric(HValue* context, | |
5681 HValue* global_object, | |
5682 Handle<Object> name, | |
5683 HValue* value, | |
5684 StrictModeFlag strict_mode_flag) | |
5685 : name_(name), | |
5686 strict_mode_flag_(strict_mode_flag) { | |
5687 SetOperandAt(0, context); | |
5688 SetOperandAt(1, global_object); | |
5689 SetOperandAt(2, value); | |
5690 set_representation(Representation::Tagged()); | |
5691 SetAllSideEffects(); | |
5692 } | |
5693 | |
5461 Handle<Object> name_; | 5694 Handle<Object> name_; |
5462 StrictModeFlag strict_mode_flag_; | 5695 StrictModeFlag strict_mode_flag_; |
5463 }; | 5696 }; |
5464 | 5697 |
5465 | 5698 |
5466 class HLoadContextSlot: public HUnaryOperation { | 5699 class HLoadContextSlot: public HUnaryOperation { |
5467 public: | 5700 public: |
5468 enum Mode { | 5701 enum Mode { |
5469 // Perform a normal load of the context slot without checking its value. | 5702 // Perform a normal load of the context slot without checking its value. |
5470 kNoCheck, | 5703 kNoCheck, |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5538 kNoCheck, | 5771 kNoCheck, |
5539 // Check the previous value of the context slot and deoptimize if it's the | 5772 // Check the previous value of the context slot and deoptimize if it's the |
5540 // hole value. This is used for checking for assignments to uninitialized | 5773 // hole value. This is used for checking for assignments to uninitialized |
5541 // harmony bindings where we deoptimize into full-codegen generated code | 5774 // harmony bindings where we deoptimize into full-codegen generated code |
5542 // which will subsequently throw a reference error. | 5775 // which will subsequently throw a reference error. |
5543 kCheckDeoptimize, | 5776 kCheckDeoptimize, |
5544 // Check the previous value and ignore assignment if it isn't a hole value | 5777 // Check the previous value and ignore assignment if it isn't a hole value |
5545 kCheckIgnoreAssignment | 5778 kCheckIgnoreAssignment |
5546 }; | 5779 }; |
5547 | 5780 |
5548 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) | 5781 DECLARE_INSTRUCTION_FACTORY_P4(HStoreContextSlot, HValue*, int, |
5549 : slot_index_(slot_index), mode_(mode) { | 5782 Mode, HValue*); |
5550 SetOperandAt(0, context); | |
5551 SetOperandAt(1, value); | |
5552 SetGVNFlag(kChangesContextSlots); | |
5553 } | |
5554 | 5783 |
5555 HValue* context() { return OperandAt(0); } | 5784 HValue* context() { return OperandAt(0); } |
5556 HValue* value() { return OperandAt(1); } | 5785 HValue* value() { return OperandAt(1); } |
5557 int slot_index() const { return slot_index_; } | 5786 int slot_index() const { return slot_index_; } |
5558 Mode mode() const { return mode_; } | 5787 Mode mode() const { return mode_; } |
5559 | 5788 |
5560 bool NeedsWriteBarrier() { | 5789 bool NeedsWriteBarrier() { |
5561 return StoringValueNeedsWriteBarrier(value()); | 5790 return StoringValueNeedsWriteBarrier(value()); |
5562 } | 5791 } |
5563 | 5792 |
5564 bool DeoptimizesOnHole() { | 5793 bool DeoptimizesOnHole() { |
5565 return mode_ == kCheckDeoptimize; | 5794 return mode_ == kCheckDeoptimize; |
5566 } | 5795 } |
5567 | 5796 |
5568 bool RequiresHoleCheck() { | 5797 bool RequiresHoleCheck() { |
5569 return mode_ != kNoCheck; | 5798 return mode_ != kNoCheck; |
5570 } | 5799 } |
5571 | 5800 |
5572 virtual Representation RequiredInputRepresentation(int index) { | 5801 virtual Representation RequiredInputRepresentation(int index) { |
5573 return Representation::Tagged(); | 5802 return Representation::Tagged(); |
5574 } | 5803 } |
5575 | 5804 |
5576 virtual void PrintDataTo(StringStream* stream); | 5805 virtual void PrintDataTo(StringStream* stream); |
5577 | 5806 |
5578 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) | 5807 DECLARE_CONCRETE_INSTRUCTION(StoreContextSlot) |
5579 | 5808 |
5580 private: | 5809 private: |
5810 HStoreContextSlot(HValue* context, int slot_index, Mode mode, HValue* value) | |
5811 : slot_index_(slot_index), mode_(mode) { | |
5812 SetOperandAt(0, context); | |
5813 SetOperandAt(1, value); | |
5814 SetGVNFlag(kChangesContextSlots); | |
5815 } | |
5816 | |
5581 int slot_index_; | 5817 int slot_index_; |
5582 Mode mode_; | 5818 Mode mode_; |
5583 }; | 5819 }; |
5584 | 5820 |
5585 | 5821 |
5586 // Represents an access to a portion of an object, such as the map pointer, | 5822 // Represents an access to a portion of an object, such as the map pointer, |
5587 // array elements pointer, etc, but not accesses to array elements themselves. | 5823 // array elements pointer, etc, but not accesses to array elements themselves. |
5588 class HObjectAccess { | 5824 class HObjectAccess { |
5589 public: | 5825 public: |
5590 inline bool IsInobject() const { | 5826 inline bool IsInobject() const { |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5743 }; | 5979 }; |
5744 | 5980 |
5745 | 5981 |
5746 class HLinkObjectInList: public HUnaryOperation { | 5982 class HLinkObjectInList: public HUnaryOperation { |
5747 public: | 5983 public: |
5748 // There needs to be a mapping from every KnownList to an external reference | 5984 // There needs to be a mapping from every KnownList to an external reference |
5749 enum KnownList { | 5985 enum KnownList { |
5750 ALLOCATION_SITE_LIST | 5986 ALLOCATION_SITE_LIST |
5751 }; | 5987 }; |
5752 | 5988 |
5753 HLinkObjectInList(HValue* object, HObjectAccess store_field, | 5989 DECLARE_INSTRUCTION_FACTORY_P3(HLinkObjectInList, HValue*, |
5754 KnownList known_list) | 5990 HObjectAccess, KnownList); |
5755 : HUnaryOperation(object), | |
5756 store_field_(store_field), | |
5757 known_list_(known_list) { | |
5758 set_representation(Representation::Tagged()); | |
5759 } | |
5760 | 5991 |
5761 HObjectAccess store_field() const { return store_field_; } | 5992 HObjectAccess store_field() const { return store_field_; } |
5762 KnownList known_list() const { return known_list_; } | 5993 KnownList known_list() const { return known_list_; } |
5763 | 5994 |
5764 virtual Representation RequiredInputRepresentation(int index) { | 5995 virtual Representation RequiredInputRepresentation(int index) { |
5765 return Representation::Tagged(); | 5996 return Representation::Tagged(); |
5766 } | 5997 } |
5767 | 5998 |
5768 virtual void PrintDataTo(StringStream* stream); | 5999 virtual void PrintDataTo(StringStream* stream); |
5769 | 6000 |
5770 DECLARE_CONCRETE_INSTRUCTION(LinkObjectInList) | 6001 DECLARE_CONCRETE_INSTRUCTION(LinkObjectInList) |
5771 | 6002 |
5772 private: | 6003 private: |
6004 HLinkObjectInList(HValue* object, HObjectAccess store_field, | |
6005 KnownList known_list) | |
6006 : HUnaryOperation(object), | |
6007 store_field_(store_field), | |
6008 known_list_(known_list) { | |
6009 set_representation(Representation::Tagged()); | |
6010 } | |
6011 | |
5773 HObjectAccess store_field_; | 6012 HObjectAccess store_field_; |
5774 KnownList known_list_; | 6013 KnownList known_list_; |
5775 }; | 6014 }; |
5776 | 6015 |
5777 | 6016 |
5778 class HLoadNamedField: public HTemplateInstruction<2> { | 6017 class HLoadNamedField: public HTemplateInstruction<2> { |
5779 public: | 6018 public: |
5780 HLoadNamedField(HValue* object, | 6019 DECLARE_INSTRUCTION_FACTORY_P2(HLoadNamedField, HValue*, HObjectAccess); |
5781 HObjectAccess access, | 6020 DECLARE_INSTRUCTION_FACTORY_P3(HLoadNamedField, HValue*, HObjectAccess, |
5782 HValue* typecheck = NULL) | 6021 HValue*); |
5783 : access_(access) { | |
5784 ASSERT(object != NULL); | |
5785 SetOperandAt(0, object); | |
5786 SetOperandAt(1, typecheck != NULL ? typecheck : object); | |
5787 | |
5788 Representation representation = access.representation(); | |
5789 if (representation.IsSmi()) { | |
5790 set_type(HType::Smi()); | |
5791 set_representation(representation); | |
5792 } else if (representation.IsDouble() || | |
5793 representation.IsExternal() || | |
5794 representation.IsInteger32()) { | |
5795 set_representation(representation); | |
5796 } else if (FLAG_track_heap_object_fields && | |
5797 representation.IsHeapObject()) { | |
5798 set_type(HType::NonPrimitive()); | |
5799 set_representation(Representation::Tagged()); | |
5800 } else { | |
5801 set_representation(Representation::Tagged()); | |
5802 } | |
5803 access.SetGVNFlags(this, false); | |
5804 } | |
5805 | 6022 |
5806 HValue* object() { return OperandAt(0); } | 6023 HValue* object() { return OperandAt(0); } |
5807 HValue* typecheck() { | 6024 HValue* typecheck() { |
5808 ASSERT(HasTypeCheck()); | 6025 ASSERT(HasTypeCheck()); |
5809 return OperandAt(1); | 6026 return OperandAt(1); |
5810 } | 6027 } |
5811 | 6028 |
5812 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } | 6029 bool HasTypeCheck() const { return OperandAt(0) != OperandAt(1); } |
5813 HObjectAccess access() const { return access_; } | 6030 HObjectAccess access() const { return access_; } |
5814 Representation field_representation() const { | 6031 Representation field_representation() const { |
(...skipping 12 matching lines...) Expand all Loading... | |
5827 | 6044 |
5828 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) | 6045 DECLARE_CONCRETE_INSTRUCTION(LoadNamedField) |
5829 | 6046 |
5830 protected: | 6047 protected: |
5831 virtual bool DataEquals(HValue* other) { | 6048 virtual bool DataEquals(HValue* other) { |
5832 HLoadNamedField* b = HLoadNamedField::cast(other); | 6049 HLoadNamedField* b = HLoadNamedField::cast(other); |
5833 return access_.Equals(b->access_); | 6050 return access_.Equals(b->access_); |
5834 } | 6051 } |
5835 | 6052 |
5836 private: | 6053 private: |
6054 HLoadNamedField(HValue* object, | |
6055 HObjectAccess access, | |
6056 HValue* typecheck = NULL) | |
6057 : access_(access) { | |
6058 ASSERT(object != NULL); | |
6059 SetOperandAt(0, object); | |
6060 SetOperandAt(1, typecheck != NULL ? typecheck : object); | |
6061 | |
6062 Representation representation = access.representation(); | |
6063 if (representation.IsSmi()) { | |
6064 set_type(HType::Smi()); | |
6065 set_representation(representation); | |
6066 } else if (representation.IsDouble() || | |
6067 representation.IsExternal() || | |
6068 representation.IsInteger32()) { | |
6069 set_representation(representation); | |
6070 } else if (FLAG_track_heap_object_fields && | |
6071 representation.IsHeapObject()) { | |
6072 set_type(HType::NonPrimitive()); | |
6073 set_representation(Representation::Tagged()); | |
6074 } else { | |
6075 set_representation(Representation::Tagged()); | |
6076 } | |
6077 access.SetGVNFlags(this, false); | |
6078 } | |
6079 | |
5837 virtual bool IsDeletable() const { return true; } | 6080 virtual bool IsDeletable() const { return true; } |
5838 | 6081 |
5839 HObjectAccess access_; | 6082 HObjectAccess access_; |
5840 }; | 6083 }; |
5841 | 6084 |
5842 | 6085 |
5843 class HLoadNamedFieldPolymorphic: public HTemplateInstruction<2> { | 6086 class HLoadNamedFieldPolymorphic: public HTemplateInstruction<2> { |
5844 public: | 6087 public: |
5845 HLoadNamedFieldPolymorphic(HValue* context, | 6088 HLoadNamedFieldPolymorphic(HValue* context, |
5846 HValue* object, | 6089 HValue* object, |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
5945 | 6188 |
5946 enum LoadKeyedHoleMode { | 6189 enum LoadKeyedHoleMode { |
5947 NEVER_RETURN_HOLE, | 6190 NEVER_RETURN_HOLE, |
5948 ALLOW_RETURN_HOLE | 6191 ALLOW_RETURN_HOLE |
5949 }; | 6192 }; |
5950 | 6193 |
5951 | 6194 |
5952 class HLoadKeyed | 6195 class HLoadKeyed |
5953 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6196 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
5954 public: | 6197 public: |
5955 HLoadKeyed(HValue* obj, | 6198 DECLARE_INSTRUCTION_FACTORY_P4(HLoadKeyed, HValue*, HValue*, HValue*, |
5956 HValue* key, | 6199 ElementsKind); |
5957 HValue* dependency, | 6200 DECLARE_INSTRUCTION_FACTORY_P5(HLoadKeyed, HValue*, HValue*, HValue*, |
5958 ElementsKind elements_kind, | 6201 ElementsKind, LoadKeyedHoleMode); |
5959 LoadKeyedHoleMode mode = NEVER_RETURN_HOLE) | |
5960 : bit_field_(0) { | |
5961 bit_field_ = ElementsKindField::encode(elements_kind) | | |
5962 HoleModeField::encode(mode); | |
5963 | |
5964 SetOperandAt(0, obj); | |
5965 SetOperandAt(1, key); | |
5966 SetOperandAt(2, dependency != NULL ? dependency : obj); | |
5967 | |
5968 if (!is_external()) { | |
5969 // I can detect the case between storing double (holey and fast) and | |
5970 // smi/object by looking at elements_kind_. | |
5971 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || | |
5972 IsFastDoubleElementsKind(elements_kind)); | |
5973 | |
5974 if (IsFastSmiOrObjectElementsKind(elements_kind)) { | |
5975 if (IsFastSmiElementsKind(elements_kind) && | |
5976 (!IsHoleyElementsKind(elements_kind) || | |
5977 mode == NEVER_RETURN_HOLE)) { | |
5978 set_type(HType::Smi()); | |
5979 set_representation(Representation::Smi()); | |
5980 } else { | |
5981 set_representation(Representation::Tagged()); | |
5982 } | |
5983 | |
5984 SetGVNFlag(kDependsOnArrayElements); | |
5985 } else { | |
5986 set_representation(Representation::Double()); | |
5987 SetGVNFlag(kDependsOnDoubleArrayElements); | |
5988 } | |
5989 } else { | |
5990 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | |
5991 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | |
5992 set_representation(Representation::Double()); | |
5993 } else { | |
5994 set_representation(Representation::Integer32()); | |
5995 } | |
5996 | |
5997 SetGVNFlag(kDependsOnExternalMemory); | |
5998 // Native code could change the specialized array. | |
5999 SetGVNFlag(kDependsOnCalls); | |
6000 } | |
6001 | |
6002 SetFlag(kUseGVN); | |
6003 } | |
6004 | 6202 |
6005 bool is_external() const { | 6203 bool is_external() const { |
6006 return IsExternalArrayElementsKind(elements_kind()); | 6204 return IsExternalArrayElementsKind(elements_kind()); |
6007 } | 6205 } |
6008 HValue* elements() { return OperandAt(0); } | 6206 HValue* elements() { return OperandAt(0); } |
6009 HValue* key() { return OperandAt(1); } | 6207 HValue* key() { return OperandAt(1); } |
6010 HValue* dependency() { | 6208 HValue* dependency() { |
6011 ASSERT(HasDependency()); | 6209 ASSERT(HasDependency()); |
6012 return OperandAt(2); | 6210 return OperandAt(2); |
6013 } | 6211 } |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6062 virtual bool DataEquals(HValue* other) { | 6260 virtual bool DataEquals(HValue* other) { |
6063 if (!other->IsLoadKeyed()) return false; | 6261 if (!other->IsLoadKeyed()) return false; |
6064 HLoadKeyed* other_load = HLoadKeyed::cast(other); | 6262 HLoadKeyed* other_load = HLoadKeyed::cast(other); |
6065 | 6263 |
6066 if (IsDehoisted() && index_offset() != other_load->index_offset()) | 6264 if (IsDehoisted() && index_offset() != other_load->index_offset()) |
6067 return false; | 6265 return false; |
6068 return elements_kind() == other_load->elements_kind(); | 6266 return elements_kind() == other_load->elements_kind(); |
6069 } | 6267 } |
6070 | 6268 |
6071 private: | 6269 private: |
6270 HLoadKeyed(HValue* obj, | |
6271 HValue* key, | |
6272 HValue* dependency, | |
6273 ElementsKind elements_kind, | |
6274 LoadKeyedHoleMode mode = NEVER_RETURN_HOLE) | |
6275 : bit_field_(0) { | |
6276 bit_field_ = ElementsKindField::encode(elements_kind) | | |
6277 HoleModeField::encode(mode); | |
6278 | |
6279 SetOperandAt(0, obj); | |
6280 SetOperandAt(1, key); | |
6281 SetOperandAt(2, dependency != NULL ? dependency : obj); | |
6282 | |
6283 if (!is_external()) { | |
6284 // I can detect the case between storing double (holey and fast) and | |
6285 // smi/object by looking at elements_kind_. | |
6286 ASSERT(IsFastSmiOrObjectElementsKind(elements_kind) || | |
6287 IsFastDoubleElementsKind(elements_kind)); | |
6288 | |
6289 if (IsFastSmiOrObjectElementsKind(elements_kind)) { | |
6290 if (IsFastSmiElementsKind(elements_kind) && | |
6291 (!IsHoleyElementsKind(elements_kind) || | |
6292 mode == NEVER_RETURN_HOLE)) { | |
6293 set_type(HType::Smi()); | |
6294 set_representation(Representation::Smi()); | |
6295 } else { | |
6296 set_representation(Representation::Tagged()); | |
6297 } | |
6298 | |
6299 SetGVNFlag(kDependsOnArrayElements); | |
6300 } else { | |
6301 set_representation(Representation::Double()); | |
6302 SetGVNFlag(kDependsOnDoubleArrayElements); | |
6303 } | |
6304 } else { | |
6305 if (elements_kind == EXTERNAL_FLOAT_ELEMENTS || | |
6306 elements_kind == EXTERNAL_DOUBLE_ELEMENTS) { | |
6307 set_representation(Representation::Double()); | |
6308 } else { | |
6309 set_representation(Representation::Integer32()); | |
6310 } | |
6311 | |
6312 SetGVNFlag(kDependsOnExternalMemory); | |
6313 // Native code could change the specialized array. | |
6314 SetGVNFlag(kDependsOnCalls); | |
6315 } | |
6316 | |
6317 SetFlag(kUseGVN); | |
6318 } | |
6319 | |
6072 virtual bool IsDeletable() const { | 6320 virtual bool IsDeletable() const { |
6073 return !RequiresHoleCheck(); | 6321 return !RequiresHoleCheck(); |
6074 } | 6322 } |
6075 | 6323 |
6076 // Establish some checks around our packed fields | 6324 // Establish some checks around our packed fields |
6077 enum LoadKeyedBits { | 6325 enum LoadKeyedBits { |
6078 kBitsForElementsKind = 5, | 6326 kBitsForElementsKind = 5, |
6079 kBitsForHoleMode = 1, | 6327 kBitsForHoleMode = 1, |
6080 kBitsForIndexOffset = 25, | 6328 kBitsForIndexOffset = 25, |
6081 kBitsForIsDehoisted = 1, | 6329 kBitsForIsDehoisted = 1, |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6127 } | 6375 } |
6128 | 6376 |
6129 virtual HValue* Canonicalize(); | 6377 virtual HValue* Canonicalize(); |
6130 | 6378 |
6131 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) | 6379 DECLARE_CONCRETE_INSTRUCTION(LoadKeyedGeneric) |
6132 }; | 6380 }; |
6133 | 6381 |
6134 | 6382 |
6135 class HStoreNamedField: public HTemplateInstruction<2> { | 6383 class HStoreNamedField: public HTemplateInstruction<2> { |
6136 public: | 6384 public: |
6137 HStoreNamedField(HValue* obj, | 6385 DECLARE_INSTRUCTION_FACTORY_P3(HStoreNamedField, HValue*, |
6138 HObjectAccess access, | 6386 HObjectAccess, HValue*); |
6139 HValue* val) | |
6140 : access_(access), | |
6141 transition_(), | |
6142 transition_unique_id_(), | |
6143 new_space_dominator_(NULL), | |
6144 write_barrier_mode_(UPDATE_WRITE_BARRIER) { | |
6145 SetOperandAt(0, obj); | |
6146 SetOperandAt(1, val); | |
6147 access.SetGVNFlags(this, true); | |
6148 } | |
6149 | 6387 |
6150 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) | 6388 DECLARE_CONCRETE_INSTRUCTION(StoreNamedField) |
6151 | 6389 |
6152 virtual bool HasEscapingOperandAt(int index) { return index == 1; } | 6390 virtual bool HasEscapingOperandAt(int index) { return index == 1; } |
6153 virtual Representation RequiredInputRepresentation(int index) { | 6391 virtual Representation RequiredInputRepresentation(int index) { |
6154 if (index == 0 && access().IsExternalMemory()) { | 6392 if (index == 0 && access().IsExternalMemory()) { |
6155 // object must be external in case of external memory access | 6393 // object must be external in case of external memory access |
6156 return Representation::External(); | 6394 return Representation::External(); |
6157 } else if (index == 1 && | 6395 } else if (index == 1 && |
6158 (field_representation().IsDouble() || | 6396 (field_representation().IsDouble() || |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6207 | 6445 |
6208 virtual void FinalizeUniqueValueId() { | 6446 virtual void FinalizeUniqueValueId() { |
6209 transition_unique_id_ = UniqueValueId(transition_); | 6447 transition_unique_id_ = UniqueValueId(transition_); |
6210 } | 6448 } |
6211 | 6449 |
6212 Representation field_representation() const { | 6450 Representation field_representation() const { |
6213 return access_.representation(); | 6451 return access_.representation(); |
6214 } | 6452 } |
6215 | 6453 |
6216 private: | 6454 private: |
6455 HStoreNamedField(HValue* obj, | |
6456 HObjectAccess access, | |
6457 HValue* val) | |
6458 : access_(access), | |
6459 transition_(), | |
6460 transition_unique_id_(), | |
6461 new_space_dominator_(NULL), | |
6462 write_barrier_mode_(UPDATE_WRITE_BARRIER) { | |
6463 SetOperandAt(0, obj); | |
6464 SetOperandAt(1, val); | |
6465 access.SetGVNFlags(this, true); | |
6466 } | |
6467 | |
6217 HObjectAccess access_; | 6468 HObjectAccess access_; |
6218 Handle<Map> transition_; | 6469 Handle<Map> transition_; |
6219 UniqueValueId transition_unique_id_; | 6470 UniqueValueId transition_unique_id_; |
6220 HValue* new_space_dominator_; | 6471 HValue* new_space_dominator_; |
6221 WriteBarrierMode write_barrier_mode_; | 6472 WriteBarrierMode write_barrier_mode_; |
6222 }; | 6473 }; |
6223 | 6474 |
6224 | 6475 |
6225 class HStoreNamedGeneric: public HTemplateInstruction<3> { | 6476 class HStoreNamedGeneric: public HTemplateInstruction<3> { |
6226 public: | 6477 public: |
(...skipping 26 matching lines...) Expand all Loading... | |
6253 | 6504 |
6254 private: | 6505 private: |
6255 Handle<String> name_; | 6506 Handle<String> name_; |
6256 StrictModeFlag strict_mode_flag_; | 6507 StrictModeFlag strict_mode_flag_; |
6257 }; | 6508 }; |
6258 | 6509 |
6259 | 6510 |
6260 class HStoreKeyed | 6511 class HStoreKeyed |
6261 : public HTemplateInstruction<3>, public ArrayInstructionInterface { | 6512 : public HTemplateInstruction<3>, public ArrayInstructionInterface { |
6262 public: | 6513 public: |
6263 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | 6514 DECLARE_INSTRUCTION_FACTORY_P4(HStoreKeyed, HValue*, HValue*, HValue*, |
6264 ElementsKind elements_kind) | 6515 ElementsKind); |
6265 : elements_kind_(elements_kind), | |
6266 index_offset_(0), | |
6267 is_dehoisted_(false), | |
6268 is_uninitialized_(false), | |
6269 new_space_dominator_(NULL) { | |
6270 SetOperandAt(0, obj); | |
6271 SetOperandAt(1, key); | |
6272 SetOperandAt(2, val); | |
6273 | |
6274 if (IsFastObjectElementsKind(elements_kind)) { | |
6275 SetFlag(kTrackSideEffectDominators); | |
6276 SetGVNFlag(kDependsOnNewSpacePromotion); | |
6277 } | |
6278 if (is_external()) { | |
6279 SetGVNFlag(kChangesExternalMemory); | |
6280 SetFlag(kAllowUndefinedAsNaN); | |
6281 } else if (IsFastDoubleElementsKind(elements_kind)) { | |
6282 SetGVNFlag(kChangesDoubleArrayElements); | |
6283 } else if (IsFastSmiElementsKind(elements_kind)) { | |
6284 SetGVNFlag(kChangesArrayElements); | |
6285 } else { | |
6286 SetGVNFlag(kChangesArrayElements); | |
6287 } | |
6288 | |
6289 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | |
6290 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | |
6291 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | |
6292 SetFlag(kTruncatingToInt32); | |
6293 } | |
6294 } | |
6295 | 6516 |
6296 virtual bool HasEscapingOperandAt(int index) { return index != 0; } | 6517 virtual bool HasEscapingOperandAt(int index) { return index != 0; } |
6297 virtual Representation RequiredInputRepresentation(int index) { | 6518 virtual Representation RequiredInputRepresentation(int index) { |
6298 // kind_fast: tagged[int32] = tagged | 6519 // kind_fast: tagged[int32] = tagged |
6299 // kind_double: tagged[int32] = double | 6520 // kind_double: tagged[int32] = double |
6300 // kind_smi : tagged[int32] = smi | 6521 // kind_smi : tagged[int32] = smi |
6301 // kind_external: external[int32] = (double | int32) | 6522 // kind_external: external[int32] = (double | int32) |
6302 if (index == 0) { | 6523 if (index == 0) { |
6303 return is_external() ? Representation::External() | 6524 return is_external() ? Representation::External() |
6304 : Representation::Tagged(); | 6525 : Representation::Tagged(); |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6381 } | 6602 } |
6382 } | 6603 } |
6383 | 6604 |
6384 bool NeedsCanonicalization(); | 6605 bool NeedsCanonicalization(); |
6385 | 6606 |
6386 virtual void PrintDataTo(StringStream* stream); | 6607 virtual void PrintDataTo(StringStream* stream); |
6387 | 6608 |
6388 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) | 6609 DECLARE_CONCRETE_INSTRUCTION(StoreKeyed) |
6389 | 6610 |
6390 private: | 6611 private: |
6612 HStoreKeyed(HValue* obj, HValue* key, HValue* val, | |
6613 ElementsKind elements_kind) | |
6614 : elements_kind_(elements_kind), | |
6615 index_offset_(0), | |
6616 is_dehoisted_(false), | |
6617 is_uninitialized_(false), | |
6618 new_space_dominator_(NULL) { | |
6619 SetOperandAt(0, obj); | |
6620 SetOperandAt(1, key); | |
6621 SetOperandAt(2, val); | |
6622 | |
6623 if (IsFastObjectElementsKind(elements_kind)) { | |
6624 SetFlag(kTrackSideEffectDominators); | |
6625 SetGVNFlag(kDependsOnNewSpacePromotion); | |
6626 } | |
6627 if (is_external()) { | |
6628 SetGVNFlag(kChangesExternalMemory); | |
6629 SetFlag(kAllowUndefinedAsNaN); | |
6630 } else if (IsFastDoubleElementsKind(elements_kind)) { | |
6631 SetGVNFlag(kChangesDoubleArrayElements); | |
6632 } else if (IsFastSmiElementsKind(elements_kind)) { | |
6633 SetGVNFlag(kChangesArrayElements); | |
6634 } else { | |
6635 SetGVNFlag(kChangesArrayElements); | |
6636 } | |
6637 | |
6638 // EXTERNAL_{UNSIGNED_,}{BYTE,SHORT,INT}_ELEMENTS are truncating. | |
6639 if (elements_kind >= EXTERNAL_BYTE_ELEMENTS && | |
6640 elements_kind <= EXTERNAL_UNSIGNED_INT_ELEMENTS) { | |
6641 SetFlag(kTruncatingToInt32); | |
6642 } | |
6643 } | |
6644 | |
6391 ElementsKind elements_kind_; | 6645 ElementsKind elements_kind_; |
6392 uint32_t index_offset_; | 6646 uint32_t index_offset_; |
6393 bool is_dehoisted_ : 1; | 6647 bool is_dehoisted_ : 1; |
6394 bool is_uninitialized_ : 1; | 6648 bool is_uninitialized_ : 1; |
6395 HValue* new_space_dominator_; | 6649 HValue* new_space_dominator_; |
6396 }; | 6650 }; |
6397 | 6651 |
6398 | 6652 |
6399 class HStoreKeyedGeneric: public HTemplateInstruction<4> { | 6653 class HStoreKeyedGeneric: public HTemplateInstruction<4> { |
6400 public: | 6654 public: |
(...skipping 25 matching lines...) Expand all Loading... | |
6426 | 6680 |
6427 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) | 6681 DECLARE_CONCRETE_INSTRUCTION(StoreKeyedGeneric) |
6428 | 6682 |
6429 private: | 6683 private: |
6430 StrictModeFlag strict_mode_flag_; | 6684 StrictModeFlag strict_mode_flag_; |
6431 }; | 6685 }; |
6432 | 6686 |
6433 | 6687 |
6434 class HTransitionElementsKind: public HTemplateInstruction<2> { | 6688 class HTransitionElementsKind: public HTemplateInstruction<2> { |
6435 public: | 6689 public: |
6436 HTransitionElementsKind(HValue* context, | 6690 inline static HTransitionElementsKind* New(Zone* zone, |
6437 HValue* object, | 6691 HValue* context, |
6438 Handle<Map> original_map, | 6692 HValue* object, |
6439 Handle<Map> transitioned_map) | 6693 Handle<Map> original_map, |
6440 : original_map_(original_map), | 6694 Handle<Map> transitioned_map) { |
6441 transitioned_map_(transitioned_map), | 6695 return new(zone) HTransitionElementsKind(context, object, |
6442 original_map_unique_id_(), | 6696 original_map, transitioned_map); |
6443 transitioned_map_unique_id_(), | |
6444 from_kind_(original_map->elements_kind()), | |
6445 to_kind_(transitioned_map->elements_kind()) { | |
6446 SetOperandAt(0, object); | |
6447 SetOperandAt(1, context); | |
6448 SetFlag(kUseGVN); | |
6449 SetGVNFlag(kChangesElementsKind); | |
6450 if (original_map->has_fast_double_elements()) { | |
6451 SetGVNFlag(kChangesElementsPointer); | |
6452 SetGVNFlag(kChangesNewSpacePromotion); | |
6453 } | |
6454 if (transitioned_map->has_fast_double_elements()) { | |
6455 SetGVNFlag(kChangesElementsPointer); | |
6456 SetGVNFlag(kChangesNewSpacePromotion); | |
6457 } | |
6458 set_representation(Representation::Tagged()); | |
6459 } | 6697 } |
6460 | 6698 |
6461 virtual Representation RequiredInputRepresentation(int index) { | 6699 virtual Representation RequiredInputRepresentation(int index) { |
6462 return Representation::Tagged(); | 6700 return Representation::Tagged(); |
6463 } | 6701 } |
6464 | 6702 |
6465 HValue* object() { return OperandAt(0); } | 6703 HValue* object() { return OperandAt(0); } |
6466 HValue* context() { return OperandAt(1); } | 6704 HValue* context() { return OperandAt(1); } |
6467 Handle<Map> original_map() { return original_map_; } | 6705 Handle<Map> original_map() { return original_map_; } |
6468 Handle<Map> transitioned_map() { return transitioned_map_; } | 6706 Handle<Map> transitioned_map() { return transitioned_map_; } |
(...skipping 10 matching lines...) Expand all Loading... | |
6479 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) | 6717 DECLARE_CONCRETE_INSTRUCTION(TransitionElementsKind) |
6480 | 6718 |
6481 protected: | 6719 protected: |
6482 virtual bool DataEquals(HValue* other) { | 6720 virtual bool DataEquals(HValue* other) { |
6483 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); | 6721 HTransitionElementsKind* instr = HTransitionElementsKind::cast(other); |
6484 return original_map_unique_id_ == instr->original_map_unique_id_ && | 6722 return original_map_unique_id_ == instr->original_map_unique_id_ && |
6485 transitioned_map_unique_id_ == instr->transitioned_map_unique_id_; | 6723 transitioned_map_unique_id_ == instr->transitioned_map_unique_id_; |
6486 } | 6724 } |
6487 | 6725 |
6488 private: | 6726 private: |
6727 HTransitionElementsKind(HValue* context, | |
6728 HValue* object, | |
6729 Handle<Map> original_map, | |
6730 Handle<Map> transitioned_map) | |
6731 : original_map_(original_map), | |
6732 transitioned_map_(transitioned_map), | |
6733 original_map_unique_id_(), | |
6734 transitioned_map_unique_id_(), | |
6735 from_kind_(original_map->elements_kind()), | |
6736 to_kind_(transitioned_map->elements_kind()) { | |
6737 SetOperandAt(0, object); | |
6738 SetOperandAt(1, context); | |
6739 SetFlag(kUseGVN); | |
6740 SetGVNFlag(kChangesElementsKind); | |
6741 if (original_map->has_fast_double_elements()) { | |
6742 SetGVNFlag(kChangesElementsPointer); | |
6743 SetGVNFlag(kChangesNewSpacePromotion); | |
6744 } | |
6745 if (transitioned_map->has_fast_double_elements()) { | |
6746 SetGVNFlag(kChangesElementsPointer); | |
6747 SetGVNFlag(kChangesNewSpacePromotion); | |
6748 } | |
6749 set_representation(Representation::Tagged()); | |
6750 } | |
6751 | |
6489 Handle<Map> original_map_; | 6752 Handle<Map> original_map_; |
6490 Handle<Map> transitioned_map_; | 6753 Handle<Map> transitioned_map_; |
6491 UniqueValueId original_map_unique_id_; | 6754 UniqueValueId original_map_unique_id_; |
6492 UniqueValueId transitioned_map_unique_id_; | 6755 UniqueValueId transitioned_map_unique_id_; |
6493 ElementsKind from_kind_; | 6756 ElementsKind from_kind_; |
6494 ElementsKind to_kind_; | 6757 ElementsKind to_kind_; |
6495 }; | 6758 }; |
6496 | 6759 |
6497 | 6760 |
6498 class HStringAdd: public HBinaryOperation { | 6761 class HStringAdd: public HBinaryOperation { |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6530 // No side-effects except possible allocation. | 6793 // No side-effects except possible allocation. |
6531 // NOTE: this instruction _does not_ call ToString() on its inputs. | 6794 // NOTE: this instruction _does not_ call ToString() on its inputs. |
6532 virtual bool IsDeletable() const { return true; } | 6795 virtual bool IsDeletable() const { return true; } |
6533 | 6796 |
6534 const StringAddFlags flags_; | 6797 const StringAddFlags flags_; |
6535 }; | 6798 }; |
6536 | 6799 |
6537 | 6800 |
6538 class HStringCharCodeAt: public HTemplateInstruction<3> { | 6801 class HStringCharCodeAt: public HTemplateInstruction<3> { |
6539 public: | 6802 public: |
6540 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | 6803 static HStringCharCodeAt* New(Zone* zone, |
6541 SetOperandAt(0, context); | 6804 HValue* context, |
6542 SetOperandAt(1, string); | 6805 HValue* string, |
6543 SetOperandAt(2, index); | 6806 HValue* index) { |
6544 set_representation(Representation::Integer32()); | 6807 return new(zone) HStringCharCodeAt(context, string, index); |
6545 SetFlag(kUseGVN); | |
6546 SetGVNFlag(kDependsOnMaps); | |
6547 SetGVNFlag(kChangesNewSpacePromotion); | |
6548 } | 6808 } |
6549 | 6809 |
6550 virtual Representation RequiredInputRepresentation(int index) { | 6810 virtual Representation RequiredInputRepresentation(int index) { |
6551 // The index is supposed to be Integer32. | 6811 // The index is supposed to be Integer32. |
6552 return index == 2 | 6812 return index == 2 |
6553 ? Representation::Integer32() | 6813 ? Representation::Integer32() |
6554 : Representation::Tagged(); | 6814 : Representation::Tagged(); |
6555 } | 6815 } |
6556 | 6816 |
6557 HValue* context() const { return OperandAt(0); } | 6817 HValue* context() const { return OperandAt(0); } |
6558 HValue* string() const { return OperandAt(1); } | 6818 HValue* string() const { return OperandAt(1); } |
6559 HValue* index() const { return OperandAt(2); } | 6819 HValue* index() const { return OperandAt(2); } |
6560 | 6820 |
6561 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) | 6821 DECLARE_CONCRETE_INSTRUCTION(StringCharCodeAt) |
6562 | 6822 |
6563 protected: | 6823 protected: |
6564 virtual bool DataEquals(HValue* other) { return true; } | 6824 virtual bool DataEquals(HValue* other) { return true; } |
6565 | 6825 |
6566 virtual Range* InferRange(Zone* zone) { | 6826 virtual Range* InferRange(Zone* zone) { |
6567 return new(zone) Range(0, String::kMaxUtf16CodeUnit); | 6827 return new(zone) Range(0, String::kMaxUtf16CodeUnit); |
6568 } | 6828 } |
6569 | 6829 |
6570 private: | 6830 private: |
6831 HStringCharCodeAt(HValue* context, HValue* string, HValue* index) { | |
6832 SetOperandAt(0, context); | |
6833 SetOperandAt(1, string); | |
6834 SetOperandAt(2, index); | |
6835 set_representation(Representation::Integer32()); | |
6836 SetFlag(kUseGVN); | |
6837 SetGVNFlag(kDependsOnMaps); | |
6838 SetGVNFlag(kChangesNewSpacePromotion); | |
6839 } | |
6840 | |
6571 // No side effects: runtime function assumes string + number inputs. | 6841 // No side effects: runtime function assumes string + number inputs. |
6572 virtual bool IsDeletable() const { return true; } | 6842 virtual bool IsDeletable() const { return true; } |
6573 }; | 6843 }; |
6574 | 6844 |
6575 | 6845 |
6576 class HStringCharFromCode: public HTemplateInstruction<2> { | 6846 class HStringCharFromCode: public HTemplateInstruction<2> { |
6577 public: | 6847 public: |
6578 static HInstruction* New(Zone* zone, | 6848 static HInstruction* New(Zone* zone, |
6579 HValue* context, | 6849 HValue* context, |
6580 HValue* char_code); | 6850 HValue* char_code); |
(...skipping 22 matching lines...) Expand all Loading... | |
6603 } | 6873 } |
6604 | 6874 |
6605 virtual bool IsDeletable() const { | 6875 virtual bool IsDeletable() const { |
6606 return !value()->ToNumberCanBeObserved(); | 6876 return !value()->ToNumberCanBeObserved(); |
6607 } | 6877 } |
6608 }; | 6878 }; |
6609 | 6879 |
6610 | 6880 |
6611 class HStringLength: public HUnaryOperation { | 6881 class HStringLength: public HUnaryOperation { |
6612 public: | 6882 public: |
6613 static HInstruction* New(Zone* zone, HValue* string); | 6883 static HInstruction* New(Zone* zone, HValue* context, HValue* string); |
6614 | 6884 |
6615 virtual Representation RequiredInputRepresentation(int index) { | 6885 virtual Representation RequiredInputRepresentation(int index) { |
6616 return Representation::Tagged(); | 6886 return Representation::Tagged(); |
6617 } | 6887 } |
6618 | 6888 |
6619 virtual HType CalculateInferredType() { | 6889 virtual HType CalculateInferredType() { |
6620 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); | 6890 STATIC_ASSERT(String::kMaxLength <= Smi::kMaxValue); |
6621 return HType::Smi(); | 6891 return HType::Smi(); |
6622 } | 6892 } |
6623 | 6893 |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6764 | 7034 |
6765 DECLARE_CONCRETE_INSTRUCTION(Typeof) | 7035 DECLARE_CONCRETE_INSTRUCTION(Typeof) |
6766 | 7036 |
6767 private: | 7037 private: |
6768 virtual bool IsDeletable() const { return true; } | 7038 virtual bool IsDeletable() const { return true; } |
6769 }; | 7039 }; |
6770 | 7040 |
6771 | 7041 |
6772 class HTrapAllocationMemento : public HTemplateInstruction<1> { | 7042 class HTrapAllocationMemento : public HTemplateInstruction<1> { |
6773 public: | 7043 public: |
6774 explicit HTrapAllocationMemento(HValue* obj) { | 7044 DECLARE_INSTRUCTION_FACTORY_P1(HTrapAllocationMemento, HValue*); |
6775 SetOperandAt(0, obj); | |
6776 } | |
6777 | 7045 |
6778 virtual Representation RequiredInputRepresentation(int index) { | 7046 virtual Representation RequiredInputRepresentation(int index) { |
6779 return Representation::Tagged(); | 7047 return Representation::Tagged(); |
6780 } | 7048 } |
6781 | 7049 |
6782 HValue* object() { return OperandAt(0); } | 7050 HValue* object() { return OperandAt(0); } |
6783 | 7051 |
6784 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) | 7052 DECLARE_CONCRETE_INSTRUCTION(TrapAllocationMemento) |
7053 | |
7054 private: | |
7055 explicit HTrapAllocationMemento(HValue* obj) { | |
7056 SetOperandAt(0, obj); | |
7057 } | |
6785 }; | 7058 }; |
6786 | 7059 |
6787 | 7060 |
6788 class HToFastProperties: public HUnaryOperation { | 7061 class HToFastProperties: public HUnaryOperation { |
6789 public: | 7062 public: |
7063 DECLARE_INSTRUCTION_FACTORY_P1(HToFastProperties, HValue*); | |
7064 | |
7065 virtual Representation RequiredInputRepresentation(int index) { | |
7066 return Representation::Tagged(); | |
7067 } | |
7068 | |
7069 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | |
7070 | |
7071 private: | |
6790 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { | 7072 explicit HToFastProperties(HValue* value) : HUnaryOperation(value) { |
6791 // This instruction is not marked as having side effects, but | 7073 // This instruction is not marked as having side effects, but |
6792 // changes the map of the input operand. Use it only when creating | 7074 // changes the map of the input operand. Use it only when creating |
6793 // object literals via a runtime call. | 7075 // object literals via a runtime call. |
6794 ASSERT(value->IsCallRuntime()); | 7076 ASSERT(value->IsCallRuntime()); |
6795 #ifdef DEBUG | 7077 #ifdef DEBUG |
6796 const Runtime::Function* function = HCallRuntime::cast(value)->function(); | 7078 const Runtime::Function* function = HCallRuntime::cast(value)->function(); |
6797 ASSERT(function->function_id == Runtime::kCreateObjectLiteral || | 7079 ASSERT(function->function_id == Runtime::kCreateObjectLiteral || |
6798 function->function_id == Runtime::kCreateObjectLiteralShallow); | 7080 function->function_id == Runtime::kCreateObjectLiteralShallow); |
6799 #endif | 7081 #endif |
6800 set_representation(Representation::Tagged()); | 7082 set_representation(Representation::Tagged()); |
6801 } | 7083 } |
6802 | 7084 |
6803 virtual Representation RequiredInputRepresentation(int index) { | |
6804 return Representation::Tagged(); | |
6805 } | |
6806 | |
6807 DECLARE_CONCRETE_INSTRUCTION(ToFastProperties) | |
6808 | |
6809 private: | |
6810 virtual bool IsDeletable() const { return true; } | 7085 virtual bool IsDeletable() const { return true; } |
6811 }; | 7086 }; |
6812 | 7087 |
6813 | 7088 |
6814 class HValueOf: public HUnaryOperation { | 7089 class HValueOf: public HUnaryOperation { |
6815 public: | 7090 public: |
6816 explicit HValueOf(HValue* value) : HUnaryOperation(value) { | 7091 explicit HValueOf(HValue* value) : HUnaryOperation(value) { |
6817 set_representation(Representation::Tagged()); | 7092 set_representation(Representation::Tagged()); |
6818 } | 7093 } |
6819 | 7094 |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
6872 | 7147 |
6873 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) | 7148 DECLARE_CONCRETE_INSTRUCTION(SeqStringSetChar) |
6874 | 7149 |
6875 private: | 7150 private: |
6876 String::Encoding encoding_; | 7151 String::Encoding encoding_; |
6877 }; | 7152 }; |
6878 | 7153 |
6879 | 7154 |
6880 class HCheckMapValue: public HTemplateInstruction<2> { | 7155 class HCheckMapValue: public HTemplateInstruction<2> { |
6881 public: | 7156 public: |
6882 HCheckMapValue(HValue* value, | 7157 DECLARE_INSTRUCTION_FACTORY_P2(HCheckMapValue, HValue*, HValue*); |
6883 HValue* map) { | |
6884 SetOperandAt(0, value); | |
6885 SetOperandAt(1, map); | |
6886 set_representation(Representation::Tagged()); | |
6887 SetFlag(kUseGVN); | |
6888 SetGVNFlag(kDependsOnMaps); | |
6889 SetGVNFlag(kDependsOnElementsKind); | |
6890 } | |
6891 | 7158 |
6892 virtual Representation RequiredInputRepresentation(int index) { | 7159 virtual Representation RequiredInputRepresentation(int index) { |
6893 return Representation::Tagged(); | 7160 return Representation::Tagged(); |
6894 } | 7161 } |
6895 | 7162 |
6896 virtual void PrintDataTo(StringStream* stream); | 7163 virtual void PrintDataTo(StringStream* stream); |
6897 | 7164 |
6898 virtual HType CalculateInferredType() { | 7165 virtual HType CalculateInferredType() { |
6899 return HType::Tagged(); | 7166 return HType::Tagged(); |
6900 } | 7167 } |
6901 | 7168 |
6902 HValue* value() { return OperandAt(0); } | 7169 HValue* value() { return OperandAt(0); } |
6903 HValue* map() { return OperandAt(1); } | 7170 HValue* map() { return OperandAt(1); } |
6904 | 7171 |
6905 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) | 7172 DECLARE_CONCRETE_INSTRUCTION(CheckMapValue) |
6906 | 7173 |
6907 protected: | 7174 protected: |
6908 virtual bool DataEquals(HValue* other) { | 7175 virtual bool DataEquals(HValue* other) { |
6909 return true; | 7176 return true; |
6910 } | 7177 } |
7178 | |
7179 private: | |
7180 HCheckMapValue(HValue* value, | |
7181 HValue* map) { | |
7182 SetOperandAt(0, value); | |
7183 SetOperandAt(1, map); | |
7184 set_representation(Representation::Tagged()); | |
7185 SetFlag(kUseGVN); | |
7186 SetGVNFlag(kDependsOnMaps); | |
7187 SetGVNFlag(kDependsOnElementsKind); | |
7188 } | |
6911 }; | 7189 }; |
6912 | 7190 |
6913 | 7191 |
6914 class HForInPrepareMap : public HTemplateInstruction<2> { | 7192 class HForInPrepareMap : public HTemplateInstruction<2> { |
6915 public: | 7193 public: |
6916 HForInPrepareMap(HValue* context, | 7194 static HForInPrepareMap* New(Zone* zone, |
6917 HValue* object) { | 7195 HValue* context, |
6918 SetOperandAt(0, context); | 7196 HValue* object) { |
6919 SetOperandAt(1, object); | 7197 return new(zone) HForInPrepareMap(context, object); |
6920 set_representation(Representation::Tagged()); | |
6921 SetAllSideEffects(); | |
6922 } | 7198 } |
6923 | 7199 |
6924 virtual Representation RequiredInputRepresentation(int index) { | 7200 virtual Representation RequiredInputRepresentation(int index) { |
6925 return Representation::Tagged(); | 7201 return Representation::Tagged(); |
6926 } | 7202 } |
6927 | 7203 |
6928 HValue* context() { return OperandAt(0); } | 7204 HValue* context() { return OperandAt(0); } |
6929 HValue* enumerable() { return OperandAt(1); } | 7205 HValue* enumerable() { return OperandAt(1); } |
6930 | 7206 |
6931 virtual void PrintDataTo(StringStream* stream); | 7207 virtual void PrintDataTo(StringStream* stream); |
6932 | 7208 |
6933 virtual HType CalculateInferredType() { | 7209 virtual HType CalculateInferredType() { |
6934 return HType::Tagged(); | 7210 return HType::Tagged(); |
6935 } | 7211 } |
6936 | 7212 |
6937 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); | 7213 DECLARE_CONCRETE_INSTRUCTION(ForInPrepareMap); |
7214 | |
7215 private: | |
7216 HForInPrepareMap(HValue* context, | |
7217 HValue* object) { | |
7218 SetOperandAt(0, context); | |
7219 SetOperandAt(1, object); | |
7220 set_representation(Representation::Tagged()); | |
7221 SetAllSideEffects(); | |
7222 } | |
6938 }; | 7223 }; |
6939 | 7224 |
6940 | 7225 |
6941 class HForInCacheArray : public HTemplateInstruction<2> { | 7226 class HForInCacheArray : public HTemplateInstruction<2> { |
6942 public: | 7227 public: |
6943 HForInCacheArray(HValue* enumerable, | 7228 DECLARE_INSTRUCTION_FACTORY_P3(HForInCacheArray, HValue*, HValue*, int); |
6944 HValue* keys, | |
6945 int idx) : idx_(idx) { | |
6946 SetOperandAt(0, enumerable); | |
6947 SetOperandAt(1, keys); | |
6948 set_representation(Representation::Tagged()); | |
6949 } | |
6950 | 7229 |
6951 virtual Representation RequiredInputRepresentation(int index) { | 7230 virtual Representation RequiredInputRepresentation(int index) { |
6952 return Representation::Tagged(); | 7231 return Representation::Tagged(); |
6953 } | 7232 } |
6954 | 7233 |
6955 HValue* enumerable() { return OperandAt(0); } | 7234 HValue* enumerable() { return OperandAt(0); } |
6956 HValue* map() { return OperandAt(1); } | 7235 HValue* map() { return OperandAt(1); } |
6957 int idx() { return idx_; } | 7236 int idx() { return idx_; } |
6958 | 7237 |
6959 HForInCacheArray* index_cache() { | 7238 HForInCacheArray* index_cache() { |
6960 return index_cache_; | 7239 return index_cache_; |
6961 } | 7240 } |
6962 | 7241 |
6963 void set_index_cache(HForInCacheArray* index_cache) { | 7242 void set_index_cache(HForInCacheArray* index_cache) { |
6964 index_cache_ = index_cache; | 7243 index_cache_ = index_cache; |
6965 } | 7244 } |
6966 | 7245 |
6967 virtual void PrintDataTo(StringStream* stream); | 7246 virtual void PrintDataTo(StringStream* stream); |
6968 | 7247 |
6969 virtual HType CalculateInferredType() { | 7248 virtual HType CalculateInferredType() { |
6970 return HType::Tagged(); | 7249 return HType::Tagged(); |
6971 } | 7250 } |
6972 | 7251 |
6973 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); | 7252 DECLARE_CONCRETE_INSTRUCTION(ForInCacheArray); |
6974 | 7253 |
6975 private: | 7254 private: |
7255 HForInCacheArray(HValue* enumerable, | |
7256 HValue* keys, | |
7257 int idx) : idx_(idx) { | |
7258 SetOperandAt(0, enumerable); | |
7259 SetOperandAt(1, keys); | |
7260 set_representation(Representation::Tagged()); | |
7261 } | |
7262 | |
6976 int idx_; | 7263 int idx_; |
6977 HForInCacheArray* index_cache_; | 7264 HForInCacheArray* index_cache_; |
6978 }; | 7265 }; |
6979 | 7266 |
6980 | 7267 |
6981 class HLoadFieldByIndex : public HTemplateInstruction<2> { | 7268 class HLoadFieldByIndex : public HTemplateInstruction<2> { |
6982 public: | 7269 public: |
6983 HLoadFieldByIndex(HValue* object, | 7270 HLoadFieldByIndex(HValue* object, |
6984 HValue* index) { | 7271 HValue* index) { |
6985 SetOperandAt(0, object); | 7272 SetOperandAt(0, object); |
(...skipping 20 matching lines...) Expand all Loading... | |
7006 virtual bool IsDeletable() const { return true; } | 7293 virtual bool IsDeletable() const { return true; } |
7007 }; | 7294 }; |
7008 | 7295 |
7009 | 7296 |
7010 #undef DECLARE_INSTRUCTION | 7297 #undef DECLARE_INSTRUCTION |
7011 #undef DECLARE_CONCRETE_INSTRUCTION | 7298 #undef DECLARE_CONCRETE_INSTRUCTION |
7012 | 7299 |
7013 } } // namespace v8::internal | 7300 } } // namespace v8::internal |
7014 | 7301 |
7015 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ | 7302 #endif // V8_HYDROGEN_INSTRUCTIONS_H_ |
OLD | NEW |