Matching of regexps with ^ could be much faster try /^bar/ on a really long string and watch Safari go off the deep end... It should immediately be able to detect that ^bar doesn't match.
Created attachment 20049 [details] Make matching of regexps using ^ much faster JavaScriptCore/pcre/pcre_compile.cpp | 20 ++++++++++++-------- JavaScriptCore/pcre/pcre_exec.cpp | 32 ++++++++++++++++++++++++-------- JavaScriptCore/pcre/pcre_internal.h | 2 ++ 3 files changed, 38 insertions(+), 16 deletions(-)
*** Bug 18087 has been marked as a duplicate of this bug. ***
Created attachment 20051 [details] Test case which shows bug (warning, will hang Safari!)
I'm not sure where to put the test case. I guess I could put it in LayoutTests/fast/js/ (and make it "pass" if it completes w/o timing out).
Created attachment 20054 [details] Make matching of regexps using ^ much faster JavaScriptCore/pcre/pcre_compile.cpp | 20 +++++++----- JavaScriptCore/pcre/pcre_exec.cpp | 32 +++++++++++++++----- JavaScriptCore/pcre/pcre_internal.h | 2 + LayoutTests/ChangeLog | 10 ++++++ .../fast/js/ascii-regexp-subject-expected.txt | 5 +++ LayoutTests/fast/js/ascii-regexp-subject.html | 13 ++++++++ .../fast/js/resources/ascii-regexp-subject.js | 18 +++++++++++ 7 files changed, 84 insertions(+), 16 deletions(-)
Comment on attachment 20054 [details] Make matching of regexps using ^ much faster r=me
Assigning to Eric, assuming that he will check it in.
r31454