Title: [113445] trunk/Source
- Revision
- 113445
- Author
- msab...@apple.com
- Date
- 2012-04-06 09:09:22 -0700 (Fri, 06 Apr 2012)
Log Message
Call Heap::discardAllCompiledCode() in low memory situations
https://bugs.webkit.org/show_bug.cgi?id=83335
Reviewed by Geoffrey Garen.
Source/_javascript_Core:
Restructured Heap::discardAllCompiledCode() to do the "Is _javascript_Running?"
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):
Modified Paths
Diff
Modified: trunk/Source/_javascript_Core/ChangeLog (113444 => 113445)
--- trunk/Source/_javascript_Core/ChangeLog 2012-04-06 16:05:06 UTC (rev 113444)
+++ trunk/Source/_javascript_Core/ChangeLog 2012-04-06 16:09:22 UTC (rev 113445)
@@ -1,3 +1,22 @@
+2012-04-05 Michael Saboff <msab...@apple.com>
+
+ Call Heap::discardAllCompiledCode() in low memory situations
+ https://bugs.webkit.org/show_bug.cgi?id=83335
+
+ Reviewed by Geoffrey Garen.
+
+ Restructured Heap::discardAllCompiledCode() to do the "Is _javascript_Running?"
+ 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):
+
2012-04-05 Benjamin Poulain <bpoul...@apple.com>
Speed up the conversion from JSValue to String for bulk operations
Modified: trunk/Source/_javascript_Core/heap/Heap.cpp (113444 => 113445)
--- trunk/Source/_javascript_Core/heap/Heap.cpp 2012-04-06 16:05:06 UTC (rev 113444)
+++ trunk/Source/_javascript_Core/heap/Heap.cpp 2012-04-06 16:09:22 UTC (rev 113445)
@@ -772,8 +772,9 @@
{
// If _javascript_ is running, it's not safe to recompile, since we'll end
// up throwing away code that is live on the stack.
- ASSERT(!m_globalData->dynamicGlobalObject);
-
+ if (m_globalData->dynamicGlobalObject)
+ return;
+
for (FunctionExecutable* current = m_functions.head(); current; current = current->next())
current->discardCode();
}
@@ -782,8 +783,7 @@
{
if (!m_isSafeToCollect)
return;
- if (!m_globalData->dynamicGlobalObject)
- discardAllCompiledCode();
+ discardAllCompiledCode();
collect(DoSweep);
}
Modified: trunk/Source/_javascript_Core/heap/Heap.h (113444 => 113445)
--- trunk/Source/_javascript_Core/heap/Heap.h 2012-04-06 16:05:06 UTC (rev 113444)
+++ trunk/Source/_javascript_Core/heap/Heap.h 2012-04-06 16:09:22 UTC (rev 113445)
@@ -148,7 +148,7 @@
double lastGCLength() { return m_lastGCLength; }
- void discardAllCompiledCode();
+ JS_EXPORT_PRIVATE void discardAllCompiledCode();
private:
friend class CodeBlock;
Modified: trunk/Source/_javascript_Core/runtime/JSGlobalData.h (113444 => 113445)
--- trunk/Source/_javascript_Core/runtime/JSGlobalData.h 2012-04-06 16:05:06 UTC (rev 113444)
+++ trunk/Source/_javascript_Core/runtime/JSGlobalData.h 2012-04-06 16:09:22 UTC (rev 113445)
@@ -324,7 +324,6 @@
JS_EXPORT_PRIVATE void startSampling();
JS_EXPORT_PRIVATE void stopSampling();
JS_EXPORT_PRIVATE void dumpSampleData(ExecState* exec);
- void discardAllCompiledCode();
RegExpCache* regExpCache() { return m_regExpCache; }
#if ENABLE(REGEXP_TRACING)
void addRegExpToTrace(PassRefPtr<RegExp> regExp);
Modified: trunk/Source/WebCore/ChangeLog (113444 => 113445)
--- trunk/Source/WebCore/ChangeLog 2012-04-06 16:05:06 UTC (rev 113444)
+++ trunk/Source/WebCore/ChangeLog 2012-04-06 16:09:22 UTC (rev 113445)
@@ -1,3 +1,26 @@
+2012-04-06 Michael Saboff <msab...@apple.com>
+
+ Call Heap::discardAllCompiledCode() in low memory situations
+ https://bugs.webkit.org/show_bug.cgi?id=83335
+
+ Reviewed by Geoffrey Garen.
+
+ 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):
+
2012-04-06 Andrey Kosyakov <ca...@chromium.org>
Web Inspector: on a single click in Timeline overview, make a minimal selection centered around cursor
Modified: trunk/Source/WebCore/bindings/js/GCController.cpp (113444 => 113445)
--- trunk/Source/WebCore/bindings/js/GCController.cpp 2012-04-06 16:05:06 UTC (rev 113444)
+++ trunk/Source/WebCore/bindings/js/GCController.cpp 2012-04-06 16:09:22 UTC (rev 113445)
@@ -83,4 +83,10 @@
detachThread(threadID);
}
+void GCController::discardAllCompiledCode()
+{
+ JSLock lock(SilenceAssertionsOnly);
+ JSDOMWindow::commonJSGlobalData()->heap.discardAllCompiledCode();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/bindings/js/GCController.h (113444 => 113445)
--- trunk/Source/WebCore/bindings/js/GCController.h 2012-04-06 16:05:06 UTC (rev 113444)
+++ trunk/Source/WebCore/bindings/js/GCController.h 2012-04-06 16:09:22 UTC (rev 113445)
@@ -40,6 +40,8 @@
void garbageCollectOnAlternateThreadForDebugging(bool waitUntilDone); // Used for stress testing.
+ void discardAllCompiledCode();
+
private:
GCController(); // Use gcController() instead
void gcTimerFired(Timer<GCController>*);
Modified: trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm (113444 => 113445)
--- trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm 2012-04-06 16:05:06 UTC (rev 113444)
+++ trunk/Source/WebCore/platform/mac/MemoryPressureHandlerMac.mm 2012-04-06 16:09:22 UTC (rev 113445)
@@ -146,6 +146,8 @@
memoryCache()->pruneToPercentage(critical ? 0 : 0.5f);
+ gcController().discardAllCompiledCode();
+
WTF::releaseFastMallocFreeMemory();
}
#endif
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes