[SCM] WebKit Debian packaging branch, debian/experimental, updated. debian/1.3.8-1-142-g786665c
barraclough at apple.com
barraclough at apple.com
Mon Dec 27 16:28:36 UTC 2010
The following commit has been merged in the debian/experimental branch:
commit 99406a009ed8b9744aa7c4711f5fd3b13ee1be9a
Author: barraclough at apple.com <barraclough at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Dec 22 01:30:12 2010 +0000
<rdar://problem/8241425> JIT executable memory excessive usage due to regex caching
https://bugs.webkit.org/show_bug.cgi?id=51434
Reviewed by Geoff Garen.
Reduce the amount of memory the RegExpCache can hold on to on iOS.
Currently the RegExpCache can hold 256 RegExp objects. If each falls into a separate
ExecutablePool, with a common size of 16Kb, this means we end up holding onto 4Mb of
memory. Firstly, we can reduce this by simply reducing the size of the cache to 32
entries. Secondly, we can use a separate set of ExecutablePools for JIT code generated
from RegExp objects. This helps in two ways (1) it increases the probability that
RegExps in the cache share the same pool, and (2) it means that a RegExp can't end
up holding on to a large ExecutablePool containing a translation of JS code.
(A RegExp could end up keeping a larger RegExp alive that happened to be sharing the
same pool, but large RegExp patterns are less common).
* runtime/JSGlobalData.h:
* runtime/RegExpCache.h:
* yarr/RegexJIT.cpp:
(JSC::Yarr::RegexGenerator::compile):
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@74441 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index e825e2a..0bf8863 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,28 @@
2010-12-21 Gavin Barraclough <barraclough at apple.com>
+ Reviewed by Geoff Garen.
+
+ <rdar://problem/8241425> JIT executable memory excessive usage due to regex caching
+ https://bugs.webkit.org/show_bug.cgi?id=51434
+
+ Reduce the amount of memory the RegExpCache can hold on to on iOS.
+ Currently the RegExpCache can hold 256 RegExp objects. If each falls into a separate
+ ExecutablePool, with a common size of 16Kb, this means we end up holding onto 4Mb of
+ memory. Firstly, we can reduce this by simply reducing the size of the cache to 32
+ entries. Secondly, we can use a separate set of ExecutablePools for JIT code generated
+ from RegExp objects. This helps in two ways (1) it increases the probability that
+ RegExps in the cache share the same pool, and (2) it means that a RegExp can't end
+ up holding on to a large ExecutablePool containing a translation of JS code.
+ (A RegExp could end up keeping a larger RegExp alive that happened to be sharing the
+ same pool, but large RegExp patterns are less common).
+
+ * runtime/JSGlobalData.h:
+ * runtime/RegExpCache.h:
+ * yarr/RegexJIT.cpp:
+ (JSC::Yarr::RegexGenerator::compile):
+
+2010-12-21 Gavin Barraclough <barraclough at apple.com>
+
Windows build fix.
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
diff --git a/JavaScriptCore/runtime/JSGlobalData.h b/JavaScriptCore/runtime/JSGlobalData.h
index c6729c4..1dad920 100644
--- a/JavaScriptCore/runtime/JSGlobalData.h
+++ b/JavaScriptCore/runtime/JSGlobalData.h
@@ -170,6 +170,7 @@ namespace JSC {
#if ENABLE(ASSEMBLER)
ExecutableAllocator executableAllocator;
+ ExecutableAllocator regexAllocator;
#endif
#if !ENABLE(JIT)
diff --git a/JavaScriptCore/runtime/RegExpCache.h b/JavaScriptCore/runtime/RegExpCache.h
index e897b43..b5b637f 100644
--- a/JavaScriptCore/runtime/RegExpCache.h
+++ b/JavaScriptCore/runtime/RegExpCache.h
@@ -47,7 +47,14 @@ public:
private:
static const unsigned maxCacheablePatternLength = 256;
+
+#if PLATFORM(IOS)
+ // The RegExpCache can currently hold onto multiple Mb of memory;
+ // as a short-term fix some embedded platforms may wish to reduce the cache size.
+ static const int maxCacheableEntries = 32;
+#else
static const int maxCacheableEntries = 256;
+#endif
FixedArray<RegExpKey, maxCacheableEntries> patternKeyArray;
RegExpCacheMap m_cacheMap;
diff --git a/JavaScriptCore/yarr/RegexJIT.cpp b/JavaScriptCore/yarr/RegexJIT.cpp
index 63e8a26..9e6756d 100644
--- a/JavaScriptCore/yarr/RegexJIT.cpp
+++ b/JavaScriptCore/yarr/RegexJIT.cpp
@@ -2186,7 +2186,7 @@ public:
{
generate();
- LinkBuffer patchBuffer(this, globalData->executableAllocator.poolForSize(size()), 0);
+ LinkBuffer patchBuffer(this, globalData->regexAllocator.poolForSize(size()), 0);
for (unsigned i = 0; i < m_expressionState.m_backtrackRecords.size(); ++i)
patchBuffer.patch(m_expressionState.m_backtrackRecords[i].dataLabel, patchBuffer.locationOf(m_expressionState.m_backtrackRecords[i].backtrackLocation));
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list