Commit db02a0eb authored by Michael Lippautz's avatar Michael Lippautz Committed by Commit Bot

[heap] Fix SpacesTest.WriteBarrierFromHeapObject

Instead of actually allocating an objects just test the corner cases
around the page boundary by casting addresses.

Bug: v8:7984
Change-Id: I27615cc193d6f85abc91cfe898719a4a9b761f23
Reviewed-on: https://chromium-review.googlesource.com/1151114Reviewed-by: 's avatarLeszek Swirski <leszeks@chromium.org>
Commit-Queue: Michael Lippautz <mlippautz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#54717}
parent a2a38175
......@@ -53,20 +53,18 @@ TEST_F(SpacesTest, CompactionSpaceMerge) {
}
TEST_F(SpacesTest, WriteBarrierFromHeapObject) {
Heap* heap = i_isolate()->heap();
CompactionSpace* temporary_space =
new CompactionSpace(heap, OLD_SPACE, NOT_EXECUTABLE);
EXPECT_NE(nullptr, temporary_space);
HeapObject* object =
temporary_space->AllocateRawUnaligned(kMaxRegularHeapObjectSize)
.ToObjectChecked();
EXPECT_NE(nullptr, object);
MemoryChunk* chunk = MemoryChunk::FromHeapObject(object);
heap_internals::MemoryChunk* slim_chunk =
heap_internals::MemoryChunk::FromHeapObject(object);
EXPECT_EQ(static_cast<void*>(chunk), static_cast<void*>(slim_chunk));
delete temporary_space;
constexpr Address address1 = Page::kPageSize;
HeapObject* object1 = reinterpret_cast<HeapObject*>(address1);
MemoryChunk* chunk1 = MemoryChunk::FromHeapObject(object1);
heap_internals::MemoryChunk* slim_chunk1 =
heap_internals::MemoryChunk::FromHeapObject(object1);
EXPECT_EQ(static_cast<void*>(chunk1), static_cast<void*>(slim_chunk1));
constexpr Address address2 = 2 * Page::kPageSize - 1;
HeapObject* object2 = reinterpret_cast<HeapObject*>(address2);
MemoryChunk* chunk2 = MemoryChunk::FromHeapObject(object2);
heap_internals::MemoryChunk* slim_chunk2 =
heap_internals::MemoryChunk::FromHeapObject(object2);
EXPECT_EQ(static_cast<void*>(chunk2), static_cast<void*>(slim_chunk2));
}
TEST_F(SpacesTest, WriteBarrierIsMarking) {
......
......@@ -3,12 +3,6 @@
# found in the LICENSE file.
[
[ALWAYS, {
# BUG(v8:7984).
'SpacesTest.WriteBarrierFromHeapObject': [SKIP],
}], # ALWAYS
['system == macos and asan', {
# BUG(820416).
'BitsDeathTest*': [SKIP],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment