Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 5dab9451677bf2c340bb075aadbbd2c6a541dc13..afdc7bb4cd397d69625ecdca09c295a668e0a6ae 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -893,8 +893,7 @@ |
isolate()->optimizing_compile_dispatcher()->Flush(); |
} |
isolate()->ClearSerializerData(); |
- set_current_gc_flags(kAbortIncrementalMarkingMask | |
- kReduceMemoryFootprintMask); |
+ set_current_gc_flags(kMakeHeapIterableMask | kReduceMemoryFootprintMask); |
isolate_->compilation_cache()->Clear(); |
const int kMaxNumberOfAttempts = 7; |
const int kMinNumberOfAttempts = 2; |
@@ -4033,10 +4032,22 @@ |
} |
+bool Heap::IsHeapIterable() { |
+ // TODO(hpayer): This function is not correct. Allocation folding in old |
+ // space breaks the iterability. |
+ return new_space_top_after_last_gc_ == new_space()->top(); |
+} |
+ |
+ |
void Heap::MakeHeapIterable() { |
+ DCHECK(AllowHeapAllocation::IsAllowed()); |
+ if (!IsHeapIterable()) { |
+ CollectAllGarbage(kMakeHeapIterableMask, "Heap::MakeHeapIterable"); |
+ } |
if (mark_compact_collector()->sweeping_in_progress()) { |
mark_compact_collector()->EnsureSweepingCompleted(); |
} |
+ DCHECK(IsHeapIterable()); |
} |
@@ -4581,7 +4592,10 @@ |
CHECK(HasBeenSetUp()); |
HandleScope scope(isolate()); |
- MakeHeapIterable(); |
+ if (mark_compact_collector()->sweeping_in_progress()) { |
+ // We have to wait here for the sweeper threads to have an iterable heap. |
+ mark_compact_collector()->EnsureSweepingCompleted(); |
+ } |
VerifyPointersVisitor visitor; |
IterateRoots(&visitor, VISIT_ONLY_STRONG); |