Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(824)

Unified Diff: src/heap/heap.cc

Issue 1559873004: [heap] Buffer counter updates for new space evacuation. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Switch AdjustLiveBytes to checking whether we are in a HeapIterator Created 4 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « src/heap/heap.h ('k') | src/heap/mark-compact.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698