diff --git a/src/heap/heap.cc b/src/heap/heap.cc index 0ee88a0398..627a829b83 100644 --- a/src/heap/heap.cc +++ b/src/heap/heap.cc @@ -3109,6 +3109,7 @@ void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) { // update while using HeapIterator because the iterator is temporarily // marking the whole object graph, without updating live bytes. if (!in_heap_iterator() && + !mark_compact_collector()->sweeping_in_progress() && Marking::IsBlack(Marking::MarkBitFrom(object->address()))) { if (mode == SEQUENTIAL_TO_SWEEPER) { MemoryChunk::IncrementLiveBytesFromGC(object, by); diff --git a/src/heap/mark-compact.cc b/src/heap/mark-compact.cc index 6025e298ea..9ba2d5a340 100644 --- a/src/heap/mark-compact.cc +++ b/src/heap/mark-compact.cc @@ -3982,6 +3982,7 @@ void MarkCompactCollector::SweepSpaces() { MoveEvacuationCandidatesToEndOfPagesList(); { + sweeping_in_progress_ = true; { GCTracer::Scope sweep_scope(heap()->tracer(), GCTracer::Scope::MC_SWEEP_OLD); @@ -3997,7 +3998,6 @@ void MarkCompactCollector::SweepSpaces() { GCTracer::Scope::MC_SWEEP_MAP); StartSweepSpace(heap()->map_space()); } - sweeping_in_progress_ = true; if (FLAG_concurrent_sweeping) { StartSweeperThreads(); }