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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 V(ToNumber) \ | 70 V(ToNumber) \ |
71 V(ArgumentsAccess) \ | 71 V(ArgumentsAccess) \ |
72 V(RegExpConstructResult) \ | 72 V(RegExpConstructResult) \ |
73 V(NumberToString) \ | 73 V(NumberToString) \ |
74 V(CEntry) \ | 74 V(CEntry) \ |
75 V(JSEntry) \ | 75 V(JSEntry) \ |
76 V(KeyedLoadElement) \ | 76 V(KeyedLoadElement) \ |
77 V(ArrayNoArgumentConstructor) \ | 77 V(ArrayNoArgumentConstructor) \ |
78 V(ArraySingleArgumentConstructor) \ | 78 V(ArraySingleArgumentConstructor) \ |
79 V(ArrayNArgumentsConstructor) \ | 79 V(ArrayNArgumentsConstructor) \ |
| 80 V(InternalArrayNoArgumentConstructor) \ |
| 81 V(InternalArraySingleArgumentConstructor) \ |
| 82 V(InternalArrayNArgumentsConstructor) \ |
80 V(KeyedStoreElement) \ | 83 V(KeyedStoreElement) \ |
81 V(DebuggerStatement) \ | 84 V(DebuggerStatement) \ |
82 V(NameDictionaryLookup) \ | 85 V(NameDictionaryLookup) \ |
83 V(ElementsTransitionAndStore) \ | 86 V(ElementsTransitionAndStore) \ |
84 V(TransitionElementsKind) \ | 87 V(TransitionElementsKind) \ |
85 V(StoreArrayLiteralElement) \ | 88 V(StoreArrayLiteralElement) \ |
86 V(StubFailureTrampoline) \ | 89 V(StubFailureTrampoline) \ |
87 V(ArrayConstructor) \ | 90 V(ArrayConstructor) \ |
| 91 V(InternalArrayConstructor) \ |
88 V(ProfileEntryHook) \ | 92 V(ProfileEntryHook) \ |
89 /* IC Handler stubs */ \ | 93 /* IC Handler stubs */ \ |
90 V(LoadField) \ | 94 V(LoadField) \ |
91 V(KeyedLoadField) | 95 V(KeyedLoadField) |
92 | 96 |
93 // List of code stubs only used on ARM platforms. | 97 // List of code stubs only used on ARM platforms. |
94 #ifdef V8_TARGET_ARCH_ARM | 98 #ifdef V8_TARGET_ARCH_ARM |
95 #define CODE_STUB_LIST_ARM(V) \ | 99 #define CODE_STUB_LIST_ARM(V) \ |
96 V(GetProperty) \ | 100 V(GetProperty) \ |
97 V(SetProperty) \ | 101 V(SetProperty) \ |
(...skipping 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
648 void Generate(MacroAssembler* masm); | 652 void Generate(MacroAssembler* masm); |
649 | 653 |
650 private: | 654 private: |
651 virtual CodeStub::Major MajorKey() { return ArrayConstructor; } | 655 virtual CodeStub::Major MajorKey() { return ArrayConstructor; } |
652 virtual int MinorKey() { return argument_count_; } | 656 virtual int MinorKey() { return argument_count_; } |
653 | 657 |
654 ArgumentCountKey argument_count_; | 658 ArgumentCountKey argument_count_; |
655 }; | 659 }; |
656 | 660 |
657 | 661 |
| 662 class InternalArrayConstructorStub: public PlatformCodeStub { |
| 663 public: |
| 664 explicit InternalArrayConstructorStub(Isolate* isolate); |
| 665 |
| 666 void Generate(MacroAssembler* masm); |
| 667 |
| 668 private: |
| 669 virtual CodeStub::Major MajorKey() { return InternalArrayConstructor; } |
| 670 virtual int MinorKey() { return 0; } |
| 671 |
| 672 void GenerateCase(MacroAssembler* masm, ElementsKind kind); |
| 673 }; |
| 674 |
| 675 |
658 class MathPowStub: public PlatformCodeStub { | 676 class MathPowStub: public PlatformCodeStub { |
659 public: | 677 public: |
660 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; | 678 enum ExponentType { INTEGER, DOUBLE, TAGGED, ON_STACK}; |
661 | 679 |
662 explicit MathPowStub(ExponentType exponent_type) | 680 explicit MathPowStub(ExponentType exponent_type) |
663 : exponent_type_(exponent_type) { } | 681 : exponent_type_(exponent_type) { } |
664 virtual void Generate(MacroAssembler* masm); | 682 virtual void Generate(MacroAssembler* masm); |
665 | 683 |
666 private: | 684 private: |
667 virtual CodeStub::Major MajorKey() { return MathPow; } | 685 virtual CodeStub::Major MajorKey() { return MathPow; } |
(...skipping 969 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1637 | 1655 |
1638 Major MajorKey() { return TransitionElementsKind; } | 1656 Major MajorKey() { return TransitionElementsKind; } |
1639 int NotMissMinorKey() { return bit_field_; } | 1657 int NotMissMinorKey() { return bit_field_; } |
1640 | 1658 |
1641 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 1659 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
1642 }; | 1660 }; |
1643 | 1661 |
1644 | 1662 |
1645 class ArrayConstructorStubBase : public HydrogenCodeStub { | 1663 class ArrayConstructorStubBase : public HydrogenCodeStub { |
1646 public: | 1664 public: |
1647 ArrayConstructorStubBase(ElementsKind kind, AllocationSiteMode mode) | 1665 ArrayConstructorStubBase( |
| 1666 ElementsKind kind, |
| 1667 AllocationSiteMode mode) |
1648 : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS) { | 1668 : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS) { |
1649 bit_field_ = ElementsKindBits::encode(kind) | | 1669 bit_field_ = ElementsKindBits::encode(kind) | |
1650 AllocationSiteModeBits::encode(mode == TRACK_ALLOCATION_SITE); | 1670 AllocationSiteModeBits::encode(mode == TRACK_ALLOCATION_SITE); |
1651 } | 1671 } |
1652 | 1672 |
1653 ElementsKind elements_kind() const { | 1673 ElementsKind elements_kind() const { |
1654 return ElementsKindBits::decode(bit_field_); | 1674 return ElementsKindBits::decode(bit_field_); |
1655 } | 1675 } |
1656 | 1676 |
1657 AllocationSiteMode mode() const { | 1677 AllocationSiteMode mode() const { |
1658 return AllocationSiteModeBits::decode(bit_field_) | 1678 return AllocationSiteModeBits::decode(bit_field_) |
1659 ? TRACK_ALLOCATION_SITE | 1679 ? TRACK_ALLOCATION_SITE |
1660 : DONT_TRACK_ALLOCATION_SITE; | 1680 : DONT_TRACK_ALLOCATION_SITE; |
1661 } | 1681 } |
1662 | 1682 |
1663 virtual bool IsPregenerated() { return true; } | 1683 virtual bool IsPregenerated() { return true; } |
1664 static void GenerateStubsAheadOfTime(Isolate* isolate); | 1684 static void GenerateStubsAheadOfTime(Isolate* isolate); |
1665 static void InstallDescriptors(Isolate* isolate); | 1685 static void InstallDescriptors(Isolate* isolate); |
1666 | 1686 |
1667 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1687 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1668 static const int kConstructor = 0; | 1688 static const int kConstructor = 0; |
1669 static const int kPropertyCell = 1; | 1689 static const int kPropertyCell = 1; |
1670 | 1690 |
1671 private: | 1691 private: |
1672 int NotMissMinorKey() { return bit_field_; } | 1692 int NotMissMinorKey() { return bit_field_; } |
1673 | 1693 |
1674 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1694 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
1675 class AllocationSiteModeBits: public BitField<bool, 8, 1> {}; | 1695 class AllocationSiteModeBits: public BitField<bool, 8, 1> {}; |
| 1696 |
1676 uint32_t bit_field_; | 1697 uint32_t bit_field_; |
1677 | 1698 |
1678 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | 1699 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); |
1679 }; | 1700 }; |
1680 | 1701 |
1681 | 1702 |
1682 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 1703 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
1683 public: | 1704 public: |
1684 ArrayNoArgumentConstructorStub( | 1705 ArrayNoArgumentConstructorStub( |
1685 ElementsKind kind, | 1706 ElementsKind kind, |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1718 Major MajorKey() { return ArraySingleArgumentConstructor; } | 1739 Major MajorKey() { return ArraySingleArgumentConstructor; } |
1719 | 1740 |
1720 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 1741 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
1721 }; | 1742 }; |
1722 | 1743 |
1723 | 1744 |
1724 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 1745 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
1725 public: | 1746 public: |
1726 ArrayNArgumentsConstructorStub( | 1747 ArrayNArgumentsConstructorStub( |
1727 ElementsKind kind, | 1748 ElementsKind kind, |
1728 AllocationSiteMode mode = TRACK_ALLOCATION_SITE) : | 1749 AllocationSiteMode mode = TRACK_ALLOCATION_SITE) |
1729 ArrayConstructorStubBase(kind, mode) { | 1750 : ArrayConstructorStubBase(kind, mode) { |
1730 } | 1751 } |
1731 | 1752 |
1732 virtual Handle<Code> GenerateCode(); | 1753 virtual Handle<Code> GenerateCode(); |
1733 | 1754 |
1734 virtual void InitializeInterfaceDescriptor( | 1755 virtual void InitializeInterfaceDescriptor( |
1735 Isolate* isolate, | 1756 Isolate* isolate, |
1736 CodeStubInterfaceDescriptor* descriptor); | 1757 CodeStubInterfaceDescriptor* descriptor); |
1737 | 1758 |
1738 private: | 1759 private: |
1739 Major MajorKey() { return ArrayNArgumentsConstructor; } | 1760 Major MajorKey() { return ArrayNArgumentsConstructor; } |
1740 | 1761 |
1741 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); | 1762 DISALLOW_COPY_AND_ASSIGN(ArrayNArgumentsConstructorStub); |
1742 }; | 1763 }; |
1743 | 1764 |
1744 | 1765 |
| 1766 class InternalArrayConstructorStubBase : public HydrogenCodeStub { |
| 1767 public: |
| 1768 explicit InternalArrayConstructorStubBase(ElementsKind kind) |
| 1769 : HydrogenCodeStub(CODE_STUB_IS_NOT_MISS) { |
| 1770 kind_ = kind; |
| 1771 } |
| 1772 |
| 1773 virtual bool IsPregenerated() { return true; } |
| 1774 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 1775 static void InstallDescriptors(Isolate* isolate); |
| 1776 |
| 1777 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1778 static const int kConstructor = 0; |
| 1779 |
| 1780 ElementsKind elements_kind() const { return kind_; } |
| 1781 |
| 1782 private: |
| 1783 int NotMissMinorKey() { return kind_; } |
| 1784 |
| 1785 ElementsKind kind_; |
| 1786 |
| 1787 DISALLOW_COPY_AND_ASSIGN(InternalArrayConstructorStubBase); |
| 1788 }; |
| 1789 |
| 1790 |
| 1791 class InternalArrayNoArgumentConstructorStub : public |
| 1792 InternalArrayConstructorStubBase { |
| 1793 public: |
| 1794 explicit InternalArrayNoArgumentConstructorStub(ElementsKind kind) |
| 1795 : InternalArrayConstructorStubBase(kind) { } |
| 1796 |
| 1797 virtual Handle<Code> GenerateCode(); |
| 1798 |
| 1799 virtual void InitializeInterfaceDescriptor( |
| 1800 Isolate* isolate, |
| 1801 CodeStubInterfaceDescriptor* descriptor); |
| 1802 |
| 1803 private: |
| 1804 Major MajorKey() { return InternalArrayNoArgumentConstructor; } |
| 1805 |
| 1806 DISALLOW_COPY_AND_ASSIGN(InternalArrayNoArgumentConstructorStub); |
| 1807 }; |
| 1808 |
| 1809 |
| 1810 class InternalArraySingleArgumentConstructorStub : public |
| 1811 InternalArrayConstructorStubBase { |
| 1812 public: |
| 1813 explicit InternalArraySingleArgumentConstructorStub(ElementsKind kind) |
| 1814 : InternalArrayConstructorStubBase(kind) { } |
| 1815 |
| 1816 virtual Handle<Code> GenerateCode(); |
| 1817 |
| 1818 virtual void InitializeInterfaceDescriptor( |
| 1819 Isolate* isolate, |
| 1820 CodeStubInterfaceDescriptor* descriptor); |
| 1821 |
| 1822 private: |
| 1823 Major MajorKey() { return InternalArraySingleArgumentConstructor; } |
| 1824 |
| 1825 DISALLOW_COPY_AND_ASSIGN(InternalArraySingleArgumentConstructorStub); |
| 1826 }; |
| 1827 |
| 1828 |
| 1829 class InternalArrayNArgumentsConstructorStub : public |
| 1830 InternalArrayConstructorStubBase { |
| 1831 public: |
| 1832 explicit InternalArrayNArgumentsConstructorStub(ElementsKind kind) |
| 1833 : InternalArrayConstructorStubBase(kind) { } |
| 1834 |
| 1835 virtual Handle<Code> GenerateCode(); |
| 1836 |
| 1837 virtual void InitializeInterfaceDescriptor( |
| 1838 Isolate* isolate, |
| 1839 CodeStubInterfaceDescriptor* descriptor); |
| 1840 |
| 1841 private: |
| 1842 Major MajorKey() { return InternalArrayNArgumentsConstructor; } |
| 1843 |
| 1844 DISALLOW_COPY_AND_ASSIGN(InternalArrayNArgumentsConstructorStub); |
| 1845 }; |
| 1846 |
| 1847 |
1745 class KeyedStoreElementStub : public PlatformCodeStub { | 1848 class KeyedStoreElementStub : public PlatformCodeStub { |
1746 public: | 1849 public: |
1747 KeyedStoreElementStub(bool is_js_array, | 1850 KeyedStoreElementStub(bool is_js_array, |
1748 ElementsKind elements_kind, | 1851 ElementsKind elements_kind, |
1749 KeyedAccessStoreMode store_mode) | 1852 KeyedAccessStoreMode store_mode) |
1750 : is_js_array_(is_js_array), | 1853 : is_js_array_(is_js_array), |
1751 elements_kind_(elements_kind), | 1854 elements_kind_(elements_kind), |
1752 store_mode_(store_mode), | 1855 store_mode_(store_mode), |
1753 fp_registers_(CanUseFPRegisters()) { } | 1856 fp_registers_(CanUseFPRegisters()) { } |
1754 | 1857 |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1964 | 2067 |
1965 // The current function entry hook. | 2068 // The current function entry hook. |
1966 static FunctionEntryHook entry_hook_; | 2069 static FunctionEntryHook entry_hook_; |
1967 | 2070 |
1968 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2071 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
1969 }; | 2072 }; |
1970 | 2073 |
1971 } } // namespace v8::internal | 2074 } } // namespace v8::internal |
1972 | 2075 |
1973 #endif // V8_CODE_STUBS_H_ | 2076 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |