Changeset 113445 in webkit for trunk/Source/JavaScriptCore/heap


Ignore:
Timestamp:
Apr 6, 2012, 9:09:22 AM (13 years ago)
Author:
[email protected]
Message:

Call Heap::discardAllCompiledCode() in low memory situations
https://bugs.webkit.org/show_bug.cgi?id=83335

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Restructured Heap::discardAllCompiledCode() to do the "Is JavaScriptRunning?"
check inline so that it can be called directly without this check.

  • heap/Heap.cpp:

(JSC::Heap::discardAllCompiledCode):
(JSC::Heap::collectAllGarbage):

  • heap/Heap.h: Added JS_EXPORT_PRIVATE to discardAllCompiledCode() so it can be

called from WebCore.
(Heap):

  • runtime/JSGlobalData.h: Removed unused " void discardAllCompiledCode()" declaration.

(JSGlobalData):

Source/WebCore:

Added call to discardAllCompiledCode() when under memory pressure.
We can re-JIT as needed. This is similar to what we used to do when we did
a full GC which also cleaned up JIT code. Doing a full GC typically didn't
help our memory situation, in fact it made things worse in the really low
memory situation as it caused more paging.

Added pass through discardAllCompiledCode() method to GCController.

  • bindings/js/GCController.cpp:

(WebCore::GCController::discardAllCompiledCode):
(WebCore):

  • bindings/js/GCController.h:

(GCController):

  • platform/mac/MemoryPressureHandlerMac.mm:

(WebCore::MemoryPressureHandler::releaseMemory):

Location:
trunk/Source/JavaScriptCore/heap
Files:
2 edited

Legend:

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

    r113141 r113445  
    773773    // If JavaScript is running, it's not safe to recompile, since we'll end
    774774    // up throwing away code that is live on the stack.
    775     ASSERT(!m_globalData->dynamicGlobalObject);
    776    
     775    if (m_globalData->dynamicGlobalObject)
     776        return;
     777
    777778    for (FunctionExecutable* current = m_functions.head(); current; current = current->next())
    778779        current->discardCode();
     
    783784    if (!m_isSafeToCollect)
    784785        return;
    785     if (!m_globalData->dynamicGlobalObject)
    786         discardAllCompiledCode();
     786    discardAllCompiledCode();
    787787
    788788    collect(DoSweep);
  • trunk/Source/JavaScriptCore/heap/Heap.h

    r113141 r113445  
    149149        double lastGCLength() { return m_lastGCLength; }
    150150
    151         void discardAllCompiledCode();
     151        JS_EXPORT_PRIVATE void discardAllCompiledCode();
    152152
    153153    private:
Note: See TracChangeset for help on using the changeset viewer.