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

Unified Diff: Source/platform/heap/HeapTest.cpp

Issue 1138663002: Oilpan: support eager finalization/sweeping. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: review iteration + rebase Created 5 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 | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/ThreadState.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/heap/HeapTest.cpp
diff --git a/Source/platform/heap/HeapTest.cpp b/Source/platform/heap/HeapTest.cpp
index 9f7024173d5b9186e68b130471c593ebf210bea0..f112db222f246f1473f40b15cba6dd846797b1b8 100644
--- a/Source/platform/heap/HeapTest.cpp
+++ b/Source/platform/heap/HeapTest.cpp
@@ -1867,6 +1867,52 @@ TEST(HeapTest, LazySweepingLargeObjectPages)
Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWithSweep, Heap::ForcedGC);
EXPECT_EQ(22, LargeHeapObject::s_destructorCalls);
}
+
+class SimpleFinalizedEagerObjectBase : public GarbageCollectedFinalized<SimpleFinalizedEagerObjectBase> {
+public:
+ virtual ~SimpleFinalizedEagerObjectBase() { }
+ DEFINE_INLINE_TRACE() { }
+protected:
+ SimpleFinalizedEagerObjectBase() { }
+};
+
+class SimpleFinalizedEagerObject : public SimpleFinalizedEagerObjectBase {
+public:
+ static SimpleFinalizedEagerObject* create()
+ {
+ return new SimpleFinalizedEagerObject();
+ }
+
+ virtual ~SimpleFinalizedEagerObject()
+ {
+ ++s_destructorCalls;
+ }
+
+ static int s_destructorCalls;
+private:
+ SimpleFinalizedEagerObject() { }
+};
+
+int SimpleFinalizedEagerObject::s_destructorCalls = 0;
+
+EAGERLY_SWEEP(SimpleFinalizedEagerObjectBase);
+
+TEST(HeapTest, EagerlySweepingPages)
+{
+ clearOutOldGarbage();
+
+ SimpleFinalizedObject::s_destructorCalls = 0;
+ SimpleFinalizedEagerObject::s_destructorCalls = 0;
+ EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls);
+ EXPECT_EQ(0, SimpleFinalizedEagerObject::s_destructorCalls);
+ for (int i = 0; i < 1000; i++)
+ SimpleFinalizedObject::create();
+ for (int i = 0; i < 100; i++)
+ SimpleFinalizedEagerObject::create();
+ Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWithoutSweep, Heap::ForcedGC);
+ EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls);
+ EXPECT_EQ(100, SimpleFinalizedEagerObject::s_destructorCalls);
+}
#endif
TEST(HeapTest, Finalization)
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/ThreadState.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698