Reviewers: adamk,

Description:
Revert "In RegExp, lastIndex is read with ToLength, not ToInteger"

$toLength is slow, causing a 3.8%-8% regression in the Octane RegExp
benchmark. Reverting this patch brings it back up. To make this change,
we'll need a faster implementation fo $toLength.

BUG=chromium:513160
LOG=Y
R=adamk

Please review this at https://codereview.chromium.org/1243053005/

Base URL: https://chromium.googlesource.com/v8/v8.git@master

Affected files (+9, -11 lines):
  M src/regexp.js
  M test/mozilla/mozilla.status
  M test/test262-es6/test262-es6.status
  M test/test262/test262.status


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) {
Index: test/mozilla/mozilla.status
diff --git a/test/mozilla/mozilla.status b/test/mozilla/mozilla.status
index 90c397d5ee2dc0e19864eeed34a5ac1807541c14..94278e39b30e2aca222e55b1a2d53cab5dc0a82e 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 #####################

Index: test/test262-es6/test262-es6.status
diff --git a/test/test262-es6/test262-es6.status b/test/test262-es6/test262-es6.status index cab3f0db958716677d84ea281fd81c0c41da8c33..782ee39b673e44ca853a6412cc5201f4956e080d 100644
--- a/test/test262-es6/test262-es6.status
+++ b/test/test262-es6/test262-es6.status
@@ -421,6 +421,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],
Index: test/test262/test262.status
diff --git a/test/test262/test262.status b/test/test262/test262.status
index a88982c9773a3c4678a0567e4c3ca1fff63885cb..feed1a320662db1dbb64d932d85a9ac820df3fb8 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],
-
   ######################## NEEDS INVESTIGATION ###########################

# These test failures are specific to the intl402 suite and need investigation


--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to