diff --git a/src/heap/heap.cc b/src/heap/heap.cc index f8fb0667b9..c620d899b8 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -4481,10 +4481,10 @@ void Heap::FinalizeIncrementalMarkingIfComplete( } void Heap::RegisterDeserializedObjectsForBlackAllocation( - Reservation* reservations, List* large_objects) { - // TODO(hpayer): We do not have to iterate reservations on black objects - // for marking. We just have to execute the special visiting side effect - // code that adds objects to global data structures, e.g. for array buffers. + Reservation* reservations, List* large_objects, + List
* maps) { + // TODO(ulan): pause black allocation during deserialization to avoid + // iterating all these objects in one go. if (!incremental_marking()->black_allocation()) return; @@ -4514,6 +4514,12 @@ void Heap::RegisterDeserializedObjectsForBlackAllocation( for (HeapObject* object : *large_objects) { incremental_marking()->ProcessBlackAllocatedObject(object); } + + // Map space doesn't use reservations, so it needs custom handling. + for (Address addr : *maps) { + incremental_marking()->ProcessBlackAllocatedObject( + HeapObject::FromAddress(addr)); + } } void Heap::NotifyObjectLayoutChange(HeapObject* object, diff --git a/src/heap/heap.h b/src/heap/heap.h index f33df448c0..65037d2821 100644 --- a/src/heap/heap.h +++ b/src/heap/heap.h @@ -1184,7 +1184,8 @@ class Heap { void FinalizeIncrementalMarkingIfComplete(GarbageCollectionReason gc_reason); void RegisterDeserializedObjectsForBlackAllocation( - Reservation* reservations, List* large_objects); + Reservation* reservations, List* large_objects, + List
* maps); IncrementalMarking* incremental_marking() { return incremental_marking_; } diff --git a/src/snapshot/deserializer.cc b/src/snapshot/deserializer.cc index a01fa67c88..a0c26aa4a2 100644 --- a/src/snapshot/deserializer.cc +++ b/src/snapshot/deserializer.cc @@ -153,7 +153,7 @@ MaybeHandle Deserializer::DeserializePartial( DeserializeEmbedderFields(embedder_fields_deserializer); isolate->heap()->RegisterDeserializedObjectsForBlackAllocation( - reservations_, &deserialized_large_objects_); + reservations_, &deserialized_large_objects_, &allocated_maps_); // There's no code deserialized here. If this assert fires then that's // changed and logging should be added to notify the profiler et al of the @@ -181,7 +181,7 @@ MaybeHandle Deserializer::DeserializeObject(Isolate* isolate) { FlushICacheForNewCodeObjectsAndRecordEmbeddedObjects(); result = Handle(HeapObject::cast(root)); isolate->heap()->RegisterDeserializedObjectsForBlackAllocation( - reservations_, &deserialized_large_objects_); + reservations_, &deserialized_large_objects_, &allocated_maps_); } CommitPostProcessedObjects(isolate); return scope.CloseAndEscape(result);