Ignore:
Timestamp:
Mar 29, 2012, 5:36:37 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 Filip Pizlo.

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/heap/Heap.h

    r111877 r112624  
    4343    class CopiedSpace;
    4444    class CodeBlock;
     45    class FunctionExecutable;
    4546    class GCActivityCallback;
    4647    class GlobalCodeBlock;
     
    106107        typedef void (*Finalizer)(JSCell*);
    107108        JS_EXPORT_PRIVATE void addFinalizer(JSCell*, Finalizer);
     109        void addFunctionExecutable(FunctionExecutable*);
     110        void removeFunctionExecutable(FunctionExecutable*);
    108111
    109112        void notifyIsSafeToCollect() { m_isSafeToCollect = true; }
     
    140143
    141144        double lastGCLength() { return m_lastGCLength; }
     145
     146        void discardAllCompiledCode();
    142147
    143148    private:
     
    241246        JSGlobalData* m_globalData;
    242247        double m_lastGCLength;
     248
     249        DoublyLinkedList<FunctionExecutable> m_functions;
    243250    };
    244251
Note: See TracChangeset for help on using the changeset viewer.