Reviewers: Erik Corry,
Description:
Fix bug in cache handling of lastIndex on global regexps.
Please review this at http://codereview.chromium.org/3745005/show
Affected files:
M src/regexp.js
Index: src/regexp.js
diff --git a/src/regexp.js b/src/regexp.js
index
faa525d62da27ca518e3b4fa8ec12f6ab2cbdaa8..59c40407fbc20ddc4406d0ef2661d7d9bcf39099
100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -186,10 +186,10 @@ function RegExpExec(string) {
%_IsRegExpEquivalent(cache.regExp, this) &&
%_ObjectEquals(cache.subject, string)) {
if (cache.answerSaved) {
- // If this regexp is not global, cache.lastIndex is zero, so we only
get
+ // If this regexp is global, cache.lastIndex is zero, so we only get
// here if this.lastIndex is zero, and resulting this.lastIndex
// must be zero too, so no change is necessary.
- if (this.global) this.lastIndex = lastMatchInfo[CAPTURE1];
+ if (!this.global) this.lastIndex = lastMatchInfo[CAPTURE1];
return %_RegExpCloneResult(cache.answer);
} else {
saveAnswer = true;
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev