| 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 1823 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1834 | 1834 |
| 1835 TEST(HeapTest, LargeObjects) | 1835 TEST(HeapTest, LargeObjects) |
| 1836 { | 1836 { |
| 1837 HeapStats initialHeapSize; | 1837 HeapStats initialHeapSize; |
| 1838 clearOutOldGarbage(&initialHeapSize); | 1838 clearOutOldGarbage(&initialHeapSize); |
| 1839 IntWrapper::s_destructorCalls = 0; | 1839 IntWrapper::s_destructorCalls = 0; |
| 1840 LargeObject::s_destructorCalls = 0; | 1840 LargeObject::s_destructorCalls = 0; |
| 1841 { | 1841 { |
| 1842 int slack = 8; // LargeObject points to an IntWrapper that is also alloc
ated. | 1842 int slack = 8; // LargeObject points to an IntWrapper that is also alloc
ated. |
| 1843 Persistent<LargeObject> object = LargeObject::create(); | 1843 Persistent<LargeObject> object = LargeObject::create(); |
| 1844 EXPECT_TRUE(ThreadState::current()->contains(object)); |
| 1845 EXPECT_TRUE(ThreadState::current()->contains(reinterpret_cast<char*>(obj
ect.get()) + sizeof(LargeObject) - 1)); |
| 1846 #if ENABLE(GC_TRACING) |
| 1847 const GCInfo* info = ThreadState::current()->findGCInfo(reinterpret_cast
<Address>(object.get())); |
| 1848 EXPECT_NE(reinterpret_cast<const GCInfo*>(0), info); |
| 1849 EXPECT_EQ(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr
ess>(object.get()) + sizeof(LargeObject) - 1)); |
| 1850 EXPECT_NE(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr
ess>(object.get()) + sizeof(LargeObject))); |
| 1851 EXPECT_NE(info, ThreadState::current()->findGCInfo(reinterpret_cast<Addr
ess>(object.get()) - 1)); |
| 1852 #endif |
| 1844 HeapStats afterAllocation; | 1853 HeapStats afterAllocation; |
| 1845 clearOutOldGarbage(&afterAllocation); | 1854 clearOutOldGarbage(&afterAllocation); |
| 1846 { | 1855 { |
| 1847 object->set(0, 'a'); | 1856 object->set(0, 'a'); |
| 1848 EXPECT_EQ('a', object->get(0)); | 1857 EXPECT_EQ('a', object->get(0)); |
| 1849 object->set(object->length() - 1, 'b'); | 1858 object->set(object->length() - 1, 'b'); |
| 1850 EXPECT_EQ('b', object->get(object->length() - 1)); | 1859 EXPECT_EQ('b', object->get(object->length() - 1)); |
| 1851 size_t expectedObjectSpace = sizeof(LargeObject) + sizeof(IntWrapper
); | 1860 size_t expectedObjectSpace = sizeof(LargeObject) + sizeof(IntWrapper
); |
| 1852 size_t actualObjectSpace = | 1861 size_t actualObjectSpace = |
| 1853 afterAllocation.totalObjectSpace() - initialHeapSize.totalObject
Space(); | 1862 afterAllocation.totalObjectSpace() - initialHeapSize.totalObject
Space(); |
| (...skipping 2020 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3874 { | 3883 { |
| 3875 Persistent<MixinB> b = obj; | 3884 Persistent<MixinB> b = obj; |
| 3876 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 3885 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 3877 EXPECT_EQ(0, IntWrapper::s_destructorCalls); | 3886 EXPECT_EQ(0, IntWrapper::s_destructorCalls); |
| 3878 } | 3887 } |
| 3879 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); | 3888 Heap::collectGarbage(ThreadState::NoHeapPointersOnStack); |
| 3880 EXPECT_EQ(3, IntWrapper::s_destructorCalls); | 3889 EXPECT_EQ(3, IntWrapper::s_destructorCalls); |
| 3881 } | 3890 } |
| 3882 | 3891 |
| 3883 } // WebCore namespace | 3892 } // WebCore namespace |
| OLD | NEW |