diff options
Diffstat (limited to 'deps/v8/test/mjsunit')
70 files changed, 96 insertions, 4365 deletions
diff --git a/deps/v8/test/mjsunit/array-bounds-check-removal.js b/deps/v8/test/mjsunit/array-bounds-check-removal.js index 7a7cb304de..df7988bdaa 100644 --- a/deps/v8/test/mjsunit/array-bounds-check-removal.js +++ b/deps/v8/test/mjsunit/array-bounds-check-removal.js @@ -178,29 +178,5 @@ short_test(a, 0); assertTrue(%GetOptimizationStatus(short_test) != 1); -// A test for when we would modify a phi index. -var data_phi = [0, 1, 2, 3, 4, 5, 6, 7, 8]; -function test_phi(a, base, check) { - var index; - if (check) { - index = base + 1; - } else { - index = base + 2; - } - var result = a[index]; - result += a[index + 1]; - result += a[index - 1]; - return result; -} -var result_phi = 0; -result_phi = test_phi(data_phi, 3, true); -assertEquals(12, result_phi); -result_phi = test_phi(data_phi, 3, true); -assertEquals(12, result_phi); -%OptimizeFunctionOnNextCall(test_phi); -result_phi = test_phi(data_phi, 3, true); -assertEquals(12, result_phi); - - gc(); diff --git a/deps/v8/test/mjsunit/array-natives-elements.js b/deps/v8/test/mjsunit/array-natives-elements.js deleted file mode 100644 index 96a8cb5d19..0000000000 --- a/deps/v8/test/mjsunit/array-natives-elements.js +++ /dev/null @@ -1,307 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax --smi-only-arrays -// Flags: --noparallel-recompilation - -// Test element kind of objects. -// Since --smi-only-arrays affects builtins, its default setting at compile time -// sticks if built with snapshot. If --smi-only-arrays is deactivated by -// default, only a no-snapshot build actually has smi-only arrays enabled in -// this test case. Depending on whether smi-only arrays are actually enabled, -// this test takes the appropriate code path to check smi-only arrays. - -support_smi_only_arrays = %HasFastSmiElements([1,2,3,4,5,6,7,8,9,10]); - -if (support_smi_only_arrays) { - print("Tests include smi-only arrays."); -} else { - print("Tests do NOT include smi-only arrays."); -} - -// IC and Crankshaft support for smi-only elements in dynamic array literals. -function get(foo) { return foo; } // Used to generate dynamic values. - -function array_natives_test() { - - // Ensure small array literals start in specific element kind mode. - assertTrue(%HasFastSmiElements([])); - assertTrue(%HasFastSmiElements([1])); - assertTrue(%HasFastSmiElements([1,2])); - assertTrue(%HasFastDoubleElements([1.1])); - assertTrue(%HasFastDoubleElements([1.1,2])); - - // Push - var a0 = [1, 2, 3]; - assertTrue(%HasFastSmiElements(a0)); - a0.push(4); - assertTrue(%HasFastSmiElements(a0)); - a0.push(1.3); - assertTrue(%HasFastDoubleElements(a0)); - a0.push(1.5); - assertTrue(%HasFastDoubleElements(a0)); - a0.push({}); - assertTrue(%HasFastObjectElements(a0)); - a0.push({}); - assertTrue(%HasFastObjectElements(a0)); - assertEquals([1,2,3,4,1.3,1.5,{},{}], a0); - - // Concat - var a1; - a1 = [1,2,3].concat([]); - assertTrue(%HasFastSmiElements(a1)); - assertEquals([1,2,3], a1); - a1 = [1,2,3].concat([4,5,6]); - assertTrue(%HasFastSmiElements(a1)); - assertEquals([1,2,3,4,5,6], a1); - a1 = [1,2,3].concat([4,5,6], [7,8,9]); - assertTrue(%HasFastSmiElements(a1)); - assertEquals([1,2,3,4,5,6,7,8,9], a1); - a1 = [1.1,2,3].concat([]); - assertTrue(%HasFastDoubleElements(a1)); - assertEquals([1.1,2,3], a1); - a1 = [1,2,3].concat([1.1, 2]); - assertTrue(%HasFastDoubleElements(a1)); - assertEquals([1,2,3,1.1,2], a1); - a1 = [1.1,2,3].concat([1, 2]); - assertTrue(%HasFastDoubleElements(a1)); - assertEquals([1.1,2,3,1,2], a1); - a1 = [1.1,2,3].concat([1.2, 2]); - assertTrue(%HasFastDoubleElements(a1)); - assertEquals([1.1,2,3,1.2,2], a1); - - a1 = [1,2,3].concat([{}]); - assertTrue(%HasFastObjectElements(a1)); - assertEquals([1,2,3,{}], a1); - a1 = [1.1,2,3].concat([{}]); - assertTrue(%HasFastObjectElements(a1)); - assertEquals([1.1,2,3,{}], a1); - a1 = [{}].concat([1,2,3]); - assertTrue(%HasFastObjectElements(a1)); - assertEquals([{},1,2,3], a1); - a1 = [{}].concat([1.1,2,3]); - assertTrue(%HasFastObjectElements(a1)); - assertEquals([{},1.1,2,3], a1); - - // Slice - var a2 = [1,2,3]; - assertTrue(%HasFastSmiElements(a2.slice())); - assertTrue(%HasFastSmiElements(a2.slice(1))); - assertTrue(%HasFastSmiElements(a2.slice(1, 2))); - assertEquals([1,2,3], a2.slice()); - assertEquals([2,3], a2.slice(1)); - assertEquals([2], a2.slice(1,2)); - a2 = [1.1,2,3]; - assertTrue(%HasFastDoubleElements(a2.slice())); - assertTrue(%HasFastDoubleElements(a2.slice(1))); - assertTrue(%HasFastDoubleElements(a2.slice(1, 2))); - assertEquals([1.1,2,3], a2.slice()); - assertEquals([2,3], a2.slice(1)); - assertEquals([2], a2.slice(1,2)); - a2 = [{},2,3]; - assertTrue(%HasFastObjectElements(a2.slice())); - assertTrue(%HasFastObjectElements(a2.slice(1))); - assertTrue(%HasFastObjectElements(a2.slice(1, 2))); - assertEquals([{},2,3], a2.slice()); - assertEquals([2,3], a2.slice(1)); - assertEquals([2], a2.slice(1,2)); - - // Splice - var a3 = [1,2,3]; - var a3r; - a3r = a3.splice(0, 0); - assertTrue(%HasFastSmiElements(a3r)); - assertTrue(%HasFastSmiElements(a3)); - assertEquals([], a3r); - assertEquals([1, 2, 3], a3); - a3 = [1,2,3]; - a3r = a3.splice(0, 1); - assertTrue(%HasFastSmiElements(a3r)); - assertTrue(%HasFastSmiElements(a3)); - assertEquals([1], a3r); - assertEquals([2, 3], a3); - a3 = [1,2,3]; - a3r = a3.splice(0, 0, 2); - assertTrue(%HasFastSmiElements(a3r)); - assertTrue(%HasFastSmiElements(a3)); - assertEquals([], a3r); - assertEquals([2, 1, 2, 3], a3); - a3 = [1,2,3]; - a3r = a3.splice(0, 1, 2); - assertTrue(%HasFastSmiElements(a3r)); - assertTrue(%HasFastSmiElements(a3)); - assertEquals([1], a3r); - assertEquals([2, 2, 3], a3); - - a3 = [1.1,2,3]; - a3r = a3.splice(0, 0); - assertTrue(%HasFastDoubleElements(a3r)); - assertTrue(%HasFastDoubleElements(a3)); - assertEquals([], a3r); - assertEquals([1.1, 2, 3], a3); - a3 = [1.1,2,3]; - a3r = a3.splice(0, 1); - assertTrue(%HasFastDoubleElements(a3r)); - assertTrue(%HasFastDoubleElements(a3)); - assertEquals([1.1], a3r); - assertEquals([2, 3], a3); - a3 = [1.1,2,3]; - a3r = a3.splice(0, 0, 2); - // Commented out since handled in js, which takes the best fit. - // assertTrue(%HasFastDoubleElements(a3r)); - assertTrue(%HasFastSmiElements(a3r)); - assertTrue(%HasFastDoubleElements(a3)); - assertEquals([], a3r); - assertEquals([2, 1.1, 2, 3], a3); - a3 = [1.1,2,3]; - a3r = a3.splice(0, 1, 2); - assertTrue(%HasFastDoubleElements(a3r)); - assertTrue(%HasFastDoubleElements(a3)); - assertEquals([1.1], a3r); - assertEquals([2, 2, 3], a3); - a3 = [1.1,2,3]; - a3r = a3.splice(0, 0, 2.1); - // Commented out since handled in js, which takes the best fit. - // assertTrue(%HasFastDoubleElements(a3r)); - assertTrue(%HasFastSmiElements(a3r)); - assertTrue(%HasFastDoubleElements(a3)); - assertEquals([], a3r); - assertEquals([2.1, 1.1, 2, 3], a3); - a3 = [1.1,2,3]; - a3r = a3.splice(0, 1, 2.2); - assertTrue(%HasFastDoubleElements(a3r)); - assertTrue(%HasFastDoubleElements(a3)); - assertEquals([1.1], a3r); - assertEquals([2.2, 2, 3], a3); - a3 = [1,2,3]; - a3r = a3.splice(0, 0, 2.1); - // Commented out since handled in js, which takes the best fit. - // assertTrue(%HasFastDoubleElements(a3r)); - assertTrue(%HasFastSmiElements(a3r)); - assertTrue(%HasFastDoubleElements(a3)); - assertEquals([], a3r); - assertEquals([2.1, 1, 2, 3], a3); - a3 = [1,2,3]; - a3r = a3.splice(0, 1, 2.2); - assertTrue(%HasFastDoubleElements(a3r)); - assertTrue(%HasFastDoubleElements(a3)); - assertEquals([1], a3r); - assertEquals([2.2, 2, 3], a3); - - a3 = [{},2,3]; - a3r = a3.splice(0, 0); - assertTrue(%HasFastObjectElements(a3r)); - assertTrue(%HasFastObjectElements(a3)); - assertEquals([], a3r); - assertEquals([{}, 2, 3], a3); - a3 = [1,2,{}]; - a3r = a3.splice(0, 1); - assertTrue(%HasFastObjectElements(a3r)); - assertTrue(%HasFastObjectElements(a3)); - assertEquals([1], a3r); - assertEquals([2, {}], a3); - a3 = [1,2,3]; - a3r = a3.splice(0, 0, {}); - assertTrue(%HasFastObjectElements(a3r)); - assertTrue(%HasFastObjectElements(a3)); - assertEquals([], a3r); - assertEquals([{}, 1, 2, 3], a3); - a3 = [1,2,3]; - a3r = a3.splice(0, 1, {}); - assertTrue(%HasFastObjectElements(a3r)); - assertTrue(%HasFastObjectElements(a3)); - assertEquals([1], a3r); - assertEquals([{}, 2, 3], a3); - - a3 = [1.1,2,3]; - a3r = a3.splice(0, 0, {}); - assertTrue(%HasFastObjectElements(a3r)); - assertTrue(%HasFastObjectElements(a3)); - assertEquals([], a3r); - assertEquals([{}, 1.1, 2, 3], a3); - a3 = [1.1,2,3]; - a3r = a3.splice(0, 1, {}); - assertTrue(%HasFastObjectElements(a3r)); - assertTrue(%HasFastObjectElements(a3)); - assertEquals([1.1], a3r); - assertEquals([{}, 2, 3], a3); - - // Pop - var a4 = [1,2,3]; - assertEquals(3, a4.pop()); - assertTrue(%HasFastSmiElements(a4)); - a4 = [1.1,2,3]; - assertEquals(3, a4.pop()); - assertTrue(%HasFastDoubleElements(a4)); - a4 = [{},2,3]; - assertEquals(3, a4.pop()); - assertTrue(%HasFastObjectElements(a4)); - - // Shift - var a4 = [1,2,3]; - assertEquals(1, a4.shift()); - assertTrue(%HasFastSmiElements(a4)); - a4 = [1.1,2,3]; - assertEquals(1.1, a4.shift()); - assertTrue(%HasFastDoubleElements(a4)); - a4 = [{},2,3]; - assertEquals({}, a4.shift()); - assertTrue(%HasFastObjectElements(a4)); - - // Unshift - var a4 = [1,2,3]; - a4.unshift(1); - assertTrue(%HasFastSmiElements(a4)); - assertEquals([1,1,2,3], a4); - a4 = [1,2,3]; - a4.unshift(1.1); - // TODO(verwaest): We'll want to support double unshifting as well. - // assertTrue(%HasFastDoubleElements(a4)); - assertTrue(%HasFastObjectElements(a4)); - assertEquals([1.1,1,2,3], a4); - a4 = [1.1,2,3]; - a4.unshift(1); - // assertTrue(%HasFastDoubleElements(a4)); - assertTrue(%HasFastObjectElements(a4)); - assertEquals([1,1.1,2,3], a4); - a4 = [{},2,3]; - a4.unshift(1); - assertTrue(%HasFastObjectElements(a4)); - assertEquals([1,{},2,3], a4); - a4 = [{},2,3]; - a4.unshift(1.1); - assertTrue(%HasFastObjectElements(a4)); - assertEquals([1.1,{},2,3], a4); -} - -if (support_smi_only_arrays) { - for (var i = 0; i < 3; i++) { - array_natives_test(); - } - %OptimizeFunctionOnNextCall(array_natives_test); - array_natives_test(); -} diff --git a/deps/v8/test/mjsunit/array-reduce.js b/deps/v8/test/mjsunit/array-reduce.js index 429f34808d..1e96188265 100755 --- a/deps/v8/test/mjsunit/array-reduce.js +++ b/deps/v8/test/mjsunit/array-reduce.js @@ -418,8 +418,8 @@ try { exception = true; assertTrue(e instanceof TypeError, "reduce callback not a function not throwing TypeError"); - assertTrue(e.message.indexOf(" is not a function") >= 0, - "reduce non function TypeError type"); + assertEquals("called_non_callable", e.type, + "reduce non function TypeError type"); } assertTrue(exception); @@ -430,8 +430,8 @@ try { exception = true; assertTrue(e instanceof TypeError, "reduceRight callback not a function not throwing TypeError"); - assertTrue(e.message.indexOf(" is not a function") >= 0, - "reduceRight non function TypeError type"); + assertEquals("called_non_callable", e.type, + "reduceRight non function TypeError type"); } assertTrue(exception); @@ -442,7 +442,7 @@ try { exception = true; assertTrue(e instanceof TypeError, "reduce no initial value not throwing TypeError"); - assertEquals("Reduce of empty array with no initial value", e.message, + assertEquals("reduce_no_initial", e.type, "reduce no initial TypeError type"); } assertTrue(exception); @@ -454,7 +454,7 @@ try { exception = true; assertTrue(e instanceof TypeError, "reduceRight no initial value not throwing TypeError"); - assertEquals("Reduce of empty array with no initial value", e.message, + assertEquals("reduce_no_initial", e.type, "reduceRight no initial TypeError type"); } assertTrue(exception); @@ -466,7 +466,7 @@ try { exception = true; assertTrue(e instanceof TypeError, "reduce sparse no initial value not throwing TypeError"); - assertEquals("Reduce of empty array with no initial value", e.message, + assertEquals("reduce_no_initial", e.type, "reduce no initial TypeError type"); } assertTrue(exception); @@ -478,7 +478,7 @@ try { exception = true; assertTrue(e instanceof TypeError, "reduceRight sparse no initial value not throwing TypeError"); - assertEquals("Reduce of empty array with no initial value", e.message, + assertEquals("reduce_no_initial", e.type, "reduceRight no initial TypeError type"); } assertTrue(exception); diff --git a/deps/v8/test/mjsunit/array-slice.js b/deps/v8/test/mjsunit/array-slice.js index ae0e3bc1ef..5ae31dc527 100644 --- a/deps/v8/test/mjsunit/array-slice.js +++ b/deps/v8/test/mjsunit/array-slice.js @@ -290,15 +290,3 @@ func('a', 'b', 'c'); })(); - -// Check slicing of holey objects with elements in the prototype -(function() { - function f() { - delete arguments[1]; - arguments.__proto__[1] = 5; - var result = Array.prototype.slice.call(arguments); - delete arguments.__proto__[1]; - assertEquals([1,5,3], result); - } - f(1,2,3); -})(); diff --git a/deps/v8/test/mjsunit/array-store-and-grow.js b/deps/v8/test/mjsunit/array-store-and-grow.js index 88f3db8f64..131d4ebc51 100644 --- a/deps/v8/test/mjsunit/array-store-and-grow.js +++ b/deps/v8/test/mjsunit/array-store-and-grow.js @@ -99,10 +99,7 @@ array_store_5(a, 1, 0.5); a = makeCOW(); array_store_5(a, 1, 0.5); assertEquals(0.5, a[1]); -a = []; -assertEquals(0.5, array_store_5(a, 1, 0.5)); -assertEquals(undefined, a[0]); -assertEquals(0.5, a[1]); +assertEquals(0.5, array_store_5([], 1, 0.5)); function array_store_6(a,b,c) { return (a[b] = c); diff --git a/deps/v8/test/mjsunit/compiler/multiply-add.js b/deps/v8/test/mjsunit/compiler/multiply-add.js deleted file mode 100644 index 2b4304e845..0000000000 --- a/deps/v8/test/mjsunit/compiler/multiply-add.js +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax -// Test expressions that can be computed with a multiply-add instruction. - -function f(a, b, c) { - return a * b + c; -} - -function g(a, b, c) { - return a + b * c; -} - -function h(a, b, c, d) { - return a * b + c * d; -} - -assertEquals(5, f(1, 2, 3)); -assertEquals(5, f(1, 2, 3)); -%OptimizeFunctionOnNextCall(f); -assertEquals(5, f(1, 2, 3)); -assertEquals("2foo", f(1, 2, "foo")); -assertEquals(5.41, f(1.1, 2.1, 3.1)); -assertEquals(5.41, f(1.1, 2.1, 3.1)); -%OptimizeFunctionOnNextCall(f); -assertEquals(5.41, f(1.1, 2.1, 3.1)); - -assertEquals(7, g(1, 2, 3)); -assertEquals(7, g(1, 2, 3)); -%OptimizeFunctionOnNextCall(g); -assertEquals(7, g(1, 2, 3)); -assertEquals(8.36, g(1.1, 2.2, 3.3)); -assertEquals(8.36, g(1.1, 2.2, 3.3)); -%OptimizeFunctionOnNextCall(g); -assertEquals(8.36, g(1.1, 2.2, 3.3)); - -assertEquals(14, h(1, 2, 3, 4)); -assertEquals(14, h(1, 2, 3, 4)); -%OptimizeFunctionOnNextCall(h); -assertEquals(14, h(1, 2, 3, 4)); -assertEquals(15.02, h(1.1, 2.1, 3.1, 4.1)); -assertEquals(15.02, h(1.1, 2.1, 3.1, 4.1)); -%OptimizeFunctionOnNextCall(h); -assertEquals(15.02, h(1.1, 2.1, 3.1, 4.1)); diff --git a/deps/v8/test/mjsunit/compiler/proto-chain-load.js b/deps/v8/test/mjsunit/compiler/proto-chain-load.js deleted file mode 100644 index 60c6431d2b..0000000000 --- a/deps/v8/test/mjsunit/compiler/proto-chain-load.js +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax - -// Test HLoadNamedField on the proto chain. - -var obj4 = Object.create(null, { f4: {value: 4} }); -var obj3 = Object.create(obj4, { f3: {value: 3} }); -var obj2 = Object.create(obj3, { f2: {value: 2} }); -var obj1 = Object.create(obj2, { f1: {value: 1} }); -var obj0 = Object.create(obj1, { f0: {value: 0} }); - -function get4(obj) { return obj.f4; } - -assertEquals(4, get4(obj0)); -assertEquals(4, get4(obj0)); -%OptimizeFunctionOnNextCall(get4); -assertEquals(4, get4(obj0)); -assertEquals(4, get4(obj0)); diff --git a/deps/v8/test/mjsunit/compiler/rotate.js b/deps/v8/test/mjsunit/compiler/rotate.js deleted file mode 100644 index 14fe9da3e6..0000000000 --- a/deps/v8/test/mjsunit/compiler/rotate.js +++ /dev/null @@ -1,224 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax --expose-gc - -// Test shift operations that can be replaced by rotate operation. - -function SideEffect() { - with ({}) { } // not inlinable -} - -function Twenty() { - SideEffect(); - return 20; -} - -function Twelve() { - SideEffect(); - return 12; -} - - -function ROR(x, sa) { - return (x >>> sa) | (x << (32 - sa)); -} - -function ROR1(x, sa) { - return (x >>> sa) | (x << (32 - sa)); -} - -function ROR2(x, sa) { - return (x >>> (32 - sa)) | (x << (sa)); -} - -function ROR3(x, sa) { - return (x << (32 - sa)) | (x >>> sa); -} - -function ROR4(x, sa) { - return (x << (sa)) | (x >>> (32 - sa)); -} - -assertEquals(1 << ((2 % 32)), ROR(1, 30)); -assertEquals(1 << ((2 % 32)), ROR(1, 30)); -%OptimizeFunctionOnNextCall(ROR); -assertEquals(1 << ((2 % 32)), ROR(1, 30)); - -assertEquals(0xF0000FFF | 0, ROR1(0x0000FFFF, 4)); -assertEquals(0xF0000FFF | 0, ROR1(0x0000FFFF, 4)); -%OptimizeFunctionOnNextCall(ROR1); -assertEquals(0xF0000FFF | 0, ROR1(0x0000FFFF, 4)); - -assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, 20)); -assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, 20)); -%OptimizeFunctionOnNextCall(ROR1); -assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, 20)); - -assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, Twenty())); -assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, Twenty())); -%OptimizeFunctionOnNextCall(ROR1); -assertEquals(0x0FFFF000 | 0, ROR1(0x0000FFFF, Twenty())); - -for (var i = 0; i <= 100; i++) { - assertEquals(0xFFFFFFFF | 0, ROR1(0xFFFFFFFF, i)); - assertEquals(0xFFFFFFFF | 0, ROR1(0xFFFFFFFF, i)); - %OptimizeFunctionOnNextCall(ROR1); - assertEquals(0xFFFFFFFF | 0, ROR1(0xFFFFFFFF, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(-1, ROR1(-1, i)); - assertEquals(-1, ROR1(-1, i)); - %OptimizeFunctionOnNextCall(ROR1); - assertEquals(-1, ROR1(-1, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(1 << (32 - (i % 32)), ROR1(1, i)); - assertEquals(1 << (32 - (i % 32)), ROR1(1, i)); - %OptimizeFunctionOnNextCall(ROR1); - assertEquals(1 << (32 - (i % 32)), ROR1(1, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(1 << (32 - (i % 32)), ROR1(1.4, i)); - assertEquals(1 << (32 - (i % 32)), ROR1(1.4, i)); - %OptimizeFunctionOnNextCall(ROR1); - assertEquals(1 << (32 - (i % 32)), ROR1(1.4, i)); -} - - - -assertEquals(0xF0000FFF | 0, ROR2(0x0000FFFF, 28)); -assertEquals(0xF0000FFF | 0, ROR2(0x0000FFFF, 28)); -%OptimizeFunctionOnNextCall(ROR2); -assertEquals(0xF0000FFF | 0, ROR2(0x0000FFFF, 28)); - -assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, 12)); -assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, 12)); -%OptimizeFunctionOnNextCall(ROR2); -assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, 12)); - -assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, Twelve())); -assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, Twelve())); -%OptimizeFunctionOnNextCall(ROR2); -assertEquals(0x0FFFF000 | 0, ROR2(0x0000FFFF, Twelve())); - -for (var i = 0; i <= 100; i++) { - assertEquals(0xFFFFFFFF | 0, ROR2(0xFFFFFFFF, i)); - assertEquals(0xFFFFFFFF | 0, ROR2(0xFFFFFFFF, i)); - %OptimizeFunctionOnNextCall(ROR2); - assertEquals(0xFFFFFFFF | 0, ROR2(0xFFFFFFFF, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(-1, ROR2(-1, i)); - assertEquals(-1, ROR2(-1, i)); - %OptimizeFunctionOnNextCall(ROR2); - assertEquals(-1, ROR2(-1, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(1 << ((i % 32)), ROR2(1, i)); - assertEquals(1 << ((i % 32)), ROR2(1, i)); - %OptimizeFunctionOnNextCall(ROR2); - assertEquals(1 << ((i % 32)), ROR2(1, i)); -} - -assertEquals(0xF0000FFF | 0, ROR3(0x0000FFFF, 4)); -assertEquals(0xF0000FFF | 0, ROR3(0x0000FFFF, 4)); -%OptimizeFunctionOnNextCall(ROR3); -assertEquals(0xF0000FFF | 0, ROR3(0x0000FFFF, 4)); - -assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, 20)); -assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, 20)); -%OptimizeFunctionOnNextCall(ROR3); -assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, 20)); - -assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, Twenty())); -assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, Twenty())); -%OptimizeFunctionOnNextCall(ROR3); -assertEquals(0x0FFFF000 | 0, ROR3(0x0000FFFF, Twenty())); - -for (var i = 0; i <= 100; i++) { - assertEquals(0xFFFFFFFF | 0, ROR3(0xFFFFFFFF, i)); - assertEquals(0xFFFFFFFF | 0, ROR3(0xFFFFFFFF, i)); - %OptimizeFunctionOnNextCall(ROR3); - assertEquals(0xFFFFFFFF | 0, ROR3(0xFFFFFFFF, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(-1, ROR3(-1, i)); - assertEquals(-1, ROR3(-1, i)); - %OptimizeFunctionOnNextCall(ROR3); - assertEquals(-1, ROR3(-1, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(1 << (32 - (i % 32)), ROR3(1, i)); - assertEquals(1 << (32 - (i % 32)), ROR3(1, i)); - %OptimizeFunctionOnNextCall(ROR3); - assertEquals(1 << (32 - (i % 32)), ROR3(1, i)); -} - -assertEquals(0xF0000FFF | 0, ROR4(0x0000FFFF, 28)); -assertEquals(0xF0000FFF | 0, ROR4(0x0000FFFF, 28)); -%OptimizeFunctionOnNextCall(ROR4); -assertEquals(0xF0000FFF | 0, ROR4(0x0000FFFF, 28)); - -assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, 12)); -assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, 12)); -%OptimizeFunctionOnNextCall(ROR4); -assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, 12)); - -assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, Twelve())); -assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, Twelve())); -%OptimizeFunctionOnNextCall(ROR4); -assertEquals(0x0FFFF000 | 0, ROR4(0x0000FFFF, Twelve())); - -for (var i = 0; i <= 100; i++) { - assertEquals(0xFFFFFFFF | 0, ROR4(0xFFFFFFFF, i)); - assertEquals(0xFFFFFFFF | 0, ROR4(0xFFFFFFFF, i)); - %OptimizeFunctionOnNextCall(ROR4); - assertEquals(0xFFFFFFFF | 0, ROR4(0xFFFFFFFF, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(-1, ROR4(-1, i)); - assertEquals(-1, ROR4(-1, i)); - %OptimizeFunctionOnNextCall(ROR4); - assertEquals(-1, ROR4(-1, i)); -} - -for (var i = 0; i <= 100; i++) { - assertEquals(1 << ((i % 32)), ROR4(1, i)); - assertEquals(1 << ((i % 32)), ROR4(1, i)); - %OptimizeFunctionOnNextCall(ROR4); - assertEquals(1 << ((i % 32)), ROR4(1, i)); -} - diff --git a/deps/v8/test/mjsunit/debug-liveedit-compile-error.js b/deps/v8/test/mjsunit/debug-liveedit-compile-error.js deleted file mode 100644 index 2fd6aedabf..0000000000 --- a/deps/v8/test/mjsunit/debug-liveedit-compile-error.js +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2012 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. - -// Flags: --expose-debug-as debug -// Get the Debug object exposed from the debug context global object. - -Debug = debug.Debug - -eval("var something1 = 25; \n" - + " function ChooseAnimal() { return 'Cat'; } \n" - + " ChooseAnimal.Helper = function() { return 'Help!'; }\n"); - -assertEquals("Cat", ChooseAnimal()); - -var script = Debug.findScript(ChooseAnimal); - -var orig_animal = "Cat"; -var patch_pos = script.source.indexOf(orig_animal); -var new_animal_patch = "Cap' + ) + 'bara"; - -var change_log = new Array(); -var caught_exception = null; -try { - Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, - orig_animal.length, new_animal_patch, change_log); -} catch (e) { - caught_exception = e; -} - -assertNotNull(caught_exception); -assertEquals("Unexpected token )", - caught_exception.details.syntaxErrorMessage); - -assertEquals(2, caught_exception.details.position.start.line); - - diff --git a/deps/v8/test/mjsunit/debug-liveedit-literals.js b/deps/v8/test/mjsunit/debug-liveedit-literals.js deleted file mode 100644 index 5f9217e833..0000000000 --- a/deps/v8/test/mjsunit/debug-liveedit-literals.js +++ /dev/null @@ -1,94 +0,0 @@ -// 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. - -// Flags: --expose-debug-as debug -// Get the Debug object exposed from the debug context global object. - -Debug = debug.Debug - -function Test(old_expression, new_expression) { - // Generate several instances of function to test that we correctly fix - // all functions in memory. - var function_instance_number = 11; - eval("var t1 =1;\n" + - "ChooseAnimalArray = [];\n" + - "for (var i = 0; i < function_instance_number; i++) {\n" + - " ChooseAnimalArray.push(\n" + - " function ChooseAnimal() {\n" + - " return " + old_expression + ";\n" + - " });\n" + - "}\n" + - "var t2 =1;\n"); - - for (var i = 0; i < ChooseAnimalArray.length; i++) { - assertEquals("Cat", ChooseAnimalArray[i]()); - } - - var script = Debug.findScript(ChooseAnimalArray[0]); - - var patch_pos = script.source.indexOf(old_expression); - var new_animal_patch = new_expression; - - var change_log = new Array(); - Debug.LiveEdit.TestApi.ApplySingleChunkPatch(script, patch_pos, - old_expression.length, new_expression, change_log); - - for (var i = 0; i < ChooseAnimalArray.length; i++) { - assertEquals("Capybara", ChooseAnimalArray[i]()); - } -} - -// Check that old literal boilerplate was reset. -Test("['Cat'][0]", "['Capybara'][0]"); -Test("['Cat'][0]", "{a:'Capybara'}.a"); - -// No literals -> 1 literal. -Test("'Cat'", "['Capybara'][0]"); - -// No literals -> 2 literals. -Test("'Cat'", "['Capy'][0] + {a:'bara'}.a"); - -// 1 literal -> no literals. -Test("['Cat'][0]", "'Capybara'"); - -// 2 literals -> no literals. -Test("['Ca'][0] + {a:'t'}.a", "'Capybara'"); - -// No literals -> regexp. -Test("'Cat'", "(/.A.Y.A.A/i).exec('Capybara')[0]"); - -// Array literal -> regexp. -Test("['Cat'][0]", "(/.A.Y.A.A/i).exec('Capybara')[0]"); - -// Regexp -> object literal. -Test("(/.A./i).exec('Cat')[0]", "{c:'Capybara'}.c"); - -// No literals -> regexp. -Test("'Cat'", "(/.A.Y.A.A/i).exec('Capybara')[0]"); - -// Regexp -> no literals. -Test("(/.A./i).exec('Cat')[0]", "'Capybara'"); diff --git a/deps/v8/test/mjsunit/debug-set-variable-value.js b/deps/v8/test/mjsunit/debug-set-variable-value.js deleted file mode 100644 index dac8861456..0000000000 --- a/deps/v8/test/mjsunit/debug-set-variable-value.js +++ /dev/null @@ -1,176 +0,0 @@ -// Copyright 2012 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. - -// Flags: --expose-debug-as debug - -// Get the Debug object exposed from the debug context global object. -var Debug = debug.Debug; - -// Accepts a function/closure 'fun' that must have a debugger statement inside. -// A variable 'variable_name' must be initialized before debugger statement -// and returned after the statement. The test will alter variable value when -// on debugger statement and check that returned value reflects the change. -function RunPauseTest(scope_number, variable_name, expected_new_value, fun) { - var old_value = fun(); - - var listener_delegate; - var listener_called = false; - var exception = null; - - function listener_delegate(exec_state) { - var scope = exec_state.frame(0).scope(scope_number); - scope.setVariableValue(variable_name, expected_new_value); - } - - function listener(event, exec_state, event_data, data) { - try { - if (event == Debug.DebugEvent.Break) { - listener_called = true; - listener_delegate(exec_state); - } - } catch (e) { - exception = e; - } - } - - // Add the debug event listener. - Debug.setListener(listener); - - var actual_new_value; - try { - actual_new_value = fun(); - } finally { - Debug.setListener(null); - } - - if (exception != null) { - assertUnreachable("Exception: " + exception); - } - assertTrue(listener_called); - - assertTrue(old_value != actual_new_value); - assertTrue(expected_new_value == actual_new_value); -} - -// Accepts a closure 'fun' that returns a variable from it's outer scope. -// The test changes the value of variable via the handle to function and checks -// that the return value changed accordingly. -function RunClosureTest(scope_number, variable_name, expected_new_value, fun) { - var old_value = fun(); - - var fun_mirror = Debug.MakeMirror(fun); - - var scope = fun_mirror.scope(scope_number); - scope.setVariableValue(variable_name, expected_new_value); - - var actual_new_value = fun(); - - assertTrue(old_value != actual_new_value); - assertTrue(expected_new_value == actual_new_value); -} - -// Test changing variable value when in pause -RunPauseTest(1, 'v1', 5, (function Factory() { - var v1 = 'cat'; - return function() { - debugger; - return v1; - } -})()); - -RunPauseTest(1, 'v2', 11, (function Factory(v2) { - return function() { - debugger; - return v2; - } -})('dog')); - -RunPauseTest(3, 'foo', 77, (function Factory() { - var foo = "capybara"; - return (function() { - var bar = "fish"; - try { - throw {name: "test exception"}; - } catch (e) { - return function() { - debugger; - bar = "beast"; - return foo; - } - } - })(); -})()); - - - -// Test changing variable value in closure by handle -RunClosureTest(0, 'v1', 5, (function Factory() { - var v1 = 'cat'; - return function() { - return v1; - } -})()); - -RunClosureTest(0, 'v2', 11, (function Factory(v2) { - return function() { - return v2; - } -})('dog')); - -RunClosureTest(2, 'foo', 77, (function Factory() { - var foo = "capybara"; - return (function() { - var bar = "fish"; - try { - throw {name: "test exception"}; - } catch (e) { - return function() { - bar = "beast"; - return foo; - } - } - })(); -})()); - - -// Test value description protocol JSON -assertEquals(true, Debug.TestApi.CommandProcessorResolveValue({value: true})); - -assertSame(null, Debug.TestApi.CommandProcessorResolveValue({type: "null"})); -assertSame(undefined, - Debug.TestApi.CommandProcessorResolveValue({type: "undefined"})); - -assertSame("123", Debug.TestApi.CommandProcessorResolveValue( - {type: "string", stringDescription: "123"})); -assertSame(123, Debug.TestApi.CommandProcessorResolveValue( - {type: "number", stringDescription: "123"})); - -assertSame(Number, Debug.TestApi.CommandProcessorResolveValue( - {handle: Debug.MakeMirror(Number).handle()})); -assertSame(RunClosureTest, Debug.TestApi.CommandProcessorResolveValue( - {handle: Debug.MakeMirror(RunClosureTest).handle()})); - diff --git a/deps/v8/test/mjsunit/elements-kind.js b/deps/v8/test/mjsunit/elements-kind.js index cf9c21605d..b74a212437 100644 --- a/deps/v8/test/mjsunit/elements-kind.js +++ b/deps/v8/test/mjsunit/elements-kind.js @@ -321,7 +321,8 @@ if (support_smi_only_arrays) { assertKind(elements_kind.fast_double, b); var c = a.concat(b); assertEquals([1, 2, 4.5, 5.5], c); - assertKind(elements_kind.fast_double, c); + // TODO(1810): Change implementation so that we get DOUBLE elements here? + assertKind(elements_kind.fast, c); } // Test that Array.push() correctly handles SMI elements. diff --git a/deps/v8/test/mjsunit/elements-length-no-holey.js b/deps/v8/test/mjsunit/elements-length-no-holey.js deleted file mode 100644 index 5bac296e1a..0000000000 --- a/deps/v8/test/mjsunit/elements-length-no-holey.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax - -a = [1,2,3]; -a.length = 1; -assertFalse(%HasFastHoleyElements(a)); -assertTrue(%HasFastSmiElements(a)); diff --git a/deps/v8/test/mjsunit/error-accessors.js b/deps/v8/test/mjsunit/error-accessors.js deleted file mode 100644 index 9581050240..0000000000 --- a/deps/v8/test/mjsunit/error-accessors.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2012 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. - -// Test that the message property of error objects is a data property. - -var o; - -// message is constructed using the constructor. -var error1 = new Error("custom message"); -o = {}; -o.__proto__ = error1; - -assertEquals("custom message", - Object.getOwnPropertyDescriptor(error1, "message").value); -o.message = "another message"; -assertEquals("another message", o.message); -assertEquals("custom message", error1.message); - -// message is constructed by the runtime. -var error2; -try { x.x } catch (e) { error2 = e; } -o = {}; -o.__proto__ = error2; - -assertEquals("x is not defined", - Object.getOwnPropertyDescriptor(error2, "message").value); -o.message = "another message"; -assertEquals("another message", o.message); -assertEquals("x is not defined", error2.message); - diff --git a/deps/v8/test/mjsunit/error-constructors.js b/deps/v8/test/mjsunit/error-constructors.js index 84c6bbfd0c..107164df56 100644 --- a/deps/v8/test/mjsunit/error-constructors.js +++ b/deps/v8/test/mjsunit/error-constructors.js @@ -36,6 +36,10 @@ assertFalse(desc['enumerable']); var e = new Error("foobar"); desc = Object.getOwnPropertyDescriptor(e, 'message'); assertFalse(desc['enumerable']); +desc = Object.getOwnPropertyDescriptor(e, 'arguments'); +assertFalse(desc['enumerable']); +desc = Object.getOwnPropertyDescriptor(e, 'type'); +assertFalse(desc['enumerable']); desc = Object.getOwnPropertyDescriptor(e, 'stack'); assertFalse(desc['enumerable']); @@ -53,17 +57,26 @@ for (var v in e) { function fail() { assertUnreachable(); }; ReferenceError.prototype.__defineSetter__('name', fail); ReferenceError.prototype.__defineSetter__('message', fail); +ReferenceError.prototype.__defineSetter__('type', fail); +ReferenceError.prototype.__defineSetter__('arguments', fail); ReferenceError.prototype.__defineSetter__('stack', fail); var e = new ReferenceError(); assertTrue(e.hasOwnProperty('stack')); +assertTrue(e.hasOwnProperty('type')); +assertTrue(e.hasOwnProperty('arguments')); var e = new ReferenceError('123'); assertTrue(e.hasOwnProperty('message')); assertTrue(e.hasOwnProperty('stack')); +assertTrue(e.hasOwnProperty('type')); +assertTrue(e.hasOwnProperty('arguments')); var e = %MakeReferenceError("my_test_error", [0, 1]); assertTrue(e.hasOwnProperty('stack')); +assertTrue(e.hasOwnProperty('type')); +assertTrue(e.hasOwnProperty('arguments')); +assertEquals("my_test_error", e.type) // Check that intercepting property access from toString is prevented for // compiler errors. This is not specified, but allowing interception @@ -73,7 +86,7 @@ var errors = [SyntaxError, ReferenceError, TypeError]; for (var i in errors) { var name = errors[i].prototype.toString(); // Monkey-patch prototype. - var props = ["name", "message", "stack"]; + var props = ["name", "message", "type", "arguments", "stack"]; for (var j in props) { errors[i].prototype.__defineGetter__(props[j], fail); } diff --git a/deps/v8/test/mjsunit/function-call.js b/deps/v8/test/mjsunit/function-call.js index 92792ac827..26890ed113 100644 --- a/deps/v8/test/mjsunit/function-call.js +++ b/deps/v8/test/mjsunit/function-call.js @@ -67,7 +67,8 @@ var should_throw_on_null_and_undefined = String.prototype.toLocaleLowerCase, String.prototype.toUpperCase, String.prototype.toLocaleUpperCase, - String.prototype.trim]; + String.prototype.trim, + Number.prototype.toLocaleString]; // Non generic natives do not work on any input other than the specific // type, but since this change will allow call to be invoked with undefined @@ -149,11 +150,6 @@ var reducing_functions = [Array.prototype.reduce, Array.prototype.reduceRight]; -function checkExpectedMessage(e) { - assertTrue(e.message.indexOf("called on null or undefined") >= 0 || - e.message.indexOf("Cannot convert null to object") >= 0); -} - // Test that all natives using the ToObject call throw the right exception. for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) { // Sanity check that all functions are correct @@ -170,7 +166,8 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) { should_throw_on_null_and_undefined[i].call(null); } catch (e) { exception = true; - checkExpectedMessage(e); + assertTrue("called_on_null_or_undefined" == e.type || + "null_to_object" == e.type); } assertTrue(exception); @@ -179,7 +176,8 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) { should_throw_on_null_and_undefined[i].call(undefined); } catch (e) { exception = true; - checkExpectedMessage(e); + assertTrue("called_on_null_or_undefined" == e.type || + "null_to_object" == e.type); } assertTrue(exception); @@ -188,7 +186,8 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) { should_throw_on_null_and_undefined[i].apply(null); } catch (e) { exception = true; - checkExpectedMessage(e); + assertTrue("called_on_null_or_undefined" == e.type || + "null_to_object" == e.type); } assertTrue(exception); @@ -197,7 +196,8 @@ for (var i = 0; i < should_throw_on_null_and_undefined.length; i++) { should_throw_on_null_and_undefined[i].apply(undefined); } catch (e) { exception = true; - checkExpectedMessage(e); + assertTrue("called_on_null_or_undefined" == e.type || + "null_to_object" == e.type); } assertTrue(exception); } @@ -257,7 +257,8 @@ for (var j = 0; j < mapping_functions.length; j++) { null); } catch (e) { exception = true; - checkExpectedMessage(e); + assertTrue("called_on_null_or_undefined" == e.type || + "null_to_object" == e.type); } assertTrue(exception); @@ -268,7 +269,8 @@ for (var j = 0; j < mapping_functions.length; j++) { undefined); } catch (e) { exception = true; - checkExpectedMessage(e); + assertTrue("called_on_null_or_undefined" == e.type || + "null_to_object" == e.type); } assertTrue(exception); } @@ -309,7 +311,8 @@ for (var j = 0; j < reducing_functions.length; j++) { reducing_functions[j].call(array, should_throw_on_null_and_undefined[i]); } catch (e) { exception = true; - checkExpectedMessage(e); + assertTrue("called_on_null_or_undefined" == e.type || + "null_to_object" == e.type); } assertTrue(exception); @@ -318,7 +321,8 @@ for (var j = 0; j < reducing_functions.length; j++) { reducing_functions[j].call(array, should_throw_on_null_and_undefined[i]); } catch (e) { exception = true; - checkExpectedMessage(e); + assertTrue("called_on_null_or_undefined" == e.type || + "null_to_object" == e.type); } assertTrue(exception); } diff --git a/deps/v8/test/mjsunit/fuzz-natives-part1.js b/deps/v8/test/mjsunit/fuzz-natives-part1.js index 87f7d0d766..6941d806cc 100644 --- a/deps/v8/test/mjsunit/fuzz-natives-part1.js +++ b/deps/v8/test/mjsunit/fuzz-natives-part1.js @@ -147,7 +147,6 @@ var knownProblems = { "PushWithContext": true, "PushCatchContext": true, "PushBlockContext": true, - "PushModuleContext": true, "LazyCompile": true, "LazyRecompile": true, "ParallelRecompile": true, @@ -196,13 +195,7 @@ var knownProblems = { // Only applicable to strings. "_HasCachedArrayIndex": true, - "_GetCachedArrayIndex": true, - "_OneByteSeqStringSetChar": true, - "_TwoByteSeqStringSetChar": true, - - // Only for debugging parallel recompilation. - "InstallRecompiledCode": true, - "ForceParallelRecompile": true + "_GetCachedArrayIndex": true }; var currentlyUncallable = { diff --git a/deps/v8/test/mjsunit/fuzz-natives-part2.js b/deps/v8/test/mjsunit/fuzz-natives-part2.js index 2faad1dcac..ea8a2cfe1d 100644 --- a/deps/v8/test/mjsunit/fuzz-natives-part2.js +++ b/deps/v8/test/mjsunit/fuzz-natives-part2.js @@ -147,7 +147,6 @@ var knownProblems = { "PushWithContext": true, "PushCatchContext": true, "PushBlockContext": true, - "PushModuleContext": true, "LazyCompile": true, "LazyRecompile": true, "ParallelRecompile": true, @@ -196,13 +195,7 @@ var knownProblems = { // Only applicable to strings. "_HasCachedArrayIndex": true, - "_GetCachedArrayIndex": true, - "_OneByteSeqStringSetChar": true, - "_TwoByteSeqStringSetChar": true, - - // Only for debugging parallel recompilation. - "InstallRecompiledCode": true, - "ForceParallelRecompile": true + "_GetCachedArrayIndex": true }; var currentlyUncallable = { diff --git a/deps/v8/test/mjsunit/fuzz-natives-part3.js b/deps/v8/test/mjsunit/fuzz-natives-part3.js index ed71d332a0..ecfdf9737d 100644 --- a/deps/v8/test/mjsunit/fuzz-natives-part3.js +++ b/deps/v8/test/mjsunit/fuzz-natives-part3.js @@ -147,7 +147,6 @@ var knownProblems = { "PushWithContext": true, "PushCatchContext": true, "PushBlockContext": true, - "PushModuleContext": true, "LazyCompile": true, "LazyRecompile": true, "ParallelRecompile": true, @@ -196,13 +195,7 @@ var knownProblems = { // Only applicable to strings. "_HasCachedArrayIndex": true, - "_GetCachedArrayIndex": true, - "_OneByteSeqStringSetChar": true, - "_TwoByteSeqStringSetChar": true, - - // Only for debugging parallel recompilation. - "InstallRecompiledCode": true, - "ForceParallelRecompile": true + "_GetCachedArrayIndex": true }; var currentlyUncallable = { diff --git a/deps/v8/test/mjsunit/fuzz-natives-part4.js b/deps/v8/test/mjsunit/fuzz-natives-part4.js index 1b128d5942..da045963f0 100644 --- a/deps/v8/test/mjsunit/fuzz-natives-part4.js +++ b/deps/v8/test/mjsunit/fuzz-natives-part4.js @@ -147,7 +147,6 @@ var knownProblems = { "PushWithContext": true, "PushCatchContext": true, "PushBlockContext": true, - "PushModuleContext": true, "LazyCompile": true, "LazyRecompile": true, "ParallelRecompile": true, @@ -196,13 +195,7 @@ var knownProblems = { // Only applicable to strings. "_HasCachedArrayIndex": true, - "_GetCachedArrayIndex": true, - "_OneByteSeqStringSetChar": true, - "_TwoByteSeqStringSetChar": true, - - // Only for debugging parallel recompilation. - "InstallRecompiledCode": true, - "ForceParallelRecompile": true + "_GetCachedArrayIndex": true }; var currentlyUncallable = { diff --git a/deps/v8/test/mjsunit/harmony/collections.js b/deps/v8/test/mjsunit/harmony/collections.js index 0219f39364..f3db7ea2b7 100644 --- a/deps/v8/test/mjsunit/harmony/collections.js +++ b/deps/v8/test/mjsunit/harmony/collections.js @@ -313,60 +313,4 @@ TestBogusReceivers(bogusReceiversTestSet); // Stress Test // There is a proposed stress-test available at the es-discuss mailing list // which cannot be reasonably automated. Check it out by hand if you like: -// https://mail.mozilla.org/pipermail/es-discuss/2011-May/014096.html - - -// Set and Map size getters -var setSizeDescriptor = Object.getOwnPropertyDescriptor(Set.prototype, 'size'); -assertEquals(undefined, setSizeDescriptor.value); -assertEquals(undefined, setSizeDescriptor.set); -assertTrue(setSizeDescriptor.get instanceof Function); -assertEquals(undefined, setSizeDescriptor.get.prototype); -assertFalse(setSizeDescriptor.enumerable); -assertTrue(setSizeDescriptor.configurable); - -var s = new Set(); -assertFalse(s.hasOwnProperty('size')); -for (var i = 0; i < 10; i++) { - assertEquals(i, s.size); - s.add(i); -} -for (var i = 9; i >= 0; i--) { - s.delete(i); - assertEquals(i, s.size); -} - - -var mapSizeDescriptor = Object.getOwnPropertyDescriptor(Map.prototype, 'size'); -assertEquals(undefined, mapSizeDescriptor.value); -assertEquals(undefined, mapSizeDescriptor.set); -assertTrue(mapSizeDescriptor.get instanceof Function); -assertEquals(undefined, mapSizeDescriptor.get.prototype); -assertFalse(mapSizeDescriptor.enumerable); -assertTrue(mapSizeDescriptor.configurable); - -var m = new Map(); -assertFalse(m.hasOwnProperty('size')); -for (var i = 0; i < 10; i++) { - assertEquals(i, m.size); - m.set(i, i); -} -for (var i = 9; i >= 0; i--) { - m.delete(i); - assertEquals(i, m.size); -} - -// Test clear -var a = new Set(); -s.add(42); -assertTrue(s.has(42)); -s.clear(); -assertFalse(s.has(42)); -assertEquals(0, s.size); - -var m = new Map(); -m.set(42, true); -assertTrue(m.has(42)); -m.clear(); -assertFalse(m.has(42)); -assertEquals(0, m.size); +// https://mail.mozilla.org/pipermail/es-discuss/2011-May/014096.html
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/harmony/module-linking.js b/deps/v8/test/mjsunit/harmony/module-linking.js index 3c0f18c37d..a4b272f468 100644 --- a/deps/v8/test/mjsunit/harmony/module-linking.js +++ b/deps/v8/test/mjsunit/harmony/module-linking.js @@ -112,7 +112,7 @@ module R { assertThrows(function() { eval("c = -1") }, SyntaxError) assertThrows(function() { R.c = -2 }, TypeError) - // Initialize first bunch of variables. + // Initialize first bunch or variables. export var v = 1 export let l = 2 export const c = 3 diff --git a/deps/v8/test/mjsunit/harmony/object-observe.js b/deps/v8/test/mjsunit/harmony/object-observe.js deleted file mode 100644 index 04dfb967b3..0000000000 --- a/deps/v8/test/mjsunit/harmony/object-observe.js +++ /dev/null @@ -1,873 +0,0 @@ -// Copyright 2012 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. - -// Flags: --harmony-observation --harmony-proxies --harmony-collections - -var allObservers = []; -function reset() { - allObservers.forEach(function(observer) { observer.reset(); }); -} - -function stringifyNoThrow(arg) { - try { - return JSON.stringify(arg); - } catch (e) { - return '{<circular reference>}'; - } -} - -function createObserver() { - "use strict"; // So that |this| in callback can be undefined. - - var observer = { - records: undefined, - callbackCount: 0, - reset: function() { - this.records = undefined; - this.callbackCount = 0; - }, - assertNotCalled: function() { - assertEquals(undefined, this.records); - assertEquals(0, this.callbackCount); - }, - assertCalled: function() { - assertEquals(1, this.callbackCount); - }, - assertRecordCount: function(count) { - this.assertCalled(); - assertEquals(count, this.records.length); - }, - assertCallbackRecords: function(recs) { - this.assertRecordCount(recs.length); - for (var i = 0; i < recs.length; i++) { - if ('name' in recs[i]) - recs[i].name = String(recs[i].name); - print(i, stringifyNoThrow(this.records[i]), stringifyNoThrow(recs[i])); - assertSame(this.records[i].object, recs[i].object); - assertEquals('string', typeof recs[i].type); - assertPropertiesEqual(this.records[i], recs[i]); - } - } - }; - - observer.callback = function(r) { - assertEquals(undefined, this); - assertEquals('object', typeof r); - assertTrue(r instanceof Array) - observer.records = r; - observer.callbackCount++; - }; - - observer.reset(); - allObservers.push(observer); - return observer; -} - -var observer = createObserver(); -assertEquals("function", typeof observer.callback); -var obj = {}; - -function frozenFunction() {} -Object.freeze(frozenFunction); -var nonFunction = {}; -var changeRecordWithAccessor = { type: 'foo' }; -var recordCreated = false; -Object.defineProperty(changeRecordWithAccessor, 'name', { - get: function() { - recordCreated = true; - return "bar"; - }, - enumerable: true -}) - -// Object.observe -assertThrows(function() { Object.observe("non-object", observer.callback); }, TypeError); -assertThrows(function() { Object.observe(obj, nonFunction); }, TypeError); -assertThrows(function() { Object.observe(obj, frozenFunction); }, TypeError); -assertEquals(obj, Object.observe(obj, observer.callback)); - -// Object.unobserve -assertThrows(function() { Object.unobserve(4, observer.callback); }, TypeError); -assertThrows(function() { Object.unobserve(obj, nonFunction); }, TypeError); -assertEquals(obj, Object.unobserve(obj, observer.callback)); - -// Object.getNotifier -var notifier = Object.getNotifier(obj); -assertSame(notifier, Object.getNotifier(obj)); -assertEquals(null, Object.getNotifier(Object.freeze({}))); -assertFalse(notifier.hasOwnProperty('notify')); -assertEquals([], Object.keys(notifier)); -var notifyDesc = Object.getOwnPropertyDescriptor(notifier.__proto__, 'notify'); -assertTrue(notifyDesc.configurable); -assertTrue(notifyDesc.writable); -assertFalse(notifyDesc.enumerable); -assertThrows(function() { notifier.notify({}); }, TypeError); -assertThrows(function() { notifier.notify({ type: 4 }); }, TypeError); -var notify = notifier.notify; -assertThrows(function() { notify.call(undefined, { type: 'a' }); }, TypeError); -assertThrows(function() { notify.call(null, { type: 'a' }); }, TypeError); -assertThrows(function() { notify.call(5, { type: 'a' }); }, TypeError); -assertThrows(function() { notify.call('hello', { type: 'a' }); }, TypeError); -assertThrows(function() { notify.call(false, { type: 'a' }); }, TypeError); -assertThrows(function() { notify.call({}, { type: 'a' }); }, TypeError); -assertFalse(recordCreated); -notifier.notify(changeRecordWithAccessor); -assertFalse(recordCreated); // not observed yet - -// Object.deliverChangeRecords -assertThrows(function() { Object.deliverChangeRecords(nonFunction); }, TypeError); - -Object.observe(obj, observer.callback); - -// notify uses to [[CreateOwnProperty]] to create changeRecord; -reset(); -var protoExpandoAccessed = false; -Object.defineProperty(Object.prototype, 'protoExpando', - { - configurable: true, - set: function() { protoExpandoAccessed = true; } - } -); -notifier.notify({ type: 'foo', protoExpando: 'val'}); -assertFalse(protoExpandoAccessed); -delete Object.prototype.protoExpando; -Object.deliverChangeRecords(observer.callback); - -// Multiple records are delivered. -reset(); -notifier.notify({ - type: 'updated', - name: 'foo', - expando: 1 -}); - -notifier.notify({ - object: notifier, // object property is ignored - type: 'deleted', - name: 'bar', - expando2: 'str' -}); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: obj, name: 'foo', type: 'updated', expando: 1 }, - { object: obj, name: 'bar', type: 'deleted', expando2: 'str' } -]); - -// No delivery takes place if no records are pending -reset(); -Object.deliverChangeRecords(observer.callback); -observer.assertNotCalled(); - -// Multiple observation has no effect. -reset(); -Object.observe(obj, observer.callback); -Object.observe(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', -}); -Object.deliverChangeRecords(observer.callback); -observer.assertCalled(); - -// Observation can be stopped. -reset(); -Object.unobserve(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', -}); -Object.deliverChangeRecords(observer.callback); -observer.assertNotCalled(); - -// Multiple unobservation has no effect -reset(); -Object.unobserve(obj, observer.callback); -Object.unobserve(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', -}); -Object.deliverChangeRecords(observer.callback); -observer.assertNotCalled(); - -// Re-observation works and only includes changeRecords after of call. -reset(); -Object.getNotifier(obj).notify({ - type: 'foo', -}); -Object.observe(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', -}); -records = undefined; -Object.deliverChangeRecords(observer.callback); -observer.assertRecordCount(1); - -// Observing a continuous stream of changes, while itermittantly unobserving. -reset(); -Object.observe(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', - val: 1 -}); - -Object.unobserve(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', - val: 2 -}); - -Object.observe(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', - val: 3 -}); - -Object.unobserve(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', - val: 4 -}); - -Object.observe(obj, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo', - val: 5 -}); - -Object.unobserve(obj, observer.callback); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: obj, type: 'foo', val: 1 }, - { object: obj, type: 'foo', val: 3 }, - { object: obj, type: 'foo', val: 5 } -]); - -// Observing multiple objects; records appear in order. -reset(); -var obj2 = {}; -var obj3 = {} -Object.observe(obj, observer.callback); -Object.observe(obj3, observer.callback); -Object.observe(obj2, observer.callback); -Object.getNotifier(obj).notify({ - type: 'foo1', -}); -Object.getNotifier(obj2).notify({ - type: 'foo2', -}); -Object.getNotifier(obj3).notify({ - type: 'foo3', -}); -Object.observe(obj3, observer.callback); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: obj, type: 'foo1' }, - { object: obj2, type: 'foo2' }, - { object: obj3, type: 'foo3' } -]); - -// Observing named properties. -reset(); -var obj = {a: 1} -Object.observe(obj, observer.callback); -obj.a = 2; -obj["a"] = 3; -delete obj.a; -obj.a = 4; -obj.a = 4; // ignored -obj.a = 5; -Object.defineProperty(obj, "a", {value: 6}); -Object.defineProperty(obj, "a", {writable: false}); -obj.a = 7; // ignored -Object.defineProperty(obj, "a", {value: 8}); -Object.defineProperty(obj, "a", {value: 7, writable: true}); -Object.defineProperty(obj, "a", {get: function() {}}); -Object.defineProperty(obj, "a", {get: frozenFunction}); -Object.defineProperty(obj, "a", {get: frozenFunction}); // ignored -Object.defineProperty(obj, "a", {get: frozenFunction, set: frozenFunction}); -Object.defineProperty(obj, "a", {set: frozenFunction}); // ignored -Object.defineProperty(obj, "a", {get: undefined, set: frozenFunction}); -delete obj.a; -delete obj.a; -Object.defineProperty(obj, "a", {get: function() {}, configurable: true}); -Object.defineProperty(obj, "a", {value: 9, writable: true}); -obj.a = 10; -delete obj.a; -Object.defineProperty(obj, "a", {value: 11, configurable: true}); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: obj, name: "a", type: "updated", oldValue: 1 }, - { object: obj, name: "a", type: "updated", oldValue: 2 }, - { object: obj, name: "a", type: "deleted", oldValue: 3 }, - { object: obj, name: "a", type: "new" }, - { object: obj, name: "a", type: "updated", oldValue: 4 }, - { object: obj, name: "a", type: "updated", oldValue: 5 }, - { object: obj, name: "a", type: "reconfigured", oldValue: 6 }, - { object: obj, name: "a", type: "updated", oldValue: 6 }, - { object: obj, name: "a", type: "reconfigured", oldValue: 8 }, - { object: obj, name: "a", type: "reconfigured", oldValue: 7 }, - { object: obj, name: "a", type: "reconfigured" }, - { object: obj, name: "a", type: "reconfigured" }, - { object: obj, name: "a", type: "reconfigured" }, - { object: obj, name: "a", type: "deleted" }, - { object: obj, name: "a", type: "new" }, - { object: obj, name: "a", type: "reconfigured" }, - { object: obj, name: "a", type: "updated", oldValue: 9 }, - { object: obj, name: "a", type: "deleted", oldValue: 10 }, - { object: obj, name: "a", type: "new" }, -]); - -// Observing indexed properties. -reset(); -var obj = {'1': 1} -Object.observe(obj, observer.callback); -obj[1] = 2; -obj[1] = 3; -delete obj[1]; -obj[1] = 4; -obj[1] = 4; // ignored -obj[1] = 5; -Object.defineProperty(obj, "1", {value: 6}); -Object.defineProperty(obj, "1", {writable: false}); -obj[1] = 7; // ignored -Object.defineProperty(obj, "1", {value: 8}); -Object.defineProperty(obj, "1", {value: 7, writable: true}); -Object.defineProperty(obj, "1", {get: function() {}}); -Object.defineProperty(obj, "1", {get: frozenFunction}); -Object.defineProperty(obj, "1", {get: frozenFunction}); // ignored -Object.defineProperty(obj, "1", {get: frozenFunction, set: frozenFunction}); -Object.defineProperty(obj, "1", {set: frozenFunction}); // ignored -Object.defineProperty(obj, "1", {get: undefined, set: frozenFunction}); -delete obj[1]; -delete obj[1]; -Object.defineProperty(obj, "1", {get: function() {}, configurable: true}); -Object.defineProperty(obj, "1", {value: 9, writable: true}); -obj[1] = 10; -delete obj[1]; -Object.defineProperty(obj, "1", {value: 11, configurable: true}); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: obj, name: "1", type: "updated", oldValue: 1 }, - { object: obj, name: "1", type: "updated", oldValue: 2 }, - { object: obj, name: "1", type: "deleted", oldValue: 3 }, - { object: obj, name: "1", type: "new" }, - { object: obj, name: "1", type: "updated", oldValue: 4 }, - { object: obj, name: "1", type: "updated", oldValue: 5 }, - { object: obj, name: "1", type: "reconfigured", oldValue: 6 }, - { object: obj, name: "1", type: "updated", oldValue: 6 }, - { object: obj, name: "1", type: "reconfigured", oldValue: 8 }, - { object: obj, name: "1", type: "reconfigured", oldValue: 7 }, - { object: obj, name: "1", type: "reconfigured" }, - { object: obj, name: "1", type: "reconfigured" }, - { object: obj, name: "1", type: "reconfigured" }, - { object: obj, name: "1", type: "deleted" }, - { object: obj, name: "1", type: "new" }, - { object: obj, name: "1", type: "reconfigured" }, - { object: obj, name: "1", type: "updated", oldValue: 9 }, - { object: obj, name: "1", type: "deleted", oldValue: 10 }, - { object: obj, name: "1", type: "new" }, -]); - - -// Test all kinds of objects generically. -function TestObserveConfigurable(obj, prop) { - reset(); - obj[prop] = 1; - Object.observe(obj, observer.callback); - obj[prop] = 2; - obj[prop] = 3; - delete obj[prop]; - obj[prop] = 4; - obj[prop] = 4; // ignored - obj[prop] = 5; - Object.defineProperty(obj, prop, {value: 6}); - Object.defineProperty(obj, prop, {writable: false}); - obj[prop] = 7; // ignored - Object.defineProperty(obj, prop, {value: 8}); - Object.defineProperty(obj, prop, {value: 7, writable: true}); - Object.defineProperty(obj, prop, {get: function() {}}); - Object.defineProperty(obj, prop, {get: frozenFunction}); - Object.defineProperty(obj, prop, {get: frozenFunction}); // ignored - Object.defineProperty(obj, prop, {get: frozenFunction, set: frozenFunction}); - Object.defineProperty(obj, prop, {set: frozenFunction}); // ignored - Object.defineProperty(obj, prop, {get: undefined, set: frozenFunction}); - obj.__defineSetter__(prop, frozenFunction); // ignored - obj.__defineSetter__(prop, function() {}); - obj.__defineGetter__(prop, function() {}); - delete obj[prop]; - delete obj[prop]; // ignored - obj.__defineGetter__(prop, function() {}); - delete obj[prop]; - Object.defineProperty(obj, prop, {get: function() {}, configurable: true}); - Object.defineProperty(obj, prop, {value: 9, writable: true}); - obj[prop] = 10; - delete obj[prop]; - Object.defineProperty(obj, prop, {value: 11, configurable: true}); - Object.deliverChangeRecords(observer.callback); - observer.assertCallbackRecords([ - { object: obj, name: prop, type: "updated", oldValue: 1 }, - { object: obj, name: prop, type: "updated", oldValue: 2 }, - { object: obj, name: prop, type: "deleted", oldValue: 3 }, - { object: obj, name: prop, type: "new" }, - { object: obj, name: prop, type: "updated", oldValue: 4 }, - { object: obj, name: prop, type: "updated", oldValue: 5 }, - { object: obj, name: prop, type: "reconfigured", oldValue: 6 }, - { object: obj, name: prop, type: "updated", oldValue: 6 }, - { object: obj, name: prop, type: "reconfigured", oldValue: 8 }, - { object: obj, name: prop, type: "reconfigured", oldValue: 7 }, - { object: obj, name: prop, type: "reconfigured" }, - { object: obj, name: prop, type: "reconfigured" }, - { object: obj, name: prop, type: "reconfigured" }, - { object: obj, name: prop, type: "reconfigured" }, - { object: obj, name: prop, type: "reconfigured" }, - { object: obj, name: prop, type: "deleted" }, - { object: obj, name: prop, type: "new" }, - { object: obj, name: prop, type: "deleted" }, - { object: obj, name: prop, type: "new" }, - { object: obj, name: prop, type: "reconfigured" }, - { object: obj, name: prop, type: "updated", oldValue: 9 }, - { object: obj, name: prop, type: "deleted", oldValue: 10 }, - { object: obj, name: prop, type: "new" }, - ]); - Object.unobserve(obj, observer.callback); - delete obj[prop]; -} - -function TestObserveNonConfigurable(obj, prop, desc) { - reset(); - obj[prop] = 1; - Object.observe(obj, observer.callback); - obj[prop] = 4; - obj[prop] = 4; // ignored - obj[prop] = 5; - Object.defineProperty(obj, prop, {value: 6}); - Object.defineProperty(obj, prop, {value: 6}); // ignored - Object.defineProperty(obj, prop, {value: 7}); - Object.defineProperty(obj, prop, - {enumerable: desc.enumerable}); // ignored - Object.defineProperty(obj, prop, {writable: false}); - obj[prop] = 7; // ignored - Object.deliverChangeRecords(observer.callback); - observer.assertCallbackRecords([ - { object: obj, name: prop, type: "updated", oldValue: 1 }, - { object: obj, name: prop, type: "updated", oldValue: 4 }, - { object: obj, name: prop, type: "updated", oldValue: 5 }, - { object: obj, name: prop, type: "updated", oldValue: 6 }, - { object: obj, name: prop, type: "reconfigured", oldValue: 7 }, - ]); - Object.unobserve(obj, observer.callback); -} - -function createProxy(create, x) { - var handler = { - getPropertyDescriptor: function(k) { - for (var o = this.target; o; o = Object.getPrototypeOf(o)) { - var desc = Object.getOwnPropertyDescriptor(o, k); - if (desc) return desc; - } - return undefined; - }, - getOwnPropertyDescriptor: function(k) { - return Object.getOwnPropertyDescriptor(this.target, k); - }, - defineProperty: function(k, desc) { - var x = Object.defineProperty(this.target, k, desc); - Object.deliverChangeRecords(this.callback); - return x; - }, - delete: function(k) { - var x = delete this.target[k]; - Object.deliverChangeRecords(this.callback); - return x; - }, - getPropertyNames: function() { - return Object.getOwnPropertyNames(this.target); - }, - target: {isProxy: true}, - callback: function(changeRecords) { - print("callback", stringifyNoThrow(handler.proxy), stringifyNoThrow(got)); - for (var i in changeRecords) { - var got = changeRecords[i]; - var change = {object: handler.proxy, name: got.name, type: got.type}; - if ("oldValue" in got) change.oldValue = got.oldValue; - Object.getNotifier(handler.proxy).notify(change); - } - }, - }; - Object.observe(handler.target, handler.callback); - return handler.proxy = create(handler, x); -} - -var objects = [ - {}, - [], - this, // global object - function(){}, - (function(){ return arguments })(), - (function(){ "use strict"; return arguments })(), - Object(1), Object(true), Object("bla"), - new Date(), - Object, Function, Date, RegExp, - new Set, new Map, new WeakMap, - new ArrayBuffer(10), new Int32Array(5), - createProxy(Proxy.create, null), - createProxy(Proxy.createFunction, function(){}), -]; -var properties = ["a", "1", 1, "length", "prototype"]; - -// Cases that yield non-standard results. -// TODO(observe): ...or don't work yet. -function blacklisted(obj, prop) { - return (obj instanceof Int32Array && prop == 1) || - (obj instanceof Int32Array && prop === "length") || - (obj instanceof ArrayBuffer && prop == 1) || - // TODO(observe): oldValue when reconfiguring array length - (obj instanceof Array && prop === "length") -} - -for (var i in objects) for (var j in properties) { - var obj = objects[i]; - var prop = properties[j]; - if (blacklisted(obj, prop)) continue; - var desc = Object.getOwnPropertyDescriptor(obj, prop); - print("***", typeof obj, stringifyNoThrow(obj), prop); - if (!desc || desc.configurable) - TestObserveConfigurable(obj, prop); - else if (desc.writable) - TestObserveNonConfigurable(obj, prop, desc); -} - - -// Observing array length (including truncation) -reset(); -var arr = ['a', 'b', 'c', 'd']; -var arr2 = ['alpha', 'beta']; -var arr3 = ['hello']; -arr3[2] = 'goodbye'; -arr3.length = 6; -// TODO(adamk): Enable this test case when it can run in a reasonable -// amount of time. -//var slow_arr = new Array(1000000000); -//slow_arr[500000000] = 'hello'; -Object.defineProperty(arr, '0', {configurable: false}); -Object.defineProperty(arr, '2', {get: function(){}}); -Object.defineProperty(arr2, '0', {get: function(){}, configurable: false}); -Object.observe(arr, observer.callback); -Object.observe(arr2, observer.callback); -Object.observe(arr3, observer.callback); -arr.length = 2; -arr.length = 0; -arr.length = 10; -arr2.length = 0; -arr2.length = 1; // no change expected -arr3.length = 0; -Object.defineProperty(arr3, 'length', {value: 5}); -Object.defineProperty(arr3, 'length', {value: 10, writable: false}); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: arr, name: '3', type: 'deleted', oldValue: 'd' }, - { object: arr, name: '2', type: 'deleted' }, - { object: arr, name: 'length', type: 'updated', oldValue: 4 }, - { object: arr, name: '1', type: 'deleted', oldValue: 'b' }, - { object: arr, name: 'length', type: 'updated', oldValue: 2 }, - { object: arr, name: 'length', type: 'updated', oldValue: 1 }, - { object: arr2, name: '1', type: 'deleted', oldValue: 'beta' }, - { object: arr2, name: 'length', type: 'updated', oldValue: 2 }, - { object: arr3, name: '2', type: 'deleted', oldValue: 'goodbye' }, - { object: arr3, name: '0', type: 'deleted', oldValue: 'hello' }, - { object: arr3, name: 'length', type: 'updated', oldValue: 6 }, - { object: arr3, name: 'length', type: 'updated', oldValue: 0 }, - { object: arr3, name: 'length', type: 'updated', oldValue: 5 }, - // TODO(adamk): This record should be merged with the above - { object: arr3, name: 'length', type: 'reconfigured' }, -]); - -// Assignments in loops (checking different IC states). -reset(); -var obj = {}; -Object.observe(obj, observer.callback); -for (var i = 0; i < 5; i++) { - obj["a" + i] = i; -} -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: obj, name: "a0", type: "new" }, - { object: obj, name: "a1", type: "new" }, - { object: obj, name: "a2", type: "new" }, - { object: obj, name: "a3", type: "new" }, - { object: obj, name: "a4", type: "new" }, -]); - -reset(); -var obj = {}; -Object.observe(obj, observer.callback); -for (var i = 0; i < 5; i++) { - obj[i] = i; -} -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: obj, name: "0", type: "new" }, - { object: obj, name: "1", type: "new" }, - { object: obj, name: "2", type: "new" }, - { object: obj, name: "3", type: "new" }, - { object: obj, name: "4", type: "new" }, -]); - -// Adding elements past the end of an array should notify on length -reset(); -var arr = [1, 2, 3]; -Object.observe(arr, observer.callback); -arr[3] = 10; -arr[100] = 20; -Object.defineProperty(arr, '200', {value: 7}); -Object.defineProperty(arr, '400', {get: function(){}}); -arr[50] = 30; // no length change expected -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: arr, name: '3', type: 'new' }, - { object: arr, name: 'length', type: 'updated', oldValue: 3 }, - { object: arr, name: '100', type: 'new' }, - { object: arr, name: 'length', type: 'updated', oldValue: 4 }, - { object: arr, name: '200', type: 'new' }, - { object: arr, name: 'length', type: 'updated', oldValue: 101 }, - { object: arr, name: '400', type: 'new' }, - { object: arr, name: 'length', type: 'updated', oldValue: 201 }, - { object: arr, name: '50', type: 'new' }, -]); - -// Tests for array methods, first on arrays and then on plain objects -// -// === ARRAYS === -// -// Push -reset(); -var array = [1, 2]; -Object.observe(array, observer.callback); -array.push(3, 4); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '2', type: 'new' }, - { object: array, name: 'length', type: 'updated', oldValue: 2 }, - { object: array, name: '3', type: 'new' }, - { object: array, name: 'length', type: 'updated', oldValue: 3 }, -]); - -// Pop -reset(); -var array = [1, 2]; -Object.observe(array, observer.callback); -array.pop(); -array.pop(); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '1', type: 'deleted', oldValue: 2 }, - { object: array, name: 'length', type: 'updated', oldValue: 2 }, - { object: array, name: '0', type: 'deleted', oldValue: 1 }, - { object: array, name: 'length', type: 'updated', oldValue: 1 }, -]); - -// Shift -reset(); -var array = [1, 2]; -Object.observe(array, observer.callback); -array.shift(); -array.shift(); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '0', type: 'updated', oldValue: 1 }, - { object: array, name: '1', type: 'deleted', oldValue: 2 }, - { object: array, name: 'length', type: 'updated', oldValue: 2 }, - { object: array, name: '0', type: 'deleted', oldValue: 2 }, - { object: array, name: 'length', type: 'updated', oldValue: 1 }, -]); - -// Unshift -reset(); -var array = [1, 2]; -Object.observe(array, observer.callback); -array.unshift(3, 4); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '3', type: 'new' }, - { object: array, name: 'length', type: 'updated', oldValue: 2 }, - { object: array, name: '2', type: 'new' }, - { object: array, name: '0', type: 'updated', oldValue: 1 }, - { object: array, name: '1', type: 'updated', oldValue: 2 }, -]); - -// Splice -reset(); -var array = [1, 2, 3]; -Object.observe(array, observer.callback); -array.splice(1, 1, 4, 5); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '3', type: 'new' }, - { object: array, name: 'length', type: 'updated', oldValue: 3 }, - { object: array, name: '1', type: 'updated', oldValue: 2 }, - { object: array, name: '2', type: 'updated', oldValue: 3 }, -]); - -// -// === PLAIN OBJECTS === -// -// Push -reset() -var array = {0: 1, 1: 2, length: 2} -Object.observe(array, observer.callback); -Array.prototype.push.call(array, 3, 4); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '2', type: 'new' }, - { object: array, name: '3', type: 'new' }, - { object: array, name: 'length', type: 'updated', oldValue: 2 }, -]); - -// Pop -reset() -var array = {0: 1, 1: 2, length: 2}; -Object.observe(array, observer.callback); -Array.prototype.pop.call(array); -Array.prototype.pop.call(array); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '1', type: 'deleted', oldValue: 2 }, - { object: array, name: 'length', type: 'updated', oldValue: 2 }, - { object: array, name: '0', type: 'deleted', oldValue: 1 }, - { object: array, name: 'length', type: 'updated', oldValue: 1 }, -]); - -// Shift -reset() -var array = {0: 1, 1: 2, length: 2}; -Object.observe(array, observer.callback); -Array.prototype.shift.call(array); -Array.prototype.shift.call(array); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '0', type: 'updated', oldValue: 1 }, - { object: array, name: '1', type: 'deleted', oldValue: 2 }, - { object: array, name: 'length', type: 'updated', oldValue: 2 }, - { object: array, name: '0', type: 'deleted', oldValue: 2 }, - { object: array, name: 'length', type: 'updated', oldValue: 1 }, -]); - -// Unshift -reset() -var array = {0: 1, 1: 2, length: 2}; -Object.observe(array, observer.callback); -Array.prototype.unshift.call(array, 3, 4); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '3', type: 'new' }, - { object: array, name: '2', type: 'new' }, - { object: array, name: '0', type: 'updated', oldValue: 1 }, - { object: array, name: '1', type: 'updated', oldValue: 2 }, - { object: array, name: 'length', type: 'updated', oldValue: 2 }, -]); - -// Splice -reset() -var array = {0: 1, 1: 2, 2: 3, length: 3}; -Object.observe(array, observer.callback); -Array.prototype.splice.call(array, 1, 1, 4, 5); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '3', type: 'new' }, - { object: array, name: '1', type: 'updated', oldValue: 2 }, - { object: array, name: '2', type: 'updated', oldValue: 3 }, - { object: array, name: 'length', type: 'updated', oldValue: 3 }, -]); - -// Exercise StoreIC_ArrayLength -reset(); -var dummy = {}; -Object.observe(dummy, observer.callback); -Object.unobserve(dummy, observer.callback); -var array = [0]; -Object.observe(array, observer.callback); -array.splice(0, 1); -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: array, name: '0', type: 'deleted', oldValue: 0 }, - { object: array, name: 'length', type: 'updated', oldValue: 1}, -]); - - -// __proto__ -reset(); -var obj = {}; -Object.observe(obj, observer.callback); -var p = {foo: 'yes'}; -var q = {bar: 'no'}; -obj.__proto__ = p; -obj.__proto__ = p; // ignored -obj.__proto__ = null; -obj.__proto__ = q; -// TODO(adamk): Add tests for objects with hidden prototypes -// once we support observing the global object. -Object.deliverChangeRecords(observer.callback); -observer.assertCallbackRecords([ - { object: obj, name: '__proto__', type: 'prototype', - oldValue: Object.prototype }, - { object: obj, name: '__proto__', type: 'prototype', oldValue: p }, - { object: obj, name: '__proto__', type: 'prototype', oldValue: null }, -]); - -// Function.prototype -reset(); -var fun = function(){}; -Object.observe(fun, observer.callback); -var myproto = {foo: 'bar'}; -fun.prototype = myproto; -fun.prototype = 7; -fun.prototype = 7; // ignored -Object.defineProperty(fun, 'prototype', {value: 8}); -Object.deliverChangeRecords(observer.callback); -observer.assertRecordCount(3); -// Manually examine the first record in order to test -// lazy creation of oldValue -assertSame(fun, observer.records[0].object); -assertEquals('prototype', observer.records[0].name); -assertEquals('updated', observer.records[0].type); -// The only existing reference to the oldValue object is in this -// record, so to test that lazy creation happened correctly -// we compare its constructor to our function (one of the invariants -// ensured when creating an object via AllocateFunctionPrototype). -assertSame(fun, observer.records[0].oldValue.constructor); -observer.records.splice(0, 1); -observer.assertCallbackRecords([ - { object: fun, name: 'prototype', type: 'updated', oldValue: myproto }, - { object: fun, name: 'prototype', type: 'updated', oldValue: 7 }, -]); - -// Function.prototype should not be observable except on the object itself -reset(); -var fun = function(){}; -var obj = { __proto__: fun }; -Object.observe(obj, observer.callback); -obj.prototype = 7; -Object.deliverChangeRecords(observer.callback); -observer.assertNotCalled(); diff --git a/deps/v8/test/mjsunit/harmony/proxies-json.js b/deps/v8/test/mjsunit/harmony/proxies-json.js deleted file mode 100644 index 539c5a84cb..0000000000 --- a/deps/v8/test/mjsunit/harmony/proxies-json.js +++ /dev/null @@ -1,178 +0,0 @@ -// Copyright 2012 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. - -// Flags: --harmony - -function testStringify(expected, object) { - // Test fast case that bails out to slow case. - assertEquals(expected, JSON.stringify(object)); - // Test slow case. - assertEquals(expected, JSON.stringify(object, undefined, 0)); -} - -// Test serializing a proxy, function proxy and objects that contain them. -var handler1 = { - get: function(target, name) { - return name.toUpperCase(); - }, - enumerate: function(target) { - return ['a', 'b', 'c']; - }, - getOwnPropertyDescriptor: function(target, name) { - return { enumerable: true }; - } -} - -var proxy1 = Proxy.create(handler1); -testStringify('{"a":"A","b":"B","c":"C"}', proxy1); - -var proxy_fun = Proxy.createFunction(handler1, function() { return 1; }); -testStringify(undefined, proxy_fun); -testStringify('[1,null]', [1, proxy_fun]); - -var parent1a = { b: proxy1 }; -testStringify('{"b":{"a":"A","b":"B","c":"C"}}', parent1a); - -var parent1b = { a: 123, b: proxy1, c: true }; -testStringify('{"a":123,"b":{"a":"A","b":"B","c":"C"},"c":true}', parent1b); - -var parent1c = [123, proxy1, true]; -testStringify('[123,{"a":"A","b":"B","c":"C"},true]', parent1c); - -// Proxy with side effect. -var handler2 = { - get: function(target, name) { - delete parent2.c; - return name.toUpperCase(); - }, - enumerate: function(target) { - return ['a', 'b', 'c']; - }, - getOwnPropertyDescriptor: function(target, name) { - return { enumerable: true }; - } -} - -var proxy2 = Proxy.create(handler2); -var parent2 = { a: "delete", b: proxy2, c: "remove" }; -var expected2 = '{"a":"delete","b":{"a":"A","b":"B","c":"C"}}'; -assertEquals(expected2, JSON.stringify(parent2)); -parent2.c = "remove"; // Revert side effect. -assertEquals(expected2, JSON.stringify(parent2, undefined, 0)); - -// Proxy with a get function that uses the first argument. -var handler3 = { - get: function(target, name) { - if (name == 'valueOf') return function() { return "proxy" }; - return name + "(" + target + ")"; - }, - enumerate: function(target) { - return ['a', 'b', 'c']; - }, - getOwnPropertyDescriptor: function(target, name) { - return { enumerable: true }; - } -} - -var proxy3 = Proxy.create(handler3); -var parent3 = { x: 123, y: proxy3 } -testStringify('{"x":123,"y":{"a":"a(proxy)","b":"b(proxy)","c":"c(proxy)"}}', - parent3); - -// Empty proxy. -var handler4 = { - get: function(target, name) { - return 0; - }, - enumerate: function(target) { - return []; - }, - getOwnPropertyDescriptor: function(target, name) { - return { enumerable: false }; - } -} - -var proxy4 = Proxy.create(handler4); -testStringify('{}', proxy4); -testStringify('{"a":{}}', { a: proxy4 }); - -// Proxy that provides a toJSON function that uses this. -var handler5 = { - get: function(target, name) { - if (name == 'z') return 97000; - return function(key) { return key.charCodeAt(0) + this.z; }; - }, - enumerate: function(target) { - return ['toJSON', 'z']; - }, - getOwnPropertyDescriptor: function(target, name) { - return { enumerable: true }; - } -} - -var proxy5 = Proxy.create(handler5); -testStringify('{"a":97097}', { a: proxy5 }); - -// Proxy that provides a toJSON function that returns undefined. -var handler6 = { - get: function(target, name) { - return function(key) { return undefined; }; - }, - enumerate: function(target) { - return ['toJSON']; - }, - getOwnPropertyDescriptor: function(target, name) { - return { enumerable: true }; - } -} - -var proxy6 = Proxy.create(handler6); -testStringify('[1,null,true]', [1, proxy6, true]); -testStringify('{"a":1,"c":true}', {a: 1, b: proxy6, c: true}); - -// Object containing a proxy that changes the parent's properties. -var handler7 = { - get: function(target, name) { - delete parent7.a; - delete parent7.c; - parent7.e = "5"; - return name.toUpperCase(); - }, - enumerate: function(target) { - return ['a', 'b', 'c']; - }, - getOwnPropertyDescriptor: function(target, name) { - return { enumerable: true }; - } -} - -var proxy7 = Proxy.create(handler7); -var parent7 = { a: "1", b: proxy7, c: "3", d: "4" }; -assertEquals('{"a":"1","b":{"a":"A","b":"B","c":"C"},"d":"4"}', - JSON.stringify(parent7)); -assertEquals('{"b":{"a":"A","b":"B","c":"C"},"d":"4","e":"5"}', - JSON.stringify(parent7)); diff --git a/deps/v8/test/mjsunit/harmony/proxies.js b/deps/v8/test/mjsunit/harmony/proxies.js index 04fc76949e..7170ffd9c7 100644 --- a/deps/v8/test/mjsunit/harmony/proxies.js +++ b/deps/v8/test/mjsunit/harmony/proxies.js @@ -649,11 +649,6 @@ function TestSetForDerived2(create, trap) { TestSetForDerived( function(k) { - // TODO(yangguo): issue 2398 - throwing an error causes formatting of - // the message string, which can be observable through this handler. - // We ignore keys that occur when formatting the message string. - if (k == "toString" || k == "valueOf") return; - key = k; switch (k) { case "p_writable": return {writable: true, configurable: true} diff --git a/deps/v8/test/mjsunit/json-parser-recursive.js b/deps/v8/test/mjsunit/json-parser-recursive.js deleted file mode 100644 index 1e00c83c87..0000000000 --- a/deps/v8/test/mjsunit/json-parser-recursive.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 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. - -var str = "[1]"; -for (var i = 0; i < 100000; i++) { - str = "[1," + str + "]"; -} - -assertThrows(function() { JSON.parse(str); }, RangeError); diff --git a/deps/v8/test/mjsunit/json-stringify-recursive.js b/deps/v8/test/mjsunit/json-stringify-recursive.js deleted file mode 100644 index 31aa0027c5..0000000000 --- a/deps/v8/test/mjsunit/json-stringify-recursive.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2012 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. - -var a = {}; -for (i = 0; i < 10000; i++) { - var current = {}; - current.a = a; - a = current; -} - -function rec(a,b,c,d,e,f,g,h,i,j,k,l,m,n) { - JSON.stringify(a); - rec(a,b,c,d,e,f,g,h,i,j,k,l,m,n); -} - -assertThrows(function() { rec(1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 1, 2, 3, 4) }, - RangeError); - - -var depth = 10000; -var deepArray = []; -for (var i = 0; i < depth; i++) deepArray = [deepArray]; -assertThrows(function() { JSON.stringify(deepArray); }, RangeError); - - -var deepObject = {}; -for (var i = 0; i < depth; i++) deepObject = { next: deepObject }; -assertThrows(function() { JSON.stringify(deepObject); }, RangeError); diff --git a/deps/v8/test/mjsunit/json.js b/deps/v8/test/mjsunit/json.js index 6e91725c7d..54fa1854f7 100644 --- a/deps/v8/test/mjsunit/json.js +++ b/deps/v8/test/mjsunit/json.js @@ -257,42 +257,6 @@ assertEquals("[1,2,[3,[4],5],6,7]", assertEquals("[2,4,[6,[8],10],12,14]", JSON.stringify([1, 2, [3, [4], 5], 6, 7], DoubleNumbers)); assertEquals('["a","ab","abc"]', JSON.stringify(["a","ab","abc"])); -assertEquals('{"a":1,"c":true}', - JSON.stringify({ a : 1, - b : function() { 1 }, - c : true, - d : function() { 2 } })); -assertEquals('[1,null,true,null]', - JSON.stringify([1, function() { 1 }, true, function() { 2 }])); -assertEquals('"toJSON 123"', - JSON.stringify({ toJSON : function() { return 'toJSON 123'; } })); -assertEquals('{"a":321}', - JSON.stringify({ a : { toJSON : function() { return 321; } } })); -var counter = 0; -assertEquals('{"getter":123}', - JSON.stringify({ get getter() { counter++; return 123; } })); -assertEquals(1, counter); -assertEquals('{"a":"abc","b":"\u1234bc"}', - JSON.stringify({ a : "abc", b : "\u1234bc" })); - - -var a = { a : 1, b : 2 }; -delete a.a; -assertEquals('{"b":2}', JSON.stringify(a)); - -var b = {}; -b.__proto__ = { toJSON : function() { return 321;} }; -assertEquals("321", JSON.stringify(b)); - -var array = [""]; -var expected = '""'; -for (var i = 0; i < 10000; i++) { - array.push(""); - expected = '"",' + expected; -} -expected = '[' + expected + ']'; -assertEquals(expected, JSON.stringify(array)); - var circular = [1, 2, 3]; circular[2] = circular; diff --git a/deps/v8/test/mjsunit/json2.js b/deps/v8/test/mjsunit/json2.js deleted file mode 100644 index 4c0b8f58c8..0000000000 --- a/deps/v8/test/mjsunit/json2.js +++ /dev/null @@ -1,153 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax - -// Test JSON.stringify on the global object. -var a = 12345; -assertTrue(JSON.stringify(this).indexOf('"a":12345') > 0); - -// Test JSON.stringify of array in dictionary mode. -var array_1 = []; -var array_2 = []; -array_1[100000] = 1; -array_2[100000] = function() { return 1; }; -var nulls = ""; -for (var i = 0; i < 100000; i++) { - nulls += 'null,'; -} -expected_1 = '[' + nulls + '1]'; -expected_2 = '[' + nulls + 'null]'; -assertEquals(expected_1, JSON.stringify(array_1)); -assertEquals(expected_2, JSON.stringify(array_2)); - -// Test JSValue with custom prototype. -var num_wrapper = Object(42); -num_wrapper.__proto__ = { __proto__: null, - toString: function() { return true; } }; -assertEquals('1', JSON.stringify(num_wrapper)); - -var str_wrapper = Object('2'); -str_wrapper.__proto__ = { __proto__: null, - toString: function() { return true; } }; -assertEquals('"true"', JSON.stringify(str_wrapper)); - -var bool_wrapper = Object(false); -bool_wrapper.__proto__ = { __proto__: null, - toString: function() { return true; } }; -// Note that toString function is not evaluated here! -assertEquals('false', JSON.stringify(bool_wrapper)); - -// Test getters. -var counter = 0; -var getter_obj = { get getter() { - counter++; - return 123; - } }; -assertEquals('{"getter":123}', JSON.stringify(getter_obj)); -assertEquals(1, counter); - -// Test toJSON function. -var tojson_obj = { toJSON: function() { - counter++; - return [1, 2]; - }, - a: 1}; -assertEquals('[1,2]', JSON.stringify(tojson_obj)); -assertEquals(2, counter); - -// Test that we don't recursively look for the toJSON function. -var tojson_proto_obj = { a: 'fail' }; -tojson_proto_obj.__proto__ = { toJSON: function() { - counter++; - return tojson_obj; - } }; -assertEquals('{"a":1}', JSON.stringify(tojson_proto_obj)); - -// Test toJSON produced by a getter. -var tojson_via_getter = { get toJSON() { - return function(x) { - counter++; - return 321; - }; - }, - a: 1 }; -assertEquals('321', JSON.stringify(tojson_via_getter)); - -// Test toJSON with key. -tojson_obj = { toJSON: function(key) { return key + key; } }; -var tojson_with_key_1 = { a: tojson_obj, b: tojson_obj }; -assertEquals('{"a":"aa","b":"bb"}', JSON.stringify(tojson_with_key_1)); -var tojson_with_key_2 = [ tojson_obj, tojson_obj ]; -assertEquals('["00","11"]', JSON.stringify(tojson_with_key_2)); - -// Test toJSON with exception. -var tojson_ex = { toJSON: function(key) { throw "123" } }; -assertThrows(function() { JSON.stringify(tojson_ex); }); - -// Test toJSON with access to this. -var obj = { toJSON: function(key) { return this.a + key; }, a: "x" }; -assertEquals('{"y":"xy"}', JSON.stringify({y: obj})); - -// Test holes in arrays. -var fast_smi = [1, 2, 3, 4]; -fast_smi.__proto__ = [7, 7, 7, 7]; -delete fast_smi[2]; -assertTrue(%HasFastSmiElements(fast_smi)); -assertEquals("[1,2,7,4]", JSON.stringify(fast_smi)); - -var fast_double = [1.1, 2, 3, 4]; -fast_double.__proto__ = [7, 7, 7, 7]; - -delete fast_double[2]; -assertTrue(%HasFastDoubleElements(fast_double)); -assertEquals("[1.1,2,7,4]", JSON.stringify(fast_double)); - -var fast_obj = [1, 2, {}, {}]; -fast_obj.__proto__ = [7, 7, 7, 7]; - -delete fast_obj[2]; -assertTrue(%HasFastObjectElements(fast_obj)); -assertEquals("[1,2,7,{}]", JSON.stringify(fast_obj)); - -var getter_side_effect = { a: 1, - get b() { - delete this.a; - delete this.c; - this.e = 5; - return 2; - }, - c: 3, - d: 4 }; -assertEquals('{"a":1,"b":2,"d":4}', JSON.stringify(getter_side_effect)); -assertEquals('{"b":2,"d":4,"e":5}', JSON.stringify(getter_side_effect)); - -var non_enum = {}; -non_enum.a = 1; -Object.defineProperty(non_enum, "b", { value: 2, enumerable: false }); -non_enum.c = 3; -assertEquals('{"a":1,"c":3}', JSON.stringify(non_enum)); diff --git a/deps/v8/test/mjsunit/manual-parallel-recompile.js b/deps/v8/test/mjsunit/manual-parallel-recompile.js deleted file mode 100644 index 26b160537b..0000000000 --- a/deps/v8/test/mjsunit/manual-parallel-recompile.js +++ /dev/null @@ -1,79 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax --expose-gc -// Flags: --parallel-recompilation --manual-parallel-recompilation - -function assertOptimized(fun) { - // This assertion takes --always-opt and --nocrankshaft flags into account. - assertTrue(%GetOptimizationStatus(fun) != 2); -} - -function assertUnoptimized(fun) { - assertTrue(%GetOptimizationStatus(fun) != 1); -} - -function f(x) { - var xx = x * x; - var xxstr = xx.toString(); - return xxstr.length; -} - -function g(x) { - var xxx = Math.sqrt(x) | 0; - var xxxstr = xxx.toString(); - return xxxstr.length; -} - -function k(x) { - return x * x; -} - -f(g(1)); -f(g(2)); -assertUnoptimized(f); -assertUnoptimized(g); - -%ForceParallelRecompile(f); -%ForceParallelRecompile(g); -assertUnoptimized(f); -assertUnoptimized(g); - -var sum = 0; -for (var i = 0; i < 10000; i++) sum += f(i) + g(i); -gc(); - -assertEquals(95274, sum); -assertUnoptimized(f); -assertUnoptimized(g); - -%InstallRecompiledCode(f); -assertOptimized(f); -assertUnoptimized(g); - -%InstallRecompiledCode(g); -assertOptimized(g); diff --git a/deps/v8/test/mjsunit/math-exp-precision.js b/deps/v8/test/mjsunit/math-exp-precision.js deleted file mode 100644 index ace7edc58c..0000000000 --- a/deps/v8/test/mjsunit/math-exp-precision.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2012 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. - -// Tests that the --fast-math implementation of Math.exp() has -// reasonable precision. - -function exp(x) { - return Math.exp(x); -} - -var first_call_result = exp(Math.PI); -var second_call_result = exp(Math.PI); - -function assertAlmostEquals(expected, actual, x) { - if (expected == 0 && actual == 0) return; // OK - if (expected == Number.POSITIVE_INFINITY && - actual == Number.POSITIVE_INFINITY) { - return; // OK - } - relative_diff = Math.abs(expected/actual - 1); - assertTrue(relative_diff < 1e-12, "relative difference of " + relative_diff + - " for input " + x); -} - -var increment = Math.PI / 35; // Roughly 0.1, but we want to try many - // different mantissae. -for (var x = -708; x < 710; x += increment) { - var ex = exp(x); - var reference = Math.pow(Math.E, x); - assertAlmostEquals(reference, ex, x); - if (ex > 0 && isFinite(ex)) { - var back = Math.log(ex); - assertAlmostEquals(x, back, x + " (backwards)"); - } -} - -// Make sure optimizing the function does not alter the result. -var last_call_result = exp(Math.PI); -assertEquals(first_call_result, second_call_result); -assertEquals(first_call_result, last_call_result); diff --git a/deps/v8/test/mjsunit/math-floor-of-div-minus-zero.js b/deps/v8/test/mjsunit/math-floor-of-div-minus-zero.js index 7349165854..2743490847 100644 --- a/deps/v8/test/mjsunit/math-floor-of-div-minus-zero.js +++ b/deps/v8/test/mjsunit/math-floor-of-div-minus-zero.js @@ -35,7 +35,6 @@ function test_div_no_deopt_minus_zero() { } test_div_no_deopt_minus_zero(); -test_div_no_deopt_minus_zero(); %OptimizeFunctionOnNextCall(test_div_no_deopt_minus_zero); test_div_no_deopt_minus_zero(); assertTrue(2 != %GetOptimizationStatus(test_div_no_deopt_minus_zero)); diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status index 0bf378b476..037093bf73 100644 --- a/deps/v8/test/mjsunit/mjsunit.status +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -44,7 +44,6 @@ regress/regress-524: SKIP # Too slow in debug mode with --stress-opt compiler/regress-stacktrace-methods: PASS, SKIP if $mode == debug compiler/regress-funcaller: PASS, SKIP if $mode == debug -regress/regress-2318: PASS, SKIP if $mode == debug regress/regress-create-exception: PASS, SKIP if $mode == debug ############################################################################## @@ -61,15 +60,6 @@ array-constructor: PASS || TIMEOUT unicode-case-overoptimization: PASS, TIMEOUT if ($arch == arm || $arch == android_arm || $arch == mipsel) ############################################################################## -# This test expects to reach a certain recursion depth, which may not work -# for debug mode. -json-recursive: PASS, (PASS || FAIL) if $mode == debug - -############################################################################## -# Skip long running test that times out in debug mode. -regress/regress-crbug-160010: PASS, SKIP if $mode == debug - -############################################################################## # This test sets the umask on a per-process basis and hence cannot be # used in multi-threaded runs. # On android there is no /tmp directory. diff --git a/deps/v8/test/mjsunit/regress/regress-121407.js b/deps/v8/test/mjsunit/regress/regress-121407.js index 4403708184..25033fb525 100644 --- a/deps/v8/test/mjsunit/regress/regress-121407.js +++ b/deps/v8/test/mjsunit/regress/regress-121407.js @@ -37,4 +37,4 @@ a[2000000] = 2000000; a.length=2000; for (var i = 0; i <= 256; i++) { a[i] = new Object(); -} +}
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/regress/regress-164442.js b/deps/v8/test/mjsunit/regress/regress-164442.js deleted file mode 100644 index 1160d874f5..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-164442.js +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax - -// Should not take a very long time (n^2 algorithms are bad) - - -function ensureNotNegative(x) { - return Math.max(0, x | 0); -} - - -ensureNotNegative(1); -ensureNotNegative(2); - -%OptimizeFunctionOnNextCall(ensureNotNegative); - -var r = ensureNotNegative(-1); - -assertEquals(0, r); diff --git a/deps/v8/test/mjsunit/regress/regress-166553.js b/deps/v8/test/mjsunit/regress/regress-166553.js deleted file mode 100644 index acaf34f4e0..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-166553.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 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. - -// Flags: --expose_gc - -JSON.stringify(String.fromCharCode(1, -11).toString()) -gc(); -var s = String.fromCharCode(1, -11) -assertEquals(65525, s.charCodeAt(1)) diff --git a/deps/v8/test/mjsunit/regress/regress-1692.js b/deps/v8/test/mjsunit/regress/regress-1692.js index 32be87f989..06bd66cf7f 100644 --- a/deps/v8/test/mjsunit/regress/regress-1692.js +++ b/deps/v8/test/mjsunit/regress/regress-1692.js @@ -82,7 +82,7 @@ var o = Object("string"); // Non-string property on String object. o[10] = 42; assertTrue(o.propertyIsEnumerable(10)); -assertTrue(o.propertyIsEnumerable(0)); +assertFalse(o.propertyIsEnumerable(0)); // Fast elements. var o = [1,2,3,4,5]; diff --git a/deps/v8/test/mjsunit/regress/regress-1980.js b/deps/v8/test/mjsunit/regress/regress-1980.js index d87ff45074..49dfd063ba 100644 --- a/deps/v8/test/mjsunit/regress/regress-1980.js +++ b/deps/v8/test/mjsunit/regress/regress-1980.js @@ -34,7 +34,7 @@ for (var i = 0; i < invalid_this.length; i++) { Error.prototype.toString.call(invalid_this[i]); } catch (e) { exception = true; - assertEquals("Error.prototype.toString called on non-object", e.message); + assertTrue("called_on_non_object" == e.type); } assertTrue(exception); } diff --git a/deps/v8/test/mjsunit/regress/regress-2263.js b/deps/v8/test/mjsunit/regress/regress-2263.js deleted file mode 100644 index 9a9db58773..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2263.js +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright 2012 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. - -var obj = { length: { valueOf: function(){ throw { type: "length" }}}}; -var sep = { toString: function(){ throw { type: "toString" }}}; -assertThrows("Array.prototype.join.call(obj, sep)", undefined, "length"); diff --git a/deps/v8/test/mjsunit/regress/regress-2315.js b/deps/v8/test/mjsunit/regress/regress-2315.js deleted file mode 100644 index a3f9182c95..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2315.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax - -var foo = (function() { - return eval("(function bar() { return 1; })"); -})(); - -foo(); -foo(); -%OptimizeFunctionOnNextCall(foo); -foo(); - -// Function should be optimized now. -assertTrue(%GetOptimizationStatus(foo) != 2); diff --git a/deps/v8/test/mjsunit/regress/regress-2398.js b/deps/v8/test/mjsunit/regress/regress-2398.js deleted file mode 100644 index 1c66e7f84c..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2398.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 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. - -"use strict"; - -var observed = false; - -var object = { get toString() { observed = true; } }; -Object.defineProperty(object, "ro", { value: 1 }); - -try { - object.ro = 2; // TypeError caused by trying to write to read-only. -} catch (e) { - e.message; // Forces formatting of the message object. -} - -assertFalse(observed); diff --git a/deps/v8/test/mjsunit/regress/regress-2410.js b/deps/v8/test/mjsunit/regress/regress-2410.js deleted file mode 100644 index c16fd14cdc..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2410.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 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. - -// Object.prototype should be ignored in Object.getOwnPropertyNames -// -// See http://code.google.com/p/v8/issues/detail?id=2410 for details. - -Object.defineProperty(Object.prototype, - 'thrower', - { get: function() { throw Error('bug') } }); -var obj = { thrower: 'local' }; -assertEquals(['thrower'], Object.getOwnPropertyNames(obj)); diff --git a/deps/v8/test/mjsunit/regress/regress-2416.js b/deps/v8/test/mjsunit/regress/regress-2416.js deleted file mode 100644 index 02afeb9a59..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2416.js +++ /dev/null @@ -1,75 +0,0 @@ -// Copyright 2012 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. - -assertFalse(2147483647 < -2147483648) -assertFalse(2147483647 <= -2147483648) -assertFalse(2147483647 == -2147483648) -assertTrue(2147483647 >= -2147483648) -assertTrue(2147483647 > -2147483648) - -assertTrue(-2147483648 < 2147483647) -assertTrue(-2147483648 <= 2147483647) -assertFalse(-2147483648 == 2147483647) -assertFalse(-2147483648 >= 2147483647) -assertFalse(-2147483648 > 2147483647) - -assertFalse(2147483647 < 2147483647) -assertTrue(2147483647 <= 2147483647) -assertTrue(2147483647 == 2147483647) -assertTrue(2147483647 >= 2147483647) -assertFalse(2147483647 > 2147483647) - -assertFalse(-2147483648 < -2147483648) -assertTrue(-2147483648 <= -2147483648) -assertTrue(-2147483648 == -2147483648) -assertTrue(-2147483648 >= -2147483648) -assertFalse(-2147483648 > -2147483648) - - -assertFalse(1073741823 < -1073741824) -assertFalse(1073741823 <= -1073741824) -assertFalse(1073741823 == -1073741824) -assertTrue(1073741823 >= -1073741824) -assertTrue(1073741823 > -1073741824) - -assertTrue(-1073741824 < 1073741823) -assertTrue(-1073741824 <= 1073741823) -assertFalse(-1073741824 == 1073741823) -assertFalse(-1073741824 >= 1073741823) -assertFalse(-1073741824 > 1073741823) - -assertFalse(1073741823 < 1073741823) -assertTrue(1073741823 <= 1073741823) -assertTrue(1073741823 == 1073741823) -assertTrue(1073741823 >= 1073741823) -assertFalse(1073741823 > 1073741823) - -assertFalse(-1073741824 < -1073741824) -assertTrue(-1073741824 <= -1073741824) -assertTrue(-1073741824 == -1073741824) -assertTrue(-1073741824 >= -1073741824) -assertFalse(-1073741824 > -1073741824) diff --git a/deps/v8/test/mjsunit/regress/regress-2433.js b/deps/v8/test/mjsunit/regress/regress-2433.js deleted file mode 100644 index dfe7131b59..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2433.js +++ /dev/null @@ -1,36 +0,0 @@ -// Copyright 2012 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. - -// Transitioning from a PackedSmi to PackedDouble should fill the destination -// with holes. -// -// See http://code.google.com/p/v8/issues/detail?id=2433 for details. - -arr = []; -arr[0] = 0; -arr[0] = 1.1; -assertEquals(undefined, arr[1]); diff --git a/deps/v8/test/mjsunit/regress/regress-2437.js b/deps/v8/test/mjsunit/regress/regress-2437.js deleted file mode 100644 index c82293ae32..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2437.js +++ /dev/null @@ -1,156 +0,0 @@ -// Copyright 2012 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. - -// Summary of the spec: lastIndex is reset to 0 if -// - a regexp fails to match, regardless of global or non-global. -// - a global regexp is used in a function that returns multiple results, -// such as String.prototype.replace or String.prototype.match, since it -// repeats the regexp until it fails to match. -// Otherwise lastIndex is only set when a global regexp matches, to the index -// after the match. - -// Test Regexp.prototype.exec -r = /a/; -r.lastIndex = 1; -r.exec("zzzz"); -assertEquals(0, r.lastIndex); - -// Test Regexp.prototype.test -r = /a/; -r.lastIndex = 1; -r.test("zzzz"); -assertEquals(0, r.lastIndex); - -// Test String.prototype.match -r = /a/; -r.lastIndex = 1; -"zzzz".match(r); -assertEquals(0, r.lastIndex); - -// Test String.prototype.replace with atomic regexp and empty string. -r = /a/; -r.lastIndex = 1; -"zzzz".replace(r, ""); -assertEquals(0, r.lastIndex); - -// Test String.prototype.replace with non-atomic regexp and empty string. -r = /\d/; -r.lastIndex = 1; -"zzzz".replace(r, ""); -assertEquals(0, r.lastIndex); - -// Test String.prototype.replace with atomic regexp and non-empty string. -r = /a/; -r.lastIndex = 1; -"zzzz".replace(r, "a"); -assertEquals(0, r.lastIndex); - -// Test String.prototype.replace with non-atomic regexp and non-empty string. -r = /\d/; -r.lastIndex = 1; -"zzzz".replace(r, "a"); -assertEquals(0, r.lastIndex); - -// Test String.prototype.replace with replacement function -r = /a/; -r.lastIndex = 1; -"zzzz".replace(r, function() { return ""; }); -assertEquals(0, r.lastIndex); - -// Regexp functions that returns multiple results: -// A global regexp always resets lastIndex regardless of whether it matches. -r = /a/g; -r.lastIndex = -1; -"0123abcd".replace(r, "x"); -assertEquals(0, r.lastIndex); - -r.lastIndex = -1; -"01234567".replace(r, "x"); -assertEquals(0, r.lastIndex); - -r.lastIndex = -1; -"0123abcd".match(r); -assertEquals(0, r.lastIndex); - -r.lastIndex = -1; -"01234567".match(r); -assertEquals(0, r.lastIndex); - -// A non-global regexp resets lastIndex iff it does not match. -r = /a/; -r.lastIndex = -1; -"0123abcd".replace(r, "x"); -assertEquals(-1, r.lastIndex); - -r.lastIndex = -1; -"01234567".replace(r, "x"); -assertEquals(0, r.lastIndex); - -r.lastIndex = -1; -"0123abcd".match(r); -assertEquals(-1, r.lastIndex); - -r.lastIndex = -1; -"01234567".match(r); -assertEquals(0, r.lastIndex); - -// Also test RegExp.prototype.exec and RegExp.prototype.test -r = /a/g; -r.lastIndex = 1; -r.exec("01234567"); -assertEquals(0, r.lastIndex); - -r.lastIndex = 1; -r.exec("0123abcd"); -assertEquals(5, r.lastIndex); - -r = /a/; -r.lastIndex = 1; -r.exec("01234567"); -assertEquals(0, r.lastIndex); - -r.lastIndex = 1; -r.exec("0123abcd"); -assertEquals(1, r.lastIndex); - -r = /a/g; -r.lastIndex = 1; -r.test("01234567"); -assertEquals(0, r.lastIndex); - -r.lastIndex = 1; -r.test("0123abcd"); -assertEquals(5, r.lastIndex); - -r = /a/; -r.lastIndex = 1; -r.test("01234567"); -assertEquals(0, r.lastIndex); - -r.lastIndex = 1; -r.test("0123abcd"); -assertEquals(1, r.lastIndex); diff --git a/deps/v8/test/mjsunit/regress/regress-2438.js b/deps/v8/test/mjsunit/regress/regress-2438.js deleted file mode 100644 index 3f4fd7df57..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2438.js +++ /dev/null @@ -1,52 +0,0 @@ -// Copyright 2012 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 testSideEffects(subject, re) { - var counter = 0; - var side_effect_object = { valueOf: function() { return counter++; } }; - re.lastIndex = side_effect_object; - re.exec(subject); - assertEquals(1, counter); - - re.lastIndex = side_effect_object; - re.test(subject); - assertEquals(2, counter); - - re.lastIndex = side_effect_object; - subject.match(re); - assertEquals(3, counter); - - re.lastIndex = side_effect_object; - subject.replace(re, ""); - assertEquals(4, counter); -} - -testSideEffects("zzzz", /a/); -testSideEffects("zzzz", /a/g); -testSideEffects("xaxa", /a/); -testSideEffects("xaxa", /a/g); - diff --git a/deps/v8/test/mjsunit/regress/regress-2443.js b/deps/v8/test/mjsunit/regress/regress-2443.js deleted file mode 100644 index 0800c45c02..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2443.js +++ /dev/null @@ -1,129 +0,0 @@ -// Copyright 2012 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. - -// Number.prototype methods on non-Numbers. - -assertThrows(function() { Number.prototype.toExponential.call({}) }, - TypeError); - -assertThrows(function() { Number.prototype.toPrecision.call({}) }, - TypeError); - -assertThrows(function() { Number.prototype.toFixed.call({}) }, - TypeError); - -assertThrows(function() { Number.prototype.toString.call({}) }, - TypeError); - -assertThrows(function() { Number.prototype.toLocaleString.call({}) }, - TypeError); - -assertThrows(function() { Number.prototype.ValueOf.call({}) }, - TypeError); - - -// Call on Number objects with custom valueOf method. - -var x_obj = new Number(1); -x_obj.valueOf = function() { assertUnreachable(); }; - -assertEquals("1.00e+0", - Number.prototype.toExponential.call(x_obj, 2)); - -assertEquals("1.0", - Number.prototype.toPrecision.call(x_obj, 2)); - -assertEquals("1.00", - Number.prototype.toFixed.call(x_obj, 2)); - -// Call on primitive numbers. -assertEquals("1.00e+0", - Number.prototype.toExponential.call(1, 2)); - -assertEquals("1.0", - Number.prototype.toPrecision.call(1, 2)); - -assertEquals("1.00", - Number.prototype.toFixed.call(1, 2)); - - -// toExponential and toPrecision does following steps in order -// 1) convert the argument using ToInteger -// 2) check for non-finite receiver, on which it returns, -// 3) check argument range and throw exception if out of range. -// Note that the the last two steps are reversed for toFixed. -// Luckily, the receiver is expected to be a number or number -// wrapper, so that getting its value is not observable. - -var f_flag = false; -var f_obj = { valueOf: function() { f_flag = true; return 1000; } }; - -assertEquals("NaN", - Number.prototype.toExponential.call(NaN, f_obj)); -assertTrue(f_flag); - -f_flag = false; -assertEquals("Infinity", - Number.prototype.toExponential.call(1/0, f_obj)); -assertTrue(f_flag); - -f_flag = false; -assertEquals("-Infinity", - Number.prototype.toExponential.call(-1/0, f_obj)); -assertTrue(f_flag); - -f_flag = false; -assertEquals("NaN", - Number.prototype.toPrecision.call(NaN, f_obj)); -assertTrue(f_flag); - -f_flag = false; -assertEquals("Infinity", - Number.prototype.toPrecision.call(1/0, f_obj)); -assertTrue(f_flag); - -f_flag = false; -assertEquals("-Infinity", - Number.prototype.toPrecision.call(-1/0, f_obj)); -assertTrue(f_flag); - -// The odd man out: toFixed. - -f_flag = false; -assertThrows(function() { Number.prototype.toFixed.call(NaN, f_obj) }, - RangeError); -assertTrue(f_flag); - -f_flag = false; -assertThrows(function() { Number.prototype.toFixed.call(1/0, f_obj) }, - RangeError); -assertTrue(f_flag); - -f_flag = false; -assertThrows(function() { Number.prototype.toFixed.call(-1/0, f_obj) }, - RangeError); -assertTrue(f_flag); diff --git a/deps/v8/test/mjsunit/regress/regress-2444.js b/deps/v8/test/mjsunit/regress/regress-2444.js deleted file mode 100644 index 8fb8d8b52e..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2444.js +++ /dev/null @@ -1,120 +0,0 @@ -// Copyright 2012 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. - - -var flags; - -function resetFlags(size) { - flags = Array(size); - while (size--) flags[size] = 0; -} - -function assertFlags(array) { - assertArrayEquals(array, flags); -} - -function object_factory(flag_index, value, expected_flags) { - var obj = {}; - obj.valueOf = function() { - assertFlags(expected_flags); - flags[flag_index]++; - return value; - } - return obj; -} - - -assertEquals(-Infinity, Math.max()); - -resetFlags(1); -assertEquals(NaN, - Math.max(object_factory(0, NaN, [0]))); -assertFlags([1]); - -resetFlags(2); -assertEquals(NaN, - Math.max(object_factory(0, NaN, [0, 0]), - object_factory(1, 0, [1, 0]))); -assertFlags([1, 1]); - -resetFlags(3); -assertEquals(NaN, - Math.max(object_factory(0, NaN, [0, 0, 0]), - object_factory(1, 0, [1, 0, 0]), - object_factory(2, 1, [1, 1, 0]))); -assertFlags([1, 1, 1]); - -resetFlags(3); -assertEquals(NaN, - Math.max(object_factory(0, 2, [0, 0, 0]), - object_factory(1, 0, [1, 0, 0]), - object_factory(2, NaN, [1, 1, 0]))); -assertFlags([1, 1, 1]); - -resetFlags(3); -assertEquals(2, - Math.max(object_factory(0, 2, [0, 0, 0]), - object_factory(1, 0, [1, 0, 0]), - object_factory(2, 1, [1, 1, 0]))); -assertFlags([1, 1, 1]); - - -assertEquals(+Infinity, Math.min()); - -resetFlags(1); -assertEquals(NaN, - Math.min(object_factory(0, NaN, [0]))); -assertFlags([1]); - -resetFlags(2); -assertEquals(NaN, - Math.min(object_factory(0, NaN, [0, 0]), - object_factory(1, 0, [1, 0]))); -assertFlags([1, 1]); - -resetFlags(3); -assertEquals(NaN, - Math.min(object_factory(0, NaN, [0, 0, 0]), - object_factory(1, 0, [1, 0, 0]), - object_factory(2, 1, [1, 1, 0]))); -assertFlags([1, 1, 1]); - -resetFlags(3); -assertEquals(NaN, - Math.min(object_factory(0, 2, [0, 0, 0]), - object_factory(1, 0, [1, 0, 0]), - object_factory(2, NaN, [1, 1, 0]))); -assertFlags([1, 1, 1]); - -resetFlags(3); -assertEquals(0, - Math.min(object_factory(0, 2, [0, 0, 0]), - object_factory(1, 0, [1, 0, 0]), - object_factory(2, 1, [1, 1, 0]))); -assertFlags([1, 1, 1]); - - diff --git a/deps/v8/test/mjsunit/regress/regress-2489.js b/deps/v8/test/mjsunit/regress/regress-2489.js deleted file mode 100644 index 882c4f794a..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2489.js +++ /dev/null @@ -1,50 +0,0 @@ -// Copyright 2013 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. - -// Flags: --allow-natives-syntax - -"use strict"; - -function f(a, b) { - return g("c", "d"); -} - -function g(a, b) { - g.constructor.apply(this, arguments); -} - -g.constructor = function(a, b) { - assertEquals("c", a); - assertEquals("d", b); -} - -f("a", "b"); -f("a", "b"); -%OptimizeFunctionOnNextCall(f); -f("a", "b"); -g.x = "deopt"; -f("a", "b"); diff --git a/deps/v8/test/mjsunit/regress/regress-2499.js b/deps/v8/test/mjsunit/regress/regress-2499.js deleted file mode 100644 index 52aad874db..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-2499.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2013 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. - -// Flags: --allow-natives-syntax - -function foo(word, nBits) { - return (word[1] >>> nBits) | (word[0] << (32 - nBits)); -} - -word = [0x1001, 0]; - -var expected = foo(word, 1); -foo(word, 1); -%OptimizeFunctionOnNextCall(foo); -var optimized = foo(word, 1); -assertEquals(expected, optimized) diff --git a/deps/v8/test/mjsunit/regress/regress-492.js b/deps/v8/test/mjsunit/regress/regress-492.js index 53b3195cfe..a8b783b301 100644 --- a/deps/v8/test/mjsunit/regress/regress-492.js +++ b/deps/v8/test/mjsunit/regress/regress-492.js @@ -29,7 +29,7 @@ // This should not hit any asserts in debug mode on ARM. function function_with_n_args(n) { - var source = '(function f' + n + '('; + var source = '(function f('; for (var arg = 0; arg < n; arg++) { if (arg != 0) source += ','; source += 'arg' + arg; @@ -50,41 +50,3 @@ for (args = 500; args < 520; args++) { for (args = 1019; args < 1041; args++) { function_with_n_args(args); } - - -function foo( - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, - x, x, x, x, x, x, x, x, x, x, x, x, x, x, x, x -) {} - -for (var i = 0; i < 10000; ++i) foo(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-135066.js b/deps/v8/test/mjsunit/regress/regress-crbug-135066.js index 35e9ff8c87..1aeca8b1a3 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-135066.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-135066.js @@ -29,27 +29,25 @@ var filler = "//" + new Array(1024).join('x'); // Test strict eval in global context. -assertEquals(23, eval( +eval( "'use strict';" + "var x = 23;" + "var f = function bozo1() {" + " return x;" + "};" + "assertSame(23, f());" + - "f;" + filler -)()); +); // Test default eval in strict context. -assertEquals(42, (function() { +(function() { "use strict"; - return eval( + eval( "var y = 42;" + "var g = function bozo2() {" + " return y;" + "};" + "assertSame(42, g());" + - "g;" + filler - )(); -})()); + ); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-157019.js b/deps/v8/test/mjsunit/regress/regress-crbug-157019.js deleted file mode 100644 index 1c54089ff9..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-crbug-157019.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax --nocrankshaft - -function makeConstructor() { - return function() { - this.a = 1; - this.b = 2; - }; -} - -var c1 = makeConstructor(); -var o1 = new c1(); - -c1.prototype = {}; - -for (var i = 0; i < 10; i++) { - var o = new c1(); - for (var j = 0; j < 8; j++) { - o["x" + j] = 0; - } -} - -var c2 = makeConstructor(); -var o2 = new c2(); - -for (var i = 0; i < 50000; i++) { - new c2(); -} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-157520.js b/deps/v8/test/mjsunit/regress/regress-crbug-157520.js deleted file mode 100644 index 17081dfa52..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-crbug-157520.js +++ /dev/null @@ -1,38 +0,0 @@ -// Copyright 2012 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. - -// Flags: --nocrankshaft - -(function(){ - var f = function(arg) { - arg = 2; - return arguments[0]; - }; - for (var i = 0; i < 50000; i++) { - assertSame(2, f(1)); - } -})(); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-158185.js b/deps/v8/test/mjsunit/regress/regress-crbug-158185.js deleted file mode 100644 index 99f19c72fd..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-crbug-158185.js +++ /dev/null @@ -1,39 +0,0 @@ -// Copyright 2012 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. - -assertEquals("0023456", - Object.keys(JSON.parse('{"0023456": 1}'))[0]); -assertEquals("1234567890123", - Object.keys(JSON.parse('{"1234567890123": 1}'))[0]); -assertEquals("123456789ABCD", - Object.keys(JSON.parse('{"123456789ABCD": 1}'))[0]); -assertEquals("12A", - Object.keys(JSON.parse('{"12A": 1}'))[0]); - -assertEquals(1, JSON.parse('{"0":1}')[0]); -assertEquals(undefined, JSON.parse('{"00":1}')[0]); - diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-160010.js b/deps/v8/test/mjsunit/regress/regress-crbug-160010.js deleted file mode 100644 index 266e545325..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-crbug-160010.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2012 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. - -var str = "a"; -for (var i = 0; i < 28; i++) { - str += str; -} -JSON.stringify(str); - diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-162085.js b/deps/v8/test/mjsunit/regress/regress-crbug-162085.js deleted file mode 100644 index a53b2c9987..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-crbug-162085.js +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright 2012 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. - -// Ensure extending an empty packed smi array with a double initializes the -// array with holes. -var a = [1,2,3]; -a.length = 0; -a[0] = 1.4; -assertEquals(1.4, a[0]); -assertEquals(undefined, a[1]); -assertEquals(undefined, a[2]); -assertEquals(undefined, a[3]); - -// Ensure the double array growstub initializes the array with holes. -function grow_store(a,i,v) { - a[i] = v; -} - -var a2 = [1.3]; -grow_store(a2,1,1.4); -a2.length = 0; -grow_store(a2,0,1.5); -assertEquals(1.5, a2[0]); -assertEquals(undefined, a2[1]); -assertEquals(undefined, a2[2]); -assertEquals(undefined, a2[3]); - -// Check storing objects using the double grow stub. -var a3 = [1.3]; -var o = {}; -grow_store(a3, 1, o); -assertEquals(1.3, a3[0]); -assertEquals(o, a3[1]); - -// Ensure the double array growstub initializes the array with holes. -function grow_store2(a,i,v) { - a[i] = v; -} - -var a4 = [1.3]; -grow_store2(a4,1,1.4); -a4.length = 0; -grow_store2(a4,0,1); -assertEquals(1, a4[0]); -assertEquals(undefined, a4[1]); -assertEquals(undefined, a4[2]); -assertEquals(undefined, a4[3]); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-170856.js b/deps/v8/test/mjsunit/regress/regress-crbug-170856.js deleted file mode 100644 index 2e73b12caa..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-crbug-170856.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2013 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. - -r = new RegExp("a"); -for (var i = 0; i < 100; i++) { - r["abc" + i] = i; -} -"zzzz".replace(r, ""); -assertEquals(0, r.lastIndex); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-18639.js b/deps/v8/test/mjsunit/regress/regress-crbug-18639.js index 4f4bb7c796..23e225a4f4 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-18639.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-18639.js @@ -27,12 +27,8 @@ // See http://crbug.com/18639 -try { - toString = toString; - __defineGetter__("z", (0).toLocaleString); - z; - z; - ((0).toLocaleString)(); -} catch (e) { - assertInstanceof(e, TypeError); -}
\ No newline at end of file +toString = toString; +__defineGetter__("z", (0).toLocaleString); +z; +z; +((0).toLocaleString)(); diff --git a/deps/v8/test/mjsunit/regress/regress-delete-empty-double.js b/deps/v8/test/mjsunit/regress/regress-delete-empty-double.js deleted file mode 100644 index f7af2b1e31..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-delete-empty-double.js +++ /dev/null @@ -1,40 +0,0 @@ -// Copyright 2012 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. - -// Flags: --allow-natives-syntax - -a = [1.1,2.2,3.3]; -a.length = 1; -delete a[1]; - -assertTrue(%HasFastDoubleElements(a)); -assertFalse(%HasFastHoleyElements(a)); - -delete a[0]; - -assertTrue(%HasFastDoubleElements(a)); -assertTrue(%HasFastHoleyElements(a)); diff --git a/deps/v8/test/mjsunit/regress/regress-json-stringify-gc.js b/deps/v8/test/mjsunit/regress/regress-json-stringify-gc.js deleted file mode 100644 index c0a71bf4a1..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-json-stringify-gc.js +++ /dev/null @@ -1,41 +0,0 @@ -// Copyright 2012 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. - -var a = []; -var new_space_string = ""; -for (var i = 0; i < 128; i++) { - new_space_string += String.fromCharCode((Math.random() * 26 + 65) | 0); -} -for (var i = 0; i < 10000; i++) a.push(new_space_string); - -// At some point during the first stringify, allocation causes a GC and -// new_space_string is moved to old space. Make sure that this does not -// screw up reading from the correct location. -json1 = JSON.stringify(a); -json2 = JSON.stringify(a); -assertTrue(json1 == json2, "GC caused JSON.stringify to fail."); - diff --git a/deps/v8/test/mjsunit/regress/regress-observe-empty-double-array.js b/deps/v8/test/mjsunit/regress/regress-observe-empty-double-array.js deleted file mode 100644 index aea9c73b22..0000000000 --- a/deps/v8/test/mjsunit/regress/regress-observe-empty-double-array.js +++ /dev/null @@ -1,37 +0,0 @@ -// Copyright 2012 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. - -// Flags: --harmony-observation --allow-natives-syntax -// -// Test passes if it does not crash. - -arr = [1.1]; -Object.observe(arr, function(){}); -arr.length = 0; -assertTrue(%HasFastDoubleElements(arr)); -// Should not crash -arr.push(1.1); diff --git a/deps/v8/test/mjsunit/shift-for-integer-div.js b/deps/v8/test/mjsunit/shift-for-integer-div.js deleted file mode 100644 index 0fe1262292..0000000000 --- a/deps/v8/test/mjsunit/shift-for-integer-div.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2012 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 divp4(x) { - return x / 4; -} - -for (var i = 0; i < 10000; i+=4) { - assertEquals(i >> 2, divp4(i)); -} - -assertEquals(0.5, divp4(2)); - -function divn4(x) { - return x / (-4); -} - -for (var i = 0; i < 10000; i+=4) { - assertEquals(-(i >> 2), divn4(i)); -} - -assertEquals(-0, divn4(0)); - - -function divn1(x) { - return x / (-1); -} - -for (var i = 0; i < 10000; i++) { - assertEquals(-i, divn1(i)); -} - -var min_int = -(0x7FFFFFFF)-1; -assertEquals(-min_int, divn1(min_int)); - diff --git a/deps/v8/test/mjsunit/stack-traces-overflow.js b/deps/v8/test/mjsunit/stack-traces-overflow.js deleted file mode 100644 index 7722e93bd2..0000000000 --- a/deps/v8/test/mjsunit/stack-traces-overflow.js +++ /dev/null @@ -1,122 +0,0 @@ -// Copyright 2012 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 rec1(a) { rec1(a+1); } -function rec2(a) { rec3(a+1); } -function rec3(a) { rec2(a+1); } - -// Test stack trace getter and setter. -try { - rec1(0); -} catch (e) { - assertTrue(e.stack.indexOf("rec1") > 0); - e.stack = "123"; - assertEquals("123", e.stack); -} - -// Test setter w/o calling the getter. -try { - rec2(0); -} catch (e) { - assertTrue(e.stack.indexOf("rec2") > 0); - assertTrue(e.stack.indexOf("rec3") > 0); - e.stack = "123"; - assertEquals("123", e.stack); -} - -// Test getter to make sure setter does not affect the boilerplate. -try { - rec1(0); -} catch (e) { - assertTrue(e.stack.indexOf("rec1") > 0); - assertInstanceof(e, RangeError); -} - - -// Check setting/getting stack property on the prototype chain. -function testErrorPrototype(prototype) { - var object = {}; - object.__proto__ = prototype; - object.stack = "123"; - assertEquals("123", object.stack); - assertTrue("123" != prototype.stack); -} - -try { - rec1(0); -} catch (e) { - e.stack; - testErrorPrototype(e); -} - -try { - rec1(0); -} catch (e) { - testErrorPrototype(e); -} - -try { - throw new Error(); -} catch (e) { - testErrorPrototype(e); -} - -Error.stackTraceLimit = 3; -try { - rec1(0); -} catch (e) { - assertEquals(4, e.stack.split('\n').length); -} - -Error.stackTraceLimit = 25.9; -try { - rec1(0); -} catch (e) { - assertEquals(26, e.stack.split('\n').length); -} - -Error.stackTraceLimit = NaN; -try { - rec1(0); -} catch (e) { - assertEquals(1, e.stack.split('\n').length); -} - -Error.stackTraceLimit = "not a number"; -try { - rec1(0); -} catch (e) { - assertEquals(undefined, e.stack); -} - -Error.stackTraceLimit = 3; -Error = ""; // Overwrite Error in the global object. -try { - rec1(0); -} catch (e) { - assertEquals(4, e.stack.split('\n').length); -} diff --git a/deps/v8/test/mjsunit/strict-mode.js b/deps/v8/test/mjsunit/strict-mode.js index 5fb404a799..9c9bdfd52d 100644 --- a/deps/v8/test/mjsunit/strict-mode.js +++ b/deps/v8/test/mjsunit/strict-mode.js @@ -1141,9 +1141,9 @@ function CheckPillDescriptor(func, name) { function strict() { "use strict"; - return return_my_caller(); + return_my_caller(); } - assertSame(null, strict()); + assertThrows(strict, TypeError); function non_strict() { return return_my_caller(); @@ -1155,57 +1155,32 @@ function CheckPillDescriptor(func, name) { (function TestNonStrictFunctionCallerPill() { function strict(n) { "use strict"; - return non_strict(n); + non_strict(n); } function recurse(n, then) { if (n > 0) { - return recurse(n - 1, then); + recurse(n - 1); } else { return then(); } } function non_strict(n) { - return recurse(n, function() { return non_strict.caller; }); + recurse(n, function() { non_strict.caller; }); } function test(n) { - return recurse(n, function() { return strict(n); }); - } - - for (var i = 0; i < 10; i ++) { - assertSame(null, test(i)); - } -})(); - - -(function TestNonStrictFunctionCallerDescriptorPill() { - function strict(n) { - "use strict"; - return non_strict(n); - } - - function recurse(n, then) { - if (n > 0) { - return recurse(n - 1, then); - } else { - return then(); + try { + recurse(n, function() { strict(n); }); + } catch(e) { + return e instanceof TypeError; } - } - - function non_strict(n) { - return recurse(n, function() { - return Object.getOwnPropertyDescriptor(non_strict, "caller").value; - }); - } - - function test(n) { - return recurse(n, function() { return strict(n); }); + return false; } for (var i = 0; i < 10; i ++) { - assertSame(null, test(i)); + assertEquals(test(i), true); } })(); diff --git a/deps/v8/test/mjsunit/string-natives.js b/deps/v8/test/mjsunit/string-natives.js deleted file mode 100644 index b1ec875420..0000000000 --- a/deps/v8/test/mjsunit/string-natives.js +++ /dev/null @@ -1,72 +0,0 @@ -// Copyright 2012 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. - -// Flags: --expose-gc --allow-natives-syntax - -function test() { - var s1 = %NewString(26, true); - for (i = 0; i < 26; i++) %_OneByteSeqStringSetChar(s1, i, i+65); - assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ", s1); - s1 = %TruncateString(s1, 13); - assertEquals("ABCDEFGHIJKLM", s1); - - var s2 = %NewString(26, false); - for (i = 0; i < 26; i++) %_TwoByteSeqStringSetChar(s2, i, i+65); - assertEquals("ABCDEFGHIJKLMNOPQRSTUVWXYZ", s2); - s2 = %TruncateString(s1, 13); - assertEquals("ABCDEFGHIJKLM", s2); - - var s3 = %NewString(26, false); - for (i = 0; i < 26; i++) %_TwoByteSeqStringSetChar(s3, i, i+1000); - for (i = 0; i < 26; i++) assertEquals(s3[i], String.fromCharCode(i+1000)); - - var a = []; - for (var i = 0; i < 1000; i++) { - var s = %NewString(10000, i % 2 == 1); - a.push(s); - } - - gc(); - - for (var i = 0; i < 1000; i++) { - assertEquals(10000, a[i].length); - a[i] = %TruncateString(a[i], 5000); - } - - gc(); - - for (var i = 0; i < 1000; i++) { - assertEquals(5000, a[i].length); - } -} - - -test(); -test(); -%OptimizeFunctionOnNextCall(test); -test(); - diff --git a/deps/v8/test/mjsunit/string-split.js b/deps/v8/test/mjsunit/string-split.js index 1308244cab..d8412f0eed 100644 --- a/deps/v8/test/mjsunit/string-split.js +++ b/deps/v8/test/mjsunit/string-split.js @@ -66,23 +66,6 @@ assertArrayEquals(["div", "#i", "d", ".class"], "div#id.class".split(/(?=[d#.])/ assertArrayEquals(["a", "b", "c"], "abc".split(/(?=.)/)); -assertArrayEquals(["Wenige", "sind", "auserwählt."], - "Wenige sind auserwählt.".split(" ")); - -assertArrayEquals([], "Wenige sind auserwählt.".split(" ", 0)); - -assertArrayEquals(["Wenige"], "Wenige sind auserwählt.".split(" ", 1)); - -assertArrayEquals(["Wenige", "sind"], "Wenige sind auserwählt.".split(" ", 2)); - -assertArrayEquals(["Wenige", "sind", "auserwählt."], - "Wenige sind auserwählt.".split(" ", 3)); - -assertArrayEquals(["Wenige sind auserw", "hlt."], - "Wenige sind auserwählt.".split("ä")); - -assertArrayEquals(["Wenige sind ", "."], - "Wenige sind auserwählt.".split("auserwählt")); /* "ab".split(/((?=.))/) * diff --git a/deps/v8/test/mjsunit/testcfg.py b/deps/v8/test/mjsunit/testcfg.py index c8b972c12f..21139562e7 100644 --- a/deps/v8/test/mjsunit/testcfg.py +++ b/deps/v8/test/mjsunit/testcfg.py @@ -57,10 +57,11 @@ class MjsunitTestSuite(testsuite.TestSuite): def GetFlagsForTestCase(self, testcase, context): source = self.GetSourceForTest(testcase) - flags = [] + context.mode_flags + flags = [] flags_match = re.findall(FLAGS_PATTERN, source) for match in flags_match: flags += match.strip().split() + flags += context.mode_flags files_list = [] # List of file names to append to command arguments. files_match = FILES_PATTERN.search(source); diff --git a/deps/v8/test/mjsunit/tools/tickprocessor-test.log b/deps/v8/test/mjsunit/tools/tickprocessor-test.log index 5ddad89a55..db8be79fa9 100644 --- a/deps/v8/test/mjsunit/tools/tickprocessor-test.log +++ b/deps/v8/test/mjsunit/tools/tickprocessor-test.log @@ -2,24 +2,24 @@ shared-library,"shell",0x08048000,0x081ee000 shared-library,"/lib32/libm-2.7.so",0xf7db6000,0xf7dd9000 shared-library,"ffffe000-fffff000",0xffffe000,0xfffff000 profiler,"begin",1 -code-creation,Stub,0,0xf540a100,474,"CEntryStub" -code-creation,Script,0,0xf541cd80,736,"exp.js" -code-creation,Stub,0,0xf541d0e0,47,"RuntimeStub_Math_exp" -code-creation,LazyCompile,0,0xf541d120,145,"exp native math.js:41" +code-creation,Stub,0xf540a100,474,"CEntryStub" +code-creation,Script,0xf541cd80,736,"exp.js" +code-creation,Stub,0xf541d0e0,47,"RuntimeStub_Math_exp" +code-creation,LazyCompile,0xf541d120,145,"exp native math.js:41" function-creation,0xf441d280,0xf541d120 -code-creation,LoadIC,0,0xf541d280,117,"j" -code-creation,LoadIC,0,0xf541d360,63,"i" -tick,0x80f82d1,0xffdfe880,0,0,0,0,0xf541ce5c -tick,0x80f89a1,0xffdfecf0,0,0,0,0,0xf541ce5c -tick,0x8123b5c,0xffdff1a0,0,0,0,0,0xf541d1a1,0xf541ceea -tick,0x8123b65,0xffdff1a0,0,0,0,0,0xf541d1a1,0xf541ceea -tick,0xf541d2be,0xffdff1e4,0,0,0,0 -tick,0xf541d320,0xffdff1dc,0,0,0,0 -tick,0xf541d384,0xffdff1d8,0,0,0,0 -tick,0xf7db94da,0xffdff0ec,0,0,0,0,0xf541d1a1,0xf541ceea -tick,0xf7db951c,0xffdff0f0,0,0,0,0,0xf541d1a1,0xf541ceea -tick,0xf7dbc508,0xffdff14c,0,0,0,0,0xf541d1a1,0xf541ceea -tick,0xf7dbff21,0xffdff198,0,0,0,0,0xf541d1a1,0xf541ceea -tick,0xf7edec90,0xffdff0ec,0,0,0,0,0xf541d1a1,0xf541ceea -tick,0xffffe402,0xffdff488,0,0,0,0 +code-creation,LoadIC,0xf541d280,117,"j" +code-creation,LoadIC,0xf541d360,63,"i" +tick,0x80f82d1,0xffdfe880,0,0,0,0xf541ce5c +tick,0x80f89a1,0xffdfecf0,0,0,0,0xf541ce5c +tick,0x8123b5c,0xffdff1a0,0,0,0,0xf541d1a1,0xf541ceea +tick,0x8123b65,0xffdff1a0,0,0,0,0xf541d1a1,0xf541ceea +tick,0xf541d2be,0xffdff1e4,0,0,0 +tick,0xf541d320,0xffdff1dc,0,0,0 +tick,0xf541d384,0xffdff1d8,0,0,0 +tick,0xf7db94da,0xffdff0ec,0,0,0,0xf541d1a1,0xf541ceea +tick,0xf7db951c,0xffdff0f0,0,0,0,0xf541d1a1,0xf541ceea +tick,0xf7dbc508,0xffdff14c,0,0,0,0xf541d1a1,0xf541ceea +tick,0xf7dbff21,0xffdff198,0,0,0,0xf541d1a1,0xf541ceea +tick,0xf7edec90,0xffdff0ec,0,0,0,0xf541d1a1,0xf541ceea +tick,0xffffe402,0xffdff488,0,0,0 profiler,"end" diff --git a/deps/v8/test/mjsunit/uri.js b/deps/v8/test/mjsunit/uri.js index fae349f439..178ff1f2a7 100644 --- a/deps/v8/test/mjsunit/uri.js +++ b/deps/v8/test/mjsunit/uri.js @@ -76,15 +76,3 @@ assertEquals(cc8_2, decodeURI(encodeURI(s8)).charCodeAt(1)); assertEquals(cc9_1, decodeURI(encodeURI(s9)).charCodeAt(0)); assertEquals(cc9_2, decodeURI(encodeURI(s9)).charCodeAt(1)); assertEquals(cc10, decodeURI(encodeURI(s10)).charCodeAt(0)); - -assertEquals("", decodeURI("")); -assertEquals("", encodeURI("")); - -function test(string) { - assertEquals(string, decodeURI(encodeURI(string))); -} - -test("\u1234\u0123\uabcd"); -test("abcd"); -test("ab<\u1234\u0123"); -test("ab\u1234<\u0123"); |