Index: src/heap.cc |
diff --git a/src/heap.cc b/src/heap.cc |
index 5713537b5ab301076c51706d77f3eef5e5713970..a58b24c95d1c5af02d824dea16ae2f0857c9f1a4 100644 |
--- a/src/heap.cc |
+++ b/src/heap.cc |
@@ -3451,11 +3451,18 @@ bool Heap::CanMoveObjectStart(HeapObject* object) { |
if (lo_space()->Contains(object)) return false; |
- // We cannot move the object start if the given old space page is |
- // concurrently swept. |
+ Page* page = Page::FromAddress(address); |
+ // We can move the object start if: |
+ // (1) the object is not in old pointer or old data space, |
+ // (2) the page of the object was already swept, |
+ // (3) the page was already concurrently swept. This case is an optimization |
+ // for concurrent sweeping. The WasSwept predicate for concurrently swept |
+ // pages is set after sweeping all pages. |
return (!is_in_old_pointer_space && !is_in_old_data_space) || |
- Page::FromAddress(address)->parallel_sweeping() <= |
- MemoryChunk::PARALLEL_SWEEPING_FINALIZE; |
+ page->WasSwept() || |
+ (mark_compact_collector()->AreSweeperThreadsActivated() && |
+ page->parallel_sweeping() <= |
+ MemoryChunk::PARALLEL_SWEEPING_FINALIZE); |
} |