Clear the JSString cache when under memory pressure.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 May 2014 03:22:04 +0000 (03:22 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 4 May 2014 03:22:04 +0000 (03:22 +0000)
<https://webkit.org/b/132539>

The WeakGCMap used for fast mapping from StringImpl* to JSString*
can actually get pretty big, and if we find ourselves under memory
pressure, it's entirely inessential.

1.1 MB progression on Membuster3.

Reviewed by Sam Weinig.

* platform/MemoryPressureHandler.cpp:
(WebCore::MemoryPressureHandler::releaseMemory):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@168235 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebCore/ChangeLog
Source/WebCore/platform/MemoryPressureHandler.cpp

index 23bca8a..bf41686 100644 (file)
@@ -1,3 +1,19 @@
+2014-05-03  Andreas Kling  <akling@apple.com>
+
+        Clear the JSString cache when under memory pressure.
+        <https://webkit.org/b/132539>
+
+        The WeakGCMap used for fast mapping from StringImpl* to JSString*
+        can actually get pretty big, and if we find ourselves under memory
+        pressure, it's entirely inessential.
+
+        1.1 MB progression on Membuster3.
+
+        Reviewed by Sam Weinig.
+
+        * platform/MemoryPressureHandler.cpp:
+        (WebCore::MemoryPressureHandler::releaseMemory):
+
 2014-05-03  Benjamin Poulain  <benjamin@webkit.org>
 
         [iOS][WK2] Support disabling speculative tiling
index 493eb13..6758223 100644 (file)
@@ -31,6 +31,7 @@
 #include "Font.h"
 #include "FontCache.h"
 #include "GCController.h"
+#include "JSDOMWindow.h"
 #include "MemoryCache.h"
 #include "Page.h"
 #include "PageCache.h"
@@ -105,6 +106,11 @@ void MemoryPressureHandler::releaseMemory(bool critical)
         gcController().discardAllCompiledCode();
     }
 
+    {
+        ReliefLogger log("Clearing JS string cache");
+        JSDOMWindow::commonVM().stringCache.clear();
+    }
+
     platformReleaseMemory(critical);
 
     {