| 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 1717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 class ArrayConstructorStubBase : public HydrogenCodeStub { | 1736 class ArrayConstructorStubBase : public HydrogenCodeStub { |
| 1737 public: | 1737 public: |
| 1738 ArrayConstructorStubBase(ElementsKind kind, bool disable_allocation_sites) { | 1738 ArrayConstructorStubBase(ElementsKind kind, bool ensure_context, |
| 1739 bool disable_allocation_sites) { |
| 1739 // It only makes sense to override local allocation site behavior | 1740 // It only makes sense to override local allocation site behavior |
| 1740 // if there is a difference between the global allocation site policy | 1741 // if there is a difference between the global allocation site policy |
| 1741 // for an ElementsKind and the desired usage of the stub. | 1742 // for an ElementsKind and the desired usage of the stub. |
| 1742 ASSERT(!disable_allocation_sites || | 1743 ASSERT(!disable_allocation_sites || |
| 1743 AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); | 1744 AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); |
| 1744 bit_field_ = ElementsKindBits::encode(kind) | | 1745 bit_field_ = ElementsKindBits::encode(kind) | |
| 1745 DisableAllocationSitesBits::encode(disable_allocation_sites); | 1746 DisableAllocationSitesBits::encode(disable_allocation_sites) | |
| 1747 EnsureContextBits::encode(ensure_context); |
| 1746 } | 1748 } |
| 1747 | 1749 |
| 1748 ElementsKind elements_kind() const { | 1750 ElementsKind elements_kind() const { |
| 1749 return ElementsKindBits::decode(bit_field_); | 1751 return ElementsKindBits::decode(bit_field_); |
| 1750 } | 1752 } |
| 1751 | 1753 |
| 1752 bool disable_allocation_sites() const { | 1754 bool disable_allocation_sites() const { |
| 1753 return DisableAllocationSitesBits::decode(bit_field_); | 1755 return DisableAllocationSitesBits::decode(bit_field_); |
| 1754 } | 1756 } |
| 1755 | 1757 |
| 1756 virtual bool IsPregenerated() { return true; } | 1758 bool ensure_context() const { |
| 1759 return EnsureContextBits::decode(bit_field_); |
| 1760 } |
| 1761 |
| 1762 virtual bool IsPregenerated() { |
| 1763 // We only pre-generate stubs that verify correct context |
| 1764 return ensure_context(); |
| 1765 } |
| 1766 |
| 1757 static void GenerateStubsAheadOfTime(Isolate* isolate); | 1767 static void GenerateStubsAheadOfTime(Isolate* isolate); |
| 1758 static void InstallDescriptors(Isolate* isolate); | 1768 static void InstallDescriptors(Isolate* isolate); |
| 1759 | 1769 |
| 1760 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1770 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
| 1761 static const int kConstructor = 0; | 1771 static const int kConstructor = 0; |
| 1762 static const int kPropertyCell = 1; | 1772 static const int kPropertyCell = 1; |
| 1763 | 1773 |
| 1764 private: | 1774 private: |
| 1765 int NotMissMinorKey() { return bit_field_; } | 1775 int NotMissMinorKey() { return bit_field_; } |
| 1766 | 1776 |
| 1767 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1777 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
| 1768 class DisableAllocationSitesBits: public BitField<bool, 8, 1> {}; | 1778 class DisableAllocationSitesBits: public BitField<bool, 8, 1> {}; |
| 1779 class EnsureContextBits: public BitField<bool, 9, 1> {}; |
| 1769 uint32_t bit_field_; | 1780 uint32_t bit_field_; |
| 1770 | 1781 |
| 1771 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | 1782 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); |
| 1772 }; | 1783 }; |
| 1773 | 1784 |
| 1774 | 1785 |
| 1775 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 1786 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
| 1776 public: | 1787 public: |
| 1777 ArrayNoArgumentConstructorStub( | 1788 ArrayNoArgumentConstructorStub( |
| 1778 ElementsKind kind, | 1789 ElementsKind kind, |
| 1790 bool ensure_context = true, |
| 1779 bool disable_allocation_sites = false) | 1791 bool disable_allocation_sites = false) |
| 1780 : ArrayConstructorStubBase(kind, disable_allocation_sites) { | 1792 : ArrayConstructorStubBase(kind, ensure_context, |
| 1793 disable_allocation_sites) { |
| 1781 } | 1794 } |
| 1782 | 1795 |
| 1783 virtual Handle<Code> GenerateCode(); | 1796 virtual Handle<Code> GenerateCode(); |
| 1784 | 1797 |
| 1785 virtual void InitializeInterfaceDescriptor( | 1798 virtual void InitializeInterfaceDescriptor( |
| 1786 Isolate* isolate, | 1799 Isolate* isolate, |
| 1787 CodeStubInterfaceDescriptor* descriptor); | 1800 CodeStubInterfaceDescriptor* descriptor); |
| 1788 | 1801 |
| 1789 private: | 1802 private: |
| 1790 Major MajorKey() { return ArrayNoArgumentConstructor; } | 1803 Major MajorKey() { return ArrayNoArgumentConstructor; } |
| 1791 | 1804 |
| 1792 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 1805 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
| 1793 }; | 1806 }; |
| 1794 | 1807 |
| 1795 | 1808 |
| 1796 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 1809 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
| 1797 public: | 1810 public: |
| 1798 ArraySingleArgumentConstructorStub( | 1811 ArraySingleArgumentConstructorStub( |
| 1799 ElementsKind kind, | 1812 ElementsKind kind, |
| 1813 bool ensure_context = true, |
| 1800 bool disable_allocation_sites = false) | 1814 bool disable_allocation_sites = false) |
| 1801 : ArrayConstructorStubBase(kind, disable_allocation_sites) { | 1815 : ArrayConstructorStubBase(kind, ensure_context, |
| 1816 disable_allocation_sites) { |
| 1802 } | 1817 } |
| 1803 | 1818 |
| 1804 virtual Handle<Code> GenerateCode(); | 1819 virtual Handle<Code> GenerateCode(); |
| 1805 | 1820 |
| 1806 virtual void InitializeInterfaceDescriptor( | 1821 virtual void InitializeInterfaceDescriptor( |
| 1807 Isolate* isolate, | 1822 Isolate* isolate, |
| 1808 CodeStubInterfaceDescriptor* descriptor); | 1823 CodeStubInterfaceDescriptor* descriptor); |
| 1809 | 1824 |
| 1810 private: | 1825 private: |
| 1811 Major MajorKey() { return ArraySingleArgumentConstructor; } | 1826 Major MajorKey() { return ArraySingleArgumentConstructor; } |
| 1812 | 1827 |
| 1813 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 1828 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
| 1814 }; | 1829 }; |
| 1815 | 1830 |
| 1816 | 1831 |
| 1817 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 1832 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
| 1818 public: | 1833 public: |
| 1819 ArrayNArgumentsConstructorStub( | 1834 ArrayNArgumentsConstructorStub( |
| 1820 ElementsKind kind, | 1835 ElementsKind kind, |
| 1836 bool ensure_context = true, |
| 1821 bool disable_allocation_sites = false) | 1837 bool disable_allocation_sites = false) |
| 1822 : ArrayConstructorStubBase(kind, disable_allocation_sites) { | 1838 : ArrayConstructorStubBase(kind, ensure_context, |
| 1839 disable_allocation_sites) { |
| 1823 } | 1840 } |
| 1824 | 1841 |
| 1825 virtual Handle<Code> GenerateCode(); | 1842 virtual Handle<Code> GenerateCode(); |
| 1826 | 1843 |
| 1827 virtual void InitializeInterfaceDescriptor( | 1844 virtual void InitializeInterfaceDescriptor( |
| 1828 Isolate* isolate, | 1845 Isolate* isolate, |
| 1829 CodeStubInterfaceDescriptor* descriptor); | 1846 CodeStubInterfaceDescriptor* descriptor); |
| 1830 | 1847 |
| 1831 private: | 1848 private: |
| 1832 Major MajorKey() { return ArrayNArgumentsConstructor; } | 1849 Major MajorKey() { return ArrayNArgumentsConstructor; } |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2153 | 2170 |
| 2154 // The current function entry hook. | 2171 // The current function entry hook. |
| 2155 static FunctionEntryHook entry_hook_; | 2172 static FunctionEntryHook entry_hook_; |
| 2156 | 2173 |
| 2157 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2174 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
| 2158 }; | 2175 }; |
| 2159 | 2176 |
| 2160 } } // namespace v8::internal | 2177 } } // namespace v8::internal |
| 2161 | 2178 |
| 2162 #endif // V8_CODE_STUBS_H_ | 2179 #endif // V8_CODE_STUBS_H_ |
| OLD | NEW |