Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(105)

Unified Diff: test/cctest/heap/test-heap.cc

Issue 2035413003: Revert of Provide a tagged allocation top pointer. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « test/cctest/heap/heap-utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/heap/test-heap.cc
diff --git a/test/cctest/heap/test-heap.cc b/test/cctest/heap/test-heap.cc
index 25c939d970b27ccf67267fc82cc5f4a3d8724577..1b87564516c30aae876b7e31047ec3fdc29abfe7 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -2065,18 +2065,19 @@
// Get new space allocation into the desired alignment.
static Address AlignNewSpace(AllocationAlignment alignment, int offset) {
- Address top = CcTest::heap()->new_space()->top();
- int fill = Heap::GetFillToAlign(top, alignment);
+ Address* top_addr = CcTest::heap()->new_space()->allocation_top_address();
+ int fill = Heap::GetFillToAlign(*top_addr, alignment);
if (fill) {
NewSpaceAllocateAligned(fill + offset, kWordAligned);
}
- return CcTest::heap()->new_space()->top();
+ return *top_addr;
}
TEST(TestAlignedAllocation) {
// Double misalignment is 4 on 32-bit platforms, 0 on 64-bit ones.
const intptr_t double_misalignment = kDoubleSize - kPointerSize;
+ Address* top_addr = CcTest::heap()->new_space()->allocation_top_address();
Address start;
HeapObject* obj;
HeapObject* filler;
@@ -2087,7 +2088,7 @@
obj = NewSpaceAllocateAligned(kPointerSize, kDoubleAligned);
CHECK(IsAddressAligned(obj->address(), kDoubleAlignment));
// There is no filler.
- CHECK_EQ(kPointerSize, CcTest::heap()->new_space()->top() - start);
+ CHECK_EQ(kPointerSize, *top_addr - start);
// Allocate a second pointer sized object that must be double aligned at an
// unaligned address.
@@ -2098,14 +2099,13 @@
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == kPointerSize);
- CHECK_EQ(kPointerSize + double_misalignment,
- CcTest::heap()->new_space()->top() - start);
+ CHECK_EQ(kPointerSize + double_misalignment, *top_addr - start);
// Similarly for kDoubleUnaligned.
start = AlignNewSpace(kDoubleUnaligned, 0);
obj = NewSpaceAllocateAligned(kPointerSize, kDoubleUnaligned);
CHECK(IsAddressAligned(obj->address(), kDoubleAlignment, kPointerSize));
- CHECK_EQ(kPointerSize, CcTest::heap()->new_space()->top() - start);
+ CHECK_EQ(kPointerSize, *top_addr - start);
start = AlignNewSpace(kDoubleUnaligned, kPointerSize);
obj = NewSpaceAllocateAligned(kPointerSize, kDoubleUnaligned);
CHECK(IsAddressAligned(obj->address(), kDoubleAlignment, kPointerSize));
@@ -2113,8 +2113,7 @@
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == kPointerSize);
- CHECK_EQ(kPointerSize + double_misalignment,
- CcTest::heap()->new_space()->top() - start);
+ CHECK_EQ(kPointerSize + double_misalignment, *top_addr - start);
}
// Now test SIMD alignment. There are 2 or 4 possible alignments, depending
@@ -2123,7 +2122,7 @@
obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned);
CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize));
// There is no filler.
- CHECK_EQ(kPointerSize, CcTest::heap()->new_space()->top() - start);
+ CHECK_EQ(kPointerSize, *top_addr - start);
start = AlignNewSpace(kSimd128Unaligned, kPointerSize);
obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned);
CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize));
@@ -2131,8 +2130,7 @@
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == kSimd128Size - kPointerSize);
- CHECK_EQ(kPointerSize + kSimd128Size - kPointerSize,
- CcTest::heap()->new_space()->top() - start);
+ CHECK_EQ(kPointerSize + kSimd128Size - kPointerSize, *top_addr - start);
if (double_misalignment) {
// Test the 2 other alignments possible on 32 bit platforms.
@@ -2143,8 +2141,7 @@
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == 2 * kPointerSize);
- CHECK_EQ(kPointerSize + 2 * kPointerSize,
- CcTest::heap()->new_space()->top() - start);
+ CHECK_EQ(kPointerSize + 2 * kPointerSize, *top_addr - start);
start = AlignNewSpace(kSimd128Unaligned, 3 * kPointerSize);
obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned);
CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize));
@@ -2152,8 +2149,7 @@
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == kPointerSize);
- CHECK_EQ(kPointerSize + kPointerSize,
- CcTest::heap()->new_space()->top() - start);
+ CHECK_EQ(kPointerSize + kPointerSize, *top_addr - start);
}
}
@@ -2172,13 +2168,13 @@
// Get old space allocation into the desired alignment.
static Address AlignOldSpace(AllocationAlignment alignment, int offset) {
- Address top = CcTest::heap()->old_space()->top();
- int fill = Heap::GetFillToAlign(top, alignment);
+ Address* top_addr = CcTest::heap()->old_space()->allocation_top_address();
+ int fill = Heap::GetFillToAlign(*top_addr, alignment);
int allocation = fill + offset;
if (allocation) {
OldSpaceAllocateAligned(allocation, kWordAligned);
}
- top = CcTest::heap()->old_space()->top();
+ Address top = *top_addr;
// Now force the remaining allocation onto the free list.
CcTest::heap()->old_space()->EmptyAllocationInfo();
return top;
« no previous file with comments | « test/cctest/heap/heap-utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698