⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 277381 in webkit


Ignore:
Timestamp:
May 12, 2021, 11:34:55 AM (5 years ago)
Author:
commit-queue@webkit.org
Message:

Unreviewed, reverting r277346.
https://bugs.webkit.org/show_bug.cgi?id=225705

Introduced a (rare) deadlock

Reverted changeset:

"ConservativeRoots triggers page demand on Speedometer"
https://bugs.webkit.org/show_bug.cgi?id=225676
https://trac.webkit.org/changeset/277346

Location:
trunk/Source/JavaScriptCore
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/ChangeLog

    r277370 r277381  
     12021-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
    1142021-05-12  Mark Lam  <mark.lam@apple.com>
    215
  • trunk/Source/JavaScriptCore/heap/ConservativeRoots.cpp

    r277346 r277381  
    3939
    4040ConservativeRoots::ConservativeRoots(Heap& heap)
    41     : m_heap(heap)
     41    : m_roots(m_inlineRoots)
     42    , m_size(0)
     43    , m_capacity(inlineCapacity)
     44    , m_heap(heap)
    4245{
    4346}
     
    4548ConservativeRoots::~ConservativeRoots()
    4649{
     50    if (m_roots != m_inlineRoots)
     51        OSAllocator::decommitAndRelease(m_roots, m_capacity * sizeof(HeapCell*));
     52}
     53
     54void 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;
    4763}
    4864
     
    5975                markHook.markKnownJSCell(static_cast<JSCell*>(p));
    6076           
    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);
    6281        });
    6382}
  • trunk/Source/JavaScriptCore/heap/ConservativeRoots.h

    r277346 r277381  
    3535
    3636class ConservativeRoots {
    37     static constexpr size_t inlineCapacity = 1024;
    38    
    3937public:
    4038    ConservativeRoots(Heap&);
     
    4442    void add(void* begin, void* end, JITStubRoutineSet&, CodeBlockSet&);
    4543   
    46     const Vector<HeapCell*, inlineCapacity>& roots() const { return m_roots; };
     44    size_t size() const;
     45    HeapCell** roots() const;
    4746
    4847private:
     48    static constexpr size_t inlineCapacity = 128;
     49    static constexpr size_t nonInlineCapacity = 8192 / sizeof(HeapCell*);
     50   
    4951    template<typename MarkHook>
    5052    void genericAddPointer(void*, HeapVersion markingVersion, HeapVersion newlyAllocatedVersion, TinyBloomFilter, MarkHook&);
     
    5355    void genericAddSpan(void*, void* end, MarkHook&);
    5456   
     57    void grow();
     58
     59    HeapCell** m_roots;
     60    size_t m_size;
     61    size_t m_capacity;
    5562    Heap& m_heap;
    56     Vector<HeapCell*, inlineCapacity> m_roots;
     63    HeapCell* m_inlineRoots[inlineCapacity];
    5764};
    5865
     66inline size_t ConservativeRoots::size() const
     67{
     68    return m_size;
     69}
     70
     71inline HeapCell** ConservativeRoots::roots() const
     72{
     73    return m_roots;
     74}
     75
    5976} // namespace JSC
  • trunk/Source/JavaScriptCore/heap/SlotVisitor.cpp

    r277346 r277381  
    130130void SlotVisitor::append(const ConservativeRoots& conservativeRoots)
    131131{
    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]);
    134136}
    135137
  • trunk/Source/JavaScriptCore/heap/VerifierSlotVisitor.cpp

    r277346 r277381  
    149149    };
    150150
    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]);
    153155}
    154156
Note: See TracChangeset for help on using the changeset viewer.