Index: src/heap/objects-visiting-inl.h |
diff --git a/src/heap/objects-visiting-inl.h b/src/heap/objects-visiting-inl.h |
index d220118368e77d07b973ec92c701061ddf06b6a5..dcf8a9b02607508d75169d4740ab2321d27a309a 100644 |
--- a/src/heap/objects-visiting-inl.h |
+++ b/src/heap/objects-visiting-inl.h |
@@ -191,6 +191,8 @@ void StaticMarkingVisitor<StaticVisitor>::Initialize() { |
table_.Register(kVisitPropertyCell, &VisitPropertyCell); |
+ table_.Register(kVisitWeakCell, &VisitWeakCell); |
+ |
table_.template RegisterSpecializations<DataObjectVisitor, kVisitDataObject, |
kVisitDataObjectGeneric>(); |
@@ -350,6 +352,22 @@ void StaticMarkingVisitor<StaticVisitor>::VisitPropertyCell( |
template <typename StaticVisitor> |
+void StaticMarkingVisitor<StaticVisitor>::VisitWeakCell(Map* map, |
+ HeapObject* object) { |
+ Heap* heap = map->GetHeap(); |
+ WeakCell* weak_cell = reinterpret_cast<WeakCell*>(object); |
+ Object* undefined = heap->undefined_value(); |
+ // Enqueue weak cell in linked list of encountered weak collections. |
+ // We can ignore weak cells with cleared values because they will always point |
+ // to the undefined_value. |
+ if (weak_cell->next() == undefined && weak_cell->value() != undefined) { |
+ weak_cell->set_next(heap->encountered_weak_cells()); |
+ heap->set_encountered_weak_cells(weak_cell); |
+ } |
+} |
+ |
+ |
+template <typename StaticVisitor> |
void StaticMarkingVisitor<StaticVisitor>::VisitAllocationSite( |
Map* map, HeapObject* object) { |
Heap* heap = map->GetHeap(); |