Index: test/cctest/cctest.h |
diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h |
index 92ea2fb85a1c7875f5022da7fe71d27f5d65728b..e3e7607479bed4e6d7afb0d19a3924bd3c4d2d35 100644 |
--- a/test/cctest/cctest.h |
+++ b/test/cctest/cctest.h |
@@ -486,39 +486,27 @@ |
v8::internal::AllocationResult allocation = |
space->AllocateRaw(v8::internal::Page::kMaxRegularHeapObjectSize); |
if (allocation.IsRetry()) return false; |
- v8::internal::HeapObject* free_space; |
- CHECK(allocation.To(&free_space)); |
- space->heap()->CreateFillerObjectAt( |
- free_space->address(), v8::internal::Page::kMaxRegularHeapObjectSize); |
+ v8::internal::FreeListNode* node = |
+ v8::internal::FreeListNode::cast(allocation.ToObjectChecked()); |
+ node->set_size(space->heap(), v8::internal::Page::kMaxRegularHeapObjectSize); |
return true; |
} |
-// 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() - |
+static inline void SimulateFullSpace(v8::internal::NewSpace* space) { |
+ int new_linear_size = static_cast<int>(*space->allocation_limit_address() - |
*space->allocation_top_address()); |
- 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)) { |
- } |
+ 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); |
+ } |
+ // Fill up all remaining pages. |
+ while (FillUpOnePage(space)) |
+ ; |
} |