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

Unified Diff: src/js/string.js

Issue 1410753002: Do not coerce lastIndex of a global RegExp in @@match and @@replace. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 2 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
« no previous file with comments | « no previous file | test/mjsunit/es6/regexp-match-lastindex.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/string.js
diff --git a/src/js/string.js b/src/js/string.js
index 3fa8e5c2b700c76a396d6da53f70102b16c82cad..c4d25238b4e9951abfb0c769494a1273ba9c9eeb 100644
--- a/src/js/string.js
+++ b/src/js/string.js
@@ -151,9 +151,6 @@ function StringMatchJS(regexp) {
var subject = TO_STRING(this);
if (IS_REGEXP(regexp)) {
- // Emulate RegExp.prototype.exec's side effect in step 5, even though
- // value is discarded.
- var lastIndex = TO_INTEGER(regexp.lastIndex);
if (!regexp.global) return RegExpExecNoTests(regexp, subject, 0);
var result = %StringMatch(subject, regexp, RegExpLastMatchInfo);
if (result !== null) $regexpLastMatchInfoOverride = null;
@@ -222,10 +219,6 @@ function StringReplace(search, replace) {
// ...... string replace (with $-expansion)
if (IS_REGEXP(search)) {
- // Emulate RegExp.prototype.exec's side effect in step 5, even if
- // value is discarded.
- var lastIndex = TO_INTEGER(search.lastIndex);
-
if (!IS_CALLABLE(replace)) {
replace = TO_STRING(replace);
« no previous file with comments | « no previous file | test/mjsunit/es6/regexp-match-lastindex.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698