⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 245928 in webkit


Ignore:
Timestamp:
May 30, 2019, 5:30:23 PM (7 years ago)
Author:
Alan Coon
Message:

Cherry-pick r245815. rdar://problem/51264876

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

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245815 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Location:
branches/safari-607-branch
Files:
1 added
3 edited

Legend:

Unmodified
Added
Removed
  • branches/safari-607-branch/JSTests/ChangeLog

    r245926 r245928  
     12019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r245815. rdar://problem/51264876
     4
     5    [YARR] Properly handle RegExp's that require large ParenContext space
     6    https://bugs.webkit.org/show_bug.cgi?id=198065
     7   
     8    Reviewed by Keith Miller.
     9   
     10    JSTests:
     11   
     12    New test.
     13   
     14    * stress/regexp-large-paren-context.js: Added.
     15    (testLargeRegExp):
     16   
     17    Source/JavaScriptCore:
     18   
     19    Changed what happens when we exceed VM::patternContextBufferSize when compiling a RegExp
     20    that needs ParenCOntextSpace to fail the RegExp JIT compilation and fall back to the YARR
     21    interpreter.  This can save large amounts of JIT memory for a
     22    JIT'ed function that cannot ever succeed.
     23   
     24    * yarr/YarrJIT.cpp:
     25    (JSC::Yarr::YarrGenerator::initParenContextFreeList):
     26    (JSC::Yarr::YarrGenerator::compile):
     27   
     28   
     29    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     30
     31    2019-05-28  Michael Saboff  <msaboff@apple.com>
     32
     33            [YARR] Properly handle RegExp's that require large ParenContext space
     34            https://bugs.webkit.org/show_bug.cgi?id=198065
     35
     36            Reviewed by Keith Miller.
     37
     38            New test.
     39
     40            * stress/regexp-large-paren-context.js: Added.
     41            (testLargeRegExp):
     42
    1432019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
    244
  • branches/safari-607-branch/Source/JavaScriptCore/ChangeLog

    r245926 r245928  
     12019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
     2
     3        Cherry-pick r245815. rdar://problem/51264876
     4
     5    [YARR] Properly handle RegExp's that require large ParenContext space
     6    https://bugs.webkit.org/show_bug.cgi?id=198065
     7   
     8    Reviewed by Keith Miller.
     9   
     10    JSTests:
     11   
     12    New test.
     13   
     14    * stress/regexp-large-paren-context.js: Added.
     15    (testLargeRegExp):
     16   
     17    Source/JavaScriptCore:
     18   
     19    Changed what happens when we exceed VM::patternContextBufferSize when compiling a RegExp
     20    that needs ParenCOntextSpace to fail the RegExp JIT compilation and fall back to the YARR
     21    interpreter.  This can save large amounts of JIT memory for a
     22    JIT'ed function that cannot ever succeed.
     23   
     24    * yarr/YarrJIT.cpp:
     25    (JSC::Yarr::YarrGenerator::initParenContextFreeList):
     26    (JSC::Yarr::YarrGenerator::compile):
     27   
     28   
     29    git-svn-id: https://svn.webkit.org/repository/webkit/trunk@245815 268f45cc-cd09-0410-ab3c-d52691b4dbfc
     30
     31    2019-05-28  Michael Saboff  <msaboff@apple.com>
     32
     33            [YARR] Properly handle RegExp's that require large ParenContext space
     34            https://bugs.webkit.org/show_bug.cgi?id=198065
     35
     36            Reviewed by Keith Miller.
     37
     38            Changed what happens when we exceed VM::patternContextBufferSize when compiling a RegExp
     39            that needs ParenCOntextSpace to fail the RegExp JIT compilation and fall back to the YARR
     40            interpreter.  This can save large amounts of JIT memory for a
     41            JIT'ed function that cannot ever succeed.
     42
     43            * yarr/YarrJIT.cpp:
     44            (JSC::Yarr::YarrGenerator::initParenContextFreeList):
     45            (JSC::Yarr::YarrGenerator::compile):
     46
    1472019-05-30  Kocsen Chung  <kocsen_chung@apple.com>
    248
  • branches/safari-607-branch/Source/JavaScriptCore/yarr/YarrJIT.cpp

    r245926 r245928  
    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);
     
    38733874
    38743875#if ENABLE(YARR_JIT_ALL_PARENS_EXPRESSIONS)
    3875         if (m_containsNestedSubpatterns)
     3876        if (m_containsNestedSubpatterns) {
    38763877            initParenContextFreeList();
     3878            if (m_failureReason) {
     3879                codeBlock.setFallBackWithFailureReason(*m_failureReason);
     3880                return;
     3881            }
     3882        }
    38773883#endif
    38783884       
Note: See TracChangeset for help on using the changeset viewer.