| Index: src/heap/spaces.cc
|
| diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc
|
| index 3a794a8c6b4417ad4c7faa5b14d3d0510634d3d3..26b29afaeb9816397ad37fb26b671960e6510b72 100644
|
| --- a/src/heap/spaces.cc
|
| +++ b/src/heap/spaces.cc
|
| @@ -395,11 +395,12 @@ void MemoryAllocator::Unmapper::ReconsiderDelayedChunks() {
|
|
|
| bool MemoryAllocator::CanFreeMemoryChunk(MemoryChunk* chunk) {
|
| MarkCompactCollector* mc = isolate_->heap()->mark_compact_collector();
|
| - // We cannot free memory chunks in new space while the sweeper is running
|
| - // since a sweeper thread might be stuck right before trying to lock the
|
| - // corresponding page.
|
| - return !chunk->InNewSpace() || (mc == nullptr) || !FLAG_concurrent_sweeping ||
|
| - mc->sweeper().IsSweepingCompleted();
|
| + // We cannot free a memory chunk in new space while the sweeper is running
|
| + // because the memory chunk can be in the queue of a sweeper task.
|
| + // Chunks in old generation are unmapped if they are empty.
|
| + DCHECK(chunk->InNewSpace() || chunk->SweepingDone());
|
| + return !chunk->InNewSpace() || mc == nullptr || !FLAG_concurrent_sweeping ||
|
| + mc->sweeper().IsSweepingCompleted(NEW_SPACE);
|
| }
|
|
|
| bool MemoryAllocator::CommitMemory(Address base, size_t size,
|
|
|