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 1666 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1677 | 1677 |
1678 Major MajorKey() { return TransitionElementsKind; } | 1678 Major MajorKey() { return TransitionElementsKind; } |
1679 int NotMissMinorKey() { return bit_field_; } | 1679 int NotMissMinorKey() { return bit_field_; } |
1680 | 1680 |
1681 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); | 1681 DISALLOW_COPY_AND_ASSIGN(TransitionElementsKindStub); |
1682 }; | 1682 }; |
1683 | 1683 |
1684 | 1684 |
1685 class ArrayConstructorStubBase : public HydrogenCodeStub { | 1685 class ArrayConstructorStubBase : public HydrogenCodeStub { |
1686 public: | 1686 public: |
1687 ArrayConstructorStubBase(ElementsKind kind, AllocationSiteMode mode) { | 1687 ArrayConstructorStubBase(ElementsKind kind, bool disable_allocation_sites) { |
1688 // It only makes sense to override local allocation site behavior | |
1689 // if there is a difference between the global allocation site policy | |
1690 // for an ElementsKind and the desired usage of the stub. | |
1691 ASSERT(!disable_allocation_sites || | |
1692 AllocationSiteInfo::GetMode(kind) == TRACK_ALLOCATION_SITE); | |
1688 bit_field_ = ElementsKindBits::encode(kind) | | 1693 bit_field_ = ElementsKindBits::encode(kind) | |
1689 AllocationSiteModeBits::encode(mode == TRACK_ALLOCATION_SITE); | 1694 DisableAllocationSitesBits::encode(disable_allocation_sites); |
1690 } | 1695 } |
1691 | 1696 |
1692 ElementsKind elements_kind() const { | 1697 ElementsKind elements_kind() const { |
1693 return ElementsKindBits::decode(bit_field_); | 1698 return ElementsKindBits::decode(bit_field_); |
1694 } | 1699 } |
1695 | 1700 |
1696 AllocationSiteMode mode() const { | 1701 bool disable_allocation_sites() const { |
Hannes Payer (out of office)
2013/06/04 12:25:54
This is not a real getter. The function name shoul
| |
1697 return AllocationSiteModeBits::decode(bit_field_) | 1702 return DisableAllocationSitesBits::decode(bit_field_); |
1698 ? TRACK_ALLOCATION_SITE | |
1699 : DONT_TRACK_ALLOCATION_SITE; | |
1700 } | 1703 } |
1701 | 1704 |
1702 virtual bool IsPregenerated() { return true; } | 1705 virtual bool IsPregenerated() { return true; } |
1703 static void GenerateStubsAheadOfTime(Isolate* isolate); | 1706 static void GenerateStubsAheadOfTime(Isolate* isolate); |
1704 static void InstallDescriptors(Isolate* isolate); | 1707 static void InstallDescriptors(Isolate* isolate); |
1705 | 1708 |
1706 // Parameters accessed via CodeStubGraphBuilder::GetParameter() | 1709 // Parameters accessed via CodeStubGraphBuilder::GetParameter() |
1707 static const int kConstructor = 0; | 1710 static const int kConstructor = 0; |
1708 static const int kPropertyCell = 1; | 1711 static const int kPropertyCell = 1; |
1709 | 1712 |
1710 private: | 1713 private: |
1711 int NotMissMinorKey() { return bit_field_; } | 1714 int NotMissMinorKey() { return bit_field_; } |
1712 | 1715 |
1713 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; | 1716 class ElementsKindBits: public BitField<ElementsKind, 0, 8> {}; |
1714 class AllocationSiteModeBits: public BitField<bool, 8, 1> {}; | 1717 class DisableAllocationSitesBits: public BitField<bool, 8, 1> {}; |
Hannes Payer (out of office)
2013/06/04 12:25:54
Do you want to rename it to DisableAllocationSites
| |
1715 uint32_t bit_field_; | 1718 uint32_t bit_field_; |
1716 | 1719 |
1717 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); | 1720 DISALLOW_COPY_AND_ASSIGN(ArrayConstructorStubBase); |
1718 }; | 1721 }; |
1719 | 1722 |
1720 | 1723 |
1721 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { | 1724 class ArrayNoArgumentConstructorStub : public ArrayConstructorStubBase { |
1722 public: | 1725 public: |
1723 ArrayNoArgumentConstructorStub( | 1726 ArrayNoArgumentConstructorStub( |
1724 ElementsKind kind, | 1727 ElementsKind kind, |
1725 AllocationSiteMode mode = TRACK_ALLOCATION_SITE) | 1728 bool disable_allocation_sites = false) |
1726 : ArrayConstructorStubBase(kind, mode) { | 1729 : ArrayConstructorStubBase(kind, disable_allocation_sites) { |
1727 } | 1730 } |
1728 | 1731 |
1729 virtual Handle<Code> GenerateCode(); | 1732 virtual Handle<Code> GenerateCode(); |
1730 | 1733 |
1731 virtual void InitializeInterfaceDescriptor( | 1734 virtual void InitializeInterfaceDescriptor( |
1732 Isolate* isolate, | 1735 Isolate* isolate, |
1733 CodeStubInterfaceDescriptor* descriptor); | 1736 CodeStubInterfaceDescriptor* descriptor); |
1734 | 1737 |
1735 private: | 1738 private: |
1736 Major MajorKey() { return ArrayNoArgumentConstructor; } | 1739 Major MajorKey() { return ArrayNoArgumentConstructor; } |
1737 | 1740 |
1738 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); | 1741 DISALLOW_COPY_AND_ASSIGN(ArrayNoArgumentConstructorStub); |
1739 }; | 1742 }; |
1740 | 1743 |
1741 | 1744 |
1742 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { | 1745 class ArraySingleArgumentConstructorStub : public ArrayConstructorStubBase { |
1743 public: | 1746 public: |
1744 ArraySingleArgumentConstructorStub( | 1747 ArraySingleArgumentConstructorStub( |
1745 ElementsKind kind, | 1748 ElementsKind kind, |
1746 AllocationSiteMode mode = TRACK_ALLOCATION_SITE) | 1749 bool disable_allocation_sites = false) |
1747 : ArrayConstructorStubBase(kind, mode) { | 1750 : ArrayConstructorStubBase(kind, disable_allocation_sites) { |
1748 } | 1751 } |
1749 | 1752 |
1750 virtual Handle<Code> GenerateCode(); | 1753 virtual Handle<Code> GenerateCode(); |
1751 | 1754 |
1752 virtual void InitializeInterfaceDescriptor( | 1755 virtual void InitializeInterfaceDescriptor( |
1753 Isolate* isolate, | 1756 Isolate* isolate, |
1754 CodeStubInterfaceDescriptor* descriptor); | 1757 CodeStubInterfaceDescriptor* descriptor); |
1755 | 1758 |
1756 private: | 1759 private: |
1757 Major MajorKey() { return ArraySingleArgumentConstructor; } | 1760 Major MajorKey() { return ArraySingleArgumentConstructor; } |
1758 | 1761 |
1759 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); | 1762 DISALLOW_COPY_AND_ASSIGN(ArraySingleArgumentConstructorStub); |
1760 }; | 1763 }; |
1761 | 1764 |
1762 | 1765 |
1763 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { | 1766 class ArrayNArgumentsConstructorStub : public ArrayConstructorStubBase { |
1764 public: | 1767 public: |
1765 ArrayNArgumentsConstructorStub( | 1768 ArrayNArgumentsConstructorStub( |
1766 ElementsKind kind, | 1769 ElementsKind kind, |
1767 AllocationSiteMode mode = TRACK_ALLOCATION_SITE) : | 1770 bool disable_allocation_sites = false) |
1768 ArrayConstructorStubBase(kind, mode) { | 1771 : ArrayConstructorStubBase(kind, disable_allocation_sites) { |
1769 } | 1772 } |
1770 | 1773 |
1771 virtual Handle<Code> GenerateCode(); | 1774 virtual Handle<Code> GenerateCode(); |
1772 | 1775 |
1773 virtual void InitializeInterfaceDescriptor( | 1776 virtual void InitializeInterfaceDescriptor( |
1774 Isolate* isolate, | 1777 Isolate* isolate, |
1775 CodeStubInterfaceDescriptor* descriptor); | 1778 CodeStubInterfaceDescriptor* descriptor); |
1776 | 1779 |
1777 private: | 1780 private: |
1778 Major MajorKey() { return ArrayNArgumentsConstructor; } | 1781 Major MajorKey() { return ArrayNArgumentsConstructor; } |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2011 | 2014 |
2012 // The current function entry hook. | 2015 // The current function entry hook. |
2013 static FunctionEntryHook entry_hook_; | 2016 static FunctionEntryHook entry_hook_; |
2014 | 2017 |
2015 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); | 2018 DISALLOW_COPY_AND_ASSIGN(ProfileEntryHookStub); |
2016 }; | 2019 }; |
2017 | 2020 |
2018 } } // namespace v8::internal | 2021 } } // namespace v8::internal |
2019 | 2022 |
2020 #endif // V8_CODE_STUBS_H_ | 2023 #endif // V8_CODE_STUBS_H_ |
OLD | NEW |