diff --git a/src/heap/heap.cc b/src/heap/heap.cc index bd8734b331..1b4c11179e 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -639,6 +639,7 @@ void Heap::GarbageCollectionPrologue() { ephemeron_retainer_.clear(); retaining_root_.clear(); } + memory_allocator()->unmapper()->PrepareForGC(); } size_t Heap::SizeOfObjects() { diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 044dfd8fcd..77534b921d 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -796,8 +796,6 @@ void MarkCompactCollector::Prepare() { heap()->incremental_marking()->Stop(); } - heap()->memory_allocator()->unmapper()->PrepareForMarkCompact(); - if (!was_marked_incrementally_) { TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_EMBEDDER_PROLOGUE); heap_->local_embedder_heap_tracer()->TracePrologue(); diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc index eaed6c51c4..32a2973801 100644 --- a/src/heap/spaces.cc +++ b/src/heap/spaces.cc @@ -307,8 +307,7 @@ void MemoryAllocator::Unmapper::CancelAndWaitForPendingTasks() { } } -void MemoryAllocator::Unmapper::PrepareForMarkCompact() { - CancelAndWaitForPendingTasks(); +void MemoryAllocator::Unmapper::PrepareForGC() { // Free non-regular chunks because they cannot be re-used. PerformFreeMemoryOnQueuedNonRegularChunks(); } diff --git a/src/heap/spaces.h b/src/heap/spaces.h index c0bcf3250b..877672564f 100644 --- a/src/heap/spaces.h +++ b/src/heap/spaces.h @@ -1250,7 +1250,7 @@ class V8_EXPORT_PRIVATE MemoryAllocator { V8_EXPORT_PRIVATE void FreeQueuedChunks(); void CancelAndWaitForPendingTasks(); - void PrepareForMarkCompact(); + void PrepareForGC(); void EnsureUnmappingCompleted(); V8_EXPORT_PRIVATE void TearDown(); size_t NumberOfCommittedChunks();