Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2)

Side by Side Diff: src/heap/spaces.cc

Issue 2562383002: [heap] Black areas are created for both linear and free list allocations. (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <utility> 7 #include <utility>
8 8
9 #include "src/base/bits.h" 9 #include "src/base/bits.h"
10 #include "src/base/platform/platform.h" 10 #include "src/base/platform/platform.h"
(...skipping 815 matching lines...) Expand 10 before | Expand all | Expand 10 after
826 filler->address(), 826 filler->address(),
827 static_cast<int>(area_end() - filler->address() - unused), 827 static_cast<int>(area_end() - filler->address() - unused),
828 ClearRecordedSlots::kNo); 828 ClearRecordedSlots::kNo);
829 heap()->memory_allocator()->ShrinkChunk(this, unused); 829 heap()->memory_allocator()->ShrinkChunk(this, unused);
830 CHECK(filler->IsFiller()); 830 CHECK(filler->IsFiller());
831 CHECK_EQ(filler->address() + filler->Size(), area_end()); 831 CHECK_EQ(filler->address() + filler->Size(), area_end());
832 } 832 }
833 return unused; 833 return unused;
834 } 834 }
835 835
836 void Page::CreateBlackArea(Address start, Address end) {
837 DCHECK(heap()->incremental_marking()->black_allocation());
838 DCHECK_EQ(Page::FromAddress(start), this);
839 DCHECK_NE(start, end);
840 DCHECK_EQ(Page::FromAddress(end - 1), this);
841 markbits()->SetRange(AddressToMarkbitIndex(start),
842 AddressToMarkbitIndex(end));
843 IncrementLiveBytes(static_cast<int>(end - start));
844 }
845
836 void MemoryAllocator::PartialFreeMemory(MemoryChunk* chunk, 846 void MemoryAllocator::PartialFreeMemory(MemoryChunk* chunk,
837 Address start_free) { 847 Address start_free) {
838 // We do not allow partial shrink for code. 848 // We do not allow partial shrink for code.
839 DCHECK(chunk->executable() == NOT_EXECUTABLE); 849 DCHECK(chunk->executable() == NOT_EXECUTABLE);
840 850
841 intptr_t size; 851 intptr_t size;
842 base::VirtualMemory* reservation = chunk->reserved_memory(); 852 base::VirtualMemory* reservation = chunk->reserved_memory();
843 DCHECK(reservation->IsReserved()); 853 DCHECK(reservation->IsReserved());
844 size = static_cast<intptr_t>(reservation->size()); 854 size = static_cast<intptr_t>(reservation->size());
845 855
(...skipping 489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1335 void PagedSpace::ResetFreeListStatistics() { 1345 void PagedSpace::ResetFreeListStatistics() {
1336 for (Page* page : *this) { 1346 for (Page* page : *this) {
1337 page->ResetFreeListStatistics(); 1347 page->ResetFreeListStatistics();
1338 } 1348 }
1339 } 1349 }
1340 1350
1341 void PagedSpace::SetAllocationInfo(Address top, Address limit) { 1351 void PagedSpace::SetAllocationInfo(Address top, Address limit) {
1342 SetTopAndLimit(top, limit); 1352 SetTopAndLimit(top, limit);
1343 if (top != nullptr && top != limit && 1353 if (top != nullptr && top != limit &&
1344 heap()->incremental_marking()->black_allocation()) { 1354 heap()->incremental_marking()->black_allocation()) {
1345 Page* page = Page::FromAllocationAreaAddress(top); 1355 Page::FromAllocationAreaAddress(top)->CreateBlackArea(top, limit);
1346 page->markbits()->SetRange(page->AddressToMarkbitIndex(top),
1347 page->AddressToMarkbitIndex(limit));
1348 page->IncrementLiveBytes(static_cast<int>(limit - top));
1349 } 1356 }
1350 } 1357 }
1351 1358
1352 void PagedSpace::MarkAllocationInfoBlack() { 1359 void PagedSpace::MarkAllocationInfoBlack() {
1353 DCHECK(heap()->incremental_marking()->black_allocation()); 1360 DCHECK(heap()->incremental_marking()->black_allocation());
1354 Address current_top = top(); 1361 Address current_top = top();
1355 Address current_limit = limit(); 1362 Address current_limit = limit();
1356 if (current_top != nullptr && current_top != current_limit) { 1363 if (current_top != nullptr && current_top != current_limit) {
1357 Page* page = Page::FromAllocationAreaAddress(current_top); 1364 Page::FromAllocationAreaAddress(current_top)
1358 page->markbits()->SetRange(page->AddressToMarkbitIndex(current_top), 1365 ->CreateBlackArea(current_top, current_limit);
1359 page->AddressToMarkbitIndex(current_limit));
1360 page->IncrementLiveBytes(static_cast<int>(current_limit - current_top));
1361 } 1366 }
1362 } 1367 }
1363 1368
1364 // Empty space allocation info, returning unused area to free list. 1369 // Empty space allocation info, returning unused area to free list.
1365 void PagedSpace::EmptyAllocationInfo() { 1370 void PagedSpace::EmptyAllocationInfo() {
1366 // Mark the old linear allocation area with a free space map so it can be 1371 // Mark the old linear allocation area with a free space map so it can be
1367 // skipped when scanning the heap. 1372 // skipped when scanning the heap.
1368 Address current_top = top(); 1373 Address current_top = top();
1369 Address current_limit = limit(); 1374 Address current_limit = limit();
1370 if (current_top == nullptr) { 1375 if (current_top == nullptr) {
(...skipping 1858 matching lines...) Expand 10 before | Expand all | Expand 10 after
3229 object->ShortPrint(); 3234 object->ShortPrint();
3230 PrintF("\n"); 3235 PrintF("\n");
3231 } 3236 }
3232 printf(" --------------------------------------\n"); 3237 printf(" --------------------------------------\n");
3233 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes()); 3238 printf(" Marked: %x, LiveCount: %x\n", mark_size, LiveBytes());
3234 } 3239 }
3235 3240
3236 #endif // DEBUG 3241 #endif // DEBUG
3237 } // namespace internal 3242 } // namespace internal
3238 } // namespace v8 3243 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | src/heap/spaces-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698