Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: src/heap/mark-compact.cc

Issue 2580813002: [heap] Do not trace through blink after making weak roots strong for finalizers (Closed)
Patch Set: Created 4 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "src/heap/mark-compact.h" 5 #include "src/heap/mark-compact.h"
6 6
7 #include "src/base/atomicops.h" 7 #include "src/base/atomicops.h"
8 #include "src/base/bits.h" 8 #include "src/base/bits.h"
9 #include "src/base/sys-info.h" 9 #include "src/base/sys-info.h"
10 #include "src/code-stubs.h" 10 #include "src/code-stubs.h"
(...skipping 2122 matching lines...) Expand 10 before | Expand all | Expand 10 after
2133 DCHECK(marking_deque()->IsEmpty()); 2133 DCHECK(marking_deque()->IsEmpty());
2134 } 2134 }
2135 2135
2136 // Mark all objects reachable (transitively) from objects on the marking 2136 // Mark all objects reachable (transitively) from objects on the marking
2137 // stack including references only considered in the atomic marking pause. 2137 // stack including references only considered in the atomic marking pause.
2138 void MarkCompactCollector::ProcessEphemeralMarking( 2138 void MarkCompactCollector::ProcessEphemeralMarking(
2139 ObjectVisitor* visitor, bool only_process_harmony_weak_collections) { 2139 ObjectVisitor* visitor, bool only_process_harmony_weak_collections) {
2140 DCHECK(marking_deque()->IsEmpty() && !marking_deque()->overflowed()); 2140 DCHECK(marking_deque()->IsEmpty() && !marking_deque()->overflowed());
2141 bool work_to_do = true; 2141 bool work_to_do = true;
2142 while (work_to_do) { 2142 while (work_to_do) {
2143 if (heap_->UsingEmbedderHeapTracer()) {
2144 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_TRACING);
2145 heap_->RegisterWrappersWithEmbedderHeapTracer();
2146 heap_->embedder_heap_tracer()->AdvanceTracing(
2147 0, EmbedderHeapTracer::AdvanceTracingActions(
2148 EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
2149 }
2150 if (!only_process_harmony_weak_collections) { 2143 if (!only_process_harmony_weak_collections) {
2151 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_OBJECT_GROUPING); 2144 if (heap_->UsingEmbedderHeapTracer()) {
2152 isolate()->global_handles()->IterateObjectGroups( 2145 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_WRAPPER_TRACING);
2153 visitor, &IsUnmarkedHeapObjectWithHeap); 2146 heap_->RegisterWrappersWithEmbedderHeapTracer();
2154 MarkImplicitRefGroups(&MarkCompactMarkingVisitor::MarkObject); 2147 heap_->embedder_heap_tracer()->AdvanceTracing(
2148 0,
2149 EmbedderHeapTracer::AdvanceTracingActions(
2150 EmbedderHeapTracer::ForceCompletionAction::FORCE_COMPLETION));
2151 } else {
2152 TRACE_GC(heap()->tracer(), GCTracer::Scope::MC_MARK_OBJECT_GROUPING);
2153 isolate()->global_handles()->IterateObjectGroups(
2154 visitor, &IsUnmarkedHeapObjectWithHeap);
2155 MarkImplicitRefGroups(&MarkCompactMarkingVisitor::MarkObject);
2156 }
2157 } else {
2158 // TODO(mlippautz): We currently do not trace through blink when
2159 // discovering new objects reachable from weak roots (that have been made
2160 // strong). This is a limitation of not having a separate handle type
2161 // that doesn't require zapping before this phase. See crbug.com/668060.
2162 heap_->clear_wrappers_to_trace();
2155 } 2163 }
2156 ProcessWeakCollections(); 2164 ProcessWeakCollections();
2157 work_to_do = !marking_deque()->IsEmpty(); 2165 work_to_do = !marking_deque()->IsEmpty();
2158 ProcessMarkingDeque<MarkCompactMode::FULL>(); 2166 ProcessMarkingDeque<MarkCompactMode::FULL>();
2159 } 2167 }
2168 CHECK(heap_->MarkingDequesAreEmpty());
2160 } 2169 }
2161 2170
2162 void MarkCompactCollector::ProcessTopOptimizedFrame(ObjectVisitor* visitor) { 2171 void MarkCompactCollector::ProcessTopOptimizedFrame(ObjectVisitor* visitor) {
2163 for (StackFrameIterator it(isolate(), isolate()->thread_local_top()); 2172 for (StackFrameIterator it(isolate(), isolate()->thread_local_top());
2164 !it.done(); it.Advance()) { 2173 !it.done(); it.Advance()) {
2165 if (it.frame()->type() == StackFrame::JAVA_SCRIPT) { 2174 if (it.frame()->type() == StackFrame::JAVA_SCRIPT) {
2166 return; 2175 return;
2167 } 2176 }
2168 if (it.frame()->type() == StackFrame::OPTIMIZED) { 2177 if (it.frame()->type() == StackFrame::OPTIMIZED) {
2169 Code* code = it.frame()->LookupCode(); 2178 Code* code = it.frame()->LookupCode();
(...skipping 1909 matching lines...) Expand 10 before | Expand all | Expand 10 after
4079 // The target is always in old space, we don't have to record the slot in 4088 // The target is always in old space, we don't have to record the slot in
4080 // the old-to-new remembered set. 4089 // the old-to-new remembered set.
4081 DCHECK(!heap()->InNewSpace(target)); 4090 DCHECK(!heap()->InNewSpace(target));
4082 RecordRelocSlot(host, &rinfo, target); 4091 RecordRelocSlot(host, &rinfo, target);
4083 } 4092 }
4084 } 4093 }
4085 } 4094 }
4086 4095
4087 } // namespace internal 4096 } // namespace internal
4088 } // namespace v8 4097 } // namespace v8
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698