Changeset 277346 in webkit
- Timestamp:
- May 11, 2021, 5:52:09 PM (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
r277326 r277346 1 2021-05-11 Geoffrey Garen <ggaren@apple.com> 2 3 ConservativeRoots triggers page demand on Speedometer 4 https://bugs.webkit.org/show_bug.cgi?id=225676 5 6 Reviewed by Saam Barati. 7 8 Use a Vector instead of OSAllocator to avoid mmap() and page fault -- 9 and, like, come on. 10 11 Bump default inlineCapacity up to 1024 because we seem to overflow 12 frequently. 13 14 * heap/ConservativeRoots.cpp: 15 (JSC::ConservativeRoots::ConservativeRoots): 16 (JSC::ConservativeRoots::~ConservativeRoots): 17 (JSC::ConservativeRoots::genericAddPointer): 18 (JSC::ConservativeRoots::grow): Deleted. 19 * heap/ConservativeRoots.h: 20 (JSC::ConservativeRoots::roots const): 21 (JSC::ConservativeRoots::size const): Deleted. 22 * heap/SlotVisitor.cpp: 23 (JSC::SlotVisitor::append): 24 * heap/VerifierSlotVisitor.cpp: 25 (JSC::VerifierSlotVisitor::append): 26 1 27 2021-05-10 Filip Pizlo <fpizlo@apple.com> 2 28 -
trunk/Source/JavaScriptCore/heap/ConservativeRoots.cpp
r261895 r277346 39 39 40 40 ConservativeRoots::ConservativeRoots(Heap& heap) 41 : m_roots(m_inlineRoots) 42 , m_size(0) 43 , m_capacity(inlineCapacity) 44 , m_heap(heap) 41 : m_heap(heap) 45 42 { 46 43 } … … 48 45 ConservativeRoots::~ConservativeRoots() 49 46 { 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;63 47 } 64 48 … … 75 59 markHook.markKnownJSCell(static_cast<JSCell*>(p)); 76 60 77 if (m_size == m_capacity) 78 grow(); 79 80 m_roots[m_size++] = bitwise_cast<HeapCell*>(p); 61 m_roots.append(bitwise_cast<HeapCell*>(p)); 81 62 }); 82 63 } -
trunk/Source/JavaScriptCore/heap/ConservativeRoots.h
r250005 r277346 35 35 36 36 class ConservativeRoots { 37 static constexpr size_t inlineCapacity = 1024; 38 37 39 public: 38 40 ConservativeRoots(Heap&); … … 42 44 void add(void* begin, void* end, JITStubRoutineSet&, CodeBlockSet&); 43 45 44 size_t size() const; 45 HeapCell** roots() const; 46 const Vector<HeapCell*, inlineCapacity>& roots() const { return m_roots; }; 46 47 47 48 private: 48 static constexpr size_t inlineCapacity = 128;49 static constexpr size_t nonInlineCapacity = 8192 / sizeof(HeapCell*);50 51 49 template<typename MarkHook> 52 50 void genericAddPointer(void*, HeapVersion markingVersion, HeapVersion newlyAllocatedVersion, TinyBloomFilter, MarkHook&); … … 55 53 void genericAddSpan(void*, void* end, MarkHook&); 56 54 57 void grow();58 59 HeapCell** m_roots;60 size_t m_size;61 size_t m_capacity;62 55 Heap& m_heap; 63 HeapCell* m_inlineRoots[inlineCapacity];56 Vector<HeapCell*, inlineCapacity> m_roots; 64 57 }; 65 58 66 inline size_t ConservativeRoots::size() const67 {68 return m_size;69 }70 71 inline HeapCell** ConservativeRoots::roots() const72 {73 return m_roots;74 }75 76 59 } // namespace JSC -
trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp
r273138 r277346 130 130 void SlotVisitor::append(const ConservativeRoots& conservativeRoots) 131 131 { 132 HeapCell** roots = conservativeRoots.roots(); 133 size_t size = conservativeRoots.size(); 134 for (size_t i = 0; i < size; ++i) 135 appendJSCellOrAuxiliary(roots[i]); 132 for (auto root : conservativeRoots.roots()) 133 appendJSCellOrAuxiliary(root); 136 134 } 137 135 -
trunk/Source/JavaScriptCore/heap/VerifierSlotVisitor.cpp
r275229 r277346 149 149 }; 150 150 151 HeapCell** roots = conservativeRoots.roots(); 152 size_t size = conservativeRoots.size(); 153 for (size_t i = 0; i < size; ++i) 154 appendJSCellOrAuxiliary(roots[i]); 151 for (auto root : conservativeRoots.roots()) 152 appendJSCellOrAuxiliary(root); 155 153 } 156 154
Note:
See TracChangeset
for help on using the changeset viewer.