Changeset 277381 in webkit
- Timestamp:
- May 12, 2021, 11:34:55 AM (5 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 5 edited
-
ChangeLog (modified) (1 diff)
-
heap/ConservativeRoots.cpp (modified) (3 diffs)
-
heap/ConservativeRoots.h (modified) (3 diffs)
-
heap/SlotVisitor.cpp (modified) (1 diff)
-
heap/VerifierSlotVisitor.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r277370 r277381 1 2021-05-12 Commit Queue <commit-queue@webkit.org> 2 3 Unreviewed, reverting r277346. 4 https://bugs.webkit.org/show_bug.cgi?id=225705 5 6 Introduced a (rare) deadlock 7 8 Reverted changeset: 9 10 "ConservativeRoots triggers page demand on Speedometer" 11 https://bugs.webkit.org/show_bug.cgi?id=225676 12 https://trac.webkit.org/changeset/277346 13 1 14 2021-05-12 Mark Lam <mark.lam@apple.com> 2 15 -
trunk/Source/JavaScriptCore/heap/ConservativeRoots.cpp
r277346 r277381 39 39 40 40 ConservativeRoots::ConservativeRoots(Heap& heap) 41 : m_heap(heap) 41 : m_roots(m_inlineRoots) 42 , m_size(0) 43 , m_capacity(inlineCapacity) 44 , m_heap(heap) 42 45 { 43 46 } … … 45 48 ConservativeRoots::~ConservativeRoots() 46 49 { 50 if (m_roots != m_inlineRoots) 51 OSAllocator::decommitAndRelease(m_roots, m_capacity * sizeof(HeapCell*)); 52 } 53 54 void ConservativeRoots::grow() 55 { 56 size_t newCapacity = m_capacity == inlineCapacity ? nonInlineCapacity : m_capacity * 2; 57 HeapCell** newRoots = static_cast<HeapCell**>(OSAllocator::reserveAndCommit(newCapacity * sizeof(HeapCell*))); 58 memcpy(newRoots, m_roots, m_size * sizeof(HeapCell*)); 59 if (m_roots != m_inlineRoots) 60 OSAllocator::decommitAndRelease(m_roots, m_capacity * sizeof(HeapCell*)); 61 m_capacity = newCapacity; 62 m_roots = newRoots; 47 63 } 48 64 … … 59 75 markHook.markKnownJSCell(static_cast<JSCell*>(p)); 60 76 61 m_roots.append(bitwise_cast<HeapCell*>(p)); 77 if (m_size == m_capacity) 78 grow(); 79 80 m_roots[m_size++] = bitwise_cast<HeapCell*>(p); 62 81 }); 63 82 } -
trunk/Source/JavaScriptCore/heap/ConservativeRoots.h
r277346 r277381 35 35 36 36 class ConservativeRoots { 37 static constexpr size_t inlineCapacity = 1024;38 39 37 public: 40 38 ConservativeRoots(Heap&); … … 44 42 void add(void* begin, void* end, JITStubRoutineSet&, CodeBlockSet&); 45 43 46 const Vector<HeapCell*, inlineCapacity>& roots() const { return m_roots; }; 44 size_t size() const; 45 HeapCell** roots() const; 47 46 48 47 private: 48 static constexpr size_t inlineCapacity = 128; 49 static constexpr size_t nonInlineCapacity = 8192 / sizeof(HeapCell*); 50 49 51 template<typename MarkHook> 50 52 void genericAddPointer(void*, HeapVersion markingVersion, HeapVersion newlyAllocatedVersion, TinyBloomFilter, MarkHook&); … … 53 55 void genericAddSpan(void*, void* end, MarkHook&); 54 56 57 void grow(); 58 59 HeapCell** m_roots; 60 size_t m_size; 61 size_t m_capacity; 55 62 Heap& m_heap; 56 Vector<HeapCell*, inlineCapacity> m_roots;63 HeapCell* m_inlineRoots[inlineCapacity]; 57 64 }; 58 65 66 inline size_t ConservativeRoots::size() const 67 { 68 return m_size; 69 } 70 71 inline HeapCell** ConservativeRoots::roots() const 72 { 73 return m_roots; 74 } 75 59 76 } // namespace JSC -
trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp
r277346 r277381 130 130 void SlotVisitor::append(const ConservativeRoots& conservativeRoots) 131 131 { 132 for (auto root : conservativeRoots.roots()) 133 appendJSCellOrAuxiliary(root); 132 HeapCell** roots = conservativeRoots.roots(); 133 size_t size = conservativeRoots.size(); 134 for (size_t i = 0; i < size; ++i) 135 appendJSCellOrAuxiliary(roots[i]); 134 136 } 135 137 -
trunk/Source/JavaScriptCore/heap/VerifierSlotVisitor.cpp
r277346 r277381 149 149 }; 150 150 151 for (auto root : conservativeRoots.roots()) 152 appendJSCellOrAuxiliary(root); 151 HeapCell** roots = conservativeRoots.roots(); 152 size_t size = conservativeRoots.size(); 153 for (size_t i = 0; i < size; ++i) 154 appendJSCellOrAuxiliary(roots[i]); 153 155 } 154 156
Note:
See TracChangeset
for help on using the changeset viewer.