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 1565 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1576 | 1576 |
1577 private: | 1577 private: |
1578 // The size range of blocks, in bytes. | 1578 // The size range of blocks, in bytes. |
1579 static const int kMinBlockSize = 3 * kPointerSize; | 1579 static const int kMinBlockSize = 3 * kPointerSize; |
1580 static const int kMaxBlockSize = Page::kMaxRegularHeapObjectSize; | 1580 static const int kMaxBlockSize = Page::kMaxRegularHeapObjectSize; |
1581 | 1581 |
1582 FreeSpace* FindNodeFor(int size_in_bytes, int* node_size); | 1582 FreeSpace* FindNodeFor(int size_in_bytes, int* node_size); |
1583 | 1583 |
1584 PagedSpace* owner_; | 1584 PagedSpace* owner_; |
1585 Heap* heap_; | 1585 Heap* heap_; |
| 1586 int unreported_allocation_; |
1586 | 1587 |
1587 static const int kSmallListMax = 0xff * kPointerSize; | 1588 static const int kSmallListMax = 0xff * kPointerSize; |
1588 static const int kMediumListMax = 0x7ff * kPointerSize; | 1589 static const int kMediumListMax = 0x7ff * kPointerSize; |
1589 static const int kLargeListMax = 0x3fff * kPointerSize; | 1590 static const int kLargeListMax = 0x3fff * kPointerSize; |
1590 static const int kSmallAllocationMax = kSmallListMin - kPointerSize; | 1591 static const int kSmallAllocationMax = kSmallListMin - kPointerSize; |
1591 static const int kMediumAllocationMax = kSmallListMax; | 1592 static const int kMediumAllocationMax = kSmallListMax; |
1592 static const int kLargeAllocationMax = kMediumListMax; | 1593 static const int kLargeAllocationMax = kMediumListMax; |
1593 FreeListCategory small_list_; | 1594 FreeListCategory small_list_; |
1594 FreeListCategory medium_list_; | 1595 FreeListCategory medium_list_; |
1595 FreeListCategory large_list_; | 1596 FreeListCategory large_list_; |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1773 int Free(Address start, int size_in_bytes) { | 1774 int Free(Address start, int size_in_bytes) { |
1774 int wasted = free_list_.Free(start, size_in_bytes); | 1775 int wasted = free_list_.Free(start, size_in_bytes); |
1775 accounting_stats_.DeallocateBytes(size_in_bytes); | 1776 accounting_stats_.DeallocateBytes(size_in_bytes); |
1776 accounting_stats_.WasteBytes(wasted); | 1777 accounting_stats_.WasteBytes(wasted); |
1777 return size_in_bytes - wasted; | 1778 return size_in_bytes - wasted; |
1778 } | 1779 } |
1779 | 1780 |
1780 void ResetFreeList() { free_list_.Reset(); } | 1781 void ResetFreeList() { free_list_.Reset(); } |
1781 | 1782 |
1782 // Set space allocation info. | 1783 // Set space allocation info. |
1783 void SetTopAndLimit(Address top, Address limit) { | 1784 void SetTopAndLimit(Address top, Address limit); |
1784 DCHECK(top == limit || | |
1785 Page::FromAddress(top) == Page::FromAddress(limit - 1)); | |
1786 MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); | |
1787 allocation_info_.set_top(top); | |
1788 allocation_info_.set_limit(limit); | |
1789 } | |
1790 | 1785 |
1791 // Empty space allocation info, returning unused area to free list. | 1786 // Empty space allocation info, returning unused area to free list. |
1792 void EmptyAllocationInfo() { | 1787 void EmptyAllocationInfo() { |
1793 // Mark the old linear allocation area with a free space map so it can be | 1788 // Mark the old linear allocation area with a free space map so it can be |
1794 // skipped when scanning the heap. | 1789 // skipped when scanning the heap. |
1795 int old_linear_size = static_cast<int>(limit() - top()); | 1790 int old_linear_size = static_cast<int>(limit() - top()); |
1796 Free(top(), old_linear_size); | 1791 Free(top(), old_linear_size); |
1797 SetTopAndLimit(NULL, NULL); | 1792 SetTopAndLimit(NULL, NULL); |
1798 } | 1793 } |
1799 | 1794 |
(...skipping 1060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2860 count = 0; | 2855 count = 0; |
2861 } | 2856 } |
2862 // Must be small, since an iteration is used for lookup. | 2857 // Must be small, since an iteration is used for lookup. |
2863 static const int kMaxComments = 64; | 2858 static const int kMaxComments = 64; |
2864 }; | 2859 }; |
2865 #endif | 2860 #endif |
2866 } | 2861 } |
2867 } // namespace v8::internal | 2862 } // namespace v8::internal |
2868 | 2863 |
2869 #endif // V8_HEAP_SPACES_H_ | 2864 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |