Ignore:
Timestamp:
Feb 15, 2019, 8:32:42 PM (7 years ago)
Author:
[email protected]
Message:

[JSC] Lazily create empty RegExp
https://bugs.webkit.org/show_bug.cgi?id=194735

Reviewed by Keith Miller.

Some scripts do not have any RegExp. In that case, allocating MarkedBlock for RegExp is costly.
Previously, there was always one RegExp, "empty RegExp". This patch lazily creates it and drop
one MarkedBlock.

  • runtime/JSGlobalObject.cpp:

(JSC::JSGlobalObject::init):

  • runtime/RegExpCache.cpp:

(JSC::RegExpCache::ensureEmptyRegExpSlow):
(JSC::RegExpCache::initialize): Deleted.

  • runtime/RegExpCache.h:

(JSC::RegExpCache::ensureEmptyRegExp):
(JSC::RegExpCache::emptyRegExp const): Deleted.

  • runtime/RegExpCachedResult.cpp:

(JSC::RegExpCachedResult::lastResult):

  • runtime/RegExpCachedResult.h:
  • runtime/VM.cpp:

(JSC::VM::VM):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/runtime/RegExpCache.cpp

    r240593 r241640  
    5757}
    5858
    59 void RegExpCache::initialize(VM& vm)
     59RegExp* RegExpCache::ensureEmptyRegExpSlow(VM& vm)
    6060{
    61     m_emptyRegExp.set(vm, RegExp::create(vm, "", NoFlags));
     61    RegExp* regExp = RegExp::create(vm, "", NoFlags);
     62    m_emptyRegExp.set(vm, regExp);
     63    return regExp;
    6264}
    6365
Note: See TracChangeset for help on using the changeset viewer.