[heap] Fix DCHECK failure in Heap::StartIncrementalMarking

When starting incremental marking from an allocation observer, the
DCHECK for AllowGarbageCollection::IsAllowed() fails. We need to
explicitly allow this here in order to use SafepointScope.

Bug: chromium:1271659, v8:11708, v8:12413
Change-Id: I8607a82faed50f8dfffce1e495fb5e715a47bc1b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3293086
Commit-Queue: Dominik Inführ <dinfuehr@chromium.org>
Auto-Submit: Dominik Inführ <dinfuehr@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#77996}
This commit is contained in:
Dominik Inführ 2021-11-19 14:23:13 +01:00 committed by V8 LUCI CQ
parent 7ae0b77628
commit 7e62e2aa60

View File

@ -1910,7 +1910,12 @@ void Heap::StartIncrementalMarking(int gc_flags,
CppHeap::From(cpp_heap())->FinishSweepingIfRunning();
}
SafepointScope safepoint(this);
base::Optional<SafepointScope> safepoint_scope;
{
AllowGarbageCollection allow_shared_gc;
safepoint_scope.emplace(this);
}
#ifdef DEBUG
VerifyCountersAfterSweeping();