Ignore:
Timestamp:
Jan 21, 2015, 6:56:26 PM (10 years ago)
Author:
[email protected]
Message:

Change Heap::m_compiledCode to use a Vector
https://bugs.webkit.org/show_bug.cgi?id=140717

Reviewed by Andreas Kling.

Right now it's a DoublyLinkedList, which is iterated during each
collection. This contributes to some of the longish Eden pause times.
A Vector would be more appropriate and would also allow ExecutableBase
to be 2 pointers smaller.

  • heap/Heap.cpp:

(JSC::Heap::deleteAllCompiledCode):
(JSC::Heap::deleteAllUnlinkedFunctionCode):
(JSC::Heap::clearUnmarkedExecutables):

  • heap/Heap.h:
  • runtime/Executable.h: No longer need to inherit from DoublyLinkedListNode.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/Heap.cpp

    r178364 r178884  
    903903#endif // ENABLE(DFG_JIT)
    904904
    905     for (ExecutableBase* current = m_compiledCode.head(); current; current = current->next()) {
     905    for (ExecutableBase* current : m_compiledCode) {
    906906        if (!current->isFunctionExecutable())
    907907            continue;
     
    916916void Heap::deleteAllUnlinkedFunctionCode()
    917917{
    918     for (ExecutableBase* current = m_compiledCode.head(); current; current = current->next()) {
     918    for (ExecutableBase* current : m_compiledCode) {
    919919        if (!current->isFunctionExecutable())
    920920            continue;
     
    926926{
    927927    GCPHASE(ClearUnmarkedExecutables);
    928     ExecutableBase* next;
    929     for (ExecutableBase* current = m_compiledCode.head(); current; current = next) {
    930         next = current->next();
     928    for (unsigned i = m_compiledCode.size(); i--;) {
     929        ExecutableBase* current = m_compiledCode[i];
    931930        if (isMarked(current))
    932931            continue;
     
    935934        // CodeBlock requires eager finalization.
    936935        ExecutableBase::clearCodeVirtual(current);
    937         m_compiledCode.remove(current);
     936        std::swap(m_compiledCode[i], m_compiledCode.last());
     937        m_compiledCode.removeLast();
    938938    }
    939939}
Note: See TracChangeset for help on using the changeset viewer.