Commit f6b185ca authored by Leszek Swirski's avatar Leszek Swirski Committed by Commit Bot

[offthread] Ensure off-thread page marking bits are right

Ensure that the off-thread pages' marking bits (including the page
headers) are correct, and synchronised correctly on merge.

Bug: chromium:1011762
Change-Id: I46c66fb35d49d39eb0da3513c869baf49c366706
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2110020
Commit-Queue: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#66805}
parent d745a1e3
...@@ -6666,7 +6666,7 @@ bool Heap::PageFlagsAreConsistent(HeapObject object) { ...@@ -6666,7 +6666,7 @@ bool Heap::PageFlagsAreConsistent(HeapObject object) {
CHECK_EQ(chunk->InReadOnlySpace(), slim_chunk->InReadOnlySpace()); CHECK_EQ(chunk->InReadOnlySpace(), slim_chunk->InReadOnlySpace());
// Marking consistency. // Marking consistency.
if (chunk->IsWritable()) { if (chunk->IsWritable() && !Heap::InOffThreadSpace(object)) {
// RO_SPACE can be shared between heaps, so we can't use RO_SPACE objects to // RO_SPACE can be shared between heaps, so we can't use RO_SPACE objects to
// find a heap. The exception is when the ReadOnlySpace is writeable, during // find a heap. The exception is when the ReadOnlySpace is writeable, during
// bootstrapping, so explicitly allow this case. // bootstrapping, so explicitly allow this case.
......
...@@ -169,8 +169,7 @@ void OffThreadFactory::Publish(Isolate* isolate) { ...@@ -169,8 +169,7 @@ void OffThreadFactory::Publish(Isolate* isolate) {
isolate->factory()->InternalizeString(string_handle); isolate->factory()->InternalizeString(string_handle);
// Recalculate the slot in case there was GC and the holder moved. // Recalculate the slot in case there was GC and the holder moved.
ObjectSlot slot(heap_object_handles[i]->ptr() + ObjectSlot slot(heap_object_handles[i]->ptr() + slot_offset);
string_slots_[i].slot_offset);
DCHECK(string_handle->IsThinString() || DCHECK(string_handle->IsThinString() ||
string_handle->IsInternalizedString()); string_handle->IsInternalizedString());
......
...@@ -762,7 +762,8 @@ Page* PagedSpace::InitializePage(MemoryChunk* chunk) { ...@@ -762,7 +762,8 @@ Page* PagedSpace::InitializePage(MemoryChunk* chunk) {
page->area_size()); page->area_size());
// Make sure that categories are initialized before freeing the area. // Make sure that categories are initialized before freeing the area.
page->ResetAllocationStatistics(); page->ResetAllocationStatistics();
page->SetOldGenerationPageFlags(heap()->incremental_marking()->IsMarking()); page->SetOldGenerationPageFlags(!is_off_thread_space() &&
heap()->incremental_marking()->IsMarking());
page->AllocateFreeListCategories(); page->AllocateFreeListCategories();
page->InitializeFreeListCategories(); page->InitializeFreeListCategories();
page->list_node().Initialize(); page->list_node().Initialize();
...@@ -1744,6 +1745,7 @@ void PagedSpace::MergeLocalSpace(LocalSpace* other) { ...@@ -1744,6 +1745,7 @@ void PagedSpace::MergeLocalSpace(LocalSpace* other) {
if (merging_from_off_thread) { if (merging_from_off_thread) {
DCHECK_NULL(p->sweeping_slot_set()); DCHECK_NULL(p->sweeping_slot_set());
p->SetOldGenerationPageFlags(heap()->incremental_marking()->IsMarking());
if (heap()->incremental_marking()->black_allocation()) { if (heap()->incremental_marking()->black_allocation()) {
p->CreateBlackArea(p->area_start(), p->HighWaterMark()); p->CreateBlackArea(p->area_start(), p->HighWaterMark());
} }
...@@ -1912,7 +1914,7 @@ int PagedSpace::CountTotalPages() { ...@@ -1912,7 +1914,7 @@ int PagedSpace::CountTotalPages() {
void PagedSpace::SetLinearAllocationArea(Address top, Address limit) { void PagedSpace::SetLinearAllocationArea(Address top, Address limit) {
SetTopAndLimit(top, limit); SetTopAndLimit(top, limit);
if (top != kNullAddress && top != limit && if (top != kNullAddress && top != limit && !is_off_thread_space() &&
heap()->incremental_marking()->black_allocation()) { heap()->incremental_marking()->black_allocation()) {
Page::FromAllocationAreaAddress(top)->CreateBlackArea(top, limit); Page::FromAllocationAreaAddress(top)->CreateBlackArea(top, limit);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment