Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
ASSERTION FAILED: regexp->isValid() or ASSERTION FAILED: !isCompilati…
…onThread() https://bugs.webkit.org/show_bug.cgi?id=195735 Reviewed by Mark Lam. JSTests: New regression test. * stress/dont-strength-reduce-regexp-with-compile-error.js: Added. (foo): (bar): Source/JavaScriptCore: There are two bug fixes here. The first bug happens due to a race condition when we are compiling on a separate thread while the main thread is compiling the RegExp at a place where it can run out of stack. When that happens, the RegExp becomes invalid due to the out of stack error. If we check the ASSERT condition in the DFG compilation thread, we crash. After the main thread throws an exception, it resets the RegExp as it might compile successfully the next time we try to execute it on a shallower stack. The main thread will see the regular expression as valid when it executes the JIT'ed code we are compiling or any slow path we call out to. Therefore ASSERTs like this in compilation code can be eliminated. The second bug is due to incorrect logic when we go to run the regexp in the Strength Reduction phase. The current check for "do we have code to run the RegExp?" only checks that the RegExp's state is != NotCompiled. We also can't run the RegExp if there the state is ParseError. Changing hasCode() to take this into account fixes the second issue. (JSC::FTL::DFG::LowerDFGToB3::compileNewRegexp): * runtime/RegExp.h: * dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileNewRegexp): * runtime/RegExp.h: Canonical link: https://commits.webkit.org/210045@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@242955 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
Showing
6 changed files
with
65 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//@ runDefault("--jitPolicyScale=0") | ||
|
||
let tryCount = 10000; | ||
|
||
function foo(a) { | ||
if (tryCount == 0) | ||
return; | ||
|
||
tryCount--; | ||
|
||
try { | ||
eval('bar(/' + a[0].source + '/)'); | ||
} catch(e) { | ||
} | ||
} | ||
|
||
function bar(r) { | ||
foo([r]); | ||
foo([r]); | ||
r.exec('x'); | ||
} | ||
|
||
bar(/((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((x))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters