OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef V8_HEAP_SPACES_H_ | 5 #ifndef V8_HEAP_SPACES_H_ |
6 #define V8_HEAP_SPACES_H_ | 6 #define V8_HEAP_SPACES_H_ |
7 | 7 |
8 #include "src/allocation.h" | 8 #include "src/allocation.h" |
9 #include "src/base/atomicops.h" | 9 #include "src/base/atomicops.h" |
10 #include "src/base/bits.h" | 10 #include "src/base/bits.h" |
(...skipping 1571 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1582 | 1582 |
1583 private: | 1583 private: |
1584 // The size range of blocks, in bytes. | 1584 // The size range of blocks, in bytes. |
1585 static const int kMinBlockSize = 3 * kPointerSize; | 1585 static const int kMinBlockSize = 3 * kPointerSize; |
1586 static const int kMaxBlockSize = Page::kMaxRegularHeapObjectSize; | 1586 static const int kMaxBlockSize = Page::kMaxRegularHeapObjectSize; |
1587 | 1587 |
1588 FreeSpace* FindNodeFor(int size_in_bytes, int* node_size); | 1588 FreeSpace* FindNodeFor(int size_in_bytes, int* node_size); |
1589 | 1589 |
1590 PagedSpace* owner_; | 1590 PagedSpace* owner_; |
1591 Heap* heap_; | 1591 Heap* heap_; |
| 1592 int unreported_allocation_; |
1592 | 1593 |
1593 static const int kSmallListMax = 0xff * kPointerSize; | 1594 static const int kSmallListMax = 0xff * kPointerSize; |
1594 static const int kMediumListMax = 0x7ff * kPointerSize; | 1595 static const int kMediumListMax = 0x7ff * kPointerSize; |
1595 static const int kLargeListMax = 0x3fff * kPointerSize; | 1596 static const int kLargeListMax = 0x3fff * kPointerSize; |
1596 static const int kSmallAllocationMax = kSmallListMin - kPointerSize; | 1597 static const int kSmallAllocationMax = kSmallListMin - kPointerSize; |
1597 static const int kMediumAllocationMax = kSmallListMax; | 1598 static const int kMediumAllocationMax = kSmallListMax; |
1598 static const int kLargeAllocationMax = kMediumListMax; | 1599 static const int kLargeAllocationMax = kMediumListMax; |
1599 FreeListCategory small_list_; | 1600 FreeListCategory small_list_; |
1600 FreeListCategory medium_list_; | 1601 FreeListCategory medium_list_; |
1601 FreeListCategory large_list_; | 1602 FreeListCategory large_list_; |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 int Free(Address start, int size_in_bytes) { | 1779 int Free(Address start, int size_in_bytes) { |
1779 int wasted = free_list_.Free(start, size_in_bytes); | 1780 int wasted = free_list_.Free(start, size_in_bytes); |
1780 accounting_stats_.DeallocateBytes(size_in_bytes); | 1781 accounting_stats_.DeallocateBytes(size_in_bytes); |
1781 accounting_stats_.WasteBytes(wasted); | 1782 accounting_stats_.WasteBytes(wasted); |
1782 return size_in_bytes - wasted; | 1783 return size_in_bytes - wasted; |
1783 } | 1784 } |
1784 | 1785 |
1785 void ResetFreeList() { free_list_.Reset(); } | 1786 void ResetFreeList() { free_list_.Reset(); } |
1786 | 1787 |
1787 // Set space allocation info. | 1788 // Set space allocation info. |
1788 void SetTopAndLimit(Address top, Address limit) { | 1789 void SetTopAndLimit(Address top, Address limit); |
1789 DCHECK(top == limit || | 1790 void ReturnLinearAllocationAreaToFreeList(); |
1790 Page::FromAddress(top) == Page::FromAddress(limit - 1)); | |
1791 MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); | |
1792 allocation_info_.set_top(top); | |
1793 allocation_info_.set_limit(limit); | |
1794 } | |
1795 | 1791 |
1796 // Empty space allocation info, returning unused area to free list. | 1792 // Empty space allocation info, returning unused area to free list. |
1797 void EmptyAllocationInfo() { | 1793 void EmptyAllocationInfo() { |
1798 // Mark the old linear allocation area with a free space map so it can be | 1794 // Mark the old linear allocation area with a free space map so it can be |
1799 // skipped when scanning the heap. | 1795 // skipped when scanning the heap. |
1800 int old_linear_size = static_cast<int>(limit() - top()); | 1796 int old_linear_size = static_cast<int>(limit() - top()); |
1801 Free(top(), old_linear_size); | 1797 Free(top(), old_linear_size); |
1802 SetTopAndLimit(NULL, NULL); | 1798 SetTopAndLimit(NULL, NULL); |
1803 } | 1799 } |
1804 | 1800 |
(...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2885 count = 0; | 2881 count = 0; |
2886 } | 2882 } |
2887 // Must be small, since an iteration is used for lookup. | 2883 // Must be small, since an iteration is used for lookup. |
2888 static const int kMaxComments = 64; | 2884 static const int kMaxComments = 64; |
2889 }; | 2885 }; |
2890 #endif | 2886 #endif |
2891 } | 2887 } |
2892 } // namespace v8::internal | 2888 } // namespace v8::internal |
2893 | 2889 |
2894 #endif // V8_HEAP_SPACES_H_ | 2890 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |