Index: test/cctest/heap/test-heap.cc |
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc |
index f76b6ba7a4cde08c7c3a331ebb477b52f2222d9c..7a3c1a86d85b6a0e50a9d4755764d492c6570691 100644 |
--- a/test/cctest/heap/test-heap.cc |
+++ b/test/cctest/heap/test-heap.cc |
@@ -2186,6 +2186,18 @@ static Address AlignOldSpace(AllocationAlignment alignment, int offset) { |
// Test the case where allocation must be done from the free list, so filler |
// may precede or follow the object. |
TEST(TestAlignedOverAllocation) { |
+ Heap* heap = CcTest::heap(); |
+ // Test checks for fillers before and behind objects and requires a fresh |
+ // page and empty free list. |
+ heap::AbandonCurrentlyFreeMemory(heap->old_space()); |
+ // Allocate a dummy object to properly set up the linear allocation info. |
+ AllocationResult dummy = |
+ heap->old_space()->AllocateRawUnaligned(kPointerSize); |
+ CHECK(!dummy.IsRetry()); |
+ heap->CreateFillerObjectAt( |
+ HeapObject::cast(dummy.ToObjectChecked())->address(), kPointerSize, |
+ ClearRecordedSlots::kNo); |
+ |
// Double misalignment is 4 on 32-bit platforms, 0 on 64-bit ones. |
const intptr_t double_misalignment = kDoubleSize - kPointerSize; |
Address start; |
@@ -3571,6 +3583,11 @@ TEST(ReleaseOverReservedPages) { |
Isolate* isolate = CcTest::i_isolate(); |
Factory* factory = isolate->factory(); |
Heap* heap = isolate->heap(); |
+ |
+ // The initial GC makes sure that objects that are allocated in new space |
+ // don't play a part in the test. |
+ heap->CollectAllAvailableGarbage("initial GC"); |
+ |
v8::HandleScope scope(CcTest::isolate()); |
static const int number_of_test_pages = 20; |