Index: test/cctest/heap/heap-utils.cc |
diff --git a/test/cctest/heap/heap-utils.cc b/test/cctest/heap/heap-utils.cc |
index 8abc5c3b5c63d2e863080effda3d2c0a69a2396a..54b7e24588e72d249e6e1518bf8f825a38b8bb2d 100644 |
--- a/test/cctest/heap/heap-utils.cc |
+++ b/test/cctest/heap/heap-utils.cc |
@@ -45,8 +45,7 @@ std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, |
} else { |
heap->new_space()->DisableInlineAllocationSteps(); |
int overall_free_memory = |
- static_cast<int>(*heap->new_space()->allocation_limit_address() - |
- *heap->new_space()->allocation_top_address()); |
+ static_cast<int>(heap->new_space()->limit() - heap->new_space()->top()); |
CHECK(padding_size <= overall_free_memory || overall_free_memory == 0); |
} |
while (free_memory > 0) { |
@@ -59,9 +58,13 @@ std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, |
if (length <= 0) { |
// Not enough room to create another fixed array. Let's create a filler. |
if (free_memory > (2 * kPointerSize)) { |
- heap->CreateFillerObjectAt( |
- *heap->old_space()->allocation_top_address(), free_memory, |
- ClearRecordedSlots::kNo); |
+ if (tenure == i::TENURED) { |
+ heap->CreateFillerObjectAt(heap->old_space()->top(), free_memory, |
+ ClearRecordedSlots::kNo); |
+ } else { |
+ heap->CreateFillerObjectAt(heap->new_space()->top(), free_memory, |
+ ClearRecordedSlots::kNo); |
+ } |
} |
break; |
} |
@@ -77,8 +80,7 @@ std::vector<Handle<FixedArray>> CreatePadding(Heap* heap, int padding_size, |
void AllocateAllButNBytes(v8::internal::NewSpace* space, int extra_bytes, |
std::vector<Handle<FixedArray>>* out_handles) { |
space->DisableInlineAllocationSteps(); |
- int space_remaining = static_cast<int>(*space->allocation_limit_address() - |
- *space->allocation_top_address()); |
+ int space_remaining = static_cast<int>(space->limit() - space->top()); |
CHECK(space_remaining >= extra_bytes); |
int new_linear_size = space_remaining - extra_bytes; |
if (new_linear_size == 0) return; |
@@ -96,8 +98,7 @@ void FillCurrentPage(v8::internal::NewSpace* space, |
bool FillUpOnePage(v8::internal::NewSpace* space, |
std::vector<Handle<FixedArray>>* out_handles) { |
space->DisableInlineAllocationSteps(); |
- int space_remaining = static_cast<int>(*space->allocation_limit_address() - |
- *space->allocation_top_address()); |
+ int space_remaining = static_cast<int>(space->limit() - space->top()); |
if (space_remaining == 0) return false; |
std::vector<Handle<FixedArray>> handles = |
heap::CreatePadding(space->heap(), space_remaining, i::NOT_TENURED); |
@@ -156,6 +157,13 @@ void GcAndSweep(Heap* heap, AllocationSpace space) { |
} |
} |
+void MakeSureNewSpaceTopIsNotDoubleAligned(i::Heap* heap) { |
+ intptr_t top = reinterpret_cast<intptr_t>(heap->new_space()->top()); |
+ if ((top & kDoubleAlignmentMaskTagged) == 0) { |
+ CreatePadding(heap, kDoubleSize / 2, NOT_TENURED); |
+ } |
+} |
+ |
} // namespace heap |
} // namespace internal |
} // namespace v8 |