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

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

Issue 769253002: Trace how long it takes to compute the weak closure during mark-compact (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: updates Created 6 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 | « src/heap/gc-tracer.cc ('k') | 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/v8.h" 5 #include "src/v8.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/code-stubs.h" 9 #include "src/code-stubs.h"
10 #include "src/compilation-cache.h" 10 #include "src/compilation-cache.h"
(...skipping 2204 matching lines...) Expand 10 before | Expand all | Expand 10 after
2215 } 2215 }
2216 } 2216 }
2217 } 2217 }
2218 } 2218 }
2219 2219
2220 RootMarkingVisitor root_visitor(heap()); 2220 RootMarkingVisitor root_visitor(heap());
2221 MarkRoots(&root_visitor); 2221 MarkRoots(&root_visitor);
2222 2222
2223 ProcessTopOptimizedFrame(&root_visitor); 2223 ProcessTopOptimizedFrame(&root_visitor);
2224 2224
2225 // The objects reachable from the roots are marked, yet unreachable 2225 {
2226 // objects are unmarked. Mark objects reachable due to host 2226 GCTracer::Scope gc_scope(heap()->tracer(), GCTracer::Scope::MC_WEAKCLOSURE);
2227 // application specific logic or through Harmony weak maps.
2228 ProcessEphemeralMarking(&root_visitor, false);
2229 2227
2230 // The objects reachable from the roots, weak maps or object groups 2228 // The objects reachable from the roots are marked, yet unreachable
2231 // are marked. Objects pointed to only by weak global handles cannot be 2229 // objects are unmarked. Mark objects reachable due to host
2232 // immediately reclaimed. Instead, we have to mark them as pending and mark 2230 // application specific logic or through Harmony weak maps.
2233 // objects reachable from them. 2231 ProcessEphemeralMarking(&root_visitor, false);
2234 //
2235 // First we identify nonlive weak handles and mark them as pending
2236 // destruction.
2237 heap()->isolate()->global_handles()->IdentifyWeakHandles(
2238 &IsUnmarkedHeapObject);
2239 // Then we mark the objects.
2240 heap()->isolate()->global_handles()->IterateWeakRoots(&root_visitor);
2241 2232
2242 // Repeat Harmony weak maps marking to mark unmarked objects reachable from 2233 // The objects reachable from the roots, weak maps or object groups
2243 // the weak roots we just marked as pending destruction. 2234 // are marked. Objects pointed to only by weak global handles cannot be
2244 // 2235 // immediately reclaimed. Instead, we have to mark them as pending and mark
2245 // We only process harmony collections, as all object groups have been fully 2236 // objects reachable from them.
2246 // processed and no weakly reachable node can discover new objects groups. 2237 //
2247 ProcessEphemeralMarking(&root_visitor, true); 2238 // First we identify nonlive weak handles and mark them as pending
2239 // destruction.
2240 heap()->isolate()->global_handles()->IdentifyWeakHandles(
2241 &IsUnmarkedHeapObject);
2242 // Then we mark the objects.
2243 heap()->isolate()->global_handles()->IterateWeakRoots(&root_visitor);
2244
2245 // Repeat Harmony weak maps marking to mark unmarked objects reachable from
2246 // the weak roots we just marked as pending destruction.
2247 //
2248 // We only process harmony collections, as all object groups have been fully
2249 // processed and no weakly reachable node can discover new objects groups.
2250 ProcessEphemeralMarking(&root_visitor, true);
2251 }
2248 2252
2249 AfterMarking(); 2253 AfterMarking();
2250 2254
2251 if (FLAG_print_cumulative_gc_stat) { 2255 if (FLAG_print_cumulative_gc_stat) {
2252 heap_->tracer()->AddMarkingTime(base::OS::TimeCurrentMillis() - start_time); 2256 heap_->tracer()->AddMarkingTime(base::OS::TimeCurrentMillis() - start_time);
2253 } 2257 }
2254 } 2258 }
2255 2259
2256 2260
2257 void MarkCompactCollector::AfterMarking() { 2261 void MarkCompactCollector::AfterMarking() {
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
4435 SlotsBuffer* buffer = *buffer_address; 4439 SlotsBuffer* buffer = *buffer_address;
4436 while (buffer != NULL) { 4440 while (buffer != NULL) {
4437 SlotsBuffer* next_buffer = buffer->next(); 4441 SlotsBuffer* next_buffer = buffer->next();
4438 DeallocateBuffer(buffer); 4442 DeallocateBuffer(buffer);
4439 buffer = next_buffer; 4443 buffer = next_buffer;
4440 } 4444 }
4441 *buffer_address = NULL; 4445 *buffer_address = NULL;
4442 } 4446 }
4443 } 4447 }
4444 } // namespace v8::internal 4448 } // namespace v8::internal
OLDNEW
« no previous file with comments | « src/heap/gc-tracer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698