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

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

Issue 2862563002: [heap] Pause black allocation during GCs (Closed)
Patch Set: Created 3 years, 7 months 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') | no next file » | 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 831 matching lines...) Expand 10 before | Expand all | Expand 10 after
842 DCHECK(heap()->incremental_marking()->black_allocation()); 842 DCHECK(heap()->incremental_marking()->black_allocation());
843 DCHECK_EQ(Page::FromAddress(start), this); 843 DCHECK_EQ(Page::FromAddress(start), this);
844 DCHECK_NE(start, end); 844 DCHECK_NE(start, end);
845 DCHECK_EQ(Page::FromAddress(end - 1), this); 845 DCHECK_EQ(Page::FromAddress(end - 1), this);
846 MarkingState::Internal(this).bitmap()->SetRange(AddressToMarkbitIndex(start), 846 MarkingState::Internal(this).bitmap()->SetRange(AddressToMarkbitIndex(start),
847 AddressToMarkbitIndex(end)); 847 AddressToMarkbitIndex(end));
848 MarkingState::Internal(this).IncrementLiveBytes( 848 MarkingState::Internal(this).IncrementLiveBytes(
849 static_cast<int>(end - start)); 849 static_cast<int>(end - start));
850 } 850 }
851 851
852 void Page::DestroyBlackArea(Address start, Address end) {
853 DCHECK(heap()->incremental_marking()->black_allocation());
854 DCHECK_EQ(Page::FromAddress(start), this);
855 DCHECK_NE(start, end);
856 DCHECK_EQ(Page::FromAddress(end - 1), this);
857 MarkingState::Internal(this).bitmap()->ClearRange(
858 AddressToMarkbitIndex(start), AddressToMarkbitIndex(end));
859 MarkingState::Internal(this).IncrementLiveBytes(
860 -static_cast<int>(end - start));
861 }
862
852 void MemoryAllocator::PartialFreeMemory(MemoryChunk* chunk, 863 void MemoryAllocator::PartialFreeMemory(MemoryChunk* chunk,
853 Address start_free) { 864 Address start_free) {
854 // We do not allow partial shrink for code. 865 // We do not allow partial shrink for code.
855 DCHECK(chunk->executable() == NOT_EXECUTABLE); 866 DCHECK(chunk->executable() == NOT_EXECUTABLE);
856 867
857 intptr_t size; 868 intptr_t size;
858 base::VirtualMemory* reservation = chunk->reserved_memory(); 869 base::VirtualMemory* reservation = chunk->reserved_memory();
859 DCHECK(reservation->IsReserved()); 870 DCHECK(reservation->IsReserved());
860 size = static_cast<intptr_t>(reservation->size()); 871 size = static_cast<intptr_t>(reservation->size());
861 872
(...skipping 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
1406 void PagedSpace::MarkAllocationInfoBlack() { 1417 void PagedSpace::MarkAllocationInfoBlack() {
1407 DCHECK(heap()->incremental_marking()->black_allocation()); 1418 DCHECK(heap()->incremental_marking()->black_allocation());
1408 Address current_top = top(); 1419 Address current_top = top();
1409 Address current_limit = limit(); 1420 Address current_limit = limit();
1410 if (current_top != nullptr && current_top != current_limit) { 1421 if (current_top != nullptr && current_top != current_limit) {
1411 Page::FromAllocationAreaAddress(current_top) 1422 Page::FromAllocationAreaAddress(current_top)
1412 ->CreateBlackArea(current_top, current_limit); 1423 ->CreateBlackArea(current_top, current_limit);
1413 } 1424 }
1414 } 1425 }
1415 1426
1427 void PagedSpace::UnmarkAllocationInfo() {
1428 Address current_top = top();
1429 Address current_limit = limit();
1430 if (current_top != nullptr && current_top != current_limit) {
1431 Page::FromAllocationAreaAddress(current_top)
1432 ->DestroyBlackArea(current_top, current_limit);
1433 }
1434 }
1435
1416 // Empty space allocation info, returning unused area to free list. 1436 // Empty space allocation info, returning unused area to free list.
1417 void PagedSpace::EmptyAllocationInfo() { 1437 void PagedSpace::EmptyAllocationInfo() {
1418 // Mark the old linear allocation area with a free space map so it can be 1438 // Mark the old linear allocation area with a free space map so it can be
1419 // skipped when scanning the heap. 1439 // skipped when scanning the heap.
1420 Address current_top = top(); 1440 Address current_top = top();
1421 Address current_limit = limit(); 1441 Address current_limit = limit();
1422 if (current_top == nullptr) { 1442 if (current_top == nullptr) {
1423 DCHECK(current_limit == nullptr); 1443 DCHECK(current_limit == nullptr);
1424 return; 1444 return;
1425 } 1445 }
(...skipping 1876 matching lines...) Expand 10 before | Expand all | Expand 10 after
3302 PrintF("\n"); 3322 PrintF("\n");
3303 } 3323 }
3304 printf(" --------------------------------------\n"); 3324 printf(" --------------------------------------\n");
3305 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size, 3325 printf(" Marked: %x, LiveCount: %" V8PRIdPTR "\n", mark_size,
3306 MarkingState::Internal(this).live_bytes()); 3326 MarkingState::Internal(this).live_bytes());
3307 } 3327 }
3308 3328
3309 #endif // DEBUG 3329 #endif // DEBUG
3310 } // namespace internal 3330 } // namespace internal
3311 } // namespace v8 3331 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698