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

Side by Side Diff: test/cctest/heap/test-heap.cc

Issue 2043263002: Revert of [heap] Uncommit unused large object page memory. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 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 unified diff | Download patch
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 the V8 project authors. All rights reserved. 1 // Copyright 2012 the V8 project authors. All rights reserved.
2 // Redistribution and use in source and binary forms, with or without 2 // Redistribution and use in source and binary forms, with or without
3 // modification, are permitted provided that the following conditions are 3 // modification, are permitted provided that the following conditions are
4 // met: 4 // met:
5 // 5 //
6 // * Redistributions of source code must retain the above copyright 6 // * Redistributions of source code must retain the above copyright
7 // notice, this list of conditions and the following disclaimer. 7 // notice, this list of conditions and the following disclaimer.
8 // * Redistributions in binary form must reproduce the above 8 // * Redistributions in binary form must reproduce the above
9 // copyright notice, this list of conditions and the following 9 // copyright notice, this list of conditions and the following
10 // disclaimer in the documentation and/or other materials provided 10 // disclaimer in the documentation and/or other materials provided
(...skipping 6742 matching lines...) Expand 10 before | Expand all | Expand 10 after
6753 } 6753 }
6754 } 6754 }
6755 CHECK(marking->IsComplete()); 6755 CHECK(marking->IsComplete());
6756 intptr_t size_before = heap->SizeOfObjects(); 6756 intptr_t size_before = heap->SizeOfObjects();
6757 CcTest::heap()->CollectAllGarbage(); 6757 CcTest::heap()->CollectAllGarbage();
6758 intptr_t size_after = heap->SizeOfObjects(); 6758 intptr_t size_after = heap->SizeOfObjects();
6759 // Live size does not increase after garbage collection. 6759 // Live size does not increase after garbage collection.
6760 CHECK_LE(size_after, size_before); 6760 CHECK_LE(size_after, size_before);
6761 } 6761 }
6762 6762
6763 TEST(UncommitUnusedLargeObjectMemory) {
6764 CcTest::InitializeVM();
6765 v8::HandleScope scope(CcTest::isolate());
6766 Heap* heap = CcTest::heap();
6767 Isolate* isolate = heap->isolate();
6768
6769 Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000);
6770 MemoryChunk* chunk = MemoryChunk::FromAddress(array->address());
6771 CHECK(chunk->owner()->identity() == LO_SPACE);
6772
6773 intptr_t size_before = array->Size();
6774 size_t committed_memory_before = chunk->CommittedPhysicalMemory();
6775
6776 array->Shrink(1);
6777 CHECK(array->Size() < size_before);
6778
6779 CcTest::heap()->CollectAllGarbage();
6780 CHECK(chunk->CommittedPhysicalMemory() < committed_memory_before);
6781 size_t shrinked_size =
6782 RoundUp((array->address() - chunk->address()) + array->Size(),
6783 base::OS::CommitPageSize());
6784 CHECK_EQ(shrinked_size, chunk->CommittedPhysicalMemory());
6785 }
6786 } // namespace internal 6763 } // namespace internal
6787 } // namespace v8 6764 } // namespace v8
OLDNEW
« no previous file with comments | « src/heap/spaces.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698