cppgc: young-gen: Gate cpp_heap->FinishSweeping behind runtime flag

Do it conditionally only when young-gen is enabled.

Change-Id: I1bd8ed49302b9e2aef0a60ed7831de9ec1cbe276
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3899308
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Auto-Submit: Anton Bikineev <bikineev@chromium.org>
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/main@{#83241}
This commit is contained in:
Anton Bikineev 2022-09-16 00:46:12 +02:00 committed by V8 LUCI CQ
parent 1256fb0ab0
commit 238278e4ef

View File

@ -2497,7 +2497,11 @@ void Heap::CompleteSweepingYoung(GarbageCollector collector) {
#if defined(CPPGC_YOUNG_GENERATION)
// Always complete sweeping if young generation is enabled.
if (cpp_heap()) CppHeap::From(cpp_heap())->FinishSweepingIfRunning();
if (cpp_heap()) {
if (auto* iheap = CppHeap::From(cpp_heap());
iheap->generational_gc_supported())
iheap->FinishSweepingIfRunning();
}
#endif // defined(CPPGC_YOUNG_GENERATION)
}