Index: Source/platform/heap/HeapTest.cpp |
diff --git a/Source/platform/heap/HeapTest.cpp b/Source/platform/heap/HeapTest.cpp |
index 5f1d34007b462fdf2bb574e2c189982667087658..e4d00ac8f52300b12dbefb18389d3592813b71d7 100644 |
--- a/Source/platform/heap/HeapTest.cpp |
+++ b/Source/platform/heap/HeapTest.cpp |
@@ -5571,4 +5571,18 @@ TEST(HeapTest, StackGrowthDirection) |
EXPECT_EQ(GrowsTowardsLower, stackGrowthDirection()); |
} |
+TEST(HeapTest, Zombie) |
+{ |
+ Bar::s_live = 0; |
+ Baz* baz = Baz::create(Bar::create()); |
+ ThreadState::current()->markAsZombie(baz); |
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
+ // |baz| and a Bar shouldn't be collected. |
+ EXPECT_EQ(1u, Bar::s_live); |
+ |
+ ThreadState::current()->purifyZombies(); |
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
+ EXPECT_EQ(0u, Bar::s_live); |
+} |
+ |
} // namespace blink |