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

Unified Diff: src/heap/spaces.cc

Issue 2236543002: [heap] Register end of black areas to support faster filtering of invalid slots. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fix nit Created 4 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/spaces.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/heap/spaces.cc
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
index b31aaf3998fd98a370b3a329dcfb992c12f9e112..7ce2ae919ac2bd943dc69e538a1e0b36f1fdc226 100644
--- a/src/heap/spaces.cc
+++ b/src/heap/spaces.cc
@@ -504,6 +504,7 @@ MemoryChunk* MemoryChunk::Initialize(Heap* heap, Address base, size_t size,
chunk->set_next_chunk(nullptr);
chunk->set_prev_chunk(nullptr);
chunk->local_tracker_ = nullptr;
+ chunk->black_area_end_marker_map_ = nullptr;
DCHECK(OFFSET_OF(MemoryChunk, flags_) == kFlagsOffset);
DCHECK(OFFSET_OF(MemoryChunk, live_byte_count_) == kLiveBytesOffset);
@@ -1286,16 +1287,26 @@ void PagedSpace::EmptyAllocationInfo() {
DCHECK(current_limit == nullptr);
return;
}
- int old_linear_size = static_cast<int>(current_limit - current_top);
- SetTopAndLimit(NULL, NULL);
- if (current_top != current_limit &&
- heap()->incremental_marking()->black_allocation()) {
+
+ if (heap()->incremental_marking()->black_allocation()) {
Page* page = Page::FromAddress(current_top);
- page->markbits()->ClearRange(page->AddressToMarkbitIndex(current_top),
- page->AddressToMarkbitIndex(current_limit));
- page->IncrementLiveBytes(-static_cast<int>(current_limit - current_top));
+ // We have to remember the end of the current black allocation area if
+ // something was allocated in the current bump pointer range.
+ if (allocation_info_.original_top() != current_top) {
+ Address end_black_area = current_top - kPointerSize;
+ page->AddBlackAreaEndMarker(end_black_area);
+ }
+
+ // Clear the bits in the unused black area.
+ if (current_top != current_limit) {
+ page->markbits()->ClearRange(page->AddressToMarkbitIndex(current_top),
+ page->AddressToMarkbitIndex(current_limit));
+ page->IncrementLiveBytes(-static_cast<int>(current_limit - current_top));
+ }
}
- Free(current_top, old_linear_size);
+
+ SetTopAndLimit(NULL, NULL);
+ Free(current_top, static_cast<int>(current_limit - current_top));
}
void PagedSpace::IncreaseCapacity(int size) {
@@ -1310,6 +1321,8 @@ void PagedSpace::ReleasePage(Page* page) {
free_list_.EvictFreeListItems(page);
DCHECK(!free_list_.ContainsPageFreeListItems(page));
+ page->ReleaseBlackAreaEndMarkerMap();
+
if (Page::FromAllocationAreaAddress(allocation_info_.top()) == page) {
allocation_info_.Reset(nullptr, nullptr);
}
« no previous file with comments | « src/heap/spaces.h ('k') | test/cctest/heap/test-heap.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698