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); |
} |