Adding regular expression caching to JavaScriptCore
https://bugs.webkit.org/show_bug.cgi?id=38142
Patch by Renata Hodovan <[email protected]> on 2010-06-22
Reviewed by Geoffrey Garen.
The cache is based on Round Robin eviction policy, and
can cache at most 256 character long regular expressions,
and at most 256 of them. These values can be changed at compile time.
(JSC::RegExpNode::emitBytecode):
- runtime/JSGlobalData.cpp:
(JSC::JSGlobalData::JSGlobalData):
(JSC::JSGlobalData::~JSGlobalData):
(JSC::JSGlobalData::regExpCache):
- runtime/RegExpCache.cpp: Added.
(JSC::RegExpCache::lookupOrCreate):
(JSC::RegExpCache::create):
(JSC::RegExpCache::RegExpCache):
- runtime/RegExpCache.h: Added.
- runtime/RegExpConstructor.cpp:
(JSC::constructRegExp):
- runtime/RegExpKey.h: Added.
(JSC::RegExpKey::RegExpKey):
(JSC::RegExpKey::getFlagsValue):
(WTF::operator==):
(WTF::):
- runtime/RegExpPrototype.cpp:
(JSC::regExpProtoFuncCompile):
- runtime/StringPrototype.cpp:
(JSC::stringProtoFuncMatch):
(JSC::stringProtoFuncSearch):