Ignore:
Timestamp:
Mar 7, 2012, 6:14:38 PM (13 years ago)
Author:
[email protected]
Message:

Refactor recompileAllJSFunctions() to be less expensive
https://bugs.webkit.org/show_bug.cgi?id=80330

Reviewed by Geoffrey Garen.

This change is performance neutral on the JS benchmarks we track. It's mostly to improve page
load performance, which currently does at least a couple full GCs per navigation.

  • heap/Heap.cpp:

(JSC::Heap::discardAllCompiledCode): Rename recompileAllJSFunctions to discardAllCompiledCode
because the function doesn't actually recompile anything (and never did); it simply throws code
away for it to be recompiled later if we determine we should do so.
(JSC):
(JSC::Heap::collectAllGarbage):
(JSC::Heap::addFunctionExecutable): Adds a newly created FunctionExecutable to the Heap's list.
(JSC::Heap::removeFunctionExecutable): Removes the specified FunctionExecutable from the Heap's list.

  • heap/Heap.h:

(JSC):
(Heap):

  • runtime/Executable.cpp: Added next and prev fields to FunctionExecutables so that they can

be used in DoublyLinkedLists.
(JSC::FunctionExecutable::FunctionExecutable):
(JSC::FunctionExecutable::finalize): Removes the FunctionExecutable from the Heap's list.

  • runtime/Executable.h:

(FunctionExecutable):
(JSC::FunctionExecutable::create): Adds the FunctionExecutable to the Heap's list.

  • runtime/JSGlobalData.cpp: Remove recompileAllJSFunctions, as it's the Heap's job to own and manage

the list of FunctionExecutables.

  • runtime/JSGlobalData.h:

(JSGlobalData):

  • runtime/JSGlobalObject.cpp:

(JSC::DynamicGlobalObjectScope::DynamicGlobalObjectScope): Use the new discardAllCompiledCode.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/Executable.cpp

    r110033 r110127  
    147147    , m_inferredName(inferredName.isNull() ? globalData.propertyNames->emptyIdentifier : inferredName)
    148148    , m_symbolTable(0)
     149    , m_next(0)
     150    , m_prev(0)
    149151{
    150152}
     
    158160    , m_inferredName(inferredName.isNull() ? exec->globalData().propertyNames->emptyIdentifier : inferredName)
    159161    , m_symbolTable(0)
     162    , m_next(0)
     163    , m_prev(0)
    160164{
    161165}
     
    655659void FunctionExecutable::finalize(JSCell* cell)
    656660{
    657     jsCast<FunctionExecutable*>(cell)->clearCode();
     661    FunctionExecutable* executable = jsCast<FunctionExecutable*>(cell);
     662    Heap::heap(executable)->removeFunctionExecutable(executable);
     663    executable->clearCode();
    658664}
    659665
Note: See TracChangeset for help on using the changeset viewer.