Changeset 243237 in webkit
- Timestamp:
- Mar 20, 2019, 2:04:10 PM (7 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 4 edited
-
ChangeLog (modified) (1 diff)
-
yarr/YarrInterpreter.cpp (modified) (1 diff)
-
yarr/YarrJIT.cpp (modified) (4 diffs)
-
yarr/YarrJIT.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r243236 r243237 1 2019-03-20 Michael Saboff <msaboff@apple.com> 2 3 JSC test crash: stress/dont-strength-reduce-regexp-with-compile-error.js.default 4 https://bugs.webkit.org/show_bug.cgi?id=195906 5 6 Reviewed by Mark Lam. 7 8 The problem here as that we may successfully parsed a RegExp without running out of stack, 9 but later run out of stack when trying to JIT compile the same expression. 10 11 Added a check for available stack space when we call into one of the parenthesis compilation 12 functions that recurse. When we don't have enough stack space to recurse, we fail the JIT 13 compilation and let the interpreter handle the expression. 14 15 From code inspection of the YARR interpreter it has the same issue, but I couldn't cause a failure. 16 Filed a new bug and added a FIXME comment for the Interpreter to have similar checks. 17 Given that we can reproduce a failure, this is sufficient for now. 18 19 This change is covered by the previously added failing test, 20 JSTests/stress/dont-strength-reduce-regexp-with-compile-error.js. 21 22 * yarr/YarrInterpreter.cpp: 23 (JSC::Yarr::Interpreter::interpret): 24 * yarr/YarrJIT.cpp: 25 (JSC::Yarr::YarrGenerator::opCompileParenthesesSubpattern): 26 (JSC::Yarr::YarrGenerator::opCompileParentheticalAssertion): 27 (JSC::Yarr::YarrGenerator::opCompileBody): 28 (JSC::Yarr::dumpCompileFailure): 29 * yarr/YarrJIT.h: 30 1 31 2019-03-20 Robin Morisset <rmorisset@apple.com> 2 32 -
trunk/Source/JavaScriptCore/yarr/YarrInterpreter.cpp
r240641 r243237 1607 1607 unsigned interpret() 1608 1608 { 1609 // FIXME: https://bugs.webkit.org/show_bug.cgi?id=195970 1610 // [Yarr Interpreter] The interpreter doesn't have checks for stack overflow due to deep recursion 1609 1611 if (!input.isAvailableInput(0)) 1610 1612 return offsetNoMatch; -
trunk/Source/JavaScriptCore/yarr/YarrJIT.cpp
r242838 r243237 3387 3387 YarrOpCode alternativeEndOpCode = OpSimpleNestedAlternativeEnd; 3388 3388 3389 if (UNLIKELY(!m_vm->isSafeToRecurse())) { 3390 m_failureReason = JITFailureReason::ParenthesisNestedTooDeep; 3391 return; 3392 } 3393 3389 3394 // We can currently only compile quantity 1 subpatterns that are 3390 3395 // not copies. We generate a copy in the case of a range quantifier, … … 3493 3498 void opCompileParentheticalAssertion(PatternTerm* term) 3494 3499 { 3500 if (UNLIKELY(!m_vm->isSafeToRecurse())) { 3501 m_failureReason = JITFailureReason::ParenthesisNestedTooDeep; 3502 return; 3503 } 3504 3495 3505 size_t parenBegin = m_ops.size(); 3496 3506 m_ops.append(OpParentheticalAssertionBegin); … … 3573 3583 void opCompileBody(PatternDisjunction* disjunction) 3574 3584 { 3585 if (UNLIKELY(!m_vm->isSafeToRecurse())) { 3586 m_failureReason = JITFailureReason::ParenthesisNestedTooDeep; 3587 return; 3588 } 3589 3575 3590 Vector<std::unique_ptr<PatternAlternative>>& alternatives = disjunction->m_alternatives; 3576 3591 size_t currentAlternativeIndex = 0; … … 4201 4216 dataLog("Can't JIT a pattern containing fixed count parenthesized subpatterns\n"); 4202 4217 break; 4218 case JITFailureReason::ParenthesisNestedTooDeep: 4219 dataLog("Can't JIT pattern due to parentheses nested too deeply\n"); 4220 break; 4203 4221 case JITFailureReason::ExecutableMemoryAllocationFailure: 4204 4222 dataLog("Can't JIT because of failure of allocation of executable memory\n"); -
trunk/Source/JavaScriptCore/yarr/YarrJIT.h
r239427 r243237 57 57 ParenthesizedSubpattern, 58 58 FixedCountParenthesizedSubpattern, 59 ParenthesisNestedTooDeep, 59 60 ExecutableMemoryAllocationFailure, 60 61 };
Note:
See TracChangeset
for help on using the changeset viewer.