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

Unified Diff: src/js/regexp.js

Issue 1394023005: Make RegExp use ToLength on lastIndex when flag is turned on (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 | « src/js/macros.py ('k') | test/mjsunit/harmony/regexp-tolength.js » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/js/regexp.js
diff --git a/src/js/regexp.js b/src/js/regexp.js
index 90d4d358e8d2653797d0b586fa8b306f481437e5..3536fe17eb049b62eeac7204dd1129c79b57ddde 100644
--- a/src/js/regexp.js
+++ b/src/js/regexp.js
@@ -163,9 +163,9 @@ function RegExpExecJS(string) {
string = TO_STRING(string);
var lastIndex = this.lastIndex;
- // Conversion is required by the ES5 specification (RegExp.prototype.exec
- // algorithm, step 5) even if the value is discarded for non-global RegExps.
- var i = TO_INTEGER(lastIndex);
+ // Conversion is required by the ES2015 specification (RegExpBuiltinExec
+ // algorithm, step 4) even if the value is discarded for non-global RegExps.
+ var i = TO_LENGTH_OR_INTEGER(lastIndex);
var updateLastIndex = this.global || (FLAG_harmony_regexps && this.sticky);
if (updateLastIndex) {
@@ -211,9 +211,9 @@ function RegExpTest(string) {
var lastIndex = this.lastIndex;
- // Conversion is required by the ES5 specification (RegExp.prototype.exec
- // algorithm, step 5) even if the value is discarded for non-global RegExps.
- var i = TO_INTEGER(lastIndex);
+ // Conversion is required by the ES2015 specification (RegExpBuiltinExec
+ // algorithm, step 4) even if the value is discarded for non-global RegExps.
+ var i = TO_LENGTH_OR_INTEGER(lastIndex);
if (this.global || (FLAG_harmony_regexps && this.sticky)) {
if (i < 0 || i > string.length) {
« no previous file with comments | « src/js/macros.py ('k') | test/mjsunit/harmony/regexp-tolength.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698