| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 1613 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1624 | 1624 |
| 1625 INLINE(Address MarkbitIndexToAddress(uint32_t index)) { | 1625 INLINE(Address MarkbitIndexToAddress(uint32_t index)) { |
| 1626 return reinterpret_cast<Address>(index << kPointerSizeLog2); | 1626 return reinterpret_cast<Address>(index << kPointerSizeLog2); |
| 1627 } | 1627 } |
| 1628 | 1628 |
| 1629 // The allocation top and limit addresses. | 1629 // The allocation top and limit addresses. |
| 1630 Address* allocation_top_address() { return &allocation_info_.top; } | 1630 Address* allocation_top_address() { return &allocation_info_.top; } |
| 1631 Address* allocation_limit_address() { return &allocation_info_.limit; } | 1631 Address* allocation_limit_address() { return &allocation_info_.limit; } |
| 1632 | 1632 |
| 1633 MUST_USE_RESULT MaybeObject* AllocateRaw(int size_in_bytes) { | 1633 MUST_USE_RESULT MaybeObject* AllocateRaw(int size_in_bytes) { |
| 1634 return AllocateRawInternal(size_in_bytes, &allocation_info_); | 1634 return AllocateRawInternal(size_in_bytes); |
| 1635 } | 1635 } |
| 1636 | 1636 |
| 1637 // Reset the allocation pointer to the beginning of the active semispace. | 1637 // Reset the allocation pointer to the beginning of the active semispace. |
| 1638 void ResetAllocationInfo(); | 1638 void ResetAllocationInfo(); |
| 1639 | 1639 |
| 1640 void LowerInlineAllocationLimit(intptr_t step) { |
| 1641 inline_alloction_limit_step_ = step; |
| 1642 allocation_info_.limit = Min( |
| 1643 allocation_info_.top + inline_alloction_limit_step_, |
| 1644 allocation_info_.limit); |
| 1645 top_on_previous_step_ = allocation_info_.top; |
| 1646 } |
| 1647 |
| 1640 // Get the extent of the inactive semispace (for use as a marking stack). | 1648 // Get the extent of the inactive semispace (for use as a marking stack). |
| 1641 Address FromSpaceLow() { return from_space_.low(); } | 1649 Address FromSpaceLow() { return from_space_.low(); } |
| 1642 Address FromSpaceHigh() { return from_space_.high(); } | 1650 Address FromSpaceHigh() { return from_space_.high(); } |
| 1643 | 1651 |
| 1644 // Get the extent of the active semispace (to sweep newly copied objects | 1652 // Get the extent of the active semispace (to sweep newly copied objects |
| 1645 // during a scavenge collection). | 1653 // during a scavenge collection). |
| 1646 Address ToSpaceLow() { return to_space_.low(); } | 1654 Address ToSpaceLow() { return to_space_.low(); } |
| 1647 Address ToSpaceHigh() { return to_space_.high(); } | 1655 Address ToSpaceHigh() { return to_space_.high(); } |
| 1648 | 1656 |
| 1649 // Offsets from the beginning of the semispaces. | 1657 // Offsets from the beginning of the semispaces. |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1720 // Start address and bit mask for containment testing. | 1728 // Start address and bit mask for containment testing. |
| 1721 Address start_; | 1729 Address start_; |
| 1722 uintptr_t address_mask_; | 1730 uintptr_t address_mask_; |
| 1723 uintptr_t object_mask_; | 1731 uintptr_t object_mask_; |
| 1724 uintptr_t object_expected_; | 1732 uintptr_t object_expected_; |
| 1725 | 1733 |
| 1726 // Allocation pointer and limit for normal allocation and allocation during | 1734 // Allocation pointer and limit for normal allocation and allocation during |
| 1727 // mark-compact collection. | 1735 // mark-compact collection. |
| 1728 AllocationInfo allocation_info_; | 1736 AllocationInfo allocation_info_; |
| 1729 | 1737 |
| 1738 // When incremental marking is active we will set allocation_info_.limit |
| 1739 // to be lower than actual limit and then will gradually increase it |
| 1740 // in steps to guarantee that we do incremental marking steps even |
| 1741 // when all allocation is performed from inlined generated code. |
| 1742 intptr_t inline_alloction_limit_step_; |
| 1743 |
| 1744 Address top_on_previous_step_; |
| 1745 |
| 1730 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) | 1746 #if defined(DEBUG) || defined(ENABLE_LOGGING_AND_PROFILING) |
| 1731 HistogramInfo* allocated_histogram_; | 1747 HistogramInfo* allocated_histogram_; |
| 1732 HistogramInfo* promoted_histogram_; | 1748 HistogramInfo* promoted_histogram_; |
| 1733 #endif | 1749 #endif |
| 1734 | 1750 |
| 1735 // Implementation of AllocateRaw and MCAllocateRaw. | 1751 // Implementation of AllocateRaw. |
| 1736 MUST_USE_RESULT inline MaybeObject* AllocateRawInternal( | 1752 MUST_USE_RESULT inline MaybeObject* AllocateRawInternal(int size_in_bytes); |
| 1737 int size_in_bytes, | |
| 1738 AllocationInfo* alloc_info); | |
| 1739 | 1753 |
| 1740 friend class SemiSpaceIterator; | 1754 friend class SemiSpaceIterator; |
| 1741 | 1755 |
| 1742 public: | 1756 public: |
| 1743 TRACK_MEMORY("NewSpace") | 1757 TRACK_MEMORY("NewSpace") |
| 1744 }; | 1758 }; |
| 1745 | 1759 |
| 1746 | 1760 |
| 1747 // ----------------------------------------------------------------------------- | 1761 // ----------------------------------------------------------------------------- |
| 1748 // Old object space (excluding map objects) | 1762 // Old object space (excluding map objects) |
| (...skipping 16 matching lines...) Expand all Loading... |
| 1765 | 1779 |
| 1766 // Prepare for full garbage collection. Resets the relocation pointer and | 1780 // Prepare for full garbage collection. Resets the relocation pointer and |
| 1767 // clears the free list. | 1781 // clears the free list. |
| 1768 virtual void PrepareForMarkCompact(bool will_compact); | 1782 virtual void PrepareForMarkCompact(bool will_compact); |
| 1769 | 1783 |
| 1770 public: | 1784 public: |
| 1771 TRACK_MEMORY("OldSpace") | 1785 TRACK_MEMORY("OldSpace") |
| 1772 }; | 1786 }; |
| 1773 | 1787 |
| 1774 | 1788 |
| 1789 // For contiguous spaces, top should be in the space (or at the end) and limit |
| 1790 // should be the end of the space. |
| 1791 #define ASSERT_SEMISPACE_ALLOCATION_INFO(info, space) \ |
| 1792 ASSERT((space).low() <= (info).top \ |
| 1793 && (info).top <= (space).high() \ |
| 1794 && (info).limit <= (space).high()) |
| 1795 |
| 1796 |
| 1775 // ----------------------------------------------------------------------------- | 1797 // ----------------------------------------------------------------------------- |
| 1776 // Old space for objects of a fixed size | 1798 // Old space for objects of a fixed size |
| 1777 | 1799 |
| 1778 class FixedSpace : public PagedSpace { | 1800 class FixedSpace : public PagedSpace { |
| 1779 public: | 1801 public: |
| 1780 FixedSpace(intptr_t max_capacity, | 1802 FixedSpace(intptr_t max_capacity, |
| 1781 AllocationSpace id, | 1803 AllocationSpace id, |
| 1782 int object_size_in_bytes, | 1804 int object_size_in_bytes, |
| 1783 const char* name) | 1805 const char* name) |
| 1784 : PagedSpace(max_capacity, id, NOT_EXECUTABLE), | 1806 : PagedSpace(max_capacity, id, NOT_EXECUTABLE), |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2001 | 2023 |
| 2002 private: | 2024 private: |
| 2003 LargePage* current_; | 2025 LargePage* current_; |
| 2004 HeapObjectCallback size_func_; | 2026 HeapObjectCallback size_func_; |
| 2005 }; | 2027 }; |
| 2006 | 2028 |
| 2007 | 2029 |
| 2008 } } // namespace v8::internal | 2030 } } // namespace v8::internal |
| 2009 | 2031 |
| 2010 #endif // V8_SPACES_H_ | 2032 #endif // V8_SPACES_H_ |
| OLD | NEW |