Index: test/cctest/cctest.h |
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h |
index e3e7607479bed4e6d7afb0d19a3924bd3c4d2d35..92ea2fb85a1c7875f5022da7fe71d27f5d65728b 100644 |
--- a/test/cctest/cctest.h |
+++ b/test/cctest/cctest.h |
@@ -486,27 +486,39 @@ static inline bool FillUpOnePage(v8::internal::NewSpace* space) { |
v8::internal::AllocationResult allocation = |
space->AllocateRaw(v8::internal::Page::kMaxRegularHeapObjectSize); |
if (allocation.IsRetry()) return false; |
- v8::internal::FreeListNode* node = |
- v8::internal::FreeListNode::cast(allocation.ToObjectChecked()); |
- node->set_size(space->heap(), v8::internal::Page::kMaxRegularHeapObjectSize); |
+ v8::internal::HeapObject* free_space; |
+ CHECK(allocation.To(&free_space)); |
+ space->heap()->CreateFillerObjectAt( |
+ free_space->address(), v8::internal::Page::kMaxRegularHeapObjectSize); |
return true; |
} |
-static inline void SimulateFullSpace(v8::internal::NewSpace* space) { |
- int new_linear_size = static_cast<int>(*space->allocation_limit_address() - |
+// Helper function that simulates a fill new-space in the heap. |
+static inline void AllocateAllButNBytes(v8::internal::NewSpace* space, |
+ int extra_bytes) { |
+ int space_remaining = static_cast<int>(*space->allocation_limit_address() - |
*space->allocation_top_address()); |
- if (new_linear_size > 0) { |
- // Fill up the current page. |
- v8::internal::AllocationResult allocation = |
- space->AllocateRaw(new_linear_size); |
- v8::internal::FreeListNode* node = |
- v8::internal::FreeListNode::cast(allocation.ToObjectChecked()); |
- node->set_size(space->heap(), new_linear_size); |
+ CHECK(space_remaining >= extra_bytes); |
+ int new_linear_size = space_remaining - extra_bytes; |
+ if (new_linear_size == 0) return; |
+ v8::internal::AllocationResult allocation = |
+ space->AllocateRaw(new_linear_size); |
+ v8::internal::HeapObject* free_space; |
+ CHECK(allocation.To(&free_space)); |
+ space->heap()->CreateFillerObjectAt(free_space->address(), new_linear_size); |
+} |
+ |
+ |
+static inline void FillCurrentPage(v8::internal::NewSpace* space) { |
+ AllocateAllButNBytes(space, 0); |
+} |
+ |
+ |
+static inline void SimulateFullSpace(v8::internal::NewSpace* space) { |
+ FillCurrentPage(space); |
+ while (FillUpOnePage(space)) { |
} |
- // Fill up all remaining pages. |
- while (FillUpOnePage(space)) |
- ; |
} |