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

Side by Side Diff: Source/platform/heap/Heap.h

Issue 383743002: Oilpan: GC profiling. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: TracedValue contexts Created 6 years, 5 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
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 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
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
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
309 size_t age() const { return m_size >> 27; }
haraken 2014/07/14 02:26:14 Can we avoid hard-coding 27?
zerny-chromium 2014/07/28 11:54:41 Done.
310
311 NO_SANITIZE_ADDRESS
312 void incAge()
313 {
314 size_t current = age();
315 if (current < 7)
316 m_size = ((current + 1) << 27) | (m_size & ~heapObjectAgeMask);
317 }
318 #endif
319
288 protected: 320 protected:
289 size_t m_size; 321 size_t m_size;
290 }; 322 };
291 323
292 // Our heap object layout is layered with the HeapObjectHeader closest 324 // Our heap object layout is layered with the HeapObjectHeader closest
293 // to the payload, this can be wrapped in a FinalizedObjectHeader if the 325 // to the payload, this can be wrapped in a FinalizedObjectHeader if the
294 // object is on the GeneralHeap and not on a specific TypedHeap. 326 // 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 327 // Finally if the object is a large object (> blinkPageSize/2) then it is
296 // wrapped with a LargeObjectHeader. 328 // wrapped with a LargeObjectHeader.
297 // 329 //
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 } 520 }
489 521
490 Address end() { return payload() + payloadSize(); } 522 Address end() { return payload() + payloadSize(); }
491 523
492 void getStats(HeapStats&); 524 void getStats(HeapStats&);
493 void clearMarks(); 525 void clearMarks();
494 void sweep(); 526 void sweep();
495 void clearObjectStartBitMap(); 527 void clearObjectStartBitMap();
496 void finalize(Header*); 528 void finalize(Header*);
497 virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE; 529 virtual void checkAndMarkPointer(Visitor*, Address) OVERRIDE;
498 #if ENABLE(GC_TRACING) 530 #if GC_PROFILE_MARKING
499 const GCInfo* findGCInfo(Address) OVERRIDE; 531 const GCInfo* findGCInfo(Address) OVERRIDE;
500 #endif 532 #endif
533 #if GC_PROFILE_HEAP
534 virtual void snapshot(TracedArrayBase*, ThreadState::SnapshotInfo*);
535 #endif
501 ThreadHeap<Header>* heap() { return m_heap; } 536 ThreadHeap<Header>* heap() { return m_heap; }
502 #if defined(ADDRESS_SANITIZER) 537 #if defined(ADDRESS_SANITIZER)
503 void poisonUnmarkedObjects(); 538 void poisonUnmarkedObjects();
504 #endif 539 #endif
505 540
506 protected: 541 protected:
507 Header* findHeaderFromAddress(Address); 542 Header* findHeaderFromAddress(Address);
508 void populateObjectStartBitMap(); 543 void populateObjectStartBitMap();
509 bool isObjectStartBitMapComputed() { return m_objectStartBitMapComputed; } 544 bool isObjectStartBitMapComputed() { return m_objectStartBitMapComputed; }
510 TraceCallback traceCallback(Header*); 545 TraceCallback traceCallback(Header*);
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after
754 // Non-template super class used to pass a heap around to other classes. 789 // Non-template super class used to pass a heap around to other classes.
755 class BaseHeap { 790 class BaseHeap {
756 public: 791 public:
757 virtual ~BaseHeap() { } 792 virtual ~BaseHeap() { }
758 793
759 // Find the page in this thread heap containing the given 794 // Find the page in this thread heap containing the given
760 // address. Returns 0 if the address is not contained in any 795 // address. Returns 0 if the address is not contained in any
761 // page in this thread heap. 796 // page in this thread heap.
762 virtual BaseHeapPage* heapPageFromAddress(Address) = 0; 797 virtual BaseHeapPage* heapPageFromAddress(Address) = 0;
763 798
764 #if ENABLE(GC_TRACING) 799 #if GC_PROFILE_MARKING
765 virtual const GCInfo* findGCInfoOfLargeHeapObject(Address) = 0; 800 virtual const GCInfo* findGCInfoOfLargeHeapObject(Address) = 0;
766 #endif 801 #endif
767 802
803 #if GC_PROFILE_HEAP
804 virtual void snapshot(TracedDictionaryBase*, ThreadState::SnapshotInfo*) = 0 ;
805 #endif
806
768 // Sweep this part of the Blink heap. This finalizes dead objects 807 // Sweep this part of the Blink heap. This finalizes dead objects
769 // and builds freelists for all the unused memory. 808 // and builds freelists for all the unused memory.
770 virtual void sweep() = 0; 809 virtual void sweep() = 0;
771 810
772 // Forcefully finalize all objects in this part of the Blink heap 811 // Forcefully finalize all objects in this part of the Blink heap
773 // (potentially with the exception of one object). This is used 812 // (potentially with the exception of one object). This is used
774 // during thread termination to make sure that all objects for the 813 // during thread termination to make sure that all objects for the
775 // dying thread are finalized. 814 // dying thread are finalized.
776 virtual void assertEmpty() = 0; 815 virtual void assertEmpty() = 0;
777 816
(...skipping 22 matching lines...) Expand all
800 // (potentially adding new pages to the heap), to find and mark 839 // (potentially adding new pages to the heap), to find and mark
801 // objects during conservative stack scanning and to sweep the set of 840 // objects during conservative stack scanning and to sweep the set of
802 // pages after a GC. 841 // pages after a GC.
803 template<typename Header> 842 template<typename Header>
804 class ThreadHeap : public BaseHeap { 843 class ThreadHeap : public BaseHeap {
805 public: 844 public:
806 ThreadHeap(ThreadState*); 845 ThreadHeap(ThreadState*);
807 virtual ~ThreadHeap(); 846 virtual ~ThreadHeap();
808 847
809 virtual BaseHeapPage* heapPageFromAddress(Address); 848 virtual BaseHeapPage* heapPageFromAddress(Address);
810 #if ENABLE(GC_TRACING) 849 #if GC_PROFILE_MARKING
811 virtual const GCInfo* findGCInfoOfLargeHeapObject(Address); 850 virtual const GCInfo* findGCInfoOfLargeHeapObject(Address);
812 #endif 851 #endif
852 #if GC_PROFILE_HEAP
853 virtual void snapshot(TracedDictionaryBase*, ThreadState::SnapshotInfo*);
854 #endif
813 virtual void sweep(); 855 virtual void sweep();
814 virtual void assertEmpty(); 856 virtual void assertEmpty();
815 virtual void clearFreeLists(); 857 virtual void clearFreeLists();
816 virtual void clearMarks(); 858 virtual void clearMarks();
817 #ifndef NDEBUG 859 #ifndef NDEBUG
818 virtual void getScannedStats(HeapStats&); 860 virtual void getScannedStats(HeapStats&);
819 #endif 861 #endif
820 862
821 virtual void makeConsistentForGC(); 863 virtual void makeConsistentForGC();
822 virtual bool isConsistentForGC(); 864 virtual bool isConsistentForGC();
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
952 static void collectGarbage(ThreadState::StackState); 994 static void collectGarbage(ThreadState::StackState);
953 static void collectAllGarbage(); 995 static void collectAllGarbage();
954 static void setForcePreciseGCForTesting(); 996 static void setForcePreciseGCForTesting();
955 997
956 static void prepareForGC(); 998 static void prepareForGC();
957 999
958 // Conservatively checks whether an address is a pointer in any of the threa d 1000 // 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. 1001 // heaps. If so marks the object pointed to as live.
960 static Address checkAndMarkPointer(Visitor*, Address); 1002 static Address checkAndMarkPointer(Visitor*, Address);
961 1003
962 #if ENABLE(GC_TRACING) 1004 #if GC_PROFILE_MARKING
963 // Dump the path to specified object on the next GC. This method is to be in voked from GDB. 1005 // 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); 1006 static void dumpPathToObjectOnNextGC(void* p);
965 1007
966 // Forcibly find GCInfo of the object at Address. 1008 // Forcibly find GCInfo of the object at Address.
967 // This is slow and should only be used for debug purposes. 1009 // 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. 1010 // It involves finding the heap page and scanning the heap page for an objec t header.
969 static const GCInfo* findGCInfo(Address); 1011 static const GCInfo* findGCInfo(Address);
970 1012
971 static String createBacktraceString(); 1013 static String createBacktraceString();
972 #endif 1014 #endif
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
1793 template<typename Key, typename Value, typename T, typename U, typename V> 1835 template<typename Key, typename Value, typename T, typename U, typename V>
1794 struct GCInfoTrait<HashMap<Key, Value, T, U, V, HeapAllocator> > { 1836 struct GCInfoTrait<HashMap<Key, Value, T, U, V, HeapAllocator> > {
1795 static const GCInfo* get() 1837 static const GCInfo* get()
1796 { 1838 {
1797 typedef HashMap<Key, Value, T, U, V, HeapAllocator> TargetType; 1839 typedef HashMap<Key, Value, T, U, V, HeapAllocator> TargetType;
1798 static const GCInfo info = { 1840 static const GCInfo info = {
1799 TraceTrait<TargetType>::trace, 1841 TraceTrait<TargetType>::trace,
1800 0, 1842 0,
1801 false, // HashMap needs no finalizer. 1843 false, // HashMap needs no finalizer.
1802 WTF::IsPolymorphic<TargetType>::value, 1844 WTF::IsPolymorphic<TargetType>::value,
1803 #if ENABLE(GC_TRACING) 1845 #if GC_PROFILE_DEFINE_CLASSNAME
1804 TypenameStringTrait<TargetType>::get() 1846 TypenameStringTrait<TargetType>::get()
1805 #endif 1847 #endif
1806 }; 1848 };
1807 return &info; 1849 return &info;
1808 } 1850 }
1809 }; 1851 };
1810 1852
1811 template<typename T, typename U, typename V> 1853 template<typename T, typename U, typename V>
1812 struct GCInfoTrait<HashSet<T, U, V, HeapAllocator> > { 1854 struct GCInfoTrait<HashSet<T, U, V, HeapAllocator> > {
1813 static const GCInfo* get() 1855 static const GCInfo* get()
1814 { 1856 {
1815 typedef HashSet<T, U, V, HeapAllocator> TargetType; 1857 typedef HashSet<T, U, V, HeapAllocator> TargetType;
1816 static const GCInfo info = { 1858 static const GCInfo info = {
1817 TraceTrait<TargetType>::trace, 1859 TraceTrait<TargetType>::trace,
1818 0, 1860 0,
1819 false, // HashSet needs no finalizer. 1861 false, // HashSet needs no finalizer.
1820 WTF::IsPolymorphic<TargetType>::value, 1862 WTF::IsPolymorphic<TargetType>::value,
1821 #if ENABLE(GC_TRACING) 1863 #if GC_PROFILE_DEFINE_CLASSNAME
1822 TypenameStringTrait<TargetType>::get() 1864 TypenameStringTrait<TargetType>::get()
1823 #endif 1865 #endif
1824 }; 1866 };
1825 return &info; 1867 return &info;
1826 } 1868 }
1827 }; 1869 };
1828 1870
1829 template<typename T, typename U, typename V> 1871 template<typename T, typename U, typename V>
1830 struct GCInfoTrait<LinkedHashSet<T, U, V, HeapAllocator> > { 1872 struct GCInfoTrait<LinkedHashSet<T, U, V, HeapAllocator> > {
1831 static const GCInfo* get() 1873 static const GCInfo* get()
1832 { 1874 {
1833 typedef LinkedHashSet<T, U, V, HeapAllocator> TargetType; 1875 typedef LinkedHashSet<T, U, V, HeapAllocator> TargetType;
1834 static const GCInfo info = { 1876 static const GCInfo info = {
1835 TraceTrait<TargetType>::trace, 1877 TraceTrait<TargetType>::trace,
1836 LinkedHashSet<T, U, V, HeapAllocator>::finalize, 1878 LinkedHashSet<T, U, V, HeapAllocator>::finalize,
1837 true, // Needs finalization. The anchor needs to unlink itself from the chain. 1879 true, // Needs finalization. The anchor needs to unlink itself from the chain.
1838 WTF::IsPolymorphic<TargetType>::value, 1880 WTF::IsPolymorphic<TargetType>::value,
1839 #if ENABLE(GC_TRACING) 1881 #if GC_PROFILE_DEFINE_CLASSNAME
1840 TypenameStringTrait<TargetType>::get() 1882 TypenameStringTrait<TargetType>::get()
1841 #endif 1883 #endif
1842 }; 1884 };
1843 return &info; 1885 return &info;
1844 } 1886 }
1845 }; 1887 };
1846 1888
1847 template<typename ValueArg, size_t inlineCapacity, typename U> 1889 template<typename ValueArg, size_t inlineCapacity, typename U>
1848 struct GCInfoTrait<ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAlloc ator<ValueArg, inlineCapacity> > > { 1890 struct GCInfoTrait<ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAlloc ator<ValueArg, inlineCapacity> > > {
1849 static const GCInfo* get() 1891 static const GCInfo* get()
1850 { 1892 {
1851 typedef WTF::ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAll ocator<ValueArg, inlineCapacity> > TargetType; 1893 typedef WTF::ListHashSet<ValueArg, inlineCapacity, U, HeapListHashSetAll ocator<ValueArg, inlineCapacity> > TargetType;
1852 static const GCInfo info = { 1894 static const GCInfo info = {
1853 TraceTrait<TargetType>::trace, 1895 TraceTrait<TargetType>::trace,
1854 0, 1896 0,
1855 false, // ListHashSet needs no finalization though its backing might . 1897 false, // ListHashSet needs no finalization though its backing might .
1856 false, // no vtable. 1898 false, // no vtable.
1857 #if ENABLE(GC_TRACING) 1899 #if GC_PROFILE_DEFINE_CLASSNAME
1858 TypenameStringTrait<TargetType>::get() 1900 TypenameStringTrait<TargetType>::get()
1859 #endif 1901 #endif
1860 }; 1902 };
1861 return &info; 1903 return &info;
1862 } 1904 }
1863 }; 1905 };
1864 1906
1865 template<typename T, typename Allocator> 1907 template<typename T, typename Allocator>
1866 struct GCInfoTrait<WTF::ListHashSetNode<T, Allocator> > { 1908 struct GCInfoTrait<WTF::ListHashSetNode<T, Allocator> > {
1867 static const GCInfo* get() 1909 static const GCInfo* get()
1868 { 1910 {
1869 typedef WTF::ListHashSetNode<T, Allocator> TargetType; 1911 typedef WTF::ListHashSetNode<T, Allocator> TargetType;
1870 static const GCInfo info = { 1912 static const GCInfo info = {
1871 TraceTrait<TargetType>::trace, 1913 TraceTrait<TargetType>::trace,
1872 TargetType::finalize, 1914 TargetType::finalize,
1873 WTF::HashTraits<T>::needsDestruction, // The node needs destruction if its data does. 1915 WTF::HashTraits<T>::needsDestruction, // The node needs destruction if its data does.
1874 false, // no vtable. 1916 false, // no vtable.
1875 #if ENABLE(GC_TRACING) 1917 #if GC_PROFILE_DEFINE_CLASSNAME
1876 TypenameStringTrait<TargetType>::get() 1918 TypenameStringTrait<TargetType>::get()
1877 #endif 1919 #endif
1878 }; 1920 };
1879 return &info; 1921 return &info;
1880 } 1922 }
1881 }; 1923 };
1882 1924
1883 template<typename T> 1925 template<typename T>
1884 struct GCInfoTrait<Vector<T, 0, HeapAllocator> > { 1926 struct GCInfoTrait<Vector<T, 0, HeapAllocator> > {
1885 static const GCInfo* get() 1927 static const GCInfo* get()
1886 { 1928 {
1887 #if ENABLE(GC_TRACING) 1929 #if GC_PROFILE_DEFINE_CLASSNAME
1888 typedef Vector<T, 0, HeapAllocator> TargetType; 1930 typedef Vector<T, 0, HeapAllocator> TargetType;
1889 #endif 1931 #endif
1890 static const GCInfo info = { 1932 static const GCInfo info = {
1891 TraceTrait<Vector<T, 0, HeapAllocator> >::trace, 1933 TraceTrait<Vector<T, 0, HeapAllocator> >::trace,
1892 0, 1934 0,
1893 false, // Vector needs no finalizer if it has no inline capacity. 1935 false, // Vector needs no finalizer if it has no inline capacity.
1894 WTF::IsPolymorphic<Vector<T, 0, HeapAllocator> >::value, 1936 WTF::IsPolymorphic<Vector<T, 0, HeapAllocator> >::value,
1895 #if ENABLE(GC_TRACING) 1937 #if GC_PROFILE_DEFINE_CLASSNAME
1896 TypenameStringTrait<TargetType>::get() 1938 TypenameStringTrait<TargetType>::get()
1897 #endif 1939 #endif
1898 }; 1940 };
1899 return &info; 1941 return &info;
1900 } 1942 }
1901 }; 1943 };
1902 1944
1903 template<typename T, size_t inlineCapacity> 1945 template<typename T, size_t inlineCapacity>
1904 struct FinalizerTrait<Vector<T, inlineCapacity, HeapAllocator> > : public Finali zerTraitImpl<Vector<T, inlineCapacity, HeapAllocator>, true> { }; 1946 struct FinalizerTrait<Vector<T, inlineCapacity, HeapAllocator> > : public Finali zerTraitImpl<Vector<T, inlineCapacity, HeapAllocator>, true> { };
1905 1947
1906 template<typename T, size_t inlineCapacity> 1948 template<typename T, size_t inlineCapacity>
1907 struct GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator> > { 1949 struct GCInfoTrait<Vector<T, inlineCapacity, HeapAllocator> > {
1908 static const GCInfo* get() 1950 static const GCInfo* get()
1909 { 1951 {
1910 typedef Vector<T, inlineCapacity, HeapAllocator> TargetType; 1952 typedef Vector<T, inlineCapacity, HeapAllocator> TargetType;
1911 static const GCInfo info = { 1953 static const GCInfo info = {
1912 TraceTrait<TargetType>::trace, 1954 TraceTrait<TargetType>::trace,
1913 FinalizerTrait<TargetType>::finalize, 1955 FinalizerTrait<TargetType>::finalize,
1914 // Finalizer is needed to destruct things stored in the inline capac ity. 1956 // Finalizer is needed to destruct things stored in the inline capac ity.
1915 inlineCapacity && VectorTraits<T>::needsDestruction, 1957 inlineCapacity && VectorTraits<T>::needsDestruction,
1916 WTF::IsPolymorphic<TargetType>::value, 1958 WTF::IsPolymorphic<TargetType>::value,
1917 #if ENABLE(GC_TRACING) 1959 #if GC_PROFILE_DEFINE_CLASSNAME
1918 TypenameStringTrait<TargetType>::get() 1960 TypenameStringTrait<TargetType>::get()
1919 #endif 1961 #endif
1920 }; 1962 };
1921 return &info; 1963 return &info;
1922 } 1964 }
1923 }; 1965 };
1924 1966
1925 template<typename T> 1967 template<typename T>
1926 struct GCInfoTrait<Deque<T, 0, HeapAllocator> > { 1968 struct GCInfoTrait<Deque<T, 0, HeapAllocator> > {
1927 static const GCInfo* get() 1969 static const GCInfo* get()
1928 { 1970 {
1929 typedef Deque<T, 0, HeapAllocator> TargetType; 1971 typedef Deque<T, 0, HeapAllocator> TargetType;
1930 static const GCInfo info = { 1972 static const GCInfo info = {
1931 TraceTrait<TargetType>::trace, 1973 TraceTrait<TargetType>::trace,
1932 0, 1974 0,
1933 false, // Deque needs no finalizer if it has no inline capacity. 1975 false, // Deque needs no finalizer if it has no inline capacity.
1934 WTF::IsPolymorphic<TargetType>::value, 1976 WTF::IsPolymorphic<TargetType>::value,
1935 #if ENABLE(GC_TRACING) 1977 #if GC_PROFILE_DEFINE_CLASSNAME
1936 TypenameStringTrait<TargetType>::get() 1978 TypenameStringTrait<TargetType>::get()
1937 #endif 1979 #endif
1938 }; 1980 };
1939 return &info; 1981 return &info;
1940 } 1982 }
1941 static const GCInfo info; 1983 static const GCInfo info;
1942 }; 1984 };
1943 1985
1944 template<typename T, typename U, typename V> 1986 template<typename T, typename U, typename V>
1945 struct GCInfoTrait<HashCountedSet<T, U, V, HeapAllocator> > { 1987 struct GCInfoTrait<HashCountedSet<T, U, V, HeapAllocator> > {
1946 static const GCInfo* get() 1988 static const GCInfo* get()
1947 { 1989 {
1948 typedef HashCountedSet<T, U, V, HeapAllocator> TargetType; 1990 typedef HashCountedSet<T, U, V, HeapAllocator> TargetType;
1949 static const GCInfo info = { 1991 static const GCInfo info = {
1950 TraceTrait<TargetType>::trace, 1992 TraceTrait<TargetType>::trace,
1951 0, 1993 0,
1952 false, // HashCountedSet is just a HashTable, and needs no finalizer . 1994 false, // HashCountedSet is just a HashTable, and needs no finalizer .
1953 WTF::IsPolymorphic<TargetType>::value, 1995 WTF::IsPolymorphic<TargetType>::value,
1954 #if ENABLE(GC_TRACING) 1996 #if GC_PROFILE_DEFINE_CLASSNAME
1955 TypenameStringTrait<TargetType>::get() 1997 TypenameStringTrait<TargetType>::get()
1956 #endif 1998 #endif
1957 }; 1999 };
1958 return &info; 2000 return &info;
1959 } 2001 }
1960 static const GCInfo info; 2002 static const GCInfo info;
1961 }; 2003 };
1962 2004
1963 template<typename T, size_t inlineCapacity> 2005 template<typename T, size_t inlineCapacity>
1964 struct FinalizerTrait<Deque<T, inlineCapacity, HeapAllocator> > : public Finaliz erTraitImpl<Deque<T, inlineCapacity, HeapAllocator>, true> { }; 2006 struct FinalizerTrait<Deque<T, inlineCapacity, HeapAllocator> > : public Finaliz erTraitImpl<Deque<T, inlineCapacity, HeapAllocator>, true> { };
1965 2007
1966 template<typename T, size_t inlineCapacity> 2008 template<typename T, size_t inlineCapacity>
1967 struct GCInfoTrait<Deque<T, inlineCapacity, HeapAllocator> > { 2009 struct GCInfoTrait<Deque<T, inlineCapacity, HeapAllocator> > {
1968 static const GCInfo* get() 2010 static const GCInfo* get()
1969 { 2011 {
1970 typedef Deque<T, inlineCapacity, HeapAllocator> TargetType; 2012 typedef Deque<T, inlineCapacity, HeapAllocator> TargetType;
1971 static const GCInfo info = { 2013 static const GCInfo info = {
1972 TraceTrait<TargetType>::trace, 2014 TraceTrait<TargetType>::trace,
1973 FinalizerTrait<TargetType>::finalize, 2015 FinalizerTrait<TargetType>::finalize,
1974 // Finalizer is needed to destruct things stored in the inline capac ity. 2016 // Finalizer is needed to destruct things stored in the inline capac ity.
1975 inlineCapacity && VectorTraits<T>::needsDestruction, 2017 inlineCapacity && VectorTraits<T>::needsDestruction,
1976 WTF::IsPolymorphic<TargetType>::value, 2018 WTF::IsPolymorphic<TargetType>::value,
1977 #if ENABLE(GC_TRACING) 2019 #if GC_PROFILE_DEFINE_CLASSNAME
1978 TypenameStringTrait<TargetType>::get() 2020 TypenameStringTrait<TargetType>::get()
1979 #endif 2021 #endif
1980 }; 2022 };
1981 return &info; 2023 return &info;
1982 } 2024 }
1983 static const GCInfo info; 2025 static const GCInfo info;
1984 }; 2026 };
1985 2027
1986 template<typename T, typename Traits> 2028 template<typename T, typename Traits>
1987 struct GCInfoTrait<HeapVectorBacking<T, Traits> > { 2029 struct GCInfoTrait<HeapVectorBacking<T, Traits> > {
1988 static const GCInfo* get() 2030 static const GCInfo* get()
1989 { 2031 {
1990 typedef HeapVectorBacking<T, Traits> TargetType; 2032 typedef HeapVectorBacking<T, Traits> TargetType;
1991 static const GCInfo info = { 2033 static const GCInfo info = {
1992 TraceTrait<TargetType>::trace, 2034 TraceTrait<TargetType>::trace,
1993 FinalizerTrait<TargetType>::finalize, 2035 FinalizerTrait<TargetType>::finalize,
1994 Traits::needsDestruction, 2036 Traits::needsDestruction,
1995 false, // We don't support embedded objects in HeapVectors with vtab les. 2037 false, // We don't support embedded objects in HeapVectors with vtab les.
1996 #if ENABLE(GC_TRACING) 2038 #if GC_PROFILE_DEFINE_CLASSNAME
1997 TypenameStringTrait<TargetType>::get() 2039 TypenameStringTrait<TargetType>::get()
1998 #endif 2040 #endif
1999 }; 2041 };
2000 return &info; 2042 return &info;
2001 } 2043 }
2002 }; 2044 };
2003 2045
2004 template<typename Table> 2046 template<typename Table>
2005 struct GCInfoTrait<HeapHashTableBacking<Table> > { 2047 struct GCInfoTrait<HeapHashTableBacking<Table> > {
2006 static const GCInfo* get() 2048 static const GCInfo* get()
2007 { 2049 {
2008 typedef HeapHashTableBacking<Table> TargetType; 2050 typedef HeapHashTableBacking<Table> TargetType;
2009 static const GCInfo info = { 2051 static const GCInfo info = {
2010 TraceTrait<TargetType>::trace, 2052 TraceTrait<TargetType>::trace,
2011 HeapHashTableBacking<Table>::finalize, 2053 HeapHashTableBacking<Table>::finalize,
2012 Table::ValueTraits::needsDestruction, 2054 Table::ValueTraits::needsDestruction,
2013 WTF::IsPolymorphic<TargetType>::value, 2055 WTF::IsPolymorphic<TargetType>::value,
2014 #if ENABLE(GC_TRACING) 2056 #if GC_PROFILE_DEFINE_CLASSNAME
2015 TypenameStringTrait<TargetType>::get() 2057 TypenameStringTrait<TargetType>::get()
2016 #endif 2058 #endif
2017 }; 2059 };
2018 return &info; 2060 return &info;
2019 } 2061 }
2020 }; 2062 };
2021 2063
2022 } // namespace WebCore 2064 } // namespace WebCore
2023 2065
2024 namespace WTF { 2066 namespace WTF {
(...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after
2347 }; 2389 };
2348 2390
2349 template<typename T> 2391 template<typename T>
2350 struct IfWeakMember<WeakMember<T> > { 2392 struct IfWeakMember<WeakMember<T> > {
2351 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit or->isAlive(t.get()); } 2393 static bool isDead(Visitor* visitor, const WeakMember<T>& t) { return !visit or->isAlive(t.get()); }
2352 }; 2394 };
2353 2395
2354 } 2396 }
2355 2397
2356 #endif // Heap_h 2398 #endif // Heap_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698