Index: src/heap/spaces.cc |
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc |
index 5e0a7a86a2aa3751a179ae732f090c63c9a705d1..3a794a8c6b4417ad4c7faa5b14d3d0510634d3d3 100644 |
--- a/src/heap/spaces.cc |
+++ b/src/heap/spaces.cc |
@@ -394,14 +394,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. |
- |
- // Chunks in old generation are unmapped if they are empty. |
- DCHECK(chunk->InNewSpace() || chunk->SweepingDone()); |
- return !chunk->InNewSpace() || !FLAG_concurrent_sweeping || |
- chunk->SweepingDone(); |
+ return !chunk->InNewSpace() || (mc == nullptr) || !FLAG_concurrent_sweeping || |
+ mc->sweeper().IsSweepingCompleted(); |
} |
bool MemoryAllocator::CommitMemory(Address base, size_t size, |