Commit 37e3cac7 authored by Dominik Inführ's avatar Dominik Inführ Committed by Commit Bot

[heap] Do not verify slots in concurrent sweeper

Cannot verify whether slots are cleared from a concurrent sweeping task,
the OLD_TO_NEW remembered set is owned by the main thread.

Bug: v8:10562
Change-Id: I0c880f7f96350aa35b44d2966c9621576825374c
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2215820
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: 's avatarUlan Degenbaev <ulan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#68098}
parent f8439175
...@@ -3032,6 +3032,13 @@ HeapObject Heap::CreateFillerObjectAt(ReadOnlyRoots roots, Address addr, ...@@ -3032,6 +3032,13 @@ HeapObject Heap::CreateFillerObjectAt(ReadOnlyRoots roots, Address addr,
return filler; return filler;
} }
void Heap::CreateFillerObjectFromSweeper(
Address addr, int size, ClearFreedMemoryMode clear_memory_mode) {
CreateFillerObjectAtImpl(ReadOnlyRoots(this), addr, size, clear_memory_mode);
// Do not verify whether slots are cleared here: the concurrent sweeper is not
// allowed to access the main thread's remembered set.
}
HeapObject Heap::CreateFillerObjectAt(Address addr, int size, HeapObject Heap::CreateFillerObjectAt(Address addr, int size,
ClearRecordedSlots clear_slots_mode) { ClearRecordedSlots clear_slots_mode) {
if (size == 0) return HeapObject(); if (size == 0) return HeapObject();
......
...@@ -474,6 +474,9 @@ class Heap { ...@@ -474,6 +474,9 @@ class Heap {
V8_EXPORT_PRIVATE HeapObject CreateFillerObjectAt( V8_EXPORT_PRIVATE HeapObject CreateFillerObjectAt(
Address addr, int size, ClearRecordedSlots clear_slots_mode); Address addr, int size, ClearRecordedSlots clear_slots_mode);
void CreateFillerObjectFromSweeper(Address addr, int size,
ClearFreedMemoryMode clear_memory_mode);
template <typename T> template <typename T>
void CreateFillerForArray(T object, int elements_to_trim, int bytes_to_trim); void CreateFillerForArray(T object, int elements_to_trim, int bytes_to_trim);
......
...@@ -265,14 +265,15 @@ V8_INLINE size_t Sweeper::FreeAndProcessFreedMemory( ...@@ -265,14 +265,15 @@ V8_INLINE size_t Sweeper::FreeAndProcessFreedMemory(
if (free_space_mode == ZAP_FREE_SPACE) { if (free_space_mode == ZAP_FREE_SPACE) {
ZapCode(free_start, size); ZapCode(free_start, size);
} }
ClearFreedMemoryMode clear_memory_mode =
(free_list_mode == REBUILD_FREE_LIST)
? ClearFreedMemoryMode::kDontClearFreedMemory
: ClearFreedMemoryMode::kClearFreedMemory;
page->heap()->CreateFillerObjectFromSweeper(
free_start, static_cast<int>(size), clear_memory_mode);
if (free_list_mode == REBUILD_FREE_LIST) { if (free_list_mode == REBUILD_FREE_LIST) {
freed_bytes = reinterpret_cast<PagedSpace*>(space)->Free( freed_bytes =
free_start, size, SpaceAccountingMode::kSpaceUnaccounted); reinterpret_cast<PagedSpace*>(space)->UnaccountedFree(free_start, size);
} else {
Heap::CreateFillerObjectAt(ReadOnlyRoots(page->heap()), free_start,
static_cast<int>(size),
ClearFreedMemoryMode::kClearFreedMemory);
} }
if (should_reduce_memory_) page->DiscardUnusedMemory(free_start, size); if (should_reduce_memory_) page->DiscardUnusedMemory(free_start, size);
......
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