Index: src/heap/spaces.cc |
diff --git a/src/heap/spaces.cc b/src/heap/spaces.cc |
index d78d621cda40447408cab4ec260ecbdf0a8f37a3..9d5ac8ca4a46ecc7c88d0a066277952659e9ebe3 100644 |
--- a/src/heap/spaces.cc |
+++ b/src/heap/spaces.cc |
@@ -394,14 +394,12 @@ |
} |
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, |