Changeset 163450 in webkit
- Timestamp:
- Feb 5, 2014, 9:31:47 AM (11 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r163444 r163450 1 2014-02-05 Mark Hahnenberg <mhahnenberg@apple.com> 2 3 Malloc called beneath MachineThreads::gatherFromOtherThread(), while forbidden 4 https://bugs.webkit.org/show_bug.cgi?id=128202 5 6 Reviewed by Geoffrey Garen. 7 8 This patch uses the new GCSegmentedArray to replace the Vector that was used 9 to record the set of currently executing CodeBlocks during the conservative 10 stack scan. This is primarily to avoid the possibility of the Vector resizing 11 while FastMalloc is forbidden. 12 13 * heap/BlockAllocator.h: 14 * heap/CodeBlockSet.cpp: 15 (JSC::CodeBlockSet::CodeBlockSet): 16 (JSC::CodeBlockSet::rememberCurrentlyExecutingCodeBlocks): 17 * heap/CodeBlockSet.h: 18 * heap/GCSegmentedArray.h: 19 (JSC::GCSegmentedArray::begin): 20 (JSC::GCSegmentedArray::end): 21 (JSC::GCSegmentedArrayIterator::GCSegmentedArrayIterator): 22 (JSC::GCSegmentedArrayIterator::get): 23 (JSC::GCSegmentedArrayIterator::operator*): 24 (JSC::GCSegmentedArrayIterator::operator->): 25 (JSC::GCSegmentedArrayIterator::operator==): 26 (JSC::GCSegmentedArrayIterator::operator!=): 27 (JSC::GCSegmentedArrayIterator::operator++): 28 * heap/Heap.cpp: 29 (JSC::Heap::Heap): 30 1 31 2014-02-05 Wojciech Bielawski <w.bielawski@samsung.com> 2 32 -
trunk/Source/JavaScriptCore/heap/BlockAllocator.h
r163419 r163450 40 40 41 41 class BlockAllocator; 42 class CodeBlock; 42 43 class CopiedBlock; 43 44 class CopyWorkListSegment; … … 234 235 REGION_SET_FOR(WeakBlock, m_fourKBBlockRegionSet); 235 236 REGION_SET_FOR(GCArraySegment<const JSCell*>, m_fourKBBlockRegionSet); 237 REGION_SET_FOR(GCArraySegment<CodeBlock*>, m_fourKBBlockRegionSet); 236 238 REGION_SET_FOR(CopyWorkListSegment, m_workListRegionSet); 237 239 REGION_SET_FOR(HandleBlock, m_fourKBBlockRegionSet); -
trunk/Source/JavaScriptCore/heap/CodeBlockSet.cpp
r162377 r163450 34 34 static const bool verbose = false; 35 35 36 CodeBlockSet::CodeBlockSet() { } 36 CodeBlockSet::CodeBlockSet(BlockAllocator& blockAllocator) 37 : m_currentlyExecuting(blockAllocator) 38 { 39 } 37 40 38 41 CodeBlockSet::~CodeBlockSet() … … 110 113 { 111 114 #if ENABLE(GGC) 112 for ( size_t i = 0; i < m_currentlyExecuting.size(); ++i)113 heap->addToRememberedSet( m_currentlyExecuting[i]->ownerExecutable());115 for (CodeBlock* codeBlock : m_currentlyExecuting) 116 heap->addToRememberedSet(codeBlock->ownerExecutable()); 114 117 m_currentlyExecuting.clear(); 115 118 #else -
trunk/Source/JavaScriptCore/heap/CodeBlockSet.h
r162598 r163450 27 27 #define CodeBlockSet_h 28 28 29 #include "GCSegmentedArray.h" 29 30 #include <wtf/HashSet.h> 30 31 #include <wtf/Noncopyable.h> 31 32 #include <wtf/PassRefPtr.h> 32 33 #include <wtf/RefPtr.h> 33 #include <wtf/Vector.h>34 34 35 35 namespace JSC { 36 36 37 class BlockAllocator; 37 38 class CodeBlock; 38 39 class Heap; … … 47 48 48 49 public: 49 CodeBlockSet( );50 CodeBlockSet(BlockAllocator&); 50 51 ~CodeBlockSet(); 51 52 … … 89 90 // and all, but that seemed like overkill. 90 91 HashSet<CodeBlock* > m_set; 91 Vector<CodeBlock*> m_currentlyExecuting;92 GCSegmentedArray<CodeBlock*> m_currentlyExecuting; 92 93 }; 93 94 -
trunk/Source/JavaScriptCore/heap/GCSegmentedArray.h
r163414 r163450 60 60 }; 61 61 62 template <typename T> class GCSegmentedArrayIterator; 63 62 64 template <typename T> 63 65 class GCSegmentedArray { 66 friend class GCSegmentedArrayIterator<T>; 64 67 public: 65 68 GCSegmentedArray(BlockAllocator&); … … 77 80 void fillVector(Vector<T>&); 78 81 void clear(); 82 83 typedef GCSegmentedArrayIterator<T> iterator; 84 iterator begin() { return GCSegmentedArrayIterator<T>(m_segments.head(), m_top); } 85 iterator end() { return GCSegmentedArrayIterator<T>(); } 79 86 80 87 protected: … … 101 108 }; 102 109 110 template <typename T> 111 class GCSegmentedArrayIterator { 112 friend class GCSegmentedArray<T>; 113 public: 114 GCSegmentedArrayIterator() 115 : m_currentSegment(0) 116 , m_currentOffset(0) 117 { 118 } 119 120 T& get() { return m_currentSegment->data()[m_currentOffset]; } 121 T& operator*() { return get(); } 122 T& operator->() { return get(); } 123 124 bool operator==(const GCSegmentedArrayIterator& other) 125 { 126 return m_currentSegment == other.m_currentSegment && m_currentOffset == other.m_currentOffset; 127 } 128 129 bool operator!=(const GCSegmentedArrayIterator& other) 130 { 131 return !(*this == other); 132 } 133 134 GCSegmentedArrayIterator& operator++() 135 { 136 ASSERT(m_currentSegment); 137 138 m_currentOffset++; 139 140 if (m_currentOffset >= m_offsetLimit) { 141 m_currentSegment = m_currentSegment->next(); 142 m_currentOffset = 0; 143 m_offsetLimit = GCSegmentedArray<T>::s_segmentCapacity; 144 } 145 146 return *this; 147 } 148 149 private: 150 GCSegmentedArrayIterator(GCArraySegment<T>* start, size_t top) 151 : m_currentSegment(start) 152 , m_currentOffset(0) 153 , m_offsetLimit(top) 154 { 155 if (!m_offsetLimit) 156 m_currentSegment = nullptr; 157 } 158 159 GCArraySegment<T>* m_currentSegment; 160 size_t m_currentOffset; 161 size_t m_offsetLimit; 162 }; 163 103 164 } // namespace JSC 104 165 -
trunk/Source/JavaScriptCore/heap/Heap.cpp
r163027 r163450 271 271 , m_copyVisitor(m_sharedData) 272 272 , m_handleSet(vm) 273 , m_codeBlocks(m_blockAllocator) 273 274 , m_isSafeToCollect(false) 274 275 , m_writeBarrierBuffer(256)
Note:
See TracChangeset
for help on using the changeset viewer.