Index: src/mark-compact.cc |
diff --git a/src/mark-compact.cc b/src/mark-compact.cc |
index 9dbadacfb86b49785a7c78c43c8b5087f555fbc8..367b65a9e5fe4042e21fab914d28ceb9d4b09c39 100644 |
--- a/src/mark-compact.cc |
+++ b/src/mark-compact.cc |
@@ -968,6 +968,7 @@ void MarkCompactCollector::Prepare() { |
if (was_marked_incrementally_ && abort_incremental_marking_) { |
heap()->incremental_marking()->Abort(); |
ClearMarkbits(); |
+ AbortWeakCollections(); |
AbortCompaction(); |
was_marked_incrementally_ = false; |
} |
@@ -2800,6 +2801,20 @@ void MarkCompactCollector::ClearWeakCollections() { |
} |
+void MarkCompactCollector::AbortWeakCollections() { |
+ GCTracer::Scope gc_scope(heap()->tracer(), |
+ GCTracer::Scope::MC_WEAKCOLLECTION_ABORT); |
+ Object* weak_collection_obj = heap()->encountered_weak_collections(); |
+ while (weak_collection_obj != Smi::FromInt(0)) { |
+ JSWeakCollection* weak_collection = |
+ reinterpret_cast<JSWeakCollection*>(weak_collection_obj); |
+ weak_collection_obj = weak_collection->next(); |
+ weak_collection->set_next(heap()->undefined_value()); |
+ } |
+ heap()->set_encountered_weak_collections(Smi::FromInt(0)); |
+} |
+ |
+ |
void MarkCompactCollector::RecordMigratedSlot(Object* value, Address slot) { |
if (heap_->InNewSpace(value)) { |
heap_->store_buffer()->Mark(slot); |