Ignore:
Timestamp:
May 12, 2017, 9:59:35 PM (8 years ago)
Author:
[email protected]
Message:

[JSC] DFG::Node should not have its own allocator
https://bugs.webkit.org/show_bug.cgi?id=160098

Reviewed by Saam Barati.

I just rebased the patch from <http://trac.webkit.org/changeset/203808>.

I ran Octane and JetStream locally on a MacBook Air and I wasn't able to
reproduce a regression. Let's land this again and see what the bots say.

(JSC::B3::SparseCollection::packIndices):

  • dfg/DFGAllocator.h: Removed.
  • dfg/DFGDriver.cpp:

(JSC::DFG::compileImpl):

  • dfg/DFGGraph.cpp:

(JSC::DFG::Graph::Graph):
(JSC::DFG::Graph::~Graph):
(JSC::DFG::Graph::deleteNode):
(JSC::DFG::Graph::packNodeIndices):
(JSC::DFG::Graph::addNodeToMapByIndex): Deleted.

  • dfg/DFGGraph.h:

(JSC::DFG::Graph::addNode):
(JSC::DFG::Graph::maxNodeCount):
(JSC::DFG::Graph::nodeAt):

  • dfg/DFGLongLivedState.cpp: Removed.
  • dfg/DFGLongLivedState.h: Removed.
  • dfg/DFGNode.h:
  • dfg/DFGNodeAllocator.h:
  • dfg/DFGPlan.cpp:

(JSC::DFG::Plan::compileInThread):
(JSC::DFG::Plan::compileInThreadImpl):

  • dfg/DFGPlan.h:
  • dfg/DFGWorklist.cpp:
  • runtime/VM.cpp:

(JSC::VM::VM):

  • runtime/VM.h:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/b3/B3SparseCollection.h

    r206525 r216815  
    2626#pragma once
    2727
    28 #if ENABLE(B3_JIT)
     28#if ENABLE(DFG_JIT)
    2929
    3030#include <wtf/StdLibExtras.h>
     
    7474        m_indexFreeList.append(value->m_index);
    7575        m_vector[value->m_index] = nullptr;
     76    }
     77
     78    void packIndices()
     79    {
     80        if (m_indexFreeList.isEmpty())
     81            return;
     82
     83        unsigned holeIndex = 0;
     84        unsigned endIndex = m_vector.size();
     85
     86        while (true) {
     87            while (holeIndex < endIndex && m_vector[holeIndex])
     88                ++holeIndex;
     89
     90            if (holeIndex == endIndex)
     91                break;
     92            ASSERT(holeIndex < m_vector.size());
     93            ASSERT(!m_vector[holeIndex]);
     94
     95            do {
     96                --endIndex;
     97            } while (!m_vector[endIndex] && endIndex > holeIndex);
     98
     99            if (holeIndex == endIndex)
     100                break;
     101            ASSERT(endIndex > holeIndex);
     102            ASSERT(m_vector[endIndex]);
     103
     104            auto& value = m_vector[endIndex];
     105            value->m_index = holeIndex;
     106            m_vector[holeIndex] = WTFMove(value);
     107            ++holeIndex;
     108        }
     109
     110        m_indexFreeList.resize(0);
     111        m_vector.resize(endIndex);
    76112    }
    77113
     
    140176} } // namespace JSC::B3
    141177
    142 #endif // ENABLE(B3_JIT)
     178#endif // ENABLE(DFG_JIT)
Note: See TracChangeset for help on using the changeset viewer.