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

Unified Diff: src/regexp.js

Issue 1256193002: Revert "In RegExp, lastIndex is read with ToLength, not ToInteger" (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 5 years, 5 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/mozilla/mozilla.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/regexp.js
diff --git a/src/regexp.js b/src/regexp.js
index 6c6b11cfd624c7e5ff5a5aad5ef7e2bc2a50181c..bf75ca1b011e4f5a30013a84621a9d9e3b5a882b 100644
--- a/src/regexp.js
+++ b/src/regexp.js
@@ -154,9 +154,9 @@ function RegExpExecJS(string) {
string = TO_STRING_INLINE(string);
var lastIndex = this.lastIndex;
- // Conversion is required by the ES6 specification (RegExpBuiltinExec
- // algorithm, step 4) even if the value is discarded for non-global RegExps.
- var i = $toLength(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);
var updateLastIndex = this.global || (harmony_regexps && this.sticky);
if (updateLastIndex) {
@@ -202,9 +202,9 @@ function RegExpTest(string) {
var lastIndex = this.lastIndex;
- // Conversion is required by the ES6 specification (RegExpBuiltinExec
- // algorithm, step 4) even if the value is discarded for non-global RegExps.
- var i = $toLength(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);
if (this.global || (harmony_regexps && this.sticky)) {
if (i < 0 || i > string.length) {
« no previous file with comments | « no previous file | test/mozilla/mozilla.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698