| 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 1715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1726 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; | 1726 class ToKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1727 uint32_t bit_field_; | 1727 uint32_t bit_field_; |
| 1728 | 1728 |
| 1729 Major MajorKey() { return TransitionElementsKind; } | 1729 Major MajorKey() { return TransitionElementsKind; } |
| 1730 int NotMissMinorKey() { return bit_field_; } | 1730 int NotMissMinorKey() { return bit_field_; } |
| 1731 | 1731 |
| 1732 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 1732 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
| 1733 }; | 1733 }; |
| 1734 | 1734 |
| 1735 | 1735 |
| 1736 enum ContextCheckMode { |
| 1737 CONTEXT_CHECK_REQUIRED, |
| 1738 CONTEXT_CHECK_NOT_REQUIRED, |
| 1739 LAST_CONTEXT_CHECK_MODE = CONTEXT_CHECK_NOT_REQUIRED |
| 1740 }; |
| 1741 |
| 1742 |
| 1743 enum AllocationSiteOverrideMode { |
| 1744 DONT_OVERRIDE, |
| 1745 DISABLE_ALLOCATION_SITES, |
| 1746 LAST_ALLOCATION_SITE_OVERRIDE_MODE = DISABLE_ALLOCATION_SITES |
| 1747 }; |
| 1748 |
| 1749 |
| 1736 class ArrayConstructorStubBase : public HydrogenCodeStub { | 1750 class ArrayConstructorStubBase : public HydrogenCodeStub { |
| 1737 public: | 1751 public: |
| 1738 ArrayConstructorStubBase(ElementsKind kind, bool disable_allocation_sites) { | 1752 ArrayConstructorStubBase(ElementsKind kind, ContextCheckMode context_mode, |
| 1753 AllocationSiteOverrideMode override_mode) { |
| 1739 // It only makes sense to override local allocation site behavior | 1754 // It only makes sense to override local allocation site behavior |
| 1740 // if there is a difference between the global allocation site policy | 1755 // if there is a difference between the global allocation site policy |
| 1741 // for an ElementsKind and the desired usage of the stub. | 1756 // for an ElementsKind and the desired usage of the stub. |
| 1742 ASSERT(!disable_allocation_sites || | 1757 ASSERT(override_mode != DISABLE_ALLOCATION_SITES || |
| 1743 AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); | 1758 AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); |
| 1744 bit_field_ = ElementsKindBits::encode(kind) | | 1759 bit_field_ = ElementsKindBits::encode(kind) | |
| 1745 DisableAllocationSitesBits::encode(disable_allocation_sites); | 1760 AllocationSiteOverrideModeBits::encode(override_mode) | |
| 1761 ContextCheckModeBits::encode(context_mode); |
| 1746 } | 1762 } |
| 1747 | 1763 |
| 1748 ElementsKind elements_kind() const { | 1764 ElementsKind elements_kind() const { |
| 1749 return ElementsKindBits::decode(bit_field_); | 1765 return ElementsKindBits::decode(bit_field_); |
| 1750 } | 1766 } |
| 1751 | 1767 |
| 1752 bool disable_allocation_sites() const { | 1768 AllocationSiteOverrideMode override_mode() const { |
| 1753 return DisableAllocationSitesBits::decode(bit_field_); | 1769 return AllocationSiteOverrideModeBits::decode(bit_field_); |
| 1754 } | 1770 } |
| 1755 | 1771 |
| 1756 virtual bool IsPregenerated() { return true; } | 1772 ContextCheckMode context_mode() const { |
| 1773 return ContextCheckModeBits::decode(bit_field_); |
| 1774 } |
| 1775 |
| 1776 virtual bool IsPregenerated() { |
| 1777 // We only pre-generate stubs that verify correct context |
| 1778 return context_mode() == CONTEXT_CHECK_REQUIRED; |
| 1779 } |
| 1780 |
| 1757 static void GenerateStubsAheadOfTime(Isolate* isolate); | 1781 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 1758 static void InstallDescriptors(Isolate* isolate); | 1782 static void InstallDescriptors(Isolate* isolate); |
| 1759 | 1783 |
| 1760 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1784 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1761 static const int kConstructor = 0; | 1785 static const int kConstructor = 0; |
| 1762 static const int kPropertyCell = 1; | 1786 static const int kPropertyCell = 1; |
| 1763 | 1787 |
| 1764 private: | 1788 private: |
| 1765 int NotMissMinorKey() { return bit_field_; } | 1789 int NotMissMinorKey() { return bit_field_; } |
| 1766 | 1790 |
| 1791 // Ensure data fits within available bits. |
| 1792 STATIC_ASSERT(LAST_ALLOCATION_SITE_OVERRIDE_MODE == 1); |
| 1793 STATIC_ASSERT(LAST_CONTEXT_CHECK_MODE == 1); |
| 1794 |
| 1767 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1795 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1768 class DisableAllocationSitesBits: public BitField<bool, 8, 1> {}; | 1796 class AllocationSiteOverrideModeBits: public |
| 1797 BitField<AllocationSiteOverrideMode, 8, 1> {}; // NOLINT |
| 1798 class ContextCheckModeBits: public BitField<ContextCheckMode, 9, 1> {}; |
| 1769 uint32_t bit_field_; | 1799 uint32_t bit_field_; |
| 1770 | 1800 |
| 1771 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | 1801 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); |
| 1772 }; | 1802 }; |
| 1773 | 1803 |
| 1774 | 1804 |
| 1775 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 1805 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
| 1776 public: | 1806 public: |
| 1777 ArrayNoArgumentConstructorStub( | 1807 ArrayNoArgumentConstructorStub( |
| 1778 ElementsKind kind, | 1808 ElementsKind kind, |
| 1779 bool disable_allocation_sites = false) | 1809 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, |
| 1780 : ArrayConstructorStubBase(kind, disable_allocation_sites) { | 1810 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 1811 : ArrayConstructorStubBase(kind, context_mode, override_mode) { |
| 1781 } | 1812 } |
| 1782 | 1813 |
| 1783 virtual Handle<Code> GenerateCode(); | 1814 virtual Handle<Code> GenerateCode(); |
| 1784 | 1815 |
| 1785 virtual void InitializeInterfaceDescriptor( | 1816 virtual void InitializeInterfaceDescriptor( |
| 1786 Isolate* isolate, | 1817 Isolate* isolate, |
| 1787 CodeStubInterfaceDescriptor* descriptor); | 1818 CodeStubInterfaceDescriptor* descriptor); |
| 1788 | 1819 |
| 1789 private: | 1820 private: |
| 1790 Major MajorKey() { return ArrayNoArgumentConstructor; } | 1821 Major MajorKey() { return ArrayNoArgumentConstructor; } |
| 1791 | 1822 |
| 1792 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 1823 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
| 1793 }; | 1824 }; |
| 1794 | 1825 |
| 1795 | 1826 |
| 1796 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 1827 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
| 1797 public: | 1828 public: |
| 1798 ArraySingleArgumentConstructorStub( | 1829 ArraySingleArgumentConstructorStub( |
| 1799 ElementsKind kind, | 1830 ElementsKind kind, |
| 1800 bool disable_allocation_sites = false) | 1831 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, |
| 1801 : ArrayConstructorStubBase(kind, disable_allocation_sites) { | 1832 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 1833 : ArrayConstructorStubBase(kind, context_mode, override_mode) { |
| 1802 } | 1834 } |
| 1803 | 1835 |
| 1804 virtual Handle<Code> GenerateCode(); | 1836 virtual Handle<Code> GenerateCode(); |
| 1805 | 1837 |
| 1806 virtual void InitializeInterfaceDescriptor( | 1838 virtual void InitializeInterfaceDescriptor( |
| 1807 Isolate* isolate, | 1839 Isolate* isolate, |
| 1808 CodeStubInterfaceDescriptor* descriptor); | 1840 CodeStubInterfaceDescriptor* descriptor); |
| 1809 | 1841 |
| 1810 private: | 1842 private: |
| 1811 Major MajorKey() { return ArraySingleArgumentConstructor; } | 1843 Major MajorKey() { return ArraySingleArgumentConstructor; } |
| 1812 | 1844 |
| 1813 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 1845 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
| 1814 }; | 1846 }; |
| 1815 | 1847 |
| 1816 | 1848 |
| 1817 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 1849 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
| 1818 public: | 1850 public: |
| 1819 ArrayNArgumentsConstructorStub( | 1851 ArrayNArgumentsConstructorStub( |
| 1820 ElementsKind kind, | 1852 ElementsKind kind, |
| 1821 bool disable_allocation_sites = false) | 1853 ContextCheckMode context_mode = CONTEXT_CHECK_REQUIRED, |
| 1822 : ArrayConstructorStubBase(kind, disable_allocation_sites) { | 1854 AllocationSiteOverrideMode override_mode = DONT_OVERRIDE) |
| 1855 : ArrayConstructorStubBase(kind, context_mode, override_mode) { |
| 1823 } | 1856 } |
| 1824 | 1857 |
| 1825 virtual Handle<Code> GenerateCode(); | 1858 virtual Handle<Code> GenerateCode(); |
| 1826 | 1859 |
| 1827 virtual void InitializeInterfaceDescriptor( | 1860 virtual void InitializeInterfaceDescriptor( |
| 1828 Isolate* isolate, | 1861 Isolate* isolate, |
| 1829 CodeStubInterfaceDescriptor* descriptor); | 1862 CodeStubInterfaceDescriptor* descriptor); |
| 1830 | 1863 |
| 1831 private: | 1864 private: |
| 1832 Major MajorKey() { return ArrayNArgumentsConstructor; } | 1865 Major MajorKey() { return ArrayNArgumentsConstructor; } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 | 2186 |
| 2154 // The current function entry hook. | 2187 // The current function entry hook. |
| 2155 static FunctionEntryHook entry_hook_; | 2188 static FunctionEntryHook entry_hook_; |
| 2156 | 2189 |
| 2157 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2190 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2158 }; | 2191 }; |
| 2159 | 2192 |
| 2160 } } // namespace v8::internal | 2193 } } // namespace v8::internal |
| 2161 | 2194 |
| 2162 #endif // V8_CODE_STUBS_H_ | 2195 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |