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

Unified Diff: runtime/vm/gc_marker.cc

Issue 2091023002: Add flag to control background finalization. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/flag_list.h ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/gc_marker.cc
diff --git a/runtime/vm/gc_marker.cc b/runtime/vm/gc_marker.cc
index a7fd2483f3bf5307183f2bd33e5bed9b7eb93b35..ae0e205e851341e58a53dc861599574a088a04c6 100644
--- a/runtime/vm/gc_marker.cc
+++ b/runtime/vm/gc_marker.cc
@@ -708,13 +708,18 @@ void GCMarker::MarkObjects(Isolate* isolate,
mark.DrainMarkingStack();
{
TIMELINE_FUNCTION_GC_DURATION(thread, "WeakHandleProcessing");
- FinalizationQueue* queue = new FinalizationQueue();
- MarkingWeakVisitor mark_weak(thread, queue);
- IterateWeakRoots(isolate, &mark_weak);
- if (queue->length() > 0) {
- Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue));
+ if (FLAG_background_finalization) {
+ FinalizationQueue* queue = new FinalizationQueue();
+ MarkingWeakVisitor mark_weak(thread, queue);
+ IterateWeakRoots(isolate, &mark_weak);
+ if (queue->length() > 0) {
+ Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue));
+ } else {
+ delete queue;
+ }
} else {
- delete queue;
+ MarkingWeakVisitor mark_weak(thread, NULL);
+ IterateWeakRoots(isolate, &mark_weak);
}
}
// All marking done; detach code, etc.
@@ -751,13 +756,18 @@ void GCMarker::MarkObjects(Isolate* isolate,
// Phase 2: Weak processing on main thread.
{
TIMELINE_FUNCTION_GC_DURATION(thread, "WeakHandleProcessing");
- FinalizationQueue* queue = new FinalizationQueue();
- MarkingWeakVisitor mark_weak(thread, queue);
- IterateWeakRoots(isolate, &mark_weak);
- if (queue->length() > 0) {
- Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue));
+ if (FLAG_background_finalization) {
+ FinalizationQueue* queue = new FinalizationQueue();
+ MarkingWeakVisitor mark_weak(thread, queue);
+ IterateWeakRoots(isolate, &mark_weak);
+ if (queue->length() > 0) {
+ Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue));
+ } else {
+ delete queue;
+ }
} else {
- delete queue;
+ MarkingWeakVisitor mark_weak(thread, NULL);
+ IterateWeakRoots(isolate, &mark_weak);
}
}
barrier.Sync();
« no previous file with comments | « runtime/vm/flag_list.h ('k') | runtime/vm/scavenger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698