| Index: src/mark-compact.cc
|
| diff --git a/src/mark-compact.cc b/src/mark-compact.cc
|
| index 0f6a5663fbdc5a683987f9c92d306b2609286aa7..29ed215e75547bd7b55f6820320a3440c3f6d829 100644
|
| --- a/src/mark-compact.cc
|
| +++ b/src/mark-compact.cc
|
| @@ -1152,9 +1152,10 @@ class StaticMarkingVisitor : public StaticVisitorBase {
|
| JSWeakMap* weak_map = reinterpret_cast<JSWeakMap*>(object);
|
|
|
| // Enqueue weak map in linked list of encountered weak maps.
|
| - ASSERT(weak_map->next() == Smi::FromInt(0));
|
| - weak_map->set_next(collector->encountered_weak_maps());
|
| - collector->set_encountered_weak_maps(weak_map);
|
| + if (weak_map->next() == Smi::FromInt(0)) {
|
| + weak_map->set_next(collector->encountered_weak_maps());
|
| + collector->set_encountered_weak_maps(weak_map);
|
| + }
|
|
|
| // Skip visiting the backing hash table containing the mappings.
|
| int object_size = JSWeakMap::BodyDescriptor::SizeOf(map, object);
|
| @@ -1170,9 +1171,15 @@ class StaticMarkingVisitor : public StaticVisitorBase {
|
| object_size);
|
|
|
| // Mark the backing hash table without pushing it on the marking stack.
|
| - ObjectHashTable* table = ObjectHashTable::cast(weak_map->table());
|
| - ASSERT(!MarkCompactCollector::IsMarked(table));
|
| - collector->SetMark(table, Marking::MarkBitFrom(table));
|
| + Object* table_object = weak_map->table();
|
| + if (!table_object->IsHashTable()) return;
|
| + ObjectHashTable* table = ObjectHashTable::cast(table_object);
|
| + Object** table_slot =
|
| + HeapObject::RawField(weak_map, JSWeakMap::kTableOffset);
|
| + MarkBit table_mark = Marking::MarkBitFrom(table);
|
| + collector->RecordSlot(table_slot, table_slot, table);
|
| + if (!table_mark.Get()) collector->SetMark(table, table_mark);
|
| + // Recording the map slot can be skipped, because maps are not compacted.
|
| collector->MarkObject(table->map(), Marking::MarkBitFrom(table->map()));
|
| ASSERT(MarkCompactCollector::IsMarked(table->map()));
|
| }
|
|
|