Commit 6f536814 authored by deanm@chromium.org's avatar deanm@chromium.org

Don't try an indexOf() when the search string is bigger than the string. The...

Don't try an indexOf() when the search string is bigger than the string.  The current code will spend a bunch of time trying to match, even though we should know a match is impossible.

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@348 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent ab377a3f
......@@ -340,6 +340,7 @@ function ApplyReplacementFunction(replace, captures, subject) {
}
if (index < 0) index = 0;
if (index > str.length) index = str.length;
if (searchStr.length + index > str.length) return -1;
return %StringIndexOf(str, searchStr, index);
}, DONT_ENUM);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment