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 #include "src/heap/spaces.h" | 5 #include "src/heap/spaces.h" |
6 | 6 |
7 #include "src/base/bits.h" | 7 #include "src/base/bits.h" |
8 #include "src/base/platform/platform.h" | 8 #include "src/base/platform/platform.h" |
9 #include "src/base/platform/semaphore.h" | 9 #include "src/base/platform/semaphore.h" |
10 #include "src/full-codegen/full-codegen.h" | 10 #include "src/full-codegen/full-codegen.h" |
(...skipping 1087 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1098 | 1098 |
1099 bool PagedSpace::SetUp() { return true; } | 1099 bool PagedSpace::SetUp() { return true; } |
1100 | 1100 |
1101 | 1101 |
1102 bool PagedSpace::HasBeenSetUp() { return true; } | 1102 bool PagedSpace::HasBeenSetUp() { return true; } |
1103 | 1103 |
1104 | 1104 |
1105 void PagedSpace::TearDown() { | 1105 void PagedSpace::TearDown() { |
1106 for (auto it = begin(); it != end();) { | 1106 for (auto it = begin(); it != end();) { |
1107 Page* page = *(it++); // Will be erased. | 1107 Page* page = *(it++); // Will be erased. |
1108 ArrayBufferTracker::FreeAll(page); | 1108 heap()->array_buffer_tracker()->FreeAll(page); |
1109 heap()->memory_allocator()->Free<MemoryAllocator::kFull>(page); | 1109 heap()->memory_allocator()->Free<MemoryAllocator::kFull>(page); |
1110 } | 1110 } |
1111 anchor_.set_next_page(&anchor_); | 1111 anchor_.set_next_page(&anchor_); |
1112 anchor_.set_prev_page(&anchor_); | 1112 anchor_.set_prev_page(&anchor_); |
1113 accounting_stats_.Clear(); | 1113 accounting_stats_.Clear(); |
1114 } | 1114 } |
1115 | 1115 |
1116 void PagedSpace::RefillFreeList() { | 1116 void PagedSpace::RefillFreeList() { |
1117 // Any PagedSpace might invoke RefillFreeList. We filter all but our old | 1117 // Any PagedSpace might invoke RefillFreeList. We filter all but our old |
1118 // generation spaces out. | 1118 // generation spaces out. |
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1778 current_capacity_ = minimum_capacity_; | 1778 current_capacity_ = minimum_capacity_; |
1779 maximum_capacity_ = RoundDown(maximum_capacity, Page::kPageSize); | 1779 maximum_capacity_ = RoundDown(maximum_capacity, Page::kPageSize); |
1780 committed_ = false; | 1780 committed_ = false; |
1781 } | 1781 } |
1782 | 1782 |
1783 | 1783 |
1784 void SemiSpace::TearDown() { | 1784 void SemiSpace::TearDown() { |
1785 // Properly uncommit memory to keep the allocator counters in sync. | 1785 // Properly uncommit memory to keep the allocator counters in sync. |
1786 if (is_committed()) { | 1786 if (is_committed()) { |
1787 for (Page* p : *this) { | 1787 for (Page* p : *this) { |
1788 ArrayBufferTracker::FreeAll(p); | 1788 heap()->array_buffer_tracker()->FreeAll(p); |
1789 } | 1789 } |
1790 Uncommit(); | 1790 Uncommit(); |
1791 } | 1791 } |
1792 current_capacity_ = maximum_capacity_ = 0; | 1792 current_capacity_ = maximum_capacity_ = 0; |
1793 } | 1793 } |
1794 | 1794 |
1795 | 1795 |
1796 bool SemiSpace::Commit() { | 1796 bool SemiSpace::Commit() { |
1797 DCHECK(!is_committed()); | 1797 DCHECK(!is_committed()); |
1798 Page* current = anchor(); | 1798 Page* current = anchor(); |
(...skipping 1333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3132 object->ShortPrint(); | 3132 object->ShortPrint(); |
3133 PrintF("\n"); | 3133 PrintF("\n"); |
3134 } | 3134 } |
3135 printf(" --------------------------------------\n"); | 3135 printf(" --------------------------------------\n"); |
3136 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3136 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3137 } | 3137 } |
3138 | 3138 |
3139 #endif // DEBUG | 3139 #endif // DEBUG |
3140 } // namespace internal | 3140 } // namespace internal |
3141 } // namespace v8 | 3141 } // namespace v8 |
OLD | NEW |