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

Unified Diff: src/runtime.cc

Issue 11896060: Correctly reset lastIndex in an RegExp object. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: . Created 7 years, 11 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
Index: src/runtime.cc
diff --git a/src/runtime.cc b/src/runtime.cc
index ef04ed34f0d8cdff397d6938c4d528a86954ade9..5047dbd49b98366310fc493caeebd25f4d31340e 100644
--- a/src/runtime.cc
+++ b/src/runtime.cc
@@ -1794,7 +1794,8 @@ RUNTIME_FUNCTION(MaybeObject*, Runtime_RegExpInitializeObject) {
JSRegExp::kIgnoreCaseFieldIndex, ignoreCase, SKIP_WRITE_BARRIER);
regexp->InObjectPropertyAtPut(
JSRegExp::kMultilineFieldIndex, multiline, SKIP_WRITE_BARRIER);
- regexp->ResetLastIndex();
+ regexp->InObjectPropertyAtPut(
+ JSRegExp::kLastIndexFieldIndex, Smi::FromInt(0), SKIP_WRITE_BARRIER);
return regexp;
}
@@ -2911,7 +2912,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceAtomRegExpWithString(
int matches = indices.length();
if (matches == 0) {
- pattern_regexp->ResetLastIndex();
+ JSRegExp::ResetLastIndex(isolate, pattern_regexp);
return *subject;
}
@@ -3014,7 +3015,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithString(
int32_t* current_match = global_cache.FetchNext();
if (current_match == NULL) {
if (global_cache.HasException()) return Failure::Exception();
- regexp->ResetLastIndex();
+ JSRegExp::ResetLastIndex(isolate, regexp);
return *subject;
}
@@ -3113,7 +3114,7 @@ MUST_USE_RESULT static MaybeObject* StringReplaceRegExpWithEmptyString(
int32_t* current_match = global_cache.FetchNext();
if (current_match == NULL) {
if (global_cache.HasException()) return Failure::Exception();
- regexp->ResetLastIndex();
+ JSRegExp::ResetLastIndex(isolate, regexp);
return *subject;
}

Powered by Google App Engine
This is Rietveld 408576698