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

Unified Diff: runtime/vm/scavenger.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/gc_marker.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/scavenger.cc
diff --git a/runtime/vm/scavenger.cc b/runtime/vm/scavenger.cc
index f68145990d582f609f570401a232c8630bebb2d9..ba36ac8fc14adc940060e890107eb839e990c50b 100644
--- a/runtime/vm/scavenger.cc
+++ b/runtime/vm/scavenger.cc
@@ -816,13 +816,18 @@ void Scavenger::Scavenge(bool invoke_api_callbacks) {
int64_t middle = OS::GetCurrentTimeMicros();
{
TIMELINE_FUNCTION_GC_DURATION(thread, "WeakHandleProcessing");
- FinalizationQueue* queue = new FinalizationQueue();
- ScavengerWeakVisitor weak_visitor(thread, this, queue);
- IterateWeakRoots(isolate, &weak_visitor);
- if (queue->length() > 0) {
- Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue));
+ if (FLAG_background_finalization) {
+ FinalizationQueue* queue = new FinalizationQueue();
+ ScavengerWeakVisitor weak_visitor(thread, this, queue);
+ IterateWeakRoots(isolate, &weak_visitor);
+ if (queue->length() > 0) {
+ Dart::thread_pool()->Run(new BackgroundFinalizer(isolate, queue));
+ } else {
+ delete queue;
+ }
} else {
- delete queue;
+ ScavengerWeakVisitor weak_visitor(thread, this, NULL);
+ IterateWeakRoots(isolate, &weak_visitor);
}
}
ProcessWeakReferences();
« no previous file with comments | « runtime/vm/gc_marker.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698