Revision: 9804
Author: [email protected]
Date: Wed Oct 26 05:51:07 2011
Log: Remove special-casing of calls to RegExp test and exec methods
with no argument.
Matches new JSC behavior. Fix issue 75740.
BUG=75740
TEST=mjsunit/regexp-static
Review URL: http://codereview.chromium.org/6677020
http://code.google.com/p/v8/source/detail?r=9804
Modified:
/branches/bleeding_edge/src/regexp.js
/branches/bleeding_edge/test/mjsunit/regexp-static.js
/branches/bleeding_edge/test/mozilla/mozilla.status
/branches/bleeding_edge/test/sputnik/sputnik.status
/branches/bleeding_edge/test/test262/test262.status
=======================================
--- /branches/bleeding_edge/src/regexp.js Mon Sep 26 01:42:01 2011
+++ /branches/bleeding_edge/src/regexp.js Wed Oct 26 05:51:07 2011
@@ -174,13 +174,6 @@
['RegExp.prototype.exec', this]);
}
- if (%_ArgumentsLength() === 0) {
- var regExpInput = LAST_INPUT(lastMatchInfo);
- if (IS_UNDEFINED(regExpInput)) {
- throw MakeError('no_input_to_regexp', [this]);
- }
- string = regExpInput;
- }
string = TO_STRING_INLINE(string);
var lastIndex = this.lastIndex;
@@ -229,14 +222,6 @@
throw MakeTypeError('incompatible_method_receiver',
['RegExp.prototype.test', this]);
}
- if (%_ArgumentsLength() == 0) {
- var regExpInput = LAST_INPUT(lastMatchInfo);
- if (IS_UNDEFINED(regExpInput)) {
- throw MakeError('no_input_to_regexp', [this]);
- }
- string = regExpInput;
- }
-
string = TO_STRING_INLINE(string);
var lastIndex = this.lastIndex;
=======================================
--- /branches/bleeding_edge/test/mjsunit/regexp-static.js Fri Apr 15
04:35:36 2011
+++ /branches/bleeding_edge/test/mjsunit/regexp-static.js Wed Oct 26
05:51:07 2011
@@ -25,18 +25,6 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Test that we throw exceptions when calling test and exec with no
-// input. This is not part of the spec, but we do it for
-// compatibility with JSC.
-assertThrows("/a/.test()");
-assertThrows("/a/.exec()");
-
-// Test that we do not throw exceptions once the static RegExp.input
-// field has been set.
-RegExp.input = "a";
-assertDoesNotThrow("/a/.test()");
-assertDoesNotThrow("/a/.exec()");
-
// Test the (deprecated as of JS 1.5) properties of the RegExp function.
var re = /((\d+)\.(\d+))/;
var s = 'abc123.456def';
@@ -166,3 +154,8 @@
var foo = "lsdfj sldkfj sdklfj læsdfjl sdkfjlsdk fjsdl fjsdljskdj flsj
flsdkj flskd regexp: /foobar/\nldkfj sdlkfj sdkl";
assertTrue(/^([a-z]+):
(.*)/.test(foo.substring(foo.indexOf("regexp:"))), "regexp: setup");
assertEquals("regexp", RegExp.$1, "RegExp.$1");
+
+
+// Check that calling with no argument is the same as calling with
undefined.
+assertTrue(/^undefined$/.test());
+assertEquals(["undefined"], /^undefined$/.exec());
=======================================
--- /branches/bleeding_edge/test/mozilla/mozilla.status Mon Oct 17 00:43:40
2011
+++ /branches/bleeding_edge/test/mozilla/mozilla.status Wed Oct 26 05:51:07
2011
@@ -300,6 +300,11 @@
js1_2/regexp/beginLine: FAIL_OK
js1_2/regexp/endLine: FAIL_OK
+# We no longer let calls to test and exec with no argument implicitly
+# use the previous input.
+js1_2/regexp/RegExp_input: FAIL_OK
+js1_2/regexp/RegExp_input_as_array: FAIL_OK
+
# To be compatible with safari typeof a regexp yields 'function';
# in firefox it yields 'object'.
=======================================
--- /branches/bleeding_edge/test/sputnik/sputnik.status Wed Oct 19 08:34:32
2011
+++ /branches/bleeding_edge/test/sputnik/sputnik.status Wed Oct 26 05:51:07
2011
@@ -42,12 +42,6 @@
S15.8.2.18_A7: PASS || FAIL_OK
S15.8.2.13_A23: PASS || FAIL_OK
-# We allow calls to regexp exec() with no arguments to fail for
-# compatibility reasons.
-S15.10.6.2_A1_T16: FAIL_OK
-S15.10.6.2_A12: FAIL_OK
-S15.10.6.3_A1_T16: FAIL_OK
-
# Sputnik tests (r97) assume RegExp.prototype is an Object, not a RegExp.
S15.10.6_A2: FAIL_OK
=======================================
--- /branches/bleeding_edge/test/test262/test262.status Wed Oct 26 03:41:52
2011
+++ /branches/bleeding_edge/test/test262/test262.status Wed Oct 26 05:51:07
2011
@@ -145,12 +145,6 @@
S15.8.2.18_A7: PASS || FAIL_OK
S15.8.2.13_A23: PASS || FAIL_OK
-# We allow calls to regexp exec() with no arguments to fail for
-# compatibility reasons.
-S15.10.6.2_A1_T16: FAIL_OK
-S15.10.6.2_A12: FAIL_OK
-S15.10.6.3_A1_T16: FAIL_OK
-
# Sputnik tests (r97) assume RegExp.prototype is an Object, not a RegExp.
S15.10.6_A2: FAIL_OK
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev