diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 400e1e49d6..42307cd84c 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -2140,23 +2140,32 @@ void MarkCompactCollector::ProcessEphemeralMarking( DCHECK(marking_deque()->IsEmpty() && !marking_deque()->overflowed()); bool work_to_do = true; while (work_to_do) { - if (heap_->UsingEmbedderHeapTracer()) { - TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_TRACING); - heap_->RegisterWrappersWithEmbedderHeapTracer(); - heap_->embedder_heap_tracer()->AdvanceTracing( - 0, EmbedderHeapTracer::AdvanceTracingActions( - EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)); - } if (!only_process_harmony_weak_collections) { - TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_OBJECT_GROUPING); - isolate()->global_handles()->IterateObjectGroups( - visitor, &IsUnmarkedHeapObjectWithHeap); - MarkImplicitRefGroups(&MarkCompactMarkingVisitor::MarkObject); + if (heap_->UsingEmbedderHeapTracer()) { + TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_TRACING); + heap_->RegisterWrappersWithEmbedderHeapTracer(); + heap_->embedder_heap_tracer()->AdvanceTracing( + 0, + EmbedderHeapTracer::AdvanceTracingActions( + EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION)); + } else { + TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_OBJECT_GROUPING); + isolate()->global_handles()->IterateObjectGroups( + visitor, &IsUnmarkedHeapObjectWithHeap); + MarkImplicitRefGroups(&MarkCompactMarkingVisitor::MarkObject); + } + } else { + // TODO(mlippautz): We currently do not trace through blink when + // discovering new objects reachable from weak roots (that have been made + // strong). This is a limitation of not having a separate handle type + // that doesn't require zapping before this phase. See crbug.com/668060. + heap_->clear_wrappers_to_trace(); } ProcessWeakCollections(); work_to_do = !marking_deque()->IsEmpty(); ProcessMarkingDeque(); } + CHECK(heap_->MarkingDequesAreEmpty()); } void MarkCompactCollector::ProcessTopOptimizedFrame(ObjectVisitor* visitor) {