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 1240 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1251 void PagedSpace::ResetFreeListStatistics() { | 1251 void PagedSpace::ResetFreeListStatistics() { |
1252 for (Page* page : *this) { | 1252 for (Page* page : *this) { |
1253 page->ResetFreeListStatistics(); | 1253 page->ResetFreeListStatistics(); |
1254 } | 1254 } |
1255 } | 1255 } |
1256 | 1256 |
1257 void PagedSpace::SetAllocationInfo(Address top, Address limit) { | 1257 void PagedSpace::SetAllocationInfo(Address top, Address limit) { |
1258 SetTopAndLimit(top, limit); | 1258 SetTopAndLimit(top, limit); |
1259 if (top != nullptr && top != limit && | 1259 if (top != nullptr && top != limit && |
1260 heap()->incremental_marking()->black_allocation()) { | 1260 heap()->incremental_marking()->black_allocation()) { |
1261 Page* page = Page::FromAddress(top); | 1261 Page* page = Page::FromAllocationAreaAddress(top); |
1262 page->markbits()->SetRange(page->AddressToMarkbitIndex(top), | 1262 page->markbits()->SetRange(page->AddressToMarkbitIndex(top), |
1263 page->AddressToMarkbitIndex(limit)); | 1263 page->AddressToMarkbitIndex(limit)); |
1264 page->IncrementLiveBytes(static_cast<int>(limit - top)); | 1264 page->IncrementLiveBytes(static_cast<int>(limit - top)); |
1265 } | 1265 } |
1266 } | 1266 } |
1267 | 1267 |
1268 void PagedSpace::MarkAllocationInfoBlack() { | 1268 void PagedSpace::MarkAllocationInfoBlack() { |
1269 DCHECK(heap()->incremental_marking()->black_allocation()); | 1269 DCHECK(heap()->incremental_marking()->black_allocation()); |
1270 Address current_top = top(); | 1270 Address current_top = top(); |
1271 Address current_limit = limit(); | 1271 Address current_limit = limit(); |
1272 if (current_top != nullptr && current_top != current_limit) { | 1272 if (current_top != nullptr && current_top != current_limit) { |
1273 Page* page = Page::FromAddress(current_top); | 1273 Page* page = Page::FromAllocationAreaAddress(current_top); |
1274 page->markbits()->SetRange(page->AddressToMarkbitIndex(current_top), | 1274 page->markbits()->SetRange(page->AddressToMarkbitIndex(current_top), |
1275 page->AddressToMarkbitIndex(current_limit)); | 1275 page->AddressToMarkbitIndex(current_limit)); |
1276 page->IncrementLiveBytes(static_cast<int>(current_limit - current_top)); | 1276 page->IncrementLiveBytes(static_cast<int>(current_limit - current_top)); |
1277 } | 1277 } |
1278 } | 1278 } |
1279 | 1279 |
1280 // Empty space allocation info, returning unused area to free list. | 1280 // Empty space allocation info, returning unused area to free list. |
1281 void PagedSpace::EmptyAllocationInfo() { | 1281 void PagedSpace::EmptyAllocationInfo() { |
1282 // Mark the old linear allocation area with a free space map so it can be | 1282 // Mark the old linear allocation area with a free space map so it can be |
1283 // skipped when scanning the heap. | 1283 // skipped when scanning the heap. |
1284 Address current_top = top(); | 1284 Address current_top = top(); |
1285 Address current_limit = limit(); | 1285 Address current_limit = limit(); |
1286 if (current_top == nullptr) { | 1286 if (current_top == nullptr) { |
1287 DCHECK(current_limit == nullptr); | 1287 DCHECK(current_limit == nullptr); |
1288 return; | 1288 return; |
1289 } | 1289 } |
1290 | 1290 |
1291 if (heap()->incremental_marking()->black_allocation()) { | 1291 if (heap()->incremental_marking()->black_allocation()) { |
1292 Page* page = Page::FromAddress(current_top); | 1292 Page* page = Page::FromAllocationAreaAddress(current_top); |
1293 // We have to remember the end of the current black allocation area if | 1293 // We have to remember the end of the current black allocation area if |
1294 // something was allocated in the current bump pointer range. | 1294 // something was allocated in the current bump pointer range. |
1295 if (allocation_info_.original_top() != current_top) { | 1295 if (allocation_info_.original_top() != current_top) { |
1296 Address end_black_area = current_top - kPointerSize; | 1296 Address end_black_area = current_top - kPointerSize; |
1297 page->AddBlackAreaEndMarker(end_black_area); | 1297 page->AddBlackAreaEndMarker(end_black_area); |
1298 } | 1298 } |
1299 | 1299 |
1300 // Clear the bits in the unused black area. | 1300 // Clear the bits in the unused black area. |
1301 if (current_top != current_limit) { | 1301 if (current_top != current_limit) { |
1302 page->markbits()->ClearRange(page->AddressToMarkbitIndex(current_top), | 1302 page->markbits()->ClearRange(page->AddressToMarkbitIndex(current_top), |
(...skipping 1842 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3145 object->ShortPrint(); | 3145 object->ShortPrint(); |
3146 PrintF("\n"); | 3146 PrintF("\n"); |
3147 } | 3147 } |
3148 printf(" --------------------------------------\n"); | 3148 printf(" --------------------------------------\n"); |
3149 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); | 3149 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); |
3150 } | 3150 } |
3151 | 3151 |
3152 #endif // DEBUG | 3152 #endif // DEBUG |
3153 } // namespace internal | 3153 } // namespace internal |
3154 } // namespace v8 | 3154 } // namespace v8 |
OLD | NEW |