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

Side by Side Diff: Source/platform/heap/HeapTest.cpp

Issue 1055193004: Oilpan: Enable lazy sweeping on non-oilpan builds (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2013 Google Inc. All rights reserved. 2 * Copyright (C) 2013 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer. 9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 1782 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 Persistent<SimpleFinalizedObject> finalized = SimpleFinalizedObject::cre ate(); 1793 Persistent<SimpleFinalizedObject> finalized = SimpleFinalizedObject::cre ate();
1794 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); 1794 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls);
1795 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GC WithSweep, Heap::ForcedGC); 1795 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GC WithSweep, Heap::ForcedGC);
1796 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); 1796 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls);
1797 } 1797 }
1798 1798
1799 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGC); 1799 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGC);
1800 EXPECT_EQ(1, SimpleFinalizedObject::s_destructorCalls); 1800 EXPECT_EQ(1, SimpleFinalizedObject::s_destructorCalls);
1801 } 1801 }
1802 1802
1803 // FIXME: Lazy sweeping is disabled in non-oilpan builds.
1804 #if ENABLE(OILPAN)
1805 TEST(HeapTest, LazySweepingPages) 1803 TEST(HeapTest, LazySweepingPages)
1806 { 1804 {
1807 clearOutOldGarbage(); 1805 clearOutOldGarbage();
1808 1806
1809 SimpleFinalizedObject::s_destructorCalls = 0; 1807 SimpleFinalizedObject::s_destructorCalls = 0;
1810 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); 1808 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls);
1811 for (int i = 0; i < 1000; i++) 1809 for (int i = 0; i < 1000; i++)
1812 SimpleFinalizedObject::create(); 1810 SimpleFinalizedObject::create();
1813 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith outSweep, Heap::ForcedGC); 1811 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith outSweep, Heap::ForcedGC);
1814 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); 1812 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls);
(...skipping 18 matching lines...) Expand all
1833 EXPECT_EQ(i + 1, LargeHeapObject::s_destructorCalls); 1831 EXPECT_EQ(i + 1, LargeHeapObject::s_destructorCalls);
1834 } 1832 }
1835 LargeHeapObject::create(); 1833 LargeHeapObject::create();
1836 LargeHeapObject::create(); 1834 LargeHeapObject::create();
1837 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); 1835 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls);
1838 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith outSweep, Heap::ForcedGC); 1836 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith outSweep, Heap::ForcedGC);
1839 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); 1837 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls);
1840 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGC); 1838 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith Sweep, Heap::ForcedGC);
1841 EXPECT_EQ(22, LargeHeapObject::s_destructorCalls); 1839 EXPECT_EQ(22, LargeHeapObject::s_destructorCalls);
1842 } 1840 }
1843 #endif
1844 1841
1845 TEST(HeapTest, Finalization) 1842 TEST(HeapTest, Finalization)
1846 { 1843 {
1847 { 1844 {
1848 HeapTestSubClass* t1 = HeapTestSubClass::create(); 1845 HeapTestSubClass* t1 = HeapTestSubClass::create();
1849 HeapTestSubClass* t2 = HeapTestSubClass::create(); 1846 HeapTestSubClass* t2 = HeapTestSubClass::create();
1850 HeapTestSuperClass* t3 = HeapTestSuperClass::create(); 1847 HeapTestSuperClass* t3 = HeapTestSuperClass::create();
1851 // FIXME(oilpan): Ignore unused variables. 1848 // FIXME(oilpan): Ignore unused variables.
1852 (void)t1; 1849 (void)t1;
1853 (void)t2; 1850 (void)t2;
(...skipping 4149 matching lines...) Expand 10 before | Expand all | Expand 10 after
6003 { 6000 {
6004 Persistent<ClassWithMember> object = ClassWithMember::create(); 6001 Persistent<ClassWithMember> object = ClassWithMember::create();
6005 EXPECT_EQ(0, object->traceCount()); 6002 EXPECT_EQ(0, object->traceCount());
6006 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object. get()); 6003 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object. get());
6007 EXPECT_TRUE(mixin); 6004 EXPECT_TRUE(mixin);
6008 EXPECT_GT(object->traceCount(), 0); 6005 EXPECT_GT(object->traceCount(), 0);
6009 EXPECT_GT(mixin->traceCount(), 0); 6006 EXPECT_GT(mixin->traceCount(), 0);
6010 } 6007 }
6011 6008
6012 } // namespace blink 6009 } // namespace blink
OLDNEW
« no previous file with comments | « Source/platform/heap/Heap.h ('k') | Source/platform/heap/ThreadState.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698