Changeset 245815 in webkit


Ignore:
Timestamp:
May 28, 2019 10:19:09 AM (5 years ago)
Author:
msaboff@apple.com
Message:

[YARR] Properly handle RegExp's that require large ParenContext space
https://bugs.webkit.org/show_bug.cgi?id=198065

Reviewed by Keith Miller.

JSTests:

New test.

  • stress/regexp-large-paren-context.js: Added.

(testLargeRegExp):

Source/JavaScriptCore:

Changed what happens when we exceed VM::patternContextBufferSize when compiling a RegExp
that needs ParenCOntextSpace to fail the RegExp JIT compilation and fall back to the YARR
interpreter. This can save large amounts of JIT memory for a
JIT'ed function that cannot ever succeed.

  • yarr/YarrJIT.cpp:

(JSC::Yarr::YarrGenerator::initParenContextFreeList):
(JSC::Yarr::YarrGenerator::compile):

Location:
trunk
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/JSTests/ChangeLog

    r245813 r245815  
     12019-05-28  Michael Saboff  <msaboff@apple.com>
     2
     3        [YARR] Properly handle RegExp's that require large ParenContext space
     4        https://bugs.webkit.org/show_bug.cgi?id=198065
     5
     6        Reviewed by Keith Miller.
     7
     8        New test.
     9
     10        * stress/regexp-large-paren-context.js: Added.
     11        (testLargeRegExp):
     12
    1132019-05-28  Tadeu Zagallo  <tzagallo@apple.com>
    214
  • trunk/Source/JavaScriptCore/ChangeLog

    r245813 r245815  
     12019-05-28  Michael Saboff  <msaboff@apple.com>
     2
     3        [YARR] Properly handle RegExp's that require large ParenContext space
     4        https://bugs.webkit.org/show_bug.cgi?id=198065
     5
     6        Reviewed by Keith Miller.
     7
     8        Changed what happens when we exceed VM::patternContextBufferSize when compiling a RegExp
     9        that needs ParenCOntextSpace to fail the RegExp JIT compilation and fall back to the YARR
     10        interpreter.  This can save large amounts of JIT memory for a
     11        JIT'ed function that cannot ever succeed.
     12
     13        * yarr/YarrJIT.cpp:
     14        (JSC::Yarr::YarrGenerator::initParenContextFreeList):
     15        (JSC::Yarr::YarrGenerator::compile):
     16
    1172019-05-28  Tadeu Zagallo  <tzagallo@apple.com>
    218
  • trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp

    r245586 r245815  
    229229        parenContextSize = WTF::roundUpToMultipleOf<sizeof(uintptr_t)>(parenContextSize);
    230230
    231         // Check that the paren context is a reasonable size.
    232         if (parenContextSize > VM::patternContextBufferSize)
    233             m_abortExecution.append(jump());
     231        if (parenContextSize > VM::patternContextBufferSize) {
     232            m_failureReason = JITFailureReason::ParenthesisNestedTooDeep;
     233            return;
     234        }
    234235
    235236        Jump emptyFreeList = branchTestPtr(Zero, freelistRegister);
     
    39363937
    39373938#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
    3938         if (m_containsNestedSubpatterns)
     3939        if (m_containsNestedSubpatterns) {
    39393940            initParenContextFreeList();
     3941            if (m_failureReason) {
     3942                codeBlock.setFallBackWithFailureReason(*m_failureReason);
     3943                return;
     3944            }
     3945        }
    39403946#endif
    39413947       
Note: See TracChangeset for help on using the changeset viewer.