Commit 991af265 authored by lrn@chromium.org's avatar lrn@chromium.org

Less intrusive patch for regexp bug.

Review URL: http://codereview.chromium.org/2843024

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@4947 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent b71fe5b6
...@@ -197,7 +197,6 @@ function RegExpExec(string) { ...@@ -197,7 +197,6 @@ function RegExpExec(string) {
%_ObjectEquals(cache.regExp, this) && %_ObjectEquals(cache.regExp, this) &&
%_ObjectEquals(cache.subject, string)) { %_ObjectEquals(cache.subject, string)) {
if (cache.answerSaved) { if (cache.answerSaved) {
if (this.global) this.lastIndex = 0;
return CloneRegExpResult(cache.answer); return CloneRegExpResult(cache.answer);
} else { } else {
saveAnswer = true; saveAnswer = true;
...@@ -231,7 +230,10 @@ function RegExpExec(string) { ...@@ -231,7 +230,10 @@ function RegExpExec(string) {
var matchIndices = %_RegExpExec(this, s, i, lastMatchInfo); var matchIndices = %_RegExpExec(this, s, i, lastMatchInfo);
if (matchIndices == null) { if (matchIndices == null) {
if (this.global) this.lastIndex = 0; if (this.global) {
this.lastIndex = 0;
if (lastIndex != 0) return matchIndices;
}
cache.lastIndex = lastIndex; cache.lastIndex = lastIndex;
cache.regExp = this; cache.regExp = this;
cache.subject = s; cache.subject = s;
......
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