diff options
Diffstat (limited to 'deps/v8/test/mjsunit')
-rw-r--r-- | deps/v8/test/mjsunit/mjsunit.status | 5 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/object-define-property.js | 32 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/regexp.js | 92 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-962.js | 53 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-969.js | 127 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/third_party/regexp-pcre.js | 24 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/tools/logreader.js | 82 |
7 files changed, 277 insertions, 138 deletions
diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status index 24d9603b6b..75a5a02150 100644 --- a/deps/v8/test/mjsunit/mjsunit.status +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -104,6 +104,11 @@ regress/regress-create-exception: SKIP regress/regress-3218915: SKIP regress/regress-3247124: SKIP +############################################################################## +[ $arch == arm && $crankshaft ] + +# Test that currently fail with crankshaft on ARM. +compiler/simple-osr: FAIL ############################################################################## [ $arch == mips ] diff --git a/deps/v8/test/mjsunit/object-define-property.js b/deps/v8/test/mjsunit/object-define-property.js index b258aa75bf..780c720b51 100644 --- a/deps/v8/test/mjsunit/object-define-property.js +++ b/deps/v8/test/mjsunit/object-define-property.js @@ -866,4 +866,36 @@ assertFalse(desc.writable); assertFalse(desc.enumerable); assertFalse(desc.configurable); +// See issue 968: http://code.google.com/p/v8/issues/detail?id=968 +var o = { x : 42 }; +Object.defineProperty(o, "x", { writable: false }); +assertEquals(42, o.x); +o.x = 37; +assertEquals(42, o.x); + +o = { x : 42 }; +Object.defineProperty(o, "x", {}); +assertEquals(42, o.x); +o.x = 37; +// Writability is preserved. +assertEquals(37, o.x); + +var o = { }; +Object.defineProperty(o, "x", { writable: false }); +assertEquals(undefined, o.x); +o.x = 37; +assertEquals(undefined, o.x); + +o = { get x() { return 87; } }; +Object.defineProperty(o, "x", { writable: false }); +assertEquals(undefined, o.x); +o.x = 37; +assertEquals(undefined, o.x); + +// Ignore inherited properties. +o = { __proto__ : { x : 87 } }; +Object.defineProperty(o, "x", { writable: false }); +assertEquals(undefined, o.x); +o.x = 37; +assertEquals(undefined, o.x); diff --git a/deps/v8/test/mjsunit/regexp.js b/deps/v8/test/mjsunit/regexp.js index 59c3ba8d28..4c1d2e315f 100644 --- a/deps/v8/test/mjsunit/regexp.js +++ b/deps/v8/test/mjsunit/regexp.js @@ -110,6 +110,44 @@ assertFalse(re.test("\\]")); assertFalse(re.test("\x03]")); // I.e., read as \cc +// Test that we handle \s and \S correctly inside some bizarre +// character classes. +re = /[\s-:]/; +assertTrue(re.test('-')); +assertTrue(re.test(':')); +assertTrue(re.test(' ')); +assertTrue(re.test('\t')); +assertTrue(re.test('\n')); +assertFalse(re.test('a')); +assertFalse(re.test('Z')); + +re = /[\S-:]/; +assertTrue(re.test('-')); +assertTrue(re.test(':')); +assertFalse(re.test(' ')); +assertFalse(re.test('\t')); +assertFalse(re.test('\n')); +assertTrue(re.test('a')); +assertTrue(re.test('Z')); + +re = /[^\s-:]/; +assertFalse(re.test('-')); +assertFalse(re.test(':')); +assertFalse(re.test(' ')); +assertFalse(re.test('\t')); +assertFalse(re.test('\n')); +assertTrue(re.test('a')); +assertTrue(re.test('Z')); + +re = /[^\S-:]/; +assertFalse(re.test('-')); +assertFalse(re.test(':')); +assertTrue(re.test(' ')); +assertTrue(re.test('\t')); +assertTrue(re.test('\n')); +assertFalse(re.test('a')); +assertFalse(re.test('Z')); + re = /[\s]/; assertFalse(re.test('-')); assertFalse(re.test(':')); @@ -164,6 +202,17 @@ assertFalse(re.test('\n')); assertFalse(re.test('a')); assertFalse(re.test('Z')); +// First - is treated as range operator, second as literal minus. +// This follows the specification in parsing, but doesn't throw on +// the \s at the beginning of the range. +re = /[\s-0-9]/; +assertTrue(re.test(' ')); +assertTrue(re.test('\xA0')); +assertTrue(re.test('-')); +assertTrue(re.test('0')); +assertTrue(re.test('9')); +assertFalse(re.test('1')); + // Test beginning and end of line assertions with or without the // multiline flag. re = /^\d+/; @@ -610,46 +659,3 @@ assertEquals(["bc"], re.exec("zimzomzumbc")); assertFalse(re.test("c")); assertFalse(re.test("")); - -function testInvalidRange(str) { - try { - RegExp(str).test("x"); - } catch (e) { - return; - } - assetUnreachable("Allowed invalid range in " + str); -} - -function testValidRange(str) { - try { - RegExp(str).test("x"); - } catch (e) { - assertUnreachable("Shouldn't fail parsing: " + str + ", was: " + e); - } -} - -testInvalidRange("[\\d-z]"); -testInvalidRange("[z-\\d]"); -testInvalidRange("[\\d-\\d]"); -testInvalidRange("[z-x]"); // Larger value first. -testInvalidRange("[x-\\d-\\d]"); - -testValidRange("[x-z]"); -testValidRange("[!--\d]"); // Second "-" is end of range. -testValidRange("[\d-]"); -testValidRange("[-\d]"); -testValidRange("[-\d-]"); -testValidRange("[^-\d-]"); -testValidRange("[^-\d-]"); -testValidRange("[0-9-\w]"); - -// Escaped dashes do not count as range operators. -testValidRange("[\\d\\-z]"); -testValidRange("[z\\-\\d]"); -testValidRange("[\\d\\-\\d]"); -testValidRange("[z\\-x]"); -testValidRange("[x\\-\\d\\-\\d]"); - - - - diff --git a/deps/v8/test/mjsunit/regress/regress-962.js b/deps/v8/test/mjsunit/regress/regress-962.js new file mode 100644 index 0000000000..c0a2fdc716 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-962.js @@ -0,0 +1,53 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function L(scope) { this.s = new Object(); } + +L.prototype.c = function() { return true; } + +function F() { + this.l = [new L, new L]; +} + +F.prototype.foo = function () { + var f, d = arguments, + e, b = this.l, + g; + for (e = 0; e < b.length; e++) { + g = b[e]; + f = g.c.apply(g.s, d); + if (f === false) { + break + } + } + return f +} + + +var ctx = new F; + +for (var i = 0; i < 10000000; i++) ctx.foo(); diff --git a/deps/v8/test/mjsunit/regress/regress-969.js b/deps/v8/test/mjsunit/regress/regress-969.js new file mode 100644 index 0000000000..c2ba0ac9e8 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-969.js @@ -0,0 +1,127 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Regression test for bugs when deoptimizing after assignments in effect +// contexts. + +// Bug 989 is that there was an extra value on the expression stack when +// deoptimizing after an assignment in effect context (the value of the +// assignment was lingering). This is hard to observe in the unoptimized +// code. +// +// This test uses comma expressions to put assignments in effect contexts, +// references to deleted global variables to force deoptimization, and +// function calls to observe an extra value. + +function first(x, y) { return x; } +var y = 0; +var o = {}; +o.x = 0; +o[0] = 0; + +// Assignment to global variable. +x0 = 0; +function test0() { return first((y = 1, typeof x0), 2); } +// Call the function once to compile it. +assertEquals('number', test0()); +// Delete to force deoptimization on the next call. +delete x0; +assertEquals('undefined', test0()); + +// Compound assignment to global variable. +x1 = 0; +function test1() { return first((y += 1, typeof x1), 2); } +assertEquals('number', test1(), 'test1 before'); +delete x1; +assertEquals('undefined', test1(), 'test1 after'); + +// Pre and post-increment of global variable. +x2 = 0; +function test2() { return first((++y, typeof x2), 2); } +assertEquals('number', test2(), 'test2 before'); +delete x2; +assertEquals('undefined', test2(), 'test2 after'); + +x3 = 0; +function test3() { return first((y++, typeof x3), 2); } +assertEquals('number', test3(), 'test3 before'); +delete x3; +assertEquals('undefined', test3(), 'test3 after'); + + +// Assignment, compound assignment, and pre and post-increment of named +// properties. +x4 = 0; +function test4() { return first((o.x = 1, typeof x4), 2); } +assertEquals('number', test4()); +delete x4; +assertEquals('undefined', test4()); + +x5 = 0; +function test5() { return first((o.x += 1, typeof x5), 2); } +assertEquals('number', test5()); +delete x5; +assertEquals('undefined', test5()); + +x6 = 0; +function test6() { return first((++o.x, typeof x6), 2); } +assertEquals('number', test6()); +delete x6; +assertEquals('undefined', test6()); + +x7 = 0; +function test7() { return first((o.x++, typeof x7), 2); } +assertEquals('number', test7()); +delete x7; +assertEquals('undefined', test7()); + + +// Assignment, compound assignment, and pre and post-increment of indexed +// properties. +x8 = 0; +function test8(index) { return first((o[index] = 1, typeof x8), 2); } +assertEquals('number', test8()); +delete x8; +assertEquals('undefined', test8()); + +x9 = 0; +function test9(index) { return first((o[index] += 1, typeof x9), 2); } +assertEquals('number', test9()); +delete x9; +assertEquals('undefined', test9()); + +x10 = 0; +function test10(index) { return first((++o[index], typeof x10), 2); } +assertEquals('number', test10()); +delete x10; +assertEquals('undefined', test10()); + +x11 = 0; +function test11(index) { return first((o[index]++, typeof x11), 2); } +assertEquals('number', test11()); +delete x11; +assertEquals('undefined', test11()); diff --git a/deps/v8/test/mjsunit/third_party/regexp-pcre.js b/deps/v8/test/mjsunit/third_party/regexp-pcre.js index d9fa976855..dcb1b320fd 100644 --- a/deps/v8/test/mjsunit/third_party/regexp-pcre.js +++ b/deps/v8/test/mjsunit/third_party/regexp-pcre.js @@ -962,7 +962,7 @@ res[882] = /[az-]+/; res[883] = /[a\-z]+/; res[884] = /[a-z]+/; res[885] = /[\d-]+/; -// res[886] - Disabled after making [\d-z] invalid to be compatible with JSC. +res[886] = /[\d-z]+/; res[887] = /\x5c/; res[888] = /\x20Z/; res[889] = /ab{3cd/; @@ -1346,7 +1346,7 @@ res[1266] = /((Z)+|A)*/; res[1267] = /(Z()|A)*/; res[1268] = /(Z(())|A)*/; res[1269] = /a*/g; -// res[1270] disabled after making /^[\d-a]/ invalid to be compatible with JSC. +res[1270] = /^[\d-a]/; res[1271] = /[[:space:]]+/; res[1272] = /[[:blank:]]+/; res[1273] = /[\s]+/; @@ -2530,7 +2530,7 @@ assertEquals(null, res[431].exec("a\x0db ", 882)); assertEquals(null, res[431].exec("a\x85b", 883)); assertThrows("var re = /(?-+a)/;", 884); assertEquals(null, res[443].exec("aaaa", 885)); -// assertEquals(null, res[443].exec("bacxxx", 886)); +assertEquals(null, res[443].exec("bacxxx", 886)); assertEquals(null, res[443].exec("bbaccxxx ", 887)); assertEquals(null, res[443].exec("bbbacccxx", 888)); assertEquals(null, res[443].exec("aaaa", 889)); @@ -4391,10 +4391,9 @@ assertEquals("abcdxyz", res[884].exec("abcdxyz"), 2743); assertEquals("12-34", res[885].exec("12-34"), 2744); assertEquals(null, res[885].exec("*** Failers", 2745)); assertEquals(null, res[885].exec("aaa", 2746)); -// Disabled. To be compatible with JSC, the regexp is no longer valid. -// assertEquals("12-34z", res[886].exec("12-34z"), 2747); -// assertEquals(null, res[886].exec("*** Failers", 2748)); -// assertEquals(null, res[886].exec("aaa", 2749)); +assertEquals("12-34z", res[886].exec("12-34z"), 2747); +assertEquals(null, res[886].exec("*** Failers", 2748)); +assertEquals(null, res[886].exec("aaa", 2749)); assertEquals("\\", res[887].exec("\\\\"), 2750); assertEquals(" Z", res[888].exec("the Zoo"), 2751); assertEquals(null, res[888].exec("*** Failers", 2752)); @@ -5356,12 +5355,11 @@ assertEquals("", res[1269].exec("-things"), 3707); assertEquals("", res[1269].exec("0digit"), 3708); assertEquals("", res[1269].exec("*** Failers"), 3709); assertEquals("", res[1269].exec("bcdef "), 3710); -// Disabled. To be compatible with JSC, the RegExp is no longer valid. -// assertEquals("a", res[1270].exec("abcde"), 3711); -// assertEquals("-", res[1270].exec("-things"), 3712); -// assertEquals("0", res[1270].exec("0digit"), 3713); -// assertEquals(null, res[1270].exec("*** Failers", 3714)); -// assertEquals(null, res[1270].exec("bcdef ", 3715)); +assertEquals("a", res[1270].exec("abcde"), 3711); +assertEquals("-", res[1270].exec("-things"), 3712); +assertEquals("0", res[1270].exec("0digit"), 3713); +assertEquals(null, res[1270].exec("*** Failers", 3714)); +assertEquals(null, res[1270].exec("bcdef ", 3715)); assertEquals(null, res[1271].exec("> \x09\n\x0c\x0d\x0b<", 3716)); assertEquals(null, res[1271].exec(" ", 3717)); assertEquals(null, res[1272].exec("> \x09\n\x0c\x0d\x0b<", 3718)); diff --git a/deps/v8/test/mjsunit/tools/logreader.js b/deps/v8/test/mjsunit/tools/logreader.js deleted file mode 100644 index 485990eaa1..0000000000 --- a/deps/v8/test/mjsunit/tools/logreader.js +++ /dev/null @@ -1,82 +0,0 @@ -// Copyright 2009 the V8 project authors. All rights reserved. -// Redistribution and use in source and binary forms, with or without -// modification, are permitted provided that the following conditions are -// met: -// -// * Redistributions of source code must retain the above copyright -// notice, this list of conditions and the following disclaimer. -// * Redistributions in binary form must reproduce the above -// copyright notice, this list of conditions and the following -// disclaimer in the documentation and/or other materials provided -// with the distribution. -// * Neither the name of Google Inc. nor the names of its -// contributors may be used to endorse or promote products derived -// from this software without specific prior written permission. -// -// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS -// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT -// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR -// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT -// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, -// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT -// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, -// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY -// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT -// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - -// Load CSV Parser and Log Reader implementations from <project root>/tools. -// Files: tools/csvparser.js tools/logreader.js - - -(function testAddressParser() { - var reader = new devtools.profiler.LogReader({}); - var parser = reader.createAddressParser('test'); - - // Test that 0x values are parsed, and prevAddresses_ are untouched. - assertFalse('test' in reader.prevAddresses_); - assertEquals(0, parser('0x0')); - assertFalse('test' in reader.prevAddresses_); - assertEquals(0x100, parser('0x100')); - assertFalse('test' in reader.prevAddresses_); - assertEquals(0xffffffff, parser('0xffffffff')); - assertFalse('test' in reader.prevAddresses_); - - // Test that values that has no '+' or '-' prefix are parsed - // and saved to prevAddresses_. - assertEquals(0, parser('0')); - assertEquals(0, reader.prevAddresses_.test); - assertEquals(0x100, parser('100')); - assertEquals(0x100, reader.prevAddresses_.test); - assertEquals(0xffffffff, parser('ffffffff')); - assertEquals(0xffffffff, reader.prevAddresses_.test); - - // Test that values prefixed with '+' or '-' are treated as deltas, - // and prevAddresses_ is updated. - // Set base value. - assertEquals(0x100, parser('100')); - assertEquals(0x100, reader.prevAddresses_.test); - assertEquals(0x200, parser('+100')); - assertEquals(0x200, reader.prevAddresses_.test); - assertEquals(0x100, parser('-100')); - assertEquals(0x100, reader.prevAddresses_.test); -})(); - - -(function testAddressParser() { - var reader = new devtools.profiler.LogReader({}); - - assertEquals([0x10000000, 0x10001000, 0xffff000, 0x10000000], - reader.processStack(0x10000000, 0, ['overflow', - '+1000', '-2000', '+1000'])); -})(); - - -(function testExpandBackRef() { - var reader = new devtools.profiler.LogReader({}); - - assertEquals('aaaaaaaa', reader.expandBackRef_('aaaaaaaa')); - assertEquals('aaaaaaaa', reader.expandBackRef_('#1')); - assertEquals('bbbbaaaa', reader.expandBackRef_('bbbb#2:4')); - assertEquals('"#1:1"', reader.expandBackRef_('"#1:1"')); -})(); |