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

Unified Diff: runtime/vm/gc_marker.cc

Issue 18826007: Reland r24563 and r24564 with fixes cumbersome API leading to leaks. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 7 years, 5 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.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/gc_marker.cc
===================================================================
--- runtime/vm/gc_marker.cc (revision 24817)
+++ runtime/vm/gc_marker.cc (working copy)
@@ -379,18 +379,21 @@
}
-void GCMarker::ProcessPeerReferents(PageSpace* page_space) {
- PageSpace::PeerTable* peer_table = page_space->GetPeerTable();
- PageSpace::PeerTable::iterator it = peer_table->begin();
- while (it != peer_table->end()) {
- RawObject* raw_obj = it->first;
- ASSERT(raw_obj->IsHeapObject());
- if (raw_obj->IsMarked()) {
- // The object has survived. Do nothing.
- ++it;
- } else {
- // The object has become garbage. Remove its record.
- peer_table->erase(it++);
+void GCMarker::ProcessWeakTables(PageSpace* page_space) {
+ for (int sel = 0;
+ sel < Heap::kNumWeakSelectors;
+ sel++) {
+ WeakTable* table = heap_->GetWeakTable(
+ Heap::kOld, static_cast<Heap::WeakSelector>(sel));
+ intptr_t size = table->size();
+ for (intptr_t i = 0; i < size; i++) {
+ if (table->IsValidEntryAt(i)) {
+ RawObject* raw_obj = table->ObjectAt(i);
+ ASSERT(raw_obj->IsHeapObject());
+ if (!raw_obj->IsMarked()) {
+ table->InvalidateAt(i);
+ }
+ }
}
}
}
@@ -408,7 +411,7 @@
MarkingWeakVisitor mark_weak;
IterateWeakRoots(isolate, &mark_weak, invoke_api_callbacks);
mark.Finalize();
- ProcessPeerReferents(page_space);
+ ProcessWeakTables(page_space);
Epilogue(isolate, invoke_api_callbacks);
}
« no previous file with comments | « runtime/vm/gc_marker.h ('k') | runtime/vm/heap.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698