Revision: 4947 Author: [email protected] Date: Fri Jun 25 00:51:46 2010 Log: Less intrusive patch for regexp bug.
Review URL: http://codereview.chromium.org/2843024 http://code.google.com/p/v8/source/detail?r=4947 Modified: /branches/bleeding_edge/src/regexp.js ======================================= --- /branches/bleeding_edge/src/regexp.js Fri Jun 25 00:00:29 2010 +++ /branches/bleeding_edge/src/regexp.js Fri Jun 25 00:51:46 2010 @@ -197,7 +197,6 @@ %_ObjectEquals(cache.regExp, this) && %_ObjectEquals(cache.subject, string)) { if (cache.answerSaved) { - if (this.global) this.lastIndex = 0; return CloneRegExpResult(cache.answer); } else { saveAnswer = true; @@ -231,7 +230,10 @@ var matchIndices = %_RegExpExec(this, s, i, lastMatchInfo); if (matchIndices == null) { - if (this.global) this.lastIndex = 0; + if (this.global) { + this.lastIndex = 0; + if (lastIndex != 0) return matchIndices; + } cache.lastIndex = lastIndex; cache.regExp = this; cache.subject = s; -- v8-dev mailing list [email protected] http://groups.google.com/group/v8-dev
