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.
(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):