Ignore:
Timestamp:
Dec 21, 2010, 5:30:12 PM (14 years ago)
Author:
[email protected]
Message:

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

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/RegExpCache.h

    r65478 r74441  
    4848private:
    4949    static const unsigned maxCacheablePatternLength = 256;
     50
     51#if PLATFORM(IOS)
     52    // The RegExpCache can currently hold onto multiple Mb of memory;
     53    // as a short-term fix some embedded platforms may wish to reduce the cache size.
     54    static const int maxCacheableEntries = 32;
     55#else
    5056    static const int maxCacheableEntries = 256;
     57#endif
    5158
    5259    FixedArray<RegExpKey, maxCacheableEntries> patternKeyArray;
Note: See TracChangeset for help on using the changeset viewer.