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
This commit is contained in:
lrn@chromium.org 2010-06-25 07:51:46 +00:00
parent b71fe5b61e
commit 991af26519

View File

@ -197,7 +197,6 @@ function RegExpExec(string) {
%_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 @@ function RegExpExec(string) {
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;