From e01f34fae671e0f845d5b074788a31ae197e1e6a Mon Sep 17 00:00:00 2001 From: yangguo Date: Mon, 27 Jul 2015 03:58:33 -0700 Subject: [PATCH] Revert "In RegExp, lastIndex is read with ToLength, not ToInteger" This reverts commit 1f61ac50338cc2ef1a54735206351f9798687248. TBR=littledan@chromium.org BUG=chromium:513160 LOG=N Review URL: https://codereview.chromium.org/1256193002 Cr-Commit-Position: refs/heads/master@{#29866} --- src/regexp.js | 12 ++++++------ test/mozilla/mozilla.status | 2 -- test/test262-es6/test262-es6.status | 3 +++ test/test262/test262.status | 3 --- 4 files changed, 9 insertions(+), 11 deletions(-) diff --git a/src/regexp.js b/src/regexp.js index 6c6b11cfd6..bf75ca1b01 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) { diff --git a/test/mozilla/mozilla.status b/test/mozilla/mozilla.status index 90c397d5ee..94278e39b3 100644 --- a/test/mozilla/mozilla.status +++ b/test/mozilla/mozilla.status @@ -85,8 +85,6 @@ 'ecma/String/15.5.4.8-1': [FAIL], 'ecma/String/15.5.4.9-1': [FAIL], - # ToLength, not ToUint32, is called on RegExps' lastIndex property - 'ecma_3/RegExp/15.10.6.2-2': [FAIL], ##################### SKIPPED TESTS ##################### diff --git a/test/test262-es6/test262-es6.status b/test/test262-es6/test262-es6.status index 005a8697ef..29ecd6c4c0 100644 --- a/test/test262-es6/test262-es6.status +++ b/test/test262-es6/test262-es6.status @@ -418,6 +418,9 @@ # https://code.google.com/p/v8/issues/detail?id=4003 'built-ins/RegExp/prototype/15.10.6': [FAIL], + # https://code.google.com/p/v8/issues/detail?id=4244 + 'built-ins/RegExp/prototype/exec/S15.10.6.2_A5_T3': [FAIL], + # https://code.google.com/p/v8/issues/detail?id=4006 'built-ins/String/prototype/S15.5.4_A1': [FAIL], 'built-ins/String/prototype/S15.5.4_A2': [FAIL], diff --git a/test/test262/test262.status b/test/test262/test262.status index 48c6b35874..b9ef3c68f4 100644 --- a/test/test262/test262.status +++ b/test/test262/test262.status @@ -281,9 +281,6 @@ '15.2.3.13-1-3': [FAIL], '15.2.3.13-1-4': [FAIL], - # ES6 RegExp test calls ToLength, not ToUint32 - 'S15.10.6.2_A5_T3': [FAIL], - # ES6 says for dates to default to the local timezone if none is specified '15.9.1.15-1': [FAIL],