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 1761 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1772 int Free(Address start, int size_in_bytes) { | 1772 int Free(Address start, int size_in_bytes) { |
1773 int wasted = free_list_.Free(start, size_in_bytes); | 1773 int wasted = free_list_.Free(start, size_in_bytes); |
1774 accounting_stats_.DeallocateBytes(size_in_bytes); | 1774 accounting_stats_.DeallocateBytes(size_in_bytes); |
1775 accounting_stats_.WasteBytes(wasted); | 1775 accounting_stats_.WasteBytes(wasted); |
1776 return size_in_bytes - wasted; | 1776 return size_in_bytes - wasted; |
1777 } | 1777 } |
1778 | 1778 |
1779 void ResetFreeList() { free_list_.Reset(); } | 1779 void ResetFreeList() { free_list_.Reset(); } |
1780 | 1780 |
1781 // Set space allocation info. | 1781 // Set space allocation info. |
1782 void SetTopAndLimit(Address top, Address limit) { | 1782 void SetTopAndLimit(Address top, Address limit); |
1783 DCHECK(top == limit || | |
1784 Page::FromAddress(top) == Page::FromAddress(limit - 1)); | |
1785 MemoryChunk::UpdateHighWaterMark(allocation_info_.top()); | |
1786 allocation_info_.set_top(top); | |
1787 allocation_info_.set_limit(limit); | |
1788 } | |
1789 | 1783 |
1790 // Empty space allocation info, returning unused area to free list. | 1784 // Empty space allocation info, returning unused area to free list. |
1791 void EmptyAllocationInfo() { | 1785 void EmptyAllocationInfo() { |
1792 // Mark the old linear allocation area with a free space map so it can be | 1786 // Mark the old linear allocation area with a free space map so it can be |
1793 // skipped when scanning the heap. | 1787 // skipped when scanning the heap. |
1794 int old_linear_size = static_cast<int>(limit() - top()); | 1788 int old_linear_size = static_cast<int>(limit() - top()); |
1795 Free(top(), old_linear_size); | 1789 Free(top(), old_linear_size); |
1796 SetTopAndLimit(NULL, NULL); | 1790 SetTopAndLimit(NULL, NULL); |
1797 } | 1791 } |
1798 | 1792 |
(...skipping 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2870 count = 0; | 2864 count = 0; |
2871 } | 2865 } |
2872 // Must be small, since an iteration is used for lookup. | 2866 // Must be small, since an iteration is used for lookup. |
2873 static const int kMaxComments = 64; | 2867 static const int kMaxComments = 64; |
2874 }; | 2868 }; |
2875 #endif | 2869 #endif |
2876 } | 2870 } |
2877 } // namespace v8::internal | 2871 } // namespace v8::internal |
2878 | 2872 |
2879 #endif // V8_HEAP_SPACES_H_ | 2873 #endif // V8_HEAP_SPACES_H_ |
OLD | NEW |