Index: src/heap/heap.cc |
diff --git a/src/heap/heap.cc b/src/heap/heap.cc |
index 9c6a2a1690cdba36130ba3147302a84acf43d45d..5139c2177f8e1e85e50cec0ae70cc6ebcba0b20d 100644 |
--- a/src/heap/heap.cc |
+++ b/src/heap/heap.cc |
@@ -4622,10 +4622,23 @@ void Heap::ReduceNewSpaceSize() { |
} |
+void Heap::FinalizeIncrementalMarkingIfComplete(const char* comment) { |
+ if (FLAG_overapproximate_weak_closure && incremental_marking()->IsMarking() && |
+ (incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
+ (!incremental_marking()->weak_closure_was_overapproximated() && |
+ mark_compact_collector_.marking_deque()->IsEmpty()))) { |
+ OverApproximateWeakClosure(comment); |
+ } else if (incremental_marking()->IsComplete() || |
+ (mark_compact_collector_.marking_deque()->IsEmpty())) { |
+ CollectAllGarbage(current_gc_flags_, comment); |
+ } |
+} |
+ |
+ |
bool Heap::TryFinalizeIdleIncrementalMarking( |
double idle_time_in_ms, size_t size_of_objects, |
size_t final_incremental_mark_compact_speed_in_bytes_per_ms) { |
- if (FLAG_overapproximate_weak_closure && |
+ if (FLAG_overapproximate_weak_closure && incremental_marking()->IsMarking() && |
(incremental_marking()->IsReadyToOverApproximateWeakClosure() || |
(!incremental_marking()->weak_closure_was_overapproximated() && |
mark_compact_collector_.marking_deque()->IsEmpty() && |