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

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

Issue 2236403002: [heap] Fix SizeOfObjects tests (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 4 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 | « no previous file | no next file » | 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 d4ebd04898bea1c8e024c534115c3ab52faa6240..c76c6dde434e151a9250348b0b8718d409b95ca5 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -1968,11 +1968,7 @@ TEST(TestSizeOfRegExpCode) {
// Get initial heap size after several full GCs, which will stabilize
// the heap size and return with sweeping finished completely.
- CcTest::heap()->CollectAllGarbage();
- CcTest::heap()->CollectAllGarbage();
- CcTest::heap()->CollectAllGarbage();
- CcTest::heap()->CollectAllGarbage();
- CcTest::heap()->CollectAllGarbage();
+ CcTest::heap()->CollectAllAvailableGarbage("initial cleanup");
MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector();
if (collector->sweeping_in_progress()) {
collector->EnsureSweepingCompleted();
@@ -2005,19 +2001,16 @@ TEST(TestSizeOfRegExpCode) {
HEAP_TEST(TestSizeOfObjects) {
v8::V8::Initialize();
+ Heap* heap = CcTest::heap();
+ MarkCompactCollector* collector = heap->mark_compact_collector();
// Get initial heap size after several full GCs, which will stabilize
// the heap size and return with sweeping finished completely.
- CcTest::heap()->CollectAllGarbage();
- CcTest::heap()->CollectAllGarbage();
- CcTest::heap()->CollectAllGarbage();
- CcTest::heap()->CollectAllGarbage();
- CcTest::heap()->CollectAllGarbage();
- MarkCompactCollector* collector = CcTest::heap()->mark_compact_collector();
+ heap->CollectAllAvailableGarbage("initial cleanup");
if (collector->sweeping_in_progress()) {
collector->EnsureSweepingCompleted();
}
- int initial_size = static_cast<int>(CcTest::heap()->SizeOfObjects());
+ int initial_size = static_cast<int>(heap->SizeOfObjects());
{
// Allocate objects on several different old-space pages so that
@@ -2026,25 +2019,22 @@ HEAP_TEST(TestSizeOfObjects) {
AlwaysAllocateScope always_allocate(CcTest::i_isolate());
int filler_size = static_cast<int>(FixedArray::SizeFor(8192));
for (int i = 1; i <= 100; i++) {
- CcTest::heap()->AllocateFixedArray(8192, TENURED).ToObjectChecked();
+ heap->AllocateFixedArray(8192, TENURED).ToObjectChecked();
CHECK_EQ(initial_size + i * filler_size,
- static_cast<int>(CcTest::heap()->SizeOfObjects()));
+ static_cast<int>(heap->SizeOfObjects()));
}
}
// The heap size should go back to initial size after a full GC, even
// though sweeping didn't finish yet.
- CcTest::heap()->CollectAllGarbage();
-
+ heap->CollectAllGarbage();
// Normally sweeping would not be complete here, but no guarantees.
-
- CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects()));
-
+ CHECK_EQ(initial_size, static_cast<int>(heap->SizeOfObjects()));
// Waiting for sweeper threads should not change heap size.
if (collector->sweeping_in_progress()) {
collector->EnsureSweepingCompleted();
}
- CHECK_EQ(initial_size, static_cast<int>(CcTest::heap()->SizeOfObjects()));
+ CHECK_EQ(initial_size, static_cast<int>(heap->SizeOfObjects()));
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698