| Index: src/heap/heap.cc
|
| diff --git a/src/heap/heap.cc b/src/heap/heap.cc
|
| index 0bd763bc763b7d22826cbd0646ac4dd69860640b..e022116d990752fa5f7946f0f7436142a331b98f 100644
|
| --- a/src/heap/heap.cc
|
| +++ b/src/heap/heap.cc
|
| @@ -164,6 +164,7 @@ Heap::Heap()
|
| deserialization_complete_(false),
|
| strong_roots_list_(NULL),
|
| array_buffer_tracker_(NULL),
|
| + heap_iterator_depth_(0),
|
| force_oom_(false) {
|
| // Allow build-time customization of the max semispace size. Building
|
| // V8 with snapshots and a non-default max semispace size is much
|
| @@ -3101,7 +3102,11 @@ bool Heap::CanMoveObjectStart(HeapObject* object) {
|
|
|
|
|
| void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) {
|
| - if (incremental_marking()->IsMarking() &&
|
| + // As long as the inspected object is black and we are currently not iterating
|
| + // the heap using HeapIterator, we can update the live byte count. We cannot
|
| + // update while using HeapIterator because the iterator is temporarily
|
| + // marking the whole object graph, without updating live bytes.
|
| + if (!in_heap_iterator() &&
|
| Marking::IsBlack(Marking::MarkBitFrom(object->address()))) {
|
| if (mode == SEQUENTIAL_TO_SWEEPER) {
|
| MemoryChunk::IncrementLiveBytesFromGC(object, by);
|
| @@ -5658,6 +5663,7 @@ HeapIterator::HeapIterator(Heap* heap,
|
| filter_(nullptr),
|
| space_iterator_(nullptr),
|
| object_iterator_(nullptr) {
|
| + heap_->heap_iterator_start();
|
| // Start the iteration.
|
| space_iterator_ = new SpaceIterator(heap_);
|
| switch (filtering_) {
|
| @@ -5672,6 +5678,7 @@ HeapIterator::HeapIterator(Heap* heap,
|
|
|
|
|
| HeapIterator::~HeapIterator() {
|
| + heap_->heap_iterator_end();
|
| #ifdef DEBUG
|
| // Assert that in filtering mode we have iterated through all
|
| // objects. Otherwise, heap will be left in an inconsistent state.
|
|
|