Fix live bytes counter in large object space after right trimming.

BUG=chromium:609761
LOG=NO

Review-Url: https://codereview.chromium.org/1964143004
Cr-Commit-Position: refs/heads/master@{#36183}
This commit is contained in:
ulan 2016-05-11 09:56:34 -07:00 committed by Commit bot
parent be8c688ade
commit 12fa3fff65
3 changed files with 20 additions and 3 deletions

View File

@ -3078,9 +3078,11 @@ void Heap::AdjustLiveBytes(HeapObject* object, int by, InvocationMode mode) {
// the heap using HeapIterator, we can update the live byte count. We cannot // the heap using HeapIterator, we can update the live byte count. We cannot
// update while using HeapIterator because the iterator is temporarily // update while using HeapIterator because the iterator is temporarily
// marking the whole object graph, without updating live bytes. // marking the whole object graph, without updating live bytes.
if (!in_heap_iterator() && if (lo_space()->Contains(object)) {
!mark_compact_collector()->sweeping_in_progress() && lo_space()->AdjustLiveBytes(by);
Marking::IsBlack(Marking::MarkBitFrom(object->address()))) { } else if (!in_heap_iterator() &&
!mark_compact_collector()->sweeping_in_progress() &&
Marking::IsBlack(Marking::MarkBitFrom(object->address()))) {
if (mode == SEQUENTIAL_TO_SWEEPER) { if (mode == SEQUENTIAL_TO_SWEEPER) {
MemoryChunk::IncrementLiveBytesFromGC(object, by); MemoryChunk::IncrementLiveBytesFromGC(object, by);
} else { } else {

View File

@ -3057,6 +3057,8 @@ class LargeObjectSpace : public Space {
// Checks whether the space is empty. // Checks whether the space is empty.
bool IsEmpty() { return first_page_ == NULL; } bool IsEmpty() { return first_page_ == NULL; }
void AdjustLiveBytes(int by) { objects_size_ += by; }
LargePage* first_page() { return first_page_; } LargePage* first_page() { return first_page_; }
#ifdef VERIFY_HEAP #ifdef VERIFY_HEAP

View File

@ -6743,5 +6743,18 @@ TEST(Regress598319) {
} }
} }
TEST(Regress609761) {
CcTest::InitializeVM();
v8::HandleScope scope(CcTest::isolate());
Heap* heap = CcTest::heap();
Isolate* isolate = heap->isolate();
intptr_t size_before = heap->SizeOfObjects();
Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000);
array->Shrink(1);
intptr_t size_after = heap->SizeOfObjects();
CHECK_EQ(size_after, size_before + array->Size());
}
} // namespace internal } // namespace internal
} // namespace v8 } // namespace v8