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

Unified Diff: src/runtime.cc

Issue 113575: Fix for issue 349: Make initial boundary check for BM text search. (Closed)
Patch Set: Created 11 years, 7 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/regress/regress-349.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index ca0c67bfe05554ba9957da3b4a892ae2ca67cfd3..99ba3f11fd29d774bf6c609e22c79e97bc4eb54e 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -2035,7 +2035,7 @@ static int BoyerMooreIndexOf(Vector<const schar> subject,
BoyerMoorePopulateGoodSuffixTable(pattern, start);
pchar last_char = pattern[m - 1];
// Continue search from i.
- do {
+ while (idx <= n - m) {
int j = m - 1;
schar c;
while (last_char != (c = subject[idx + j])) {
@@ -2061,7 +2061,7 @@ static int BoyerMooreIndexOf(Vector<const schar> subject,
}
idx += shift;
}
- } while (idx <= n - m);
+ }
return -1;
}
« no previous file with comments | « no previous file | test/mjsunit/regress/regress-349.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698