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

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

Issue 1924223002: Provide tagged allocation top pointer (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 7 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 | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/heap/utils-inl.h » ('j') | 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 ef4b217a7a6601bd804b3c715742397adda07146..4d2186cae040b06236660d054d68d6571068d9e6 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -2027,19 +2027,18 @@ static HeapObject* NewSpaceAllocateAligned(int size,
// Get new space allocation into the desired alignment.
static Address AlignNewSpace(AllocationAlignment alignment, int offset) {
- Address* top_addr = CcTest::heap()->new_space()->allocation_top_address();
- int fill = Heap::GetFillToAlign(*top_addr, alignment);
+ Address top = CcTest::heap()->new_space()->top();
+ int fill = Heap::GetFillToAlign(top, alignment);
if (fill) {
NewSpaceAllocateAligned(fill + offset, kWordAligned);
}
- return *top_addr;
+ return CcTest::heap()->new_space()->top();
}
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;
@@ -2050,7 +2049,7 @@ TEST(TestAlignedAllocation) {
obj = NewSpaceAllocateAligned(kPointerSize, kDoubleAligned);
CHECK(IsAddressAligned(obj->address(), kDoubleAlignment));
// There is no filler.
- CHECK_EQ(kPointerSize, *top_addr - start);
+ CHECK_EQ(kPointerSize, CcTest::heap()->new_space()->top() - start);
// Allocate a second pointer sized object that must be double aligned at an
// unaligned address.
@@ -2061,13 +2060,14 @@ TEST(TestAlignedAllocation) {
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == kPointerSize);
- CHECK_EQ(kPointerSize + double_misalignment, *top_addr - start);
+ CHECK_EQ(kPointerSize + double_misalignment,
+ CcTest::heap()->new_space()->top() - start);
// Similarly for kDoubleUnaligned.
start = AlignNewSpace(kDoubleUnaligned, 0);
obj = NewSpaceAllocateAligned(kPointerSize, kDoubleUnaligned);
CHECK(IsAddressAligned(obj->address(), kDoubleAlignment, kPointerSize));
- CHECK_EQ(kPointerSize, *top_addr - start);
+ CHECK_EQ(kPointerSize, CcTest::heap()->new_space()->top() - start);
start = AlignNewSpace(kDoubleUnaligned, kPointerSize);
obj = NewSpaceAllocateAligned(kPointerSize, kDoubleUnaligned);
CHECK(IsAddressAligned(obj->address(), kDoubleAlignment, kPointerSize));
@@ -2075,7 +2075,8 @@ TEST(TestAlignedAllocation) {
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == kPointerSize);
- CHECK_EQ(kPointerSize + double_misalignment, *top_addr - start);
+ CHECK_EQ(kPointerSize + double_misalignment,
+ CcTest::heap()->new_space()->top() - start);
}
// Now test SIMD alignment. There are 2 or 4 possible alignments, depending
@@ -2084,7 +2085,7 @@ TEST(TestAlignedAllocation) {
obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned);
CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize));
// There is no filler.
- CHECK_EQ(kPointerSize, *top_addr - start);
+ CHECK_EQ(kPointerSize, CcTest::heap()->new_space()->top() - start);
start = AlignNewSpace(kSimd128Unaligned, kPointerSize);
obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned);
CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize));
@@ -2092,7 +2093,8 @@ TEST(TestAlignedAllocation) {
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == kSimd128Size - kPointerSize);
- CHECK_EQ(kPointerSize + kSimd128Size - kPointerSize, *top_addr - start);
+ CHECK_EQ(kPointerSize + kSimd128Size - kPointerSize,
+ CcTest::heap()->new_space()->top() - start);
if (double_misalignment) {
// Test the 2 other alignments possible on 32 bit platforms.
@@ -2103,7 +2105,8 @@ TEST(TestAlignedAllocation) {
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == 2 * kPointerSize);
- CHECK_EQ(kPointerSize + 2 * kPointerSize, *top_addr - start);
+ CHECK_EQ(kPointerSize + 2 * kPointerSize,
+ CcTest::heap()->new_space()->top() - start);
start = AlignNewSpace(kSimd128Unaligned, 3 * kPointerSize);
obj = NewSpaceAllocateAligned(kPointerSize, kSimd128Unaligned);
CHECK(IsAddressAligned(obj->address(), kSimd128Alignment, kPointerSize));
@@ -2111,7 +2114,8 @@ TEST(TestAlignedAllocation) {
filler = HeapObject::FromAddress(start);
CHECK(obj != filler && filler->IsFiller() &&
filler->Size() == kPointerSize);
- CHECK_EQ(kPointerSize + kPointerSize, *top_addr - start);
+ CHECK_EQ(kPointerSize + kPointerSize,
+ CcTest::heap()->new_space()->top() - start);
}
}
@@ -2130,13 +2134,13 @@ static HeapObject* OldSpaceAllocateAligned(int size,
// Get old space allocation into the desired alignment.
static Address AlignOldSpace(AllocationAlignment alignment, int offset) {
- Address* top_addr = CcTest::heap()->old_space()->allocation_top_address();
- int fill = Heap::GetFillToAlign(*top_addr, alignment);
+ Address top = CcTest::heap()->old_space()->top();
+ int fill = Heap::GetFillToAlign(top, alignment);
int allocation = fill + offset;
if (allocation) {
OldSpaceAllocateAligned(allocation, kWordAligned);
}
- Address top = *top_addr;
+ top = CcTest::heap()->old_space()->top();
// Now force the remaining allocation onto the free list.
CcTest::heap()->old_space()->EmptyAllocationInfo();
return top;
« no previous file with comments | « src/x64/macro-assembler-x64.cc ('k') | test/cctest/heap/utils-inl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698