| 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_; |  | 
| 1593 | 1592 | 
| 1594   static const int kSmallListMax = 0xff * kPointerSize; | 1593   static const int kSmallListMax = 0xff * kPointerSize; | 
| 1595   static const int kMediumListMax = 0x7ff * kPointerSize; | 1594   static const int kMediumListMax = 0x7ff * kPointerSize; | 
| 1596   static const int kLargeListMax = 0x3fff * kPointerSize; | 1595   static const int kLargeListMax = 0x3fff * kPointerSize; | 
| 1597   static const int kSmallAllocationMax = kSmallListMin - kPointerSize; | 1596   static const int kSmallAllocationMax = kSmallListMin - kPointerSize; | 
| 1598   static const int kMediumAllocationMax = kSmallListMax; | 1597   static const int kMediumAllocationMax = kSmallListMax; | 
| 1599   static const int kLargeAllocationMax = kMediumListMax; | 1598   static const int kLargeAllocationMax = kMediumListMax; | 
| 1600   FreeListCategory small_list_; | 1599   FreeListCategory small_list_; | 
| 1601   FreeListCategory medium_list_; | 1600   FreeListCategory medium_list_; | 
| 1602   FreeListCategory large_list_; | 1601   FreeListCategory large_list_; | 
| (...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 1779   int Free(Address start, int size_in_bytes) { | 1778   int Free(Address start, int size_in_bytes) { | 
| 1780     int wasted = free_list_.Free(start, size_in_bytes); | 1779     int wasted = free_list_.Free(start, size_in_bytes); | 
| 1781     accounting_stats_.DeallocateBytes(size_in_bytes); | 1780     accounting_stats_.DeallocateBytes(size_in_bytes); | 
| 1782     accounting_stats_.WasteBytes(wasted); | 1781     accounting_stats_.WasteBytes(wasted); | 
| 1783     return size_in_bytes - wasted; | 1782     return size_in_bytes - wasted; | 
| 1784   } | 1783   } | 
| 1785 | 1784 | 
| 1786   void ResetFreeList() { free_list_.Reset(); } | 1785   void ResetFreeList() { free_list_.Reset(); } | 
| 1787 | 1786 | 
| 1788   // Set space allocation info. | 1787   // Set space allocation info. | 
| 1789   void SetTopAndLimit(Address top, Address limit); | 1788   void SetTopAndLimit(Address top, Address limit) { | 
| 1790   void ReturnLinearAllocationAreaToFreeList(); | 1789     DCHECK(top == limit || | 
|  | 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   } | 
| 1791 | 1795 | 
| 1792   // Empty space allocation info, returning unused area to free list. | 1796   // Empty space allocation info, returning unused area to free list. | 
| 1793   void EmptyAllocationInfo() { | 1797   void EmptyAllocationInfo() { | 
| 1794     // Mark the old linear allocation area with a free space map so it can be | 1798     // Mark the old linear allocation area with a free space map so it can be | 
| 1795     // skipped when scanning the heap. | 1799     // skipped when scanning the heap. | 
| 1796     int old_linear_size = static_cast<int>(limit() - top()); | 1800     int old_linear_size = static_cast<int>(limit() - top()); | 
| 1797     Free(top(), old_linear_size); | 1801     Free(top(), old_linear_size); | 
| 1798     SetTopAndLimit(NULL, NULL); | 1802     SetTopAndLimit(NULL, NULL); | 
| 1799   } | 1803   } | 
| 1800 | 1804 | 
| (...skipping 1080 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 2881     count = 0; | 2885     count = 0; | 
| 2882   } | 2886   } | 
| 2883   // Must be small, since an iteration is used for lookup. | 2887   // Must be small, since an iteration is used for lookup. | 
| 2884   static const int kMaxComments = 64; | 2888   static const int kMaxComments = 64; | 
| 2885 }; | 2889 }; | 
| 2886 #endif | 2890 #endif | 
| 2887 } | 2891 } | 
| 2888 }  // namespace v8::internal | 2892 }  // namespace v8::internal | 
| 2889 | 2893 | 
| 2890 #endif  // V8_HEAP_SPACES_H_ | 2894 #endif  // V8_HEAP_SPACES_H_ | 
| OLD | NEW | 
|---|