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