Index: Source/platform/heap/HeapTest.cpp |
diff --git a/Source/platform/heap/HeapTest.cpp b/Source/platform/heap/HeapTest.cpp |
index 3cfbc5357d5efa316d8e47d287330a358c4c8172..5d0f2b2136eb08a45d9741f705b82a89bb54ed3c 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 |