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

Unified Diff: runtime/vm/isolate.cc

Issue 2012973002: Background finalization. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 7 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
Index: runtime/vm/isolate.cc
diff --git a/runtime/vm/isolate.cc b/runtime/vm/isolate.cc
index 8ed08737a0cdfbcf2035f1acc675afbb7ab959c8..f18a7e810132171fe849d70d4b27c31be7bcfc49 100644
--- a/runtime/vm/isolate.cc
+++ b/runtime/vm/isolate.cc
@@ -1552,7 +1552,7 @@ class FinalizeWeakPersistentHandlesVisitor : public HandleVisitor {
void VisitHandle(uword addr) {
FinalizablePersistentHandle* handle =
reinterpret_cast<FinalizablePersistentHandle*>(addr);
- handle->UpdateUnreachable(thread()->isolate());
+ handle->UpdateUnreachableFinalizeNow(thread()->isolate());
}
private:
@@ -1675,10 +1675,20 @@ void Isolate::Shutdown() {
if (heap_ != NULL) {
// Wait for any concurrent GC tasks to finish before shutting down.
// TODO(koda): Support faster sweeper shutdown (e.g., after current page).
- PageSpace* old_space = heap_->old_space();
- MonitorLocker ml(old_space->tasks_lock());
- while (old_space->tasks() > 0) {
- ml.Wait();
+ {
+ PageSpace* old_space = heap_->old_space();
+ MonitorLocker ml(old_space->tasks_lock());
+ while (old_space->tasks() > 0) {
+ ml.Wait();
+ }
+ }
+
+ // Wait for background finalization to finish before shutting down.
+ {
+ MonitorLocker ml(heap_->finalization_tasks_lock());
+ while (heap_->finalization_tasks() > 0) {
+ ml.Wait();
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698