[heap] Allow Heap::ClearRecordedSlotRange in SHARED_SPACE

During String::MakeThin, Heap::ClearRecordedSlotRange might be
invoked on a string in SHARED_SPACE. This can also happen outside
GCs.

Bug: v8:13267
Change-Id: I10d4d7f0b47589127e4a080ce49d69ca7486fc67
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3985911
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Auto-Submit: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Patrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83962}
This commit is contained in:
Dominik Inführ 2022-10-27 15:22:29 +02:00 committed by V8 LUCI CQ
parent b35d549082
commit b799750f0a

View File

@ -6231,11 +6231,10 @@ void Heap::ClearRecordedSlotRange(Address start, Address end) {
Page* page = Page::FromAddress(start);
DCHECK(!page->IsLargePage());
if (!page->InYoungGeneration()) {
// Shared GCs will invoke this method on objects in the shared heap for
// string forwarding.
DCHECK(
page->owner_identity() == OLD_SPACE ||
(page->owner_identity() == SHARED_SPACE && gc_state() == MARK_COMPACT));
// This method will be invoked on objects in shared space for
// internalization and string forwarding during GC.
DCHECK(page->owner_identity() == OLD_SPACE ||
page->owner_identity() == SHARED_SPACE);
if (!page->SweepingDone()) {
RememberedSet<OLD_TO_NEW>::RemoveRange(page, start, end,