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

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

Issue 2028633002: Provide a tagged allocation top pointer. Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: WIP: adding a few tests. 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') | test/cctest/test-macro-assembler-arm.cc » ('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 8fbe9963b1e749bf44c0474f5985c58cf0464ca9..56f625f0aa4c95766ad04c73c32e47a9d49521cf 100644
--- a/test/cctest/heap/test-heap.cc
+++ b/test/cctest/heap/test-heap.cc
@@ -2066,19 +2066,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;
@@ -2089,7 +2088,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.
@@ -2100,13 +2099,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));
@@ -2114,7 +2114,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
@@ -2123,7 +2124,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));
@@ -2131,7 +2132,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.
@@ -2142,7 +2144,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));
@@ -2150,7 +2153,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);
}
}
@@ -2169,13 +2173,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 | « test/cctest/heap/heap-utils.cc ('k') | test/cctest/test-macro-assembler-arm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698