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

Unified Diff: test/cctest/heap/test-heap.cc

Issue 2101383002: [heap] Reland 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/heap/spaces.cc ('k') | test/mjsunit/regress/regress-617882.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-heap.cc
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index e76678289bea20a34da33d3cba462569cf60edac..cc89c68cfa12820735e4b7201370507c8fef61ec 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -6791,5 +6791,28 @@ TEST(Regress618958) {
!heap->incremental_marking()->IsStopped()));
}
+TEST(UncommitUnusedLargeObjectMemory) {
+ CcTest::InitializeVM();
+ v8::HandleScope scope(CcTest::isolate());
+ Heap* heap = CcTest::heap();
+ Isolate* isolate = heap->isolate();
+
+ Handle<FixedArray> array = isolate->factory()->NewFixedArray(200000);
+ MemoryChunk* chunk = MemoryChunk::FromAddress(array->address());
+ CHECK(chunk->owner()->identity() == LO_SPACE);
+
+ intptr_t size_before = array->Size();
+ size_t committed_memory_before = chunk->CommittedPhysicalMemory();
+
+ array->Shrink(1);
+ CHECK(array->Size() < size_before);
+
+ CcTest::heap()->CollectAllGarbage();
+ CHECK(chunk->CommittedPhysicalMemory() < committed_memory_before);
+ size_t shrinked_size =
+ RoundUp((array->address() - chunk->address()) + array->Size(),
+ base::OS::CommitPageSize());
+ CHECK_EQ(shrinked_size, chunk->CommittedPhysicalMemory());
+}
} // namespace internal
} // namespace v8
« no previous file with comments | « src/heap/spaces.cc ('k') | test/mjsunit/regress/regress-617882.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698