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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
63 // align all allocations even on 32 bit. | 63 // align all allocations even on 32 bit. |
64 const size_t allocationGranularity = 8; | 64 const size_t allocationGranularity = 8; |
65 const size_t allocationMask = allocationGranularity - 1; | 65 const size_t allocationMask = allocationGranularity - 1; |
66 const size_t objectStartBitMapSize = (blinkPageSize + ((8 * allocationGranularit y) - 1)) / (8 * allocationGranularity); | 66 const size_t objectStartBitMapSize = (blinkPageSize + ((8 * allocationGranularit y) - 1)) / (8 * allocationGranularity); |
67 const size_t reservedForObjectBitMap = ((objectStartBitMapSize + allocationMask) & ~allocationMask); | 67 const size_t reservedForObjectBitMap = ((objectStartBitMapSize + allocationMask) & ~allocationMask); |
68 const size_t maxHeapObjectSize = 1 << 27; | 68 const size_t maxHeapObjectSize = 1 << 27; |
69 | 69 |
70 const size_t markBitMask = 1; | 70 const size_t markBitMask = 1; |
71 const size_t freeListMask = 2; | 71 const size_t freeListMask = 2; |
72 const size_t debugBitMask = 4; | 72 const size_t debugBitMask = 4; |
73 #if GC_PROFILE_HEAP | |
74 const size_t heapObjectGenerations = 8; | |
75 const size_t maxHeapObjectAge = heapObjectGenerations - 1; | |
76 const size_t heapObjectAgeMask = ~(maxHeapObjectSize - 1); | |
77 const size_t sizeMask = ~heapObjectAgeMask & ~7; | |
78 #else | |
73 const size_t sizeMask = ~7; | 79 const size_t sizeMask = ~7; |
80 #endif | |
74 const uint8_t freelistZapValue = 42; | 81 const uint8_t freelistZapValue = 42; |
75 const uint8_t finalizedZapValue = 24; | 82 const uint8_t finalizedZapValue = 24; |
76 | 83 |
77 class HeapStats; | 84 class HeapStats; |
78 class PageMemory; | 85 class PageMemory; |
79 template<ThreadAffinity affinity> class ThreadLocalPersistents; | 86 template<ThreadAffinity affinity> class ThreadLocalPersistents; |
80 template<typename T, typename RootsAccessor = ThreadLocalPersistents<ThreadingTr ait<T>::Affinity > > class Persistent; | 87 template<typename T, typename RootsAccessor = ThreadLocalPersistents<ThreadingTr ait<T>::Affinity > > class Persistent; |
81 template<typename T> class CrossThreadPersistent; | 88 template<typename T> class CrossThreadPersistent; |
82 | 89 |
90 #if GC_PROFILE_HEAP | |
91 class TracedArrayBase; | |
92 class TracedDictionaryBase; | |
93 #endif | |
94 | |
83 PLATFORM_EXPORT size_t osPageSize(); | 95 PLATFORM_EXPORT size_t osPageSize(); |
84 | 96 |
85 // Blink heap pages are set up with a guard page before and after the | 97 // Blink heap pages are set up with a guard page before and after the |
86 // payload. | 98 // payload. |
87 inline size_t blinkPagePayloadSize() | 99 inline size_t blinkPagePayloadSize() |
88 { | 100 { |
89 return blinkPageSize - 2 * osPageSize(); | 101 return blinkPageSize - 2 * osPageSize(); |
90 } | 102 } |
91 | 103 |
92 // Blink heap pages are aligned to the Blink heap page size. | 104 // Blink heap pages are aligned to the Blink heap page size. |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
151 // Check if the given address points to an object in this | 163 // Check if the given address points to an object in this |
152 // heap page. If so, find the start of that object and mark it | 164 // heap page. If so, find the start of that object and mark it |
153 // using the given Visitor. Otherwise do nothing. The pointer must | 165 // using the given Visitor. Otherwise do nothing. The pointer must |
154 // be within the same aligned blinkPageSize as the this-pointer. | 166 // be within the same aligned blinkPageSize as the this-pointer. |
155 // | 167 // |
156 // This is used during conservative stack scanning to | 168 // This is used during conservative stack scanning to |
157 // conservatively mark all objects that could be referenced from | 169 // conservatively mark all objects that could be referenced from |
158 // the stack. | 170 // the stack. |
159 virtual void checkAndMarkPointer(Visitor*, Address) = 0; | 171 virtual void checkAndMarkPointer(Visitor*, Address) = 0; |
160 | 172 |
161 #if ENABLE(GC_TRACING) | 173 #if GC_PROFILE_MARKING |
162 virtual const GCInfo* findGCInfo(Address) = 0; | 174 virtual const GCInfo* findGCInfo(Address) = 0; |
163 #endif | 175 #endif |
164 | 176 |
165 Address address() { return reinterpret_cast<Address>(this); } | 177 Address address() { return reinterpret_cast<Address>(this); } |
166 PageMemory* storage() const { return m_storage; } | 178 PageMemory* storage() const { return m_storage; } |
167 ThreadState* threadState() const { return m_threadState; } | 179 ThreadState* threadState() const { return m_threadState; } |
168 const GCInfo* gcInfo() { return m_gcInfo; } | 180 const GCInfo* gcInfo() { return m_gcInfo; } |
169 virtual bool isLargeObject() { return false; } | 181 virtual bool isLargeObject() { return false; } |
170 | 182 |
171 private: | 183 private: |
(...skipping 23 matching lines...) Expand all Loading... | |
195 class LargeHeapObject : public BaseHeapPage { | 207 class LargeHeapObject : public BaseHeapPage { |
196 public: | 208 public: |
197 LargeHeapObject(PageMemory* storage, const GCInfo* gcInfo, ThreadState* stat e) : BaseHeapPage(storage, gcInfo, state) | 209 LargeHeapObject(PageMemory* storage, const GCInfo* gcInfo, ThreadState* stat e) : BaseHeapPage(storage, gcInfo, state) |
198 { | 210 { |
199 COMPILE_ASSERT(!(sizeof(LargeHeapObject<Header>) & allocationMask), larg e_heap_object_header_misaligned); | 211 COMPILE_ASSERT(!(sizeof(LargeHeapObject<Header>) & allocationMask), larg e_heap_object_header_misaligned); |
200 } | 212 } |
201 | 213 |
202 virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE; | 214 virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE; |
203 virtual bool isLargeObject() OVERRIDE { return true; } | 215 virtual bool isLargeObject() OVERRIDE { return true; } |
204 | 216 |
205 #if ENABLE(GC_TRACING) | 217 #if GC_PROFILE_MARKING |
206 virtual const GCInfo* findGCInfo(Address address) | 218 virtual const GCInfo* findGCInfo(Address address) |
207 { | 219 { |
208 if (!objectContains(address)) | 220 if (!objectContains(address)) |
209 return 0; | 221 return 0; |
210 return gcInfo(); | 222 return gcInfo(); |
211 } | 223 } |
212 #endif | 224 #endif |
213 | 225 |
226 #if GC_PROFILE_HEAP | |
227 void snapshot(TracedDictionaryBase*, ThreadState::SnapshotInfo*); | |
228 #endif | |
229 | |
214 void link(LargeHeapObject<Header>** previousNext) | 230 void link(LargeHeapObject<Header>** previousNext) |
215 { | 231 { |
216 m_next = *previousNext; | 232 m_next = *previousNext; |
217 *previousNext = this; | 233 *previousNext = this; |
218 } | 234 } |
219 | 235 |
220 void unlink(LargeHeapObject<Header>** previousNext) | 236 void unlink(LargeHeapObject<Header>** previousNext) |
221 { | 237 { |
222 *previousNext = m_next; | 238 *previousNext = m_next; |
223 } | 239 } |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
278 : m_size(encodedSize) { } | 294 : m_size(encodedSize) { } |
279 | 295 |
280 static size_t freeListEncodedSize(size_t size) { return size | freeListMask; } | 296 static size_t freeListEncodedSize(size_t size) { return size | freeListMask; } |
281 | 297 |
282 NO_SANITIZE_ADDRESS | 298 NO_SANITIZE_ADDRESS |
283 bool isFree() { return m_size & freeListMask; } | 299 bool isFree() { return m_size & freeListMask; } |
284 | 300 |
285 NO_SANITIZE_ADDRESS | 301 NO_SANITIZE_ADDRESS |
286 size_t size() const { return m_size & sizeMask; } | 302 size_t size() const { return m_size & sizeMask; } |
287 | 303 |
304 #if GC_PROFILE_HEAP | |
305 NO_SANITIZE_ADDRESS | |
306 size_t encodedSize() const { return m_size; } | |
307 | |
308 NO_SANITIZE_ADDRESS size_t age() const { return m_size >> 27; } | |
Mads Ager (chromium)
2014/07/11 11:26:54
Let's consistently add NO_SANITIZE_ADDRESS on a li
zerny-chromium
2014/07/11 11:56:37
Acknowledged.
| |
309 | |
310 NO_SANITIZE_ADDRESS void incAge() | |
311 { | |
312 size_t current = age(); | |
313 if (current < 7) | |
314 m_size = ((current + 1) << 27) | (m_size & ~heapObjectAgeMask); | |
315 } | |
316 #endif | |
317 | |
288 protected: | 318 protected: |
289 size_t m_size; | 319 size_t m_size; |
290 }; | 320 }; |
291 | 321 |
292 // Our heap object layout is layered with the HeapObjectHeader closest | 322 // Our heap object layout is layered with the HeapObjectHeader closest |
293 // to the payload, this can be wrapped in a FinalizedObjectHeader if the | 323 // to the payload, this can be wrapped in a FinalizedObjectHeader if the |
294 // object is on the GeneralHeap and not on a specific TypedHeap. | 324 // object is on the GeneralHeap and not on a specific TypedHeap. |
295 // Finally if the object is a large object (> blinkPageSize/2) then it is | 325 // Finally if the object is a large object (> blinkPageSize/2) then it is |
296 // wrapped with a LargeObjectHeader. | 326 // wrapped with a LargeObjectHeader. |
297 // | 327 // |
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
488 } | 518 } |
489 | 519 |
490 Address end() { return payload() + payloadSize(); } | 520 Address end() { return payload() + payloadSize(); } |
491 | 521 |
492 void getStats(HeapStats&); | 522 void getStats(HeapStats&); |
493 void clearMarks(); | 523 void clearMarks(); |
494 void sweep(); | 524 void sweep(); |
495 void clearObjectStartBitMap(); | 525 void clearObjectStartBitMap(); |
496 void finalize(Header*); | 526 void finalize(Header*); |
497 virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE; | 527 virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE; |
498 #if ENABLE(GC_TRACING) | 528 #if GC_PROFILE_MARKING |
499 const GCInfo* findGCInfo(Address) OVERRIDE; | 529 const GCInfo* findGCInfo(Address) OVERRIDE; |
500 #endif | 530 #endif |
531 #if GC_PROFILE_HEAP | |
532 virtual void snapshot(TracedArrayBase*, ThreadState::SnapshotInfo*); | |
533 #endif | |
501 ThreadHeap<Header>* heap() { return m_heap; } | 534 ThreadHeap<Header>* heap() { return m_heap; } |
502 #if defined(ADDRESS_SANITIZER) | 535 #if defined(ADDRESS_SANITIZER) |
503 void poisonUnmarkedObjects(); | 536 void poisonUnmarkedObjects(); |
504 #endif | 537 #endif |
505 | 538 |
506 protected: | 539 protected: |
507 Header* findHeaderFromAddress(Address); | 540 Header* findHeaderFromAddress(Address); |
508 void populateObjectStartBitMap(); | 541 void populateObjectStartBitMap(); |
509 bool isObjectStartBitMapComputed() { return m_objectStartBitMapComputed; } | 542 bool isObjectStartBitMapComputed() { return m_objectStartBitMapComputed; } |
510 TraceCallback traceCallback(Header*); | 543 TraceCallback traceCallback(Header*); |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
754 // Non-template super class used to pass a heap around to other classes. | 787 // Non-template super class used to pass a heap around to other classes. |
755 class BaseHeap { | 788 class BaseHeap { |
756 public: | 789 public: |
757 virtual ~BaseHeap() { } | 790 virtual ~BaseHeap() { } |
758 | 791 |
759 // Find the page in this thread heap containing the given | 792 // Find the page in this thread heap containing the given |
760 // address. Returns 0 if the address is not contained in any | 793 // address. Returns 0 if the address is not contained in any |
761 // page in this thread heap. | 794 // page in this thread heap. |
762 virtual BaseHeapPage* heapPageFromAddress(Address) = 0; | 795 virtual BaseHeapPage* heapPageFromAddress(Address) = 0; |
763 | 796 |
764 #if ENABLE(GC_TRACING) | 797 #if GC_PROFILE_MARKING |
765 virtual const GCInfo* findGCInfoOfLargeHeapObject(Address) = 0; | 798 virtual const GCInfo* findGCInfoOfLargeHeapObject(Address) = 0; |
766 #endif | 799 #endif |
767 | 800 |
801 #if GC_PROFILE_HEAP | |
802 virtual void snapshot(TracedDictionaryBase*, ThreadState::SnapshotInfo*) = 0 ; | |
803 #endif | |
804 | |
768 // Sweep this part of the Blink heap. This finalizes dead objects | 805 // Sweep this part of the Blink heap. This finalizes dead objects |
769 // and builds freelists for all the unused memory. | 806 // and builds freelists for all the unused memory. |
770 virtual void sweep() = 0; | 807 virtual void sweep() = 0; |
771 | 808 |
772 // Forcefully finalize all objects in this part of the Blink heap | 809 // Forcefully finalize all objects in this part of the Blink heap |
773 // (potentially with the exception of one object). This is used | 810 // (potentially with the exception of one object). This is used |
774 // during thread termination to make sure that all objects for the | 811 // during thread termination to make sure that all objects for the |
775 // dying thread are finalized. | 812 // dying thread are finalized. |
776 virtual void assertEmpty() = 0; | 813 virtual void assertEmpty() = 0; |
777 | 814 |
(...skipping 22 matching lines...) Expand all Loading... | |
800 // (potentially adding new pages to the heap), to find and mark | 837 // (potentially adding new pages to the heap), to find and mark |
801 // objects during conservative stack scanning and to sweep the set of | 838 // objects during conservative stack scanning and to sweep the set of |
802 // pages after a GC. | 839 // pages after a GC. |
803 template<typename Header> | 840 template<typename Header> |
804 class ThreadHeap : public BaseHeap { | 841 class ThreadHeap : public BaseHeap { |
805 public: | 842 public: |
806 ThreadHeap(ThreadState*); | 843 ThreadHeap(ThreadState*); |
807 virtual ~ThreadHeap(); | 844 virtual ~ThreadHeap(); |
808 | 845 |
809 virtual BaseHeapPage* heapPageFromAddress(Address); | 846 virtual BaseHeapPage* heapPageFromAddress(Address); |
810 #if ENABLE(GC_TRACING) | 847 #if GC_PROFILE_MARKING |
811 virtual const GCInfo* findGCInfoOfLargeHeapObject(Address); | 848 virtual const GCInfo* findGCInfoOfLargeHeapObject(Address); |
812 #endif | 849 #endif |
850 #if GC_PROFILE_HEAP | |
851 virtual void snapshot(TracedDictionaryBase*, ThreadState::SnapshotInfo*); | |
852 #endif | |
813 virtual void sweep(); | 853 virtual void sweep(); |
814 virtual void assertEmpty(); | 854 virtual void assertEmpty(); |
815 virtual void clearFreeLists(); | 855 virtual void clearFreeLists(); |
816 virtual void clearMarks(); | 856 virtual void clearMarks(); |
817 #ifndef NDEBUG | 857 #ifndef NDEBUG |
818 virtual void getScannedStats(HeapStats&); | 858 virtual void getScannedStats(HeapStats&); |
819 #endif | 859 #endif |
820 | 860 |
821 virtual void makeConsistentForGC(); | 861 virtual void makeConsistentForGC(); |
822 virtual bool isConsistentForGC(); | 862 virtual bool isConsistentForGC(); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
952 static void collectGarbage(ThreadState::StackState); | 992 static void collectGarbage(ThreadState::StackState); |
953 static void collectAllGarbage(); | 993 static void collectAllGarbage(); |
954 static void setForcePreciseGCForTesting(); | 994 static void setForcePreciseGCForTesting(); |
955 | 995 |
956 static void prepareForGC(); | 996 static void prepareForGC(); |
957 | 997 |
958 // Conservatively checks whether an address is a pointer in any of the threa d | 998 // Conservatively checks whether an address is a pointer in any of the threa d |
959 // heaps. If so marks the object pointed to as live. | 999 // heaps. If so marks the object pointed to as live. |
960 static Address checkAndMarkPointer(Visitor*, Address); | 1000 static Address checkAndMarkPointer(Visitor*, Address); |
961 | 1001 |
962 #if ENABLE(GC_TRACING) | 1002 #if GC_PROFILE_MARKING |
963 // Dump the path to specified object on the next GC. This method is to be in voked from GDB. | 1003 // Dump the path to specified object on the next GC. This method is to be in voked from GDB. |
964 static void dumpPathToObjectOnNextGC(void* p); | 1004 static void dumpPathToObjectOnNextGC(void* p); |
965 | 1005 |
966 // Forcibly find GCInfo of the object at Address. | 1006 // Forcibly find GCInfo of the object at Address. |
967 // This is slow and should only be used for debug purposes. | 1007 // This is slow and should only be used for debug purposes. |
968 // It involves finding the heap page and scanning the heap page for an objec t header. | 1008 // It involves finding the heap page and scanning the heap page for an objec t header. |
969 static const GCInfo* findGCInfo(Address); | 1009 static const GCInfo* findGCInfo(Address); |
970 | 1010 |
971 static String createBacktraceString(); | 1011 static String createBacktraceString(); |
972 #endif | 1012 #endif |
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1793 template<typename Key, typename Value, typename T, typename U, typename V> | 1833 template<typename Key, typename Value, typename T, typename U, typename V> |
1794 struct GCInfoTrait<HashMap<Key, Value, T, U, V, HeapAllocator> > { | 1834 struct GCInfoTrait<HashMap<Key, Value, T, U, V, HeapAllocator> > { |
1795 static const GCInfo* get() | 1835 static const GCInfo* get() |
1796 { | 1836 { |
1797 typedef HashMap<Key, Value, T, U, V, HeapAllocator> TargetType; | 1837 typedef HashMap<Key, Value, T, U, V, HeapAllocator> TargetType; |
1798 static const GCInfo info = { | 1838 static const GCInfo info = { |
1799 TraceTrait<TargetType>::trace, | 1839 TraceTrait<TargetType>::trace, |
1800 0, | 1840 0, |
1801 false, // HashMap needs no finalizer. | 1841 false, // HashMap needs no finalizer. |
1802 WTF::IsPolymorphic<TargetType>::value, | 1842 WTF::IsPolymorphic<TargetType>::value, |
1803 #if ENABLE(GC_TRACING) | 1843 #if GC_PROFILE_DEFINE_CLASSNAME |
1804 TypenameStringTrait<TargetType>::get() | 1844 TypenameStringTrait<TargetType>::get() |
1805 #endif | 1845 #endif |
1806 }; | 1846 }; |
1807 return &info; | 1847 return &info; |
1808 } | 1848 } |
1809 }; | 1849 }; |
1810 | 1850 |
1811 template<typename T, typename U, typename V> | 1851 template<typename T, typename U, typename V> |
1812 struct GCInfoTrait<HashSet<T, U, V, HeapAllocator> > { | 1852 struct GCInfoTrait<HashSet<T, U, V, HeapAllocator> > { |
1813 static const GCInfo* get() | 1853 static const GCInfo* get() |
1814 { | 1854 { |
1815 typedef HashSet<T, U, V, HeapAllocator> TargetType; | 1855 typedef HashSet<T, U, V, HeapAllocator> TargetType; |
1816 static const GCInfo info = { | 1856 static const GCInfo info = { |
1817 TraceTrait<TargetType>::trace, | 1857 TraceTrait<TargetType>::trace, |
1818 0, | 1858 0, |
1819 false, // HashSet needs no finalizer. | 1859 false, // HashSet needs no finalizer. |
1820 WTF::IsPolymorphic<TargetType>::value, | 1860 WTF::IsPolymorphic<TargetType>::value, |
1821 #if ENABLE(GC_TRACING) | 1861 #if GC_PROFILE_DEFINE_CLASSNAME |
1822 TypenameStringTrait<TargetType>::get() | 1862 TypenameStringTrait<TargetType>::get() |
1823 #endif | 1863 #endif |
1824 }; | 1864 }; |
1825 return &info; | 1865 return &info; |
1826 } | 1866 } |
1827 }; | 1867 }; |
1828 | 1868 |
1829 template<typename T, typename U, typename V> | 1869 template<typename T, typename U, typename V> |
1830 struct GCInfoTrait<LinkedHashSet<T, U, V, HeapAllocator> > { | 1870 struct GCInfoTrait<LinkedHashSet<T, U, V, HeapAllocator> > { |
1831 static const GCInfo* get() | 1871 static const GCInfo* get() |
1832 { | 1872 { |
1833 typedef LinkedHashSet<T, U, V, HeapAllocator> TargetType; | 1873 typedef LinkedHashSet<T, U, V, HeapAllocator> TargetType; |
1834 static const GCInfo info = { | 1874 static const GCInfo info = { |
1835 TraceTrait<TargetType>::trace, | 1875 TraceTrait<TargetType>::trace, |
1836 LinkedHashSet<T, U, V, HeapAllocator>::finalize, | 1876 LinkedHashSet<T, U, V, HeapAllocator>::finalize, |
1837 true, // Needs finalization. The anchor needs to unlink itself from the chain. | 1877 true, // Needs finalization. The anchor needs to unlink itself from the chain. |
1838 WTF::IsPolymorphic<TargetType>::value, | 1878 WTF::IsPolymorphic<TargetType>::value, |
1839 #if ENABLE(GC_TRACING) | 1879 #if GC_PROFILE_DEFINE_CLASSNAME |
1840 TypenameStringTrait<TargetType>::get() | 1880 TypenameStringTrait<TargetType>::get() |
1841 #endif | 1881 #endif |
1842 }; | 1882 }; |
1843 return &info; | 1883 return &info; |
1844 } | 1884 } |
1845 }; | 1885 }; |
1846 | 1886 |
1847 template<typename ValueArg, size_t inlineCapacity, typename U> | 1887 template<typename ValueArg, size_t inlineCapacity, typename U> |
1848 struct GCInfoTrait<ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAlloc ator<ValueArg, inlineCapacity> > > { | 1888 struct GCInfoTrait<ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAlloc ator<ValueArg, inlineCapacity> > > { |
1849 static const GCInfo* get() | 1889 static const GCInfo* get() |
1850 { | 1890 { |
1851 typedef WTF::ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAll ocator<ValueArg, inlineCapacity> > TargetType; | 1891 typedef WTF::ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAll ocator<ValueArg, inlineCapacity> > TargetType; |
1852 static const GCInfo info = { | 1892 static const GCInfo info = { |
1853 TraceTrait<TargetType>::trace, | 1893 TraceTrait<TargetType>::trace, |
1854 0, | 1894 0, |
1855 false, // ListHashSet needs no finalization though its backing might . | 1895 false, // ListHashSet needs no finalization though its backing might . |
1856 false, // no vtable. | 1896 false, // no vtable. |
1857 #if ENABLE(GC_TRACING) | 1897 #if GC_PROFILE_DEFINE_CLASSNAME |
1858 TypenameStringTrait<TargetType>::get() | 1898 TypenameStringTrait<TargetType>::get() |
1859 #endif | 1899 #endif |
1860 }; | 1900 }; |
1861 return &info; | 1901 return &info; |
1862 } | 1902 } |
1863 }; | 1903 }; |
1864 | 1904 |
1865 template<typename T, typename Allocator> | 1905 template<typename T, typename Allocator> |
1866 struct GCInfoTrait<WTF::ListHashSetNode<T, Allocator> > { | 1906 struct GCInfoTrait<WTF::ListHashSetNode<T, Allocator> > { |
1867 static const GCInfo* get() | 1907 static const GCInfo* get() |
1868 { | 1908 { |
1869 typedef WTF::ListHashSetNode<T, Allocator> TargetType; | 1909 typedef WTF::ListHashSetNode<T, Allocator> TargetType; |
1870 static const GCInfo info = { | 1910 static const GCInfo info = { |
1871 TraceTrait<TargetType>::trace, | 1911 TraceTrait<TargetType>::trace, |
1872 TargetType::finalize, | 1912 TargetType::finalize, |
1873 WTF::HashTraits<T>::needsDestruction, // The node needs destruction if its data does. | 1913 WTF::HashTraits<T>::needsDestruction, // The node needs destruction if its data does. |
1874 false, // no vtable. | 1914 false, // no vtable. |
1875 #if ENABLE(GC_TRACING) | 1915 #if GC_PROFILE_DEFINE_CLASSNAME |
1876 TypenameStringTrait<TargetType>::get() | 1916 TypenameStringTrait<TargetType>::get() |
1877 #endif | 1917 #endif |
1878 }; | 1918 }; |
1879 return &info; | 1919 return &info; |
1880 } | 1920 } |
1881 }; | 1921 }; |
1882 | 1922 |
1883 template<typename T> | 1923 template<typename T> |
1884 struct GCInfoTrait<Vector<T, 0, HeapAllocator> > { | 1924 struct GCInfoTrait<Vector<T, 0, HeapAllocator> > { |
1885 static const GCInfo* get() | 1925 static const GCInfo* get() |
1886 { | 1926 { |
1887 #if ENABLE(GC_TRACING) | 1927 #if GC_PROFILE_DEFINE_CLASSNAME |
1888 typedef Vector<T, 0, HeapAllocator> TargetType; | 1928 typedef Vector<T, 0, HeapAllocator> TargetType; |
1889 #endif | 1929 #endif |
1890 static const GCInfo info = { | 1930 static const GCInfo info = { |
1891 TraceTrait<Vector<T, 0, HeapAllocator> >::trace, | 1931 TraceTrait<Vector<T, 0, HeapAllocator> >::trace, |
1892 0, | 1932 0, |
1893 false, // Vector needs no finalizer if it has no inline capacity. | 1933 false, // Vector needs no finalizer if it has no inline capacity. |
1894 WTF::IsPolymorphic<Vector<T, 0, HeapAllocator> >::value, | 1934 WTF::IsPolymorphic<Vector<T, 0, HeapAllocator> >::value, |
1895 #if ENABLE(GC_TRACING) | 1935 #if GC_PROFILE_DEFINE_CLASSNAME |
1896 TypenameStringTrait<TargetType>::get() | 1936 TypenameStringTrait<TargetType>::get() |
1897 #endif | 1937 #endif |
1898 }; | 1938 }; |
1899 return &info; | 1939 return &info; |
1900 } | 1940 } |
1901 }; | 1941 }; |
1902 | 1942 |
1903 template<typename T, size_t inlineCapacity> | 1943 template<typename T, size_t inlineCapacity> |
1904 struct FinalizerTrait<Vector<T, inlineCapacity, HeapAllocator> > : public Finali zerTraitImpl<Vector<T, inlineCapacity, HeapAllocator>, true> { }; | 1944 struct FinalizerTrait<Vector<T, inlineCapacity, HeapAllocator> > : public Finali zerTraitImpl<Vector<T, inlineCapacity, HeapAllocator>, true> { }; |
1905 | 1945 |
1906 template<typename T, size_t inlineCapacity> | 1946 template<typename T, size_t inlineCapacity> |
1907 struct GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator> > { | 1947 struct GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator> > { |
1908 static const GCInfo* get() | 1948 static const GCInfo* get() |
1909 { | 1949 { |
1910 typedef Vector<T, inlineCapacity, HeapAllocator> TargetType; | 1950 typedef Vector<T, inlineCapacity, HeapAllocator> TargetType; |
1911 static const GCInfo info = { | 1951 static const GCInfo info = { |
1912 TraceTrait<TargetType>::trace, | 1952 TraceTrait<TargetType>::trace, |
1913 FinalizerTrait<TargetType>::finalize, | 1953 FinalizerTrait<TargetType>::finalize, |
1914 // Finalizer is needed to destruct things stored in the inline capac ity. | 1954 // Finalizer is needed to destruct things stored in the inline capac ity. |
1915 inlineCapacity && VectorTraits<T>::needsDestruction, | 1955 inlineCapacity && VectorTraits<T>::needsDestruction, |
1916 WTF::IsPolymorphic<TargetType>::value, | 1956 WTF::IsPolymorphic<TargetType>::value, |
1917 #if ENABLE(GC_TRACING) | 1957 #if GC_PROFILE_DEFINE_CLASSNAME |
1918 TypenameStringTrait<TargetType>::get() | 1958 TypenameStringTrait<TargetType>::get() |
1919 #endif | 1959 #endif |
1920 }; | 1960 }; |
1921 return &info; | 1961 return &info; |
1922 } | 1962 } |
1923 }; | 1963 }; |
1924 | 1964 |
1925 template<typename T> | 1965 template<typename T> |
1926 struct GCInfoTrait<Deque<T, 0, HeapAllocator> > { | 1966 struct GCInfoTrait<Deque<T, 0, HeapAllocator> > { |
1927 static const GCInfo* get() | 1967 static const GCInfo* get() |
1928 { | 1968 { |
1929 typedef Deque<T, 0, HeapAllocator> TargetType; | 1969 typedef Deque<T, 0, HeapAllocator> TargetType; |
1930 static const GCInfo info = { | 1970 static const GCInfo info = { |
1931 TraceTrait<TargetType>::trace, | 1971 TraceTrait<TargetType>::trace, |
1932 0, | 1972 0, |
1933 false, // Deque needs no finalizer if it has no inline capacity. | 1973 false, // Deque needs no finalizer if it has no inline capacity. |
1934 WTF::IsPolymorphic<TargetType>::value, | 1974 WTF::IsPolymorphic<TargetType>::value, |
1935 #if ENABLE(GC_TRACING) | 1975 #if GC_PROFILE_DEFINE_CLASSNAME |
1936 TypenameStringTrait<TargetType>::get() | 1976 TypenameStringTrait<TargetType>::get() |
1937 #endif | 1977 #endif |
1938 }; | 1978 }; |
1939 return &info; | 1979 return &info; |
1940 } | 1980 } |
1941 static const GCInfo info; | 1981 static const GCInfo info; |
1942 }; | 1982 }; |
1943 | 1983 |
1944 template<typename T, typename U, typename V> | 1984 template<typename T, typename U, typename V> |
1945 struct GCInfoTrait<HashCountedSet<T, U, V, HeapAllocator> > { | 1985 struct GCInfoTrait<HashCountedSet<T, U, V, HeapAllocator> > { |
1946 static const GCInfo* get() | 1986 static const GCInfo* get() |
1947 { | 1987 { |
1948 typedef HashCountedSet<T, U, V, HeapAllocator> TargetType; | 1988 typedef HashCountedSet<T, U, V, HeapAllocator> TargetType; |
1949 static const GCInfo info = { | 1989 static const GCInfo info = { |
1950 TraceTrait<TargetType>::trace, | 1990 TraceTrait<TargetType>::trace, |
1951 0, | 1991 0, |
1952 false, // HashCountedSet is just a HashTable, and needs no finalizer . | 1992 false, // HashCountedSet is just a HashTable, and needs no finalizer . |
1953 WTF::IsPolymorphic<TargetType>::value, | 1993 WTF::IsPolymorphic<TargetType>::value, |
1954 #if ENABLE(GC_TRACING) | 1994 #if GC_PROFILE_DEFINE_CLASSNAME |
1955 TypenameStringTrait<TargetType>::get() | 1995 TypenameStringTrait<TargetType>::get() |
1956 #endif | 1996 #endif |
1957 }; | 1997 }; |
1958 return &info; | 1998 return &info; |
1959 } | 1999 } |
1960 static const GCInfo info; | 2000 static const GCInfo info; |
1961 }; | 2001 }; |
1962 | 2002 |
1963 template<typename T, size_t inlineCapacity> | 2003 template<typename T, size_t inlineCapacity> |
1964 struct FinalizerTrait<Deque<T, inlineCapacity, HeapAllocator> > : public Finaliz erTraitImpl<Deque<T, inlineCapacity, HeapAllocator>, true> { }; | 2004 struct FinalizerTrait<Deque<T, inlineCapacity, HeapAllocator> > : public Finaliz erTraitImpl<Deque<T, inlineCapacity, HeapAllocator>, true> { }; |
1965 | 2005 |
1966 template<typename T, size_t inlineCapacity> | 2006 template<typename T, size_t inlineCapacity> |
1967 struct GCInfoTrait<Deque<T, inlineCapacity, HeapAllocator> > { | 2007 struct GCInfoTrait<Deque<T, inlineCapacity, HeapAllocator> > { |
1968 static const GCInfo* get() | 2008 static const GCInfo* get() |
1969 { | 2009 { |
1970 typedef Deque<T, inlineCapacity, HeapAllocator> TargetType; | 2010 typedef Deque<T, inlineCapacity, HeapAllocator> TargetType; |
1971 static const GCInfo info = { | 2011 static const GCInfo info = { |
1972 TraceTrait<TargetType>::trace, | 2012 TraceTrait<TargetType>::trace, |
1973 FinalizerTrait<TargetType>::finalize, | 2013 FinalizerTrait<TargetType>::finalize, |
1974 // Finalizer is needed to destruct things stored in the inline capac ity. | 2014 // Finalizer is needed to destruct things stored in the inline capac ity. |
1975 inlineCapacity && VectorTraits<T>::needsDestruction, | 2015 inlineCapacity && VectorTraits<T>::needsDestruction, |
1976 WTF::IsPolymorphic<TargetType>::value, | 2016 WTF::IsPolymorphic<TargetType>::value, |
1977 #if ENABLE(GC_TRACING) | 2017 #if GC_PROFILE_DEFINE_CLASSNAME |
1978 TypenameStringTrait<TargetType>::get() | 2018 TypenameStringTrait<TargetType>::get() |
1979 #endif | 2019 #endif |
1980 }; | 2020 }; |
1981 return &info; | 2021 return &info; |
1982 } | 2022 } |
1983 static const GCInfo info; | 2023 static const GCInfo info; |
1984 }; | 2024 }; |
1985 | 2025 |
1986 template<typename T, typename Traits> | 2026 template<typename T, typename Traits> |
1987 struct GCInfoTrait<HeapVectorBacking<T, Traits> > { | 2027 struct GCInfoTrait<HeapVectorBacking<T, Traits> > { |
1988 static const GCInfo* get() | 2028 static const GCInfo* get() |
1989 { | 2029 { |
1990 typedef HeapVectorBacking<T, Traits> TargetType; | 2030 typedef HeapVectorBacking<T, Traits> TargetType; |
1991 static const GCInfo info = { | 2031 static const GCInfo info = { |
1992 TraceTrait<TargetType>::trace, | 2032 TraceTrait<TargetType>::trace, |
1993 FinalizerTrait<TargetType>::finalize, | 2033 FinalizerTrait<TargetType>::finalize, |
1994 Traits::needsDestruction, | 2034 Traits::needsDestruction, |
1995 false, // We don't support embedded objects in HeapVectors with vtab les. | 2035 false, // We don't support embedded objects in HeapVectors with vtab les. |
1996 #if ENABLE(GC_TRACING) | 2036 #if GC_PROFILE_DEFINE_CLASSNAME |
1997 TypenameStringTrait<TargetType>::get() | 2037 TypenameStringTrait<TargetType>::get() |
1998 #endif | 2038 #endif |
1999 }; | 2039 }; |
2000 return &info; | 2040 return &info; |
2001 } | 2041 } |
2002 }; | 2042 }; |
2003 | 2043 |
2004 template<typename Table> | 2044 template<typename Table> |
2005 struct GCInfoTrait<HeapHashTableBacking<Table> > { | 2045 struct GCInfoTrait<HeapHashTableBacking<Table> > { |
2006 static const GCInfo* get() | 2046 static const GCInfo* get() |
2007 { | 2047 { |
2008 typedef HeapHashTableBacking<Table> TargetType; | 2048 typedef HeapHashTableBacking<Table> TargetType; |
2009 static const GCInfo info = { | 2049 static const GCInfo info = { |
2010 TraceTrait<TargetType>::trace, | 2050 TraceTrait<TargetType>::trace, |
2011 HeapHashTableBacking<Table>::finalize, | 2051 HeapHashTableBacking<Table>::finalize, |
2012 Table::ValueTraits::needsDestruction, | 2052 Table::ValueTraits::needsDestruction, |
2013 WTF::IsPolymorphic<TargetType>::value, | 2053 WTF::IsPolymorphic<TargetType>::value, |
2014 #if ENABLE(GC_TRACING) | 2054 #if GC_PROFILE_DEFINE_CLASSNAME |
2015 TypenameStringTrait<TargetType>::get() | 2055 TypenameStringTrait<TargetType>::get() |
2016 #endif | 2056 #endif |
2017 }; | 2057 }; |
2018 return &info; | 2058 return &info; |
2019 } | 2059 } |
2020 }; | 2060 }; |
2021 | 2061 |
2022 } // namespace WebCore | 2062 } // namespace WebCore |
2023 | 2063 |
2024 namespace WTF { | 2064 namespace WTF { |
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
2347 }; | 2387 }; |
2348 | 2388 |
2349 template<typename T> | 2389 template<typename T> |
2350 struct IfWeakMember<WeakMember<T> > { | 2390 struct IfWeakMember<WeakMember<T> > { |
2351 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit or->isAlive(t.get()); } | 2391 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit or->isAlive(t.get()); } |
2352 }; | 2392 }; |
2353 | 2393 |
2354 } | 2394 } |
2355 | 2395 |
2356 #endif // Heap_h | 2396 #endif // Heap_h |
OLD | NEW |