| Index: test/cctest/cctest.h
|
| diff --git a/test/cctest/cctest.h b/test/cctest/cctest.h
|
| index e3e7607479bed4e6d7afb0d19a3924bd3c4d2d35..81a0dd9a4ee6fab84c598639b69d18dd7b8c4bc9 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 = NULL;
|
| + 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 = NULL;
|
| + 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))
|
| - ;
|
| }
|
|
|
|
|
|
|