Chromium Code Reviews| Index: src/heap/mark-compact.cc |
| diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc |
| index 847bdac1263db4c9de13aa624e934bb5edcbcdba..c98b433144d192dc2b6056c789f409eceb29b7e7 100644 |
| --- a/src/heap/mark-compact.cc |
| +++ b/src/heap/mark-compact.cc |
| @@ -2078,13 +2078,16 @@ void MarkCompactCollector::ProcessMarkingDeque() { |
| // Mark all objects reachable (transitively) from objects on the marking |
| // stack including references only considered in the atomic marking pause. |
| -void MarkCompactCollector::ProcessEphemeralMarking(ObjectVisitor* visitor) { |
| +void MarkCompactCollector::ProcessEphemeralMarking( |
| + ObjectVisitor* visitor, bool only_process_harmony_weak_collections) { |
| bool work_to_do = true; |
| DCHECK(marking_deque_.IsEmpty()); |
| while (work_to_do) { |
| - isolate()->global_handles()->IterateObjectGroups( |
| - visitor, &IsUnmarkedHeapObjectWithHeap); |
| - MarkImplicitRefGroups(); |
| + if (!only_process_harmony_weak_collections) { |
| + isolate()->global_handles()->IterateObjectGroups( |
| + visitor, &IsUnmarkedHeapObjectWithHeap); |
| + MarkImplicitRefGroups(); |
| + } |
| ProcessWeakCollections(); |
| work_to_do = !marking_deque_.IsEmpty(); |
| ProcessMarkingDeque(); |
| @@ -2196,26 +2199,24 @@ void MarkCompactCollector::MarkLiveObjects() { |
| // The objects reachable from the roots are marked, yet unreachable |
| // objects are unmarked. Mark objects reachable due to host |
| // application specific logic or through Harmony weak maps. |
| - ProcessEphemeralMarking(&root_visitor); |
| + ProcessEphemeralMarking(&root_visitor, false); |
| // The objects reachable from the roots, weak maps or object groups |
| - // are marked, yet unreachable objects are unmarked. Mark objects |
| + // are marked. Objects pointed to only by weak global handles cannot be |
| + // immediately reclaimed. Instead, we have to mark them as pending and mark |
| + // objects reachable from them. |
| // reachable only from weak global handles. |
|
Michael Starzinger
2014/12/02 10:22:42
nit: This dangling part of the sentence looks like
jochen (gone - plz use gerrit)
2014/12/02 10:37:18
done
|
| // |
| // First we identify nonlive weak handles and mark them as pending |
| // destruction. |
| heap()->isolate()->global_handles()->IdentifyWeakHandles( |
| &IsUnmarkedHeapObject); |
| - // Then we mark the objects and process the transitive closure. |
| + // Then we mark the objects. |
| heap()->isolate()->global_handles()->IterateWeakRoots(&root_visitor); |
| - while (marking_deque_.overflowed()) { |
| - RefillMarkingDeque(); |
| - EmptyMarkingDeque(); |
| - } |
| - // Repeat host application specific and Harmony weak maps marking to |
| - // mark unmarked objects reachable from the weak roots. |
| - ProcessEphemeralMarking(&root_visitor); |
| + // Repeat Harmony weak maps marking to mark unmarked objects reachable from |
| + // the weak roots we just marked as pending destruction. |
|
Michael Starzinger
2014/12/02 10:22:42
This requires more explanation as to why we can sk
jochen (gone - plz use gerrit)
2014/12/02 10:37:18
done
|
| + ProcessEphemeralMarking(&root_visitor, true); |
| AfterMarking(); |