| OLD | NEW |
| 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 Loading... |
| 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) |
| 1803 TEST(HeapTest, LazySweepingPages) | 1805 TEST(HeapTest, LazySweepingPages) |
| 1804 { | 1806 { |
| 1805 clearOutOldGarbage(); | 1807 clearOutOldGarbage(); |
| 1806 | 1808 |
| 1807 SimpleFinalizedObject::s_destructorCalls = 0; | 1809 SimpleFinalizedObject::s_destructorCalls = 0; |
| 1808 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); | 1810 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); |
| 1809 for (int i = 0; i < 1000; i++) | 1811 for (int i = 0; i < 1000; i++) |
| 1810 SimpleFinalizedObject::create(); | 1812 SimpleFinalizedObject::create(); |
| 1811 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
outSweep, Heap::ForcedGC); | 1813 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
outSweep, Heap::ForcedGC); |
| 1812 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); | 1814 EXPECT_EQ(0, SimpleFinalizedObject::s_destructorCalls); |
| (...skipping 18 matching lines...) Expand all Loading... |
| 1831 EXPECT_EQ(i + 1, LargeHeapObject::s_destructorCalls); | 1833 EXPECT_EQ(i + 1, LargeHeapObject::s_destructorCalls); |
| 1832 } | 1834 } |
| 1833 LargeHeapObject::create(); | 1835 LargeHeapObject::create(); |
| 1834 LargeHeapObject::create(); | 1836 LargeHeapObject::create(); |
| 1835 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); | 1837 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); |
| 1836 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
outSweep, Heap::ForcedGC); | 1838 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
outSweep, Heap::ForcedGC); |
| 1837 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); | 1839 EXPECT_EQ(10, LargeHeapObject::s_destructorCalls); |
| 1838 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); | 1840 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack, ThreadState::GCWith
Sweep, Heap::ForcedGC); |
| 1839 EXPECT_EQ(22, LargeHeapObject::s_destructorCalls); | 1841 EXPECT_EQ(22, LargeHeapObject::s_destructorCalls); |
| 1840 } | 1842 } |
| 1843 #endif |
| 1841 | 1844 |
| 1842 TEST(HeapTest, Finalization) | 1845 TEST(HeapTest, Finalization) |
| 1843 { | 1846 { |
| 1844 { | 1847 { |
| 1845 HeapTestSubClass* t1 = HeapTestSubClass::create(); | 1848 HeapTestSubClass* t1 = HeapTestSubClass::create(); |
| 1846 HeapTestSubClass* t2 = HeapTestSubClass::create(); | 1849 HeapTestSubClass* t2 = HeapTestSubClass::create(); |
| 1847 HeapTestSuperClass* t3 = HeapTestSuperClass::create(); | 1850 HeapTestSuperClass* t3 = HeapTestSuperClass::create(); |
| 1848 // FIXME(oilpan): Ignore unused variables. | 1851 // FIXME(oilpan): Ignore unused variables. |
| 1849 (void)t1; | 1852 (void)t1; |
| 1850 (void)t2; | 1853 (void)t2; |
| (...skipping 4149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 6000 { | 6003 { |
| 6001 Persistent<ClassWithMember> object = ClassWithMember::create(); | 6004 Persistent<ClassWithMember> object = ClassWithMember::create(); |
| 6002 EXPECT_EQ(0, object->traceCount()); | 6005 EXPECT_EQ(0, object->traceCount()); |
| 6003 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); | 6006 TestMixinAllocatingObject* mixin = TestMixinAllocatingObject::create(object.
get()); |
| 6004 EXPECT_TRUE(mixin); | 6007 EXPECT_TRUE(mixin); |
| 6005 EXPECT_GT(object->traceCount(), 0); | 6008 EXPECT_GT(object->traceCount(), 0); |
| 6006 EXPECT_GT(mixin->traceCount(), 0); | 6009 EXPECT_GT(mixin->traceCount(), 0); |
| 6007 } | 6010 } |
| 6008 | 6011 |
| 6009 } // namespace blink | 6012 } // namespace blink |
| OLD | NEW |