Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Unified Diff: src/runtime.cc

Issue 1687013: Fix search-for-string and replace global to avoid hangs... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 10 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | test/mjsunit/search-string-multiple.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
===================================================================
--- src/runtime.cc (revision 4506)
+++ src/runtime.cc (working copy)
@@ -3162,7 +3162,7 @@
StringSearchStrategy strategy =
InitializeStringSearch(pattern_string, is_ascii);
switch (strategy) {
- case SEARCH_FAIL: return false;
+ case SEARCH_FAIL: break;
case SEARCH_SHORT:
while (pos <= max_search_start) {
if (!builder->HasCapacity(kMaxBuilderEntriesPerRegExpMatch)) {
@@ -3189,16 +3189,15 @@
case SEARCH_LONG:
while (pos <= max_search_start) {
if (!builder->HasCapacity(kMaxBuilderEntriesPerRegExpMatch)) {
- *match_pos = pos;
- return false;
+ *match_pos = pos;
+ return false;
}
- int new_pos = ComplexIndexOf(subject,
- pattern_string,
- pos + pattern_length);
+ int match_end = pos + pattern_length;
+ int new_pos = ComplexIndexOf(subject, pattern_string, match_end);
if (new_pos >= 0) {
- // A match has been found.
- if (new_pos > pos) {
- ReplacementStringBuilder::AddSubjectSlice(builder, pos, new_pos);
+ // A match has been found.
+ if (new_pos > match_end) {
+ ReplacementStringBuilder::AddSubjectSlice(builder, match_end, new_pos);
Søren Thygesen Gjesse 2010/04/27 11:22:47 Long line.
}
pos = new_pos;
builder->Add(pattern);
« no previous file with comments | « no previous file | test/mjsunit/search-string-multiple.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698