diff options
author | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-02 17:11:31 +0200 |
---|---|---|
committer | Ben Noordhuis <info@bnoordhuis.nl> | 2013-07-06 16:53:06 +0200 |
commit | 704fd8f3745527fc080f96e54e5ec1857c505399 (patch) | |
tree | bff68e8a731f3618d3e8f1708aa9de194bc1f612 /deps/v8/test/mjsunit/regress | |
parent | eec43351c44c0bec31a83e1a28be15e30722936a (diff) | |
download | node-new-704fd8f3745527fc080f96e54e5ec1857c505399.tar.gz |
v8: upgrade to v3.20.2
Diffstat (limited to 'deps/v8/test/mjsunit/regress')
10 files changed, 478 insertions, 9 deletions
diff --git a/deps/v8/test/mjsunit/regress/regress-1383.js b/deps/v8/test/mjsunit/regress/regress-1383.js index 4b08f5a6b5..387c8b4004 100644 --- a/deps/v8/test/mjsunit/regress/regress-1383.js +++ b/deps/v8/test/mjsunit/regress/regress-1383.js @@ -33,7 +33,7 @@ x=""; function foo(){ "use strict"; var wxemsx=(4); - var wxemsx_0=Float32Array(wxemsx); + var wxemsx_0=new Float32Array(wxemsx); wxemsx_0[0]={}; } diff --git a/deps/v8/test/mjsunit/regress/regress-2691.js b/deps/v8/test/mjsunit/regress/regress-2691.js new file mode 100644 index 0000000000..e17be10814 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-2691.js @@ -0,0 +1,34 @@ +// 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: --harmony-generators + +// Check that yield* on non-objects raises a TypeError. + +assertThrows('(function*() { yield* 10 })().next()', TypeError); +assertThrows('(function*() { yield* {} })().next()', TypeError); +assertThrows('(function*() { yield* undefined })().next()', TypeError); diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-217858.js b/deps/v8/test/mjsunit/regress/regress-crbug-217858.js index 8563e07eee..e61cb9f6d2 100644 --- a/deps/v8/test/mjsunit/regress/regress-crbug-217858.js +++ b/deps/v8/test/mjsunit/regress/regress-crbug-217858.js @@ -25,16 +25,13 @@ // (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 +// Flags: --noanalyze_environment_liveness var r = /r/; -var a = ""; function f() { - %OptimizeFunctionOnNextCall(f, "osr"); - for (var i = 0; i < 1000000; i++) { - a += i.toString(); - r[r] = function() {}; - } + r[r] = function() {}; } -f(); +for (var i = 0; i < 300000; i++) { + f(); +} diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-245480.js b/deps/v8/test/mjsunit/regress/regress-crbug-245480.js new file mode 100644 index 0000000000..4769486403 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-crbug-245480.js @@ -0,0 +1,90 @@ +// 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 --smi-only-arrays --expose-gc +// Flags: --track-allocation-sites --noalways-opt + +// 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(new Array(1,2,3,4,5,6,7,8)); +support_smi_only_arrays = true; + +if (support_smi_only_arrays) { + print("Tests include smi-only arrays."); +} else { + print("Tests do NOT include smi-only arrays."); +} + +function isHoley(obj) { + if (%HasFastHoleyElements(obj)) return true; + return false; +} + +function assertHoley(obj, name_opt) { + assertEquals(true, isHoley(obj), name_opt); +} + +function assertNotHoley(obj, name_opt) { + assertEquals(false, isHoley(obj), name_opt); +} + +if (support_smi_only_arrays) { + function create_array(arg) { + return new Array(arg); + } + + obj = create_array(0); + assertNotHoley(obj); + create_array(0); + %OptimizeFunctionOnNextCall(create_array); + obj = create_array(10); + assertHoley(obj); +} + +// The code below would assert in debug or crash in release +function f(length) { + return new Array(length) +} + +f(0); +f(0); +%OptimizeFunctionOnNextCall(f); +var a = f(10); + +function g(a) { + return a[0]; +} + +var b = [0]; +g(b); +g(b); +assertEquals(undefined, g(a));
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/regress/regress-debug-deopt-while-recompile.js b/deps/v8/test/mjsunit/regress/regress-debug-deopt-while-recompile.js new file mode 100644 index 0000000000..3a66235684 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-debug-deopt-while-recompile.js @@ -0,0 +1,84 @@ +// 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: --expose-debug-as debug --allow-natives-syntax + +Debug = debug.Debug; + +function listener(event, exec_state, event_data, data) { + if (event != Debug.DebugEvent.Break) return; + try { + assertEquals("foo", exec_state.frame(0).evaluate("bar").value()); + } catch (e) { + exception = e; + }; + listened++; +}; + +var exception = null; +var listened = 0; + +var f = function() { + var bar = "foo"; + var baz = bar; // Break point should be here. + return bar; +} + +var g = function() { + var bar = "foo"; + var baz = bar; // Break point should be here. + return bar; +} + +f(); +f(); +g(); +g(); + +// Mark with builtin. +%OptimizeFunctionOnNextCall(f); +if (%IsParallelRecompilationSupported()) { + %OptimizeFunctionOnNextCall(g, "parallel"); +} + +// Activate debugger. +Debug.setListener(listener); + + // Set break point. +Debug.setBreakPoint(f, 2, 0); +Debug.setBreakPoint(g, 2, 0); + +// Trigger break point. +f(); +g(); + +// Assert that break point is set at expected location. +assertTrue(Debug.showBreakPoints(f).indexOf("[B0]var baz = bar;") > 0); +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]var baz = bar;") > 0); + +assertEquals(2, listened); +assertNull(exception); diff --git a/deps/v8/test/mjsunit/regress/regress-embedded-cons-string.js b/deps/v8/test/mjsunit/regress/regress-embedded-cons-string.js new file mode 100644 index 0000000000..afb3835688 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-embedded-cons-string.js @@ -0,0 +1,66 @@ +// 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: --fold-constants --nodead-code-elimination +// Flags: --expose-gc --allow-natives-syntax +// Flags: --parallel-recompilation --parallel-recompilation-delay=300 + +if (!%IsParallelRecompilationSupported()) { + print("Parallel recompilation is disabled. Skipping this test."); + quit(); +} + +function assertUnoptimized(fun) { + assertTrue(%GetOptimizationStatus(fun) != 1); +} + +function test(fun) { + fun(); + fun(); + %OptimizeFunctionOnNextCall(fun, "parallel"); + fun(); // Trigger optimization in the background. + gc(); // Tenure cons string. + assertUnoptimized(fun); // Compilation not complete yet. + %CompleteOptimization(fun); // Compilation embeds tenured cons string. + gc(); // Visit embedded cons string during mark compact. +} + +function f() { + return "abcdefghijklmn" + "123456789"; +} + +function g() { + return "abcdefghijklmn\u2603" + "123456789"; +} + +function h() { + return "abcdefghijklmn\u2603" + "123456789\u2604"; +} + +test(f); +test(g); +test(h); diff --git a/deps/v8/test/mjsunit/regress/regress-function-length-strict.js b/deps/v8/test/mjsunit/regress/regress-function-length-strict.js new file mode 100644 index 0000000000..700f34a67a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-function-length-strict.js @@ -0,0 +1,41 @@ +// 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. + +// Test that the length property of a function is read-only in strict mode. + +"use strict"; + +function foo(a, b, c) { + return b; +} + +var desc = Object.getOwnPropertyDescriptor(foo, 'length'); +assertEquals(3, desc.value); +assertFalse(desc.writable); +assertFalse(desc.enumerable); +assertFalse(desc.configurable); +assertThrows(function() { foo.length = 2; }, TypeError); diff --git a/deps/v8/test/mjsunit/regress/regress-opt-after-debug-deopt.js b/deps/v8/test/mjsunit/regress/regress-opt-after-debug-deopt.js new file mode 100644 index 0000000000..be12cc56fd --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-opt-after-debug-deopt.js @@ -0,0 +1,69 @@ +// 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: --expose-debug-as debug --allow-natives-syntax +// Flags: --parallel-recompilation --parallel-recompilation-delay=300 + +if (!%IsParallelRecompilationSupported()) { + print("Parallel recompilation is disabled. Skipping this test."); + quit(); +} + +Debug = debug.Debug; + +function listener(event, exec_state, event_data, data) { + if (event != Debug.DebugEvent.Break) return; + try { + assertEquals("foo", exec_state.frame(0).evaluate("a").value()); + } catch (e) { + exception = e; + }; + listened++; +}; + +var exception = null; +var listened = 0; + +var f = function() { + var a = "foo"; + var b = a.substring("1"); + [a, b].sort(); + return a; +} + +f(); +f(); +%OptimizeFunctionOnNextCall(f, "parallel"); // Mark with builtin. +f(); // Kick off parallel recompilation. + +Debug.setListener(listener); // Activate debugger. +Debug.setBreakPoint(f, 2, 0); // Force deopt. +%CompleteOptimization(f); // Install optimized code. + +f(); // Trigger break point. +assertEquals(1, listened); +assertNull(exception); diff --git a/deps/v8/test/mjsunit/regress/regress-polymorphic-store.js b/deps/v8/test/mjsunit/regress/regress-polymorphic-store.js new file mode 100644 index 0000000000..4723a7f434 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-polymorphic-store.js @@ -0,0 +1,48 @@ +// 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 + +var o1 = {}; +o1.f1 = function() { return 10; }; +o1.x = 5; +o1.y = 2; +var o2 = {}; +o2.x = 5; +o2.y = 5; + +function store(o, v) { + o.y = v; +} + +store(o2, 0); +store(o1, 0); +store(o2, 0); +%OptimizeFunctionOnNextCall(store); +store(o1, 10); +assertEquals(5, o1.x); +assertEquals(10, o1.y); diff --git a/deps/v8/test/mjsunit/regress/string-split-monkey-patching.js b/deps/v8/test/mjsunit/regress/string-split-monkey-patching.js new file mode 100644 index 0000000000..ea5c8679cb --- /dev/null +++ b/deps/v8/test/mjsunit/regress/string-split-monkey-patching.js @@ -0,0 +1,40 @@ +// 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. + +// Test that String.prototype.split with an regexp does not call the +// monkey-patchable Array.prototype.push or PutValue. + +Array.prototype.push = assertUnreachable; + +Object.defineProperty(Array.prototype, "0", { + get: assertUnreachable, + set: assertUnreachable }); + +"-".split(/-/); +"I-must-not-use-push!".split(/-/); +"Oh-no!".split(/(-)/); +"a".split(/(a)|(b)/); |