diff options
author | Ryan <ry@tinyclouds.org> | 2009-04-22 19:35:47 +0200 |
---|---|---|
committer | Ryan <ry@tinyclouds.org> | 2009-04-22 19:35:47 +0200 |
commit | 40c0f755c998d2615fe8466aab20c6d81bd463e7 (patch) | |
tree | 51fcb08ba1bd3f745ceb43fd5f814a5700079881 /deps/v8/test/mjsunit | |
parent | a93cf503073ba0258c55dec4dc325bdc1509b739 (diff) | |
download | node-new-40c0f755c998d2615fe8466aab20c6d81bd463e7.tar.gz |
import full versions of dependency libraries!
Diffstat (limited to 'deps/v8/test/mjsunit')
350 files changed, 48875 insertions, 0 deletions
diff --git a/deps/v8/test/mjsunit/api-call-after-bypassed-exception.js b/deps/v8/test/mjsunit/api-call-after-bypassed-exception.js new file mode 100644 index 0000000000..f77b5140c1 --- /dev/null +++ b/deps/v8/test/mjsunit/api-call-after-bypassed-exception.js @@ -0,0 +1,39 @@ +// Copyright 2008 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.
+ +// This is a test of making an API call after an exception thrown in JavaScript +// has been bypassed by a return in the finally block. +function foo() { + try { + throw "bar"; + } finally { + return "baz"; + } +} + +foo(); +print({}); diff --git a/deps/v8/test/mjsunit/apply.js b/deps/v8/test/mjsunit/apply.js new file mode 100644 index 0000000000..1d9dde9b11 --- /dev/null +++ b/deps/v8/test/mjsunit/apply.js @@ -0,0 +1,184 @@ +// Copyright 2008 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 f0() { + return this; +} + +function f1(a) { + return a; +} + +assertTrue(this === f0.apply(), "1-0"); + +assertTrue(this === f0.apply(this), "2a"); +assertTrue(this === f0.apply(this, new Array(1)), "2b"); +assertTrue(this === f0.apply(this, new Array(2)), "2c"); +assertTrue(this === f0.apply(this, new Array(4242)), "2c"); + +assertTrue(this === f0.apply(null), "3a"); +assertTrue(this === f0.apply(null, new Array(1)), "3b"); +assertTrue(this === f0.apply(null, new Array(2)), "3c"); +assertTrue(this === f0.apply(this, new Array(4242)), "2c"); + +assertTrue(this === f0.apply(void 0), "4a"); +assertTrue(this === f0.apply(void 0, new Array(1)), "4b"); +assertTrue(this === f0.apply(void 0, new Array(2)), "4c"); + +assertTrue(void 0 === f1.apply(), "1-1"); + +assertTrue(void 0 === f1.apply(this), "2a"); +assertTrue(void 0 === f1.apply(this, new Array(1)), "2b"); +assertTrue(void 0 === f1.apply(this, new Array(2)), "2c"); +assertTrue(void 0 === f1.apply(this, new Array(4242)), "2c"); +assertTrue(42 === f1.apply(this, new Array(42, 43)), "2c"); +assertEquals("foo", f1.apply(this, new Array("foo", "bar", "baz", "boo")), "2c"); + +assertTrue(void 0 === f1.apply(null), "3a"); +assertTrue(void 0 === f1.apply(null, new Array(1)), "3b"); +assertTrue(void 0 === f1.apply(null, new Array(2)), "3c"); +assertTrue(void 0 === f1.apply(null, new Array(4242)), "2c"); +assertTrue(42 === f1.apply(null, new Array(42, 43)), "2c"); +assertEquals("foo", f1.apply(null, new Array("foo", "bar", "baz", "boo")), "2c"); + +assertTrue(void 0 === f1.apply(void 0), "4a"); +assertTrue(void 0 === f1.apply(void 0, new Array(1)), "4b"); +assertTrue(void 0 === f1.apply(void 0, new Array(2)), "4c"); +assertTrue(void 0 === f1.apply(void 0, new Array(4242)), "4c"); +assertTrue(42 === f1.apply(void 0, new Array(42, 43)), "2c"); +assertEquals("foo", f1.apply(void 0, new Array("foo", "bar", "baz", "boo")), "2c"); + +var arr = new Array(42, "foo", "fish", "horse"); +function j(a, b, c, d, e, f, g, h, i, j, k, l) { + return "" + a + b + c + d + e + f + g + h + i + j + k + l; +} + + +var expect = "42foofishhorse"; +for (var i = 0; i < 8; i++) + expect += "undefined"; +assertEquals(expect, j.apply(undefined, arr)); + +assertThrows("f0.apply(this, 1);"); +assertThrows("f0.apply(this, 1, 2);"); +assertThrows("f0.apply(this, 1, new Array(2));"); + +function f() { + var doo = ""; + for (var i = 0; i < arguments.length; i++) { + doo += arguments[i]; + } + return doo; +} + +assertEquals("42foofishhorse", f.apply(this, arr)); + +function s() { + var doo = this; + for (var i = 0; i < arguments.length; i++) { + doo += arguments[i]; + } + return doo; +} + +assertEquals("bar42foofishhorse", s.apply("bar", arr)); + +function al() { + assertEquals(345, this); + return arguments.length + arguments[arguments.length - 1]; +} + +for (var j = 1; j < 0x40000000; j <<= 1) { + try { + var a = new Array(j); + a[j - 1] = 42; + assertEquals(42 + j, al.apply(345, a)); + } catch (e) { + assertTrue(e.toString().indexOf("Function.prototype.apply") != -1); + for (; j < 0x40000000; j <<= 1) { + var caught = false; + try { + a = new Array(j); + a[j - 1] = 42; + al.apply(345, a); + assertEquals("Shouldn't get", "here"); + } catch (e) { + assertTrue(e.toString().indexOf("Function.prototype.apply") != -1); + caught = true; + } + assertTrue(caught); + } + break; + } +} + +var primes = new Array(0); + +function isPrime(possible_prime) { + for (var d = 0; d < primes.length; d++) { + var p = primes[d]; + if (possible_prime % p == 0) + return false; + if (p * p > possible_prime) + return true; + } + return true; +} + +for (var i = 2; i < 10000; i++) { + if (isPrime(i)) { + primes.push(i); + } +} + +assertEquals(1229, primes.length); + +var same_primes = Array.prototype.constructor.apply(Array, primes); + +for (var i = 0; i < primes.length; i++) + assertEquals(primes[i], same_primes[i]); +assertEquals(primes.length, same_primes.length); + + +Array.prototype["1"] = "sep"; + +var holey = new Array(3); +holey[0] = "mor"; +holey[2] = "er"; + +assertEquals("morseper", String.prototype.concat.apply("", holey)); +assertEquals("morseper", String.prototype.concat.apply("", holey, 1)); +assertEquals("morseper", String.prototype.concat.apply("", holey, 1, 2)); +assertEquals("morseper", String.prototype.concat.apply("", holey, 1, 2, 3)); +assertEquals("morseper", String.prototype.concat.apply("", holey, 1, 2, 3, 4)); + +primes[0] = ""; +primes[1] = holey; +assertThrows("String.prototype.concat.apply.apply('foo', primes)"); +assertEquals("morseper", String.prototype.concat.apply.apply(String.prototype.concat, primes)); + +delete(Array.prototype["1"]); diff --git a/deps/v8/test/mjsunit/arguments-call-apply.js b/deps/v8/test/mjsunit/arguments-call-apply.js new file mode 100644 index 0000000000..a5cadf557b --- /dev/null +++ b/deps/v8/test/mjsunit/arguments-call-apply.js @@ -0,0 +1,41 @@ +// Copyright 2008 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 sum(a, b, c) { + var result = 0; + for (var i = 0; i < arguments.length; i++) { + result += arguments[i]; + } + return result; +} + +// Try invoking call before sum has been compiled lazily. +assertEquals(6, sum.call(this, 1, 2, 3), "lazy call"); + +assertEquals(6, sum(1, 2, 3), "normal"); +assertEquals(6, sum.call(this, 1, 2, 3), "call"); +assertEquals(6, sum.apply(this, [1, 2, 3]), "apply"); diff --git a/deps/v8/test/mjsunit/arguments-enum.js b/deps/v8/test/mjsunit/arguments-enum.js new file mode 100644 index 0000000000..f76240ff1b --- /dev/null +++ b/deps/v8/test/mjsunit/arguments-enum.js @@ -0,0 +1,52 @@ +// Copyright 2008 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 countArguments() { + var count = 0; + for (var prop in arguments) + count++; + return count; +} + +function setArgumentCount() { + arguments[10] = 5; + arguments.x = 4; + var count = 0; + for (var prop in arguments) + count++; + return count; +} + +assertEquals(0, countArguments()); +assertEquals(0, countArguments(1)); +assertEquals(0, countArguments(1, 2)); +assertEquals(0, countArguments(1, 2, 3, 4, 5)); + +assertEquals(0, setArgumentCount()); +assertEquals(0, setArgumentCount(1)); +assertEquals(0, setArgumentCount(1, 2)); +assertEquals(0, setArgumentCount(1, 2, 3, 4, 5)); diff --git a/deps/v8/test/mjsunit/arguments-indirect.js b/deps/v8/test/mjsunit/arguments-indirect.js new file mode 100644 index 0000000000..2d37027f41 --- /dev/null +++ b/deps/v8/test/mjsunit/arguments-indirect.js @@ -0,0 +1,47 @@ +// Copyright 2008 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 f1() { + g(f1); +} + +function f2(x) { + var a = arguments; + x++; + g(f2); +} + + +function g(f) { + assertEquals(3, f.arguments.length); + assertEquals(1, f.arguments[0]); + assertEquals(2, f.arguments[1]); + assertEquals(3, f.arguments[2]); +} + +f1(1,2,3); +f2(0,2,3); diff --git a/deps/v8/test/mjsunit/arguments-opt.js b/deps/v8/test/mjsunit/arguments-opt.js new file mode 100644 index 0000000000..c74fc75a2e --- /dev/null +++ b/deps/v8/test/mjsunit/arguments-opt.js @@ -0,0 +1,130 @@ +// Copyright 2008 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 L0() { + return %_ArgumentsLength(); +} + +function L1(a) { + return %_ArgumentsLength(); +} + +function L5(a,b,c,d,e) { + return %_ArgumentsLength(); +} + + +assertEquals(0, L0()); +assertEquals(1, L0(1)); +assertEquals(2, L0(1,2)); +assertEquals(5, L0(1,2,3,4,5)); + +assertEquals(0, L1()); +assertEquals(1, L1(1)); +assertEquals(2, L1(1,2)); +assertEquals(5, L1(1,2,3,4,5)); + +assertEquals(0, L5()); +assertEquals(1, L5(1)); +assertEquals(2, L5(1,2)); +assertEquals(5, L5(1,2,3,4,5)); + + +function A(key) { + return %_Arguments(key); +} + +// Integer access. +assertEquals(0, A(0)); +assertEquals(0, A(0,1)); +assertEquals(2, A(1,2)); +assertEquals(2, A(1,2,3,4,5)); +assertEquals(5, A(4,2,3,4,5)); +assertTrue(typeof A(1) == 'undefined'); +assertTrue(typeof A(3,2,1) == 'undefined'); + +// Out-of-bounds integer access with and without argument +// adaptor frames. +assertTrue(typeof(A(-10000)) == 'undefined'); +assertTrue(typeof(A(-10000, 0)) == 'undefined'); +assertTrue(typeof(A(-1)) == 'undefined'); +assertTrue(typeof(A(-1, 0)) == 'undefined'); +assertTrue(typeof(A(10000)) == 'undefined'); +assertTrue(typeof(A(10000, 0)) == 'undefined'); + +// String access. +assertEquals(0, A('0')); +assertEquals(0, A('0',1)); +assertEquals(2, A('1',2)); +assertEquals(2, A('1',2,3,4,5)); +assertEquals(5, A('4',2,3,4,5)); +assertTrue(typeof A('1') == 'undefined'); +assertTrue(typeof A('3',2,1) == 'undefined'); +assertEquals(A, A('callee')); +assertEquals(1, A('length')); +assertEquals(2, A('length',2)); +assertEquals(5, A('length',2,3,4,5)); +assertEquals({}.toString, A('toString')); +assertEquals({}.isPrototypeOf, A('isPrototypeOf')); +assertTrue(typeof A('xxx') == 'undefined'); + +// Object access. +function O(key) { + return { toString: function() { return key; } }; +} + +assertEquals(0, A(O(0))); +assertEquals(0, A(O(0),1)); +assertEquals(2, A(O(1),2)); +assertEquals(2, A(O(1),2,3,4,5)); +assertEquals(5, A(O(4),2,3,4,5)); +assertTrue(typeof A(O(1)) == 'undefined'); +assertTrue(typeof A(O(3),2,1) == 'undefined'); + +assertEquals(0, A(O('0'))); +assertEquals(0, A(O('0'),1)); +assertEquals(2, A(O('1'),2)); +assertEquals(2, A(O('1'),2,3,4,5)); +assertEquals(5, A(O('4'),2,3,4,5)); +assertTrue(typeof A(O('1')) == 'undefined'); +assertTrue(typeof A(O('3'),2,1) == 'undefined'); +assertEquals(A, A(O('callee'))); +assertEquals(1, A(O('length'))); +assertEquals(2, A(O('length'),2)); +assertEquals(5, A(O('length'),2,3,4,5)); +assertEquals({}.toString, A(O('toString'))); +assertEquals({}.isPrototypeOf, A(O('isPrototypeOf'))); +assertTrue(typeof A(O('xxx')) == 'undefined'); + +// Make sure that out-of-bounds access do lookups in the +// prototype chain. +Object.prototype[5] = 42; +assertEquals(42, A(5)); +Object.prototype[-5] = 87; +assertEquals(87, A(-5)); diff --git a/deps/v8/test/mjsunit/arguments.js b/deps/v8/test/mjsunit/arguments.js new file mode 100644 index 0000000000..030273904c --- /dev/null +++ b/deps/v8/test/mjsunit/arguments.js @@ -0,0 +1,97 @@ +// Copyright 2008 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 argc0() { + return arguments.length; +} + +function argc1(i) { + return arguments.length; +} + +function argc2(i, j) { + return arguments.length; +} + +assertEquals(0, argc0()); +assertEquals(1, argc0(1)); +assertEquals(2, argc0(1, 2)); +assertEquals(3, argc0(1, 2, 3)); +assertEquals(0, argc1()); +assertEquals(1, argc1(1)); +assertEquals(2, argc1(1, 2)); +assertEquals(3, argc1(1, 2, 3)); +assertEquals(0, argc2()); +assertEquals(1, argc2(1)); +assertEquals(2, argc2(1, 2)); +assertEquals(3, argc2(1, 2, 3)); + + + +var index; + +function argv0() { + return arguments[index]; +} + +function argv1(i) { + return arguments[index]; +} + +function argv2(i, j) { + return arguments[index]; +} + +index = 0; +assertEquals(7, argv0(7)); +assertEquals(7, argv0(7, 8)); +assertEquals(7, argv0(7, 8, 9)); +assertEquals(7, argv1(7)); +assertEquals(7, argv1(7, 8)); +assertEquals(7, argv1(7, 8, 9)); +assertEquals(7, argv2(7)); +assertEquals(7, argv2(7, 8)); +assertEquals(7, argv2(7, 8, 9)); + +index = 1; +assertEquals(8, argv0(7, 8)); +assertEquals(8, argv0(7, 8)); +assertEquals(8, argv1(7, 8, 9)); +assertEquals(8, argv1(7, 8, 9)); +assertEquals(8, argv2(7, 8, 9)); +assertEquals(8, argv2(7, 8, 9)); + +index = 2; +assertEquals(9, argv0(7, 8, 9)); +assertEquals(9, argv1(7, 8, 9)); +assertEquals(9, argv2(7, 8, 9)); + + +// Test that calling a lazily compiled function with +// an unexpected number of arguments works. +function f(a) { return arguments.length; }; +assertEquals(3, f(1, 2, 3)); diff --git a/deps/v8/test/mjsunit/array-concat.js b/deps/v8/test/mjsunit/array-concat.js new file mode 100644 index 0000000000..2346c8de67 --- /dev/null +++ b/deps/v8/test/mjsunit/array-concat.js @@ -0,0 +1,120 @@ +// Copyright 2008 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. + +/** + * @fileoverview Test concat on small and large arrays + */ + +var poses = [140, 4000000000]; +while (pos = poses.shift()) { + var a = new Array(pos); + assertEquals(pos, a.length); + a.push('foo'); + assertEquals(pos + 1, a.length); + var b = ['bar']; + var c = a.concat(b); + assertEquals(pos + 2, c.length); + assertEquals("undefined", typeof(c[pos - 1])); + assertEquals("foo", c[pos]); + assertEquals("bar", c[pos + 1]); + + // Can we fool the system by putting a number in a string? + var onetwofour = "124"; + a[onetwofour] = 'doo'; + assertEquals(a[124], 'doo'); + c = a.concat(b); + assertEquals(c[124], 'doo'); + + // If we put a number in the prototype, then the spec says it should be + // copied on concat. + Array.prototype["123"] = 'baz'; + assertEquals(a[123], 'baz'); + + c = a.concat(b); + assertEquals(pos + 2, c.length); + assertEquals("baz", c[123]); + assertEquals("undefined", typeof(c[pos - 1])); + assertEquals("foo", c[pos]); + assertEquals("bar", c[pos + 1]); + + // When we take the number off the prototype it disappears from a, but + // the concat put it in c itself. + Array.prototype["123"] = undefined; + assertEquals("undefined", typeof(a[123])); + assertEquals("baz", c[123]); + + // If the element of prototype is shadowed, the element on the instance + // should be copied, but not the one on the prototype. + Array.prototype[123] = 'baz'; + a[123] = 'xyz'; + assertEquals('xyz', a[123]); + c = a.concat(b); + assertEquals('xyz', c[123]); + + // Non-numeric properties on the prototype or the array shouldn't get + // copied. + Array.prototype.moe = 'joe'; + a.ben = 'jerry'; + assertEquals(a["moe"], 'joe'); + assertEquals(a["ben"], 'jerry'); + c = a.concat(b); + // ben was not copied + assertEquals("undefined", typeof(c.ben)); + // moe was not copied, but we can see it through the prototype + assertEquals("joe", c.moe); + + // When we take moe off the prototype it disappears from all arrays. + Array.prototype.moe = undefined; + assertEquals("undefined", typeof(c.moe)); + + // Negative indeces don't get concated. + a[-1] = 'minus1'; + assertEquals("minus1", a[-1]); + assertEquals("undefined", typeof(a[0xffffffff])); + c = a.concat(b); + assertEquals("undefined", typeof(c[-1])); + assertEquals("undefined", typeof(c[0xffffffff])); + assertEquals(c.length, a.length + 1); + +} + +a = []; +c = a.concat('Hello'); +assertEquals(1, c.length); +assertEquals("Hello", c[0]); +assertEquals("Hello", c.toString()); + +// Check that concat preserves holes. +var holey = [void 0,'a',,'c'].concat(['d',,'f',[0,,2],void 0]) +assertEquals(9, holey.length); // hole in embedded array is ignored +for (var i = 0; i < holey.length; i++) { + if (i == 2 || i == 5) { + assertFalse(i in holey); + } else { + assertTrue(i in holey); + } +} diff --git a/deps/v8/test/mjsunit/array-functions-prototype.js b/deps/v8/test/mjsunit/array-functions-prototype.js new file mode 100644 index 0000000000..ea0dc61ef7 --- /dev/null +++ b/deps/v8/test/mjsunit/array-functions-prototype.js @@ -0,0 +1,159 @@ +// Copyright 2008 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. + +// This file contains a number of tests of array functions and their +// interaction with properties in the prototype chain. +// +// The behavior of SpiderMonkey is slightly different for arrays (see +// below). Our behavior is consistent and matches the bahavior of +// KJS. + +var proto = { length:3, 0:'zero', 1:'one', 2:'two' } +function constructor() {}; +constructor.prototype = proto; + +// Set elements on the array prototype. +Array.prototype[0] = 'zero'; +Array.prototype[1] = 'one'; +Array.prototype[2] = 'two'; + +// ---------------------------------------------------------------------- +// Helper functions. +// ---------------------------------------------------------------------- +function assertHasOwnProperties(object, limit) { + for (var i = 0; i < limit; i++) { + assertTrue(object.hasOwnProperty(i)); + } +} + + +// ---------------------------------------------------------------------- +// shift. +// ---------------------------------------------------------------------- + +function runTest() { + var nonArray = new constructor(); + var array = ['zero', , 'two']; + // Shift away the zero. + assertEquals('zero', array.shift()); + assertEquals('zero', Array.prototype.shift.call(nonArray)); + // Check that the local object has properties 0 and 1 with the right + // values. + assertEquals(2, array.length); + assertEquals(2, nonArray.length); + assertHasOwnProperties(array, 2); + assertHasOwnProperties(nonArray, 2); + // Note: Spidermonkey is inconsistent here. It treats arrays + // differently from non-arrays. It only consults the prototype for + // non-arrays. Therefore, array[0] is undefined in Spidermonkey and + // 'one' in V8 and KJS. + assertEquals('one', array[0]); + assertEquals('one', nonArray[0]); + assertEquals('two', array[1]); + assertEquals('two', nonArray[1]); + // Get index 2 from the prototype. + assertEquals('two', array[2]); + assertEquals('two', nonArray[2]); +} + +runTest(); + +// ---------------------------------------------------------------------- +// unshift. +// ---------------------------------------------------------------------- + +runTest = function() { + var nonArray = new constructor(); + var array = ['zero', , 'two']; + // Unshift a new 'zero'. + assertEquals(4, array.unshift('zero')); + assertEquals(4, Array.prototype.unshift.call(nonArray, 'zero')); + // Check that the local object has properties 0 through 3 with the + // right values. + assertEquals(4, array.length); + assertEquals(4, nonArray.length); + assertHasOwnProperties(array, 4); + assertHasOwnProperties(nonArray, 4); + assertEquals('zero', array[0]); + assertEquals('zero', nonArray[0]); + assertEquals('zero', array[1]); + assertEquals('zero', nonArray[1]); + // Again Spidermonkey is inconsistent. array[2] is undefined + // instead of 'one'. + assertEquals('one', array[2]); + assertEquals('one', nonArray[2]); + assertEquals('two', array[3]); + assertEquals('two', nonArray[3]); +} + +runTest(); + + +// ---------------------------------------------------------------------- +// splice +// ---------------------------------------------------------------------- + +runTest = function() { + var nonArray = new constructor(); + var array = ['zero', , 'two']; + // Delete the first element by splicing in nothing. + assertArrayEquals(['zero'], array.splice(0, 1)); + assertArrayEquals(['zero'], Array.prototype.splice.call(nonArray, 0, 1)); + // Check that the local object has properties 0 and 1 with the right + // values. + assertEquals(2, array.length); + assertEquals(2, nonArray.length); + assertHasOwnProperties(array, 2); + assertHasOwnProperties(nonArray, 2); + // Again Spidermonkey is inconsistent. array[0] is undefined + // instead of 'one'. + assertEquals('one', array[0]); + assertEquals('one', nonArray[0]); + assertEquals('two', array[1]); + assertEquals('two', nonArray[1]); + // Get index 2 from the prototype. + assertEquals('two', array[2]); + assertEquals('two', nonArray[2]); +}; + +runTest(); + + +// ---------------------------------------------------------------------- +// slice +// ---------------------------------------------------------------------- + +runTest = function() { + var nonArray = new constructor(); + var array = ['zero', , 'two']; + // Again Spidermonkey is inconsistent. (array.slice(0, 3))[1] is + // undefined instead of 'one'. + assertArrayEquals(['zero', 'one', 'two'], array.slice(0, 3)); + assertArrayEquals(['zero', 'one', 'two'], Array.prototype.slice.call(nonArray, 0, 3)); +}; + +runTest(); diff --git a/deps/v8/test/mjsunit/array-indexing.js b/deps/v8/test/mjsunit/array-indexing.js new file mode 100644 index 0000000000..2322c5457b --- /dev/null +++ b/deps/v8/test/mjsunit/array-indexing.js @@ -0,0 +1,66 @@ +// Copyright 2008 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 array = [1,2,3,1,2,3,1,2,3,1,2,3]; + +// ---------------------------------------------------------------------- +// Array.prototype.indexOf. +// ---------------------------------------------------------------------- + +// Negative cases. +assertEquals([].indexOf(1), -1); +assertEquals(array.indexOf(4), -1); +assertEquals(array.indexOf(3, array.length), -1); + +assertEquals(array.indexOf(3), 2); +// Negative index out of range. +assertEquals(array.indexOf(1, -17), 0); +// Negative index in rage. +assertEquals(array.indexOf(1, -11), 3); +// Index in range. +assertEquals(array.indexOf(1, 1), 3); +assertEquals(array.indexOf(1, 3), 3); +assertEquals(array.indexOf(1, 4), 6); + +// ---------------------------------------------------------------------- +// Array.prototype.lastIndexOf. +// ---------------------------------------------------------------------- + +// Negative cases. +assertEquals([].lastIndexOf(1), -1); +assertEquals(array.lastIndexOf(1, -17), -1); + +assertEquals(array.lastIndexOf(1), 9); +// Index out of range. +assertEquals(array.lastIndexOf(1, array.length), 9); +// Index in range. +assertEquals(array.lastIndexOf(1, 2), 0); +assertEquals(array.lastIndexOf(1, 4), 3); +assertEquals(array.lastIndexOf(1, 3), 3); +// Negative index in range. +assertEquals(array.lastIndexOf(1, -11), 0); + diff --git a/deps/v8/test/mjsunit/array-iteration.js b/deps/v8/test/mjsunit/array-iteration.js new file mode 100644 index 0000000000..f11b51cb8f --- /dev/null +++ b/deps/v8/test/mjsunit/array-iteration.js @@ -0,0 +1,228 @@ +// Copyright 2008 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 for non-standard array iteration functions. +// +// See +// +// <http://developer.mozilla.org/en/docs/Core_JavaScript_1.5_Reference:Global_Objects:Array> +// +// for an explanation of each of the functions. + +// +// Array.prototype.filter +// +(function() { + // Simple use. + var a = [0,1]; + assertArrayEquals([0], a.filter(function(n) { return n == 0; })); + assertArrayEquals(a, a); + + // Use specified object as this object when calling the function. + var o = { value: 42 } + a = [1,42,3,42,4]; + assertArrayEquals([42,42], a.filter(function(n) { return this.value == n }, o)) + + // Modify original array. + a = [1,42,3,42,4]; + assertArrayEquals([42,42], a.filter(function(n, index, array) { array[index] = 43; return 42 == n; })); + assertArrayEquals([43,43,43,43,43], a); + + // Only loop through initial part of array eventhough elements are + // added. + a = [1,1]; + assertArrayEquals([], a.filter(function(n, index, array) { array.push(n+1); return n == 2; })); + assertArrayEquals([1,1,2,2], a); + + // Respect holes. + a = new Array(20); + var count = 0; + a[2] = 2; + a[15] = 2; + a[17] = 4; + var a = a.filter(function(n) { count++; return n == 2; }); + assertEquals(3, count); + for (var i in a) assertEquals(2, a[i]); + +})(); + + +// +// Array.prototype.forEach +// +(function() { + // Simple use. + var a = [0,1]; + var count = 0; + a.forEach(function(n) { count++; }); + assertEquals(2, count); + + // Use specified object as this object when calling the function. + var o = { value: 42 } + var result = []; + a.forEach(function(n) { result.push(this.value); }, o); + assertArrayEquals([42,42], result); + + // Modify original array. + a = [0,1]; + count = 0; + a.forEach(function(n, index, array) { array[index] = n + 1; count++; }); + assertEquals(2, count); + assertArrayEquals([1,2], a); + + // Only loop through initial part of array eventhough elements are + // added. + a = [1,1]; + count = 0; + a.forEach(function(n, index, array) { array.push(n+1); count++; }); + assertEquals(2, count); + assertArrayEquals([1,1,2,2], a); + + // Respect holes. + a = new Array(20); + count = 0; + a[15] = 2; + a.forEach(function(n) { count++; }); + assertEquals(1, count); + +})(); + + +// +// Array.prototype.every +// +(function() { + // Simple use. + var a = [0,1]; + assertFalse(a.every(function(n) { return n == 0 })); + a = [0,0]; + assertTrue(a.every(function(n) { return n == 0 })); + assertTrue([].every(function(n) { return n == 0})); + + // Use specified object as this object when calling the function. + var o = { value: 42 } + a = [0]; + assertFalse(a.every(function(n) { return this.value == n; }, o)); + a = [42]; + assertTrue(a.every(function(n) { return this.value == n; }, o)); + + // Modify original array. + a = [0,1]; + assertFalse(a.every(function(n, index, array) { array[index] = n + 1; return n == 1;})); + assertArrayEquals([1,1], a); + + // Only loop through initial part of array eventhough elements are + // added. + a = [1,1]; + assertTrue(a.every(function(n, index, array) { array.push(n + 1); return n == 1;})); + assertArrayEquals([1,1,2,2], a); + + // Respect holes. + a = new Array(20); + var count = 0; + a[2] = 2; + a[15] = 2; + assertTrue(a.every(function(n) { count++; return n == 2; })); + assertEquals(2, count); + +})(); + +// +// Array.prototype.map +// +(function() { + var a = [0,1,2,3,4]; + + // Simple use. + var result = [1,2,3,4,5]; + assertArrayEquals(result, a.map(function(n) { return n + 1; })); + assertEquals(a, a); + + // Use specified object as this object when calling the function. + var o = { delta: 42 } + result = [42,43,44,45,46]; + assertArrayEquals(result, a.map(function(n) { return this.delta + n; }, o)); + + // Modify original array. + a = [0,1,2,3,4]; + result = [1,2,3,4,5]; + assertArrayEquals(result, a.map(function(n, index, array) { array[index] = n + 1; return n + 1;})); + assertArrayEquals(result, a); + + // Only loop through initial part of array eventhough elements are + // added. + a = [0,1,2,3,4]; + result = [1,2,3,4,5]; + assertArrayEquals(result, a.map(function(n, index, array) { array.push(n); return n + 1;})); + assertArrayEquals([0,1,2,3,4,0,1,2,3,4], a); + + // Respect holes. + a = new Array(20); + a[15] = 2; + a = a.map(function(n) { return 2*n; }); + for (var i in a) assertEquals(4, a[i]); + +})(); + +// +// Array.prototype.some +// +(function() { + var a = [0,1,2,3,4]; + + // Simple use. + assertTrue(a.some(function(n) { return n == 3})); + assertFalse(a.some(function(n) { return n == 5})); + + // Use specified object as this object when calling the function. + var o = { element: 42 }; + a = [1,42,3]; + assertTrue(a.some(function(n) { return this.element == n; }, o)); + a = [1]; + assertFalse(a.some(function(n) { return this.element == n; }, o)); + + // Modify original array. + a = [0,1,2,3]; + assertTrue(a.some(function(n, index, array) { array[index] = n + 1; return n == 2; })); + assertArrayEquals([1,2,3,3], a); + + // Only loop through initial part when elements are added. + a = [0,1,2]; + assertFalse(a.some(function(n, index, array) { array.push(42); return n == 42; })); + assertArrayEquals([0,1,2,42,42,42], a); + + // Respect holes. + a = new Array(20); + var count = 0; + a[2] = 42; + a[10] = 2; + a[15] = 42; + assertTrue(a.some(function(n) { count++; return n == 2; })); + assertEquals(2, count); + +})(); + diff --git a/deps/v8/test/mjsunit/array-join.js b/deps/v8/test/mjsunit/array-join.js new file mode 100644 index 0000000000..c66e4626e7 --- /dev/null +++ b/deps/v8/test/mjsunit/array-join.js @@ -0,0 +1,45 @@ +// Copyright 2008 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 array join calls toString on subarrays. +var a = [[1,2],3,4,[5,6]]; +assertEquals('1,2*3*4*5,6', a.join('*')); + +// Create a cycle. +a.push(a); +assertEquals('1,2*3*4*5,6*', a.join('*')); + +// Replace array.prototype.toString. +Array.prototype.toString = function() { return "array"; } +assertEquals('array*3*4*array*array', a.join('*')); + +Array.prototype.toString = function() { throw 42; } +assertThrows("a.join('*')"); + +Array.prototype.toString = function() { return "array"; } +assertEquals('array*3*4*array*array', a.join('*')); + diff --git a/deps/v8/test/mjsunit/array-length-number-conversion.js b/deps/v8/test/mjsunit/array-length-number-conversion.js new file mode 100644 index 0000000000..11808afaff --- /dev/null +++ b/deps/v8/test/mjsunit/array-length-number-conversion.js @@ -0,0 +1,53 @@ +// Copyright 2008 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. + +// A reduced test case from Acid3 test 95. +// When an object is assigned to an array length field, +// it is converted to a number. + +function CheckSetArrayLength(x, expected) { + var a = []; + a.length = x; + + assertEquals("number", typeof a.length); + assertEquals(expected, a.length); +} + +CheckSetArrayLength(2147483648, 2147483648); +CheckSetArrayLength("2147483648", 2147483648); +CheckSetArrayLength(null, 0); +CheckSetArrayLength(false, 0); +CheckSetArrayLength(true, 1); +CheckSetArrayLength({valueOf : function() { return 42; }}, 42); +CheckSetArrayLength({toString : function() { return '42'; }}, 42); + +// Test invalid values +assertThrows("var y = []; y.length = 'abc';"); +assertThrows("var y = []; y.length = undefined;"); +assertThrows("var y = []; y.length = {};"); +assertThrows("var y = []; y.length = -1;"); +assertThrows("var y = []; y.length = {valueOf:function() { throw new Error(); }};"); diff --git a/deps/v8/test/mjsunit/array-length.js b/deps/v8/test/mjsunit/array-length.js new file mode 100644 index 0000000000..9731e7a3ed --- /dev/null +++ b/deps/v8/test/mjsunit/array-length.js @@ -0,0 +1,111 @@ +// Copyright 2008 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 = [0,1,2,3]; +a.length = 0; + +assertEquals('undefined', typeof a[0]); +assertEquals('undefined', typeof a[1]); +assertEquals('undefined', typeof a[2]); +assertEquals('undefined', typeof a[3]); + + +var a = [0,1,2,3]; +a.length = 2; + +assertEquals(0, a[0]); +assertEquals(1, a[1]); +assertEquals('undefined', typeof a[2]); +assertEquals('undefined', typeof a[3]); + + +var a = new Array(); +a[0] = 0; +a[1000] = 1000; +a[1000000] = 1000000; +a[2000000] = 2000000; + +assertEquals(2000001, a.length); +a.length = 0; +assertEquals(0, a.length); +assertEquals('undefined', typeof a[0]); +assertEquals('undefined', typeof a[1000]); +assertEquals('undefined', typeof a[1000000]); +assertEquals('undefined', typeof a[2000000]); + + +var a = new Array(); +a[0] = 0; +a[1000] = 1000; +a[1000000] = 1000000; +a[2000000] = 2000000; + +assertEquals(2000001, a.length); +a.length = 2000; +assertEquals(2000, a.length); +assertEquals(0, a[0]); +assertEquals(1000, a[1000]); +assertEquals('undefined', typeof a[1000000]); +assertEquals('undefined', typeof a[2000000]); + + +var a = new Array(); +a[Math.pow(2,31)-1] = 0; +a[Math.pow(2,30)-1] = 0; +assertEquals(Math.pow(2,31), a.length); + + +var a = new Array(); +a[0] = 0; +a[1000] = 1000; +a[Math.pow(2,30)-1] = Math.pow(2,30)-1; +a[Math.pow(2,31)-1] = Math.pow(2,31)-1; +a[Math.pow(2,32)-2] = Math.pow(2,32)-2; + +assertEquals(Math.pow(2,30)-1, a[Math.pow(2,30)-1]); +assertEquals(Math.pow(2,31)-1, a[Math.pow(2,31)-1]); +assertEquals(Math.pow(2,32)-2, a[Math.pow(2,32)-2]); + +assertEquals(Math.pow(2,32)-1, a.length); +a.length = Math.pow(2,30)+1; // not a smi! +assertEquals(Math.pow(2,30)+1, a.length); + +assertEquals(0, a[0]); +assertEquals(1000, a[1000]); +assertEquals(Math.pow(2,30)-1, a[Math.pow(2,30)-1]); +assertEquals('undefined', typeof a[Math.pow(2,31)-1]); +assertEquals('undefined', typeof a[Math.pow(2,32)-2], "top"); + + +var a = new Array(); +a.length = new Number(12); +assertEquals(12, a.length); + + +var o = { length: -23 }; +Array.prototype.pop.apply(o); +assertEquals(4294967272, o.length); diff --git a/deps/v8/test/mjsunit/array-sort.js b/deps/v8/test/mjsunit/array-sort.js new file mode 100644 index 0000000000..dfa45906ec --- /dev/null +++ b/deps/v8/test/mjsunit/array-sort.js @@ -0,0 +1,154 @@ +// Copyright 2008 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 array sort. + +// Test counter-intuitive default number sorting. +function TestNumberSort() { + var a = [ 200, 45, 7 ]; + + // Default sort converts each element to string and orders + // lexicographically. + a.sort(); + assertArrayEquals([ 200, 45, 7 ], a); + // Sort numbers by value using a compare functions. + a.sort(function(x, y) { return x - y; }); + assertArrayEquals([ 7, 45, 200 ], a); + + // Default sort on negative numbers. + a = [-12345,-123,-1234,-123456]; + a.sort(); + assertArrayEquals([-123,-1234,-12345,-123456], a); + + // Default sort on negative and non-negative numbers. + a = [123456,0,-12345,-123,123,1234,-1234,0,12345,-123456]; + a.sort(); + assertArrayEquals([-123,-1234,-12345,-123456,0,0,123,1234,12345,123456], a); + + // Tricky case avoiding integer overflow in Runtime_SmiLexicographicCompare. + a = [9, 1000000000].sort(); + assertArrayEquals([1000000000, 9], a); + a = [1000000000, 1].sort(); + assertArrayEquals([1, 1000000000], a); + a = [1000000000, 0].sort(); + assertArrayEquals([0, 1000000000], a); + + // One string is a prefix of the other. + a = [1230, 123].sort(); + assertArrayEquals([123, 1230], a); + a = [1231, 123].sort(); + assertArrayEquals([123, 1231], a); + + // Default sort on Smis and non-Smis. + a = [1000000000, 10000000000, 1000000001, -1000000000, -10000000000, -1000000001]; + a.sort(); + assertArrayEquals([-1000000000, -10000000000, -1000000001, 1000000000, 10000000000, 1000000001], a); + + + for (var xb = 1; xb <= 1000 * 1000 * 1000; xb *= 10) { + for (var xf = 0; xf <= 9; xf++) { + for (var xo = -1; xo <= 1; xo++) { + for (var yb = 1; yb <= 1000 * 1000 * 1000; yb *= 10) { + for (var yf = 0; yf <= 9; yf++) { + for (var yo = -1; yo <= 1; yo++) { + var x = xb * xf + xo; + var y = yb * yf + yo; + if (!%_IsSmi(x)) continue; + if (!%_IsSmi(y)) continue; + var lex = %SmiLexicographicCompare(x, y); + if (lex < 0) lex = -1; + if (lex > 0) lex = 1; + assertEquals(lex, (x == y) ? 0 : ((x + "") < (y + "") ? -1 : 1), x + " < " + y); + } + } + } + } + } + } +} + +TestNumberSort(); + + +// Test lexicographical string sorting. +function TestStringSort() { + var a = [ "cc", "c", "aa", "a", "bb", "b", "ab", "ac" ]; + a.sort(); + assertArrayEquals([ "a", "aa", "ab", "ac", "b", "bb", "c", "cc" ], a); +} + +TestStringSort(); + + +// Test object sorting. Calls toString on each element and sorts +// lexicographically. +function TestObjectSort() { + var obj0 = { toString: function() { return "a"; } }; + var obj1 = { toString: function() { return "b"; } }; + var obj2 = { toString: function() { return "c"; } }; + var a = [ obj2, obj0, obj1 ]; + a.sort(); + assertArrayEquals([ obj0, obj1, obj2 ], a); +} + +TestObjectSort(); + +// Test array sorting with holes in the array. +function TestArraySortingWithHoles() { + var a = []; + a[4] = "18"; + a[10] = "12"; + a.sort(); + assertEquals(11, a.length); + assertEquals("12", a[0]); + assertEquals("18", a[1]); +} + +TestArraySortingWithHoles(); + +// Test array sorting with undefined elemeents in the array. +function TestArraySortingWithUndefined() { + var a = [ 3, void 0, 2 ]; + a.sort(); + assertArrayEquals([ 2, 3, void 0 ], a); +} + +TestArraySortingWithUndefined(); + +// Test that sorting using an unsound comparison function still gives a +// sane result, i.e. it terminates without error and retains the elements +// in the array. +function TestArraySortingWithUnsoundComparisonFunction() { + var a = [ 3, void 0, 2 ]; + a.sort(function(x, y) { return 1; }); + a.sort(); + assertArrayEquals([ 2, 3, void 0 ], a); +} + +TestArraySortingWithUnsoundComparisonFunction(); diff --git a/deps/v8/test/mjsunit/array-splice-webkit.js b/deps/v8/test/mjsunit/array-splice-webkit.js new file mode 100644 index 0000000000..113a56a6ed --- /dev/null +++ b/deps/v8/test/mjsunit/array-splice-webkit.js @@ -0,0 +1,60 @@ +// Copyright 2008 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. + +// Simple splice tests based on webkit layout tests. +var arr = ['a','b','c','d']; +assertArrayEquals(['a','b','c','d'], arr); +assertArrayEquals(['c','d'], arr.splice(2)); +assertArrayEquals(['a','b'], arr); +assertArrayEquals(['a','b'], arr.splice(0)); +assertArrayEquals([], arr) + +arr = ['a','b','c','d']; +assertEquals(undefined, arr.splice()) +assertArrayEquals(['a','b','c','d'], arr); +assertArrayEquals(['a','b','c','d'], arr.splice(undefined)) +assertArrayEquals([], arr); + +arr = ['a','b','c','d']; +assertArrayEquals(['a','b','c','d'], arr.splice(null)) +assertArrayEquals([], arr); + +arr = ['a','b','c','d']; +assertArrayEquals([], arr.splice(100)) +assertArrayEquals(['a','b','c','d'], arr); +assertArrayEquals(['d'], arr.splice(-1)) +assertArrayEquals(['a','b','c'], arr); + +assertArrayEquals([], arr.splice(2, undefined)) +assertArrayEquals([], arr.splice(2, null)) +assertArrayEquals([], arr.splice(2, -1)) +assertArrayEquals([], arr.splice(2, 0)) +assertArrayEquals(['a','b','c'], arr); +assertArrayEquals(['c'], arr.splice(2, 100)) +assertArrayEquals(['a','b'], arr); + + diff --git a/deps/v8/test/mjsunit/array-splice.js b/deps/v8/test/mjsunit/array-splice.js new file mode 100644 index 0000000000..d308ef569d --- /dev/null +++ b/deps/v8/test/mjsunit/array-splice.js @@ -0,0 +1,311 @@ +// Copyright 2008 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. + +/** + * @fileoverview Test splice, shift, unshift, slice and join on small + * and large arrays. Some of these methods are specified such that they + * should work on other objects too, so we test that too. + */ + +var LARGE = 40000000; +var VERYLARGE = 4000000000; + +// Nicer for firefox 1.5. Unless you uncomment the following two lines, +// smjs will appear to hang on this file. +//var LARGE = 40000; +//var VERYLARGE = 40000; + +var fourhundredth = LARGE/400; + +function PseudoArray() { +}; + +for (var use_real_arrays = 0; use_real_arrays <= 1; use_real_arrays++) { + var poses = [0, 140, 20000, VERYLARGE]; + var the_prototype; + var new_function; + var push_function; + var concat_function; + var slice_function; + var splice_function; + var splice_function_2; + var unshift_function; + var unshift_function_2; + var shift_function; + if (use_real_arrays) { + new_function = function(length) { + return new Array(length); + }; + the_prototype = Array.prototype; + push_function = function(array, elt) { + return array.push(elt); + }; + concat_function = function(array, other) { + return array.concat(other); + }; + slice_function = function(array, start, len) { + return array.slice(start, len); + }; + splice_function = function(array, start, len) { + return array.splice(start, len); + }; + splice_function_2 = function(array, start, len, elt) { + return array.splice(start, len, elt); + }; + unshift_function = function(array, elt) { + return array.unshift(elt); + }; + unshift_function_2 = function(array, elt1, elt2) { + return array.unshift(elt1, elt2); + }; + shift_function = function(array) { + return array.shift(); + }; + } else { + // Don't run largest size on non-arrays or we'll be here for ever. + poses.pop(); + new_function = function(length) { + var obj = new PseudoArray(); + obj.length = length; + return obj; + }; + the_prototype = PseudoArray.prototype; + push_function = function(array, elt) { + array[array.length] = elt; + array.length++; + }; + concat_function = function(array, other) { + return Array.prototype.concat.call(array, other); + }; + slice_function = function(array, start, len) { + return Array.prototype.slice.call(array, start, len); + }; + splice_function = function(array, start, len) { + return Array.prototype.splice.call(array, start, len); + }; + splice_function_2 = function(array, start, len, elt) { + return Array.prototype.splice.call(array, start, len, elt); + }; + unshift_function = function(array, elt) { + return Array.prototype.unshift.call(array, elt); + }; + unshift_function_2 = function(array, elt1, elt2) { + return Array.prototype.unshift.call(array, elt1, elt2); + }; + shift_function = function(array) { + return Array.prototype.shift.call(array); + }; + } + + for (var pos_pos = 0; pos_pos < poses.length; pos_pos++) { + var pos = poses[pos_pos]; + if (pos > 100) { + var a = new_function(pos); + assertEquals(pos, a.length); + push_function(a, 'foo'); + assertEquals(pos + 1, a.length); + var b = ['bar']; + // Delete a huge number of holes. + var c = splice_function(a, 10, pos - 20); + assertEquals(pos - 20, c.length); + assertEquals(21, a.length); + } + + // Add a numeric property to the prototype of the array class. This + // allows us to test some borderline stuff relative to the standard. + the_prototype["" + (pos + 1)] = 'baz'; + + if (use_real_arrays) { + // It seems quite clear from ECMAScript spec 15.4.4.5. Just call Get on + // every integer in the range. + // IE, Safari get this right. + // FF, Opera get this wrong. + var a = ['zero', ,'two']; + if (pos == 0) { + assertEquals("zero,baz,two", a.join(",")); + } + + // Concat only applies to real arrays, unlike most of the other methods. + var a = new_function(pos); + push_function(a, "con"); + assertEquals("con", a[pos]); + assertEquals(pos + 1, a.length); + var b = new_function(0); + push_function(b, "cat"); + assertEquals("cat", b[0]); + var ab = concat_function(a, b); + assertEquals("con", ab[pos]); + assertEquals(pos + 2, ab.length); + assertEquals("cat", ab[pos + 1]); + var ba = concat_function(b, a); + assertEquals("con", ba[pos + 1]); + assertEquals(pos + 2, ba.length); + assertEquals("cat", ba[0]); + + // Join with '' as separator. + var join = a.join(''); + assertEquals("con", join); + join = b.join(''); + assertEquals("cat", join); + join = ab.join(''); + assertEquals("concat", join); + join = ba.join(''); + assertEquals("catcon", join); + + var sparse = []; + sparse[pos + 1000] = 'is '; + sparse[pos + 271828] = 'time '; + sparse[pos + 31415] = 'the '; + sparse[pos + 012260199] = 'all '; + sparse[-1] = 'foo'; + sparse[pos + 22591927] = 'good '; + sparse[pos + 1618033] = 'for '; + sparse[pos + 91] = ': Now '; + sparse[pos + 86720199] = 'men.'; + sparse.hest = 'fisk'; + + assertEquals("baz: Now is the time for all good men.", sparse.join('')); + } + + a = new_function(pos); + push_function(a, 'zero'); + push_function(a, void 0); + push_function(a, 'two'); + + // Splice works differently from join. + // IE, Safari get this wrong. + // FF, Opera get this right. + // 15.4.4.12 line 24 says the object itself has to have the property... + var zero = splice_function(a, pos, 1); + assertEquals("undefined", typeof(a[pos])); + assertEquals("two", a[pos+1], "pos1:" + pos); + assertEquals(pos + 2, a.length, "a length"); + assertEquals(1, zero.length, "zero length"); + assertEquals("zero", zero[0]); + + // 15.4.4.12 line 41 says the object itself has to have the property... + a = new_function(pos); + push_function(a, 'zero'); + push_function(a, void 0); + push_function(a, 'two'); + var nothing = splice_function_2(a, pos, 0, 'minus1'); + assertEquals("minus1", a[pos]); + assertEquals("zero", a[pos+1]); + assertEquals("undefined", typeof(a[pos+2]), "toot!"); + assertEquals("two", a[pos+3], "pos3"); + assertEquals(pos + 4, a.length); + assertEquals(1, zero.length); + assertEquals("zero", zero[0]); + + // 15.4.4.12 line 10 says the object itself has to have the property... + a = new_function(pos); + push_function(a, 'zero'); + push_function(a, void 0); + push_function(a, 'two'); + var one = splice_function(a, pos + 1, 1); + assertEquals("", one.join(",")); + assertEquals(pos + 2, a.length); + assertEquals("zero", a[pos]); + assertEquals("two", a[pos+1]); + + // Set things back to the way they were. + the_prototype[pos + 1] = undefined; + + // Unshift. + var a = new_function(pos); + push_function(a, "foo"); + assertEquals("foo", a[pos]); + assertEquals(pos + 1, a.length); + unshift_function(a, "bar"); + assertEquals("foo", a[pos+1]); + assertEquals(pos + 2, a.length); + assertEquals("bar", a[0]); + unshift_function_2(a, "baz", "boo"); + assertEquals("foo", a[pos+3]); + assertEquals(pos + 4, a.length); + assertEquals("baz", a[0]); + assertEquals("boo", a[1]); + assertEquals("bar", a[2]); + + // Shift. + var baz = shift_function(a); + assertEquals("baz", baz); + assertEquals("boo", a[0]); + assertEquals(pos + 3, a.length); + assertEquals("foo", a[pos + 2]); + + // Slice. + var bar = slice_function(a, 1, 0); // don't throw an exception please. + bar = slice_function(a, 1, 2); + assertEquals("bar", bar[0]); + assertEquals(1, bar.length); + assertEquals("bar", a[1]); + + } +} + +// Lets see if performance is reasonable. + +var a = new Array(LARGE + 10); +for (var i = 0; i < a.length; i += 1000) { + a[i] = i; +} + +// Take something near the end of the array. +for (var i = 0; i < 100; i++) { + var top = a.splice(LARGE, 5); + assertEquals(5, top.length); + assertEquals(LARGE, top[0]); + assertEquals("undefined", typeof(top[1])); + assertEquals(LARGE + 5, a.length); + a.splice(LARGE, 0, LARGE); + a.length = LARGE + 10; +} + +var a = new Array(LARGE + 10); +for (var i = 0; i < a.length; i += fourhundredth) { + a[i] = i; +} + +// Take something near the middle of the array. +for (var i = 0; i < 10; i++) { + var top = a.splice(LARGE >> 1, 5); + assertEquals(5, top.length); + assertEquals(LARGE >> 1, top[0]); + assertEquals("undefined", typeof(top[1])); + assertEquals(LARGE + 5, a.length); + a.splice(LARGE >> 1, 0, LARGE >> 1, void 0, void 0, void 0, void 0); +} + + +// Test http://b/issue?id=1202711 +arr = [0]; +arr.length = 2; +Array.prototype[1] = 1; +assertEquals(1, arr.pop()); +assertEquals(0, arr.pop()); +Array.prototype[1] = undefined; diff --git a/deps/v8/test/mjsunit/ascii-regexp-subject.js b/deps/v8/test/mjsunit/ascii-regexp-subject.js new file mode 100644 index 0000000000..e0c2f841d3 --- /dev/null +++ b/deps/v8/test/mjsunit/ascii-regexp-subject.js @@ -0,0 +1,49 @@ +// Copyright 2008 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. + +/** + * @fileoverview Check that an initial ^ will result in a faster match fail. + */ + + +var s = "foo"; +var i; + +for (i = 0; i < 18; i++) { + s = s + s; +} + +function repeatRegexp(re) { + for (i = 0; i < 1000; i++) { + re.test(s); + } +} + +repeatRegexp(/^bar/); +repeatRegexp(/^foo|^bar|^baz/); +repeatRegexp(/(^bar)/); +repeatRegexp(/(?=^bar)\w+/); diff --git a/deps/v8/test/mjsunit/big-array-literal.js b/deps/v8/test/mjsunit/big-array-literal.js new file mode 100644 index 0000000000..d64c96868e --- /dev/null +++ b/deps/v8/test/mjsunit/big-array-literal.js @@ -0,0 +1,111 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that we can make large object literals that work. +// Also test that we can attempt to make even larger object literals without +// crashing. +function testLiteral(size, array_in_middle) { + print(size); + + var f; + + // Build object-literal string. + var literal = "function f() { return "; + + for (var i = 0; i < size; i++) { + literal += "["; + } + + literal += array_in_middle ? " [42.2]" : "{a:42.2}"; + + for (var i = 0; i < size; i++) { + literal += "]"; + } + + literal += "; }"; + + // Create the object literal. + eval(literal); + + var x = f(); + + // Check that the properties have the expected values. + for (var i = 0; i < size; i++) { + x = x[0]; + } + + if (array_in_middle) { + assertEquals(42.2, x[0]), "x array in middle"; + x[0] = 41.2; + } else { + assertEquals(42.2, x.a, "x object in middle"); + x.a = 41.2; + } + + var y = f(); + for (var i = 0; i < size; i++) { + y = y[0]; + } + + if (array_in_middle) { + assertEquals(42.2, y[0], "y array in middle"); + y[0] = 41.2; + } else { + assertEquals(42.2, y.a, "y object in middle"); + y.a = 41.2; + } +} + +// The sizes to test. +var sizes = [1, 2, 100, 200, 400]; + +// Run the test. +for (var i = 0; i < sizes.length; i++) { + testLiteral(sizes[i], false); + testLiteral(sizes[i], true); +} + +function testLiteralAndCatch(size) { + var big_enough = false; + try { + testLiteral(size, false); + } catch (e) { + big_enough = true; + } + try { + testLiteral(size, true); + } catch (e) { + big_enough = true; + } + return big_enough; +} + +// Catch stack overflows. + +testLiteralAndCatch(1000) || +testLiteralAndCatch(20000) || +testLiteralAndCatch(200000); diff --git a/deps/v8/test/mjsunit/big-object-literal.js b/deps/v8/test/mjsunit/big-object-literal.js new file mode 100644 index 0000000000..0099ce9908 --- /dev/null +++ b/deps/v8/test/mjsunit/big-object-literal.js @@ -0,0 +1,114 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that we can make large object literals that work. +// Also test that we can attempt to make even larger object literals without +// crashing. +function testLiteral(size, array_in_middle) { + print(size); + + var f; + + // Build object-literal string. + var literal = "function f() { return "; + + for (var i = 0; i < size; i++) { + literal += "{a:"; + } + + literal += array_in_middle ? " [42.2]" : "{a:42.2}"; + + for (var i = 0; i < size; i++) { + literal += "}"; + if (i < size - 1) { + literal += ", b:42, c:/asd/, x:'foo', y:[], z:new Object()"; + } + } + + literal += "; }"; + + // Create the object literal. + eval(literal); + + var x = f(); + + // Check that the properties have the expected values. + for (var i = 0; i < size; i++) { + x = x.a; + } + + if (array_in_middle) { + assertEquals(42.2, x[0]), "x array in middle"; + x[0] = 41.2; + } else { + assertEquals(42.2, x.a, "x object in middle"); + x.a = 41.2; + } + + var y = f(); + for (var i = 0; i < size; i++) { + y = y.a; + } + + if (array_in_middle) { + assertEquals(42.2, y[0], "y array in middle"); + y[0] = 41.2; + } else { + assertEquals(42.2, y.a, "y object in middle"); + y.a = 41.2; + } +} + +// The sizes to test. +var sizes = [1, 2, 100, 200, 400]; + +// Run the test. +for (var i = 0; i < sizes.length; i++) { + testLiteral(sizes[i], false); + testLiteral(sizes[i], true); +} + +function testLiteralAndCatch(size) { + var big_enough = false; + try { + testLiteral(size, false); + } catch (e) { + big_enough = true; + } + try { + testLiteral(size, true); + } catch (e) { + big_enough = true; + } + return big_enough; +} + +// Catch stack overflows. + +testLiteralAndCatch(1000) || +testLiteralAndCatch(20000) || +testLiteralAndCatch(200000); diff --git a/deps/v8/test/mjsunit/binary-operation-overwrite.js b/deps/v8/test/mjsunit/binary-operation-overwrite.js new file mode 100644 index 0000000000..8d217c5806 --- /dev/null +++ b/deps/v8/test/mjsunit/binary-operation-overwrite.js @@ -0,0 +1,36 @@ +// Copyright 2008 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 that literals are not overwritten. +function f1() { return (1.2, 3.4) + 5.6; } +function f2() { return (1, 2) + 3; } +function f3() { return (1.2 || 3.4) + 5.6; } +function f4() { return (1 || 2) + 3; } +assertTrue(f1() === f1()); +assertTrue(f2() === f2()); +assertTrue(f3() === f3()); +assertTrue(f4() === f4()); diff --git a/deps/v8/test/mjsunit/body-not-visible.js b/deps/v8/test/mjsunit/body-not-visible.js new file mode 100644 index 0000000000..c681ab3dd9 --- /dev/null +++ b/deps/v8/test/mjsunit/body-not-visible.js @@ -0,0 +1,39 @@ +// Copyright 2008 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. + +// Make sure we cannot see the local variables in NewFunction when +// compiling functions using new Function(). + +var caught = false; +try { + (new Function("return body;"))(); + assertTrue(false); +} catch (e) { + caught = true; + assertTrue(e instanceof ReferenceError); +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/bugs/bug-1344252.js b/deps/v8/test/mjsunit/bugs/bug-1344252.js new file mode 100644 index 0000000000..1723834c09 --- /dev/null +++ b/deps/v8/test/mjsunit/bugs/bug-1344252.js @@ -0,0 +1,79 @@ +// Copyright 2008 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 setter accessors added to the prototype chain are called +// when setting properties. + +// Test that accessors added to the prototype chain are called +// eventhough there are inline caches for setting the property + +function F() { + this.x = 42; + this.y = 87; +} + +// Force the inline caches to monomorphic state. +new F(); new F(); + +// Add a setter for x to Object.prototype and make sure it gets +// called. +var result_x; +Object.prototype.__defineSetter__('x', function(value) { result_x = value; }); +var f = new F(); +assertEquals(42, result_x); +assertTrue(typeof f.x == 'undefined'); + +// Add a setter for y by changing the prototype of f and make sure +// that gets called too. +var result_y; +var proto = new Object(); +proto.__defineSetter__('y', function (value) { result_y = value; }); +var f = new F(); +f.y = undefined; +f.__proto__ = proto; +F.call(f); +assertEquals(87, result_y); +assertTrue(typeof f.y == 'undefined'); + + +// Test the same issue in the runtime system. Make sure that +// accessors added to the prototype chain are called instead of +// following map transitions. +// +// Create two objects. +var result_z; +var o1 = new Object(); +var o2 = new Object(); +// Add a z property to o1 to create a map transition. +o1.z = 32; +// Add a z accessor in the prototype chain for o1 and o2. +Object.prototype.__defineSetter__('z', function(value) { result_z = value; }); +// The accessor should be called for o2. +o2.z = 27; +assertEquals(27, result_z); +assertTrue(typeof o2.z == 'undefined'); + diff --git a/deps/v8/test/mjsunit/bugs/bug-222.js b/deps/v8/test/mjsunit/bugs/bug-222.js new file mode 100644 index 0000000000..0df7dd687e --- /dev/null +++ b/deps/v8/test/mjsunit/bugs/bug-222.js @@ -0,0 +1,42 @@ +// Copyright 2008 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 Foo(a, b) { } +Foo(); +var oldArgs = Foo.arguments; +Foo(); +var newArgs = Foo.arguments + +assertTrue(oldArgs !== newArgs); + +// Don't allow arguments to be overwritten. +Foo.arguments = oldArgs; +assertEquals(Foo.arguments, newArgs); + +// Don't allow arguments to be deleted. +assertFalse(delete Foo.arguments); +assertEquals(Foo.arguments, newArgs); diff --git a/deps/v8/test/mjsunit/bugs/bug-223.js b/deps/v8/test/mjsunit/bugs/bug-223.js new file mode 100644 index 0000000000..04b296b9bf --- /dev/null +++ b/deps/v8/test/mjsunit/bugs/bug-223.js @@ -0,0 +1,39 @@ +// Copyright 2008 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. + +// When calling user-defined functions on strings, booleans or +// numbers, we should create a wrapper object. + +function TypeOfThis() { return typeof this; } + +String.prototype.TypeOfThis = TypeOfThis; +Boolean.prototype.TypeOfThis = TypeOfThis; +Number.prototype.TypeOfThis = TypeOfThis; + +assertEquals('object', 'xxx'.TypeOfThis()); +assertEquals('object', true.TypeOfThis()); +assertEquals('object', (42).TypeOfThis()); diff --git a/deps/v8/test/mjsunit/bugs/bug-900066.js b/deps/v8/test/mjsunit/bugs/bug-900066.js new file mode 100644 index 0000000000..3b7cc3f2c7 --- /dev/null +++ b/deps/v8/test/mjsunit/bugs/bug-900066.js @@ -0,0 +1,38 @@ +// Copyright 2008 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. + +// When a property of the arguments array is deleted, it +// must be "disconnected" from the corresponding parameter. +// Re-introducing the property does not connect to the parameter. + +function f(x) { + delete arguments[0]; + arguments[0] = 100; + return x; +} + +assertEquals(10, f(10)); diff --git a/deps/v8/test/mjsunit/bugs/bug-941049.js b/deps/v8/test/mjsunit/bugs/bug-941049.js new file mode 100644 index 0000000000..f68c37a69f --- /dev/null +++ b/deps/v8/test/mjsunit/bugs/bug-941049.js @@ -0,0 +1,100 @@ +// Copyright 2008 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. + +// This test fails because we copy the arguments array on indirect +// access + +function g(f) { + assertEquals(100, f.arguments = 100); // read-only + assertEquals(3, f.arguments.length); + assertEquals(1, f.arguments[0]); + assertEquals(2, f.arguments[1]); + assertEquals(3, f.arguments[2]); + f.arguments[0] = 999; + f.arguments.extra = 'kallevip'; +} + +function h(f) { + assertEquals('kallevip', f.arguments.extra); + return f.arguments; +} + +// Test function with a materialized arguments array. +function f0() { + g(f0); + var result = h(f0); + var a = arguments; + assertEquals(999, a[0]); + return result; +} + + +// Test function without a materialized arguments array. +function f1(x) { + g(f1); + var result = h(f1); + assertEquals(999, x); + return result; +} + + +function test(f) { + assertTrue(null === f.arguments); + var args = f(1,2,3); + assertTrue(null === f.arguments); + + assertEquals(3, args.length); + assertEquals(999, args[0]); + assertEquals(2, args[1]); + assertEquals(3, args[2]); + assertEquals('kallevip', args.extra); +} + +test(f0); +test(f1); + + + + +function w() { + return q.arguments; +} + +function q(x, y) { + x = 2; + var result = w(); + y = 3; + return result; +} + +var a = q(0, 1); +// x is set locally *before* the last use of arguments before the +// activation of q is popped from the stack. +assertEquals(2, a[0]); +// y is set locally *after* the last use of arguments before the +// activation of q is popped from the stack. +assertEquals(1, a[1]); diff --git a/deps/v8/test/mjsunit/call-non-function-call.js b/deps/v8/test/mjsunit/call-non-function-call.js new file mode 100644 index 0000000000..6088fc3596 --- /dev/null +++ b/deps/v8/test/mjsunit/call-non-function-call.js @@ -0,0 +1,38 @@ +// Copyright 2008 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. + +// Throw exception when invoking Function.prototype.call with a +// non-function receiver. +var caught = false; +try { + Function.prototype.call.call({}); + assertTrue(false); +} catch (e) { + caught = true; + assertTrue(e instanceof TypeError); +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/call-non-function.js b/deps/v8/test/mjsunit/call-non-function.js new file mode 100644 index 0000000000..8ed5ccb201 --- /dev/null +++ b/deps/v8/test/mjsunit/call-non-function.js @@ -0,0 +1,54 @@ +// Copyright 2008 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 TryCall(x) { + var caught = []; + try { + x(); + } catch (e) { + caught.push(e); + } + + try { + new x(); + } catch (e) { + caught.push(e); + } + + assertTrue(caught[0] instanceof TypeError); + assertTrue(caught[1] instanceof TypeError); +}; + + +TryCall(this); +TryCall(Math); +TryCall(true); +TryCall(1234); +TryCall("hest"); + + + diff --git a/deps/v8/test/mjsunit/call.js b/deps/v8/test/mjsunit/call.js new file mode 100644 index 0000000000..b873d7d12d --- /dev/null +++ b/deps/v8/test/mjsunit/call.js @@ -0,0 +1,87 @@ +// Copyright 2008 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 f0() { + return this; +} + +assertTrue(this === f0.call(), "1"); + +assertTrue(this === f0.call(this), "w"); +assertTrue(this === f0.call(this, 1), "w"); +assertTrue(this === f0.call(this, 1, 2), "w"); + +assertTrue(this === f0.call(null), "3a"); +assertTrue(this === f0.call(null, 1), "3b"); +assertTrue(this === f0.call(null, 1, 2), "3c"); + +assertTrue(this === f0.call(void 0), "4a"); +assertTrue(this === f0.call(void 0, 1), "4b"); +assertTrue(this === f0.call(void 0, 1, 2), "4c"); + +var x = {}; +assertTrue(x === f0.call(x)); +assertTrue(x === f0.call(x, 1)); +assertTrue(x === f0.call(x, 1, 2)); + + +function f1(a) { + a = a || 'i'; + return this[a]; +} + +assertEquals(1, f1.call({i:1})); +assertEquals(42, f1.call({i:42}, 'i')); +assertEquals(87, f1.call({j:87}, 'j', 1)); +assertEquals(99, f1.call({k:99}, 'k', 1, 2)); + + +function f2(a, b) { + a = a || 'n'; + b = b || 2; + return this[a] + b; +} + +var x = {n: 1}; +assertEquals(3, f2.call(x)); +assertEquals(14, f2.call({i:12}, 'i')); +assertEquals(42, f2.call(x, 'n', 41)); +assertEquals(87, f2.call(x, 'n', 86, 1)); +assertEquals(99, f2.call(x, 'n', 98, 1, 2)); + + +function fn() { + return arguments.length; +} + +assertEquals(0, fn.call()); +assertEquals(0, fn.call(this)); +assertEquals(0, fn.call(null)); +assertEquals(0, fn.call(void 0)); +assertEquals(1, fn.call(this, 1)); +assertEquals(2, fn.call(this, 1, 2)); +assertEquals(3, fn.call(this, 1, 2, 3)); diff --git a/deps/v8/test/mjsunit/char-escape.js b/deps/v8/test/mjsunit/char-escape.js new file mode 100644 index 0000000000..a1b342977e --- /dev/null +++ b/deps/v8/test/mjsunit/char-escape.js @@ -0,0 +1,53 @@ +// Copyright 2008 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. + +// Check that character escapes are understood as one char +var escapes = ["\b", "\t", "\n", "\v", "\f", "\r", "\"", "\'", "\\", "\x4a", "\u005f"]; +for (var i = 0; i < escapes.length; i++) { + var str = escapes[i]; + assertEquals(1, str.length); + assertEquals(str, str.charAt(0)); +} + +function code(str) { + return str.charCodeAt(0); +} + +// Do the single escape chars have the right value? +assertEquals(0x08, code("\b")); +assertEquals(0x09, code("\t")); +assertEquals(0x0A, code("\n")); +assertEquals(0x0B, code("\v")); +assertEquals(0x0C, code("\f")); +assertEquals(0x0D, code("\r")); +assertEquals(0x22, code("\"")); +assertEquals(0x27, code("\'")); +assertEquals(0x5c, code("\\")); + +// Do the hex and unicode escape chars have the right value? +assertEquals(0x4a, code("\x4a")); +assertEquals(0x5f, code("\u005f")); diff --git a/deps/v8/test/mjsunit/class-of-builtins.js b/deps/v8/test/mjsunit/class-of-builtins.js new file mode 100644 index 0000000000..40c958c624 --- /dev/null +++ b/deps/v8/test/mjsunit/class-of-builtins.js @@ -0,0 +1,50 @@ +// Copyright 2008 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. + +// The [[Class]] property of (instances of) builtin functions must be +// correctly set. +var funs = { + Object: [ Object ], + Function: [ Function ], + Array: [ Array ], + String: [ String ], + Boolean: [ Boolean ], + Number: [ Number ], + Date: [ Date ], + RegExp: [ RegExp ], + Error: [ Error, TypeError, RangeError, SyntaxError, ReferenceError, EvalError, URIError ] +} +for (f in funs) { + for (i in funs[f]) { + assertEquals("[object " + f + "]", + Object.prototype.toString.call(new funs[f][i]), + funs[f][i]); + assertEquals("[object Function]", + Object.prototype.toString.call(funs[f][i]), + funs[f][i]); + } +} diff --git a/deps/v8/test/mjsunit/closure.js b/deps/v8/test/mjsunit/closure.js new file mode 100644 index 0000000000..b1460d39e6 --- /dev/null +++ b/deps/v8/test/mjsunit/closure.js @@ -0,0 +1,37 @@ +// Copyright 2008 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. + +// This test is lifted an old bug (ic_context_bug.js). + +function f(n) { + return function () { return n; } +} + +for (var i = 0; i < 10; i++) { + var a = f(i); + assertEquals(i, a()); +} diff --git a/deps/v8/test/mjsunit/compare-nan.js b/deps/v8/test/mjsunit/compare-nan.js new file mode 100644 index 0000000000..29818c83ce --- /dev/null +++ b/deps/v8/test/mjsunit/compare-nan.js @@ -0,0 +1,44 @@ +// Copyright 2008 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 = [NaN, -1, 0, 1, 1.2, -7.9, true, false, 'foo', '0', 'NaN' ]; +for (var i in a) { + var x = a[i]; + assertFalse(NaN == x); + assertFalse(NaN === x); + assertFalse(NaN < x); + assertFalse(NaN > x); + assertFalse(NaN <= x); + assertFalse(NaN >= x); + + assertFalse(x == NaN); + assertFalse(x === NaN); + assertFalse(x < NaN); + assertFalse(x > NaN); + assertFalse(x <= NaN); + assertFalse(x >= NaN); +} diff --git a/deps/v8/test/mjsunit/const-declaration.js b/deps/v8/test/mjsunit/const-declaration.js new file mode 100644 index 0000000000..48c0cf2717 --- /dev/null +++ b/deps/v8/test/mjsunit/const-declaration.js @@ -0,0 +1,172 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test handling of const variables in various settings. + +(function () { + function f() { + function g() { + x = 42; // should be ignored + return x; // force x into context + } + x = 43; // should be ignored + assertEquals(undefined, g()); + x = 44; // should be ignored + const x = 0; + x = 45; // should be ignored + assertEquals(0, g()); + } + f(); +})(); + + +(function () { + function f() { + function g() { + with ({foo: 0}) { + x = 42; // should be ignored + return x; // force x into context + } + } + x = 43; // should be ignored + assertEquals(undefined, g()); + x = 44; // should be ignored + const x = 0; + x = 45; // should be ignored + assertEquals(0, g()); + } + f(); +})(); + + +(function () { + function f() { + function g(s) { + eval(s); + return x; // force x into context + } + x = 43; // should be ignored + assertEquals(undefined, g("x = 42;")); + x = 44; // should be ignored + const x = 0; + x = 45; // should be ignored + assertEquals(0, g("x = 46;")); + } + f(); +})(); + + +(function () { + function f() { + function g(s) { + with ({foo: 0}) { + eval(s); + return x; // force x into context + } + } + x = 43; // should be ignored + assertEquals(undefined, g("x = 42;")); + x = 44; // should be ignored + const x = 0; + x = 45; // should be ignored + assertEquals(0, g("x = 46;")); + } + f(); +})(); + + +(function () { + function f(s) { + function g() { + x = 42; // assign to global x, or to const x + return x; + } + x = 43; // declare global x + assertEquals(42, g()); + x = 44; // assign to global x + eval(s); + x = 45; // should be ignored (assign to const x) + assertEquals(0, g()); + } + f("const x = 0;"); +})(); + + +(function () { + function f(s) { + function g() { + with ({foo: 0}) { + x = 42; // assign to global x, or to const x + return x; + } + } + x = 43; // declare global x + assertEquals(42, g()); + x = 44; // assign to global x + eval(s); + x = 45; // should be ignored (assign to const x) + assertEquals(0, g()); + } + f("const x = 0;"); +})(); + + +(function () { + function f(s) { + function g(s) { + eval(s); + return x; + } + x = 43; // declare global x + assertEquals(42, g("x = 42;")); + x = 44; // assign to global x + eval(s); + x = 45; // should be ignored (assign to const x) + assertEquals(0, g("x = 46;")); + } + f("const x = 0;"); +})(); + + +(function () { + function f(s) { + function g(s) { + with ({foo: 0}) { + eval(s); + return x; + } + } + x = 43; // declare global x + assertEquals(42, g("x = 42;")); + x = 44; // assign to global x + eval(s); + x = 45; // should be ignored (assign to const x) + assertEquals(0, g("x = 46;")); + } + f("const x = 0;"); +})(); + diff --git a/deps/v8/test/mjsunit/const-eval-init.js b/deps/v8/test/mjsunit/const-eval-init.js new file mode 100644 index 0000000000..d3636de7cc --- /dev/null +++ b/deps/v8/test/mjsunit/const-eval-init.js @@ -0,0 +1,111 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test the handling of initialization of deleted const variables. +// This only makes sense in local scopes since the declaration and +// initialization of consts in the global scope happen at the same +// time. + +function testIntroduceGlobal() { + var source = + // Deleting 'x' removes the local const property. + "delete x;" + + // Initialization turns into assignment to global 'x'. + "const x = 3; assertEquals(3, x);" + + // No constness of the global 'x'. + "x = 4; assertEquals(4, x);"; + eval(source); +} + +testIntroduceGlobal(); +assertEquals(4, x); + +function testAssignExistingGlobal() { + var source = + // Delete 'x' to remove the local const property. + "delete x;" + + // Initialization turns into assignment to global 'x'. + "const x = 5; assertEquals(5, x);" + + // No constness of the global 'x'. + "x = 6; assertEquals(6, x);"; + eval(source); +} + +testAssignExistingGlobal(); +assertEquals(6, x); + +function testAssignmentArgument(x) { + function local() { + var source = "delete x; const x = 7; assertEquals(7, x)"; + eval(source); + } + local(); + assertEquals(7, x); +} + +testAssignmentArgument(); +assertEquals(6, x); + +__defineSetter__('x', function() { throw 42; }); +function testAssignGlobalThrows() { + // Initialization turns into assignment to global 'x' which + // throws an exception. + var source = "delete x; const x = 8"; + eval(source); +} + +assertThrows("testAssignGlobalThrows()"); + +function testInitFastCaseExtension() { + var source = "const x = 9; assertEquals(9, x); x = 10; assertEquals(9, x)"; + eval(source); +} + +testInitFastCaseExtension(); + +function testInitSlowCaseExtension() { + var source = ""; + // Introduce 100 properties on the context extension object to force + // it in slow case. + for (var i = 0; i < 100; i++) source += ("var a" + i + " = i;"); + source += "const x = 10; assertEquals(10, x); x = 11; assertEquals(10, x)"; + eval(source); +} + +testInitSlowCaseExtension(); + +function testAssignSurroundingContextSlot() { + var x = 12; + function local() { + var source = "delete x; const x = 13; assertEquals(13, x)"; + eval(source); + } + local(); + assertEquals(13, x); +} + +testAssignSurroundingContextSlot(); diff --git a/deps/v8/test/mjsunit/const-redecl.js b/deps/v8/test/mjsunit/const-redecl.js new file mode 100644 index 0000000000..26d765b97a --- /dev/null +++ b/deps/v8/test/mjsunit/const-redecl.js @@ -0,0 +1,220 @@ +// Copyright 2008 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 for const semantics. + + +function CheckException(e) { + var string = e.toString(); + var index = string.indexOf(':'); + assertTrue(index >= 0); + var name = string.slice(0, index); + assertTrue(string.indexOf("has already been declared") >= 0 || + string.indexOf("redeclaration") >= 0); + if (name == 'SyntaxError') return 'TypeError'; + return name; +} + + +function TestLocal(s,e) { + try { + return eval("(function(){" + s + ";return " + e + "})")(); + } catch (x) { + return CheckException(x); + } +} + + +// NOTE: TestGlobal usually only tests the given string in the context +// of a global object in dictionary mode. This is because we use +// delete to get rid of any added properties. +function TestGlobal(s,e) { + // Collect the global properties before the call. + var properties = []; + for (var key in this) properties.push(key); + // Compute the result. + var result; + try { + var code = s + (e ? "; $$$result=" + e : ""); + if (this.execScript) { + execScript(code); + } else { + this.eval(code); + } + // Avoid issues if $$$result is not defined by + // reading it through this. + result = this.$$$result; + } catch (x) { + result = CheckException(x); + } + // Get rid of any introduced global properties before + // returning the result. + for (var key in this) { + if (properties.indexOf(key) == -1) delete this[key]; + } + return result; +} + + +function TestContext(s,e) { + try { + // Use a with-statement to force the system to do dynamic + // declarations of the introduced variables or constants. + with ({}) { + return eval(s + ";" + e); + } + } catch (x) { + return CheckException(x); + } +} + + +function TestAll(expected,s,opt_e) { + var e = ""; + var msg = s; + if (opt_e) { e = opt_e; msg += "; " + opt_e; } + assertEquals(expected, TestLocal(s,e), "local:'" + msg + "'"); + assertEquals(expected, TestGlobal(s,e), "global:'" + msg + "'"); + assertEquals(expected, TestContext(s,e), "context:'" + msg + "'"); +} + + +function TestConflict(def0, def1) { + // No eval. + TestAll("TypeError", def0 +'; ' + def1); + // Eval everything. + TestAll("TypeError", 'eval("' + def0 + '; ' + def1 + '")'); + // Eval first definition. + TestAll("TypeError", 'eval("' + def0 +'"); ' + def1); + // Eval second definition. + TestAll("TypeError", def0 + '; eval("' + def1 + '")'); + // Eval both definitions separately. + TestAll("TypeError", 'eval("' + def0 +'"); eval("' + def1 + '")'); +} + + +// Test conflicting definitions. +TestConflict("const x", "var x"); +TestConflict("const x = 0", "var x"); +TestConflict("const x", "var x = 0"); +TestConflict("const x = 0", "var x = 0"); + +TestConflict("var x", "const x"); +TestConflict("var x = 0", "const x"); +TestConflict("var x", "const x = 0"); +TestConflict("var x = 0", "const x = 0"); + +TestConflict("const x = undefined", "var x"); +TestConflict("const x", "var x = undefined"); +TestConflict("const x = undefined", "var x = undefined"); + +TestConflict("var x = undefined", "const x"); +TestConflict("var x", "const x = undefined"); +TestConflict("var x = undefined", "const x = undefined"); + +TestConflict("const x = undefined", "var x = 0"); +TestConflict("const x = 0", "var x = undefined"); + +TestConflict("var x = undefined", "const x = 0"); +TestConflict("var x = 0", "const x = undefined"); + +TestConflict("const x", "function x() { }"); +TestConflict("const x = 0", "function x() { }"); +TestConflict("const x = undefined", "function x() { }"); + +TestConflict("function x() { }", "const x"); +TestConflict("function x() { }", "const x = 0"); +TestConflict("function x() { }", "const x = undefined"); + +TestConflict("const x, y", "var x"); +TestConflict("const x, y", "var y"); +TestConflict("const x = 0, y", "var x"); +TestConflict("const x = 0, y", "var y"); +TestConflict("const x, y = 0", "var x"); +TestConflict("const x, y = 0", "var y"); +TestConflict("const x = 0, y = 0", "var x"); +TestConflict("const x = 0, y = 0", "var y"); + +TestConflict("var x", "const x, y"); +TestConflict("var y", "const x, y"); +TestConflict("var x", "const x = 0, y"); +TestConflict("var y", "const x = 0, y"); +TestConflict("var x", "const x, y = 0"); +TestConflict("var y", "const x, y = 0"); +TestConflict("var x", "const x = 0, y = 0"); +TestConflict("var y", "const x = 0, y = 0"); + + +// Test that multiple conflicts do not cause issues. +TestConflict("var x, y", "const x, y"); + + +// Test that repeated const declarations throw redeclaration errors. +TestConflict("const x", "const x"); +TestConflict("const x = 0", "const x"); +TestConflict("const x", "const x = 0"); +TestConflict("const x = 0", "const x = 0"); + +TestConflict("const x = undefined", "const x"); +TestConflict("const x", "const x = undefined"); +TestConflict("const x = undefined", "const x = undefined"); + +TestConflict("const x = undefined", "const x = 0"); +TestConflict("const x = 0", "const x = undefined"); + +TestConflict("const x, y", "const x"); +TestConflict("const x, y", "const y"); +TestConflict("const x = 0, y", "const x"); +TestConflict("const x = 0, y", "const y"); +TestConflict("const x, y = 0", "const x"); +TestConflict("const x, y = 0", "const y"); +TestConflict("const x = 0, y = 0", "const x"); +TestConflict("const x = 0, y = 0", "const y"); + +TestConflict("const x", "const x, y"); +TestConflict("const y", "const x, y"); +TestConflict("const x", "const x = 0, y"); +TestConflict("const y", "const x = 0, y"); +TestConflict("const x", "const x, y = 0"); +TestConflict("const y", "const x, y = 0"); +TestConflict("const x", "const x = 0, y = 0"); +TestConflict("const y", "const x = 0, y = 0"); + + +// Test that multiple const conflicts do not cause issues. +TestConflict("const x, y", "const x, y"); + + +// Test that const inside loop behaves correctly. +var loop = "for (var i = 0; i < 3; i++) { const x = i; }"; +TestAll(0, loop, "x"); +TestAll(0, "var a,b,c,d,e,f,g,h; " + loop, "x"); + + +// Test that const inside with behaves correctly. +TestAll(87, "with ({x:42}) { const x = 87; }", "x"); +TestAll(undefined, "with ({x:42}) { const x; }", "x"); diff --git a/deps/v8/test/mjsunit/const.js b/deps/v8/test/mjsunit/const.js new file mode 100644 index 0000000000..a48e82ded6 --- /dev/null +++ b/deps/v8/test/mjsunit/const.js @@ -0,0 +1,70 @@ +// Copyright 2008 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 const properties and pre/postfix operation. +function f() { + const x = 1; + x++; + assertEquals(1, x); + x--; + assertEquals(1, x); + ++x; + assertEquals(1, x); + --x; + assertEquals(1, x); + assertEquals(1, x++); + assertEquals(1, x--); + assertEquals(2, ++x); + assertEquals(0, --x); +} + +f(); + +// Test that the value is read eventhough assignment is disallowed. +// Spidermonkey does not do this, but it seems like the right thing to +// do so that 'o++' is equivalent to 'o = o + 1'. +var valueOfCount = 0; + +function g() { + const o = { valueOf: function() { valueOfCount++; return 42; } } + assertEquals(42, o); + assertEquals(1, valueOfCount); + o++; + assertEquals(42, o); + assertEquals(3, valueOfCount); + ++o; + assertEquals(42, o); + assertEquals(5, valueOfCount); + o--; + assertEquals(42, o); + assertEquals(7, valueOfCount); + --o; + assertEquals(42, o); + assertEquals(9, valueOfCount); +} + +g(); diff --git a/deps/v8/test/mjsunit/constant-folding.js b/deps/v8/test/mjsunit/constant-folding.js new file mode 100644 index 0000000000..41b632f7f4 --- /dev/null +++ b/deps/v8/test/mjsunit/constant-folding.js @@ -0,0 +1,171 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test operations that involve one or more constants. +// The code generator now handles compile-time constants specially. +// Test the code generated when operands are known at compile time + +// Test count operations involving constants +function test_count() { + var x = "foo"; + var y = "3"; + + x += x++; // ++ and -- apply ToNumber to their operand, even for postfix. + assertEquals(x, "fooNaN", "fooNaN test"); + x = "luft"; + x += ++x; + assertEquals(x, "luftNaN", "luftNaN test"); + + assertTrue(y++ === 3, "y++ === 3, where y = \"3\""); + y = 3; + assertEquals(y++, 3, "y++ == 3, where y = 3"); + y = "7.1"; + assertTrue(y++ === 7.1, "y++ === 7.1, where y = \"7.1\""); + var z = y = x = "9"; + assertEquals( z++ + (++y) + x++, 28, "z++ + (++y) + x++ == 28"); + z = y = x = 13; + assertEquals( z++ + (++y) + x++, 40, "z++ + (++y) + x++ == 40"); + z = y = x = -5.5; + assertEquals( z++ + (++y) + x++, -15.5, "z++ + (++y) + x++ == -15.5"); + + assertEquals(y, -4.5); + z = y; + z++; + assertEquals(y, -4.5); + z = y; + y++; + assertEquals(z, -4.5); + + y = 20; + z = y; + z++; + assertEquals(y, 20); + z = y; + y++; + assertEquals(z, 20); + + const w = 30; + assertEquals(w++, 30); + assertEquals(++w, 31); + assertEquals(++w, 31); +} + +test_count(); + +// Test comparison operations that involve one or two constant smis. + +function test() { + var i = 5; + var j = 3; + + assertTrue( j < i ); + i = 5; j = 3; + assertTrue( j <= i ); + i = 5; j = 3; + assertTrue( i > j ); + i = 5; j = 3; + assertTrue( i >= j ); + i = 5; j = 3; + assertTrue( i != j ); + i = 5; j = 3; + assertTrue( i == i ); + i = 5; j = 3; + assertFalse( i < j ); + i = 5; j = 3; + assertFalse( i <= j ); + i = 5; j = 3; + assertFalse( j > i ); + i = 5; j = 3; + assertFalse(j >= i ); + i = 5; j = 3; + assertFalse( j == i); + i = 5; j = 3; + assertFalse( i != i); + + i = 10 * 10; + while ( i < 107 ) { + ++i; + } + j = 21; + + assertTrue( j < i ); + j = 21; + assertTrue( j <= i ); + j = 21; + assertTrue( i > j ); + j = 21; + assertTrue( i >= j ); + j = 21; + assertTrue( i != j ); + j = 21; + assertTrue( i == i ); + j = 21; + assertFalse( i < j ); + j = 21; + assertFalse( i <= j ); + j = 21; + assertFalse( j > i ); + j = 21; + assertFalse(j >= i ); + j = 21; + assertFalse( j == i); + j = 21; + assertFalse( i != i); + j = 21; + assertTrue( j == j ); + j = 21; + assertFalse( j != j ); + + assertTrue( 100 > 99 ); + assertTrue( 101 >= 90 ); + assertTrue( 11111 > -234 ); + assertTrue( -888 <= -20 ); + + while ( 234 > 456 ) { + i = i + 1; + } + + switch(3) { + case 5: + assertUnreachable(); + break; + case 3: + j = 13; + default: + i = 2; + case 7: + j = 17; + break; + case 9: + j = 19; + assertUnreachable(); + break; + } + assertEquals(17, j, "switch with constant value"); +} + +test(); diff --git a/deps/v8/test/mjsunit/context-variable-assignments.js b/deps/v8/test/mjsunit/context-variable-assignments.js new file mode 100644 index 0000000000..930b969609 --- /dev/null +++ b/deps/v8/test/mjsunit/context-variable-assignments.js @@ -0,0 +1,37 @@ +// Copyright 2008 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 foo() { + var a, b; + var bar = function() { + a = b = "hello world"; + } + bar(); + return a; +} + +assertEquals("hello world", foo()); diff --git a/deps/v8/test/mjsunit/cyclic-array-to-string.js b/deps/v8/test/mjsunit/cyclic-array-to-string.js new file mode 100644 index 0000000000..0a2d6e379e --- /dev/null +++ b/deps/v8/test/mjsunit/cyclic-array-to-string.js @@ -0,0 +1,65 @@ +// Copyright 2008 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 printing of cyclic arrays. + +var a1 = [1,2]; +assertEquals("1,2", a1.toString()); +assertEquals("1,2", a1.toLocaleString()); +assertEquals("1,2", a1.join()); +a1.push(a1); +assertEquals("1,2,", a1.toString()); +assertEquals("1,2,", a1.toLocaleString()); +assertEquals("1,2,", a1.join()); +a1.push(1); +assertEquals("1,2,,1", a1.toString()); +assertEquals("1,2,,1", a1.toLocaleString()); +assertEquals("1,2,,1", a1.join()); +a1.push(a1); +assertEquals("1,2,,1,", a1.toString()); +assertEquals("1,2,,1,", a1.toLocaleString()); +assertEquals("1,2,,1,", a1.join()); + +a1 = [1,2]; +var a2 = [3,4]; +a1.push(a2); +a1.push(a2); +assertEquals("1,2,3,4,3,4", a1.toString()); +assertEquals("1,2,3,4,3,4", a1.toLocaleString()); +assertEquals("1,2,3,4,3,4", a1.join()); +a2.push(a1); +assertEquals("1,2,3,4,,3,4,", a1.toString()); +assertEquals("1,2,3,4,,3,4,", a1.toLocaleString()); +assertEquals("1,2,3,4,,3,4,", a1.join()); + +a1 = []; +a2 = [a1]; +a1.push(a2); +assertEquals("", a1.toString()); +assertEquals("", a1.toLocaleString()); +assertEquals("", a1.join()); + diff --git a/deps/v8/test/mjsunit/d8-os.js b/deps/v8/test/mjsunit/d8-os.js new file mode 100644 index 0000000000..630a39e966 --- /dev/null +++ b/deps/v8/test/mjsunit/d8-os.js @@ -0,0 +1,180 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test the OS module of d8. This test only makes sense with d8. It +// only does non-trivial work on Unix since os.system() is not currently +// implemented on Windows, and even if it were then many of the things +// we are calling would not be available. + +function arg_error(str) { + try { + eval(str); + } catch (e) { + assertTrue(/rgument/.test(e), str); + } +} + + +function str_error(str) { + var e = new Object(); + e.toString = function() { throw new Error("foo bar"); } + try { + eval(str); + } catch (exception) { + assertTrue(/tring conversion/.test(exception), str); + } +} + + +if (this.os && os.system) { + try { + // Delete the dir if it is lying around from last time. + os.system("ls", ["d8-os-test-directory"]); + os.system("rm", ["-r", "d8-os-test-directory"]); + } catch (e) { + } + os.mkdirp("d8-os-test-directory"); + os.chdir("d8-os-test-directory"); + // Check the chdir worked. + os.system('ls', ['../d8-os-test-directory']); + // Simple create dir. + os.mkdirp("dir"); + // Create dir in dir. + os.mkdirp("dir/foo"); + // Check that they are there. + os.system('ls', ['dir/foo']); + // Check that we can detect when something is not there. + assertThrows("os.system('ls', ['dir/bar']);", "dir not there"); + // Check that mkdirp makes intermediate directories. + os.mkdirp("dir2/foo"); + os.system("ls", ["dir2/foo"]); + // Check that mkdirp doesn't mind if the dir is already there. + os.mkdirp("dir2/foo"); + os.mkdirp("dir2/foo/"); + // Check that mkdirp can cope with trailing / + os.mkdirp("dir3/"); + os.system("ls", ["dir3"]); + // Check that we get an error if the name is taken by a file. + os.system("sh", ["-c", "echo foo > file1"]); + os.system("ls", ["file1"]); + assertThrows("os.mkdirp('file1');", "mkdir over file1"); + assertThrows("os.mkdirp('file1/foo');", "mkdir over file2"); + assertThrows("os.mkdirp('file1/');", "mkdir over file3"); + assertThrows("os.mkdirp('file1/foo/');", "mkdir over file4"); + // Create a dir we cannot read. + os.mkdirp("dir4", 0); + // This test fails if you are root since root can read any dir. + assertThrows("os.chdir('dir4');", "chdir dir4 I"); + os.rmdir("dir4"); + assertThrows("os.chdir('dir4');", "chdir dir4 II"); + // Set umask. + var old_umask = os.umask(0777); + // Create a dir we cannot read. + os.mkdirp("dir5"); + // This test fails if you are root since root can read any dir. + assertThrows("os.chdir('dir5');", "cd dir5 I"); + os.rmdir("dir5"); + assertThrows("os.chdir('dir5');", "chdir dir5 II"); + os.umask(old_umask); + + os.mkdirp("hest/fisk/../fisk/ged"); + os.system("ls", ["hest/fisk/ged"]); + + os.setenv("FOO", "bar"); + var environment = os.system("printenv"); + assertTrue(/FOO=bar/.test(environment)); + + // Check we time out. + var have_sleep = true; + var have_echo = true; + try { + os.system("ls", ["/bin/sleep"]); + } catch (e) { + have_sleep = false; + } + try { + os.system("ls", ["/bin/echo"]); + } catch (e) { + have_echo = false; + } + if (have_sleep) { + assertThrows("os.system('sleep', ['2000'], 200);", "sleep 1"); + + // Check we time out with total time. + assertThrows("os.system('sleep', ['2000'], -1, 200);", "sleep 2"); + + // Check that -1 means no timeout. + os.system('sleep', ['1'], -1, -1); + + } + + // Check that we don't fill up the process table with zombies. + // Disabled because it's too slow. + if (have_echo) { + //for (var i = 0; i < 65536; i++) { + assertEquals("baz\n", os.system("echo", ["baz"])); + //} + } + + os.chdir(".."); + os.system("rm", ["-r", "d8-os-test-directory"]); + + // Too few args. + arg_error("os.umask();"); + arg_error("os.system();"); + arg_error("os.mkdirp();"); + arg_error("os.chdir();"); + arg_error("os.setenv();"); + arg_error("os.rmdir();"); + + // Too many args. + arg_error("os.setenv('FOO=bar');"); + arg_error("os.umask(0, 0);"); + arg_error("os.system('ls', [], -1, -1, -1);"); + arg_error("os.mkdirp('foo', 0, 0)"); + arg_error("os.chdir('foo', 'bar')"); + arg_error("os.rmdir('foo', 'bar');"); + + // Wrong kind of args. + arg_error("os.umask([]);"); + arg_error("os.system('ls', 'foo');"); + arg_error("os.system('ls', 123);"); + arg_error("os.system('ls', [], 'foo');"); + arg_error("os.system('ls', [], -1, 'foo');"); + arg_error("os.mkdirp('foo', 'bar');"); + + // Test broken toString(). + str_error("os.system(e);"); + str_error("os.system('ls', [e]);"); + str_error("os.system('ls', ['.', e]);"); + str_error("os.system('ls', [e, '.']);"); + str_error("os.mkdirp(e);"); + str_error("os.setenv(e, 'goo');"); + str_error("os.setenv('goo', e);"); + str_error("os.chdir(e);"); + str_error("os.rmdir(e);"); +} diff --git a/deps/v8/test/mjsunit/date-parse.js b/deps/v8/test/mjsunit/date-parse.js new file mode 100644 index 0000000000..446472730f --- /dev/null +++ b/deps/v8/test/mjsunit/date-parse.js @@ -0,0 +1,268 @@ +// Copyright 2008 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 we can parse dates in all the different formats that we +// have to support. +// +// These formats are all supported by KJS but a lot of them are not +// supported by Spidermonkey. + +function testDateParse(string) { + var d = Date.parse(string); + assertEquals(946713600000, d, string); +}; + + +// For local time we just test that parsing returns non-NaN positive +// number of milliseconds to make it timezone independent. +function testDateParseLocalTime(string) { + var d = Date.parse(string); + assertTrue(!isNaN(d), string + " is NaN."); + assertTrue(d > 0, string + " <= 0."); +}; + + +function testDateParseMisc(array) { + assertEquals(2, array.length, "array [" + array + "] length != 2."); + var string = array[0]; + var expected = array[1]; + var d = Date.parse(string); + assertEquals(expected, d, string); +} + + +// +// Test all the formats in UT timezone. +// +var testCasesUT = [ + 'Sat, 01-Jan-2000 08:00:00 UT', + 'Sat, 01 Jan 2000 08:00:00 UT', + 'Jan 01 2000 08:00:00 UT', + 'Jan 01 08:00:00 UT 2000', + 'Saturday, 01-Jan-00 08:00:00 UT', + '01 Jan 00 08:00 +0000', + // Ignore weekdays. + 'Mon, 01 Jan 2000 08:00:00 UT', + 'Tue, 01 Jan 2000 08:00:00 UT', + // Ignore prefix that is not part of a date. + '[Saturday] Jan 01 08:00:00 UT 2000', + 'Ignore all of this stuff because it is annoying 01 Jan 2000 08:00:00 UT', + '[Saturday] Jan 01 2000 08:00:00 UT', + 'All of this stuff is really annnoying, so it will be ignored Jan 01 2000 08:00:00 UT', + // If the three first letters of the month is a + // month name we are happy - ignore the rest. + 'Sat, 01-Janisamonth-2000 08:00:00 UT', + 'Sat, 01 Janisamonth 2000 08:00:00 UT', + 'Janisamonth 01 2000 08:00:00 UT', + 'Janisamonth 01 08:00:00 UT 2000', + 'Saturday, 01-Janisamonth-00 08:00:00 UT', + '01 Janisamonth 00 08:00 +0000', + // Allow missing space between month and day. + 'Janisamonthandtherestisignored01 2000 08:00:00 UT', + 'Jan01 2000 08:00:00 UT', + // Allow year/month/day format. + 'Sat, 2000/01/01 08:00:00 UT', + // Allow month/day/year format. + 'Sat, 01/01/2000 08:00:00 UT', + // Allow month/day year format. + 'Sat, 01/01 2000 08:00:00 UT', + // Allow comma instead of space after day, month and year. + 'Sat, 01,Jan,2000,08:00:00 UT', + // Seconds are optional. + 'Sat, 01-Jan-2000 08:00 UT', + 'Sat, 01 Jan 2000 08:00 UT', + 'Jan 01 2000 08:00 UT', + 'Jan 01 08:00 UT 2000', + 'Saturday, 01-Jan-00 08:00 UT', + '01 Jan 00 08:00 +0000', + // Allow AM/PM after the time. + 'Sat, 01-Jan-2000 08:00 AM UT', + 'Sat, 01 Jan 2000 08:00 AM UT', + 'Jan 01 2000 08:00 AM UT', + 'Jan 01 08:00 AM UT 2000', + 'Saturday, 01-Jan-00 08:00 AM UT', + '01 Jan 00 08:00 AM +0000', + // White space and stuff in parenthesis is + // apparently allowed in most places where white + // space is allowed. + ' Sat, 01-Jan-2000 08:00:00 UT ', + ' Sat, 01 Jan 2000 08:00:00 UT ', + ' Saturday, 01-Jan-00 08:00:00 UT ', + ' 01 Jan 00 08:00 +0000 ', + ' ()(Sat, 01-Jan-2000) Sat, 01-Jan-2000 08:00:00 UT ', + ' Sat()(Sat, 01-Jan-2000)01 Jan 2000 08:00:00 UT ', + ' Sat,(02)01 Jan 2000 08:00:00 UT ', + ' Sat, 01(02)Jan 2000 08:00:00 UT ', + ' Sat, 01 Jan 2000 (2001)08:00:00 UT ', + ' Sat, 01 Jan 2000 (01)08:00:00 UT ', + ' Sat, 01 Jan 2000 (01:00:00)08:00:00 UT ', + ' Sat, 01 Jan 2000 08:00:00 (CDT)UT ', + ' Sat, 01 Jan 2000 08:00:00 UT((((CDT))))', + ' Saturday, 01-Jan-00 ()(((asfd)))(Sat, 01-Jan-2000)08:00:00 UT ', + ' 01 Jan 00 08:00 ()(((asdf)))(Sat, 01-Jan-2000)+0000 ', + ' 01 Jan 00 08:00 +0000()((asfd)(Sat, 01-Jan-2000)) ']; + +// +// Test that we do the right correction for different time zones. +// I'll assume that we can handle the same formats as for UT and only +// test a few formats for each of the timezones. +// + +// GMT = UT +var testCasesGMT = [ + 'Sat, 01-Jan-2000 08:00:00 GMT', + 'Sat, 01-Jan-2000 08:00:00 GMT+0', + 'Sat, 01-Jan-2000 08:00:00 GMT+00', + 'Sat, 01-Jan-2000 08:00:00 GMT+000', + 'Sat, 01-Jan-2000 08:00:00 GMT+0000', + 'Sat, 01-Jan-2000 08:00:00 GMT+00:00', // Interestingly, KJS cannot handle this. + 'Sat, 01 Jan 2000 08:00:00 GMT', + 'Saturday, 01-Jan-00 08:00:00 GMT', + '01 Jan 00 08:00 -0000', + '01 Jan 00 08:00 +0000']; + +// EST = UT minus 5 hours. +var testCasesEST = [ + 'Sat, 01-Jan-2000 03:00:00 UTC-0500', + 'Sat, 01-Jan-2000 03:00:00 UTC-05:00', // Interestingly, KJS cannot handle this. + 'Sat, 01-Jan-2000 03:00:00 EST', + 'Sat, 01 Jan 2000 03:00:00 EST', + 'Saturday, 01-Jan-00 03:00:00 EST', + '01 Jan 00 03:00 -0500']; + +// EDT = UT minus 4 hours. +var testCasesEDT = [ + 'Sat, 01-Jan-2000 04:00:00 EDT', + 'Sat, 01 Jan 2000 04:00:00 EDT', + 'Saturday, 01-Jan-00 04:00:00 EDT', + '01 Jan 00 04:00 -0400']; + +// CST = UT minus 6 hours. +var testCasesCST = [ + 'Sat, 01-Jan-2000 02:00:00 CST', + 'Sat, 01 Jan 2000 02:00:00 CST', + 'Saturday, 01-Jan-00 02:00:00 CST', + '01 Jan 00 02:00 -0600']; + +// CDT = UT minus 5 hours. +var testCasesCDT = [ + 'Sat, 01-Jan-2000 03:00:00 CDT', + 'Sat, 01 Jan 2000 03:00:00 CDT', + 'Saturday, 01-Jan-00 03:00:00 CDT', + '01 Jan 00 03:00 -0500']; + +// MST = UT minus 7 hours. +var testCasesMST = [ + 'Sat, 01-Jan-2000 01:00:00 MST', + 'Sat, 01 Jan 2000 01:00:00 MST', + 'Saturday, 01-Jan-00 01:00:00 MST', + '01 Jan 00 01:00 -0700']; + +// MDT = UT minus 6 hours. +var testCasesMDT = [ + 'Sat, 01-Jan-2000 02:00:00 MDT', + 'Sat, 01 Jan 2000 02:00:00 MDT', + 'Saturday, 01-Jan-00 02:00:00 MDT', + '01 Jan 00 02:00 -0600']; + +// PST = UT minus 8 hours. +var testCasesPST = [ + 'Sat, 01-Jan-2000 00:00:00 PST', + 'Sat, 01 Jan 2000 00:00:00 PST', + 'Saturday, 01-Jan-00 00:00:00 PST', + '01 Jan 00 00:00 -0800', + // Allow missing time. + 'Sat, 01-Jan-2000 PST']; + +// PDT = UT minus 7 hours. +var testCasesPDT = [ + 'Sat, 01-Jan-2000 01:00:00 PDT', + 'Sat, 01 Jan 2000 01:00:00 PDT', + 'Saturday, 01-Jan-00 01:00:00 PDT', + '01 Jan 00 01:00 -0700']; + + +// Local time cases. +var testCasesLocalTime = [ + // Allow timezone ommision. + 'Sat, 01-Jan-2000 08:00:00', + 'Sat, 01 Jan 2000 08:00:00', + 'Jan 01 2000 08:00:00', + 'Jan 01 08:00:00 2000', + 'Saturday, 01-Jan-00 08:00:00', + '01 Jan 00 08:00']; + + +// Misc. test cases that result in a different time value. +var testCasesMisc = [ + // Special handling for years in the [0, 100) range. + ['Sat, 01 Jan 0 08:00:00 UT', 946713600000], // year 2000 + ['Sat, 01 Jan 49 08:00:00 UT', 2493100800000], // year 2049 + ['Sat, 01 Jan 50 08:00:00 UT', -631123200000], // year 1950 + ['Sat, 01 Jan 99 08:00:00 UT', 915177600000], // year 1999 + ['Sat, 01 Jan 100 08:00:00 UT', -59011430400000], // year 100 + // Test PM after time. + ['Sat, 01-Jan-2000 08:00 PM UT', 946756800000], + ['Sat, 01 Jan 2000 08:00 PM UT', 946756800000], + ['Jan 01 2000 08:00 PM UT', 946756800000], + ['Jan 01 08:00 PM UT 2000', 946756800000], + ['Saturday, 01-Jan-00 08:00 PM UT', 946756800000], + ['01 Jan 00 08:00 PM +0000', 946756800000]]; + + +// Run all the tests. +testCasesUT.forEach(testDateParse); +testCasesGMT.forEach(testDateParse); +testCasesEST.forEach(testDateParse); +testCasesEDT.forEach(testDateParse); +testCasesCST.forEach(testDateParse); +testCasesCDT.forEach(testDateParse); +testCasesMST.forEach(testDateParse); +testCasesMDT.forEach(testDateParse); +testCasesPST.forEach(testDateParse); +testCasesPDT.forEach(testDateParse); +testCasesLocalTime.forEach(testDateParseLocalTime); +testCasesMisc.forEach(testDateParseMisc); + + +// Test that we can parse our own date format. +// (Dates from 1970 to ~2070 with 95h steps.) +for (var i = 0; i < 24 * 365 * 100; i += 95) { + var ms = i * (3600 * 1000); + var s = (new Date(ms)).toString(); + assertEquals(ms, Date.parse(s), s); +} + +// Negative tests. +var testCasesNegative = [ + 'May 25 2008 1:30 (PM)) UTC', + 'May 25 2008 1:30( )AM (PM)', + 'May 25 2008 AAA (GMT)']; + +testCasesNegative.forEach(function (s) { + assertTrue(isNaN(Date.parse(s)), s + " is not NaN."); +}); diff --git a/deps/v8/test/mjsunit/date.js b/deps/v8/test/mjsunit/date.js new file mode 100644 index 0000000000..8c53910c17 --- /dev/null +++ b/deps/v8/test/mjsunit/date.js @@ -0,0 +1,149 @@ +// Copyright 2008 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 date construction from other dates. +var date0 = new Date(1111); +var date1 = new Date(date0); +assertEquals(1111, date0.getTime()); +assertEquals(date0.getTime(), date1.getTime()); +var date2 = new Date(date0.toString()); +assertEquals(1000, date2.getTime()); + +// Test that dates may contain commas. +var date0 = Date.parse("Dec 25 1995 1:30"); +var date1 = Date.parse("Dec 25, 1995 1:30"); +var date2 = Date.parse("Dec 25 1995, 1:30"); +var date3 = Date.parse("Dec 25, 1995, 1:30"); +assertEquals(date0, date1); +assertEquals(date1, date2); +assertEquals(date2, date3); + +// Test limits (+/-1e8 days from epoch) + +var dMax = new Date(8.64e15); +assertEquals(8.64e15, dMax.getTime()); + +var dOverflow = new Date(8.64e15+1); +assertTrue(isNaN(dOverflow.getTime())); + +var dMin = new Date(-8.64e15); +assertEquals(-8.64e15, dMin.getTime()); + +var dUnderflow = new Date(-8.64e15-1); +assertTrue(isNaN(dUnderflow.getTime())); + + +// Tests inspired by js1_5/Date/regress-346363.js + +// Year +var a = new Date(); +a.setFullYear(); +a.setFullYear(2006); +assertEquals(2006, a.getFullYear()); + +var b = new Date(); +b.setUTCFullYear(); +b.setUTCFullYear(2006); +assertEquals(2006, b.getUTCFullYear()); + +// Month +var c = new Date(); +c.setMonth(); +c.setMonth(2); +assertTrue(isNaN(c.getMonth())); + +var d = new Date(); +d.setUTCMonth(); +d.setUTCMonth(2); +assertTrue(isNaN(d.getUTCMonth())); + +// Date +var e = new Date(); +e.setDate(); +e.setDate(2); +assertTrue(isNaN(e.getDate())); + +var f = new Date(); +f.setUTCDate(); +f.setUTCDate(2); +assertTrue(isNaN(f.getUTCDate())); + +// Hours +var g = new Date(); +g.setHours(); +g.setHours(2); +assertTrue(isNaN(g.getHours())); + +var h = new Date(); +h.setUTCHours(); +h.setUTCHours(2); +assertTrue(isNaN(h.getUTCHours())); + +// Minutes +var g = new Date(); +g.setMinutes(); +g.setMinutes(2); +assertTrue(isNaN(g.getMinutes())); + +var h = new Date(); +h.setUTCHours(); +h.setUTCHours(2); +assertTrue(isNaN(h.getUTCHours())); + + +// Seconds +var i = new Date(); +i.setSeconds(); +i.setSeconds(2); +assertTrue(isNaN(i.getSeconds())); + +var j = new Date(); +j.setUTCSeconds(); +j.setUTCSeconds(2); +assertTrue(isNaN(j.getUTCSeconds())); + + +// Milliseconds +var k = new Date(); +k.setMilliseconds(); +k.setMilliseconds(2); +assertTrue(isNaN(k.getMilliseconds())); + +var l = new Date(); +l.setUTCMilliseconds(); +l.setUTCMilliseconds(2); +assertTrue(isNaN(l.getUTCMilliseconds())); + +// Test that toLocaleTimeString only returns the time portion of the +// date without the timezone information. +function testToLocaleTimeString() { + var d = new Date(); + var s = d.toLocaleTimeString(); + assertEquals(8, s.length); +} + +testToLocaleTimeString(); diff --git a/deps/v8/test/mjsunit/debug-backtrace-text.js b/deps/v8/test/mjsunit/debug-backtrace-text.js new file mode 100644 index 0000000000..67c674667b --- /dev/null +++ b/deps/v8/test/mjsunit/debug-backtrace-text.js @@ -0,0 +1,122 @@ +// Copyright 2008 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 + +// The functions used for testing backtraces. +function Point(x, y) { + this.x = x; + this.y = y; +}; + +Point.prototype.distanceTo = function(p) { + debugger; + return Math.sqrt(Math.pow(Math.abs(this.x - p.x), 2) + Math.pow(Math.abs(this.y - p.y), 2)) +} + +p1 = new Point(1,1); +p2 = new Point(2,2); + +p1.distanceTo = function(p) { + return p.distanceTo(this); +} + +function distance(p, q) { + return p.distanceTo(q); +} + +function createPoint(x, y) { + return new Point(x, y); +} + +a=[1,2,distance]; + +// Get the Debug object exposed from the debug context global object. +Debug = debug.Debug + +testConstructor = false; // Flag to control which part of the test is run. +listenerCalled = false; +exception = false; + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + return undefined; + } +} + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) + { + if (!testConstructor) { + // The expected backtrace is + // 0: Call distance on Point where distance is a property on the prototype + // 1: Call distance on Point where distance is a direct property + // 2: Call on function an array element 2 + // 3: [anonymous] + assertEquals("#<a Point>.distanceTo(p=#<a Point>)", exec_state.frame(0).invocationText()); + assertEquals("#<a Point>.distanceTo(p=#<a Point>)", exec_state.frame(1).invocationText()); + assertEquals("#<an Array>[2](aka distance)(p=#<a Point>, q=#<a Point>)", exec_state.frame(2).invocationText()); + assertEquals("[anonymous]()", exec_state.frame(3).invocationText()); + listenerCalled = true; + } else { + // The expected backtrace is + // 0: Call Point constructor + // 1: Call on global function createPoint + // 2: [anonymous] + assertEquals("new Point(x=0, y=0)", exec_state.frame(0).invocationText()); + assertEquals("createPoint(x=0, y=0)", exec_state.frame(1).invocationText()); + assertEquals("[anonymous]()", exec_state.frame(2).invocationText()); + listenerCalled = true; + } + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Set a break point and call to invoke the debug event listener. +a[2](p1, p2) + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerCalled); +assertFalse(exception, "exception in listener") + +// Set a break point and call to invoke the debug event listener. +listenerCalled = false; +testConstructor = true; +Debug.setBreakPoint(Point, 0, 0); +createPoint(0, 0); + +// Make sure that the debug event listener vas invoked (again). +assertTrue(listenerCalled); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-backtrace.js b/deps/v8/test/mjsunit/debug-backtrace.js new file mode 100644 index 0000000000..940c4cb4b8 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-backtrace.js @@ -0,0 +1,227 @@ +// Copyright 2008 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 +// The functions used for testing backtraces. They are at the top to make the +// testing of source line/column easier. +function f(x, y) { + a=1; +}; + +function g() { + new f(1); +}; + + +// Get the Debug object exposed from the debug context global object. +Debug = debug.Debug + +listenerCalled = false; +exception = false; + + +function ParsedResponse(json) { + this.response_ = eval('(' + json + ')'); + this.refs_ = []; + if (this.response_.refs) { + for (var i = 0; i < this.response_.refs.length; i++) { + this.refs_[this.response_.refs[i].handle] = this.response_.refs[i]; + } + } +} + + +ParsedResponse.prototype.response = function() { + return this.response_; +} + + +ParsedResponse.prototype.body = function() { + return this.response_.body; +} + + +ParsedResponse.prototype.lookup = function(handle) { + return this.refs_[handle]; +} + + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) + { + // The expected backtrace is + // 0: f + // 1: g + // 2: [anonymous] + + var response; + var backtrace; + var frame; + var source; + + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Get the backtrace. + var json; + json = '{"seq":0,"type":"request","command":"backtrace"}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + backtrace = response.body(); + assertEquals(0, backtrace.fromFrame); + assertEquals(3, backtrace.toFrame); + assertEquals(3, backtrace.totalFrames); + var frames = backtrace.frames; + assertEquals(3, frames.length); + for (var i = 0; i < frames.length; i++) { + assertEquals('frame', frames[i].type); + } + assertEquals(0, frames[0].index); + assertEquals("f", response.lookup(frames[0].func.ref).name); + assertEquals(1, frames[1].index); + assertEquals("g", response.lookup(frames[1].func.ref).name); + assertEquals(2, frames[2].index); + assertEquals("", response.lookup(frames[2].func.ref).name); + + // Get backtrace with two frames. + json = '{"seq":0,"type":"request","command":"backtrace","arguments":{"fromFrame":1,"toFrame":3}}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + backtrace = response.body(); + assertEquals(1, backtrace.fromFrame); + assertEquals(3, backtrace.toFrame); + assertEquals(3, backtrace.totalFrames); + var frames = backtrace.frames; + assertEquals(2, frames.length); + for (var i = 0; i < frames.length; i++) { + assertEquals('frame', frames[i].type); + } + assertEquals(1, frames[0].index); + assertEquals("g", response.lookup(frames[0].func.ref).name); + assertEquals(2, frames[1].index); + assertEquals("", response.lookup(frames[1].func.ref).name); + + // Get the individual frames. + json = '{"seq":0,"type":"request","command":"frame"}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + frame = response.body(); + assertEquals(0, frame.index); + assertEquals("f", response.lookup(frame.func.ref).name); + assertTrue(frame.constructCall); + assertEquals(31, frame.line); + assertEquals(3, frame.column); + assertEquals(2, frame.arguments.length); + assertEquals('x', frame.arguments[0].name); + assertEquals('number', response.lookup(frame.arguments[0].value.ref).type); + assertEquals(1, response.lookup(frame.arguments[0].value.ref).value); + assertEquals('y', frame.arguments[1].name); + assertEquals('undefined', response.lookup(frame.arguments[1].value.ref).type); + + json = '{"seq":0,"type":"request","command":"frame","arguments":{"number":0}}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + frame = response.body(); + assertEquals(0, frame.index); + assertEquals("f", response.lookup(frame.func.ref).name); + assertEquals(31, frame.line); + assertEquals(3, frame.column); + assertEquals(2, frame.arguments.length); + assertEquals('x', frame.arguments[0].name); + assertEquals('number', response.lookup(frame.arguments[0].value.ref).type); + assertEquals(1, response.lookup(frame.arguments[0].value.ref).value); + assertEquals('y', frame.arguments[1].name); + assertEquals('undefined', response.lookup(frame.arguments[1].value.ref).type); + + json = '{"seq":0,"type":"request","command":"frame","arguments":{"number":1}}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + frame = response.body(); + assertEquals(1, frame.index); + assertEquals("g", response.lookup(frame.func.ref).name); + assertFalse(frame.constructCall); + assertEquals(35, frame.line); + assertEquals(2, frame.column); + assertEquals(0, frame.arguments.length); + + json = '{"seq":0,"type":"request","command":"frame","arguments":{"number":2}}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + frame = response.body(); + assertEquals(2, frame.index); + assertEquals("", response.lookup(frame.func.ref).name); + + // Source slices for the individual frames (they all refer to this script). + json = '{"seq":0,"type":"request","command":"source",' + + '"arguments":{"frame":0,"fromLine":30,"toLine":32}}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + source = response.body(); + assertEquals("function f(x, y) {", source.source.substring(0, 18)); + assertEquals(30, source.fromLine); + assertEquals(32, source.toLine); + + json = '{"seq":0,"type":"request","command":"source",' + + '"arguments":{"frame":1,"fromLine":31,"toLine":32}}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + source = response.body(); + assertEquals(" a=1;", source.source.substring(0, 6)); + assertEquals(31, source.fromLine); + assertEquals(32, source.toLine); + + json = '{"seq":0,"type":"request","command":"source",' + + '"arguments":{"frame":2,"fromLine":35,"toLine":36}}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + source = response.body(); + assertEquals(" new f(1);", source.source.substring(0, 11)); + assertEquals(35, source.fromLine); + assertEquals(36, source.toLine); + + // Test line interval way beyond this script will result in an error. + json = '{"seq":0,"type":"request","command":"source",' + + '"arguments":{"frame":0,"fromLine":10000,"toLine":20000}}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + assertFalse(response.response().success); + + // Test without arguments. + json = '{"seq":0,"type":"request","command":"source"}' + response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + source = response.body(); + assertEquals(Debug.findScript(f).source, source.source); + + listenerCalled = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Set a break point and call to invoke the debug event listener. +Debug.setBreakPoint(f, 0, 0); +g(); + +// Make sure that the debug event listener vas invoked. +assertFalse(exception, "exception in listener"); +assertTrue(listenerCalled); + diff --git a/deps/v8/test/mjsunit/debug-breakpoints.js b/deps/v8/test/mjsunit/debug-breakpoints.js new file mode 100644 index 0000000000..c332f1e1d4 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-breakpoints.js @@ -0,0 +1,120 @@ +// Copyright 2008 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 f() {a=1;b=2}; +function g() { + a=1; + b=2; +} + +bp = Debug.setBreakPoint(f, 0, 0); +assertEquals("() {[B0]a=1;b=2}", Debug.showBreakPoints(f)); +Debug.clearBreakPoint(bp); +assertEquals("() {a=1;b=2}", Debug.showBreakPoints(f)); +bp1 = Debug.setBreakPoint(f, 0, 8); +assertEquals("() {a=1;[B0]b=2}", Debug.showBreakPoints(f)); +bp2 = Debug.setBreakPoint(f, 0, 4); +assertEquals("() {[B0]a=1;[B1]b=2}", Debug.showBreakPoints(f)); +bp3 = Debug.setBreakPoint(f, 0, 12); +assertEquals("() {[B0]a=1;[B1]b=2}[B2]", Debug.showBreakPoints(f)); +Debug.clearBreakPoint(bp1); +assertEquals("() {[B0]a=1;b=2}[B1]", Debug.showBreakPoints(f)); +Debug.clearBreakPoint(bp2); +assertEquals("() {a=1;b=2}[B0]", Debug.showBreakPoints(f)); +Debug.clearBreakPoint(bp3); +assertEquals("() {a=1;b=2}", Debug.showBreakPoints(f)); + +// The following test checks that the Debug.showBreakPoints(g) produces output +// like follows when changein breakpoints. +// +// function g() { +// [BX]a=1; +// [BX]b=2; +// }[BX] + +// Test set and clear breakpoint at the first possible location (line 0, +// position 0). +bp = Debug.setBreakPoint(g, 0, 0); +// function g() { +// [B0]a=1; +// b=2; +// } +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0); +Debug.clearBreakPoint(bp); +// function g() { +// a=1; +// b=2; +// } +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0); + +// Second test set and clear breakpoints on lines 1, 2 and 3 (position = 0). +bp1 = Debug.setBreakPoint(g, 2, 0); +// function g() { +// a=1; +// [B0]b=2; +// } +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]b=2;") > 0); +bp2 = Debug.setBreakPoint(g, 1, 0); +// function g() { +// [B0]a=1; +// [B1]b=2; +// } +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0); +assertTrue(Debug.showBreakPoints(g).indexOf("[B1]b=2;") > 0); +bp3 = Debug.setBreakPoint(g, 3, 0); +// function g() { +// [B0]a=1; +// [B1]b=2; +// }[B2] +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0); +assertTrue(Debug.showBreakPoints(g).indexOf("[B1]b=2;") > 0); +assertTrue(Debug.showBreakPoints(g).indexOf("}[B2]") > 0); +Debug.clearBreakPoint(bp1); +// function g() { +// [B0]a=1; +// b=2; +// }[B1] +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]a=1;") > 0); +assertTrue(Debug.showBreakPoints(g).indexOf("}[B1]") > 0); +assertTrue(Debug.showBreakPoints(g).indexOf("[B2]") < 0); +Debug.clearBreakPoint(bp2); +// function g() { +// a=1; +// b=2; +// }[B0] +assertTrue(Debug.showBreakPoints(g).indexOf("}[B0]") > 0); +assertTrue(Debug.showBreakPoints(g).indexOf("[B1]") < 0); +Debug.clearBreakPoint(bp3); +// function g() { +// a=1; +// b=2; +// } +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0); diff --git a/deps/v8/test/mjsunit/debug-changebreakpoint.js b/deps/v8/test/mjsunit/debug-changebreakpoint.js new file mode 100644 index 0000000000..477c908136 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-changebreakpoint.js @@ -0,0 +1,108 @@ +// Copyright 2008 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 + +// Simple function which stores the last debug event. +listenerComplete = false; +exception = false; + +var base_request = '"seq":0,"type":"request","command":"changebreakpoint"' + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + assertEquals(void 0, e); + return undefined; + } +} + +function testArguments(dcp, arguments, success) { + var request = '{' + base_request + ',"arguments":' + arguments + '}' + var json_response = dcp.processDebugJSONRequest(request); + var response = safeEval(json_response); + if (success) { + assertTrue(response.success, json_response); + } else { + assertFalse(response.success, json_response); + } +} + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Test some illegal clearbreakpoint requests. + var request = '{' + base_request + '}' + var response = safeEval(dcp.processDebugJSONRequest(request)); + assertFalse(response.success); + + testArguments(dcp, '{}', false); + testArguments(dcp, '{"breakpoint":0,"condition":"false"}', false); + // TODO(1241036) change this to 2 when break points have been restructured. + testArguments(dcp, '{"breakpoint":3,"condition":"false"}', false); + testArguments(dcp, '{"breakpoint":"xx","condition":"false"}', false); + + // Test some legal clearbreakpoint requests. + testArguments(dcp, '{"breakpoint":1}', true); + testArguments(dcp, '{"breakpoint":1,"enabled":"true"}', true); + testArguments(dcp, '{"breakpoint":1,"enabled":"false"}', true); + testArguments(dcp, '{"breakpoint":1,"condition":"1==2"}', true); + testArguments(dcp, '{"breakpoint":1,"condition":"false"}', true); + testArguments(dcp, '{"breakpoint":1,"ignoreCount":7}', true); + testArguments(dcp, '{"breakpoint":1,"ignoreCount":0}', true); + testArguments( + dcp, + '{"breakpoint":1,"enabled":"true","condition":"false","ignoreCount":0}', + true); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function g() {}; + +// Set a break point and call to invoke the debug event listener. +bp = Debug.setBreakPoint(g, 0, 0); +assertEquals(1, bp); +g(); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete, "listener did not run to completion"); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-clearbreakpoint.js b/deps/v8/test/mjsunit/debug-clearbreakpoint.js new file mode 100644 index 0000000000..28920c53a5 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-clearbreakpoint.js @@ -0,0 +1,101 @@ +// Copyright 2008 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 + +// Simple function which stores the last debug event. +listenerComplete = false; +exception = false; + +var base_request = '"seq":0,"type":"request","command":"clearbreakpoint"' + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + assertEquals(void 0, e); + return undefined; + } +} + +function testArguments(dcp, arguments, success) { + var request = '{' + base_request + ',"arguments":' + arguments + '}' + var json_response = dcp.processDebugJSONRequest(request); + var response = safeEval(json_response); + if (success) { + assertTrue(response.success, json_response); + } else { + assertFalse(response.success, json_response); + } +} + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Test some illegal clearbreakpoint requests. + var request = '{' + base_request + '}' + var response = safeEval(dcp.processDebugJSONRequest(request)); + assertFalse(response.success); + + testArguments(dcp, '{}', false); + testArguments(dcp, '{"breakpoint":0}', false); + // TODO(1241036) change this to 2 when break points have been restructured. + testArguments(dcp, '{"breakpoint":3}', false); + testArguments(dcp, '{"breakpoint":"xx"}', false); + + // Test some legal clearbreakpoint requests. + testArguments(dcp, '{"breakpoint":1}', true); + + // Cannot clear the same break point twice. + testArguments(dcp, '{"breakpoint":1}', false); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function g() {}; + +// Set a break point and call to invoke the debug event listener. +bp = Debug.setBreakPoint(g, 0, 0); +assertEquals(1, bp); +g(); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete, "listener did not run to completion"); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-compile-event.js b/deps/v8/test/mjsunit/debug-compile-event.js new file mode 100644 index 0000000000..035e36c30f --- /dev/null +++ b/deps/v8/test/mjsunit/debug-compile-event.js @@ -0,0 +1,95 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Flags: --expose-debug-as debug +// Get the Debug object exposed from the debug context global object. +Debug = debug.Debug + +var exception = false; // Exception in debug event listener. +var before_compile_count = 0; +var after_compile_count = 0; +var current_source = ''; // Current source compiled. +var source_count = 0; // Total number of scource sompiled. + + +function compileSource(source) { + current_source = source; + eval(current_source); + source_count++; +} + + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.BeforeCompile || + event == Debug.DebugEvent.AfterCompile) { + // Count the events. + if (event == Debug.DebugEvent.BeforeCompile) { + before_compile_count++; + } else { + after_compile_count++; + } + + // If the compiled source contains 'eval' there will be additional compile + // events for the source inside eval. + if (current_source.indexOf('eval') == 0) { + // For source with 'eval' there will be compile events with substrings + // as well as with with the exact source. + assertTrue(current_source.indexOf(event_data.script().source()) >= 0); + } else { + // For source without 'eval' there will be a compile events with the + // exact source. + assertEquals(current_source, event_data.script().source()); + } + } + } catch (e) { + exception = e + } +}; + + +// Add the debug event listener. +Debug.setListener(listener); + +// Compile different sources. +compileSource('a=1'); +compileSource('function(){}'); +compileSource('eval("a=2")'); +source_count++; // Using eval causes additional compilation event. +compileSource('eval("eval(\'function(){return a;}\')")'); +source_count += 2; // Using eval causes additional compilation event. + +// Make sure that the debug event listener was invoked. +assertFalse(exception, "exception in listener") + +// Number of before and after compile events should be the same. +assertEquals(before_compile_count, after_compile_count); + +// Check the actual number of events. +assertEquals(source_count, after_compile_count); + +Debug.setListener(null); diff --git a/deps/v8/test/mjsunit/debug-conditional-breakpoints.js b/deps/v8/test/mjsunit/debug-conditional-breakpoints.js new file mode 100644 index 0000000000..5859451ba4 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-conditional-breakpoints.js @@ -0,0 +1,171 @@ +// Copyright 2008 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 + +// Simple debug event handler which just counts the number of break points hit. +var break_point_hit_count; + +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) { + break_point_hit_count++; + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Test functions. +count = 0; +function f() {}; +function g() {h(count++)}; +function h(x) {var a=x;}; + + +// Conditional breakpoint which syntax error. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(f, 0, 0, '{{{'); +f(); +assertEquals(0, break_point_hit_count); +assertEquals(0, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Conditional breakpoint which evaluates to false. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(f, 0, 0, 'false'); +f(); +assertEquals(0, break_point_hit_count); +assertEquals(0, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Conditional breakpoint which evaluates to true. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(f, 0, 0, 'true'); +f(); +assertEquals(1, break_point_hit_count); +assertEquals(1, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Conditional breakpoint which different types of quotes. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(f, 0, 0, '"a" == "a"'); +f(); +assertEquals(1, break_point_hit_count); +assertEquals(1, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); +break_point_hit_count = 0; +bp = Debug.setBreakPoint(f, 0, 0, "'a' == 'a'"); +f(); +assertEquals(1, break_point_hit_count); +assertEquals(1, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Changing condition. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(f, 0, 0, '"ab".indexOf("b") > 0'); +f(); +assertEquals(1, break_point_hit_count); +assertEquals(1, Debug.findBreakPoint(bp, false).hit_count()); +Debug.changeBreakPointCondition(bp, 'Math.sin(Math.PI/2) > 1'); +f(); +assertEquals(1, break_point_hit_count); +assertEquals(1, Debug.findBreakPoint(bp, false).hit_count()); +Debug.changeBreakPointCondition(bp, '1==1'); +f(); +assertEquals(2, break_point_hit_count); +assertEquals(2, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Conditional breakpoint which checks global variable. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(f, 0, 0, 'x==1'); +f(); +assertEquals(0, break_point_hit_count); +assertEquals(0, Debug.findBreakPoint(bp, false).hit_count()); +x=1; +f(); +assertEquals(1, break_point_hit_count); +assertEquals(1, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Conditional breakpoint which checks global variable. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(g, 0, 0, 'count % 2 == 0'); +for (var i = 0; i < 10; i++) { + g(); +} +assertEquals(5, break_point_hit_count); +assertEquals(5, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Conditional breakpoint which checks a parameter. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(h, 0, 0, 'x % 2 == 0'); +for (var i = 0; i < 10; i++) { + g(); +} +assertEquals(5, break_point_hit_count); +assertEquals(5, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Conditional breakpoint which checks a local variable. +break_point_hit_count = 0; +bp = Debug.setBreakPoint(h, 0, 0, 'a % 2 == 0'); +for (var i = 0; i < 10; i++) { + g(); +} +assertEquals(5, break_point_hit_count); +assertEquals(5, Debug.findBreakPoint(bp, false).hit_count()); +Debug.clearBreakPoint(bp); + +// Multiple conditional breakpoint which the same condition. +break_point_hit_count = 0; +bp1 = Debug.setBreakPoint(h, 0, 0, 'a % 2 == 0'); +bp2 = Debug.setBreakPoint(h, 0, 0, 'a % 2 == 0'); +for (var i = 0; i < 10; i++) { + g(); +} +assertEquals(5, break_point_hit_count); +assertEquals(5, Debug.findBreakPoint(bp1, false).hit_count()); +assertEquals(5, Debug.findBreakPoint(bp2, false).hit_count()); +Debug.clearBreakPoint(bp1); +Debug.clearBreakPoint(bp2); + +// Multiple conditional breakpoint which different conditions. +break_point_hit_count = 0; +bp1 = Debug.setBreakPoint(h, 0, 0, 'a % 2 == 0'); +bp2 = Debug.setBreakPoint(h, 0, 0, '(a + 1) % 2 == 0'); +for (var i = 0; i < 10; i++) { + g(); +} +assertEquals(10, break_point_hit_count); +assertEquals(5, Debug.findBreakPoint(bp1, false).hit_count()); +assertEquals(5, Debug.findBreakPoint(bp2, false).hit_count()); +Debug.clearBreakPoint(bp1); +Debug.clearBreakPoint(bp2); diff --git a/deps/v8/test/mjsunit/debug-constructed-by.js b/deps/v8/test/mjsunit/debug-constructed-by.js new file mode 100644 index 0000000000..c904e25955 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-constructed-by.js @@ -0,0 +1,60 @@ +// Copyright 2008 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 + +// Simple constructor. +function Point(x,y) {} + +// Create mirror for the constructor. +var ctor = debug.MakeMirror(Point); + +// Initially no instances. +assertEquals(0, ctor.constructedBy().length); +assertEquals(0, ctor.constructedBy(0).length); +assertEquals(0, ctor.constructedBy(1).length); +assertEquals(0, ctor.constructedBy(10).length); + +// Create an instance. +var p = new Point(); +assertEquals(1, ctor.constructedBy().length); +assertEquals(1, ctor.constructedBy(0).length); +assertEquals(1, ctor.constructedBy(1).length); +assertEquals(1, ctor.constructedBy(10).length); + + +// Create 10 more instances making for 11. +ps = []; +for (var i = 0; i < 10; i++) { + ps.push(new Point()); +} +assertEquals(11, ctor.constructedBy().length); +assertEquals(11, ctor.constructedBy(0).length); +assertEquals(1, ctor.constructedBy(1).length); +assertEquals(10, ctor.constructedBy(10).length); diff --git a/deps/v8/test/mjsunit/debug-constructor.js b/deps/v8/test/mjsunit/debug-constructor.js new file mode 100644 index 0000000000..38028aa8c1 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-constructor.js @@ -0,0 +1,78 @@ +// Copyright 2008 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 + +// Simple function which collects a simple call graph. +var call_graph = ""; +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) + { + call_graph += exec_state.frame().func().name(); + exec_state.prepareStep(); + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Test debug event for constructor. +function a() { + new c(); +} + +function b() { + x = 1; + new c(); +} + +function c() { + this.x = 1; + d(); +} + +function d() { +} + +// Break point stops on "new c()" and steps into c. +Debug.setBreakPoint(a, 1); +call_graph = ""; +a(); +Debug.clearStepping(); // Clear stepping as the listener leaves it on. +assertEquals("accdca", call_graph); + +// Break point stops on "x = 1" and steps to "new c()" and then into c. +Debug.setBreakPoint(b, 1); +call_graph = ""; +b(); +Debug.clearStepping(); // Clear stepping as the listener leaves it on. +assertEquals("bbccdcb", call_graph); + +// Get rid of the debug event listener. +Debug.setListener(null);
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/debug-continue.js b/deps/v8/test/mjsunit/debug-continue.js new file mode 100644 index 0000000000..0c11abc56e --- /dev/null +++ b/deps/v8/test/mjsunit/debug-continue.js @@ -0,0 +1,113 @@ +// Copyright 2008 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 + +// Simple function which stores the last debug event. +listenerComplete = false; +exception = false; + +var base_request = '"seq":0,"type":"request","command":"continue"' + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + assertEquals(void 0, e); + return undefined; + } +} + +function testArguments(dcp, arguments, success) { + // Generate request with the supplied arguments + var request; + if (arguments) { + request = '{' + base_request + ',"arguments":' + arguments + '}'; + } else { + request = '{' + base_request + '}' + } + var response = safeEval(dcp.processDebugJSONRequest(request)); + if (success) { + assertTrue(response.success, request + ' -> ' + response.message); + assertTrue(response.running, request + ' -> expected running'); + } else { + assertFalse(response.success, request + ' -> ' + response.message); + assertFalse(response.running, request + ' -> expected not running'); + } +} + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Test simple continue request. + testArguments(dcp, void 0, true); + + // Test some illegal continue requests. + testArguments(dcp, '{"stepaction":"maybe"}', false); + testArguments(dcp, '{"stepcount":-1}', false); + + // Test some legal continue requests. + testArguments(dcp, '{"stepaction":"in"}', true); + testArguments(dcp, '{"stepaction":"min"}', true); + testArguments(dcp, '{"stepaction":"next"}', true); + testArguments(dcp, '{"stepaction":"out"}', true); + testArguments(dcp, '{"stepcount":1}', true); + testArguments(dcp, '{"stepcount":10}', true); + testArguments(dcp, '{"stepcount":"10"}', true); + testArguments(dcp, '{"stepaction":"next","stepcount":10}', true); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function f() { + a=1 +}; + +function g() { + f(); +}; + +// Set a break point and call to invoke the debug event listener. +Debug.setBreakPoint(g, 0, 0); +g(); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete, "listener did not run to completion"); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-enable-disable-breakpoints.js b/deps/v8/test/mjsunit/debug-enable-disable-breakpoints.js new file mode 100644 index 0000000000..071397beac --- /dev/null +++ b/deps/v8/test/mjsunit/debug-enable-disable-breakpoints.js @@ -0,0 +1,90 @@ +// Copyright 2008 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 + +// Simple debug event handler which just counts the number of break points hit. +var break_point_hit_count; + +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) { + break_point_hit_count++; + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Test function. +function f() {a=1;b=2;}; + +// This tests enabeling and disabling of break points including the case +// with several break points in the same location. +break_point_hit_count = 0; + +// Set a breakpoint in f. +bp1 = Debug.setBreakPoint(f); +f(); +assertEquals(1, break_point_hit_count); + +// Disable the breakpoint. +Debug.disableBreakPoint(bp1); +f(); +assertEquals(1, break_point_hit_count); + +// Enable the breakpoint. +Debug.enableBreakPoint(bp1); +f(); +assertEquals(2, break_point_hit_count); + +// Set another breakpoint in f at the same place. +bp2 = Debug.setBreakPoint(f); +f(); +assertEquals(3, break_point_hit_count); + +// Disable the second breakpoint. +Debug.disableBreakPoint(bp2); +f(); +assertEquals(4, break_point_hit_count); + +// Disable the first breakpoint. +Debug.disableBreakPoint(bp1); +f(); +assertEquals(4, break_point_hit_count); + +// Enable both breakpoints. +Debug.enableBreakPoint(bp1); +Debug.enableBreakPoint(bp2); +f(); +assertEquals(5, break_point_hit_count); + +// Disable the first breakpoint. +Debug.disableBreakPoint(bp1); +f(); +assertEquals(6, break_point_hit_count); diff --git a/deps/v8/test/mjsunit/debug-evaluate-arguments.js b/deps/v8/test/mjsunit/debug-evaluate-arguments.js new file mode 100644 index 0000000000..92b745f1da --- /dev/null +++ b/deps/v8/test/mjsunit/debug-evaluate-arguments.js @@ -0,0 +1,93 @@ +// Copyright 2008 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 + +listenerComplete = false; +exception = false; + +function checkArguments(frame, names, values) { + var argc = Math.max(names.length, values.length); + assertEquals(argc, frame.argumentCount()); + for (var i = 0; i < argc; i++) { + if (i < names.length) { + assertEquals(names[i], frame.argumentName(i)); + } else { + assertEquals(void 0, frame.argumentName(i)); + } + + if (i < values.length) { + assertEquals(values[i], frame.argumentValue(i).value()); + } else { + assertEquals(void 0, frame.argumentValue(i).value()); + } + } +} + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) + { + // Frame 0 - called with less parameters than arguments. + checkArguments(exec_state.frame(0), ['x', 'y'], [1]); + + // Frame 1 - called with more parameters than arguments. + checkArguments(exec_state.frame(1), ['x', 'y'], [1, 2, 3]); + + // Frame 2 - called with same number of parameters than arguments. + checkArguments(exec_state.frame(2), ['x', 'y', 'z'], [1, 2, 3]); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function h(x, y) { + debugger; // Breakpoint. +}; + +function g(x, y) { + h(x); +}; + +function f(x, y, z) { + g.apply(null, [x, y, z]); +}; + +f(1, 2, 3); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-evaluate-locals.js b/deps/v8/test/mjsunit/debug-evaluate-locals.js new file mode 100644 index 0000000000..4b87829169 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-evaluate-locals.js @@ -0,0 +1,132 @@ +// Copyright 2008 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 + +listenerComplete = false; +exception = false; + + +function checkFrame0(name, value) { + assertTrue(name == 'a' || name == 'b'); + if (name == 'a') { + assertEquals(1, value); + } + if (name == 'b') { + assertEquals(2, value); + } +} + + +function checkFrame1(name, value) { + assertTrue(name == '.arguments' || name == 'a'); + if (name == 'a') { + assertEquals(3, value); + } +} + + +function checkFrame2(name, value) { + assertTrue(name == '.arguments' || name == 'a' || + name == 'arguments' || name == 'b'); + if (name == 'a') { + assertEquals(5, value); + } + if (name == 'b') { + assertEquals(0, value); + } +} + + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) + { + // Frame 0 has normal variables a and b. + var frame0 = exec_state.frame(0); + checkFrame0(frame0.localName(0), frame0.localValue(0).value()); + checkFrame0(frame0.localName(1), frame0.localValue(1).value()); + + // Frame 1 has normal variable a (and the .arguments variable). + var frame1 = exec_state.frame(1); + checkFrame1(frame1.localName(0), frame1.localValue(0).value()); + checkFrame1(frame1.localName(1), frame1.localValue(1).value()); + + // Frame 2 has normal variables a and b (and both the .arguments and + // arguments variable). + var frame2 = exec_state.frame(2); + checkFrame2(frame2.localName(0), frame2.localValue(0).value()); + checkFrame2(frame2.localName(1), frame2.localValue(1).value()); + checkFrame2(frame2.localName(2), frame2.localValue(2).value()); + checkFrame2(frame2.localName(3), frame2.localValue(3).value()); + + // Evaluating a and b on frames 0, 1 and 2 produces 1, 2, 3, 4, 5 and 6. + assertEquals(1, exec_state.frame(0).evaluate('a').value()); + assertEquals(2, exec_state.frame(0).evaluate('b').value()); + assertEquals(3, exec_state.frame(1).evaluate('a').value()); + assertEquals(4, exec_state.frame(1).evaluate('b').value()); + assertEquals(5, exec_state.frame(2).evaluate('a').value()); + assertEquals(6, exec_state.frame(2).evaluate('b').value()); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function h() { + var a = 1; + var b = 2; + debugger; // Breakpoint. +}; + +function g() { + var a = 3; + eval("var b = 4;"); + h(); +}; + +function f() { + var a = 5; + var b = 0; + with ({b:6}) { + g(); + } +}; + +f(); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-evaluate-recursive.js b/deps/v8/test/mjsunit/debug-evaluate-recursive.js new file mode 100644 index 0000000000..9f037e5783 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-evaluate-recursive.js @@ -0,0 +1,167 @@ +// Copyright 2008 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 + +listenerComplete = false; +exception = false; + +// The base part of all evaluate requests. +var base_request = '"seq":0,"type":"request","command":"evaluate"' + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + assertEquals(void 0, e); + return undefined; + } +} + +function testRequest(dcp, arguments, success, result) { + // Generate request with the supplied arguments. + var request; + if (arguments) { + request = '{' + base_request + ',"arguments":' + arguments + '}'; + } else { + request = '{' + base_request + '}' + } + var response = safeEval(dcp.processDebugJSONRequest(request)); + if (success) { + assertTrue(response.success, request + ' -> ' + response.message); + assertEquals(result, response.body.value); + } else { + assertFalse(response.success, request + ' -> ' + response.message); + } + assertFalse(response.running, request + ' -> expected not running'); +} + + +// Event listener which evaluates with break disabled. +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) + { + // Call functions with break using the FrameMirror directly. + assertEquals(1, exec_state.evaluateGlobal('f()', true).value()); + assertEquals(2, exec_state.evaluateGlobal('g()', true).value()); + assertEquals(1, exec_state.frame(0).evaluate('f()', true).value()); + assertEquals(2, exec_state.frame(0).evaluate('g()', true).value()); + + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Call functions with break using the JSON protocol. Tests that argument + // disable_break is default true. + testRequest(dcp, '{"expression":"f()"}', true, 1); + testRequest(dcp, '{"expression":"f()","frame":0}', true, 1); + testRequest(dcp, '{"expression":"g()"}', true, 2); + testRequest(dcp, '{"expression":"g()","frame":0}', true, 2); + + // Call functions with break using the JSON protocol. Tests passing + // argument disable_break is default true. + testRequest(dcp, '{"expression":"f()","disable_break":true}', true, 1); + testRequest(dcp, '{"expression":"f()","frame":0,"disable_break":true}', + true, 1); + testRequest(dcp, '{"expression":"g()","disable_break":true}', true, 2); + testRequest(dcp, '{"expression":"g()","frame":0,"disable_break":true}', + true, 2); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + + +// Event listener which evaluates with break enabled one time and the second +// time evaluates with break disabled. +var break_count = 0; +function listener_recurse(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) + { + break_count++; + + // Call functions with break using the FrameMirror directly. + if (break_count == 1) { + // First break event evaluates with break enabled. + assertEquals(1, exec_state.frame(0).evaluate('f()', false).value()); + listenerComplete = true; + } else { + // Second break event evaluates with break disabled. + assertEquals(2, break_count); + assertFalse(listenerComplete); + assertEquals(1, exec_state.frame(0).evaluate('f()', true).value()); + } + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Test functions - one with break point and one with debugger statement. +function f() { + return 1; +}; + +function g() { + debugger; + return 2; +}; + +Debug.setBreakPoint(f, 2, 0); + +// Cause a debug break event. +debugger; + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete); +assertFalse(exception, "exception in listener") + +// Remove the debug event listener. +Debug.setListener(null); + +// Set debug event listener wich uses recursive breaks. +Debug.setListener(listener_recurse); +listenerComplete = false; + +Debug.setBreakPoint(f, 2, 0); + +debugger; + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete); +assertFalse(exception, "exception in listener") +assertEquals(2, break_count); diff --git a/deps/v8/test/mjsunit/debug-evaluate-with.js b/deps/v8/test/mjsunit/debug-evaluate-with.js new file mode 100644 index 0000000000..9d95a9f50b --- /dev/null +++ b/deps/v8/test/mjsunit/debug-evaluate-with.js @@ -0,0 +1,77 @@ +// Copyright 2008 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 + +listenerComplete = false; +exception = false; +breakPointCount = 0; + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) + { + breakPointCount++; + if (breakPointCount == 1) { + // Break point in first with block. + assertEquals(2, exec_state.frame(0).evaluate('a').value()); + assertEquals(2, exec_state.frame(0).evaluate('b').value()); + } else { + // Break point in second with block. + assertEquals(3, exec_state.frame(0).evaluate('a').value()); + assertEquals(1, exec_state.frame(0).evaluate('b').value()); + + // Indicate that all was processed. + listenerComplete = true; + } + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function f() { + var a = 1; + var b = 2; + with ({a:2}) { + debugger; // Breakpoint. + x = {a:3,b:1}; + with (x) { + debugger; // Breakpoint. + } + } +}; + +f(); +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-evaluate.js b/deps/v8/test/mjsunit/debug-evaluate.js new file mode 100644 index 0000000000..5c5734f877 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-evaluate.js @@ -0,0 +1,117 @@ +// Copyright 2008 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 + +listenerComplete = false; +exception = false; + +// The base part of all evaluate requests. +var base_request = '"seq":0,"type":"request","command":"evaluate"' + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + assertEquals(void 0, e); + return undefined; + } +} + +function testRequest(dcp, arguments, success, result) { + // Generate request with the supplied arguments. + var request; + if (arguments) { + request = '{' + base_request + ',"arguments":' + arguments + '}'; + } else { + request = '{' + base_request + '}' + } + var response = safeEval(dcp.processDebugJSONRequest(request)); + if (success) { + assertTrue(response.success, request + ' -> ' + response.message); + assertEquals(result, response.body.value); + } else { + assertFalse(response.success, request + ' -> ' + response.message); + } + assertFalse(response.running, request + ' -> expected not running'); +} + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Test some illegal evaluate requests. + testRequest(dcp, void 0, false); + testRequest(dcp, '{"expression":"1","global"=true}', false); + testRequest(dcp, '{"expression":"a","frame":4}', false); + + // Test some legal evaluate requests. + testRequest(dcp, '{"expression":"1+2"}', true, 3); + testRequest(dcp, '{"expression":"a+2"}', true, 5); + testRequest(dcp, '{"expression":"({\\"a\\":1,\\"b\\":2}).b+2"}', true, 4); + + // Test evaluation of a in the stack frames and the global context. + testRequest(dcp, '{"expression":"a"}', true, 3); + testRequest(dcp, '{"expression":"a","frame":0}', true, 3); + testRequest(dcp, '{"expression":"a","frame":1}', true, 2); + testRequest(dcp, '{"expression":"a","frame":2}', true, 1); + testRequest(dcp, '{"expression":"a","global":true}', true, 1); + testRequest(dcp, '{"expression":"this.a","global":true}', true, 1); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function f() { + var a = 3; +}; + +function g() { + var a = 2; + f(); +}; + +a = 1; + +// Set a break point at return in f and invoke g to hit the breakpoint. +Debug.setBreakPoint(f, 2, 0); +g(); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete, "listener did not run to completion"); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-event-listener.js b/deps/v8/test/mjsunit/debug-event-listener.js new file mode 100644 index 0000000000..a2eb5f009b --- /dev/null +++ b/deps/v8/test/mjsunit/debug-event-listener.js @@ -0,0 +1,73 @@ +// Copyright 2008 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 + +// Simple function which stores the last debug event. +lastDebugEvent = new Object(); +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break || + event == Debug.DebugEvent.Exception) + { + lastDebugEvent.event = event; + lastDebugEvent.frameFuncName = exec_state.frame().func().name(); + lastDebugEvent.event_data = event_data; + } +}; + +// Add the debug event listener. +Debug.setListener(listener); +// Get events from handled exceptions. +Debug.setBreakOnException(); + +// Test debug event for handled exception. +(function f(){ + try { + x(); + } catch(e) { + // Do nothing. Ignore exception. + } +})(); +assertTrue(lastDebugEvent.event == Debug.DebugEvent.Exception); +assertEquals(lastDebugEvent.frameFuncName, "f"); +assertFalse(lastDebugEvent.event_data.uncaught()); +Debug.clearBreakOnException(); + +// Test debug event for break point. +function a() { + x = 1; + y = 2; + z = 3; +}; +Debug.setBreakPoint(a, 1); +a(); +assertTrue(lastDebugEvent.event == Debug.DebugEvent.Break); +assertEquals(lastDebugEvent.frameFuncName, "a"); + +Debug.setListener(null); diff --git a/deps/v8/test/mjsunit/debug-handle.js b/deps/v8/test/mjsunit/debug-handle.js new file mode 100644 index 0000000000..64a68a86e9 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-handle.js @@ -0,0 +1,199 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Flags: --expose-debug-as debug +// Get the Debug object exposed from the debug context global object. +Debug = debug.Debug + +listenerComplete = false; +exception = false; + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + assertEquals(void 0, e); + return undefined; + } +} + + +// Send an evaluation request and return the handle of the result. +function evaluateRequest(dcp, arguments) { + // The base part of all evaluate requests. + var base_request = '"seq":0,"type":"request","command":"evaluate"' + + // Generate request with the supplied arguments. + var request; + if (arguments) { + request = '{' + base_request + ',"arguments":' + arguments + '}'; + } else { + request = '{' + base_request + '}' + } + + var response = safeEval(dcp.processDebugJSONRequest(request)); + assertTrue(response.success, request + ' -> ' + response.message); + + return response.body.handle; +} + + +// Send a lookup request and return the evaluated JSON response. +function lookupRequest(dcp, arguments, success) { + // The base part of all lookup requests. + var base_request = '"seq":0,"type":"request","command":"lookup"' + + // Generate request with the supplied arguments. + var request; + if (arguments) { + request = '{' + base_request + ',"arguments":' + arguments + '}'; + } else { + request = '{' + base_request + '}' + } + + var response = safeEval(dcp.processDebugJSONRequest(request)); + if (success) { + assertTrue(response.success, request + ' -> ' + response.message); + } else { + assertFalse(response.success, request + ' -> ' + response.message); + } + assertFalse(response.running, request + ' -> expected not running'); + + return response; +} + + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Test some illegal lookup requests. + lookupRequest(dcp, void 0, false); + lookupRequest(dcp, '{"handle":"a"}', false); + lookupRequest(dcp, '{"handle":-1}', false); + + // Evaluate and get some handles. + var handle_o = evaluateRequest(dcp, '{"expression":"o"}'); + var handle_p = evaluateRequest(dcp, '{"expression":"p"}'); + var handle_b = evaluateRequest(dcp, '{"expression":"a"}'); + var handle_a = evaluateRequest(dcp, '{"expression":"b","frame":1}'); + assertEquals(handle_o, handle_a); + assertEquals(handle_a, handle_b); + assertFalse(handle_o == handle_p, "o and p have he same handle"); + + var response; + var count; + response = lookupRequest(dcp, '{"handle":' + handle_o + '}', true); + assertEquals(handle_o, response.body.handle); + count = 0; + for (i in response.body.properties) { + switch (response.body.properties[i].name) { + case 'o': + response.body.properties[i].ref = handle_o; + count++; + break; + case 'p': + response.body.properties[i].ref = handle_p; + count++; + break; + } + } + assertEquals(2, count, 'Either "o" or "p" not found'); + response = lookupRequest(dcp, '{"handle":' + handle_p + '}', true); + assertEquals(handle_p, response.body.handle); + + // Check handles for functions on the stack. + var handle_f = evaluateRequest(dcp, '{"expression":"f"}'); + var handle_g = evaluateRequest(dcp, '{"expression":"g"}'); + var handle_caller = evaluateRequest(dcp, '{"expression":"f.caller"}'); + + assertFalse(handle_f == handle_g, "f and g have he same handle"); + assertEquals(handle_g, handle_caller, "caller for f should be g"); + + response = lookupRequest(dcp, '{"handle":' + handle_f + '}', true); + assertEquals(handle_f, response.body.handle); + count = 0; + for (i in response.body.properties) { + var arguments = '{"handle":' + response.body.properties[i].ref + '}' + switch (response.body.properties[i].name) { + case 'name': + var response_name; + response_name = lookupRequest(dcp, arguments, true); + assertEquals('string', response_name.body.type); + assertEquals("f", response_name.body.value); + count++; + break; + case 'length': + var response_length; + response_length = lookupRequest(dcp, arguments, true); + assertEquals('number', response_length.body.type); + assertEquals(1, response_length.body.value); + count++; + break; + case 'caller': + assertEquals(handle_g, response.body.properties[i].ref); + count++; + break; + } + } + assertEquals(3, count, 'Either "name", "length" or "caller" not found'); + + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function f(a) { + debugger; +}; + +function g(b) { + f(b); +}; + +// Set a break point at return in f and invoke g to hit the breakpoint. +Debug.setBreakPoint(f, 2, 0); +o = {}; +p = {} +o.o = o; +o.p = p; +p.o = o; +p.p = p; +g(o); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete, "listener did not run to completion"); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-ignore-breakpoints.js b/deps/v8/test/mjsunit/debug-ignore-breakpoints.js new file mode 100644 index 0000000000..96c6044e7b --- /dev/null +++ b/deps/v8/test/mjsunit/debug-ignore-breakpoints.js @@ -0,0 +1,89 @@ +// Copyright 2008 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 + +// Simple debug event handler which just counts the number of break points hit. +var break_point_hit_count; + +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) { + break_point_hit_count++; + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Test function. +function f() {}; + +// This tests ignore of break points including the case with several +// break points in the same location. +break_point_hit_count = 0; + +// Set a breakpoint in f. +bp1 = Debug.setBreakPoint(f); + +// Try ignore count of 1. +Debug.changeBreakPointIgnoreCount(bp1, 1); +f(); +assertEquals(0, break_point_hit_count); +f(); +assertEquals(1, break_point_hit_count); + +// Set another breakpoint in f at the same place. +bp2 = Debug.setBreakPoint(f); +f(); +assertEquals(2, break_point_hit_count); + +// Set different ignore counts. +Debug.changeBreakPointIgnoreCount(bp1, 2); +Debug.changeBreakPointIgnoreCount(bp2, 4); +f(); +assertEquals(2, break_point_hit_count); +f(); +assertEquals(2, break_point_hit_count); +f(); +assertEquals(3, break_point_hit_count); +f(); +assertEquals(4, break_point_hit_count); + +// Set different ignore counts (opposite). +Debug.changeBreakPointIgnoreCount(bp1, 4); +Debug.changeBreakPointIgnoreCount(bp2, 2); +f(); +assertEquals(4, break_point_hit_count); +f(); +assertEquals(4, break_point_hit_count); +f(); +assertEquals(5, break_point_hit_count); +f(); +assertEquals(6, break_point_hit_count); + diff --git a/deps/v8/test/mjsunit/debug-mirror-cache.js b/deps/v8/test/mjsunit/debug-mirror-cache.js new file mode 100644 index 0000000000..d15146faef --- /dev/null +++ b/deps/v8/test/mjsunit/debug-mirror-cache.js @@ -0,0 +1,85 @@ +// Copyright 2008 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 +// The functions used for testing backtraces. They are at the top to make the +// testing of source line/column easier. +function f(x, y) { + a=1; +}; + +function g() { + new f(1); +}; + + +// Get the Debug object exposed from the debug context global object. +Debug = debug.Debug + +listenerCallCount = 0; +listenerExceptionCount = 0; + + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) + { + listenerCallCount++; + + // Check that mirror cache is cleared when entering debugger. + assertEquals(0, debug.next_handle_, "Mirror cache not cleared"); + assertEquals(0, debug.mirror_cache_.length, "Mirror cache not cleared"); + + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Make a backtrace request to create some mirrors. + var json; + json = '{"seq":0,"type":"request","command":"backtrace"}' + dcp.processDebugJSONRequest(json); + + // Some mirrors where cached. + assertFalse(debug.next_handle_ == 0, "Mirror cache not used"); + assertFalse(debug.mirror_cache_.length == 0, "Mirror cache not used"); + } + } catch (e) { + print(e); + listenerExceptionCount++; + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Enter the debugger twice. +debugger; +debugger; + +// Make sure that the debug event listener vas invoked. +assertEquals(2, listenerCallCount, "Listener not called"); +assertEquals(0, listenerExceptionCount, "Exception in listener"); + diff --git a/deps/v8/test/mjsunit/debug-multiple-breakpoints.js b/deps/v8/test/mjsunit/debug-multiple-breakpoints.js new file mode 100644 index 0000000000..1047410112 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-multiple-breakpoints.js @@ -0,0 +1,105 @@ +// Copyright 2008 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 + +// Simple debug event handler which just counts the number of break points hit. +var break_point_hit_count; + +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) { + break_point_hit_count++; + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Test functions +function f() {a=1;b=2;}; +function g() {f();} +function h() {} + +// This test sets several break points at the same place and checks that +// several break points at the same place only makes one debug break event +// and that when the last break point is removed no more debug break events +// occours. +break_point_hit_count = 0; + +// Set a breakpoint in f. +bp1 = Debug.setBreakPoint(f); +f(); +assertEquals(1, break_point_hit_count); + +// Set another breakpoint in f at the same place. +bp2 = Debug.setBreakPoint(f); +f(); +assertEquals(2, break_point_hit_count); + +// Remove one of the break points. +Debug.clearBreakPoint(bp1); +f(); +assertEquals(3, break_point_hit_count); + +// Remove the second break point. +Debug.clearBreakPoint(bp2); +f(); +assertEquals(3, break_point_hit_count); + +// Perform the same test using function g (this time removing the break points +// in the another order). +break_point_hit_count = 0; +bp1 = Debug.setBreakPoint(g); +g(); +assertEquals(1, break_point_hit_count); +bp2 = Debug.setBreakPoint(g); +g(); +assertEquals(2, break_point_hit_count); +Debug.clearBreakPoint(bp2); +g(); +assertEquals(3, break_point_hit_count); +Debug.clearBreakPoint(bp1); +g(); +assertEquals(3, break_point_hit_count); + +// Finally test with many break points. +test_count = 100; +bps = new Array(test_count); +break_point_hit_count = 0; +for (var i = 0; i < test_count; i++) { + bps[i] = Debug.setBreakPoint(h); + h(); +} +for (var i = 0; i < test_count; i++) { + h(); + Debug.clearBreakPoint(bps[i]); +} +assertEquals(test_count * 2, break_point_hit_count); +h(); +assertEquals(test_count * 2, break_point_hit_count); diff --git a/deps/v8/test/mjsunit/debug-referenced-by.js b/deps/v8/test/mjsunit/debug-referenced-by.js new file mode 100644 index 0000000000..915a0c78dc --- /dev/null +++ b/deps/v8/test/mjsunit/debug-referenced-by.js @@ -0,0 +1,112 @@ +// Copyright 2008 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 + +// Simple object. +var a = {}; + +// Create mirror for the object. +var mirror = debug.MakeMirror(a); + +// Initially one reference from the global object. +assertEquals(1, mirror.referencedBy().length); +assertEquals(1, mirror.referencedBy(0).length); +assertEquals(1, mirror.referencedBy(1).length); +assertEquals(1, mirror.referencedBy(10).length); + +// Add some more references from simple objects and arrays. +var b = {} +b.a = a; +assertEquals(2, mirror.referencedBy().length); +var c = {} +c.a = a; +c.aa = a; +c.aaa = a; +assertEquals(3, mirror.referencedBy().length); +function d(){}; +d.a = a +assertEquals(4, mirror.referencedBy().length); +e = [a,b,c,d]; +assertEquals(5, mirror.referencedBy().length); + + +// Simple closure. +function closure_simple(p) { + return function() { p = null; }; +} + +// This adds a reference (function context). +f = closure_simple(a); +assertEquals(6, mirror.referencedBy().length); +// This clears the reference (in function context). +f() +assertEquals(5, mirror.referencedBy().length); + +// Use closure with eval - creates arguments array. +function closure_eval(p, s) { + if (s) { + eval(s); + } + return function e(s) { eval(s); }; +} + +// This adds a references (function context). +g = closure_eval(a); +assertEquals(6, mirror.referencedBy().length); + +// Dynamically create a variable. This should create a context extension. +h = closure_eval(null, "var x_"); +assertEquals(6, mirror.referencedBy().length); +// Adds a reference when set. +h("x_ = a"); +var x = mirror.referencedBy(); +assertEquals(7, mirror.referencedBy().length); +// Removes a reference when cleared. +h("x_ = null"); +assertEquals(6, mirror.referencedBy().length); + +// Check circular references. +x = {} +mirror = debug.MakeMirror(x); +assertEquals(1, mirror.referencedBy().length); +x.x = x; +assertEquals(2, mirror.referencedBy().length); +x = null; +assertEquals(0, mirror.referencedBy().length); + +// Check many references. +y = {} +mirror = debug.MakeMirror(y); +refs = []; +for (var i = 0; i < 200; i++) { + refs[i] = {'y': y}; +} +y = null; +assertEquals(200, mirror.referencedBy().length); diff --git a/deps/v8/test/mjsunit/debug-references.js b/deps/v8/test/mjsunit/debug-references.js new file mode 100644 index 0000000000..dedc3eff40 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-references.js @@ -0,0 +1,118 @@ +// Copyright 2009 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --expose-debug-as debug
+// Get the Debug object exposed from the debug context global object.
+Debug = debug.Debug
+
+listenerComplete = false;
+exception = false;
+
+// The base part of all evaluate requests.
+var base_request = '"seq":0,"type":"request","command":"references"'
+
+function safeEval(code) {
+ try {
+ return eval('(' + code + ')');
+ } catch (e) {
+ assertEquals(void 0, e);
+ return undefined;
+ }
+}
+
+function testRequest(dcp, arguments, success, count) {
+ // Generate request with the supplied arguments.
+ var request;
+ if (arguments) {
+ request = '{' + base_request + ',"arguments":' + arguments + '}';
+ } else {
+ request = '{' + base_request + '}'
+ }
+
+ // Process the request and check expectation.
+ var response = safeEval(dcp.processDebugJSONRequest(request));
+ if (success) {
+ assertTrue(response.success, request + ' -> ' + response.message);
+ assertTrue(response.body instanceof Array);
+ if (count) {
+ assertEquals(count, response.body.length);
+ } else {
+ assertTrue(response.body.length > 0);
+ }
+ } else {
+ assertFalse(response.success, request + ' -> ' + response.message);
+ }
+ assertFalse(response.running, request + ' -> expected not running');
+}
+
+function listener(event, exec_state, event_data, data) {
+ try {
+ if (event == Debug.DebugEvent.Break) {
+ // Get the debug command processor.
+ var dcp = exec_state.debugCommandProcessor();
+
+ // Test some illegal references requests.
+ testRequest(dcp, void 0, false);
+ testRequest(dcp, '{"handle":"a"}', false);
+ testRequest(dcp, '{"handle":1}', false);
+ testRequest(dcp, '{"type":"referencedBy"}', false);
+ testRequest(dcp, '{"type":"constructedBy"}', false);
+
+ // Evaluate Point.
+ var evaluate_point = '{"seq":0,"type":"request","command":"evaluate",' +
+ '"arguments":{"expression":"Point"}}';
+ var response = safeEval(dcp.processDebugJSONRequest(evaluate_point));
+ assertTrue(response.success, "Evaluation of Point failed");
+ var handle = response.body.handle;
+
+ // Test some legal references requests.
+ testRequest(dcp, '{"handle":' + handle + ',"type":"referencedBy"}', true);
+ testRequest(dcp, '{"handle":' + handle + ',"type":"constructedBy"}',
+ true, 2);
+
+ // Indicate that all was processed.
+ listenerComplete = true;
+ }
+ } catch (e) {
+ exception = e
+ };
+};
+
+// Add the debug event listener.
+Debug.setListener(listener);
+
+// Test constructor and objects.
+function Point(x, y) { this.x_ = x; this.y_ = y;}
+p = new Point(0,0);
+q = new Point(1,2);
+
+// Enter debugger causing the event listener to be called.
+debugger;
+
+// Make sure that the debug event listener vas invoked.
+assertFalse(exception, "exception in listener")
+assertTrue(listenerComplete, "listener did not run to completion");
diff --git a/deps/v8/test/mjsunit/debug-script-breakpoints.js b/deps/v8/test/mjsunit/debug-script-breakpoints.js new file mode 100644 index 0000000000..ec9656c28c --- /dev/null +++ b/deps/v8/test/mjsunit/debug-script-breakpoints.js @@ -0,0 +1,112 @@ +// Copyright 2008 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 + +// Set and remove a script break point for a named script. +var sbp = Debug.setScriptBreakPointByName("1", 2, 3); +assertEquals(1, Debug.scriptBreakPoints().length); +assertEquals("1", Debug.scriptBreakPoints()[0].script_name()); +assertEquals(2, Debug.scriptBreakPoints()[0].line()); +assertEquals(3, Debug.scriptBreakPoints()[0].column()); +Debug.clearBreakPoint(sbp); +assertEquals(0, Debug.scriptBreakPoints().length); + +// Set three script break points for named scripts. +var sbp1 = Debug.setScriptBreakPointByName("1", 2, 3); +var sbp2 = Debug.setScriptBreakPointByName("2", 3, 4); +var sbp3 = Debug.setScriptBreakPointByName("3", 4, 5); + +// Check the content of the script break points. +assertEquals(3, Debug.scriptBreakPoints().length); +for (var i = 0; i < Debug.scriptBreakPoints().length; i++) { + var x = Debug.scriptBreakPoints()[i]; + if ("1" == x.script_name()) { + assertEquals(2, x.line()); + assertEquals(3, x.column()); + } else if ("2" == x.script_name()) { + assertEquals(3, x.line()); + assertEquals(4, x.column()); + } else if ("3" == x.script_name()) { + assertEquals(4, x.line()); + assertEquals(5, x.column()); + } else { + assertUnreachable("unecpected script_name " + x.script_name()); + } +} + +// Remove script break points (in another order than they where added). +assertEquals(3, Debug.scriptBreakPoints().length); +Debug.clearBreakPoint(sbp1); +assertEquals(2, Debug.scriptBreakPoints().length); +Debug.clearBreakPoint(sbp3); +assertEquals(1, Debug.scriptBreakPoints().length); +Debug.clearBreakPoint(sbp2); +assertEquals(0, Debug.scriptBreakPoints().length); + +// Set and remove a script break point for a script id. +var sbp = Debug.setScriptBreakPointById(1, 2, 3); +assertEquals(1, Debug.scriptBreakPoints().length); +assertEquals(1, Debug.scriptBreakPoints()[0].script_id()); +assertEquals(2, Debug.scriptBreakPoints()[0].line()); +assertEquals(3, Debug.scriptBreakPoints()[0].column()); +Debug.clearBreakPoint(sbp); +assertEquals(0, Debug.scriptBreakPoints().length); + +// Set three script break points for script ids. +var sbp1 = Debug.setScriptBreakPointById(1, 2, 3); +var sbp2 = Debug.setScriptBreakPointById(2, 3, 4); +var sbp3 = Debug.setScriptBreakPointById(3, 4, 5); + +// Check the content of the script break points. +assertEquals(3, Debug.scriptBreakPoints().length); +for (var i = 0; i < Debug.scriptBreakPoints().length; i++) { + var x = Debug.scriptBreakPoints()[i]; + if (1 == x.script_id()) { + assertEquals(2, x.line()); + assertEquals(3, x.column()); + } else if (2 == x.script_id()) { + assertEquals(3, x.line()); + assertEquals(4, x.column()); + } else if (3 == x.script_id()) { + assertEquals(4, x.line()); + assertEquals(5, x.column()); + } else { + assertUnreachable("unecpected script_id " + x.script_id()); + } +} + +// Remove script break points (in another order than they where added). +assertEquals(3, Debug.scriptBreakPoints().length); +Debug.clearBreakPoint(sbp1); +assertEquals(2, Debug.scriptBreakPoints().length); +Debug.clearBreakPoint(sbp3); +assertEquals(1, Debug.scriptBreakPoints().length); +Debug.clearBreakPoint(sbp2); +assertEquals(0, Debug.scriptBreakPoints().length); diff --git a/deps/v8/test/mjsunit/debug-script.js b/deps/v8/test/mjsunit/debug-script.js new file mode 100644 index 0000000000..effa145dee --- /dev/null +++ b/deps/v8/test/mjsunit/debug-script.js @@ -0,0 +1,92 @@ +// Copyright 2008 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 --expose-gc +// Get the Debug object exposed from the debug context global object. +Debug = debug.Debug + +Date(); +RegExp(); + +// Count script types. +var named_native_count = 0; +var extension_count = 0; +var normal_count = 0; +var scripts = Debug.scripts(); +for (i = 0; i < scripts.length; i++) { + if (scripts[i].type == Debug.ScriptType.Native) { + if (scripts[i].name) { + named_native_count++; + } + } else if (scripts[i].type == Debug.ScriptType.Extension) { + extension_count++; + } else if (scripts[i].type == Debug.ScriptType.Normal) { + normal_count++; + } else { + assertUnreachable('Unexpected type ' + scripts[i].type); + } +} + +// This has to be updated if the number of native scripts change. +assertEquals(12, named_native_count); +// If no snapshot is used, only the 'gc' extension is loaded. +// If snapshot is used, all extensions are cached in the snapshot. +assertTrue(extension_count == 1 || extension_count == 5); +// This script and mjsunit.js has been loaded. If using d8, d8 loads +// a normal script during startup too. +assertTrue(normal_count == 2 || normal_count == 3); + +// Test a builtins script. +var math_script = Debug.findScript('native math.js'); +assertEquals('native math.js', math_script.name); +assertEquals(Debug.ScriptType.Native, math_script.type); + +// Test a builtins delay loaded script. +var date_delay_script = Debug.findScript('native date.js'); +assertEquals('native date.js', date_delay_script.name); +assertEquals(Debug.ScriptType.Native, date_delay_script.type); + +// Test a debugger script. +var debug_delay_script = Debug.findScript('native debug.js'); +assertEquals('native debug.js', debug_delay_script.name); +assertEquals(Debug.ScriptType.Native, debug_delay_script.type); + +// Test an extension script. +var extension_gc_script = Debug.findScript('v8/gc'); +if (extension_gc_script) { + assertEquals('v8/gc', extension_gc_script.name); + assertEquals(Debug.ScriptType.Extension, extension_gc_script.type); +} + +// Test a normal script. +var mjsunit_js_script = Debug.findScript(/mjsunit.js/); +assertTrue(/mjsunit.js/.test(mjsunit_js_script.name)); +assertEquals(Debug.ScriptType.Normal, mjsunit_js_script.type); + +// Check a nonexistent script. +var dummy_script = Debug.findScript('dummy.js'); +assertTrue(typeof dummy_script == 'undefined'); diff --git a/deps/v8/test/mjsunit/debug-scripts-request.js b/deps/v8/test/mjsunit/debug-scripts-request.js new file mode 100644 index 0000000000..cf1615bb72 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-scripts-request.js @@ -0,0 +1,95 @@ +// Copyright 2008 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 + +// State to check that the listener code was invoked and that no exceptions +// occoured. +listenerComplete = false; +exception = false; + +var base_request = '"seq":0,"type":"request","command":"scripts"' + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + assertEquals(void 0, e); + return undefined; + } +} + +function testArguments(dcp, arguments, success) { + var request = '{' + base_request + ',"arguments":' + arguments + '}' + var json_response = dcp.processDebugJSONRequest(request); + var response = safeEval(json_response); + if (success) { + assertTrue(response.success, json_response); + } else { + assertFalse(response.success, json_response); + } +} + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Test illegal scripts requests. + testArguments(dcp, '{"types":"xx"}', false); + + // Test legal scripts requests. + var request = '{' + base_request + '}' + var response = safeEval(dcp.processDebugJSONRequest(request)); + assertTrue(response.success); + testArguments(dcp, '{}', true); + testArguments(dcp, '{"types":1}', true); + testArguments(dcp, '{"types":2}', true); + testArguments(dcp, '{"types":4}', true); + testArguments(dcp, '{"types":7}', true); + testArguments(dcp, '{"types":0xFF}', true); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Call debugger to invoke the debug event listener. +debugger; + +// Make sure that the debug event listener vas invoked with no exceptions. +assertTrue(listenerComplete, "listener did not run to completion"); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/debug-setbreakpoint.js b/deps/v8/test/mjsunit/debug-setbreakpoint.js new file mode 100644 index 0000000000..904ec187f2 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-setbreakpoint.js @@ -0,0 +1,153 @@ +// Copyright 2008 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 + +// Simple function which stores the last debug event. +var listenerComplete = false; +var exception = false; +var f_script_id = 0; +var g_script_id = 0; +var h_script_id = 0; +var f_line = 0; +var g_line = 0; + +var base_request = '"seq":0,"type":"request","command":"setbreakpoint"' + +function safeEval(code) { + try { + return eval('(' + code + ')'); + } catch (e) { + assertEquals(void 0, e); + return undefined; + } +} + +function testArguments(dcp, arguments, success, is_script) { + var request = '{' + base_request + ',"arguments":' + arguments + '}' + var json_response = dcp.processDebugJSONRequest(request); + var response = safeEval(json_response); + if (success) { + assertTrue(response.success, json_response); + if (is_script) { + assertEquals('scriptName', response.body.type, json_response); + } else { + assertEquals('scriptId', response.body.type, json_response); + } + } else { + assertFalse(response.success, json_response); + } +} + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Test some illegal setbreakpoint requests. + var request = '{' + base_request + '}' + var response = safeEval(dcp.processDebugJSONRequest(request)); + assertFalse(response.success); + + testArguments(dcp, '{}', false); + testArguments(dcp, '{"type":"xx"}', false); + testArguments(dcp, '{"type":"function"}', false); + testArguments(dcp, '{"type":"script"}', false); + testArguments(dcp, '{"target":"f"}', false); + testArguments(dcp, '{"type":"xx","target":"xx"}', false); + testArguments(dcp, '{"type":"function","target":1}', false); + testArguments(dcp, '{"type":"function","target":"f","line":-1}', false); + testArguments(dcp, '{"type":"function","target":"f","column":-1}', false); + testArguments(dcp, '{"type":"function","target":"f","ignoreCount":-1}', false); + + // Test some legal setbreakpoint requests. + testArguments(dcp, '{"type":"function","target":"f"}', true, false); + testArguments(dcp, '{"type":"function","target":"h"}', true, false); + testArguments(dcp, '{"type":"function","target":"f","line":1}', true, false); + testArguments(dcp, '{"type":"function","target":"f","position":1}', true, false); + testArguments(dcp, '{"type":"function","target":"f","condition":"i == 1"}', true, false); + testArguments(dcp, '{"type":"function","target":"f","enabled":true}', true, false); + testArguments(dcp, '{"type":"function","target":"f","enabled":false}', true, false); + testArguments(dcp, '{"type":"function","target":"f","ignoreCount":7}', true, false); + + testArguments(dcp, '{"type":"script","target":"test"}', true, true); + testArguments(dcp, '{"type":"script","target":"test"}', true, true); + testArguments(dcp, '{"type":"script","target":"test","line":1}', true, true); + testArguments(dcp, '{"type":"script","target":"test","column":1}', true, true); + + testArguments(dcp, '{"type":"scriptId","target":' + f_script_id + ',"line":' + f_line + '}', true, false); + testArguments(dcp, '{"type":"scriptId","target":' + g_script_id + ',"line":' + g_line + '}', true, false); + testArguments(dcp, '{"type":"scriptId","target":' + h_script_id + ',"line":' + h_line + '}', true, false); + + // Indicate that all was processed. + listenerComplete = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function f() { + a=1 +}; + +function g() { + f(); +}; + +eval('function h(){}'); + +// Check the script ids for the test functions. +f_script_id = Debug.findScript(f).id; +g_script_id = Debug.findScript(g).id; +h_script_id = Debug.findScript(h).id; +assertTrue(f_script_id > 0, "invalid script id for f"); +assertTrue(g_script_id > 0, "invalid script id for g"); +assertTrue(h_script_id > 0, "invalid script id for h"); +assertEquals(f_script_id, g_script_id); + +// Get the source line for the test functions. +f_line = Debug.findFunctionSourceLocation(f).line; +g_line = Debug.findFunctionSourceLocation(g).line; +h_line = Debug.findFunctionSourceLocation(h).line; +assertTrue(f_line > 0, "invalid line for f"); +assertTrue(g_line > 0, "invalid line for g"); +assertTrue(f_line < g_line); +assertEquals(h_line, 0, "invalid line for h"); + +// Set a break point and call to invoke the debug event listener. +Debug.setBreakPoint(g, 0, 0); +g(); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerComplete, "listener did not run to completion: " + exception); diff --git a/deps/v8/test/mjsunit/debug-sourceinfo.js b/deps/v8/test/mjsunit/debug-sourceinfo.js new file mode 100644 index 0000000000..36e9f037ef --- /dev/null +++ b/deps/v8/test/mjsunit/debug-sourceinfo.js @@ -0,0 +1,276 @@ +// Copyright 2008 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
+// For this test to work this file MUST have CR LF line endings.
+function a() { b(); };
+function b() {
+ c(true);
+};
+ function c(x) {
+ if (x) {
+ return 1;
+ } else {
+ return 1;
+ }
+ };
+
+// Get the Debug object exposed from the debug context global object.
+Debug = debug.Debug
+
+// This is the number of comment lines above the first test function.
+var comment_lines = 29;
+
+// This magic number is the length or the first line comment (actually number
+// of characters before 'function a(...'.
+var comment_line_length = 1726;
+var start_a = 10 + comment_line_length;
+var start_b = 37 + comment_line_length;
+var start_c = 71 + comment_line_length;
+
+assertEquals(start_a, Debug.sourcePosition(a));
+assertEquals(start_b, Debug.sourcePosition(b));
+assertEquals(start_c, Debug.sourcePosition(c));
+
+var script = Debug.findScript(a);
+assertTrue(script.data === Debug.findScript(b).data);
+assertTrue(script.data === Debug.findScript(c).data);
+assertTrue(script.source === Debug.findScript(b).source);
+assertTrue(script.source === Debug.findScript(c).source);
+
+// Test that when running through source positions the position, line and
+// column progresses as expected.
+var position;
+var line;
+var column;
+for (var p = 0; p < 100; p++) {
+ var location = script.locationFromPosition(p);
+ if (p > 0) {
+ assertEquals(position + 1, location.position);
+ if (line == location.line) {
+ assertEquals(column + 1, location.column);
+ } else {
+ assertEquals(line + 1, location.line);
+ assertEquals(0, location.column);
+ }
+ } else {
+ assertEquals(0, location.position);
+ assertEquals(0, location.line);
+ assertEquals(0, location.column);
+ }
+
+ // Remember the location.
+ position = location.position;
+ line = location.line;
+ column = location.column;
+}
+
+// Test first position.
+assertEquals(0, script.locationFromPosition(0).position);
+assertEquals(0, script.locationFromPosition(0).line);
+assertEquals(0, script.locationFromPosition(0).column);
+
+// Test second position.
+assertEquals(1, script.locationFromPosition(1).position);
+assertEquals(0, script.locationFromPosition(1).line);
+assertEquals(1, script.locationFromPosition(1).column);
+
+// Test first position in finction a.
+assertEquals(start_a, script.locationFromPosition(start_a).position);
+assertEquals(0, script.locationFromPosition(start_a).line - comment_lines);
+assertEquals(10, script.locationFromPosition(start_a).column);
+
+// Test first position in finction b.
+assertEquals(start_b, script.locationFromPosition(start_b).position);
+assertEquals(1, script.locationFromPosition(start_b).line - comment_lines);
+assertEquals(13, script.locationFromPosition(start_b).column);
+
+// Test first position in finction b.
+assertEquals(start_c, script.locationFromPosition(start_c).position);
+assertEquals(4, script.locationFromPosition(start_c).line - comment_lines);
+assertEquals(12, script.locationFromPosition(start_c).column);
+
+// Test first line.
+assertEquals(0, script.locationFromLine().position);
+assertEquals(0, script.locationFromLine().line);
+assertEquals(0, script.locationFromLine().column);
+assertEquals(0, script.locationFromLine(0).position);
+assertEquals(0, script.locationFromLine(0).line);
+assertEquals(0, script.locationFromLine(0).column);
+
+// Test first line column 1
+assertEquals(1, script.locationFromLine(0, 1).position);
+assertEquals(0, script.locationFromLine(0, 1).line);
+assertEquals(1, script.locationFromLine(0, 1).column);
+
+// Test first line offset 1
+assertEquals(1, script.locationFromLine(0, 0, 1).position);
+assertEquals(0, script.locationFromLine(0, 0, 1).line);
+assertEquals(1, script.locationFromLine(0, 0, 1).column);
+
+// Test offset function a
+assertEquals(start_a, script.locationFromLine(void 0, void 0, start_a).position);
+assertEquals(0, script.locationFromLine(void 0, void 0, start_a).line - comment_lines);
+assertEquals(10, script.locationFromLine(void 0, void 0, start_a).column);
+assertEquals(start_a, script.locationFromLine(0, void 0, start_a).position);
+assertEquals(0, script.locationFromLine(0, void 0, start_a).line - comment_lines);
+assertEquals(10, script.locationFromLine(0, void 0, start_a).column);
+assertEquals(start_a, script.locationFromLine(0, 0, start_a).position);
+assertEquals(0, script.locationFromLine(0, 0, start_a).line - comment_lines);
+assertEquals(10, script.locationFromLine(0, 0, start_a).column);
+
+// Test second line offset function a
+assertEquals(start_a + 14, script.locationFromLine(1, 0, start_a).position);
+assertEquals(1, script.locationFromLine(1, 0, start_a).line - comment_lines);
+assertEquals(0, script.locationFromLine(1, 0, start_a).column);
+
+// Test second line column 2 offset function a
+assertEquals(start_a + 14 + 2, script.locationFromLine(1, 2, start_a).position);
+assertEquals(1, script.locationFromLine(1, 2, start_a).line - comment_lines);
+assertEquals(2, script.locationFromLine(1, 2, start_a).column);
+
+// Test offset function b
+assertEquals(start_b, script.locationFromLine(0, 0, start_b).position);
+assertEquals(1, script.locationFromLine(0, 0, start_b).line - comment_lines);
+assertEquals(13, script.locationFromLine(0, 0, start_b).column);
+
+// Test second line offset function b
+assertEquals(start_b + 6, script.locationFromLine(1, 0, start_b).position);
+assertEquals(2, script.locationFromLine(1, 0, start_b).line - comment_lines);
+assertEquals(0, script.locationFromLine(1, 0, start_b).column);
+
+// Test second line column 11 offset function b
+assertEquals(start_b + 6 + 11, script.locationFromLine(1, 11, start_b).position);
+assertEquals(2, script.locationFromLine(1, 11, start_b).line - comment_lines);
+assertEquals(11, script.locationFromLine(1, 11, start_b).column);
+
+// Test second line column 12 offset function b. Second line in b is 11 long
+// using column 12 wraps to next line.
+assertEquals(start_b + 6 + 12, script.locationFromLine(1, 12, start_b).position);
+assertEquals(3, script.locationFromLine(1, 12, start_b).line - comment_lines);
+assertEquals(0, script.locationFromLine(1, 12, start_b).column);
+
+// Test the Debug.findSourcePosition which wraps SourceManager.
+assertEquals(0 + start_a, Debug.findFunctionSourceLocation(a, 0, 0).position);
+assertEquals(0 + start_b, Debug.findFunctionSourceLocation(b, 0, 0).position);
+assertEquals(6 + start_b, Debug.findFunctionSourceLocation(b, 1, 0).position);
+assertEquals(8 + start_b, Debug.findFunctionSourceLocation(b, 1, 2).position);
+assertEquals(18 + start_b, Debug.findFunctionSourceLocation(b, 2, 0).position);
+assertEquals(0 + start_c, Debug.findFunctionSourceLocation(c, 0, 0).position);
+assertEquals(7 + start_c, Debug.findFunctionSourceLocation(c, 1, 0).position);
+assertEquals(21 + start_c, Debug.findFunctionSourceLocation(c, 2, 0).position);
+assertEquals(38 + start_c, Debug.findFunctionSourceLocation(c, 3, 0).position);
+assertEquals(52 + start_c, Debug.findFunctionSourceLocation(c, 4, 0).position);
+assertEquals(69 + start_c, Debug.findFunctionSourceLocation(c, 5, 0).position);
+assertEquals(76 + start_c, Debug.findFunctionSourceLocation(c, 6, 0).position);
+
+// Test source line and restriction. All the following tests start from line 1
+// column 2 in function b, which is the call to c.
+// c(true);
+// ^
+
+var location;
+
+location = script.locationFromLine(1, 0, start_b);
+assertEquals(' c(true);', location.sourceText());
+
+result = ['c', ' c', ' c(', ' c(', ' c(t']
+for (var i = 1; i <= 5; i++) {
+ location = script.locationFromLine(1, 2, start_b);
+ location.restrict(i);
+ assertEquals(result[i - 1], location.sourceText());
+}
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(1, 0);
+assertEquals('c', location.sourceText());
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(2, 0);
+assertEquals('c(', location.sourceText());
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(2, 1);
+assertEquals(' c', location.sourceText());
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(2, 2);
+assertEquals(' c', location.sourceText());
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(2, 3);
+assertEquals(' c', location.sourceText());
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(3, 1);
+assertEquals(' c(', location.sourceText());
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(5, 0);
+assertEquals('c(tru', location.sourceText());
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(5, 2);
+assertEquals(' c(t', location.sourceText());
+
+location = script.locationFromLine(1, 2, start_b);
+location.restrict(5, 4);
+assertEquals(' c(t', location.sourceText());
+
+// All the following tests start from line 1 column 10 in function b, which is
+// the final character.
+// c(true);
+// ^
+
+location = script.locationFromLine(1, 10, start_b);
+location.restrict(5, 0);
+assertEquals('rue);', location.sourceText());
+
+location = script.locationFromLine(1, 10, start_b);
+location.restrict(7, 0);
+assertEquals('(true);', location.sourceText());
+
+// All the following tests start from line 1 column 0 in function b, which is
+// the first character.
+// c(true);
+//^
+
+location = script.locationFromLine(1, 0, start_b);
+location.restrict(5, 0);
+assertEquals(' c(t', location.sourceText());
+
+location = script.locationFromLine(1, 0, start_b);
+location.restrict(5, 4);
+assertEquals(' c(t', location.sourceText());
+
+location = script.locationFromLine(1, 0, start_b);
+location.restrict(7, 0);
+assertEquals(' c(tru', location.sourceText());
+
+location = script.locationFromLine(1, 0, start_b);
+location.restrict(7, 6);
+assertEquals(' c(tru', location.sourceText());
diff --git a/deps/v8/test/mjsunit/debug-sourceslice.js b/deps/v8/test/mjsunit/debug-sourceslice.js new file mode 100644 index 0000000000..db9a3e7da8 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-sourceslice.js @@ -0,0 +1,74 @@ +// Copyright 2008 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 +// Source lines for test. +var lines = [ 'function a() { b(); };\n', + 'function b() {\n', + ' c(true);\n', + '};\n', + ' function c(x) {\n', + ' if (x) {\n', + ' return 1;\n', + ' } else {\n', + ' return 1;\n', + ' }\n', + ' };\n' ]; + +// Build source by putting all lines together +var source = ''; +for (var i = 0; i < lines.length; i++) { + source += lines[i]; +} +eval(source); + +// Flags: --expose-debug-as debug +// Get the Debug object exposed from the debug context global object. +Debug = debug.Debug + +// Get the script object from one of the functions in the source. +var script = Debug.findScript(a); + +// Make sure that the source is as expected. +assertEquals(source, script.source); +assertEquals(source, script.sourceSlice().sourceText()); + +// Try all possible line interval slices. +for (var slice_size = 0; slice_size < lines.length; slice_size++) { + for (var n = 0; n < lines.length - slice_size; n++) { + var slice = script.sourceSlice(n, n + slice_size); + assertEquals(n, slice.from_line); + assertEquals(n + slice_size, slice.to_line); + + var text = slice.sourceText(); + var expected = ''; + for (var i = 0; i < slice_size; i++) { + expected += lines[n + i]; + } + assertEquals(expected, text); + } +} diff --git a/deps/v8/test/mjsunit/debug-step-stub-callfunction.js b/deps/v8/test/mjsunit/debug-step-stub-callfunction.js new file mode 100644 index 0000000000..fbb8078621 --- /dev/null +++ b/deps/v8/test/mjsunit/debug-step-stub-callfunction.js @@ -0,0 +1,73 @@ +// Copyright 2008 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 + +// Simple debug event handler which counts the number of breaks hit and steps. +var break_break_point_hit_count = 0; +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) { + break_break_point_hit_count++; + // Continue stepping until returned to bottom frame. + if (exec_state.frameCount() > 1) { + exec_state.prepareStep(Debug.StepAction.StepIn); + } + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Use 'eval' to ensure that the call to print is through CodeStub CallFunction. +// See Ia32CodeGenerator::VisitCall and Ia32CodeGenerator::CallWithArguments. +function f() { + debugger; + eval(''); + print('Hello, world!'); +}; + +break_break_point_hit_count = 0; +f(); +assertEquals(5, break_break_point_hit_count); + +// Use an inner function to ensure that the function call is through CodeStub +// CallFunction see Ia32CodeGenerator::VisitCall and +// Ia32CodeGenerator::CallWithArguments. +function g() { + function h() {} + debugger; + h(); +}; + +break_break_point_hit_count = 0; +g(); +assertEquals(4, break_break_point_hit_count); + +// Get rid of the debug event listener. +Debug.setListener(null); diff --git a/deps/v8/test/mjsunit/debug-step.js b/deps/v8/test/mjsunit/debug-step.js new file mode 100644 index 0000000000..453421864b --- /dev/null +++ b/deps/v8/test/mjsunit/debug-step.js @@ -0,0 +1,82 @@ +// Copyright 2008 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 + +// Simple debug event handler which first time hit will perform 1000 steps and +// second time hit will evaluate and store the value of "i". If requires that +// the global property "state" is initially zero. + +var bp1, bp2; + +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) { + if (state == 0) { + exec_state.prepareStep(Debug.StepAction.StepIn, 1000); + state = 1; + } else if (state == 1) { + result = exec_state.frame().evaluate("i").value(); + // Clear the break point on line 2 if set. + if (bp2) { + Debug.clearBreakPoint(bp2); + } + } + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Test debug event for break point. +function f() { + for (i = 0; i < 1000; i++) { // Line 1. + x = 1; // Line 2. + } +}; + +// Set a breakpoint on the for statement (line 1). +bp1 = Debug.setBreakPoint(f, 1); + +// Check that performing 1000 steps will make i 499. +state = 0; +result = -1; +f(); +assertEquals(499, result); + +// Check that performing 1000 steps with a break point on the statement in the +// for loop (line 2) will only make i 0 as a real break point breaks even when +// multiple steps have been requested. +state = 0; +result = -1; +bp2 = Debug.setBreakPoint(f, 2); +f(); +assertEquals(0, result); + +// Get rid of the debug event listener. +Debug.setListener(null);
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/debug-stepin-constructor.js b/deps/v8/test/mjsunit/debug-stepin-constructor.js new file mode 100644 index 0000000000..6dbe5d192b --- /dev/null +++ b/deps/v8/test/mjsunit/debug-stepin-constructor.js @@ -0,0 +1,74 @@ +// Copyright 2008 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 + +// Simple debug event handler which counts the number of breaks hit and steps. +var break_break_point_hit_count = 0; +function listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) { + break_break_point_hit_count++; + // Continue stepping until returned to bottom frame. + if (exec_state.frameCount() > 1) { + exec_state.prepareStep(Debug.StepAction.StepIn); + } + + // Test that there is a script. + assertTrue(typeof(event_data.func().script()) == 'object'); + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Test step into constructor with simple constructor. +function X() { +} + +function f() { + debugger; + new X(); +}; + +break_break_point_hit_count = 0; +f(); +assertEquals(5, break_break_point_hit_count); + +// Test step into constructor with builtin constructor. +function g() { + debugger; + new Date(); +}; + +break_break_point_hit_count = 0; +g(); +assertEquals(4, break_break_point_hit_count); + +// Get rid of the debug event listener. +Debug.setListener(null); diff --git a/deps/v8/test/mjsunit/declare-locally.js b/deps/v8/test/mjsunit/declare-locally.js new file mode 100644 index 0000000000..93fcb85f3c --- /dev/null +++ b/deps/v8/test/mjsunit/declare-locally.js @@ -0,0 +1,43 @@ +// Copyright 2008 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. + +// Make sure that we're not overwriting global +// properties defined in the prototype chain too +// early when shadowing them with var/const +// declarations. + +// This exercises the code in runtime.cc in +// DeclareGlobal...Locally(). + +this.__proto__.foo = 42; +this.__proto__.bar = 87; + +eval("assertEquals(42, foo); var foo = 87;"); +assertEquals(87, foo); + +eval("assertEquals(87, bar); const bar = 42;"); +assertEquals(42, bar); diff --git a/deps/v8/test/mjsunit/deep-recursion.js b/deps/v8/test/mjsunit/deep-recursion.js new file mode 100644 index 0000000000..a8093eb6be --- /dev/null +++ b/deps/v8/test/mjsunit/deep-recursion.js @@ -0,0 +1,64 @@ +// Copyright 2008 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. + +/** + * @fileoverview Check that flattening deep trees of cons strings does not + * cause stack overflows. + */ + +var depth = 110000; + +function newdeep(start) { + var d = start; + for (var i = 0; i < depth; i++) { + d = d + "f"; + } + return d; +} + +var deep = newdeep("foo"); +assertEquals('f', deep[0]); + +var cmp1 = newdeep("a"); +var cmp2 = newdeep("b"); + +assertEquals(-1, cmp1.localeCompare(cmp2), "ab"); + +var cmp2empty = newdeep("c"); +assertTrue(cmp2empty.localeCompare("") > 0, "c"); + +var cmp3empty = newdeep("d"); +assertTrue("".localeCompare(cmp3empty) < 0), "d"; + +var slicer = newdeep("slice"); + +for (i = 0; i < depth + 4; i += 2) { + slicer = slicer.slice(1, -1); +} + +assertEquals("f", slicer[0]); +assertEquals(1, slicer.length); diff --git a/deps/v8/test/mjsunit/delay-syntax-error.js b/deps/v8/test/mjsunit/delay-syntax-error.js new file mode 100644 index 0000000000..4fcb1435c5 --- /dev/null +++ b/deps/v8/test/mjsunit/delay-syntax-error.js @@ -0,0 +1,41 @@ +// Copyright 2008 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. + +// To be compatible with KJS syntax errors for illegal return, break +// and continue should be delayed to runtime. + +// Do not throw syntax errors for illegal return, break and continue +// at compile time. +assertDoesNotThrow("if (false) return;"); +assertDoesNotThrow("if (false) break;"); +assertDoesNotThrow("if (false) continue;"); + +// Throw syntax errors for illegal return, break and continue at +// compile time. +assertThrows("return;"); +assertThrows("break;"); +assertThrows("continue;"); diff --git a/deps/v8/test/mjsunit/delete-global-properties.js b/deps/v8/test/mjsunit/delete-global-properties.js new file mode 100644 index 0000000000..b3813dc150 --- /dev/null +++ b/deps/v8/test/mjsunit/delete-global-properties.js @@ -0,0 +1,37 @@ +// Copyright 2008 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. + +// Global properties declared with 'var' or 'function' should not be +// deleteable. +var tmp; +assertFalse(delete tmp); // should be DONT_DELETE +assertTrue("tmp" in this); +function f() { return 1; } +assertFalse(delete f); // should be DONT_DELETE +assertEquals(1, f()); + +/* Perhaps related to bugs/11? */ diff --git a/deps/v8/test/mjsunit/delete-in-eval.js b/deps/v8/test/mjsunit/delete-in-eval.js new file mode 100644 index 0000000000..9278013ead --- /dev/null +++ b/deps/v8/test/mjsunit/delete-in-eval.js @@ -0,0 +1,32 @@ +// Copyright 2008 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. + +// Should be able to delete properties in the context through eval(). +tmp = 0; +assertTrue(eval("delete XXX")); // non-existing +assertTrue(eval("delete tmp")); // existing +assertFalse("tmp" in this); diff --git a/deps/v8/test/mjsunit/delete-in-with.js b/deps/v8/test/mjsunit/delete-in-with.js new file mode 100644 index 0000000000..1efc18de11 --- /dev/null +++ b/deps/v8/test/mjsunit/delete-in-with.js @@ -0,0 +1,34 @@ +// Copyright 2008 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. + +// It should be possible to delete properties of 'with' context +// objects from within 'with' statements. +(function(){ + var tmp = { x: 12 }; + with (tmp) { assertTrue(delete x); } + assertFalse("x" in tmp); +})(); diff --git a/deps/v8/test/mjsunit/delete-vars-from-eval.js b/deps/v8/test/mjsunit/delete-vars-from-eval.js new file mode 100644 index 0000000000..a457466d74 --- /dev/null +++ b/deps/v8/test/mjsunit/delete-vars-from-eval.js @@ -0,0 +1,40 @@ +// Copyright 2008 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. + +// Variable declarations in eval() must introduce delete-able vars; +// even when they are local to a function. +(function() { + eval("var tmp0 = 0"); + assertEquals(0, tmp0); + assertTrue(delete tmp0); + assertTrue(typeof(tmp0) == 'undefined'); +})(); + +eval("var tmp1 = 1"); +assertEquals(1, tmp1); +assertTrue(delete tmp1); +assertTrue(typeof(tmp1) == 'undefined'); diff --git a/deps/v8/test/mjsunit/delete.js b/deps/v8/test/mjsunit/delete.js new file mode 100644 index 0000000000..6fc15e926d --- /dev/null +++ b/deps/v8/test/mjsunit/delete.js @@ -0,0 +1,163 @@ +// Copyright 2008 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. + +// We use the has() function to avoid relying on a functioning +// implementation of 'in'. +function has(o, k) { return typeof o[k] !== 'undefined'; } + +assertTrue(delete null); +assertTrue(delete 2); +assertTrue(delete 'foo'); +assertTrue(delete Number(7)); +assertTrue(delete new Number(8)); + +assertTrue(delete {}.x); +assertTrue(delete {}.y); +assertTrue(delete {}.toString); + +x = 42; +assertEquals(42, x); +assertTrue(delete x); +assertTrue(typeof x === 'undefined', "x is gone"); + +/**** + * This test relies on DontDelete attributes. This is not + * working yet. + +var y = 87; // should have DontDelete attribute +assertEquals(87, y); +assertFalse(delete y, "don't delete"); +assertFalse(typeof y === 'undefined'); +assertEquals(87, y); +*/ + +var o = { x: 42, y: 87 }; +assertTrue(has(o, 'x')); +assertTrue(has(o, 'y')); +assertTrue(delete o.x); +assertFalse(has(o, 'x')); +assertTrue(has(o, 'y')); +assertTrue(delete o['y']); +assertFalse(has(o, 'x')); +assertFalse(has(o, 'y')); + + +var o = {}; +for (var i = 0x0020; i < 0x02ff; i+=2) { + o[String.fromCharCode(i)] = i; + o[String.fromCharCode(i+1)] = i+1; +} +for (var i = 0x0020; i < 0x02ff; i+=2) { + assertTrue(delete o[String.fromCharCode(i)]); +} +for (var i = 0x0020; i < 0x02ff; i+=2) { + assertFalse(has(o, String.fromCharCode(i)), "deleted (" + i + ")"); + assertTrue(has(o, String.fromCharCode(i+1)), "still here (" + i + ")"); +} + + +var a = [0,1,2]; +assertTrue(has(a, 0)); +assertTrue(delete a[0]); +assertFalse(has(a, 0), "delete 0"); +assertEquals(1, a[1]); +assertEquals(2, a[2]); +assertTrue(delete a[100], "delete 100"); +assertTrue(delete a[Math.pow(2,31)-1], "delete 2^31-1"); +assertFalse(has(a, 0), "delete 0"); +assertEquals(1, a[1]); +assertEquals(2, a[2]); + + +var a = [0,1,2]; +assertEquals(3, a.length); +assertTrue(delete a[2]); +assertEquals(3, a.length); +assertTrue(delete a[0]); +assertEquals(3, a.length); +assertTrue(delete a[1]); +assertEquals(3, a.length); + + +var o = {}; +o[Math.pow(2,30)-1] = 0; +o[Math.pow(2,31)-1] = 0; +o[1] = 0; +assertTrue(delete o[0]); +assertTrue(delete o[Math.pow(2,30)]); +assertFalse(has(o, 0), "delete 0"); +assertFalse(has(o, Math.pow(2,30))); +assertTrue(has(o, 1)); +assertTrue(has(o, Math.pow(2,30)-1)); +assertTrue(has(o, Math.pow(2,31)-1)); + +assertTrue(delete o[Math.pow(2,30)-1]); +assertTrue(has(o, 1)); +assertFalse(has(o, Math.pow(2,30)-1), "delete 2^30-1"); +assertTrue(has(o, Math.pow(2,31)-1)); + +assertTrue(delete o[1]); +assertFalse(has(o, 1), "delete 1"); +assertFalse(has(o, Math.pow(2,30)-1), "delete 2^30-1"); +assertTrue(has(o, Math.pow(2,31)-1)); + +assertTrue(delete o[Math.pow(2,31)-1]); +assertFalse(has(o, 1), "delete 1"); +assertFalse(has(o, Math.pow(2,30)-1), "delete 2^30-1"); +assertFalse(has(o, Math.pow(2,31)-1), "delete 2^31-1"); + + +var a = []; +a[Math.pow(2,30)-1] = 0; +a[Math.pow(2,31)-1] = 0; +a[1] = 0; +assertTrue(delete a[0]); +assertTrue(delete a[Math.pow(2,30)]); +assertFalse(has(a, 0), "delete 0"); +assertFalse(has(a, Math.pow(2,30)), "delete 2^30"); +assertTrue(has(a, 1)); +assertTrue(has(a, Math.pow(2,30)-1)); +assertTrue(has(a, Math.pow(2,31)-1)); +assertEquals(Math.pow(2,31), a.length); + +assertTrue(delete a[Math.pow(2,30)-1]); +assertTrue(has(a, 1)); +assertFalse(has(a, Math.pow(2,30)-1), "delete 2^30-1"); +assertTrue(has(a, Math.pow(2,31)-1)); +assertEquals(Math.pow(2,31), a.length); + +assertTrue(delete a[1]); +assertFalse(has(a, 1), "delete 1"); +assertFalse(has(a, Math.pow(2,30)-1), "delete 2^30-1"); +assertTrue(has(a, Math.pow(2,31)-1)); +assertEquals(Math.pow(2,31), a.length); + +assertTrue(delete a[Math.pow(2,31)-1]); +assertFalse(has(a, 1), "delete 1"); +assertFalse(has(a, Math.pow(2,30)-1), "delete 2^30-1"); +assertFalse(has(a, Math.pow(2,31)-1), "delete 2^31-1"); +assertEquals(Math.pow(2,31), a.length); diff --git a/deps/v8/test/mjsunit/do-not-strip-fc.js b/deps/v8/test/mjsunit/do-not-strip-fc.js new file mode 100644 index 0000000000..1aef28cb62 --- /dev/null +++ b/deps/v8/test/mjsunit/do-not-strip-fc.js @@ -0,0 +1,31 @@ +// Copyright 2008 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. + +// Make sure we do not remove unicode format-control characters +// from string literals. +assertEquals(7, eval("'foo\u200dbar'").length); +assertEquals(7, eval("'foo\u200cbar'").length); diff --git a/deps/v8/test/mjsunit/dont-enum-array-holes.js b/deps/v8/test/mjsunit/dont-enum-array-holes.js new file mode 100644 index 0000000000..4761dc4ea0 --- /dev/null +++ b/deps/v8/test/mjsunit/dont-enum-array-holes.js @@ -0,0 +1,35 @@ +// Copyright 2008 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. + +// Do not enum holes in arrays. +var count = 0; +for (var i in [,1,,3]) count++; +assertEquals(2, count); + +count = 0; +for (var i in new Array(10)) count++; +assertEquals(0, count); diff --git a/deps/v8/test/mjsunit/dont-reinit-global-var.js b/deps/v8/test/mjsunit/dont-reinit-global-var.js new file mode 100644 index 0000000000..1e3c1a01a7 --- /dev/null +++ b/deps/v8/test/mjsunit/dont-reinit-global-var.js @@ -0,0 +1,47 @@ +// Copyright 2008 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 foo = 'fisk'; +assertEquals('fisk', foo); +var foo; +assertEquals('fisk', foo); +var foo = 'hest'; +assertEquals('hest', foo); + +this.bar = 'fisk'; +assertEquals('fisk', bar); +var bar; +assertEquals('fisk', bar); +var bar = 'hest'; +assertEquals('hest', bar); + +this.baz = 'fisk'; +assertEquals('fisk', baz); +eval('var baz;'); +assertEquals('fisk', baz); +eval('var baz = "hest";'); +assertEquals('hest', baz); diff --git a/deps/v8/test/mjsunit/double-equals.js b/deps/v8/test/mjsunit/double-equals.js new file mode 100644 index 0000000000..a68d7eaf98 --- /dev/null +++ b/deps/v8/test/mjsunit/double-equals.js @@ -0,0 +1,114 @@ +// Copyright 2008 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. + +/** + * This test uses assert{True,False}(... == ...) instead of + * assertEquals(..., ...) to not rely on the details of the + * implementation of assertEquals. + */ + +assertTrue (void 0 == void 0, "void 0 == void 0"); +assertTrue (null == null, "null == null"); +assertFalse(NaN == NaN, "NaN == NaN"); +assertFalse(NaN == 0, "NaN == 0"); +assertFalse(0 == NaN, "0 == NaN"); +assertFalse(NaN == Infinity, "NaN == Inf"); +assertFalse(Infinity == NaN, "Inf == NaN"); + +assertTrue(Number.MAX_VALUE == Number.MAX_VALUE, "MAX == MAX"); +assertTrue(Number.MIN_VALUE == Number.MIN_VALUE, "MIN == MIN"); +assertTrue(Infinity == Infinity, "Inf == Inf"); +assertTrue(-Infinity == -Infinity, "-Inf == -Inf"); + +assertTrue(0 == 0, "0 == 0"); +assertTrue(0 == -0, "0 == -0"); +assertTrue(-0 == 0, "-0 == 0"); +assertTrue(-0 == -0, "-0 == -0"); + +assertFalse(0.9 == 1, "0.9 == 1"); +assertFalse(0.999999 == 1, "0.999999 == 1"); +assertFalse(0.9999999999 == 1, "0.9999999999 == 1"); +assertFalse(0.9999999999999 == 1, "0.9999999999999 == 1"); + +assertTrue('hello' == 'hello', "'hello' == 'hello'"); + +assertTrue (true == true, "true == true"); +assertTrue (false == false, "false == false"); +assertFalse(true == false, "true == false"); +assertFalse(false == true, "false == true"); + +assertFalse(new Wrapper(null) == new Wrapper(null), "new Wrapper(null) == new Wrapper(null)"); +assertFalse(new Boolean(true) == new Boolean(true), "new Boolean(true) == new Boolean(true)"); +assertFalse(new Boolean(false) == new Boolean(false), "new Boolean(false) == new Boolean(false)"); + +(function () { + var x = new Wrapper(null); + var y = x, z = x; + assertTrue(y == x); +})(); + +(function () { + var x = new Boolean(true); + var y = x, z = x; + assertTrue(y == x); +})(); + +(function () { + var x = new Boolean(false); + var y = x, z = x; + assertTrue(y == x); +})(); + +assertTrue(null == void 0, "null == void 0"); +assertTrue(void 0 == null, "void 0 == null"); +assertFalse(new Wrapper(null) == null, "new Wrapper(null) == null"); +assertFalse(null == new Wrapper(null), "null == new Wrapper(null)"); + +assertTrue(1 == '1', "1 == '1"); +assertTrue(255 == '0xff', "255 == '0xff'"); +assertTrue(0 == '\r', "0 == '\\r'"); +assertTrue(1e19 == '1e19', "1e19 == '1e19'"); + +assertTrue(new Boolean(true) == true, "new Boolean(true) == true"); +assertTrue(new Boolean(false) == false, "new Boolean(false) == false"); +assertTrue(true == new Boolean(true), "true == new Boolean(true)"); +assertTrue(false == new Boolean(false), "false == new Boolean(false)"); + +assertTrue(Boolean(true) == true, "Boolean(true) == true"); +assertTrue(Boolean(false) == false, "Boolean(false) == false"); +assertTrue(true == Boolean(true), "true == Boolean(true)"); +assertTrue(false == Boolean(false), "false == Boolean(false)"); + +assertTrue(new Wrapper(true) == true, "new Wrapper(true) == true"); +assertTrue(new Wrapper(false) == false, "new Wrapper(false) == false"); +assertTrue(true == new Wrapper(true), "true = new Wrapper(true)"); +assertTrue(false == new Wrapper(false), "false = new Wrapper(false)"); + +function Wrapper(value) { + this.value = value; + this.valueOf = function () { return this.value; }; +} diff --git a/deps/v8/test/mjsunit/dtoa.js b/deps/v8/test/mjsunit/dtoa.js new file mode 100644 index 0000000000..80167b78b1 --- /dev/null +++ b/deps/v8/test/mjsunit/dtoa.js @@ -0,0 +1,32 @@ +// Copyright 2008 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. + +// dtoa.c used to contain a bogus assertions that got triggered when +// passed very small numbers. This test therefore used to fail in +// debug mode. + +assertEquals(0, 1e-500); diff --git a/deps/v8/test/mjsunit/enumeration-order.js b/deps/v8/test/mjsunit/enumeration-order.js new file mode 100644 index 0000000000..699a636cc9 --- /dev/null +++ b/deps/v8/test/mjsunit/enumeration-order.js @@ -0,0 +1,59 @@ +// Copyright 2008 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 check_enumeration_order(obj) { + var value = 0; + for (var name in obj) assertTrue(value < obj[name]); + value = obj[name]; +} + +function make_object(size) { + var a = new Object(); + + for (var i = 0; i < size; i++) a["a_" + i] = i + 1; + check_enumeration_order(a); + + for (var i = 0; i < size; i +=3) delete a["a_" + i]; + check_enumeration_order(a); +} + +// Validate the enumeration order for object up to 100 named properties. +for (var j = 1; j< 100; j++) make_object(j); + + +function make_literal_object(size) { + var code = "{ "; + for (var i = 0; i < size-1; i++) code += " a_" + i + " : " + (i + 1) + ", "; + code += "a_" + (size - 1) + " : " + size; + code += " }"; + eval("var a = " + code); + check_enumeration_order(a); +} + +// Validate the enumeration order for object literals up to 100 named properties. +for (var j = 1; j< 100; j++) make_literal_object(j); + diff --git a/deps/v8/test/mjsunit/error-constructors.js b/deps/v8/test/mjsunit/error-constructors.js new file mode 100644 index 0000000000..ca2aa060a5 --- /dev/null +++ b/deps/v8/test/mjsunit/error-constructors.js @@ -0,0 +1,32 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +var e = new Error(); +assertFalse(e.hasOwnProperty('message')); +Error.prototype.toString = Object.prototype.toString; +assertEquals("[object Error]", Error.prototype.toString()); +assertEquals(Object.prototype, Error.prototype.__proto__); diff --git a/deps/v8/test/mjsunit/escape.js b/deps/v8/test/mjsunit/escape.js new file mode 100644 index 0000000000..5732ce3ae0 --- /dev/null +++ b/deps/v8/test/mjsunit/escape.js @@ -0,0 +1,118 @@ +// Copyright 2008 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. + +/** + * @fileoverview Check that the global escape and unescape functions work + * right. + */ + +// Section B.2.1 of ECMAScript 3 +var unescaped = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789@*_+-./"; + +// Check the unescape chars are not escaped +assertEquals(unescaped, escape(unescaped)); +// Check spaces are escaped +assertEquals("%20/%20", escape(" / ")); +// Check that null chars are escaped and do not terminate the string +assertEquals("%000", escape("\0" + "0")); +// Check a unicode escape +assertEquals("A%20B%u1234%00%20C", escape(String.fromCharCode(0x41, 0x20, 0x42, 0x1234, 0, 0x20, 0x43))); +// Check unicode escapes have a leading zero to pad to 4 digits +assertEquals("%u0123", escape(String.fromCharCode(0x123))); +// Check escapes are upper case +assertEquals("%uABCD", escape(String.fromCharCode(0xabcd))); +assertEquals("%AB", escape(String.fromCharCode(0xab))); +assertEquals("%0A", escape("\n")); + +// Check first 1000 chars individually for escaped/not escaped +for (var i = 0; i < 1000; i++) { + var s = String.fromCharCode(i); + if (unescaped.indexOf(s, 0) == -1) { + assertFalse(s == escape(s)); + } else { + assertTrue(s == escape(s)); + } +} + +// Check all chars up to 1000 in groups of 10 using unescape as a check +for (var i = 0; i < 1000; i += 10) { + var s = String.fromCharCode(i, i+1, i+2, i+3, i+4, i+5, i+6, i+7, i+8, i+9); + assertEquals(s, unescape(escape(s))); +} + +// Benchmark +var example = "Now is the time for all good men to come to the aid of the party."; +example = example + String.fromCharCode(267, 0x1234, 0x6667, 0xabcd); +example = example + " The quick brown fox jumps over the lazy dog." +example = example + String.fromCharCode(171, 172, 173, 174, 175, 176, 178, 179); + +for (var i = 0; i < 3000; i++) { + assertEquals(example, unescape(escape(example))); +} + +// Check unescape can cope with upper and lower case +assertEquals(unescape("%41%4A%4a"), "AJJ"); + +// Check upper case U +assertEquals("%U1234", unescape("%U1234")); + +// Check malformed unescapes +assertEquals("%", unescape("%")); +assertEquals("%4", unescape("%4")); +assertEquals("%u", unescape("%u")); +assertEquals("%u4", unescape("%u4")); +assertEquals("%u44", unescape("%u44")); +assertEquals("%u444", unescape("%u444")); +assertEquals("%4z", unescape("%4z")); +assertEquals("%uzzzz", unescape("%uzzzz")); +assertEquals("%u4zzz", unescape("%u4zzz")); +assertEquals("%u44zz", unescape("%u44zz")); +assertEquals("%u444z", unescape("%u444z")); +assertEquals("%4<", unescape("%4<")); +assertEquals("%u<<<<", unescape("%u<<<<")); +assertEquals("%u4<<<", unescape("%u4<<<")); +assertEquals("%u44<<", unescape("%u44<<")); +assertEquals("%u444<", unescape("%u444<")); +assertEquals("foo%4<", unescape("foo%4<")); +assertEquals("foo%u<<<<", unescape("foo%u<<<<")); +assertEquals("foo%u4<<<", unescape("foo%u4<<<")); +assertEquals("foo%u44<<", unescape("foo%u44<<")); +assertEquals("foo%u444<", unescape("foo%u444<")); +assertEquals("foo%4<bar", unescape("foo%4<bar")); +assertEquals("foo%u<<<<bar", unescape("foo%u<<<<bar")); +assertEquals("foo%u4<<<bar", unescape("foo%u4<<<bar")); +assertEquals("foo%u44<<bar", unescape("foo%u44<<bar")); +assertEquals("foo%u444<bar", unescape("foo%u444<bar")); +assertEquals("% ", unescape("%%20")); +assertEquals("%% ", unescape("%%%20")); + +// Unescape stress +var eexample = escape(example); + +for (var i = 1; i < 3000; i++) { + assertEquals(example, unescape(eexample)); +} diff --git a/deps/v8/test/mjsunit/eval-typeof-non-existing.js b/deps/v8/test/mjsunit/eval-typeof-non-existing.js new file mode 100644 index 0000000000..3513767db7 --- /dev/null +++ b/deps/v8/test/mjsunit/eval-typeof-non-existing.js @@ -0,0 +1,32 @@ +// Copyright 2008 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. + +// Typeof expression must resolve to undefined when it used on a +// non-existing property. It is *not* allowed to throw a +// ReferenceError. +assertEquals('undefined', typeof xxx); +assertEquals('undefined', eval('typeof xxx')); diff --git a/deps/v8/test/mjsunit/eval.js b/deps/v8/test/mjsunit/eval.js new file mode 100644 index 0000000000..08bd3d0363 --- /dev/null +++ b/deps/v8/test/mjsunit/eval.js @@ -0,0 +1,136 @@ +// Copyright 2008 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(void 0, eval()); +assertEquals(4, eval(4)); + +function f() { return 'The f function'; }; +assertTrue(f === eval(f)); + +function g(x, y) { return 4; }; + +count = 0; +assertEquals(4, eval('2 + 2', count++)); +assertEquals(1, count); + +try { + eval('hest 7 &*^*&^'); + assertTrue(false, 'Did not throw on syntax error.'); +} catch (e) { + assertEquals('SyntaxError', e.name); +} + + +// eval has special evaluation order for consistency with other browsers. +global_eval = eval; +assertEquals(void 0, eval(eval("var eval = function f(x) { return 'hest';}"))) +eval = global_eval; + +//Test eval with different number of parameters. +global_eval = eval; +eval = function(x, y) { return x + y; }; +assertEquals(4, eval(2, 2)); +eval = global_eval; + +// Test that un-aliased eval reads from local context. +foo = 0; +result = + (function() { + var foo = 2; + return eval('foo'); + })(); +assertEquals(2, result); + +//Test that un-aliased eval writes to local context. +foo = 0; +result = + (function() { + var foo = 1; + eval('foo = 2'); + return foo; + })(); +assertEquals(2, result); +assertEquals(0, foo); + +// Test that un-aliased eval has right receiver. +function MyObject() { this.self = eval('this'); } +var o = new MyObject(); +assertTrue(o === o.self); + +// Test that aliased eval reads from global context. +var e = eval; +foo = 0; +result = + (function() { + var foo = 2; + return e('foo'); + })(); +assertEquals(0, result); + +// Test that aliased eval writes to global context. +var e = eval; +foo = 0; +(function() { e('var foo = 2;'); })(); +assertEquals(2, foo); + +// Test that aliased eval has right receiver. +function MyOtherObject() { this.self = e('this'); } +var o = new MyOtherObject(); +assertTrue(this === o.self); + +// Try to cheat the 'aliased eval' detection. +var x = this; +foo = 0; +result = + (function() { + var foo = 2; + return x.eval('foo'); + })(); +assertEquals(0, result); + +foo = 0; +result = + (function() { + var eval = function(x) { return x; }; + var foo = eval(2); + return e('foo'); + })(); +assertEquals(0, result); + +result = + (function() { + var eval = function(x) { return 2 * x; }; + return (function() { return eval(2); })(); + })(); +assertEquals(4, result); + +eval = function(x) { return 2 * x; }; +result = + (function() { + return (function() { return eval(2); })(); + })(); +assertEquals(4, result); diff --git a/deps/v8/test/mjsunit/execScript-case-insensitive.js b/deps/v8/test/mjsunit/execScript-case-insensitive.js new file mode 100644 index 0000000000..468d65747e --- /dev/null +++ b/deps/v8/test/mjsunit/execScript-case-insensitive.js @@ -0,0 +1,34 @@ +// Copyright 2008 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 x = 0; +execScript('x = 1', 'javascript'); +assertEquals(1, x); + +execScript('x = 2', 'JavaScript'); +assertEquals(2, x); + diff --git a/deps/v8/test/mjsunit/extra-arguments.js b/deps/v8/test/mjsunit/extra-arguments.js new file mode 100644 index 0000000000..186277a006 --- /dev/null +++ b/deps/v8/test/mjsunit/extra-arguments.js @@ -0,0 +1,54 @@ +// Copyright 2008 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 f() { + return g(); +}; + +function g() { + var result = 0; + var array = f.arguments; + for (var i = 0; i < array.length; i++) { + result += array[i]; + } + return result; +}; + + +// Make sure we can pass any number of arguments to f and read them +// from g. +for (var i = 0; i < 25; i++) { + var array = new Array(i); + var expected = 0; + for (var j = 0; j < i; j++) { + expected += j; + array[j] = j; + } + assertEquals(expected, f.apply(null, array), String(i)); +} + + diff --git a/deps/v8/test/mjsunit/extra-commas.js b/deps/v8/test/mjsunit/extra-commas.js new file mode 100644 index 0000000000..6fed04c0de --- /dev/null +++ b/deps/v8/test/mjsunit/extra-commas.js @@ -0,0 +1,46 @@ +// Copyright 2008 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 assertSyntaxError(x) { + var caught = false; + try { + eval(x); + } catch (e) { + caught = true; + assertTrue(e instanceof SyntaxError, "is syntax error"); + } + assertTrue(caught, "throws exception"); +}; + + +assertSyntaxError("f(,)"); +assertSyntaxError("f(1,)"); +assertSyntaxError("f(1,2,)"); + +assertSyntaxError("function f(,) {}"); +assertSyntaxError("function f(1,) {}"); +assertSyntaxError("function f(1,2,) {}"); diff --git a/deps/v8/test/mjsunit/for-in-null-or-undefined.js b/deps/v8/test/mjsunit/for-in-null-or-undefined.js new file mode 100644 index 0000000000..b12d1b06bd --- /dev/null +++ b/deps/v8/test/mjsunit/for-in-null-or-undefined.js @@ -0,0 +1,33 @@ +// Copyright 2008 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. + +// At least Spidermonkey and IE allow for-in iteration over null and +// undefined. They never executed the statement block. +var count = 0; +for (var p in null) { count++; } +for (var p in void 0) { count++; } +assertEquals(0, count); diff --git a/deps/v8/test/mjsunit/for-in-special-cases.js b/deps/v8/test/mjsunit/for-in-special-cases.js new file mode 100644 index 0000000000..3c54256e0d --- /dev/null +++ b/deps/v8/test/mjsunit/for-in-special-cases.js @@ -0,0 +1,64 @@ +// Copyright 2008 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 + +function for_in_null() { + try { + for (var x in null) { + return false; + } + } catch(e) { + return false; + } + return true; +} + +function for_in_undefined() { + try { + for (var x in undefined) { + return false; + } + } catch(e) { + return false; + } + return true; +} + +for (var i = 0; i < 10; ++i) { + assertTrue(for_in_null()); + gc(); +} + +for (var j = 0; j < 10; ++j) { + assertTrue(for_in_undefined()); + gc(); +} + +assertEquals(10, i); +assertEquals(10, j); + diff --git a/deps/v8/test/mjsunit/for-in.js b/deps/v8/test/mjsunit/for-in.js new file mode 100644 index 0000000000..dfe721dbee --- /dev/null +++ b/deps/v8/test/mjsunit/for-in.js @@ -0,0 +1,86 @@ +// Copyright 2008 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 props(x) { + var array = []; + for (var p in x) array.push(p); + return array.sort(); +} + +assertEquals(0, props({}).length); +assertEquals(1, props({x:1}).length); +assertEquals(2, props({x:1, y:2}).length); + +assertArrayEquals(["x"], props({x:1})); +assertArrayEquals(["x", "y"], props({x:1, y:2})); +assertArrayEquals(["x", "y", "zoom"], props({x:1, y:2, zoom:3})); + +assertEquals(0, props([]).length); +assertEquals(1, props([1]).length); +assertEquals(2, props([1,2]).length); + +assertArrayEquals(["0"], props([1])); +assertArrayEquals(["0", "1"], props([1,2])); +assertArrayEquals(["0", "1", "2"], props([1,2,3])); + +var o = {}; +var a = []; +for (var i = 0x0020; i < 0x01ff; i+=2) { + var s = 'char:' + String.fromCharCode(i); + a.push(s); + o[s] = i; +} +assertArrayEquals(a, props(o)); + +var a = []; +assertEquals(0, props(a).length); +a[Math.pow(2,30)-1] = 0; +assertEquals(1, props(a).length); +a[Math.pow(2,31)-1] = 0; +assertEquals(2, props(a).length); +a[1] = 0; +assertEquals(3, props(a).length); + +for (var hest = 'hest' in {}) { } +assertEquals('hest', hest); + +var result = ''; +for (var p in {a : [0], b : 1}) { result += p; } +assertEquals('ab', result); + +var result = ''; +for (var p in {a : {v:1}, b : 1}) { result += p; } +assertEquals('ab', result); + +var result = ''; +for (var p in { get a() {}, b : 1}) { result += p; } +assertEquals('ab', result); + +var result = ''; +for (var p in { get a() {}, set a(x) {}, b : 1}) { result += p; } +assertEquals('ab', result); + diff --git a/deps/v8/test/mjsunit/fun-as-prototype.js b/deps/v8/test/mjsunit/fun-as-prototype.js new file mode 100644 index 0000000000..fbe995a766 --- /dev/null +++ b/deps/v8/test/mjsunit/fun-as-prototype.js @@ -0,0 +1,36 @@ +// Copyright 2008 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 x = 0; +function Funky(a, b, c) { return 7; } +Number.prototype.__proto__ = Funky; +assertEquals(3, x.length); +assertEquals("Funky", x.name); +assertEquals(Funky.prototype, x.prototype); + +Number.prototype.__proto__ = [1, 2, 3]; +assertEquals(3, x.length); diff --git a/deps/v8/test/mjsunit/fun-name.js b/deps/v8/test/mjsunit/fun-name.js new file mode 100644 index 0000000000..676daaa133 --- /dev/null +++ b/deps/v8/test/mjsunit/fun-name.js @@ -0,0 +1,34 @@ +// Copyright 2008 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 strip(s) { + return s.replace(/\s/g, ''); +} + +assertEquals('function(){}', strip((function () { }).toString())); +assertEquals('functionanonymous(){}', strip(new Function().toString())); + diff --git a/deps/v8/test/mjsunit/function-arguments-null.js b/deps/v8/test/mjsunit/function-arguments-null.js new file mode 100644 index 0000000000..21e542fc81 --- /dev/null +++ b/deps/v8/test/mjsunit/function-arguments-null.js @@ -0,0 +1,30 @@ +// Copyright 2008 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. + +// The arguments property of functions should be null when not +// executing inside the function. +assertTrue(toString.arguments === null); diff --git a/deps/v8/test/mjsunit/function-caller.js b/deps/v8/test/mjsunit/function-caller.js new file mode 100644 index 0000000000..ddc7b5df28 --- /dev/null +++ b/deps/v8/test/mjsunit/function-caller.js @@ -0,0 +1,48 @@ +// Copyright 2008 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 f(match) { + g(match); +} + +function g(match) { + assertEquals(f, g.caller); + assertEquals(match, f.caller); +} + +// Check called from function. +function h() { + f(h); +} +h(); + +// Check called from top-level. +f(null); + +// Check called from eval. +eval('f(null)'); + diff --git a/deps/v8/test/mjsunit/function-names.js b/deps/v8/test/mjsunit/function-names.js new file mode 100644 index 0000000000..c083f18f5d --- /dev/null +++ b/deps/v8/test/mjsunit/function-names.js @@ -0,0 +1,133 @@ +// Copyright 2008 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 TestFunctionNames(object, names) { + for (var i = 0; i < names.length; i++) { + assertEquals(names[i], object[names[i]].name); + } +} + + +// Array.prototype functions. +var arrayPrototypeFunctions = [ + "toString", "toLocaleString", "join", "pop", "push", "concat", "reverse", + "shift", "unshift", "slice", "splice", "sort", "filter", "forEach", + "some", "every", "map", "indexOf", "lastIndexOf"]; + +TestFunctionNames(Array.prototype, arrayPrototypeFunctions); + + +// Boolean prototype functions. +var booleanPrototypeFunctions = [ "toString", "valueOf" ]; + +TestFunctionNames(Boolean.prototype, booleanPrototypeFunctions); + + +// Date functions. +var dateFunctions = ["UTC", "parse", "now"]; + +TestFunctionNames(Date, dateFunctions); + + +// Date.prototype functions. +var datePrototypeFunctions = [ + "toString", "toDateString", "toTimeString", "toLocaleString", + "toLocaleDateString", "toLocaleTimeString", "valueOf", "getTime", + "getFullYear", "getUTCFullYear", "getMonth", "getUTCMonth", + "getDate", "getUTCDate", "getDay", "getUTCDay", "getHours", + "getUTCHours", "getMinutes", "getUTCMinutes", "getSeconds", + "getUTCSeconds", "getMilliseconds", "getUTCMilliseconds", + "getTimezoneOffset", "setTime", "setMilliseconds", + "setUTCMilliseconds", "setSeconds", "setUTCSeconds", "setMinutes", + "setUTCMinutes", "setHours", "setUTCHours", "setDate", "setUTCDate", + "setMonth", "setUTCMonth", "setFullYear", "setUTCFullYear", "toGMTString", + "toUTCString", "getYear", "setYear"]; + +TestFunctionNames(Date.prototype, datePrototypeFunctions); + + +// Function.prototype functions. +var functionPrototypeFunctions = [ "toString", "apply", "call" ]; + +TestFunctionNames(Function.prototype, functionPrototypeFunctions); + +// Math functions. +var mathFunctions = [ + "random", "abs", "acos", "asin", "atan", "ceil", "cos", "exp", "floor", + "log", "round", "sin", "sqrt", "tan", "atan2", "pow", "max", "min"]; + +TestFunctionNames(Math, mathFunctions); + + +// Number.prototype functions. +var numberPrototypeFunctions = [ + "toString", "toLocaleString", "valueOf", "toFixed", "toExponential", + "toPrecision"]; + +TestFunctionNames(Number.prototype, numberPrototypeFunctions); + +// Object.prototype functions. +var objectPrototypeFunctions = [ + "toString", "toLocaleString", "valueOf", "hasOwnProperty", "isPrototypeOf", + "propertyIsEnumerable", "__defineGetter__", "__lookupGetter__", + "__defineSetter__", "__lookupSetter__"]; + +TestFunctionNames(Object.prototype, objectPrototypeFunctions); + +// RegExp.prototype functions. +var regExpPrototypeFunctions = ["exec", "test", "toString", "compile"]; + +TestFunctionNames(RegExp.prototype, regExpPrototypeFunctions); + +// String functions. +var stringFunctions = ["fromCharCode"]; + +TestFunctionNames(String, stringFunctions); + + +// String.prototype functions. +var stringPrototypeFunctions = [ + "toString", "valueOf", "charAt", "charCodeAt", "concat", "indexOf", + "lastIndexOf", "localeCompare", "match", "replace", "search", "slice", + "split", "substring", "substr", "toLowerCase", "toLocaleLowerCase", + "toUpperCase", "toLocaleUpperCase", "link", "anchor", "fontcolor", + "fontsize", "big", "blink", "bold", "fixed", "italics", "small", + "strike", "sub", "sup"]; + +TestFunctionNames(String.prototype, stringPrototypeFunctions); + + +// Global functions. +var globalFunctions = [ + "escape", "unescape", "decodeURI", "decodeURIComponent", + "encodeURI", "encodeURIComponent", "Error", "TypeError", + "RangeError", "SyntaxError", "ReferenceError", "EvalError", + "URIError", "isNaN", "isFinite", "parseInt", "parseFloat", + "eval", "execScript"]; + +TestFunctionNames(this, globalFunctions); diff --git a/deps/v8/test/mjsunit/function-property.js b/deps/v8/test/mjsunit/function-property.js new file mode 100644 index 0000000000..a657f649c8 --- /dev/null +++ b/deps/v8/test/mjsunit/function-property.js @@ -0,0 +1,29 @@ +// Copyright 2008 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 f() { }; +assertEquals(5, f = 5); diff --git a/deps/v8/test/mjsunit/function-prototype.js b/deps/v8/test/mjsunit/function-prototype.js new file mode 100644 index 0000000000..371311e49a --- /dev/null +++ b/deps/v8/test/mjsunit/function-prototype.js @@ -0,0 +1,97 @@ +// Copyright 2008 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 we can set function prototypes to non-object values. The +// prototype used for instances in that case should be the initial +// object prototype. ECMA-262 13.2.2. +function TestNonObjectPrototype(value) { + function F() {}; + F.prototype = value; + var f = new F(); + assertEquals(value, F.prototype); + assertEquals(Object.prototype, f.__proto__); +} + +var values = [123, "asdf", true]; + +values.forEach(TestNonObjectPrototype); + + +// Test moving between non-object and object values. +function F() {}; +var f = new F(); +assertEquals(f.__proto__, F.prototype); +F.prototype = 42; +f = new F(); +assertEquals(Object.prototype, f.__proto__); +assertEquals(42, F.prototype); +F.prototype = { a: 42 }; +f = new F(); +assertEquals(42, F.prototype.a); +assertEquals(f.__proto__, F.prototype); + + +// Test that the fast case optimizations can handle non-functions, +// functions with no prototypes (yet), non-object prototypes, +// functions without initial maps, and the fully initialized +// functions. +function GetPrototypeOf(f) { + return f.prototype; +}; + +// Seed the GetPrototypeOf function to enable the fast case +// optimizations. +var p = GetPrototypeOf(GetPrototypeOf); + +// Check that getting the prototype of a tagged integer works. +assertTrue(typeof GetPrototypeOf(1) == 'undefined'); + +function NoPrototypeYet() { } +var p = GetPrototypeOf(NoPrototypeYet); +assertEquals(NoPrototypeYet.prototype, p); + +function NonObjectPrototype() { } +NonObjectPrototype.prototype = 42; +assertEquals(42, GetPrototypeOf(NonObjectPrototype)); + +function NoInitialMap() { } +var p = NoInitialMap.prototype; +assertEquals(p, GetPrototypeOf(NoInitialMap)); + +// Check the standard fast case. +assertEquals(F.prototype, GetPrototypeOf(F)); + +// Check that getting the prototype of a non-function works. This must +// be the last thing we do because this will clobber the optimizations +// in GetPrototypeOf and go to a monomorphic IC load instead. +assertEquals(87, GetPrototypeOf({prototype:87})); + +// Check the prototype is enumerable as specified in ECMA262, 15.3.5.2 +var foo = new Function("return x"); +var result = "" +for (var n in foo) result += n; +assertEquals(result, "prototype"); diff --git a/deps/v8/test/mjsunit/function-source.js b/deps/v8/test/mjsunit/function-source.js new file mode 100644 index 0000000000..75257756d6 --- /dev/null +++ b/deps/v8/test/mjsunit/function-source.js @@ -0,0 +1,49 @@ +// Copyright 2008 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 + +// Check that the script source for all functions in a script is the same. +function f() { + function h() { + assertEquals(Debug.scriptSource(f), Debug.scriptSource(h)); + } + h(); +} + +function g() { + function h() { + assertEquals(Debug.scriptSource(f), Debug.scriptSource(h)); + } + h(); +} + +assertEquals(Debug.scriptSource(f), Debug.scriptSource(g)); +f(); +g(); diff --git a/deps/v8/test/mjsunit/function.js b/deps/v8/test/mjsunit/function.js new file mode 100644 index 0000000000..b5e83dba6e --- /dev/null +++ b/deps/v8/test/mjsunit/function.js @@ -0,0 +1,83 @@ +// Copyright 2008 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 f = Function(); +assertTrue(typeof f() == 'undefined'); +f = new Function(); +assertTrue(typeof f() == 'undefined'); + +f = Function('return 1'); +assertEquals(1, f()); +f = new Function('return 1'); +assertEquals(1, f()); + +f = Function('return true'); +assertTrue(f()); +f = new Function('return true'); +assertTrue(f()); + +f = Function('x', 'return x'); +assertEquals(1, f(1)); +assertEquals('bar', f('bar')); +assertTrue(typeof f() == 'undefined'); +var x = {}; +assertTrue(x === f(x)); + +f = Function('x', 'return x // comment'); +assertEquals(1, f(1)); + +f = Function('return typeof anonymous'); +assertEquals('undefined', f()); + +var anonymous = 42; +f = Function('return anonymous;'); +assertEquals(42, f()); + +f = new Function('x', 'return x') +assertEquals(1, f(1)); +assertEquals('bar', f('bar')); +assertTrue(typeof f() == 'undefined'); +var x = {}; +assertTrue(x === f(x)); + +f = Function('x', 'y', 'return x+y'); +assertEquals(5, f(2, 3)); +assertEquals('foobar', f('foo', 'bar')); +f = new Function('x', 'y', 'return x+y'); +assertEquals(5, f(2, 3)); +assertEquals('foobar', f('foo', 'bar')); + +var x = {}; x.toString = function() { return 'x'; }; +var y = {}; y.toString = function() { return 'y'; }; +var z = {}; z.toString = function() { return 'return x*y'; } +var f = Function(x, y, z); +assertEquals(25, f(5, 5)); +assertEquals(42, f(2, 21)); +f = new Function(x, y, z); +assertEquals(25, f(5, 5)); +assertEquals(42, f(2, 21)); + diff --git a/deps/v8/test/mjsunit/fuzz-accessors.js b/deps/v8/test/mjsunit/fuzz-accessors.js new file mode 100644 index 0000000000..f3602cca09 --- /dev/null +++ b/deps/v8/test/mjsunit/fuzz-accessors.js @@ -0,0 +1,85 @@ +// Copyright 2008 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 builtInPropertyNames = [ + 'prototype', 'length', 'caller', 0, 1, '$1', 'arguments', 'name', 'message', 'constructor' +]; + +function getAnException() { + try { + ("str")(); + } catch (e) { + return e; + } +} + +function getSpecialObjects() { + return [ + function () { }, + [1, 2, 3], + /xxx/, + RegExp, + "blah", + 9, + new Date(), + getAnException() + ]; +} + +var object = { }; +var fun = function () { }; +var someException = getAnException(); +var someDate = new Date(); + +var objects = [ + [1, Number.prototype], + ["foo", String.prototype], + [true, Boolean.prototype], + [object, object], + [fun, fun], + [someException, someException], + [someDate, someDate] +]; + +function runTest(fun) { + for (var i in objects) { + var obj = objects[i][0]; + var chain = objects[i][1]; + var specialObjects = getSpecialObjects(); + for (var j in specialObjects) { + var special = specialObjects[j]; + chain.__proto__ = special; + for (var k in builtInPropertyNames) { + var propertyName = builtInPropertyNames[k]; + fun(obj, propertyName); + } + } + } +} + +runTest(function (obj, name) { return obj[name]; }); +runTest(function (obj, name) { return obj[name] = { }; }); diff --git a/deps/v8/test/mjsunit/fuzz-natives.js b/deps/v8/test/mjsunit/fuzz-natives.js new file mode 100644 index 0000000000..debcc9a892 --- /dev/null +++ b/deps/v8/test/mjsunit/fuzz-natives.js @@ -0,0 +1,151 @@ +// Copyright 2008 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 makeArguments() { + var result = [ ]; + result.push(17); + result.push(-31); + result.push(new Array(100)); + result.push(new Array(100003)); + result.push(Number.MIN_VALUE); + result.push("whoops"); + result.push("x"); + result.push({"x": 1, "y": 2}); + var slowCaseObj = {"a": 3, "b": 4, "c": 5}; + delete slowCaseObj.c; + result.push(slowCaseObj); + result.push(function () { return 8; }); + return result; +} + +var kArgObjects = makeArguments().length; + +function makeFunction(name, argc) { + var args = []; + for (var i = 0; i < argc; i++) + args.push("x" + i); + var argsStr = args.join(", "); + return new Function(args.join(", "), "return %" + name + "(" + argsStr + ");"); +} + +function testArgumentCount(name) { + for (var i = 0; i < 10; i++) { + var func = makeFunction(name, i); + var args = [ ]; + for (var j = 0; j < i; j++) + args.push(0); + try { + func.apply(void 0, args); + } catch (e) { + // we don't care what happens as long as we don't crash + } + } +} + +function testArgumentTypes(name, argc) { + var type = 0; + var hasMore = true; + var func = makeFunction(name, argc); + while (hasMore) { + var argPool = makeArguments(); + var current = type; + var hasMore = false; + var argList = [ ]; + for (var i = 0; i < argc; i++) { + var index = current % kArgObjects; + current = (current / kArgObjects) << 0; + if (index != (kArgObjects - 1)) + hasMore = true; + argList.push(argPool[index]); + } + try { + func.apply(void 0, argList); + } catch (e) { + // we don't care what happens as long as we don't crash + } + type++; + } +} + +var knownProblems = { + "Abort": true, + + // These functions use pseudo-stack-pointers and are not robust + // to unexpected integer values. + "DebugEvaluate": true, + + // These functions do nontrivial error checking in recursive calls, + // which means that we have to propagate errors back. + "SetFunctionBreakPoint": true, + "SetScriptBreakPoint": true, + "ChangeBreakOnException": true, + "PrepareStep": true, + + // Too slow. + "DebugReferencedBy": true, + + // Calling disable/enable access checks may interfere with the + // the rest of the tests. + "DisableAccessChecks": true, + "EnableAccessChecks": true, + + // These functions should not be callable as runtime functions. + "NewContext": true, + "NewArgumentsFast": true, + "PushContext": true, + "LazyCompile": true, + "CreateObjectLiteralBoilerplate": true, + "CloneLiteralBoilerplate": true, + "CloneShallowLiteralBoilerplate": true, + "CreateArrayLiteralBoilerplate": true, + "IS_VAR": true, + "ResolvePossiblyDirectEval": true, + "Log": true +}; + +var currentlyUncallable = { + // We need to find a way to test this without breaking the system. + "SystemBreak": true +}; + +function testNatives() { + var allNatives = %ListNatives(); + for (var i = 0; i < allNatives.length; i++) { + var nativeInfo = allNatives[i]; + var name = nativeInfo[0]; + if (name in knownProblems || name in currentlyUncallable) + continue; + print(name); + var argc = nativeInfo[1]; + testArgumentCount(name); + testArgumentTypes(name, argc); + } +} + +testNatives(); diff --git a/deps/v8/test/mjsunit/getter-in-prototype.js b/deps/v8/test/mjsunit/getter-in-prototype.js new file mode 100644 index 0000000000..dd26c53319 --- /dev/null +++ b/deps/v8/test/mjsunit/getter-in-prototype.js @@ -0,0 +1,50 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that exceptions are thrown when setting properties on object +// that have only a getter in a prototype object. + +var o = {}; +var p = {}; +p.__defineGetter__('x', function(){}); +o.__proto__ = p; + +assertThrows("o.x = 42"); + +function f() { + with(o) { + x = 42; + } +} +assertThrows("f()"); + +__proto__ = p; +function g() { + eval('1'); + x = 42; +} +assertThrows("g()"); diff --git a/deps/v8/test/mjsunit/getter-in-value-prototype.js b/deps/v8/test/mjsunit/getter-in-value-prototype.js new file mode 100644 index 0000000000..b55320ac5b --- /dev/null +++ b/deps/v8/test/mjsunit/getter-in-value-prototype.js @@ -0,0 +1,35 @@ +// Copyright 2008 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 getters can be defined and called on value prototypes. +// +// This used to fail because of an invalid cast of the receiver to a +// JSObject. + +String.prototype.__defineGetter__('x', function() { return this; }); +assertEquals('asdf', 'asdf'.x); + diff --git a/deps/v8/test/mjsunit/global-const-var-conflicts.js b/deps/v8/test/mjsunit/global-const-var-conflicts.js new file mode 100644 index 0000000000..d38d0ee813 --- /dev/null +++ b/deps/v8/test/mjsunit/global-const-var-conflicts.js @@ -0,0 +1,57 @@ +// Copyright 2008 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. + +// Check that dynamically introducing conflicting consts/vars +// leads to exceptions. + +var caught = 0; + +eval("const a"); +try { eval("var a"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } +assertTrue(typeof a == 'undefined'); +try { eval("var a = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } +assertTrue(typeof a == 'undefined'); + +eval("const b = 0"); +try { eval("var b"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } +assertEquals(0, b); +try { eval("var b = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } +assertEquals(0, b); + +eval("var c"); +try { eval("const c"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } +assertTrue(typeof c == 'undefined'); +try { eval("const c = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } +assertTrue(typeof c == 'undefined'); + +eval("var d = 0"); +try { eval("const d"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } +assertEquals(0, d); +try { eval("const d = 1"); } catch (e) { caught++; assertTrue(e instanceof TypeError); } +assertEquals(0, d); + +assertEquals(8, caught); diff --git a/deps/v8/test/mjsunit/global-load-from-eval-in-with.js b/deps/v8/test/mjsunit/global-load-from-eval-in-with.js new file mode 100644 index 0000000000..d733f6c8d4 --- /dev/null +++ b/deps/v8/test/mjsunit/global-load-from-eval-in-with.js @@ -0,0 +1,59 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Tests global loads from eval inside of a with statement. + +var x = 27; + +function test(obj, source) { + with (obj) { + eval(source); + } +} + +// Test shadowing in eval scope. +test({ x: 42 }, "assertEquals(42, x)"); +test({ y: 42 }, "assertEquals(27, x)"); + +// Test shadowing in local scope inside an eval scope. +test({ x: 42 }, "function f() { assertEquals(42, x) }; f();"); +test({ y: 42 }, "function f() { assertEquals(27, x) }; f();"); + +// Test shadowing in local scope inside an eval scope. Deeper nesting +// this time. +test({ x: 42 }, "function f() { function g() { assertEquals(42, x) }; g() }; f();"); +test({ y: 42 }, "function f() { function g() { assertEquals(27, x) }; g() }; f();"); + +// Test shadowing in local scope inside an eval scope with eval calls in the eval scopes. +test({ x: 42 }, "function f() { eval('1'); assertEquals(42, x) }; f();"); +test({ y: 42 }, "function f() { eval('1'); assertEquals(27, x) }; f();"); + +// Test shadowing in local scope inside an eval scope with eval calls +// in the eval scopes. Deeper nesting this time. +test({ x: 42 }, "function f() { function g() { eval('1'); assertEquals(42, x) }; g() }; f();"); +test({ y: 42 }, "function f() { function g() { eval('1'); assertEquals(27, x) }; g() }; f();"); + diff --git a/deps/v8/test/mjsunit/global-load-from-eval.js b/deps/v8/test/mjsunit/global-load-from-eval.js new file mode 100644 index 0000000000..ad4093287e --- /dev/null +++ b/deps/v8/test/mjsunit/global-load-from-eval.js @@ -0,0 +1,85 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Tests global loads from eval. + +var x = 27; + +function test() { + function g() { + assertEquals(27, eval('x')); + function h() { + // Shadow with local variable. + var x = 22; + assertEquals(22, eval('x')); + function i(x) { + // Shadow with parameter. + assertEquals(44, eval('x')); + function j() { + assertEquals(x, eval('x')); + // Shadow with function name. + function x() { + assertEquals(x, eval('x')); + } + x(); + } + j(); + } + i(44); + } + h(); + } + g(); +} + +test(); + +// Test loading of globals from deeply nested eval. This code is a +// bit complicated, but the complication is needed to check that the +// code that loads the global variable accounts for the fact that the +// global variable becomes shadowed by an eval-introduced variable. +var result = 0; +function testDeep(source, load, test) { + eval(source); + function f() { + var y = 23; + function g() { + var z = 25; + function h() { + eval(load); + eval(test); + } + h(); + } + g(); + } + f(); +} +testDeep('1', 'result = x', 'assertEquals(27, result)'); +// Because of the eval-cache, the 'result = x' code gets reused. This +// time in a context where the 'x' variable has been shadowed. +testDeep('var x = 1', 'result = x', 'assertEquals(1, result)'); diff --git a/deps/v8/test/mjsunit/global-load-from-nested-eval.js b/deps/v8/test/mjsunit/global-load-from-nested-eval.js new file mode 100644 index 0000000000..3c7ff75691 --- /dev/null +++ b/deps/v8/test/mjsunit/global-load-from-nested-eval.js @@ -0,0 +1,66 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Tests global loads from nested eval. + +var x = 42; + +// Load the global. +function test(source) { + eval('eval(' + source +')'); +} +test('assertEquals(42, x)'); + +// Shadow variable with a with statement. +function testWith(source) { + with ({ x: 1 }) { + eval('eval(' + source +')'); + } +} +testWith('assertEquals(1, x)'); + +// Shadow variable with an eval-introduced variable. +function testEval(source) { + eval('var x = 1'); + function f() { + eval('eval('+ source + ')'); + } + f(); +} +testEval('assertEquals(1, x)'); + +// Eval that does not shadow. +function testEvalDontShadow(source) { + eval('1'); + eval('eval(' + source +')'); +} +testEvalDontShadow('assertEquals(42, x)'); + + + + + diff --git a/deps/v8/test/mjsunit/global-vars-eval.js b/deps/v8/test/mjsunit/global-vars-eval.js new file mode 100644 index 0000000000..900f7be727 --- /dev/null +++ b/deps/v8/test/mjsunit/global-vars-eval.js @@ -0,0 +1,34 @@ +// Copyright 2008 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. + +eval("" + ""); +this.bar = 'fisk'; +assertEquals('fisk', bar, "1"); +var bar; +assertEquals('fisk', bar, "2"); +var bar = 'hest'; +assertEquals('hest', bar, "3"); diff --git a/deps/v8/test/mjsunit/global-vars-with.js b/deps/v8/test/mjsunit/global-vars-with.js new file mode 100644 index 0000000000..05ca6b6bb3 --- /dev/null +++ b/deps/v8/test/mjsunit/global-vars-with.js @@ -0,0 +1,43 @@ +// Copyright 2008 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. + +with ({}) { } +this.bar = 'fisk'; +assertEquals('fisk', bar); +var bar; +assertEquals('fisk', bar); +var bar = 'hest'; +assertEquals('hest', bar); + +with ({}) { + this.baz = 'fisk'; + assertEquals('fisk', baz); + var baz; + assertEquals('fisk', baz); + var baz = 'hest'; + assertEquals('hest', baz); +} diff --git a/deps/v8/test/mjsunit/greedy.js b/deps/v8/test/mjsunit/greedy.js new file mode 100644 index 0000000000..d357f0cad3 --- /dev/null +++ b/deps/v8/test/mjsunit/greedy.js @@ -0,0 +1,60 @@ +// Copyright 2008 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: --gc-greedy + +function IterativeFib(n) { + var f0 = 0, f1 = 1; + for (; n > 0; --n) { + var f2 = f0 + f1; + f0 = f1; f1 = f2; + } + return f0; +} + +function RecursiveFib(n) { + if (n <= 1) return n; + return RecursiveFib(n - 1) + RecursiveFib(n - 2); +} + +function Check(n, expected) { + var i = IterativeFib(n); + var r = RecursiveFib(n); + assertEquals(i, expected); + assertEquals(r, expected); +} + +Check(0, 0); +Check(1, 1); +Check(2, 1); +Check(3, 1 + 1); +Check(4, 2 + 1); +Check(5, 3 + 2); +Check(10, 55); +Check(15, 610); +Check(20, 6765); +assertEquals(IterativeFib(75), 2111485077978050); diff --git a/deps/v8/test/mjsunit/has-own-property.js b/deps/v8/test/mjsunit/has-own-property.js new file mode 100644 index 0000000000..5ff8db5f7b --- /dev/null +++ b/deps/v8/test/mjsunit/has-own-property.js @@ -0,0 +1,38 @@ +// Copyright 2008 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. + +// Check for objects. +assertTrue({x:12}.hasOwnProperty('x')); +assertFalse({x:12}.hasOwnProperty('y')); + +// Check for strings. +assertTrue(''.hasOwnProperty('length')); +assertTrue(Object.prototype.hasOwnProperty.call('', 'length')); + +// Check for numbers. +assertFalse((123).hasOwnProperty('length')); +assertFalse(Object.prototype.hasOwnProperty.call(123, 'length')); diff --git a/deps/v8/test/mjsunit/html-comments.js b/deps/v8/test/mjsunit/html-comments.js new file mode 100644 index 0000000000..f39271aca7 --- /dev/null +++ b/deps/v8/test/mjsunit/html-comments.js @@ -0,0 +1,57 @@ +--> must work at beginning of file! + +// Copyright 2008 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 x = 1; +--> this must be ignored... + --> so must this... + --> and this. +x-->0; +assertEquals(0, x); + + +var x = 0; x <!-- x +assertEquals(0, x); + +var x = 1; x <!--x +assertEquals(1, x); + +var x = 2; x <!-- x; x = 42; +assertEquals(2, x); + +var x = 1; x <! x--; +assertEquals(0, x); + +var x = 1; x <!- x--; +assertEquals(0, x); + +var b = true <! true; +assertFalse(b); + +var b = true <!- true; +assertFalse(b); diff --git a/deps/v8/test/mjsunit/html-string-funcs.js b/deps/v8/test/mjsunit/html-string-funcs.js new file mode 100644 index 0000000000..213b7f3412 --- /dev/null +++ b/deps/v8/test/mjsunit/html-string-funcs.js @@ -0,0 +1,47 @@ +// Copyright 2008 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. + +// Spidermonkey and IE has some string functions useable for building +// HTML. +function CheckSimple(f, tag) { + assertEquals('<' + tag + '>foo</' + tag + '>', + "foo"[f]().toLowerCase()); +}; +var simple = { big: 'big', blink: 'blink', bold: 'b', + fixed: 'tt', italics: 'i', small: 'small', + strike: 'strike', sub: 'sub', sup: 'sup' }; +for (var i in simple) CheckSimple(i, simple[i]); + + +function CheckCompound(f, tag, att) { + assertEquals('<' + tag + ' ' + att + '="bar">foo</' + tag + '>', + "foo"[f]("bar").toLowerCase()); +}; +CheckCompound('anchor', 'a', 'name'); +CheckCompound('link', 'a', 'href'); +CheckCompound('fontcolor', 'font', 'color'); +CheckCompound('fontsize', 'font', 'size'); diff --git a/deps/v8/test/mjsunit/if-in-undefined.js b/deps/v8/test/mjsunit/if-in-undefined.js new file mode 100644 index 0000000000..5bfa42e708 --- /dev/null +++ b/deps/v8/test/mjsunit/if-in-undefined.js @@ -0,0 +1,36 @@ +// Copyright 2008 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. + +// ECMA-252 11.8.7 +// +// If the ShiftExpression is not an object, should throw an TypeError. +// Should throw an exception, but not crash VM. + +assertThrows("if ('p' in undefined) { }"); +assertThrows("if ('p' in null) { }") +assertThrows("if ('p' in true) { }"); +assertThrows("if ('p' in 5) { }"); diff --git a/deps/v8/test/mjsunit/in.js b/deps/v8/test/mjsunit/in.js new file mode 100644 index 0000000000..f98db42f61 --- /dev/null +++ b/deps/v8/test/mjsunit/in.js @@ -0,0 +1,159 @@ +// Copyright 2008 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. + +// ---------------- +// Check fast objects + +var o = { }; +assertFalse(0 in o); +assertFalse('x' in o); +assertFalse('y' in o); +assertTrue('toString' in o, "toString"); + +var o = { x: 12 }; +assertFalse(0 in o); +assertTrue('x' in o); +assertFalse('y' in o); +assertTrue('toString' in o, "toString"); + +var o = { x: 12, y: 15 }; +assertFalse(0 in o); +assertTrue('x' in o); +assertTrue('y' in o); +assertTrue('toString' in o, "toString"); + + +// ---------------- +// Check dense arrays + +var a = [ ]; +assertFalse(0 in a); +assertFalse(1 in a); +assertFalse('0' in a); +assertFalse('1' in a); +assertTrue('toString' in a, "toString"); + +var a = [ 1 ]; +assertTrue(0 in a); +assertFalse(1 in a); +assertTrue('0' in a); +assertFalse('1' in a); +assertTrue('toString' in a, "toString"); + +var a = [ 1, 2 ]; +assertTrue(0 in a); +assertTrue(1 in a); +assertTrue('0' in a); +assertTrue('1' in a); +assertTrue('toString' in a, "toString"); + +var a = [ 1, 2 ]; +assertFalse(0.001 in a); +assertTrue(-0 in a); +assertTrue(+0 in a); +assertFalse('0.0' in a); +assertFalse('1.0' in a); +assertFalse(NaN in a); +assertFalse(Infinity in a); +assertFalse(-Infinity in a); + +var a = []; +a[1] = 2; +assertFalse(0 in a); +assertTrue(1 in a); +assertFalse(2 in a); +assertFalse('0' in a); +assertTrue('1' in a); +assertFalse('2' in a); +assertTrue('toString' in a, "toString"); + + +// ---------------- +// Check dictionary ("normalized") objects + +var o = {}; +for (var i = 0x0020; i < 0x02ff; i += 2) { + o['char:' + String.fromCharCode(i)] = i; +} +for (var i = 0x0020; i < 0x02ff; i += 2) { + assertTrue('char:' + String.fromCharCode(i) in o); + assertFalse('char:' + String.fromCharCode(i + 1) in o); +} +assertTrue('toString' in o, "toString"); + +var o = {}; +o[Math.pow(2,30)-1] = 0; +o[Math.pow(2,31)-1] = 0; +o[1] = 0; +assertFalse(0 in o); +assertTrue(1 in o); +assertFalse(2 in o); +assertFalse(Math.pow(2,30)-2 in o); +assertTrue(Math.pow(2,30)-1 in o); +assertFalse(Math.pow(2,30)-0 in o); +assertTrue(Math.pow(2,31)-1 in o); +assertFalse(0.001 in o); +assertFalse('0.0' in o); +assertFalse('1.0' in o); +assertFalse(NaN in o); +assertFalse(Infinity in o); +assertFalse(-Infinity in o); +assertFalse(-0 in o); +assertFalse(+0 in o); +assertTrue('toString' in o, "toString"); + + +// ---------------- +// Check sparse arrays + +var a = []; +a[Math.pow(2,30)-1] = 0; +a[Math.pow(2,31)-1] = 0; +a[1] = 0; +assertFalse(0 in a, "0 in a"); +assertTrue(1 in a, "1 in a"); +assertFalse(2 in a, "2 in a"); +assertFalse(Math.pow(2,30)-2 in a, "Math.pow(2,30)-2 in a"); +assertTrue(Math.pow(2,30)-1 in a, "Math.pow(2,30)-1 in a"); +assertFalse(Math.pow(2,30)-0 in a, "Math.pow(2,30)-0 in a"); +assertTrue(Math.pow(2,31)-1 in a, "Math.pow(2,31)-1 in a"); +assertFalse(0.001 in a, "0.001 in a"); +assertFalse('0.0' in a,"'0.0' in a"); +assertFalse('1.0' in a,"'1.0' in a"); +assertFalse(NaN in a,"NaN in a"); +assertFalse(Infinity in a,"Infinity in a"); +assertFalse(-Infinity in a,"-Infinity in a"); +assertFalse(-0 in a,"-0 in a"); +assertFalse(+0 in a,"+0 in a"); +assertTrue('toString' in a, "toString"); + +// ------------- +// Check negative indices in arrays. +var a = []; +assertFalse(-1 in a); +a[-1] = 43; +assertTrue(-1 in a); diff --git a/deps/v8/test/mjsunit/indexed-accessors.js b/deps/v8/test/mjsunit/indexed-accessors.js new file mode 100644 index 0000000000..395f2ab394 --- /dev/null +++ b/deps/v8/test/mjsunit/indexed-accessors.js @@ -0,0 +1,120 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that getters can be defined and called with an index as a parameter. + +var o = {}; +o.x = 42; +o.__defineGetter__('0', function() { return o.x; }); +assertEquals(o.x, o[0]); +assertEquals(o.x, o.__lookupGetter__('0')()); + +o.__defineSetter__('0', function(y) { o.x = y; }); +assertEquals(o.x, o[0]); +assertEquals(o.x, o.__lookupGetter__('0')()); +o[0] = 21; +assertEquals(21, o.x); +o.__lookupSetter__(0)(7); +assertEquals(7, o.x); + +function Pair(x, y) { + this.x = x; + this.y = y; +}; +Pair.prototype.__defineGetter__('0', function() { return this.x; }); +Pair.prototype.__defineGetter__('1', function() { return this.y; }); +Pair.prototype.__defineSetter__('0', function(x) { this.x = x; }); +Pair.prototype.__defineSetter__('1', function(y) { this.y = y; }); + +var p = new Pair(2, 3); +assertEquals(2, p[0]); +assertEquals(3, p[1]); +p.x = 7; +p[1] = 8; +assertEquals(7, p[0]); +assertEquals(7, p.x); +assertEquals(8, p[1]); +assertEquals(8, p.y); + + +// Testing that a defined getter doesn't get lost due to inline caching. +var expected = {}; +var actual = {}; +for (var i = 0; i < 10; i++) { + expected[i] = actual[i] = i; +} +function testArray() { + for (var i = 0; i < 10; i++) { + assertEquals(expected[i], actual[i]); + } +} +actual[1000000] = -1; +testArray(); +testArray(); +actual.__defineGetter__('0', function() { return expected[0]; }); +expected[0] = 42; +testArray(); +expected[0] = 111; +testArray(); + +// The functionality is not implemented for arrays due to performance issues. +var a = [ 1 ]; +a.__defineGetter__('2', function() { return 7; }); +assertEquals(undefined, a[2]); +assertEquals(1, a.length); +var b = 0; +a.__defineSetter__('5', function(y) { b = y; }); +assertEquals(1, a.length); +a[5] = 42; +assertEquals(0, b); +assertEquals(42, a[5]); +assertEquals(6, a.length); + +// Using a setter where only a getter is defined throws an exception. +var q = {}; +q.__defineGetter__('0', function() { return 42; }); +assertThrows('q[0] = 7'); + +// Using a getter where only a setter is defined returns undefined. +var q1 = {}; +q1.__defineSetter__('0', function() {q1.b = 17;}); +assertEquals(q1[0], undefined); +// Setter works +q1[0] = 3; +assertEquals(q1[0], undefined); +assertEquals(q1.b, 17); + +// Complex case of using an undefined getter. +// From http://code.google.com/p/v8/issues/detail?id=298 +// Reported by nth10sd. + +a = function() {}; +__defineSetter__("0", function() {}); +if (a |= '') {}; +assertThrows('this[a].__parent__'); +assertEquals(a, 0); +assertEquals(this[a], undefined); diff --git a/deps/v8/test/mjsunit/instanceof.js b/deps/v8/test/mjsunit/instanceof.js new file mode 100644 index 0000000000..01ea4268e6 --- /dev/null +++ b/deps/v8/test/mjsunit/instanceof.js @@ -0,0 +1,93 @@ +// Copyright 2008 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. + +assertTrue({} instanceof Object); +assertTrue([] instanceof Object); + +assertFalse({} instanceof Array); +assertTrue([] instanceof Array); + +function TestChains() { + var A = {}; + var B = {}; + var C = {}; + B.__proto__ = A; + C.__proto__ = B; + + function F() { } + F.prototype = A; + assertTrue(C instanceof F); + assertTrue(B instanceof F); + assertFalse(A instanceof F); + + F.prototype = B; + assertTrue(C instanceof F); + assertFalse(B instanceof F); + assertFalse(A instanceof F); + + F.prototype = C; + assertFalse(C instanceof F); + assertFalse(B instanceof F); + assertFalse(A instanceof F); +} + +TestChains(); + + +function TestExceptions() { + function F() { } + var items = [ 1, new Number(42), + true, + 'string', new String('hest'), + {}, [], + F, new F(), + Object, String ]; + + var exceptions = 0; + var instanceofs = 0; + + for (var i = 0; i < items.length; i++) { + for (var j = 0; j < items.length; j++) { + try { + if (items[i] instanceof items[j]) instanceofs++; + } catch (e) { + assertTrue(e instanceof TypeError); + exceptions++; + } + } + } + assertEquals(10, instanceofs); + assertEquals(88, exceptions); + + // Make sure to throw an exception if the function prototype + // isn't a proper JavaScript object. + function G() { } + G.prototype = undefined; + assertThrows("({} instanceof G)"); +} + +TestExceptions(); diff --git a/deps/v8/test/mjsunit/integer-to-string.js b/deps/v8/test/mjsunit/integer-to-string.js new file mode 100644 index 0000000000..3076bc4176 --- /dev/null +++ b/deps/v8/test/mjsunit/integer-to-string.js @@ -0,0 +1,35 @@ +// Copyright 2008 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 TestIntToString() { + for (var i = -1000; i < 1000; i++) + assertEquals(i, parseInt(""+i)); + for (var i = -5e9; i < 5e9; i += (1e6 - 1)) + assertEquals(i, parseInt(""+i)); +} + +TestIntToString(); diff --git a/deps/v8/test/mjsunit/invalid-lhs.js b/deps/v8/test/mjsunit/invalid-lhs.js new file mode 100644 index 0000000000..bbd19f20b2 --- /dev/null +++ b/deps/v8/test/mjsunit/invalid-lhs.js @@ -0,0 +1,68 @@ +// Copyright 2008 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 we get exceptions for invalid left-hand sides. Also +// tests that if the invalid left-hand side is a function call, the +// exception is delayed until runtime. + +// Normal assignments: +assertThrows("12 = 12"); +assertThrows("x++ = 12"); +assertThrows("eval('var x') = 12"); +assertDoesNotThrow("if (false) eval('var x') = 12"); + +// Pre- and post-fix operations: +assertThrows("12++"); +assertThrows("12--"); +assertThrows("--12"); +assertThrows("++12"); +assertThrows("++(eval('12'))"); +assertThrows("(eval('12'))++"); +assertDoesNotThrow("if (false) ++(eval('12'))"); +assertDoesNotThrow("if (false) (eval('12'))++"); + +// For in: +assertThrows("for (12 in [1]) print(12);"); +assertThrows("for (eval('var x') in [1]) print(12);"); +assertDoesNotThrow("if (false) for (eval('var x') in [1]) print(12);"); + +// For: +assertThrows("for (12 = 1;;) print(12);"); +assertThrows("for (eval('var x') = 1;;) print(12);"); +assertDoesNotThrow("if (false) for (eval('var x') = 1;;) print(12);"); + +// Assignments to 'this'. +assertThrows("this = 42"); +assertThrows("function f() { this = 12; }"); +assertThrows("for (this in Array) ;"); +assertThrows("for (this = 0;;) ;"); +assertThrows("this++"); +assertThrows("++this"); +assertThrows("this--"); +assertThrows("--this"); + + diff --git a/deps/v8/test/mjsunit/keyed-ic.js b/deps/v8/test/mjsunit/keyed-ic.js new file mode 100644 index 0000000000..d37bd034cc --- /dev/null +++ b/deps/v8/test/mjsunit/keyed-ic.js @@ -0,0 +1,207 @@ +// Copyright 2008 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. + +// This test attempts to test the inline caching for keyed access. + +// ---------------------------------------------------------------------- +// Prototype accessor. +// ---------------------------------------------------------------------- +var runTest = function() { + var initial_P = 'prototype'; + var P = initial_P; + var H = 'hasOwnProperty'; + + var f = function() {}; + + function prototypeTest(change_index) { + for (var i = 0; i < 10; i++) { + var property = f[P]; + if (i <= change_index) { + assertEquals(f.prototype, property); + } else { + assertEquals(f.hasOwnProperty, property); + } + if (i == change_index) P = H; + } + P = initial_P; + } + + for (var i = 0; i < 10; i++) prototypeTest(i); + + f.prototype = 43; + + for (var i = 0; i < 10; i++) prototypeTest(i); +} + +runTest(); + +// ---------------------------------------------------------------------- +// Array length accessor. +// ---------------------------------------------------------------------- +runTest = function() { + var initial_L = 'length'; + var L = initial_L; + var zero = '0'; + + var a = new Array(10); + + function arrayLengthTest(change_index) { + for (var i = 0; i < 10; i++) { + var l = a[L]; + if (i <= change_index) { + assertEquals(10, l); + } else { + assertEquals(undefined, l); + } + if (i == change_index) L = zero; + } + L = initial_L; + } + + for (var i = 0; i < 10; i++) arrayLengthTest(i); +} + +runTest(); + +// ---------------------------------------------------------------------- +// String length accessor. +// ---------------------------------------------------------------------- +runTest = function() { + var initial_L = 'length'; + var L = initial_L; + var zero = '0'; + + var s = "asdf" + + function stringLengthTest(change_index) { + for (var i = 0; i < 10; i++) { + var l = s[L]; + if (i <= change_index) { + assertEquals(4, l); + } else { + assertEquals('a', l); + } + if (i == change_index) L = zero; + } + L = initial_L; + } + + for (var i = 0; i < 10; i++) stringLengthTest(i); +} + +runTest(); + +// ---------------------------------------------------------------------- +// Field access. +// ---------------------------------------------------------------------- +runTest = function() { + var o = { x: 42, y: 43 } + + var initial_X = 'x'; + var X = initial_X; + var Y = 'y'; + + function fieldTest(change_index) { + for (var i = 0; i < 10; i++) { + var property = o[X]; + if (i <= change_index) { + assertEquals(42, property); + } else { + assertEquals(43, property); + } + if (i == change_index) X = Y; + } + X = initial_X; + }; + + for (var i = 0; i < 10; i++) fieldTest(i); +} + +runTest(); + + +// ---------------------------------------------------------------------- +// Constant function access. +// ---------------------------------------------------------------------- +runTest = function() { + function fun() { }; + + var o = new Object(); + o.f = fun; + o.x = 42; + + var initial_F = 'f'; + var F = initial_F; + var X = 'x' + + function constantFunctionTest(change_index) { + for (var i = 0; i < 10; i++) { + var property = o[F]; + if (i <= change_index) { + assertEquals(fun, property); + } else { + assertEquals(42, property); + } + if (i == change_index) F = X; + } + F = initial_F; + }; + + for (var i = 0; i < 10; i++) constantFunctionTest(i); +} + +runTest(); + +// ---------------------------------------------------------------------- +// Keyed store field. +// ---------------------------------------------------------------------- + +runTest = function() { + var o = { x: 42, y: 43 } + + var initial_X = 'x'; + var X = initial_X; + var Y = 'y'; + + function fieldTest(change_index) { + for (var i = 0; i < 10; i++) { + o[X] = X; + var property = o[X]; + if (i <= change_index) { + assertEquals('x', property); + } else { + assertEquals('y', property); + } + if (i == change_index) X = Y; + } + X = initial_X; + }; + + for (var i = 0; i < 10; i++) fieldTest(i); +} + +runTest(); diff --git a/deps/v8/test/mjsunit/keyed-storage-extend.js b/deps/v8/test/mjsunit/keyed-storage-extend.js new file mode 100644 index 0000000000..04d2f0477a --- /dev/null +++ b/deps/v8/test/mjsunit/keyed-storage-extend.js @@ -0,0 +1,55 @@ +// Copyright 2008 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 F() { } + +function GrowNamed(o) { + o.a = 1; + o.b = 2; + o.c = 3; + o.d = 4; + o.e = 5; + o.f = 6; +} + +function GrowKeyed(o) { + var names = ['a','b','c','d','e','f']; + var i = 0; + o[names[i++]] = i; + o[names[i++]] = i; + o[names[i++]] = i; + o[names[i++]] = i; + o[names[i++]] = i; + o[names[i++]] = i; +} + +GrowNamed(new F()); +GrowNamed(new F()); +GrowNamed(new F()); +GrowKeyed(new F()); +GrowKeyed(new F()); +GrowKeyed(new F()); diff --git a/deps/v8/test/mjsunit/large-object-allocation.js b/deps/v8/test/mjsunit/large-object-allocation.js new file mode 100644 index 0000000000..c2b717c896 --- /dev/null +++ b/deps/v8/test/mjsunit/large-object-allocation.js @@ -0,0 +1,300 @@ +// Copyright 2008 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. + +// Allocate a very large object that is guaranteed to overflow the +// instance_size field in the map resulting in an object that is smaller +// than what was called for. +function LargeObject(i) { + this.a = i; + this.b = i; + this.c = i; + this.d = i; + this.e = i; + this.f = i; + this.g = i; + this.h = i; + this.i = i; + this.j = i; + this.k = i; + this.l = i; + this.m = i; + this.n = i; + this.o = i; + this.p = i; + this.q = i; + this.r = i; + this.s = i; + this.t = i; + this.u = i; + this.v = i; + this.w = i; + this.x = i; + this.y = i; + this.z = i; + this.a1 = i; + this.b1 = i; + this.c1 = i; + this.d1 = i; + this.e1 = i; + this.f1 = i; + this.g1 = i; + this.h1 = i; + this.i1 = i; + this.j1 = i; + this.k1 = i; + this.l1 = i; + this.m1 = i; + this.n1 = i; + this.o1 = i; + this.p1 = i; + this.q1 = i; + this.r1 = i; + this.s1 = i; + this.t1 = i; + this.u1 = i; + this.v1 = i; + this.w1 = i; + this.x1 = i; + this.y1 = i; + this.z1 = i; + this.a2 = i; + this.b2 = i; + this.c2 = i; + this.d2 = i; + this.e2 = i; + this.f2 = i; + this.g2 = i; + this.h2 = i; + this.i2 = i; + this.j2 = i; + this.k2 = i; + this.l2 = i; + this.m2 = i; + this.n2 = i; + this.o2 = i; + this.p2 = i; + this.q2 = i; + this.r2 = i; + this.s2 = i; + this.t2 = i; + this.u2 = i; + this.v2 = i; + this.w2 = i; + this.x2 = i; + this.y2 = i; + this.z2 = i; + this.a3 = i; + this.b3 = i; + this.c3 = i; + this.d3 = i; + this.e3 = i; + this.f3 = i; + this.g3 = i; + this.h3 = i; + this.i3 = i; + this.j3 = i; + this.k3 = i; + this.l3 = i; + this.m3 = i; + this.n3 = i; + this.o3 = i; + this.p3 = i; + this.q3 = i; + this.r3 = i; + this.s3 = i; + this.t3 = i; + this.u3 = i; + this.v3 = i; + this.w3 = i; + this.x3 = i; + this.y3 = i; + this.z3 = i; + this.a4 = i; + this.b4 = i; + this.c4 = i; + this.d4 = i; + this.e4 = i; + this.f4 = i; + this.g4 = i; + this.h4 = i; + this.i4 = i; + this.j4 = i; + this.k4 = i; + this.l4 = i; + this.m4 = i; + this.n4 = i; + this.o4 = i; + this.p4 = i; + this.q4 = i; + this.r4 = i; + this.s4 = i; + this.t4 = i; + this.u4 = i; + this.v4 = i; + this.w4 = i; + this.x4 = i; + this.y4 = i; + this.z4 = i; + this.a5 = i; + this.b5 = i; + this.c5 = i; + this.d5 = i; + this.e5 = i; + this.f5 = i; + this.g5 = i; + this.h5 = i; + this.i5 = i; + this.j5 = i; + this.k5 = i; + this.l5 = i; + this.m5 = i; + this.n5 = i; + this.o5 = i; + this.p5 = i; + this.q5 = i; + this.r5 = i; + this.s5 = i; + this.t5 = i; + this.u5 = i; + this.v5 = i; + this.w5 = i; + this.x5 = i; + this.y5 = i; + this.z5 = i; + this.a6 = i; + this.b6 = i; + this.c6 = i; + this.d6 = i; + this.e6 = i; + this.f6 = i; + this.g6 = i; + this.h6 = i; + this.i6 = i; + this.j6 = i; + this.k6 = i; + this.l6 = i; + this.m6 = i; + this.n6 = i; + this.o6 = i; + this.p6 = i; + this.q6 = i; + this.r6 = i; + this.s6 = i; + this.t6 = i; + this.u6 = i; + this.v6 = i; + this.w6 = i; + this.x6 = i; + this.y6 = i; + this.z6 = i; + this.a7 = i; + this.b7 = i; + this.c7 = i; + this.d7 = i; + this.e7 = i; + this.f7 = i; + this.g7 = i; + this.h7 = i; + this.i7 = i; + this.j7 = i; + this.k7 = i; + this.l7 = i; + this.m7 = i; + this.n7 = i; + this.o7 = i; + this.p7 = i; + this.q7 = i; + this.r7 = i; + this.s7 = i; + this.t7 = i; + this.u7 = i; + this.v7 = i; + this.w7 = i; + this.x7 = i; + this.y7 = i; + this.z7 = i; + this.a8 = i; + this.b8 = i; + this.c8 = i; + this.d8 = i; + this.e8 = i; + this.f8 = i; + this.g8 = i; + this.h8 = i; + this.i8 = i; + this.j8 = i; + this.k8 = i; + this.l8 = i; + this.m8 = i; + this.n8 = i; + this.o8 = i; + this.p8 = i; + this.q8 = i; + this.r8 = i; + this.s8 = i; + this.t8 = i; + this.u8 = i; + this.v8 = i; + this.w8 = i; + this.x8 = i; + this.y8 = i; + this.z8 = i; + this.a9 = i; + this.b9 = i; + this.c9 = i; + this.d9 = i; + this.e9 = i; + this.f9 = i; + this.g9 = i; + this.h9 = i; + this.i9 = i; + this.j9 = i; + this.k9 = i; + this.l9 = i; + this.m9 = i; + this.n9 = i; + this.o9 = i; + this.p9 = i; + this.q9 = i; + // With this number of properties the object perfectly wraps around if the + // instance size is not checked when allocating the initial map for MultiProp. + // Meaning that the instance will be smaller than a minimal JSObject and we + // will suffer a bus error in the release build or an assertion in the debug + // build. +} + +function ExpectAllFields(o, val) { + for (var x in o) { + assertEquals(o[x], val); + } +} + +var a = new LargeObject(1); +var b = new LargeObject(2); + +ExpectAllFields(a, 1); +ExpectAllFields(b, 2); diff --git a/deps/v8/test/mjsunit/large-object-literal.js b/deps/v8/test/mjsunit/large-object-literal.js new file mode 100644 index 0000000000..70a27696ba --- /dev/null +++ b/deps/v8/test/mjsunit/large-object-literal.js @@ -0,0 +1,56 @@ +// Copyright 2008 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 we can create object literals of various sizes. +function testLiteral(size) { + + // Build object-literal string. + var literal = "var o = { "; + + for (var i = 0; i < size; i++) { + if (i > 0) literal += ","; + literal += ("a" + i + ":" + i); + } + literal += "}"; + + // Create the object literal. + eval(literal); + + // Check that the properties have the expected values. + for (var i = 0; i < size; i++) { + assertEquals(i, o["a"+i]); + } +} + +// The sizes to test. +var sizes = [0, 1, 2, 100, 200, 400, 1000]; + +// Run the test. +for (var i = 0; i < sizes.length; i++) { + testLiteral(sizes[i]); +} + diff --git a/deps/v8/test/mjsunit/lazy-load.js b/deps/v8/test/mjsunit/lazy-load.js new file mode 100644 index 0000000000..c384331c7b --- /dev/null +++ b/deps/v8/test/mjsunit/lazy-load.js @@ -0,0 +1,34 @@ +// Copyright 2008 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 unusual way of accessing Date. +var date0 = new this["Date"](1111); +assertEquals(1111, date0.getTime()); + +// Check that regexp literals use original RegExp (non-ECMA-262). +RegExp = 42; +var re = /test/; diff --git a/deps/v8/test/mjsunit/leakcheck.js b/deps/v8/test/mjsunit/leakcheck.js new file mode 100644 index 0000000000..7cbb2e5500 --- /dev/null +++ b/deps/v8/test/mjsunit/leakcheck.js @@ -0,0 +1,53 @@ +// Copyright 2008 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. + +/** + * This test is run with leak detection when running special tests. + * Don't do too much work here or running it will take forever. + */ + +function fac(n) { + if (n > 0) return fac(n - 1) * n; + else return 1; +} + +function testFac() { + if (fac(6) != 720) throw "Error"; +} + +function testRegExp() { + var input = "123456789"; + var result = input.replace(/[4-6]+/g, "xxx"); + if (result != "123xxx789") throw "Error"; +} + +function main() { + testFac(); + testRegExp(); +} + +main(); diff --git a/deps/v8/test/mjsunit/length.js b/deps/v8/test/mjsunit/length.js new file mode 100644 index 0000000000..3331564b81 --- /dev/null +++ b/deps/v8/test/mjsunit/length.js @@ -0,0 +1,78 @@ +// Copyright 2008 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. + +/** + * @fileoverview Assert we match ES3 and Safari. + */ + +assertEquals(0, Array.prototype.length, "Array.prototype.length"); +assertEquals(1, Array.length, "Array.length"); +assertEquals(1, Array.prototype.concat.length, "Array.prototype.concat.length"); +assertEquals(1, Array.prototype.join.length, "Array.prototype.join.length"); +assertEquals(1, Array.prototype.push.length, "Array.prototype.push.length"); +assertEquals(1, Array.prototype.unshift.length, "Array.prototype.unshift.length"); +assertEquals(1, Boolean.length, "Boolean.length"); +assertEquals(1, Error.length, "Error.length"); +assertEquals(1, EvalError.length, "EvalError.length"); +assertEquals(1, Function.length, "Function.length"); +assertEquals(1, Function.prototype.call.length, "Function.prototype.call.length"); +assertEquals(1, Number.length, "Number.length"); +assertEquals(1, Number.prototype.toExponential.length, "Number.prototype.toExponential.length"); +assertEquals(1, Number.prototype.toFixed.length, "Number.prototype.toFixed.length"); +assertEquals(1, Number.prototype.toPrecision.length, "Number.prototype.toPrecision.length"); +assertEquals(1, Object.length, "Object.length"); +assertEquals(1, RangeError.length, "RangeError.length"); +assertEquals(1, ReferenceError.length, "ReferenceError.length"); +assertEquals(1, String.fromCharCode.length, "String.fromCharCode.length"); +assertEquals(1, String.length, "String.length"); +assertEquals(1, String.prototype.concat.length, "String.prototype.concat.length"); +assertEquals(1, String.prototype.indexOf.length, "String.prototype.indexOf.length"); +assertEquals(1, String.prototype.lastIndexOf.length, "String.prototype.lastIndexOf.length"); +assertEquals(1, SyntaxError.length, "SyntaxError.length"); +assertEquals(1, TypeError.length, "TypeError.length"); +assertEquals(2, Array.prototype.slice.length, "Array.prototype.slice.length"); +assertEquals(2, Array.prototype.splice.length, "Array.prototype.splice.length"); +assertEquals(2, Date.prototype.setMonth.length, "Date.prototype.setMonth.length"); +assertEquals(2, Date.prototype.setSeconds.length, "Date.prototype.setSeconds.length"); +assertEquals(2, Date.prototype.setUTCMonth.length, "Date.prototype.setUTCMonth.length"); +assertEquals(2, Date.prototype.setUTCSeconds.length, "Date.prototype.setUTCSeconds.length"); +assertEquals(2, Function.prototype.apply.length, "Function.prototype.apply.length"); +assertEquals(2, Math.max.length, "Math.max.length"); +assertEquals(2, Math.min.length, "Math.min.length"); +assertEquals(2, RegExp.length, "RegExp.length"); +assertEquals(2, String.prototype.slice.length, "String.prototype.slice.length"); +assertEquals(2, String.prototype.split.length, "String.prototype.split.length"); +assertEquals(2, String.prototype.substr.length, "String.prototype.substr.length"); +assertEquals(2, String.prototype.substring.length, "String.prototype.substring.length"); +assertEquals(3, Date.prototype.setFullYear.length, "Date.prototype.setFullYear.length"); +assertEquals(3, Date.prototype.setMinutes.length, "Date.prototype.setMinutes.length"); +assertEquals(3, Date.prototype.setUTCFullYear.length, "Date.prototype.setUTCFullYear.length"); +assertEquals(3, Date.prototype.setUTCMinutes.length, "Date.prototype.setUTCMinutes.length"); +assertEquals(4, Date.prototype.setHours.length, "Date.prototype.setHours.length"); +assertEquals(4, Date.prototype.setUTCHours.length, "Date.prototype.setUTCHours.length"); +assertEquals(7, Date.UTC.length, "Date.UTC.length"); +assertEquals(7, Date.length, "Date.length"); diff --git a/deps/v8/test/mjsunit/local-load-from-eval.js b/deps/v8/test/mjsunit/local-load-from-eval.js new file mode 100644 index 0000000000..0fdac9a791 --- /dev/null +++ b/deps/v8/test/mjsunit/local-load-from-eval.js @@ -0,0 +1,39 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Tests loads of local properties from eval. + +function test(source) { + var x = 27; + eval(source); +} + +test("assertEquals(27, x);"); +test("(function() { assertEquals(27, x) })();"); +test("(function() { var y = 42; eval('1'); assertEquals(42, y); })();"); +test("(function() { var y = 42; eval('var y = 2; var z = 2;'); assertEquals(2, y); })();"); + diff --git a/deps/v8/test/mjsunit/math-min-max.js b/deps/v8/test/mjsunit/math-min-max.js new file mode 100644 index 0000000000..0ed991203c --- /dev/null +++ b/deps/v8/test/mjsunit/math-min-max.js @@ -0,0 +1,72 @@ +// Copyright 2008 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 Math.min(). + +assertEquals(Number.POSITIVE_INFINITY, Math.min()); +assertEquals(1, Math.min(1)); +assertEquals(1, Math.min(1, 2)); +assertEquals(1, Math.min(2, 1)); +assertEquals(1, Math.min(1, 2, 3)); +assertEquals(1, Math.min(3, 2, 1)); +assertEquals(1, Math.min(2, 3, 1)); + +var o = {}; +o.valueOf = function() { return 1; }; +assertEquals(1, Math.min(2, 3, '1')); +assertEquals(1, Math.min(3, o, 2)); +assertEquals(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / Math.min(-0, +0)); +assertEquals(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / Math.min(+0, -0)); +assertEquals(Number.NEGATIVE_INFINITY, Number.POSITIVE_INFINITY / Math.min(+0, -0, 1)); +assertEquals(-1, Math.min(+0, -0, -1)); +assertEquals(-1, Math.min(-1, +0, -0)); +assertEquals(-1, Math.min(+0, -1, -0)); +assertEquals(-1, Math.min(-0, -1, +0)); + + + +// Test Math.max(). + +assertEquals(Number.NEGATIVE_INFINITY, Math.max()); +assertEquals(1, Math.max(1)); +assertEquals(2, Math.max(1, 2)); +assertEquals(2, Math.max(2, 1)); +assertEquals(3, Math.max(1, 2, 3)); +assertEquals(3, Math.max(3, 2, 1)); +assertEquals(3, Math.max(2, 3, 1)); + +var o = {}; +o.valueOf = function() { return 3; }; +assertEquals(3, Math.max(2, '3', 1)); +assertEquals(3, Math.max(1, o, 2)); +assertEquals(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Math.max(-0, +0)); +assertEquals(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Math.max(+0, -0)); +assertEquals(Number.POSITIVE_INFINITY, Number.POSITIVE_INFINITY / Math.max(+0, -0, -1)); +assertEquals(1, Math.max(+0, -0, +1)); +assertEquals(1, Math.max(+1, +0, -0)); +assertEquals(1, Math.max(+0, +1, -0)); +assertEquals(1, Math.max(-0, +1, +0));
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/megamorphic-callbacks.js b/deps/v8/test/mjsunit/megamorphic-callbacks.js new file mode 100644 index 0000000000..8829df0f6c --- /dev/null +++ b/deps/v8/test/mjsunit/megamorphic-callbacks.js @@ -0,0 +1,70 @@ +// Copyright 2008 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 load(o) { + return o.x; +}; + +function store(o) { + o.y = 42; +}; + +function call(o) { + return o.f(); +}; + +// Create a slow-case object (with hashed properties). +var o = { x: 42, f: function() { }, z: 100 }; +delete o.z; + +// Initialize IC stubs. +load(o); +store(o); +call(o); + + +// Create a new slow-case object (with hashed properties) and add +// setter and getter properties to the object. +var o = { z: 100 }; +delete o.z; +o.__defineGetter__("x", function() { return 100; }); +o.__defineSetter__("y", function(value) { this.y_mirror = value; }); +o.__defineGetter__("f", function() { return function() { return 300; }}); + +// Perform the load checks. +assertEquals(100, o.x, "normal load"); +assertEquals(100, load(o), "ic load"); + +// Perform the store checks. +o.y = 200; +assertEquals(200, o.y_mirror, "normal store"); +store(o); +assertEquals(42, o.y_mirror, "ic store"); + +// Perform the call checks. +assertEquals(300, o.f(), "normal call"); +assertEquals(300, call(o), "ic call"); diff --git a/deps/v8/test/mjsunit/mirror-array.js b/deps/v8/test/mjsunit/mirror-array.js new file mode 100644 index 0000000000..1873d1eb6e --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-array.js @@ -0,0 +1,137 @@ +// Copyright 2008 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 +// Test the mirror object for objects + +function MirrorRefCache(json_refs) { + var tmp = eval('(' + json_refs + ')'); + this.refs_ = []; + for (var i = 0; i < tmp.length; i++) { + this.refs_[tmp[i].handle] = tmp[i]; + } +} + +MirrorRefCache.prototype.lookup = function(handle) { + return this.refs_[handle]; +} + +function testArrayMirror(a, names) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(a); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + var refs = new MirrorRefCache(serializer.serializeReferencedObjects()); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror, 'Unexpected mirror hierachy'); + assertTrue(mirror instanceof debug.ValueMirror, 'Unexpected mirror hierachy'); + assertTrue(mirror instanceof debug.ObjectMirror, 'Unexpected mirror hierachy'); + assertTrue(mirror instanceof debug.ArrayMirror, 'Unexpected mirror hierachy'); + + // Check the mirror properties. + assertTrue(mirror.isArray(), 'Unexpected mirror'); + assertEquals('object', mirror.type(), 'Unexpected mirror type'); + assertFalse(mirror.isPrimitive(), 'Unexpected primitive mirror'); + assertEquals('Array', mirror.className(), 'Unexpected mirror class name'); + assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror, 'Unexpected mirror hierachy'); + assertEquals('Array', mirror.constructorFunction().name(), 'Unexpected constructor function name'); + assertTrue(mirror.protoObject() instanceof debug.Mirror, 'Unexpected mirror hierachy'); + assertTrue(mirror.prototypeObject() instanceof debug.Mirror, 'Unexpected mirror hierachy'); + assertEquals(mirror.length(), a.length, "Length mismatch"); + + var indexedProperties = mirror.indexedPropertiesFromRange(); + assertEquals(indexedProperties.length, a.length); + for (var i = 0; i < indexedProperties.length; i++) { + assertTrue(indexedProperties[i] instanceof debug.Mirror, 'Unexpected mirror hierachy'); + assertTrue(indexedProperties[i] instanceof debug.PropertyMirror, 'Unexpected mirror hierachy'); + } + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('object', fromJSON.type, 'Unexpected mirror type in JSON'); + assertEquals('Array', fromJSON.className, 'Unexpected mirror class name in JSON'); + assertEquals(mirror.constructorFunction().handle(), fromJSON.constructorFunction.ref, 'Unexpected constructor function handle in JSON'); + assertEquals('function', refs.lookup(fromJSON.constructorFunction.ref).type, 'Unexpected constructor function type in JSON'); + assertEquals('Array', refs.lookup(fromJSON.constructorFunction.ref).name, 'Unexpected constructor function name in JSON'); + assertEquals(void 0, fromJSON.namedInterceptor, 'No named interceptor expected in JSON'); + assertEquals(void 0, fromJSON.indexedInterceptor, 'No indexed interceptor expected in JSON'); + + // Check that the serialization contains all indexed properties and the length property. + var length_found = false; + for (var i = 0; i < fromJSON.properties.length; i++) { + if (fromJSON.properties[i].name == 'length') { + length_found = true; + assertEquals('number', refs.lookup(fromJSON.properties[i].ref).type, "Unexpected type of the length property"); + assertEquals(a.length, refs.lookup(fromJSON.properties[i].ref).value, "Length mismatch in parsed JSON"); + } else { + var index = parseInt(fromJSON.properties[i].name); + print(index); + if (!isNaN(index)) { + print(index); + // This test assumes that the order of the indexeed properties is in the + // same order in the serialization as returned from + // indexedPropertiesFromRange() + assertEquals(indexedProperties[index].name(), index); + assertEquals(indexedProperties[index].value().type(), refs.lookup(fromJSON.properties[i].ref).type, 'Unexpected serialized type'); + } + } + } + assertTrue(length_found, 'Property length not found'); + + // Check that the serialization contains all names properties. + if (names) { + for (var i = 0; i < names.length; i++) { + var found = false; + for (var j = 0; j < fromJSON.properties.length; j++) { + if (names[i] == fromJSON.properties[j].name) { + found = true; + } + } + assertTrue(found, names[i]) + } + } +} + + +// Test a number of different arrays. +testArrayMirror([]); +testArrayMirror([1]); +testArrayMirror([1,2]); +testArrayMirror(["a", function(){}, [1,2], 2, /[ab]/]); + +a=[1]; +a[100]=7; +testArrayMirror(a); + +a=[1,2,3]; +a.x=2.2; +a.y=function(){return null;} +testArrayMirror(a, ['x','y']); + +var a = []; a.push(a); +testArrayMirror(a); diff --git a/deps/v8/test/mjsunit/mirror-boolean.js b/deps/v8/test/mjsunit/mirror-boolean.js new file mode 100644 index 0000000000..4f93089241 --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-boolean.js @@ -0,0 +1,59 @@ +// Copyright 2008 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 +// Test the mirror object for boolean values + +function testBooleanMirror(b) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(b); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror); + assertTrue(mirror instanceof debug.ValueMirror); + assertTrue(mirror instanceof debug.BooleanMirror); + + // Check the mirror properties. + assertTrue(mirror.isBoolean()); + assertEquals('boolean', mirror.type()); + assertTrue(mirror.isPrimitive()); + + // Test text representation + assertEquals(b ? 'true' : 'false', mirror.toText()); + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('boolean', fromJSON.type, json); + assertEquals(b, fromJSON.value, json); +} + + +// Test all boolean values. +testBooleanMirror(true); +testBooleanMirror(false);
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/mirror-date.js b/deps/v8/test/mjsunit/mirror-date.js new file mode 100644 index 0000000000..a6334d0f12 --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-date.js @@ -0,0 +1,75 @@ +// Copyright 2008 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 +// Test the mirror object for boolean values + +function testDateMirror(d, iso8601) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(d); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror); + assertTrue(mirror instanceof debug.ValueMirror); + assertTrue(mirror instanceof debug.ObjectMirror); + assertTrue(mirror instanceof debug.DateMirror); + + // Check the mirror properties. + assertTrue(mirror.isDate()); + assertEquals('object', mirror.type()); + assertFalse(mirror.isPrimitive()); + + // Test text representation + assertEquals(iso8601, mirror.toText()); + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('object', fromJSON.type); + assertEquals('Date', fromJSON.className); + assertEquals(iso8601, fromJSON.value); +} + + +// Test Date values. +testDateMirror(new Date(Date.parse("Dec 25, 1995 1:30 UTC")), "1995-12-25T01:30:00.000Z"); +d = new Date(); +d.setUTCFullYear(1967); +d.setUTCMonth(0); // January. +d.setUTCDate(17); +d.setUTCHours(9); +d.setUTCMinutes(22); +d.setUTCSeconds(59); +d.setUTCMilliseconds(0); +testDateMirror(d, "1967-01-17T09:22:59.000Z"); +d.setUTCMilliseconds(1); +testDateMirror(d, "1967-01-17T09:22:59.001Z"); +d.setUTCMilliseconds(12); +testDateMirror(d, "1967-01-17T09:22:59.012Z"); +d.setUTCMilliseconds(123); +testDateMirror(d, "1967-01-17T09:22:59.123Z"); diff --git a/deps/v8/test/mjsunit/mirror-error.js b/deps/v8/test/mjsunit/mirror-error.js new file mode 100644 index 0000000000..37ec46c863 --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-error.js @@ -0,0 +1,93 @@ +// Copyright 2008 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 +// Test the mirror object for regular error objects + +function MirrorRefCache(json_refs) { + var tmp = eval('(' + json_refs + ')'); + this.refs_ = []; + for (var i = 0; i < tmp.length; i++) { + this.refs_[tmp[i].handle] = tmp[i]; + } +} + +MirrorRefCache.prototype.lookup = function(handle) { + return this.refs_[handle]; +} + +function testErrorMirror(e) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(e); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + var refs = new MirrorRefCache(serializer.serializeReferencedObjects()); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror); + assertTrue(mirror instanceof debug.ValueMirror); + assertTrue(mirror instanceof debug.ObjectMirror); + assertTrue(mirror instanceof debug.ErrorMirror); + + // Check the mirror properties. + assertTrue(mirror.isError()); + assertEquals('error', mirror.type()); + assertFalse(mirror.isPrimitive()); + assertEquals(mirror.message(), e.message, 'source'); + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('error', fromJSON.type); + assertEquals('Error', fromJSON.className); + if (e.message) { + var found_message = false; + for (var i in fromJSON.properties) { + var p = fromJSON.properties[i]; + print(p.name); + if (p.name == 'message') { + assertEquals(e.message, refs.lookup(p.ref).value); + found_message = true; + } + } + assertTrue(found_message, 'Property message not found'); + } + + // Check the formatted text (regress 1231579). + assertEquals(fromJSON.text, e.toString(), 'toString'); +} + + +// Test Date values. +testErrorMirror(new Error()); +testErrorMirror(new Error('This does not work')); +testErrorMirror(new Error(123+456)); +testErrorMirror(new EvalError('EvalError')); +testErrorMirror(new RangeError('RangeError')); +testErrorMirror(new ReferenceError('ReferenceError')); +testErrorMirror(new SyntaxError('SyntaxError')); +testErrorMirror(new TypeError('TypeError')); +testErrorMirror(new URIError('URIError')); diff --git a/deps/v8/test/mjsunit/mirror-function.js b/deps/v8/test/mjsunit/mirror-function.js new file mode 100644 index 0000000000..59d9e7862a --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-function.js @@ -0,0 +1,89 @@ +// Copyright 2008 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 +// Test the mirror object for functions. + +function MirrorRefCache(json_refs) { + var tmp = eval('(' + json_refs + ')'); + this.refs_ = []; + for (var i = 0; i < tmp.length; i++) { + this.refs_[tmp[i].handle] = tmp[i]; + } +} + +MirrorRefCache.prototype.lookup = function(handle) { + return this.refs_[handle]; +} + +function testFunctionMirror(f) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(f); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + var refs = new MirrorRefCache(serializer.serializeReferencedObjects()); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror); + assertTrue(mirror instanceof debug.ValueMirror); + assertTrue(mirror instanceof debug.ObjectMirror); + assertTrue(mirror instanceof debug.FunctionMirror); + + // Check the mirror properties. + assertTrue(mirror.isFunction()); + assertEquals('function', mirror.type()); + assertFalse(mirror.isPrimitive()); + assertEquals("Function", mirror.className()); + assertEquals(f.name, mirror.name()); + assertTrue(mirror.resolved()); + assertEquals(f.toString(), mirror.source()); + assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror); + assertTrue(mirror.protoObject() instanceof debug.Mirror); + assertTrue(mirror.prototypeObject() instanceof debug.Mirror); + + // Test text representation + assertEquals(f.toString(), mirror.toText()); + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('function', fromJSON.type); + assertEquals('Function', fromJSON.className); + assertEquals('function', refs.lookup(fromJSON.constructorFunction.ref).type); + assertEquals('Function', refs.lookup(fromJSON.constructorFunction.ref).name); + assertTrue(fromJSON.resolved); + assertEquals(f.name, fromJSON.name); + assertEquals(f.toString(), fromJSON.source); + + // Check the formatted text (regress 1142074). + assertEquals(f.toString(), fromJSON.text); +} + + +// Test a number of different functions. +testFunctionMirror(function(){}); +testFunctionMirror(function a(){return 1;}); +testFunctionMirror(Math.sin); diff --git a/deps/v8/test/mjsunit/mirror-null.js b/deps/v8/test/mjsunit/mirror-null.js new file mode 100644 index 0000000000..db68966a47 --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-null.js @@ -0,0 +1,50 @@ +// Copyright 2008 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 +// Test the mirror object for null + +// Create mirror and JSON representation. +var mirror = debug.MakeMirror(null); +var serializer = debug.MakeMirrorSerializer(); +var json = serializer.serializeValue(mirror); + +// Check the mirror hierachy. +assertTrue(mirror instanceof debug.Mirror); +assertTrue(mirror instanceof debug.NullMirror); + +// Check the mirror properties. +assertTrue(mirror.isNull()); +assertEquals('null', mirror.type()); +assertTrue(mirror.isPrimitive()); + +// Test text representation +assertEquals('null', mirror.toText()); + +// Parse JSON representation and check. +var fromJSON = eval('(' + json + ')'); +assertEquals('null', fromJSON.type); diff --git a/deps/v8/test/mjsunit/mirror-number.js b/deps/v8/test/mjsunit/mirror-number.js new file mode 100644 index 0000000000..68eb0d7e73 --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-number.js @@ -0,0 +1,77 @@ +// Copyright 2008 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 +// Test the mirror object for number values + +function testNumberMirror(n) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(n); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror); + assertTrue(mirror instanceof debug.ValueMirror); + assertTrue(mirror instanceof debug.NumberMirror); + + // Check the mirror properties. + assertTrue(mirror.isNumber()); + assertEquals('number', mirror.type()); + assertTrue(mirror.isPrimitive()); + + // Test text representation + assertEquals(String(n), mirror.toText()); + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('number', fromJSON.type); + if (!isNaN(n)) { + assertEquals(n, fromJSON.value); + } else { + // NaN values are encoded as strings. + assertTrue(typeof fromJSON.value == 'string'); + if (n === Infinity) { + assertEquals('Infinity', fromJSON.value); + } else if (n === -Infinity) { + assertEquals('-Infinity', fromJSON.value); + } else { + assertEquals('NaN', fromJSON.value); + } + } +} + + +// Test a number of different numbers. +testNumberMirror(-7); +testNumberMirror(-6.5); +testNumberMirror(0); +testNumberMirror(42); +testNumberMirror(100.0002); +testNumberMirror(Infinity); +testNumberMirror(-Infinity); +testNumberMirror(NaN); diff --git a/deps/v8/test/mjsunit/mirror-object.js b/deps/v8/test/mjsunit/mirror-object.js new file mode 100644 index 0000000000..e829a0e220 --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-object.js @@ -0,0 +1,227 @@ +// Copyright 2008 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 +// Test the mirror object for objects + +function MirrorRefCache(json_refs) { + var tmp = eval('(' + json_refs + ')'); + this.refs_ = []; + for (var i = 0; i < tmp.length; i++) { + this.refs_[tmp[i].handle] = tmp[i]; + } +} + +MirrorRefCache.prototype.lookup = function(handle) { + return this.refs_[handle]; +} + +function testObjectMirror(obj, cls_name, ctor_name, hasSpecialProperties) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(obj); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + var refs = new MirrorRefCache(serializer.serializeReferencedObjects()); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror, 'Unexpected mirror hierachy'); + assertTrue(mirror instanceof debug.ValueMirror, 'Unexpected mirror hierachy'); + assertTrue(mirror instanceof debug.ObjectMirror, 'Unexpected mirror hierachy'); + + // Check the mirror properties. + assertTrue(mirror.isObject(), 'Unexpected mirror'); + assertEquals('object', mirror.type(), 'Unexpected mirror type'); + assertFalse(mirror.isPrimitive(), 'Unexpected primitive mirror'); + assertEquals(cls_name, mirror.className(), 'Unexpected mirror class name'); + assertTrue(mirror.constructorFunction() instanceof debug.ObjectMirror, 'Unexpected mirror hierachy'); + assertEquals(ctor_name, mirror.constructorFunction().name(), 'Unexpected constructor function name'); + assertTrue(mirror.protoObject() instanceof debug.Mirror, 'Unexpected mirror hierachy'); + assertTrue(mirror.prototypeObject() instanceof debug.Mirror, 'Unexpected mirror hierachy'); + assertFalse(mirror.hasNamedInterceptor(), 'No named interceptor expected'); + assertFalse(mirror.hasIndexedInterceptor(), 'No indexed interceptor expected'); + + var names = mirror.propertyNames(); + var properties = mirror.properties() + assertEquals(names.length, properties.length); + for (var i = 0; i < properties.length; i++) { + assertTrue(properties[i] instanceof debug.Mirror, 'Unexpected mirror hierachy'); + assertTrue(properties[i] instanceof debug.PropertyMirror, 'Unexpected mirror hierachy'); + assertEquals('property', properties[i].type(), 'Unexpected mirror type'); + assertEquals(names[i], properties[i].name(), 'Unexpected property name'); + } + + for (var p in obj) { + var property_mirror = mirror.property(p); + assertTrue(property_mirror instanceof debug.PropertyMirror); + assertEquals(p, property_mirror.name()); + // If the object has some special properties don't test for these. + if (!hasSpecialProperties) { + assertEquals(0, property_mirror.attributes(), property_mirror.name()); + assertFalse(property_mirror.isReadOnly()); + assertTrue(property_mirror.isEnum()); + assertTrue(property_mirror.canDelete()); + } + } + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('object', fromJSON.type, 'Unexpected mirror type in JSON'); + assertEquals(cls_name, fromJSON.className, 'Unexpected mirror class name in JSON'); + assertEquals(mirror.constructorFunction().handle(), fromJSON.constructorFunction.ref, 'Unexpected constructor function handle in JSON'); + assertEquals('function', refs.lookup(fromJSON.constructorFunction.ref).type, 'Unexpected constructor function type in JSON'); + assertEquals(ctor_name, refs.lookup(fromJSON.constructorFunction.ref).name, 'Unexpected constructor function name in JSON'); + assertEquals(mirror.protoObject().handle(), fromJSON.protoObject.ref, 'Unexpected proto object handle in JSON'); + assertEquals(mirror.protoObject().type(), refs.lookup(fromJSON.protoObject.ref).type, 'Unexpected proto object type in JSON'); + assertEquals(mirror.prototypeObject().handle(), fromJSON.prototypeObject.ref, 'Unexpected prototype object handle in JSON'); + assertEquals(mirror.prototypeObject().type(), refs.lookup(fromJSON.prototypeObject.ref).type, 'Unexpected prototype object type in JSON'); + assertEquals(void 0, fromJSON.namedInterceptor, 'No named interceptor expected in JSON'); + assertEquals(void 0, fromJSON.indexedInterceptor, 'No indexed interceptor expected in JSON'); + + // Check that the serialization contains all properties. + assertEquals(names.length, fromJSON.properties.length, 'Some properties missing in JSON'); + for (var i = 0; i < fromJSON.properties.length; i++) { + var name = fromJSON.properties[i].name; + if (!name) name = fromJSON.properties[i].index; + var found = false; + for (var j = 0; j < names.length; j++) { + if (names[j] == name) { + // Check that serialized handle is correct. + assertEquals(properties[i].value().handle(), fromJSON.properties[i].ref, 'Unexpected serialized handle'); + + // Check that serialized name is correct. + assertEquals(properties[i].name(), fromJSON.properties[i].name, 'Unexpected serialized name'); + + // If property type is normal property type is not serialized. + if (properties[i].propertyType() != debug.PropertyType.Normal) { + assertEquals(properties[i].propertyType(), fromJSON.properties[i].propertyType, 'Unexpected serialized property type'); + } else { + assertTrue(typeof(fromJSON.properties[i].propertyType) === 'undefined', 'Unexpected serialized property type'); + } + + // If there are no attributes attributes are not serialized. + if (properties[i].attributes() != debug.PropertyAttribute.None) { + assertEquals(properties[i].attributes(), fromJSON.properties[i].attributes, 'Unexpected serialized attributes'); + } else { + assertTrue(typeof(fromJSON.properties[i].attributes) === 'undefined', 'Unexpected serialized attributes'); + } + + // Lookup the serialized object from the handle reference. + var o = refs.lookup(fromJSON.properties[i].ref); + assertTrue(o != void 0, 'Referenced object is not serialized'); + + assertEquals(properties[i].value().type(), o.type, 'Unexpected serialized property type for ' + name); + if (properties[i].value().isPrimitive()) { + // Special check for NaN as NaN == NaN is false. + if (properties[i].value().isNumber() && isNaN(properties[i].value().value())) { + assertEquals('NaN', o.value, 'Unexpected serialized property value for ' + name); + } else { + assertEquals(properties[i].value().value(), o.value, 'Unexpected serialized property value for ' + name); + } + } else if (properties[i].value().isFunction()) { + assertEquals(properties[i].value().source(), o.source, 'Unexpected serialized property value for ' + name); + } + found = true; + } + } + assertTrue(found, '"' + name + '" not found (' + json + ')'); + } +} + + +function Point(x,y) { + this.x_ = x; + this.y_ = y; +} + + +// Test a number of different objects. +testObjectMirror({}, 'Object', 'Object'); +testObjectMirror({'a':1,'b':2}, 'Object', 'Object'); +testObjectMirror({'1':void 0,'2':null,'f':function pow(x,y){return Math.pow(x,y);}}, 'Object', 'Object'); +testObjectMirror(new Point(-1.2,2.003), 'Object', 'Point'); +testObjectMirror(this, 'global', '', true); // Global object has special properties +testObjectMirror(this.__proto__, 'Object', ''); +testObjectMirror([], 'Array', 'Array'); +testObjectMirror([1,2], 'Array', 'Array'); + +// Test circular references. +o = {}; +o.o = o; +testObjectMirror(o, 'Object', 'Object'); + +// Test that non enumerable properties are part of the mirror +global_mirror = debug.MakeMirror(this); +assertEquals('property', global_mirror.property("Math").type()); +assertFalse(global_mirror.property("Math").isEnum(), "Math is enumerable" + global_mirror.property("Math").attributes()); + +math_mirror = global_mirror.property("Math").value(); +assertEquals('property', math_mirror.property("E").type()); +assertFalse(math_mirror.property("E").isEnum(), "Math.E is enumerable"); +assertTrue(math_mirror.property("E").isReadOnly()); +assertFalse(math_mirror.property("E").canDelete()); + +// Test objects with JavaScript accessors. +o = {} +o.__defineGetter__('a', function(){return 'a';}); +o.__defineSetter__('b', function(){}); +o.__defineGetter__('c', function(){throw 'c';}); +o.__defineSetter__('c', function(){throw 'c';}); +testObjectMirror(o, 'Object', 'Object'); +mirror = debug.MakeMirror(o); +// a has getter but no setter. +assertTrue(mirror.property('a').hasGetter()); +assertFalse(mirror.property('a').hasSetter()); +assertEquals(debug.PropertyType.Callbacks, mirror.property('a').propertyType()); +assertEquals('function', mirror.property('a').getter().type()); +assertEquals('undefined', mirror.property('a').setter().type()); +assertEquals('function (){return \'a\';}', mirror.property('a').getter().source()); +// b has setter but no getter. +assertFalse(mirror.property('b').hasGetter()); +assertTrue(mirror.property('b').hasSetter()); +assertEquals(debug.PropertyType.Callbacks, mirror.property('b').propertyType()); +assertEquals('undefined', mirror.property('b').getter().type()); +assertEquals('function', mirror.property('b').setter().type()); +assertEquals('function (){}', mirror.property('b').setter().source()); +assertFalse(mirror.property('b').isException()); +// c has both getter and setter. The getter throws an exception. +assertTrue(mirror.property('c').hasGetter()); +assertTrue(mirror.property('c').hasSetter()); +assertEquals(debug.PropertyType.Callbacks, mirror.property('c').propertyType()); +assertEquals('function', mirror.property('c').getter().type()); +assertEquals('function', mirror.property('c').setter().type()); +assertEquals('function (){throw \'c\';}', mirror.property('c').getter().source()); +assertEquals('function (){throw \'c\';}', mirror.property('c').setter().source()); + +// Test objects with native accessors. +mirror = debug.MakeMirror(new String('abc')); +assertTrue(mirror instanceof debug.ObjectMirror); +assertFalse(mirror.property('length').hasGetter()); +assertFalse(mirror.property('length').hasSetter()); +assertTrue(mirror.property('length').isNative()); +assertEquals('a', mirror.property(0).value().value()); +assertEquals('b', mirror.property(1).value().value()); +assertEquals('c', mirror.property(2).value().value()); diff --git a/deps/v8/test/mjsunit/mirror-regexp.js b/deps/v8/test/mjsunit/mirror-regexp.js new file mode 100644 index 0000000000..0490b17f02 --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-regexp.js @@ -0,0 +1,109 @@ +// Copyright 2008 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 +// Test the mirror object for regular expression values + +var all_attributes = debug.PropertyAttribute.ReadOnly | + debug.PropertyAttribute.DontEnum | + debug.PropertyAttribute.DontDelete; +var expected_attributes = { + 'source': all_attributes, + 'global': all_attributes, + 'ignoreCase': all_attributes, + 'multiline': all_attributes, + 'lastIndex': debug.PropertyAttribute.DontEnum | debug.PropertyAttribute.DontDelete +}; + +function MirrorRefCache(json_refs) { + var tmp = eval('(' + json_refs + ')'); + this.refs_ = []; + for (var i = 0; i < tmp.length; i++) { + this.refs_[tmp[i].handle] = tmp[i]; + } +} + +MirrorRefCache.prototype.lookup = function(handle) { + return this.refs_[handle]; +} + +function testRegExpMirror(r) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(r); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + var refs = new MirrorRefCache(serializer.serializeReferencedObjects()); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror); + assertTrue(mirror instanceof debug.ValueMirror); + assertTrue(mirror instanceof debug.ObjectMirror); + assertTrue(mirror instanceof debug.RegExpMirror); + + // Check the mirror properties. + assertTrue(mirror.isRegExp()); + assertEquals('regexp', mirror.type()); + assertFalse(mirror.isPrimitive()); + for (var p in expected_attributes) { + assertEquals(mirror.property(p).attributes(), + expected_attributes[p], + p + ' attributes'); + } + + // Test text representation + assertEquals('/' + r.source + '/', mirror.toText()); + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('regexp', fromJSON.type); + assertEquals('RegExp', fromJSON.className); + for (var p in expected_attributes) { + for (var i = 0; i < fromJSON.properties.length; i++) { + if (fromJSON.properties[i].name == p) { + assertEquals(expected_attributes[p], + fromJSON.properties[i].attributes, + 'Unexpected value for ' + p + ' attributes'); + assertEquals(mirror.property(p).propertyType(), + fromJSON.properties[i].propertyType, + 'Unexpected value for ' + p + ' propertyType'); + assertEquals(mirror.property(p).value().handle(), + fromJSON.properties[i].ref, + 'Unexpected handle for ' + p); + assertEquals(mirror.property(p).value().value(), + refs.lookup(fromJSON.properties[i].ref).value, + 'Unexpected value for ' + p); + } + } + } +} + + +// Test Date values. +testRegExpMirror(/x/); +testRegExpMirror(/[abc]/); +testRegExpMirror(/[\r\n]/g); +testRegExpMirror(/a*b/gmi); diff --git a/deps/v8/test/mjsunit/mirror-script.js b/deps/v8/test/mjsunit/mirror-script.js new file mode 100644 index 0000000000..61f0f3aa6d --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-script.js @@ -0,0 +1,92 @@ +// Copyright 2008 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 +// Test the mirror object for scripts. + +function testScriptMirror(f, file_name, file_lines, script_type, script_source) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(f).script(); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror); + assertFalse(mirror instanceof debug.ValueMirror); + assertTrue(mirror instanceof debug.ScriptMirror); + + // Check the mirror properties. + assertTrue(mirror.isScript()); + assertEquals('script', mirror.type()); + var name = mirror.name(); + if (name) { + assertEquals(file_name, name.substring(name.length - file_name.length)); + } else { + assertTrue(file_name === null); + } + assertEquals(0, mirror.lineOffset()); + assertEquals(0, mirror.columnOffset()); + if (file_lines > 0) { + assertEquals(file_lines, mirror.lineCount()); + } + assertEquals(script_type, mirror.scriptType()); + if (script_source) { + assertEquals(script_source, mirror.source()); + } + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('script', fromJSON.type); + name = fromJSON.name; + if (name) { + assertEquals(file_name, name.substring(name.length - file_name.length)); + } else { + assertTrue(file_name === null); + } + assertEquals(0, fromJSON.lineOffset); + assertEquals(0, fromJSON.columnOffset); + if (file_lines > 0) { + assertEquals(file_lines, fromJSON.lineCount); + } + assertEquals(script_type, fromJSON.scriptType); +} + + +// Test the script mirror for different functions. +testScriptMirror(function(){}, 'mirror-script.js', 92, 2); +testScriptMirror(Math.sin, 'native math.js', -1, 0); +testScriptMirror(eval('function(){}'), null, 1, 2, 'function(){}'); +testScriptMirror(eval('function(){\n }'), null, 2, 2, 'function(){\n }'); + +// Test taking slices of source. +var mirror = debug.MakeMirror(eval('function(){\n 1;\n}')).script(); +assertEquals('function(){\n', mirror.sourceSlice(0, 1).sourceText()); +assertEquals(' 1;\n', mirror.sourceSlice(1, 2).sourceText()); +assertEquals('}', mirror.sourceSlice(2, 3).sourceText()); +assertEquals('function(){\n 1;\n', mirror.sourceSlice(0, 2).sourceText()); +assertEquals(' 1;\n}', mirror.sourceSlice(1, 3).sourceText()); +assertEquals('function(){\n 1;\n}', mirror.sourceSlice(0, 3).sourceText()); diff --git a/deps/v8/test/mjsunit/mirror-string.js b/deps/v8/test/mjsunit/mirror-string.js new file mode 100644 index 0000000000..eeabc5fe2a --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-string.js @@ -0,0 +1,89 @@ +// Copyright 2008 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 +// Test the mirror object for string values + +const kMaxProtocolStringLength = 80; // Constant from mirror-delay.js + +function testStringMirror(s) { + // Create mirror and JSON representation. + var mirror = debug.MakeMirror(s); + var serializer = debug.MakeMirrorSerializer(); + var json = serializer.serializeValue(mirror); + + // Check the mirror hierachy. + assertTrue(mirror instanceof debug.Mirror); + assertTrue(mirror instanceof debug.ValueMirror); + assertTrue(mirror instanceof debug.StringMirror); + + // Check the mirror properties. + assertTrue(mirror.isString()); + assertEquals('string', mirror.type()); + assertTrue(mirror.isPrimitive()); + + // Test text representation + if (s.length <= kMaxProtocolStringLength) { + assertEquals(s, mirror.toText()); + } else { + assertEquals(s.substring(0, kMaxProtocolStringLength), + mirror.toText().substring(0, kMaxProtocolStringLength)); + } + + // Parse JSON representation and check. + var fromJSON = eval('(' + json + ')'); + assertEquals('string', fromJSON.type); + if (s.length <= kMaxProtocolStringLength) { + assertEquals(s, fromJSON.value); + } else { + assertEquals(s.substring(0, kMaxProtocolStringLength), + fromJSON.value.substring(0, kMaxProtocolStringLength)); + assertEquals(fromJSON.fromIndex, 0); + assertEquals(fromJSON.toIndex, kMaxProtocolStringLength); + } +} + +// Test a number of different strings. +testStringMirror(''); +testStringMirror('abcdABCD'); +testStringMirror('1234'); +testStringMirror('"'); +testStringMirror('"""'); +testStringMirror("'"); +testStringMirror("'''"); +testStringMirror("'\"'"); +testStringMirror('\\'); +testStringMirror('\b\t\n\f\r'); +testStringMirror('\u0001\u0002\u001E\u001F'); +testStringMirror('"a":1,"b":2'); + +var s = "1234567890" +s = s + s + s + s + s + s + s + s; +assertEquals(kMaxProtocolStringLength, s.length); +testStringMirror(s); +s = s + 'X'; +testStringMirror(s); diff --git a/deps/v8/test/mjsunit/mirror-undefined.js b/deps/v8/test/mjsunit/mirror-undefined.js new file mode 100644 index 0000000000..2b5b84c6ad --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-undefined.js @@ -0,0 +1,50 @@ +// Copyright 2008 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 +// Test the mirror object for undefined + +// Create mirror and JSON representation. +var mirror = debug.MakeMirror(void 0); +var serializer = debug.MakeMirrorSerializer(); +var json = serializer.serializeValue(mirror); + +// Check the mirror hierachy. +assertTrue(mirror instanceof debug.Mirror); +assertTrue(mirror instanceof debug.UndefinedMirror); + +// Check the mirror properties. +assertTrue(mirror.isUndefined()); +assertEquals('undefined', mirror.type()); +assertTrue(mirror.isPrimitive()); + +// Test text representation +assertEquals('undefined', mirror.toText()); + +// Parse JSON representation and check. +var fromJSON = eval('(' + json + ')'); +assertEquals('undefined', fromJSON.type);
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/mirror-unresolved-function.js b/deps/v8/test/mjsunit/mirror-unresolved-function.js new file mode 100644 index 0000000000..21d0e561b0 --- /dev/null +++ b/deps/v8/test/mjsunit/mirror-unresolved-function.js @@ -0,0 +1,78 @@ +// Copyright 2008 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 +// Test the mirror object for unresolved functions. + +function MirrorRefCache(json_refs) { + var tmp = eval('(' + json_refs + ')'); + this.refs_ = []; + for (var i = 0; i < tmp.length; i++) { + this.refs_[tmp[i].handle] = tmp[i]; + } +} + +MirrorRefCache.prototype.lookup = function(handle) { + return this.refs_[handle]; +} + +var mirror = new debug.UnresolvedFunctionMirror("f"); +var serializer = debug.MakeMirrorSerializer(); +var json = serializer.serializeValue(mirror); +var refs = new MirrorRefCache(serializer.serializeReferencedObjects()); + +// Check the mirror hierachy for unresolved functions. +assertTrue(mirror instanceof debug.Mirror); +assertTrue(mirror instanceof debug.ValueMirror); +assertTrue(mirror instanceof debug.ObjectMirror); +assertTrue(mirror instanceof debug.FunctionMirror); + +// Check the mirror properties for unresolved functions. +assertTrue(mirror.isUnresolvedFunction()); +assertEquals('function', mirror.type()); +assertFalse(mirror.isPrimitive()); +assertEquals("Function", mirror.className()); +assertEquals("f", mirror.name()); +assertFalse(mirror.resolved()); +assertEquals(void 0, mirror.source()); +assertEquals('undefined', mirror.constructorFunction().type()); +assertEquals('undefined', mirror.protoObject().type()); +assertEquals('undefined', mirror.prototypeObject().type()); + +// Parse JSON representation of unresolved functions and check. +var fromJSON = eval('(' + json + ')'); +assertEquals('function', fromJSON.type, 'Unexpected mirror type in JSON'); +assertEquals('Function', fromJSON.className, 'Unexpected mirror class name in JSON'); +assertEquals(mirror.constructorFunction().handle(), fromJSON.constructorFunction.ref, 'Unexpected constructor function handle in JSON'); +assertEquals('undefined', refs.lookup(fromJSON.constructorFunction.ref).type, 'Unexpected constructor function type in JSON'); +assertEquals(mirror.protoObject().handle(), fromJSON.protoObject.ref, 'Unexpected proto object handle in JSON'); +assertEquals('undefined', refs.lookup(fromJSON.protoObject.ref).type, 'Unexpected proto object type in JSON'); +assertEquals(mirror.prototypeObject().handle(), fromJSON.prototypeObject.ref, 'Unexpected prototype object handle in JSON'); +assertEquals('undefined', refs.lookup(fromJSON.prototypeObject.ref).type, 'Unexpected prototype object type in JSON'); +assertFalse(fromJSON.resolved); +assertEquals("f", fromJSON.name); +assertEquals(void 0, fromJSON.source); diff --git a/deps/v8/test/mjsunit/mjsunit.js b/deps/v8/test/mjsunit/mjsunit.js new file mode 100644 index 0000000000..3570d689ce --- /dev/null +++ b/deps/v8/test/mjsunit/mjsunit.js @@ -0,0 +1,151 @@ +// Copyright 2008 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 MjsUnitAssertionError(message) { + this.message = message; +} + +MjsUnitAssertionError.prototype.toString = function () { + return this.message; +} + +/* + * This file is included in all mini jsunit test cases. The test + * framework expects lines that signal failed tests to start with + * the f-word and ignore all other lines. + */ + +function fail(expected, found, name_opt) { + var start; + if (name_opt) { + // Fix this when we ditch the old test runner. + start = "Fail" + "ure (" + name_opt + "): "; + } else { + start = "Fail" + "ure:"; + } + throw new MjsUnitAssertionError(start + " expected <" + expected + "> found <" + found + ">"); +} + + +function deepEquals(a, b) { + if (a == b) return true; + if ((typeof a) !== 'object' || (typeof b) !== 'object' || + (a === null) || (b === null)) + return false; + if (a.constructor === Array) { + if (b.constructor !== Array) + return false; + if (a.length != b.length) + return false; + for (var i = 0; i < a.length; i++) { + if (i in a) { + if (!(i in b) || !(deepEquals(a[i], b[i]))) + return false; + } else if (i in b) { + return false; + } + } + return true; + } + return false; +} + + +function assertEquals(expected, found, name_opt) { + if (!deepEquals(found, expected)) { + fail(expected, found, name_opt); + } +} + + +function assertArrayEquals(expected, found, name_opt) { + var start = ""; + if (name_opt) { + start = name_opt + " - "; + } + assertEquals(expected.length, found.length, start + "array length"); + if (expected.length == found.length) { + for (var i = 0; i < expected.length; ++i) { + assertEquals(expected[i], found[i], start + "array element at index " + i); + } + } +} + + +function assertTrue(value, name_opt) { + assertEquals(true, value, name_opt); +} + + +function assertFalse(value, name_opt) { + assertEquals(false, value, name_opt); +} + + +function assertNaN(value, name_opt) { + if (!isNaN(value)) { + fail("NaN", value, name_opt); + } +} + + +function assertThrows(code) { + var threwException = true; + try { + eval(code); + threwException = false; + } catch (e) { + // Do nothing. + } + if (!threwException) assertTrue(false, "did not throw exception"); +} + + +function assertInstanceof(obj, type) { + if (!(obj instanceof type)) { + assertTrue(false, "Object <" + obj + "> is not an instance of <" + type + ">"); + } +} + + +function assertDoesNotThrow(code) { + try { + eval(code); + } catch (e) { + assertTrue(false, "threw an exception"); + } +} + + +function assertUnreachable(name_opt) { + // Fix this when we ditch the old test runner. + var message = "Fail" + "ure: unreachable" + if (name_opt) { + message += " - " + name_opt; + } + throw new MjsUnitAssertionError(message); +} diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status new file mode 100644 index 0000000000..5a76078724 --- /dev/null +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -0,0 +1,68 @@ +# Copyright 2008 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. + +prefix mjsunit + +# All tests in the bug directory are expected to fail. +bugs: FAIL + +# This one uses a built-in that's only present in debug mode. It takes +# too long to run in debug mode on ARM. +fuzz-natives: PASS, SKIP if ($mode == release || $arch == arm) + +big-object-literal: PASS, SKIP if ($arch == arm) + +[ $arch == arm ] + +# Slow tests which times out in debug mode. +try: PASS, SKIP if $mode == debug +debug-scripts-request: PASS, SKIP if $mode == debug + +# Flaky test that can hit compilation-time stack overflow in debug mode. +unicode-test: PASS, (PASS || FAIL) if $mode == debug + +# Bug number 1020483: Debug tests fail on ARM. +debug-constructor: CRASH, FAIL +debug-continue: SKIP +debug-evaluate-recursive: CRASH, FAIL if $mode == debug +debug-changebreakpoint: CRASH, FAIL if $mode == debug +debug-clearbreakpoint: CRASH, FAIL if $mode == debug +debug-conditional-breakpoints: CRASH, FAIL if $mode == debug +debug-evaluate: CRASH, FAIL if $mode == debug +debug-ignore-breakpoints: CRASH, FAIL if $mode == debug +debug-multiple-breakpoints: CRASH, FAIL if $mode == debug +debug-setbreakpoint: CRASH, FAIL if $mode == debug +debug-step-stub-callfunction: SKIP +debug-stepin-constructor: CRASH, FAIL +debug-step: SKIP +debug-breakpoints: PASS || FAIL +debug-handle: CRASH, FAIL if $mode == debug +regress/regress-269: SKIP + +# Bug number 130 http://code.google.com/p/v8/issues/detail?id=130 +# Fails on real ARM hardware but not on the simulator. +string-compare-alignment: PASS || FAIL diff --git a/deps/v8/test/mjsunit/mul-exhaustive.js b/deps/v8/test/mjsunit/mul-exhaustive.js new file mode 100644 index 0000000000..452f9332c7 --- /dev/null +++ b/deps/v8/test/mjsunit/mul-exhaustive.js @@ -0,0 +1,4511 @@ +// Copyright 2008 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 x; +var y; +var a; + +function f(a, y) { + assertEquals(a, x * y); + assertEquals(a, -x * -y); + assertEquals(-a, -x * y); + assertEquals(-a, x * -y); + assertEquals(a, y * x); + assertEquals(a, -y * -x); + assertEquals(-a, y * -x); + assertEquals(-a, -y * x); +} + +x = 1; +f(1, 1); +x = 2; +f(2, 1); +f(4, 2); +x = 3; +f(3, 1); +f(6, 2); +f(9, 3); +x = 4; +f(4, 1); +f(8, 2); +f(12, 3); +f(16, 4); +x = 5; +f(5, 1); +f(10, 2); +f(15, 3); +f(20, 4); +f(25, 5); +x = 7; +f(7, 1); +f(14, 2); +f(21, 3); +f(28, 4); +f(35, 5); +f(49, 7); +x = 8; +f(8, 1); +f(16, 2); +f(24, 3); +f(32, 4); +f(40, 5); +f(56, 7); +f(64, 8); +x = 9; +f(9, 1); +f(18, 2); +f(27, 3); +f(36, 4); +f(45, 5); +f(63, 7); +f(72, 8); +f(81, 9); +x = 15; +f(15, 1); +f(30, 2); +f(45, 3); +f(60, 4); +f(75, 5); +f(105, 7); +f(120, 8); +f(135, 9); +f(225, 15); +x = 16; +f(16, 1); +f(32, 2); +f(48, 3); +f(64, 4); +f(80, 5); +f(112, 7); +f(128, 8); +f(144, 9); +f(240, 15); +f(256, 16); +x = 17; +f(17, 1); +f(34, 2); +f(51, 3); +f(68, 4); +f(85, 5); +f(119, 7); +f(136, 8); +f(153, 9); +f(255, 15); +f(272, 16); +f(289, 17); +x = 31; +f(31, 1); +f(62, 2); +f(93, 3); +f(124, 4); +f(155, 5); +f(217, 7); +f(248, 8); +f(279, 9); +f(465, 15); +f(496, 16); +f(527, 17); +f(961, 31); +x = 32; +f(32, 1); +f(64, 2); +f(96, 3); +f(128, 4); +f(160, 5); +f(224, 7); +f(256, 8); +f(288, 9); +f(480, 15); +f(512, 16); +f(544, 17); +f(992, 31); +f(1024, 32); +x = 33; +f(33, 1); +f(66, 2); +f(99, 3); +f(132, 4); +f(165, 5); +f(231, 7); +f(264, 8); +f(297, 9); +f(495, 15); +f(528, 16); +f(561, 17); +f(1023, 31); +f(1056, 32); +f(1089, 33); +x = 63; +f(63, 1); +f(126, 2); +f(189, 3); +f(252, 4); +f(315, 5); +f(441, 7); +f(504, 8); +f(567, 9); +f(945, 15); +f(1008, 16); +f(1071, 17); +f(1953, 31); +f(2016, 32); +f(2079, 33); +f(3969, 63); +x = 64; +f(64, 1); +f(128, 2); +f(192, 3); +f(256, 4); +f(320, 5); +f(448, 7); +f(512, 8); +f(576, 9); +f(960, 15); +f(1024, 16); +f(1088, 17); +f(1984, 31); +f(2048, 32); +f(2112, 33); +f(4032, 63); +f(4096, 64); +x = 65; +f(65, 1); +f(130, 2); +f(195, 3); +f(260, 4); +f(325, 5); +f(455, 7); +f(520, 8); +f(585, 9); +f(975, 15); +f(1040, 16); +f(1105, 17); +f(2015, 31); +f(2080, 32); +f(2145, 33); +f(4095, 63); +f(4160, 64); +f(4225, 65); +x = 127; +f(127, 1); +f(254, 2); +f(381, 3); +f(508, 4); +f(635, 5); +f(889, 7); +f(1016, 8); +f(1143, 9); +f(1905, 15); +f(2032, 16); +f(2159, 17); +f(3937, 31); +f(4064, 32); +f(4191, 33); +f(8001, 63); +f(8128, 64); +f(8255, 65); +f(16129, 127); +x = 128; +f(128, 1); +f(256, 2); +f(384, 3); +f(512, 4); +f(640, 5); +f(896, 7); +f(1024, 8); +f(1152, 9); +f(1920, 15); +f(2048, 16); +f(2176, 17); +f(3968, 31); +f(4096, 32); +f(4224, 33); +f(8064, 63); +f(8192, 64); +f(8320, 65); +f(16256, 127); +f(16384, 128); +x = 129; +f(129, 1); +f(258, 2); +f(387, 3); +f(516, 4); +f(645, 5); +f(903, 7); +f(1032, 8); +f(1161, 9); +f(1935, 15); +f(2064, 16); +f(2193, 17); +f(3999, 31); +f(4128, 32); +f(4257, 33); +f(8127, 63); +f(8256, 64); +f(8385, 65); +f(16383, 127); +f(16512, 128); +f(16641, 129); +x = 255; +f(255, 1); +f(510, 2); +f(765, 3); +f(1020, 4); +f(1275, 5); +f(1785, 7); +f(2040, 8); +f(2295, 9); +f(3825, 15); +f(4080, 16); +f(4335, 17); +f(7905, 31); +f(8160, 32); +f(8415, 33); +f(16065, 63); +f(16320, 64); +f(16575, 65); +f(32385, 127); +f(32640, 128); +f(32895, 129); +f(65025, 255); +x = 256; +f(256, 1); +f(512, 2); +f(768, 3); +f(1024, 4); +f(1280, 5); +f(1792, 7); +f(2048, 8); +f(2304, 9); +f(3840, 15); +f(4096, 16); +f(4352, 17); +f(7936, 31); +f(8192, 32); +f(8448, 33); +f(16128, 63); +f(16384, 64); +f(16640, 65); +f(32512, 127); +f(32768, 128); +f(33024, 129); +f(65280, 255); +f(65536, 256); +x = 257; +f(257, 1); +f(514, 2); +f(771, 3); +f(1028, 4); +f(1285, 5); +f(1799, 7); +f(2056, 8); +f(2313, 9); +f(3855, 15); +f(4112, 16); +f(4369, 17); +f(7967, 31); +f(8224, 32); +f(8481, 33); +f(16191, 63); +f(16448, 64); +f(16705, 65); +f(32639, 127); +f(32896, 128); +f(33153, 129); +f(65535, 255); +f(65792, 256); +f(66049, 257); +x = 511; +f(511, 1); +f(1022, 2); +f(1533, 3); +f(2044, 4); +f(2555, 5); +f(3577, 7); +f(4088, 8); +f(4599, 9); +f(7665, 15); +f(8176, 16); +f(8687, 17); +f(15841, 31); +f(16352, 32); +f(16863, 33); +f(32193, 63); +f(32704, 64); +f(33215, 65); +f(64897, 127); +f(65408, 128); +f(65919, 129); +f(130305, 255); +f(130816, 256); +f(131327, 257); +f(261121, 511); +x = 512; +f(512, 1); +f(1024, 2); +f(1536, 3); +f(2048, 4); +f(2560, 5); +f(3584, 7); +f(4096, 8); +f(4608, 9); +f(7680, 15); +f(8192, 16); +f(8704, 17); +f(15872, 31); +f(16384, 32); +f(16896, 33); +f(32256, 63); +f(32768, 64); +f(33280, 65); +f(65024, 127); +f(65536, 128); +f(66048, 129); +f(130560, 255); +f(131072, 256); +f(131584, 257); +f(261632, 511); +f(262144, 512); +x = 513; +f(513, 1); +f(1026, 2); +f(1539, 3); +f(2052, 4); +f(2565, 5); +f(3591, 7); +f(4104, 8); +f(4617, 9); +f(7695, 15); +f(8208, 16); +f(8721, 17); +f(15903, 31); +f(16416, 32); +f(16929, 33); +f(32319, 63); +f(32832, 64); +f(33345, 65); +f(65151, 127); +f(65664, 128); +f(66177, 129); +f(130815, 255); +f(131328, 256); +f(131841, 257); +f(262143, 511); +f(262656, 512); +f(263169, 513); +x = 1023; +f(1023, 1); +f(2046, 2); +f(3069, 3); +f(4092, 4); +f(5115, 5); +f(7161, 7); +f(8184, 8); +f(9207, 9); +f(15345, 15); +f(16368, 16); +f(17391, 17); +f(31713, 31); +f(32736, 32); +f(33759, 33); +f(64449, 63); +f(65472, 64); +f(66495, 65); +f(129921, 127); +f(130944, 128); +f(131967, 129); +f(260865, 255); +f(261888, 256); +f(262911, 257); +f(522753, 511); +f(523776, 512); +f(524799, 513); +f(1046529, 1023); +x = 1024; +f(1024, 1); +f(2048, 2); +f(3072, 3); +f(4096, 4); +f(5120, 5); +f(7168, 7); +f(8192, 8); +f(9216, 9); +f(15360, 15); +f(16384, 16); +f(17408, 17); +f(31744, 31); +f(32768, 32); +f(33792, 33); +f(64512, 63); +f(65536, 64); +f(66560, 65); +f(130048, 127); +f(131072, 128); +f(132096, 129); +f(261120, 255); +f(262144, 256); +f(263168, 257); +f(523264, 511); +f(524288, 512); +f(525312, 513); +f(1047552, 1023); +f(1048576, 1024); +x = 1025; +f(1025, 1); +f(2050, 2); +f(3075, 3); +f(4100, 4); +f(5125, 5); +f(7175, 7); +f(8200, 8); +f(9225, 9); +f(15375, 15); +f(16400, 16); +f(17425, 17); +f(31775, 31); +f(32800, 32); +f(33825, 33); +f(64575, 63); +f(65600, 64); +f(66625, 65); +f(130175, 127); +f(131200, 128); +f(132225, 129); +f(261375, 255); +f(262400, 256); +f(263425, 257); +f(523775, 511); +f(524800, 512); +f(525825, 513); +f(1048575, 1023); +f(1049600, 1024); +f(1050625, 1025); +x = 2047; +f(2047, 1); +f(4094, 2); +f(6141, 3); +f(8188, 4); +f(10235, 5); +f(14329, 7); +f(16376, 8); +f(18423, 9); +f(30705, 15); +f(32752, 16); +f(34799, 17); +f(63457, 31); +f(65504, 32); +f(67551, 33); +f(128961, 63); +f(131008, 64); +f(133055, 65); +f(259969, 127); +f(262016, 128); +f(264063, 129); +f(521985, 255); +f(524032, 256); +f(526079, 257); +f(1046017, 511); +f(1048064, 512); +f(1050111, 513); +f(2094081, 1023); +f(2096128, 1024); +f(2098175, 1025); +f(4190209, 2047); +x = 2048; +f(2048, 1); +f(4096, 2); +f(6144, 3); +f(8192, 4); +f(10240, 5); +f(14336, 7); +f(16384, 8); +f(18432, 9); +f(30720, 15); +f(32768, 16); +f(34816, 17); +f(63488, 31); +f(65536, 32); +f(67584, 33); +f(129024, 63); +f(131072, 64); +f(133120, 65); +f(260096, 127); +f(262144, 128); +f(264192, 129); +f(522240, 255); +f(524288, 256); +f(526336, 257); +f(1046528, 511); +f(1048576, 512); +f(1050624, 513); +f(2095104, 1023); +f(2097152, 1024); +f(2099200, 1025); +f(4192256, 2047); +f(4194304, 2048); +x = 2049; +f(2049, 1); +f(4098, 2); +f(6147, 3); +f(8196, 4); +f(10245, 5); +f(14343, 7); +f(16392, 8); +f(18441, 9); +f(30735, 15); +f(32784, 16); +f(34833, 17); +f(63519, 31); +f(65568, 32); +f(67617, 33); +f(129087, 63); +f(131136, 64); +f(133185, 65); +f(260223, 127); +f(262272, 128); +f(264321, 129); +f(522495, 255); +f(524544, 256); +f(526593, 257); +f(1047039, 511); +f(1049088, 512); +f(1051137, 513); +f(2096127, 1023); +f(2098176, 1024); +f(2100225, 1025); +f(4194303, 2047); +f(4196352, 2048); +f(4198401, 2049); +x = 4095; +f(4095, 1); +f(8190, 2); +f(12285, 3); +f(16380, 4); +f(20475, 5); +f(28665, 7); +f(32760, 8); +f(36855, 9); +f(61425, 15); +f(65520, 16); +f(69615, 17); +f(126945, 31); +f(131040, 32); +f(135135, 33); +f(257985, 63); +f(262080, 64); +f(266175, 65); +f(520065, 127); +f(524160, 128); +f(528255, 129); +f(1044225, 255); +f(1048320, 256); +f(1052415, 257); +f(2092545, 511); +f(2096640, 512); +f(2100735, 513); +f(4189185, 1023); +f(4193280, 1024); +f(4197375, 1025); +f(8382465, 2047); +f(8386560, 2048); +f(8390655, 2049); +f(16769025, 4095); +x = 4096; +f(4096, 1); +f(8192, 2); +f(12288, 3); +f(16384, 4); +f(20480, 5); +f(28672, 7); +f(32768, 8); +f(36864, 9); +f(61440, 15); +f(65536, 16); +f(69632, 17); +f(126976, 31); +f(131072, 32); +f(135168, 33); +f(258048, 63); +f(262144, 64); +f(266240, 65); +f(520192, 127); +f(524288, 128); +f(528384, 129); +f(1044480, 255); +f(1048576, 256); +f(1052672, 257); +f(2093056, 511); +f(2097152, 512); +f(2101248, 513); +f(4190208, 1023); +f(4194304, 1024); +f(4198400, 1025); +f(8384512, 2047); +f(8388608, 2048); +f(8392704, 2049); +f(16773120, 4095); +f(16777216, 4096); +x = 4097; +f(4097, 1); +f(8194, 2); +f(12291, 3); +f(16388, 4); +f(20485, 5); +f(28679, 7); +f(32776, 8); +f(36873, 9); +f(61455, 15); +f(65552, 16); +f(69649, 17); +f(127007, 31); +f(131104, 32); +f(135201, 33); +f(258111, 63); +f(262208, 64); +f(266305, 65); +f(520319, 127); +f(524416, 128); +f(528513, 129); +f(1044735, 255); +f(1048832, 256); +f(1052929, 257); +f(2093567, 511); +f(2097664, 512); +f(2101761, 513); +f(4191231, 1023); +f(4195328, 1024); +f(4199425, 1025); +f(8386559, 2047); +f(8390656, 2048); +f(8394753, 2049); +f(16777215, 4095); +f(16781312, 4096); +f(16785409, 4097); +x = 8191; +f(8191, 1); +f(16382, 2); +f(24573, 3); +f(32764, 4); +f(40955, 5); +f(57337, 7); +f(65528, 8); +f(73719, 9); +f(122865, 15); +f(131056, 16); +f(139247, 17); +f(253921, 31); +f(262112, 32); +f(270303, 33); +f(516033, 63); +f(524224, 64); +f(532415, 65); +f(1040257, 127); +f(1048448, 128); +f(1056639, 129); +f(2088705, 255); +f(2096896, 256); +f(2105087, 257); +f(4185601, 511); +f(4193792, 512); +f(4201983, 513); +f(8379393, 1023); +f(8387584, 1024); +f(8395775, 1025); +f(16766977, 2047); +f(16775168, 2048); +f(16783359, 2049); +f(33542145, 4095); +f(33550336, 4096); +f(33558527, 4097); +f(67092481, 8191); +x = 8192; +f(8192, 1); +f(16384, 2); +f(24576, 3); +f(32768, 4); +f(40960, 5); +f(57344, 7); +f(65536, 8); +f(73728, 9); +f(122880, 15); +f(131072, 16); +f(139264, 17); +f(253952, 31); +f(262144, 32); +f(270336, 33); +f(516096, 63); +f(524288, 64); +f(532480, 65); +f(1040384, 127); +f(1048576, 128); +f(1056768, 129); +f(2088960, 255); +f(2097152, 256); +f(2105344, 257); +f(4186112, 511); +f(4194304, 512); +f(4202496, 513); +f(8380416, 1023); +f(8388608, 1024); +f(8396800, 1025); +f(16769024, 2047); +f(16777216, 2048); +f(16785408, 2049); +f(33546240, 4095); +f(33554432, 4096); +f(33562624, 4097); +f(67100672, 8191); +f(67108864, 8192); +x = 8193; +f(8193, 1); +f(16386, 2); +f(24579, 3); +f(32772, 4); +f(40965, 5); +f(57351, 7); +f(65544, 8); +f(73737, 9); +f(122895, 15); +f(131088, 16); +f(139281, 17); +f(253983, 31); +f(262176, 32); +f(270369, 33); +f(516159, 63); +f(524352, 64); +f(532545, 65); +f(1040511, 127); +f(1048704, 128); +f(1056897, 129); +f(2089215, 255); +f(2097408, 256); +f(2105601, 257); +f(4186623, 511); +f(4194816, 512); +f(4203009, 513); +f(8381439, 1023); +f(8389632, 1024); +f(8397825, 1025); +f(16771071, 2047); +f(16779264, 2048); +f(16787457, 2049); +f(33550335, 4095); +f(33558528, 4096); +f(33566721, 4097); +f(67108863, 8191); +f(67117056, 8192); +f(67125249, 8193); +x = 16383; +f(16383, 1); +f(32766, 2); +f(49149, 3); +f(65532, 4); +f(81915, 5); +f(114681, 7); +f(131064, 8); +f(147447, 9); +f(245745, 15); +f(262128, 16); +f(278511, 17); +f(507873, 31); +f(524256, 32); +f(540639, 33); +f(1032129, 63); +f(1048512, 64); +f(1064895, 65); +f(2080641, 127); +f(2097024, 128); +f(2113407, 129); +f(4177665, 255); +f(4194048, 256); +f(4210431, 257); +f(8371713, 511); +f(8388096, 512); +f(8404479, 513); +f(16759809, 1023); +f(16776192, 1024); +f(16792575, 1025); +f(33536001, 2047); +f(33552384, 2048); +f(33568767, 2049); +f(67088385, 4095); +f(67104768, 4096); +f(67121151, 4097); +f(134193153, 8191); +f(134209536, 8192); +f(134225919, 8193); +f(268402689, 16383); +x = 16384; +f(16384, 1); +f(32768, 2); +f(49152, 3); +f(65536, 4); +f(81920, 5); +f(114688, 7); +f(131072, 8); +f(147456, 9); +f(245760, 15); +f(262144, 16); +f(278528, 17); +f(507904, 31); +f(524288, 32); +f(540672, 33); +f(1032192, 63); +f(1048576, 64); +f(1064960, 65); +f(2080768, 127); +f(2097152, 128); +f(2113536, 129); +f(4177920, 255); +f(4194304, 256); +f(4210688, 257); +f(8372224, 511); +f(8388608, 512); +f(8404992, 513); +f(16760832, 1023); +f(16777216, 1024); +f(16793600, 1025); +f(33538048, 2047); +f(33554432, 2048); +f(33570816, 2049); +f(67092480, 4095); +f(67108864, 4096); +f(67125248, 4097); +f(134201344, 8191); +f(134217728, 8192); +f(134234112, 8193); +f(268419072, 16383); +f(268435456, 16384); +x = 16385; +f(16385, 1); +f(32770, 2); +f(49155, 3); +f(65540, 4); +f(81925, 5); +f(114695, 7); +f(131080, 8); +f(147465, 9); +f(245775, 15); +f(262160, 16); +f(278545, 17); +f(507935, 31); +f(524320, 32); +f(540705, 33); +f(1032255, 63); +f(1048640, 64); +f(1065025, 65); +f(2080895, 127); +f(2097280, 128); +f(2113665, 129); +f(4178175, 255); +f(4194560, 256); +f(4210945, 257); +f(8372735, 511); +f(8389120, 512); +f(8405505, 513); +f(16761855, 1023); +f(16778240, 1024); +f(16794625, 1025); +f(33540095, 2047); +f(33556480, 2048); +f(33572865, 2049); +f(67096575, 4095); +f(67112960, 4096); +f(67129345, 4097); +f(134209535, 8191); +f(134225920, 8192); +f(134242305, 8193); +f(268435455, 16383); +f(268451840, 16384); +f(268468225, 16385); +x = 32767; +f(32767, 1); +f(65534, 2); +f(98301, 3); +f(131068, 4); +f(163835, 5); +f(229369, 7); +f(262136, 8); +f(294903, 9); +f(491505, 15); +f(524272, 16); +f(557039, 17); +f(1015777, 31); +f(1048544, 32); +f(1081311, 33); +f(2064321, 63); +f(2097088, 64); +f(2129855, 65); +f(4161409, 127); +f(4194176, 128); +f(4226943, 129); +f(8355585, 255); +f(8388352, 256); +f(8421119, 257); +f(16743937, 511); +f(16776704, 512); +f(16809471, 513); +f(33520641, 1023); +f(33553408, 1024); +f(33586175, 1025); +f(67074049, 2047); +f(67106816, 2048); +f(67139583, 2049); +f(134180865, 4095); +f(134213632, 4096); +f(134246399, 4097); +f(268394497, 8191); +f(268427264, 8192); +f(268460031, 8193); +f(536821761, 16383); +f(536854528, 16384); +f(536887295, 16385); +f(1073676289, 32767); +x = 32768; +f(32768, 1); +f(65536, 2); +f(98304, 3); +f(131072, 4); +f(163840, 5); +f(229376, 7); +f(262144, 8); +f(294912, 9); +f(491520, 15); +f(524288, 16); +f(557056, 17); +f(1015808, 31); +f(1048576, 32); +f(1081344, 33); +f(2064384, 63); +f(2097152, 64); +f(2129920, 65); +f(4161536, 127); +f(4194304, 128); +f(4227072, 129); +f(8355840, 255); +f(8388608, 256); +f(8421376, 257); +f(16744448, 511); +f(16777216, 512); +f(16809984, 513); +f(33521664, 1023); +f(33554432, 1024); +f(33587200, 1025); +f(67076096, 2047); +f(67108864, 2048); +f(67141632, 2049); +f(134184960, 4095); +f(134217728, 4096); +f(134250496, 4097); +f(268402688, 8191); +f(268435456, 8192); +f(268468224, 8193); +f(536838144, 16383); +f(536870912, 16384); +f(536903680, 16385); +f(1073709056, 32767); +f(1073741824, 32768); +x = 32769; +f(32769, 1); +f(65538, 2); +f(98307, 3); +f(131076, 4); +f(163845, 5); +f(229383, 7); +f(262152, 8); +f(294921, 9); +f(491535, 15); +f(524304, 16); +f(557073, 17); +f(1015839, 31); +f(1048608, 32); +f(1081377, 33); +f(2064447, 63); +f(2097216, 64); +f(2129985, 65); +f(4161663, 127); +f(4194432, 128); +f(4227201, 129); +f(8356095, 255); +f(8388864, 256); +f(8421633, 257); +f(16744959, 511); +f(16777728, 512); +f(16810497, 513); +f(33522687, 1023); +f(33555456, 1024); +f(33588225, 1025); +f(67078143, 2047); +f(67110912, 2048); +f(67143681, 2049); +f(134189055, 4095); +f(134221824, 4096); +f(134254593, 4097); +f(268410879, 8191); +f(268443648, 8192); +f(268476417, 8193); +f(536854527, 16383); +f(536887296, 16384); +f(536920065, 16385); +f(1073741823, 32767); +f(1073774592, 32768); +f(1073807361, 32769); +x = 65535; +f(65535, 1); +f(131070, 2); +f(196605, 3); +f(262140, 4); +f(327675, 5); +f(458745, 7); +f(524280, 8); +f(589815, 9); +f(983025, 15); +f(1048560, 16); +f(1114095, 17); +f(2031585, 31); +f(2097120, 32); +f(2162655, 33); +f(4128705, 63); +f(4194240, 64); +f(4259775, 65); +f(8322945, 127); +f(8388480, 128); +f(8454015, 129); +f(16711425, 255); +f(16776960, 256); +f(16842495, 257); +f(33488385, 511); +f(33553920, 512); +f(33619455, 513); +f(67042305, 1023); +f(67107840, 1024); +f(67173375, 1025); +f(134150145, 2047); +f(134215680, 2048); +f(134281215, 2049); +f(268365825, 4095); +f(268431360, 4096); +f(268496895, 4097); +f(536797185, 8191); +f(536862720, 8192); +f(536928255, 8193); +f(1073659905, 16383); +f(1073725440, 16384); +f(1073790975, 16385); +f(2147385345, 32767); +f(2147450880, 32768); +f(2147516415, 32769); +f(4294836225, 65535); +x = 65536; +f(65536, 1); +f(131072, 2); +f(196608, 3); +f(262144, 4); +f(327680, 5); +f(458752, 7); +f(524288, 8); +f(589824, 9); +f(983040, 15); +f(1048576, 16); +f(1114112, 17); +f(2031616, 31); +f(2097152, 32); +f(2162688, 33); +f(4128768, 63); +f(4194304, 64); +f(4259840, 65); +f(8323072, 127); +f(8388608, 128); +f(8454144, 129); +f(16711680, 255); +f(16777216, 256); +f(16842752, 257); +f(33488896, 511); +f(33554432, 512); +f(33619968, 513); +f(67043328, 1023); +f(67108864, 1024); +f(67174400, 1025); +f(134152192, 2047); +f(134217728, 2048); +f(134283264, 2049); +f(268369920, 4095); +f(268435456, 4096); +f(268500992, 4097); +f(536805376, 8191); +f(536870912, 8192); +f(536936448, 8193); +f(1073676288, 16383); +f(1073741824, 16384); +f(1073807360, 16385); +f(2147418112, 32767); +f(2147483648, 32768); +f(2147549184, 32769); +f(4294901760, 65535); +f(4294967296, 65536); +x = 65537; +f(65537, 1); +f(131074, 2); +f(196611, 3); +f(262148, 4); +f(327685, 5); +f(458759, 7); +f(524296, 8); +f(589833, 9); +f(983055, 15); +f(1048592, 16); +f(1114129, 17); +f(2031647, 31); +f(2097184, 32); +f(2162721, 33); +f(4128831, 63); +f(4194368, 64); +f(4259905, 65); +f(8323199, 127); +f(8388736, 128); +f(8454273, 129); +f(16711935, 255); +f(16777472, 256); +f(16843009, 257); +f(33489407, 511); +f(33554944, 512); +f(33620481, 513); +f(67044351, 1023); +f(67109888, 1024); +f(67175425, 1025); +f(134154239, 2047); +f(134219776, 2048); +f(134285313, 2049); +f(268374015, 4095); +f(268439552, 4096); +f(268505089, 4097); +f(536813567, 8191); +f(536879104, 8192); +f(536944641, 8193); +f(1073692671, 16383); +f(1073758208, 16384); +f(1073823745, 16385); +f(2147450879, 32767); +f(2147516416, 32768); +f(2147581953, 32769); +f(4294967295, 65535); +f(4295032832, 65536); +f(4295098369, 65537); +x = 131071; +f(131071, 1); +f(262142, 2); +f(393213, 3); +f(524284, 4); +f(655355, 5); +f(917497, 7); +f(1048568, 8); +f(1179639, 9); +f(1966065, 15); +f(2097136, 16); +f(2228207, 17); +f(4063201, 31); +f(4194272, 32); +f(4325343, 33); +f(8257473, 63); +f(8388544, 64); +f(8519615, 65); +f(16646017, 127); +f(16777088, 128); +f(16908159, 129); +f(33423105, 255); +f(33554176, 256); +f(33685247, 257); +f(66977281, 511); +f(67108352, 512); +f(67239423, 513); +f(134085633, 1023); +f(134216704, 1024); +f(134347775, 1025); +f(268302337, 2047); +f(268433408, 2048); +f(268564479, 2049); +f(536735745, 4095); +f(536866816, 4096); +f(536997887, 4097); +f(1073602561, 8191); +f(1073733632, 8192); +f(1073864703, 8193); +f(2147336193, 16383); +f(2147467264, 16384); +f(2147598335, 16385); +f(4294803457, 32767); +f(4294934528, 32768); +f(4295065599, 32769); +f(8589737985, 65535); +f(8589869056, 65536); +f(8590000127, 65537); +f(17179607041, 131071); +x = 131072; +f(131072, 1); +f(262144, 2); +f(393216, 3); +f(524288, 4); +f(655360, 5); +f(917504, 7); +f(1048576, 8); +f(1179648, 9); +f(1966080, 15); +f(2097152, 16); +f(2228224, 17); +f(4063232, 31); +f(4194304, 32); +f(4325376, 33); +f(8257536, 63); +f(8388608, 64); +f(8519680, 65); +f(16646144, 127); +f(16777216, 128); +f(16908288, 129); +f(33423360, 255); +f(33554432, 256); +f(33685504, 257); +f(66977792, 511); +f(67108864, 512); +f(67239936, 513); +f(134086656, 1023); +f(134217728, 1024); +f(134348800, 1025); +f(268304384, 2047); +f(268435456, 2048); +f(268566528, 2049); +f(536739840, 4095); +f(536870912, 4096); +f(537001984, 4097); +f(1073610752, 8191); +f(1073741824, 8192); +f(1073872896, 8193); +f(2147352576, 16383); +f(2147483648, 16384); +f(2147614720, 16385); +f(4294836224, 32767); +f(4294967296, 32768); +f(4295098368, 32769); +f(8589803520, 65535); +f(8589934592, 65536); +f(8590065664, 65537); +f(17179738112, 131071); +f(17179869184, 131072); +x = 131073; +f(131073, 1); +f(262146, 2); +f(393219, 3); +f(524292, 4); +f(655365, 5); +f(917511, 7); +f(1048584, 8); +f(1179657, 9); +f(1966095, 15); +f(2097168, 16); +f(2228241, 17); +f(4063263, 31); +f(4194336, 32); +f(4325409, 33); +f(8257599, 63); +f(8388672, 64); +f(8519745, 65); +f(16646271, 127); +f(16777344, 128); +f(16908417, 129); +f(33423615, 255); +f(33554688, 256); +f(33685761, 257); +f(66978303, 511); +f(67109376, 512); +f(67240449, 513); +f(134087679, 1023); +f(134218752, 1024); +f(134349825, 1025); +f(268306431, 2047); +f(268437504, 2048); +f(268568577, 2049); +f(536743935, 4095); +f(536875008, 4096); +f(537006081, 4097); +f(1073618943, 8191); +f(1073750016, 8192); +f(1073881089, 8193); +f(2147368959, 16383); +f(2147500032, 16384); +f(2147631105, 16385); +f(4294868991, 32767); +f(4295000064, 32768); +f(4295131137, 32769); +f(8589869055, 65535); +f(8590000128, 65536); +f(8590131201, 65537); +f(17179869183, 131071); +f(17180000256, 131072); +f(17180131329, 131073); +x = 262143; +f(262143, 1); +f(524286, 2); +f(786429, 3); +f(1048572, 4); +f(1310715, 5); +f(1835001, 7); +f(2097144, 8); +f(2359287, 9); +f(3932145, 15); +f(4194288, 16); +f(4456431, 17); +f(8126433, 31); +f(8388576, 32); +f(8650719, 33); +f(16515009, 63); +f(16777152, 64); +f(17039295, 65); +f(33292161, 127); +f(33554304, 128); +f(33816447, 129); +f(66846465, 255); +f(67108608, 256); +f(67370751, 257); +f(133955073, 511); +f(134217216, 512); +f(134479359, 513); +f(268172289, 1023); +f(268434432, 1024); +f(268696575, 1025); +f(536606721, 2047); +f(536868864, 2048); +f(537131007, 2049); +f(1073475585, 4095); +f(1073737728, 4096); +f(1073999871, 4097); +f(2147213313, 8191); +f(2147475456, 8192); +f(2147737599, 8193); +f(4294688769, 16383); +f(4294950912, 16384); +f(4295213055, 16385); +f(8589639681, 32767); +f(8589901824, 32768); +f(8590163967, 32769); +f(17179541505, 65535); +f(17179803648, 65536); +f(17180065791, 65537); +f(34359345153, 131071); +f(34359607296, 131072); +f(34359869439, 131073); +f(68718952449, 262143); +x = 262144; +f(262144, 1); +f(524288, 2); +f(786432, 3); +f(1048576, 4); +f(1310720, 5); +f(1835008, 7); +f(2097152, 8); +f(2359296, 9); +f(3932160, 15); +f(4194304, 16); +f(4456448, 17); +f(8126464, 31); +f(8388608, 32); +f(8650752, 33); +f(16515072, 63); +f(16777216, 64); +f(17039360, 65); +f(33292288, 127); +f(33554432, 128); +f(33816576, 129); +f(66846720, 255); +f(67108864, 256); +f(67371008, 257); +f(133955584, 511); +f(134217728, 512); +f(134479872, 513); +f(268173312, 1023); +f(268435456, 1024); +f(268697600, 1025); +f(536608768, 2047); +f(536870912, 2048); +f(537133056, 2049); +f(1073479680, 4095); +f(1073741824, 4096); +f(1074003968, 4097); +f(2147221504, 8191); +f(2147483648, 8192); +f(2147745792, 8193); +f(4294705152, 16383); +f(4294967296, 16384); +f(4295229440, 16385); +f(8589672448, 32767); +f(8589934592, 32768); +f(8590196736, 32769); +f(17179607040, 65535); +f(17179869184, 65536); +f(17180131328, 65537); +f(34359476224, 131071); +f(34359738368, 131072); +f(34360000512, 131073); +f(68719214592, 262143); +f(68719476736, 262144); +x = 262145; +f(262145, 1); +f(524290, 2); +f(786435, 3); +f(1048580, 4); +f(1310725, 5); +f(1835015, 7); +f(2097160, 8); +f(2359305, 9); +f(3932175, 15); +f(4194320, 16); +f(4456465, 17); +f(8126495, 31); +f(8388640, 32); +f(8650785, 33); +f(16515135, 63); +f(16777280, 64); +f(17039425, 65); +f(33292415, 127); +f(33554560, 128); +f(33816705, 129); +f(66846975, 255); +f(67109120, 256); +f(67371265, 257); +f(133956095, 511); +f(134218240, 512); +f(134480385, 513); +f(268174335, 1023); +f(268436480, 1024); +f(268698625, 1025); +f(536610815, 2047); +f(536872960, 2048); +f(537135105, 2049); +f(1073483775, 4095); +f(1073745920, 4096); +f(1074008065, 4097); +f(2147229695, 8191); +f(2147491840, 8192); +f(2147753985, 8193); +f(4294721535, 16383); +f(4294983680, 16384); +f(4295245825, 16385); +f(8589705215, 32767); +f(8589967360, 32768); +f(8590229505, 32769); +f(17179672575, 65535); +f(17179934720, 65536); +f(17180196865, 65537); +f(34359607295, 131071); +f(34359869440, 131072); +f(34360131585, 131073); +f(68719476735, 262143); +f(68719738880, 262144); +f(68720001025, 262145); +x = 524287; +f(524287, 1); +f(1048574, 2); +f(1572861, 3); +f(2097148, 4); +f(2621435, 5); +f(3670009, 7); +f(4194296, 8); +f(4718583, 9); +f(7864305, 15); +f(8388592, 16); +f(8912879, 17); +f(16252897, 31); +f(16777184, 32); +f(17301471, 33); +f(33030081, 63); +f(33554368, 64); +f(34078655, 65); +f(66584449, 127); +f(67108736, 128); +f(67633023, 129); +f(133693185, 255); +f(134217472, 256); +f(134741759, 257); +f(267910657, 511); +f(268434944, 512); +f(268959231, 513); +f(536345601, 1023); +f(536869888, 1024); +f(537394175, 1025); +f(1073215489, 2047); +f(1073739776, 2048); +f(1074264063, 2049); +f(2146955265, 4095); +f(2147479552, 4096); +f(2148003839, 4097); +f(4294434817, 8191); +f(4294959104, 8192); +f(4295483391, 8193); +f(8589393921, 16383); +f(8589918208, 16384); +f(8590442495, 16385); +f(17179312129, 32767); +f(17179836416, 32768); +f(17180360703, 32769); +f(34359148545, 65535); +f(34359672832, 65536); +f(34360197119, 65537); +f(68718821377, 131071); +f(68719345664, 131072); +f(68719869951, 131073); +f(137438167041, 262143); +f(137438691328, 262144); +f(137439215615, 262145); +f(274876858369, 524287); +x = 524288; +f(524288, 1); +f(1048576, 2); +f(1572864, 3); +f(2097152, 4); +f(2621440, 5); +f(3670016, 7); +f(4194304, 8); +f(4718592, 9); +f(7864320, 15); +f(8388608, 16); +f(8912896, 17); +f(16252928, 31); +f(16777216, 32); +f(17301504, 33); +f(33030144, 63); +f(33554432, 64); +f(34078720, 65); +f(66584576, 127); +f(67108864, 128); +f(67633152, 129); +f(133693440, 255); +f(134217728, 256); +f(134742016, 257); +f(267911168, 511); +f(268435456, 512); +f(268959744, 513); +f(536346624, 1023); +f(536870912, 1024); +f(537395200, 1025); +f(1073217536, 2047); +f(1073741824, 2048); +f(1074266112, 2049); +f(2146959360, 4095); +f(2147483648, 4096); +f(2148007936, 4097); +f(4294443008, 8191); +f(4294967296, 8192); +f(4295491584, 8193); +f(8589410304, 16383); +f(8589934592, 16384); +f(8590458880, 16385); +f(17179344896, 32767); +f(17179869184, 32768); +f(17180393472, 32769); +f(34359214080, 65535); +f(34359738368, 65536); +f(34360262656, 65537); +f(68718952448, 131071); +f(68719476736, 131072); +f(68720001024, 131073); +f(137438429184, 262143); +f(137438953472, 262144); +f(137439477760, 262145); +f(274877382656, 524287); +f(274877906944, 524288); +x = 524289; +f(524289, 1); +f(1048578, 2); +f(1572867, 3); +f(2097156, 4); +f(2621445, 5); +f(3670023, 7); +f(4194312, 8); +f(4718601, 9); +f(7864335, 15); +f(8388624, 16); +f(8912913, 17); +f(16252959, 31); +f(16777248, 32); +f(17301537, 33); +f(33030207, 63); +f(33554496, 64); +f(34078785, 65); +f(66584703, 127); +f(67108992, 128); +f(67633281, 129); +f(133693695, 255); +f(134217984, 256); +f(134742273, 257); +f(267911679, 511); +f(268435968, 512); +f(268960257, 513); +f(536347647, 1023); +f(536871936, 1024); +f(537396225, 1025); +f(1073219583, 2047); +f(1073743872, 2048); +f(1074268161, 2049); +f(2146963455, 4095); +f(2147487744, 4096); +f(2148012033, 4097); +f(4294451199, 8191); +f(4294975488, 8192); +f(4295499777, 8193); +f(8589426687, 16383); +f(8589950976, 16384); +f(8590475265, 16385); +f(17179377663, 32767); +f(17179901952, 32768); +f(17180426241, 32769); +f(34359279615, 65535); +f(34359803904, 65536); +f(34360328193, 65537); +f(68719083519, 131071); +f(68719607808, 131072); +f(68720132097, 131073); +f(137438691327, 262143); +f(137439215616, 262144); +f(137439739905, 262145); +f(274877906943, 524287); +f(274878431232, 524288); +f(274878955521, 524289); +x = 1048575; +f(1048575, 1); +f(2097150, 2); +f(3145725, 3); +f(4194300, 4); +f(5242875, 5); +f(7340025, 7); +f(8388600, 8); +f(9437175, 9); +f(15728625, 15); +f(16777200, 16); +f(17825775, 17); +f(32505825, 31); +f(33554400, 32); +f(34602975, 33); +f(66060225, 63); +f(67108800, 64); +f(68157375, 65); +f(133169025, 127); +f(134217600, 128); +f(135266175, 129); +f(267386625, 255); +f(268435200, 256); +f(269483775, 257); +f(535821825, 511); +f(536870400, 512); +f(537918975, 513); +f(1072692225, 1023); +f(1073740800, 1024); +f(1074789375, 1025); +f(2146433025, 2047); +f(2147481600, 2048); +f(2148530175, 2049); +f(4293914625, 4095); +f(4294963200, 4096); +f(4296011775, 4097); +f(8588877825, 8191); +f(8589926400, 8192); +f(8590974975, 8193); +f(17178804225, 16383); +f(17179852800, 16384); +f(17180901375, 16385); +f(34358657025, 32767); +f(34359705600, 32768); +f(34360754175, 32769); +f(68718362625, 65535); +f(68719411200, 65536); +f(68720459775, 65537); +f(137437773825, 131071); +f(137438822400, 131072); +f(137439870975, 131073); +f(274876596225, 262143); +f(274877644800, 262144); +f(274878693375, 262145); +f(549754241025, 524287); +f(549755289600, 524288); +f(549756338175, 524289); +f(1099509530625, 1048575); +x = 1048576; +f(1048576, 1); +f(2097152, 2); +f(3145728, 3); +f(4194304, 4); +f(5242880, 5); +f(7340032, 7); +f(8388608, 8); +f(9437184, 9); +f(15728640, 15); +f(16777216, 16); +f(17825792, 17); +f(32505856, 31); +f(33554432, 32); +f(34603008, 33); +f(66060288, 63); +f(67108864, 64); +f(68157440, 65); +f(133169152, 127); +f(134217728, 128); +f(135266304, 129); +f(267386880, 255); +f(268435456, 256); +f(269484032, 257); +f(535822336, 511); +f(536870912, 512); +f(537919488, 513); +f(1072693248, 1023); +f(1073741824, 1024); +f(1074790400, 1025); +f(2146435072, 2047); +f(2147483648, 2048); +f(2148532224, 2049); +f(4293918720, 4095); +f(4294967296, 4096); +f(4296015872, 4097); +f(8588886016, 8191); +f(8589934592, 8192); +f(8590983168, 8193); +f(17178820608, 16383); +f(17179869184, 16384); +f(17180917760, 16385); +f(34358689792, 32767); +f(34359738368, 32768); +f(34360786944, 32769); +f(68718428160, 65535); +f(68719476736, 65536); +f(68720525312, 65537); +f(137437904896, 131071); +f(137438953472, 131072); +f(137440002048, 131073); +f(274876858368, 262143); +f(274877906944, 262144); +f(274878955520, 262145); +f(549754765312, 524287); +f(549755813888, 524288); +f(549756862464, 524289); +f(1099510579200, 1048575); +f(1099511627776, 1048576); +x = 1048577; +f(1048577, 1); +f(2097154, 2); +f(3145731, 3); +f(4194308, 4); +f(5242885, 5); +f(7340039, 7); +f(8388616, 8); +f(9437193, 9); +f(15728655, 15); +f(16777232, 16); +f(17825809, 17); +f(32505887, 31); +f(33554464, 32); +f(34603041, 33); +f(66060351, 63); +f(67108928, 64); +f(68157505, 65); +f(133169279, 127); +f(134217856, 128); +f(135266433, 129); +f(267387135, 255); +f(268435712, 256); +f(269484289, 257); +f(535822847, 511); +f(536871424, 512); +f(537920001, 513); +f(1072694271, 1023); +f(1073742848, 1024); +f(1074791425, 1025); +f(2146437119, 2047); +f(2147485696, 2048); +f(2148534273, 2049); +f(4293922815, 4095); +f(4294971392, 4096); +f(4296019969, 4097); +f(8588894207, 8191); +f(8589942784, 8192); +f(8590991361, 8193); +f(17178836991, 16383); +f(17179885568, 16384); +f(17180934145, 16385); +f(34358722559, 32767); +f(34359771136, 32768); +f(34360819713, 32769); +f(68718493695, 65535); +f(68719542272, 65536); +f(68720590849, 65537); +f(137438035967, 131071); +f(137439084544, 131072); +f(137440133121, 131073); +f(274877120511, 262143); +f(274878169088, 262144); +f(274879217665, 262145); +f(549755289599, 524287); +f(549756338176, 524288); +f(549757386753, 524289); +f(1099511627775, 1048575); +f(1099512676352, 1048576); +f(1099513724929, 1048577); +x = 2097151; +f(2097151, 1); +f(4194302, 2); +f(6291453, 3); +f(8388604, 4); +f(10485755, 5); +f(14680057, 7); +f(16777208, 8); +f(18874359, 9); +f(31457265, 15); +f(33554416, 16); +f(35651567, 17); +f(65011681, 31); +f(67108832, 32); +f(69205983, 33); +f(132120513, 63); +f(134217664, 64); +f(136314815, 65); +f(266338177, 127); +f(268435328, 128); +f(270532479, 129); +f(534773505, 255); +f(536870656, 256); +f(538967807, 257); +f(1071644161, 511); +f(1073741312, 512); +f(1075838463, 513); +f(2145385473, 1023); +f(2147482624, 1024); +f(2149579775, 1025); +f(4292868097, 2047); +f(4294965248, 2048); +f(4297062399, 2049); +f(8587833345, 4095); +f(8589930496, 4096); +f(8592027647, 4097); +f(17177763841, 8191); +f(17179860992, 8192); +f(17181958143, 8193); +f(34357624833, 16383); +f(34359721984, 16384); +f(34361819135, 16385); +f(68717346817, 32767); +f(68719443968, 32768); +f(68721541119, 32769); +f(137436790785, 65535); +f(137438887936, 65536); +f(137440985087, 65537); +f(274875678721, 131071); +f(274877775872, 131072); +f(274879873023, 131073); +f(549753454593, 262143); +f(549755551744, 262144); +f(549757648895, 262145); +f(1099509006337, 524287); +f(1099511103488, 524288); +f(1099513200639, 524289); +f(2199020109825, 1048575); +f(2199022206976, 1048576); +f(2199024304127, 1048577); +f(4398042316801, 2097151); +x = 2097152; +f(2097152, 1); +f(4194304, 2); +f(6291456, 3); +f(8388608, 4); +f(10485760, 5); +f(14680064, 7); +f(16777216, 8); +f(18874368, 9); +f(31457280, 15); +f(33554432, 16); +f(35651584, 17); +f(65011712, 31); +f(67108864, 32); +f(69206016, 33); +f(132120576, 63); +f(134217728, 64); +f(136314880, 65); +f(266338304, 127); +f(268435456, 128); +f(270532608, 129); +f(534773760, 255); +f(536870912, 256); +f(538968064, 257); +f(1071644672, 511); +f(1073741824, 512); +f(1075838976, 513); +f(2145386496, 1023); +f(2147483648, 1024); +f(2149580800, 1025); +f(4292870144, 2047); +f(4294967296, 2048); +f(4297064448, 2049); +f(8587837440, 4095); +f(8589934592, 4096); +f(8592031744, 4097); +f(17177772032, 8191); +f(17179869184, 8192); +f(17181966336, 8193); +f(34357641216, 16383); +f(34359738368, 16384); +f(34361835520, 16385); +f(68717379584, 32767); +f(68719476736, 32768); +f(68721573888, 32769); +f(137436856320, 65535); +f(137438953472, 65536); +f(137441050624, 65537); +f(274875809792, 131071); +f(274877906944, 131072); +f(274880004096, 131073); +f(549753716736, 262143); +f(549755813888, 262144); +f(549757911040, 262145); +f(1099509530624, 524287); +f(1099511627776, 524288); +f(1099513724928, 524289); +f(2199021158400, 1048575); +f(2199023255552, 1048576); +f(2199025352704, 1048577); +f(4398044413952, 2097151); +f(4398046511104, 2097152); +x = 2097153; +f(2097153, 1); +f(4194306, 2); +f(6291459, 3); +f(8388612, 4); +f(10485765, 5); +f(14680071, 7); +f(16777224, 8); +f(18874377, 9); +f(31457295, 15); +f(33554448, 16); +f(35651601, 17); +f(65011743, 31); +f(67108896, 32); +f(69206049, 33); +f(132120639, 63); +f(134217792, 64); +f(136314945, 65); +f(266338431, 127); +f(268435584, 128); +f(270532737, 129); +f(534774015, 255); +f(536871168, 256); +f(538968321, 257); +f(1071645183, 511); +f(1073742336, 512); +f(1075839489, 513); +f(2145387519, 1023); +f(2147484672, 1024); +f(2149581825, 1025); +f(4292872191, 2047); +f(4294969344, 2048); +f(4297066497, 2049); +f(8587841535, 4095); +f(8589938688, 4096); +f(8592035841, 4097); +f(17177780223, 8191); +f(17179877376, 8192); +f(17181974529, 8193); +f(34357657599, 16383); +f(34359754752, 16384); +f(34361851905, 16385); +f(68717412351, 32767); +f(68719509504, 32768); +f(68721606657, 32769); +f(137436921855, 65535); +f(137439019008, 65536); +f(137441116161, 65537); +f(274875940863, 131071); +f(274878038016, 131072); +f(274880135169, 131073); +f(549753978879, 262143); +f(549756076032, 262144); +f(549758173185, 262145); +f(1099510054911, 524287); +f(1099512152064, 524288); +f(1099514249217, 524289); +f(2199022206975, 1048575); +f(2199024304128, 1048576); +f(2199026401281, 1048577); +f(4398046511103, 2097151); +f(4398048608256, 2097152); +f(4398050705409, 2097153); +x = 4194303; +f(4194303, 1); +f(8388606, 2); +f(12582909, 3); +f(16777212, 4); +f(20971515, 5); +f(29360121, 7); +f(33554424, 8); +f(37748727, 9); +f(62914545, 15); +f(67108848, 16); +f(71303151, 17); +f(130023393, 31); +f(134217696, 32); +f(138411999, 33); +f(264241089, 63); +f(268435392, 64); +f(272629695, 65); +f(532676481, 127); +f(536870784, 128); +f(541065087, 129); +f(1069547265, 255); +f(1073741568, 256); +f(1077935871, 257); +f(2143288833, 511); +f(2147483136, 512); +f(2151677439, 513); +f(4290771969, 1023); +f(4294966272, 1024); +f(4299160575, 1025); +f(8585738241, 2047); +f(8589932544, 2048); +f(8594126847, 2049); +f(17175670785, 4095); +f(17179865088, 4096); +f(17184059391, 4097); +f(34355535873, 8191); +f(34359730176, 8192); +f(34363924479, 8193); +f(68715266049, 16383); +f(68719460352, 16384); +f(68723654655, 16385); +f(137434726401, 32767); +f(137438920704, 32768); +f(137443115007, 32769); +f(274873647105, 65535); +f(274877841408, 65536); +f(274882035711, 65537); +f(549751488513, 131071); +f(549755682816, 131072); +f(549759877119, 131073); +f(1099507171329, 262143); +f(1099511365632, 262144); +f(1099515559935, 262145); +f(2199018536961, 524287); +f(2199022731264, 524288); +f(2199026925567, 524289); +f(4398041268225, 1048575); +f(4398045462528, 1048576); +f(4398049656831, 1048577); +f(8796086730753, 2097151); +f(8796090925056, 2097152); +f(8796095119359, 2097153); +f(17592177655809, 4194303); +x = 4194304; +f(4194304, 1); +f(8388608, 2); +f(12582912, 3); +f(16777216, 4); +f(20971520, 5); +f(29360128, 7); +f(33554432, 8); +f(37748736, 9); +f(62914560, 15); +f(67108864, 16); +f(71303168, 17); +f(130023424, 31); +f(134217728, 32); +f(138412032, 33); +f(264241152, 63); +f(268435456, 64); +f(272629760, 65); +f(532676608, 127); +f(536870912, 128); +f(541065216, 129); +f(1069547520, 255); +f(1073741824, 256); +f(1077936128, 257); +f(2143289344, 511); +f(2147483648, 512); +f(2151677952, 513); +f(4290772992, 1023); +f(4294967296, 1024); +f(4299161600, 1025); +f(8585740288, 2047); +f(8589934592, 2048); +f(8594128896, 2049); +f(17175674880, 4095); +f(17179869184, 4096); +f(17184063488, 4097); +f(34355544064, 8191); +f(34359738368, 8192); +f(34363932672, 8193); +f(68715282432, 16383); +f(68719476736, 16384); +f(68723671040, 16385); +f(137434759168, 32767); +f(137438953472, 32768); +f(137443147776, 32769); +f(274873712640, 65535); +f(274877906944, 65536); +f(274882101248, 65537); +f(549751619584, 131071); +f(549755813888, 131072); +f(549760008192, 131073); +f(1099507433472, 262143); +f(1099511627776, 262144); +f(1099515822080, 262145); +f(2199019061248, 524287); +f(2199023255552, 524288); +f(2199027449856, 524289); +f(4398042316800, 1048575); +f(4398046511104, 1048576); +f(4398050705408, 1048577); +f(8796088827904, 2097151); +f(8796093022208, 2097152); +f(8796097216512, 2097153); +f(17592181850112, 4194303); +f(17592186044416, 4194304); +x = 4194305; +f(4194305, 1); +f(8388610, 2); +f(12582915, 3); +f(16777220, 4); +f(20971525, 5); +f(29360135, 7); +f(33554440, 8); +f(37748745, 9); +f(62914575, 15); +f(67108880, 16); +f(71303185, 17); +f(130023455, 31); +f(134217760, 32); +f(138412065, 33); +f(264241215, 63); +f(268435520, 64); +f(272629825, 65); +f(532676735, 127); +f(536871040, 128); +f(541065345, 129); +f(1069547775, 255); +f(1073742080, 256); +f(1077936385, 257); +f(2143289855, 511); +f(2147484160, 512); +f(2151678465, 513); +f(4290774015, 1023); +f(4294968320, 1024); +f(4299162625, 1025); +f(8585742335, 2047); +f(8589936640, 2048); +f(8594130945, 2049); +f(17175678975, 4095); +f(17179873280, 4096); +f(17184067585, 4097); +f(34355552255, 8191); +f(34359746560, 8192); +f(34363940865, 8193); +f(68715298815, 16383); +f(68719493120, 16384); +f(68723687425, 16385); +f(137434791935, 32767); +f(137438986240, 32768); +f(137443180545, 32769); +f(274873778175, 65535); +f(274877972480, 65536); +f(274882166785, 65537); +f(549751750655, 131071); +f(549755944960, 131072); +f(549760139265, 131073); +f(1099507695615, 262143); +f(1099511889920, 262144); +f(1099516084225, 262145); +f(2199019585535, 524287); +f(2199023779840, 524288); +f(2199027974145, 524289); +f(4398043365375, 1048575); +f(4398047559680, 1048576); +f(4398051753985, 1048577); +f(8796090925055, 2097151); +f(8796095119360, 2097152); +f(8796099313665, 2097153); +f(17592186044415, 4194303); +f(17592190238720, 4194304); +f(17592194433025, 4194305); +x = 8388607; +f(8388607, 1); +f(16777214, 2); +f(25165821, 3); +f(33554428, 4); +f(41943035, 5); +f(58720249, 7); +f(67108856, 8); +f(75497463, 9); +f(125829105, 15); +f(134217712, 16); +f(142606319, 17); +f(260046817, 31); +f(268435424, 32); +f(276824031, 33); +f(528482241, 63); +f(536870848, 64); +f(545259455, 65); +f(1065353089, 127); +f(1073741696, 128); +f(1082130303, 129); +f(2139094785, 255); +f(2147483392, 256); +f(2155871999, 257); +f(4286578177, 511); +f(4294966784, 512); +f(4303355391, 513); +f(8581544961, 1023); +f(8589933568, 1024); +f(8598322175, 1025); +f(17171478529, 2047); +f(17179867136, 2048); +f(17188255743, 2049); +f(34351345665, 4095); +f(34359734272, 4096); +f(34368122879, 4097); +f(68711079937, 8191); +f(68719468544, 8192); +f(68727857151, 8193); +f(137430548481, 16383); +f(137438937088, 16384); +f(137447325695, 16385); +f(274869485569, 32767); +f(274877874176, 32768); +f(274886262783, 32769); +f(549747359745, 65535); +f(549755748352, 65536); +f(549764136959, 65537); +f(1099503108097, 131071); +f(1099511496704, 131072); +f(1099519885311, 131073); +f(2199014604801, 262143); +f(2199022993408, 262144); +f(2199031382015, 262145); +f(4398037598209, 524287); +f(4398045986816, 524288); +f(4398054375423, 524289); +f(8796083585025, 1048575); +f(8796091973632, 1048576); +f(8796100362239, 1048577); +f(17592175558657, 2097151); +f(17592183947264, 2097152); +f(17592192335871, 2097153); +f(35184359505921, 4194303); +f(35184367894528, 4194304); +f(35184376283135, 4194305); +f(70368727400449, 8388607); +x = 8388608; +f(8388608, 1); +f(16777216, 2); +f(25165824, 3); +f(33554432, 4); +f(41943040, 5); +f(58720256, 7); +f(67108864, 8); +f(75497472, 9); +f(125829120, 15); +f(134217728, 16); +f(142606336, 17); +f(260046848, 31); +f(268435456, 32); +f(276824064, 33); +f(528482304, 63); +f(536870912, 64); +f(545259520, 65); +f(1065353216, 127); +f(1073741824, 128); +f(1082130432, 129); +f(2139095040, 255); +f(2147483648, 256); +f(2155872256, 257); +f(4286578688, 511); +f(4294967296, 512); +f(4303355904, 513); +f(8581545984, 1023); +f(8589934592, 1024); +f(8598323200, 1025); +f(17171480576, 2047); +f(17179869184, 2048); +f(17188257792, 2049); +f(34351349760, 4095); +f(34359738368, 4096); +f(34368126976, 4097); +f(68711088128, 8191); +f(68719476736, 8192); +f(68727865344, 8193); +f(137430564864, 16383); +f(137438953472, 16384); +f(137447342080, 16385); +f(274869518336, 32767); +f(274877906944, 32768); +f(274886295552, 32769); +f(549747425280, 65535); +f(549755813888, 65536); +f(549764202496, 65537); +f(1099503239168, 131071); +f(1099511627776, 131072); +f(1099520016384, 131073); +f(2199014866944, 262143); +f(2199023255552, 262144); +f(2199031644160, 262145); +f(4398038122496, 524287); +f(4398046511104, 524288); +f(4398054899712, 524289); +f(8796084633600, 1048575); +f(8796093022208, 1048576); +f(8796101410816, 1048577); +f(17592177655808, 2097151); +f(17592186044416, 2097152); +f(17592194433024, 2097153); +f(35184363700224, 4194303); +f(35184372088832, 4194304); +f(35184380477440, 4194305); +f(70368735789056, 8388607); +f(70368744177664, 8388608); +x = 8388609; +f(8388609, 1); +f(16777218, 2); +f(25165827, 3); +f(33554436, 4); +f(41943045, 5); +f(58720263, 7); +f(67108872, 8); +f(75497481, 9); +f(125829135, 15); +f(134217744, 16); +f(142606353, 17); +f(260046879, 31); +f(268435488, 32); +f(276824097, 33); +f(528482367, 63); +f(536870976, 64); +f(545259585, 65); +f(1065353343, 127); +f(1073741952, 128); +f(1082130561, 129); +f(2139095295, 255); +f(2147483904, 256); +f(2155872513, 257); +f(4286579199, 511); +f(4294967808, 512); +f(4303356417, 513); +f(8581547007, 1023); +f(8589935616, 1024); +f(8598324225, 1025); +f(17171482623, 2047); +f(17179871232, 2048); +f(17188259841, 2049); +f(34351353855, 4095); +f(34359742464, 4096); +f(34368131073, 4097); +f(68711096319, 8191); +f(68719484928, 8192); +f(68727873537, 8193); +f(137430581247, 16383); +f(137438969856, 16384); +f(137447358465, 16385); +f(274869551103, 32767); +f(274877939712, 32768); +f(274886328321, 32769); +f(549747490815, 65535); +f(549755879424, 65536); +f(549764268033, 65537); +f(1099503370239, 131071); +f(1099511758848, 131072); +f(1099520147457, 131073); +f(2199015129087, 262143); +f(2199023517696, 262144); +f(2199031906305, 262145); +f(4398038646783, 524287); +f(4398047035392, 524288); +f(4398055424001, 524289); +f(8796085682175, 1048575); +f(8796094070784, 1048576); +f(8796102459393, 1048577); +f(17592179752959, 2097151); +f(17592188141568, 2097152); +f(17592196530177, 2097153); +f(35184367894527, 4194303); +f(35184376283136, 4194304); +f(35184384671745, 4194305); +f(70368744177663, 8388607); +f(70368752566272, 8388608); +f(70368760954881, 8388609); +x = 16777215; +f(16777215, 1); +f(33554430, 2); +f(50331645, 3); +f(67108860, 4); +f(83886075, 5); +f(117440505, 7); +f(134217720, 8); +f(150994935, 9); +f(251658225, 15); +f(268435440, 16); +f(285212655, 17); +f(520093665, 31); +f(536870880, 32); +f(553648095, 33); +f(1056964545, 63); +f(1073741760, 64); +f(1090518975, 65); +f(2130706305, 127); +f(2147483520, 128); +f(2164260735, 129); +f(4278189825, 255); +f(4294967040, 256); +f(4311744255, 257); +f(8573156865, 511); +f(8589934080, 512); +f(8606711295, 513); +f(17163090945, 1023); +f(17179868160, 1024); +f(17196645375, 1025); +f(34342959105, 2047); +f(34359736320, 2048); +f(34376513535, 2049); +f(68702695425, 4095); +f(68719472640, 4096); +f(68736249855, 4097); +f(137422168065, 8191); +f(137438945280, 8192); +f(137455722495, 8193); +f(274861113345, 16383); +f(274877890560, 16384); +f(274894667775, 16385); +f(549739003905, 32767); +f(549755781120, 32768); +f(549772558335, 32769); +f(1099494785025, 65535); +f(1099511562240, 65536); +f(1099528339455, 65537); +f(2199006347265, 131071); +f(2199023124480, 131072); +f(2199039901695, 131073); +f(4398029471745, 262143); +f(4398046248960, 262144); +f(4398063026175, 262145); +f(8796075720705, 524287); +f(8796092497920, 524288); +f(8796109275135, 524289); +f(17592168218625, 1048575); +f(17592184995840, 1048576); +f(17592201773055, 1048577); +f(35184353214465, 2097151); +f(35184369991680, 2097152); +f(35184386768895, 2097153); +f(70368723206145, 4194303); +f(70368739983360, 4194304); +f(70368756760575, 4194305); +f(140737463189505, 8388607); +f(140737479966720, 8388608); +f(140737496743935, 8388609); +f(281474943156225, 16777215); +x = 16777216; +f(16777216, 1); +f(33554432, 2); +f(50331648, 3); +f(67108864, 4); +f(83886080, 5); +f(117440512, 7); +f(134217728, 8); +f(150994944, 9); +f(251658240, 15); +f(268435456, 16); +f(285212672, 17); +f(520093696, 31); +f(536870912, 32); +f(553648128, 33); +f(1056964608, 63); +f(1073741824, 64); +f(1090519040, 65); +f(2130706432, 127); +f(2147483648, 128); +f(2164260864, 129); +f(4278190080, 255); +f(4294967296, 256); +f(4311744512, 257); +f(8573157376, 511); +f(8589934592, 512); +f(8606711808, 513); +f(17163091968, 1023); +f(17179869184, 1024); +f(17196646400, 1025); +f(34342961152, 2047); +f(34359738368, 2048); +f(34376515584, 2049); +f(68702699520, 4095); +f(68719476736, 4096); +f(68736253952, 4097); +f(137422176256, 8191); +f(137438953472, 8192); +f(137455730688, 8193); +f(274861129728, 16383); +f(274877906944, 16384); +f(274894684160, 16385); +f(549739036672, 32767); +f(549755813888, 32768); +f(549772591104, 32769); +f(1099494850560, 65535); +f(1099511627776, 65536); +f(1099528404992, 65537); +f(2199006478336, 131071); +f(2199023255552, 131072); +f(2199040032768, 131073); +f(4398029733888, 262143); +f(4398046511104, 262144); +f(4398063288320, 262145); +f(8796076244992, 524287); +f(8796093022208, 524288); +f(8796109799424, 524289); +f(17592169267200, 1048575); +f(17592186044416, 1048576); +f(17592202821632, 1048577); +f(35184355311616, 2097151); +f(35184372088832, 2097152); +f(35184388866048, 2097153); +f(70368727400448, 4194303); +f(70368744177664, 4194304); +f(70368760954880, 4194305); +f(140737471578112, 8388607); +f(140737488355328, 8388608); +f(140737505132544, 8388609); +f(281474959933440, 16777215); +f(281474976710656, 16777216); +x = 16777217; +f(16777217, 1); +f(33554434, 2); +f(50331651, 3); +f(67108868, 4); +f(83886085, 5); +f(117440519, 7); +f(134217736, 8); +f(150994953, 9); +f(251658255, 15); +f(268435472, 16); +f(285212689, 17); +f(520093727, 31); +f(536870944, 32); +f(553648161, 33); +f(1056964671, 63); +f(1073741888, 64); +f(1090519105, 65); +f(2130706559, 127); +f(2147483776, 128); +f(2164260993, 129); +f(4278190335, 255); +f(4294967552, 256); +f(4311744769, 257); +f(8573157887, 511); +f(8589935104, 512); +f(8606712321, 513); +f(17163092991, 1023); +f(17179870208, 1024); +f(17196647425, 1025); +f(34342963199, 2047); +f(34359740416, 2048); +f(34376517633, 2049); +f(68702703615, 4095); +f(68719480832, 4096); +f(68736258049, 4097); +f(137422184447, 8191); +f(137438961664, 8192); +f(137455738881, 8193); +f(274861146111, 16383); +f(274877923328, 16384); +f(274894700545, 16385); +f(549739069439, 32767); +f(549755846656, 32768); +f(549772623873, 32769); +f(1099494916095, 65535); +f(1099511693312, 65536); +f(1099528470529, 65537); +f(2199006609407, 131071); +f(2199023386624, 131072); +f(2199040163841, 131073); +f(4398029996031, 262143); +f(4398046773248, 262144); +f(4398063550465, 262145); +f(8796076769279, 524287); +f(8796093546496, 524288); +f(8796110323713, 524289); +f(17592170315775, 1048575); +f(17592187092992, 1048576); +f(17592203870209, 1048577); +f(35184357408767, 2097151); +f(35184374185984, 2097152); +f(35184390963201, 2097153); +f(70368731594751, 4194303); +f(70368748371968, 4194304); +f(70368765149185, 4194305); +f(140737479966719, 8388607); +f(140737496743936, 8388608); +f(140737513521153, 8388609); +f(281474976710655, 16777215); +f(281474993487872, 16777216); +f(281475010265089, 16777217); +x = 33554431; +f(33554431, 1); +f(67108862, 2); +f(100663293, 3); +f(134217724, 4); +f(167772155, 5); +f(234881017, 7); +f(268435448, 8); +f(301989879, 9); +f(503316465, 15); +f(536870896, 16); +f(570425327, 17); +f(1040187361, 31); +f(1073741792, 32); +f(1107296223, 33); +f(2113929153, 63); +f(2147483584, 64); +f(2181038015, 65); +f(4261412737, 127); +f(4294967168, 128); +f(4328521599, 129); +f(8556379905, 255); +f(8589934336, 256); +f(8623488767, 257); +f(17146314241, 511); +f(17179868672, 512); +f(17213423103, 513); +f(34326182913, 1023); +f(34359737344, 1024); +f(34393291775, 1025); +f(68685920257, 2047); +f(68719474688, 2048); +f(68753029119, 2049); +f(137405394945, 4095); +f(137438949376, 4096); +f(137472503807, 4097); +f(274844344321, 8191); +f(274877898752, 8192); +f(274911453183, 8193); +f(549722243073, 16383); +f(549755797504, 16384); +f(549789351935, 16385); +f(1099478040577, 32767); +f(1099511595008, 32768); +f(1099545149439, 32769); +f(2198989635585, 65535); +f(2199023190016, 65536); +f(2199056744447, 65537); +f(4398012825601, 131071); +f(4398046380032, 131072); +f(4398079934463, 131073); +f(8796059205633, 262143); +f(8796092760064, 262144); +f(8796126314495, 262145); +f(17592151965697, 524287); +f(17592185520128, 524288); +f(17592219074559, 524289); +f(35184337485825, 1048575); +f(35184371040256, 1048576); +f(35184404594687, 1048577); +f(70368708526081, 2097151); +f(70368742080512, 2097152); +f(70368775634943, 2097153); +f(140737450606593, 4194303); +f(140737484161024, 4194304); +f(140737517715455, 4194305); +f(281474934767617, 8388607); +f(281474968322048, 8388608); +f(281475001876479, 8388609); +f(562949903089665, 16777215); +f(562949936644096, 16777216); +f(562949970198527, 16777217); +f(1125899839733761, 33554431); +x = 33554432; +f(33554432, 1); +f(67108864, 2); +f(100663296, 3); +f(134217728, 4); +f(167772160, 5); +f(234881024, 7); +f(268435456, 8); +f(301989888, 9); +f(503316480, 15); +f(536870912, 16); +f(570425344, 17); +f(1040187392, 31); +f(1073741824, 32); +f(1107296256, 33); +f(2113929216, 63); +f(2147483648, 64); +f(2181038080, 65); +f(4261412864, 127); +f(4294967296, 128); +f(4328521728, 129); +f(8556380160, 255); +f(8589934592, 256); +f(8623489024, 257); +f(17146314752, 511); +f(17179869184, 512); +f(17213423616, 513); +f(34326183936, 1023); +f(34359738368, 1024); +f(34393292800, 1025); +f(68685922304, 2047); +f(68719476736, 2048); +f(68753031168, 2049); +f(137405399040, 4095); +f(137438953472, 4096); +f(137472507904, 4097); +f(274844352512, 8191); +f(274877906944, 8192); +f(274911461376, 8193); +f(549722259456, 16383); +f(549755813888, 16384); +f(549789368320, 16385); +f(1099478073344, 32767); +f(1099511627776, 32768); +f(1099545182208, 32769); +f(2198989701120, 65535); +f(2199023255552, 65536); +f(2199056809984, 65537); +f(4398012956672, 131071); +f(4398046511104, 131072); +f(4398080065536, 131073); +f(8796059467776, 262143); +f(8796093022208, 262144); +f(8796126576640, 262145); +f(17592152489984, 524287); +f(17592186044416, 524288); +f(17592219598848, 524289); +f(35184338534400, 1048575); +f(35184372088832, 1048576); +f(35184405643264, 1048577); +f(70368710623232, 2097151); +f(70368744177664, 2097152); +f(70368777732096, 2097153); +f(140737454800896, 4194303); +f(140737488355328, 4194304); +f(140737521909760, 4194305); +f(281474943156224, 8388607); +f(281474976710656, 8388608); +f(281475010265088, 8388609); +f(562949919866880, 16777215); +f(562949953421312, 16777216); +f(562949986975744, 16777217); +f(1125899873288192, 33554431); +f(1125899906842624, 33554432); +x = 33554433; +f(33554433, 1); +f(67108866, 2); +f(100663299, 3); +f(134217732, 4); +f(167772165, 5); +f(234881031, 7); +f(268435464, 8); +f(301989897, 9); +f(503316495, 15); +f(536870928, 16); +f(570425361, 17); +f(1040187423, 31); +f(1073741856, 32); +f(1107296289, 33); +f(2113929279, 63); +f(2147483712, 64); +f(2181038145, 65); +f(4261412991, 127); +f(4294967424, 128); +f(4328521857, 129); +f(8556380415, 255); +f(8589934848, 256); +f(8623489281, 257); +f(17146315263, 511); +f(17179869696, 512); +f(17213424129, 513); +f(34326184959, 1023); +f(34359739392, 1024); +f(34393293825, 1025); +f(68685924351, 2047); +f(68719478784, 2048); +f(68753033217, 2049); +f(137405403135, 4095); +f(137438957568, 4096); +f(137472512001, 4097); +f(274844360703, 8191); +f(274877915136, 8192); +f(274911469569, 8193); +f(549722275839, 16383); +f(549755830272, 16384); +f(549789384705, 16385); +f(1099478106111, 32767); +f(1099511660544, 32768); +f(1099545214977, 32769); +f(2198989766655, 65535); +f(2199023321088, 65536); +f(2199056875521, 65537); +f(4398013087743, 131071); +f(4398046642176, 131072); +f(4398080196609, 131073); +f(8796059729919, 262143); +f(8796093284352, 262144); +f(8796126838785, 262145); +f(17592153014271, 524287); +f(17592186568704, 524288); +f(17592220123137, 524289); +f(35184339582975, 1048575); +f(35184373137408, 1048576); +f(35184406691841, 1048577); +f(70368712720383, 2097151); +f(70368746274816, 2097152); +f(70368779829249, 2097153); +f(140737458995199, 4194303); +f(140737492549632, 4194304); +f(140737526104065, 4194305); +f(281474951544831, 8388607); +f(281474985099264, 8388608); +f(281475018653697, 8388609); +f(562949936644095, 16777215); +f(562949970198528, 16777216); +f(562950003752961, 16777217); +f(1125899906842623, 33554431); +f(1125899940397056, 33554432); +f(1125899973951489, 33554433); +x = 67108863; +f(67108863, 1); +f(134217726, 2); +f(201326589, 3); +f(268435452, 4); +f(335544315, 5); +f(469762041, 7); +f(536870904, 8); +f(603979767, 9); +f(1006632945, 15); +f(1073741808, 16); +f(1140850671, 17); +f(2080374753, 31); +f(2147483616, 32); +f(2214592479, 33); +f(4227858369, 63); +f(4294967232, 64); +f(4362076095, 65); +f(8522825601, 127); +f(8589934464, 128); +f(8657043327, 129); +f(17112760065, 255); +f(17179868928, 256); +f(17246977791, 257); +f(34292628993, 511); +f(34359737856, 512); +f(34426846719, 513); +f(68652366849, 1023); +f(68719475712, 1024); +f(68786584575, 1025); +f(137371842561, 2047); +f(137438951424, 2048); +f(137506060287, 2049); +f(274810793985, 4095); +f(274877902848, 4096); +f(274945011711, 4097); +f(549688696833, 8191); +f(549755805696, 8192); +f(549822914559, 8193); +f(1099444502529, 16383); +f(1099511611392, 16384); +f(1099578720255, 16385); +f(2198956113921, 32767); +f(2199023222784, 32768); +f(2199090331647, 32769); +f(4397979336705, 65535); +f(4398046445568, 65536); +f(4398113554431, 65537); +f(8796025782273, 131071); +f(8796092891136, 131072); +f(8796159999999, 131073); +f(17592118673409, 262143); +f(17592185782272, 262144); +f(17592252891135, 262145); +f(35184304455681, 524287); +f(35184371564544, 524288); +f(35184438673407, 524289); +f(70368676020225, 1048575); +f(70368743129088, 1048576); +f(70368810237951, 1048577); +f(140737419149313, 2097151); +f(140737486258176, 2097152); +f(140737553367039, 2097153); +f(281474905407489, 4194303); +f(281474972516352, 4194304); +f(281475039625215, 4194305); +f(562949877923841, 8388607); +f(562949945032704, 8388608); +f(562950012141567, 8388609); +f(1125899822956545, 16777215); +f(1125899890065408, 16777216); +f(1125899957174271, 16777217); +x = 67108864; +f(67108864, 1); +f(134217728, 2); +f(201326592, 3); +f(268435456, 4); +f(335544320, 5); +f(469762048, 7); +f(536870912, 8); +f(603979776, 9); +f(1006632960, 15); +f(1073741824, 16); +f(1140850688, 17); +f(2080374784, 31); +f(2147483648, 32); +f(2214592512, 33); +f(4227858432, 63); +f(4294967296, 64); +f(4362076160, 65); +f(8522825728, 127); +f(8589934592, 128); +f(8657043456, 129); +f(17112760320, 255); +f(17179869184, 256); +f(17246978048, 257); +f(34292629504, 511); +f(34359738368, 512); +f(34426847232, 513); +f(68652367872, 1023); +f(68719476736, 1024); +f(68786585600, 1025); +f(137371844608, 2047); +f(137438953472, 2048); +f(137506062336, 2049); +f(274810798080, 4095); +f(274877906944, 4096); +f(274945015808, 4097); +f(549688705024, 8191); +f(549755813888, 8192); +f(549822922752, 8193); +f(1099444518912, 16383); +f(1099511627776, 16384); +f(1099578736640, 16385); +f(2198956146688, 32767); +f(2199023255552, 32768); +f(2199090364416, 32769); +f(4397979402240, 65535); +f(4398046511104, 65536); +f(4398113619968, 65537); +f(8796025913344, 131071); +f(8796093022208, 131072); +f(8796160131072, 131073); +f(17592118935552, 262143); +f(17592186044416, 262144); +f(17592253153280, 262145); +f(35184304979968, 524287); +f(35184372088832, 524288); +f(35184439197696, 524289); +f(70368677068800, 1048575); +f(70368744177664, 1048576); +f(70368811286528, 1048577); +f(140737421246464, 2097151); +f(140737488355328, 2097152); +f(140737555464192, 2097153); +f(281474909601792, 4194303); +f(281474976710656, 4194304); +f(281475043819520, 4194305); +f(562949886312448, 8388607); +f(562949953421312, 8388608); +f(562950020530176, 8388609); +f(1125899839733760, 16777215); +f(1125899906842624, 16777216); +f(1125899973951488, 16777217); +x = 67108865; +f(67108865, 1); +f(134217730, 2); +f(201326595, 3); +f(268435460, 4); +f(335544325, 5); +f(469762055, 7); +f(536870920, 8); +f(603979785, 9); +f(1006632975, 15); +f(1073741840, 16); +f(1140850705, 17); +f(2080374815, 31); +f(2147483680, 32); +f(2214592545, 33); +f(4227858495, 63); +f(4294967360, 64); +f(4362076225, 65); +f(8522825855, 127); +f(8589934720, 128); +f(8657043585, 129); +f(17112760575, 255); +f(17179869440, 256); +f(17246978305, 257); +f(34292630015, 511); +f(34359738880, 512); +f(34426847745, 513); +f(68652368895, 1023); +f(68719477760, 1024); +f(68786586625, 1025); +f(137371846655, 2047); +f(137438955520, 2048); +f(137506064385, 2049); +f(274810802175, 4095); +f(274877911040, 4096); +f(274945019905, 4097); +f(549688713215, 8191); +f(549755822080, 8192); +f(549822930945, 8193); +f(1099444535295, 16383); +f(1099511644160, 16384); +f(1099578753025, 16385); +f(2198956179455, 32767); +f(2199023288320, 32768); +f(2199090397185, 32769); +f(4397979467775, 65535); +f(4398046576640, 65536); +f(4398113685505, 65537); +f(8796026044415, 131071); +f(8796093153280, 131072); +f(8796160262145, 131073); +f(17592119197695, 262143); +f(17592186306560, 262144); +f(17592253415425, 262145); +f(35184305504255, 524287); +f(35184372613120, 524288); +f(35184439721985, 524289); +f(70368678117375, 1048575); +f(70368745226240, 1048576); +f(70368812335105, 1048577); +f(140737423343615, 2097151); +f(140737490452480, 2097152); +f(140737557561345, 2097153); +f(281474913796095, 4194303); +f(281474980904960, 4194304); +f(281475048013825, 4194305); +f(562949894701055, 8388607); +f(562949961809920, 8388608); +f(562950028918785, 8388609); +f(1125899856510975, 16777215); +f(1125899923619840, 16777216); +f(1125899990728705, 16777217); +x = 134217727; +f(134217727, 1); +f(268435454, 2); +f(402653181, 3); +f(536870908, 4); +f(671088635, 5); +f(939524089, 7); +f(1073741816, 8); +f(1207959543, 9); +f(2013265905, 15); +f(2147483632, 16); +f(2281701359, 17); +f(4160749537, 31); +f(4294967264, 32); +f(4429184991, 33); +f(8455716801, 63); +f(8589934528, 64); +f(8724152255, 65); +f(17045651329, 127); +f(17179869056, 128); +f(17314086783, 129); +f(34225520385, 255); +f(34359738112, 256); +f(34493955839, 257); +f(68585258497, 511); +f(68719476224, 512); +f(68853693951, 513); +f(137304734721, 1023); +f(137438952448, 1024); +f(137573170175, 1025); +f(274743687169, 2047); +f(274877904896, 2048); +f(275012122623, 2049); +f(549621592065, 4095); +f(549755809792, 4096); +f(549890027519, 4097); +f(1099377401857, 8191); +f(1099511619584, 8192); +f(1099645837311, 8193); +f(2198889021441, 16383); +f(2199023239168, 16384); +f(2199157456895, 16385); +f(4397912260609, 32767); +f(4398046478336, 32768); +f(4398180696063, 32769); +f(8795958738945, 65535); +f(8796092956672, 65536); +f(8796227174399, 65537); +f(17592051695617, 131071); +f(17592185913344, 131072); +f(17592320131071, 131073); +f(35184237608961, 262143); +f(35184371826688, 262144); +f(35184506044415, 262145); +f(70368609435649, 524287); +f(70368743653376, 524288); +f(70368877871103, 524289); +f(140737353089025, 1048575); +f(140737487306752, 1048576); +f(140737621524479, 1048577); +f(281474840395777, 2097151); +f(281474974613504, 2097152); +f(281475108831231, 2097153); +f(562949815009281, 4194303); +f(562949949227008, 4194304); +f(562950083444735, 4194305); +f(1125899764236289, 8388607); +f(1125899898454016, 8388608); +f(1125900032671743, 8388609); +x = 134217728; +f(134217728, 1); +f(268435456, 2); +f(402653184, 3); +f(536870912, 4); +f(671088640, 5); +f(939524096, 7); +f(1073741824, 8); +f(1207959552, 9); +f(2013265920, 15); +f(2147483648, 16); +f(2281701376, 17); +f(4160749568, 31); +f(4294967296, 32); +f(4429185024, 33); +f(8455716864, 63); +f(8589934592, 64); +f(8724152320, 65); +f(17045651456, 127); +f(17179869184, 128); +f(17314086912, 129); +f(34225520640, 255); +f(34359738368, 256); +f(34493956096, 257); +f(68585259008, 511); +f(68719476736, 512); +f(68853694464, 513); +f(137304735744, 1023); +f(137438953472, 1024); +f(137573171200, 1025); +f(274743689216, 2047); +f(274877906944, 2048); +f(275012124672, 2049); +f(549621596160, 4095); +f(549755813888, 4096); +f(549890031616, 4097); +f(1099377410048, 8191); +f(1099511627776, 8192); +f(1099645845504, 8193); +f(2198889037824, 16383); +f(2199023255552, 16384); +f(2199157473280, 16385); +f(4397912293376, 32767); +f(4398046511104, 32768); +f(4398180728832, 32769); +f(8795958804480, 65535); +f(8796093022208, 65536); +f(8796227239936, 65537); +f(17592051826688, 131071); +f(17592186044416, 131072); +f(17592320262144, 131073); +f(35184237871104, 262143); +f(35184372088832, 262144); +f(35184506306560, 262145); +f(70368609959936, 524287); +f(70368744177664, 524288); +f(70368878395392, 524289); +f(140737354137600, 1048575); +f(140737488355328, 1048576); +f(140737622573056, 1048577); +f(281474842492928, 2097151); +f(281474976710656, 2097152); +f(281475110928384, 2097153); +f(562949819203584, 4194303); +f(562949953421312, 4194304); +f(562950087639040, 4194305); +f(1125899772624896, 8388607); +f(1125899906842624, 8388608); +f(1125900041060352, 8388609); +x = 134217729; +f(134217729, 1); +f(268435458, 2); +f(402653187, 3); +f(536870916, 4); +f(671088645, 5); +f(939524103, 7); +f(1073741832, 8); +f(1207959561, 9); +f(2013265935, 15); +f(2147483664, 16); +f(2281701393, 17); +f(4160749599, 31); +f(4294967328, 32); +f(4429185057, 33); +f(8455716927, 63); +f(8589934656, 64); +f(8724152385, 65); +f(17045651583, 127); +f(17179869312, 128); +f(17314087041, 129); +f(34225520895, 255); +f(34359738624, 256); +f(34493956353, 257); +f(68585259519, 511); +f(68719477248, 512); +f(68853694977, 513); +f(137304736767, 1023); +f(137438954496, 1024); +f(137573172225, 1025); +f(274743691263, 2047); +f(274877908992, 2048); +f(275012126721, 2049); +f(549621600255, 4095); +f(549755817984, 4096); +f(549890035713, 4097); +f(1099377418239, 8191); +f(1099511635968, 8192); +f(1099645853697, 8193); +f(2198889054207, 16383); +f(2199023271936, 16384); +f(2199157489665, 16385); +f(4397912326143, 32767); +f(4398046543872, 32768); +f(4398180761601, 32769); +f(8795958870015, 65535); +f(8796093087744, 65536); +f(8796227305473, 65537); +f(17592051957759, 131071); +f(17592186175488, 131072); +f(17592320393217, 131073); +f(35184238133247, 262143); +f(35184372350976, 262144); +f(35184506568705, 262145); +f(70368610484223, 524287); +f(70368744701952, 524288); +f(70368878919681, 524289); +f(140737355186175, 1048575); +f(140737489403904, 1048576); +f(140737623621633, 1048577); +f(281474844590079, 2097151); +f(281474978807808, 2097152); +f(281475113025537, 2097153); +f(562949823397887, 4194303); +f(562949957615616, 4194304); +f(562950091833345, 4194305); +f(1125899781013503, 8388607); +f(1125899915231232, 8388608); +f(1125900049448961, 8388609); +x = 268435455; +f(268435455, 1); +f(536870910, 2); +f(805306365, 3); +f(1073741820, 4); +f(1342177275, 5); +f(1879048185, 7); +f(2147483640, 8); +f(2415919095, 9); +f(4026531825, 15); +f(4294967280, 16); +f(4563402735, 17); +f(8321499105, 31); +f(8589934560, 32); +f(8858370015, 33); +f(16911433665, 63); +f(17179869120, 64); +f(17448304575, 65); +f(34091302785, 127); +f(34359738240, 128); +f(34628173695, 129); +f(68451041025, 255); +f(68719476480, 256); +f(68987911935, 257); +f(137170517505, 511); +f(137438952960, 512); +f(137707388415, 513); +f(274609470465, 1023); +f(274877905920, 1024); +f(275146341375, 1025); +f(549487376385, 2047); +f(549755811840, 2048); +f(550024247295, 2049); +f(1099243188225, 4095); +f(1099511623680, 4096); +f(1099780059135, 4097); +f(2198754811905, 8191); +f(2199023247360, 8192); +f(2199291682815, 8193); +f(4397778059265, 16383); +f(4398046494720, 16384); +f(4398314930175, 16385); +f(8795824553985, 32767); +f(8796092989440, 32768); +f(8796361424895, 32769); +f(17591917543425, 65535); +f(17592185978880, 65536); +f(17592454414335, 65537); +f(35184103522305, 131071); +f(35184371957760, 131072); +f(35184640393215, 131073); +f(70368475480065, 262143); +f(70368743915520, 262144); +f(70369012350975, 262145); +f(140737219395585, 524287); +f(140737487831040, 524288); +f(140737756266495, 524289); +f(281474707226625, 1048575); +f(281474975662080, 1048576); +f(281475244097535, 1048577); +f(562949682888705, 2097151); +f(562949951324160, 2097152); +f(562950219759615, 2097153); +f(1125899634212865, 4194303); +f(1125899902648320, 4194304); +f(1125900171083775, 4194305); +x = 268435456; +f(268435456, 1); +f(536870912, 2); +f(805306368, 3); +f(1073741824, 4); +f(1342177280, 5); +f(1879048192, 7); +f(2147483648, 8); +f(2415919104, 9); +f(4026531840, 15); +f(4294967296, 16); +f(4563402752, 17); +f(8321499136, 31); +f(8589934592, 32); +f(8858370048, 33); +f(16911433728, 63); +f(17179869184, 64); +f(17448304640, 65); +f(34091302912, 127); +f(34359738368, 128); +f(34628173824, 129); +f(68451041280, 255); +f(68719476736, 256); +f(68987912192, 257); +f(137170518016, 511); +f(137438953472, 512); +f(137707388928, 513); +f(274609471488, 1023); +f(274877906944, 1024); +f(275146342400, 1025); +f(549487378432, 2047); +f(549755813888, 2048); +f(550024249344, 2049); +f(1099243192320, 4095); +f(1099511627776, 4096); +f(1099780063232, 4097); +f(2198754820096, 8191); +f(2199023255552, 8192); +f(2199291691008, 8193); +f(4397778075648, 16383); +f(4398046511104, 16384); +f(4398314946560, 16385); +f(8795824586752, 32767); +f(8796093022208, 32768); +f(8796361457664, 32769); +f(17591917608960, 65535); +f(17592186044416, 65536); +f(17592454479872, 65537); +f(35184103653376, 131071); +f(35184372088832, 131072); +f(35184640524288, 131073); +f(70368475742208, 262143); +f(70368744177664, 262144); +f(70369012613120, 262145); +f(140737219919872, 524287); +f(140737488355328, 524288); +f(140737756790784, 524289); +f(281474708275200, 1048575); +f(281474976710656, 1048576); +f(281475245146112, 1048577); +f(562949684985856, 2097151); +f(562949953421312, 2097152); +f(562950221856768, 2097153); +f(1125899638407168, 4194303); +f(1125899906842624, 4194304); +f(1125900175278080, 4194305); +x = 268435457; +f(268435457, 1); +f(536870914, 2); +f(805306371, 3); +f(1073741828, 4); +f(1342177285, 5); +f(1879048199, 7); +f(2147483656, 8); +f(2415919113, 9); +f(4026531855, 15); +f(4294967312, 16); +f(4563402769, 17); +f(8321499167, 31); +f(8589934624, 32); +f(8858370081, 33); +f(16911433791, 63); +f(17179869248, 64); +f(17448304705, 65); +f(34091303039, 127); +f(34359738496, 128); +f(34628173953, 129); +f(68451041535, 255); +f(68719476992, 256); +f(68987912449, 257); +f(137170518527, 511); +f(137438953984, 512); +f(137707389441, 513); +f(274609472511, 1023); +f(274877907968, 1024); +f(275146343425, 1025); +f(549487380479, 2047); +f(549755815936, 2048); +f(550024251393, 2049); +f(1099243196415, 4095); +f(1099511631872, 4096); +f(1099780067329, 4097); +f(2198754828287, 8191); +f(2199023263744, 8192); +f(2199291699201, 8193); +f(4397778092031, 16383); +f(4398046527488, 16384); +f(4398314962945, 16385); +f(8795824619519, 32767); +f(8796093054976, 32768); +f(8796361490433, 32769); +f(17591917674495, 65535); +f(17592186109952, 65536); +f(17592454545409, 65537); +f(35184103784447, 131071); +f(35184372219904, 131072); +f(35184640655361, 131073); +f(70368476004351, 262143); +f(70368744439808, 262144); +f(70369012875265, 262145); +f(140737220444159, 524287); +f(140737488879616, 524288); +f(140737757315073, 524289); +f(281474709323775, 1048575); +f(281474977759232, 1048576); +f(281475246194689, 1048577); +f(562949687083007, 2097151); +f(562949955518464, 2097152); +f(562950223953921, 2097153); +f(1125899642601471, 4194303); +f(1125899911036928, 4194304); +f(1125900179472385, 4194305); +x = 536870911; +f(536870911, 1); +f(1073741822, 2); +f(1610612733, 3); +f(2147483644, 4); +f(2684354555, 5); +f(3758096377, 7); +f(4294967288, 8); +f(4831838199, 9); +f(8053063665, 15); +f(8589934576, 16); +f(9126805487, 17); +f(16642998241, 31); +f(17179869152, 32); +f(17716740063, 33); +f(33822867393, 63); +f(34359738304, 64); +f(34896609215, 65); +f(68182605697, 127); +f(68719476608, 128); +f(69256347519, 129); +f(136902082305, 255); +f(137438953216, 256); +f(137975824127, 257); +f(274341035521, 511); +f(274877906432, 512); +f(275414777343, 513); +f(549218941953, 1023); +f(549755812864, 1024); +f(550292683775, 1025); +f(1098974754817, 2047); +f(1099511625728, 2048); +f(1100048496639, 2049); +f(2198486380545, 4095); +f(2199023251456, 4096); +f(2199560122367, 4097); +f(4397509632001, 8191); +f(4398046502912, 8192); +f(4398583373823, 8193); +f(8795556134913, 16383); +f(8796093005824, 16384); +f(8796629876735, 16385); +f(17591649140737, 32767); +f(17592186011648, 32768); +f(17592722882559, 32769); +f(35183835152385, 65535); +f(35184372023296, 65536); +f(35184908894207, 65537); +f(70368207175681, 131071); +f(70368744046592, 131072); +f(70369280917503, 131073); +f(140736951222273, 262143); +f(140737488093184, 262144); +f(140738024964095, 262145); +f(281474439315457, 524287); +f(281474976186368, 524288); +f(281475513057279, 524289); +f(562949415501825, 1048575); +f(562949952372736, 1048576); +f(562950489243647, 1048577); +f(1125899367874561, 2097151); +f(1125899904745472, 2097152); +f(1125900441616383, 2097153); +x = 536870912; +f(536870912, 1); +f(1073741824, 2); +f(1610612736, 3); +f(2147483648, 4); +f(2684354560, 5); +f(3758096384, 7); +f(4294967296, 8); +f(4831838208, 9); +f(8053063680, 15); +f(8589934592, 16); +f(9126805504, 17); +f(16642998272, 31); +f(17179869184, 32); +f(17716740096, 33); +f(33822867456, 63); +f(34359738368, 64); +f(34896609280, 65); +f(68182605824, 127); +f(68719476736, 128); +f(69256347648, 129); +f(136902082560, 255); +f(137438953472, 256); +f(137975824384, 257); +f(274341036032, 511); +f(274877906944, 512); +f(275414777856, 513); +f(549218942976, 1023); +f(549755813888, 1024); +f(550292684800, 1025); +f(1098974756864, 2047); +f(1099511627776, 2048); +f(1100048498688, 2049); +f(2198486384640, 4095); +f(2199023255552, 4096); +f(2199560126464, 4097); +f(4397509640192, 8191); +f(4398046511104, 8192); +f(4398583382016, 8193); +f(8795556151296, 16383); +f(8796093022208, 16384); +f(8796629893120, 16385); +f(17591649173504, 32767); +f(17592186044416, 32768); +f(17592722915328, 32769); +f(35183835217920, 65535); +f(35184372088832, 65536); +f(35184908959744, 65537); +f(70368207306752, 131071); +f(70368744177664, 131072); +f(70369281048576, 131073); +f(140736951484416, 262143); +f(140737488355328, 262144); +f(140738025226240, 262145); +f(281474439839744, 524287); +f(281474976710656, 524288); +f(281475513581568, 524289); +f(562949416550400, 1048575); +f(562949953421312, 1048576); +f(562950490292224, 1048577); +f(1125899369971712, 2097151); +f(1125899906842624, 2097152); +f(1125900443713536, 2097153); +x = 536870913; +f(536870913, 1); +f(1073741826, 2); +f(1610612739, 3); +f(2147483652, 4); +f(2684354565, 5); +f(3758096391, 7); +f(4294967304, 8); +f(4831838217, 9); +f(8053063695, 15); +f(8589934608, 16); +f(9126805521, 17); +f(16642998303, 31); +f(17179869216, 32); +f(17716740129, 33); +f(33822867519, 63); +f(34359738432, 64); +f(34896609345, 65); +f(68182605951, 127); +f(68719476864, 128); +f(69256347777, 129); +f(136902082815, 255); +f(137438953728, 256); +f(137975824641, 257); +f(274341036543, 511); +f(274877907456, 512); +f(275414778369, 513); +f(549218943999, 1023); +f(549755814912, 1024); +f(550292685825, 1025); +f(1098974758911, 2047); +f(1099511629824, 2048); +f(1100048500737, 2049); +f(2198486388735, 4095); +f(2199023259648, 4096); +f(2199560130561, 4097); +f(4397509648383, 8191); +f(4398046519296, 8192); +f(4398583390209, 8193); +f(8795556167679, 16383); +f(8796093038592, 16384); +f(8796629909505, 16385); +f(17591649206271, 32767); +f(17592186077184, 32768); +f(17592722948097, 32769); +f(35183835283455, 65535); +f(35184372154368, 65536); +f(35184909025281, 65537); +f(70368207437823, 131071); +f(70368744308736, 131072); +f(70369281179649, 131073); +f(140736951746559, 262143); +f(140737488617472, 262144); +f(140738025488385, 262145); +f(281474440364031, 524287); +f(281474977234944, 524288); +f(281475514105857, 524289); +f(562949417598975, 1048575); +f(562949954469888, 1048576); +f(562950491340801, 1048577); +f(1125899372068863, 2097151); +f(1125899908939776, 2097152); +f(1125900445810689, 2097153); +x = 1073741823; +f(1073741823, 1); +f(2147483646, 2); +f(3221225469, 3); +f(4294967292, 4); +f(5368709115, 5); +f(7516192761, 7); +f(8589934584, 8); +f(9663676407, 9); +f(16106127345, 15); +f(17179869168, 16); +f(18253610991, 17); +f(33285996513, 31); +f(34359738336, 32); +f(35433480159, 33); +f(67645734849, 63); +f(68719476672, 64); +f(69793218495, 65); +f(136365211521, 127); +f(137438953344, 128); +f(138512695167, 129); +f(273804164865, 255); +f(274877906688, 256); +f(275951648511, 257); +f(548682071553, 511); +f(549755813376, 512); +f(550829555199, 513); +f(1098437884929, 1023); +f(1099511626752, 1024); +f(1100585368575, 1025); +f(2197949511681, 2047); +f(2199023253504, 2048); +f(2200096995327, 2049); +f(4396972765185, 4095); +f(4398046507008, 4096); +f(4399120248831, 4097); +f(8795019272193, 8191); +f(8796093014016, 8192); +f(8797166755839, 8193); +f(17591112286209, 16383); +f(17592186028032, 16384); +f(17593259769855, 16385); +f(35183298314241, 32767); +f(35184372056064, 32768); +f(35185445797887, 32769); +f(70367670370305, 65535); +f(70368744112128, 65536); +f(70369817853951, 65537); +f(140736414482433, 131071); +f(140737488224256, 131072); +f(140738561966079, 131073); +f(281473902706689, 262143); +f(281474976448512, 262144); +f(281476050190335, 262145); +f(562948879155201, 524287); +f(562949952897024, 524288); +f(562951026638847, 524289); +f(1125898832052225, 1048575); +f(1125899905794048, 1048576); +f(1125900979535871, 1048577); +x = 1073741824; +f(1073741824, 1); +f(2147483648, 2); +f(3221225472, 3); +f(4294967296, 4); +f(5368709120, 5); +f(7516192768, 7); +f(8589934592, 8); +f(9663676416, 9); +f(16106127360, 15); +f(17179869184, 16); +f(18253611008, 17); +f(33285996544, 31); +f(34359738368, 32); +f(35433480192, 33); +f(67645734912, 63); +f(68719476736, 64); +f(69793218560, 65); +f(136365211648, 127); +f(137438953472, 128); +f(138512695296, 129); +f(273804165120, 255); +f(274877906944, 256); +f(275951648768, 257); +f(548682072064, 511); +f(549755813888, 512); +f(550829555712, 513); +f(1098437885952, 1023); +f(1099511627776, 1024); +f(1100585369600, 1025); +f(2197949513728, 2047); +f(2199023255552, 2048); +f(2200096997376, 2049); +f(4396972769280, 4095); +f(4398046511104, 4096); +f(4399120252928, 4097); +f(8795019280384, 8191); +f(8796093022208, 8192); +f(8797166764032, 8193); +f(17591112302592, 16383); +f(17592186044416, 16384); +f(17593259786240, 16385); +f(35183298347008, 32767); +f(35184372088832, 32768); +f(35185445830656, 32769); +f(70367670435840, 65535); +f(70368744177664, 65536); +f(70369817919488, 65537); +f(140736414613504, 131071); +f(140737488355328, 131072); +f(140738562097152, 131073); +f(281473902968832, 262143); +f(281474976710656, 262144); +f(281476050452480, 262145); +f(562948879679488, 524287); +f(562949953421312, 524288); +f(562951027163136, 524289); +f(1125898833100800, 1048575); +f(1125899906842624, 1048576); +f(1125900980584448, 1048577); +x = 1073741825; +f(1073741825, 1); +f(2147483650, 2); +f(3221225475, 3); +f(4294967300, 4); +f(5368709125, 5); +f(7516192775, 7); +f(8589934600, 8); +f(9663676425, 9); +f(16106127375, 15); +f(17179869200, 16); +f(18253611025, 17); +f(33285996575, 31); +f(34359738400, 32); +f(35433480225, 33); +f(67645734975, 63); +f(68719476800, 64); +f(69793218625, 65); +f(136365211775, 127); +f(137438953600, 128); +f(138512695425, 129); +f(273804165375, 255); +f(274877907200, 256); +f(275951649025, 257); +f(548682072575, 511); +f(549755814400, 512); +f(550829556225, 513); +f(1098437886975, 1023); +f(1099511628800, 1024); +f(1100585370625, 1025); +f(2197949515775, 2047); +f(2199023257600, 2048); +f(2200096999425, 2049); +f(4396972773375, 4095); +f(4398046515200, 4096); +f(4399120257025, 4097); +f(8795019288575, 8191); +f(8796093030400, 8192); +f(8797166772225, 8193); +f(17591112318975, 16383); +f(17592186060800, 16384); +f(17593259802625, 16385); +f(35183298379775, 32767); +f(35184372121600, 32768); +f(35185445863425, 32769); +f(70367670501375, 65535); +f(70368744243200, 65536); +f(70369817985025, 65537); +f(140736414744575, 131071); +f(140737488486400, 131072); +f(140738562228225, 131073); +f(281473903230975, 262143); +f(281474976972800, 262144); +f(281476050714625, 262145); +f(562948880203775, 524287); +f(562949953945600, 524288); +f(562951027687425, 524289); +f(1125898834149375, 1048575); +f(1125899907891200, 1048576); +f(1125900981633025, 1048577); +x = 2147483647; +f(2147483647, 1); +f(4294967294, 2); +f(6442450941, 3); +f(8589934588, 4); +f(10737418235, 5); +f(15032385529, 7); +f(17179869176, 8); +f(19327352823, 9); +f(32212254705, 15); +f(34359738352, 16); +f(36507221999, 17); +f(66571993057, 31); +f(68719476704, 32); +f(70866960351, 33); +f(135291469761, 63); +f(137438953408, 64); +f(139586437055, 65); +f(272730423169, 127); +f(274877906816, 128); +f(277025390463, 129); +f(547608329985, 255); +f(549755813632, 256); +f(551903297279, 257); +f(1097364143617, 511); +f(1099511627264, 512); +f(1101659110911, 513); +f(2196875770881, 1023); +f(2199023254528, 1024); +f(2201170738175, 1025); +f(4395899025409, 2047); +f(4398046509056, 2048); +f(4400193992703, 2049); +f(8793945534465, 4095); +f(8796093018112, 4096); +f(8798240501759, 4097); +f(17590038552577, 8191); +f(17592186036224, 8192); +f(17594333519871, 8193); +f(35182224588801, 16383); +f(35184372072448, 16384); +f(35186519556095, 16385); +f(70366596661249, 32767); +f(70368744144896, 32768); +f(70370891628543, 32769); +f(140735340806145, 65535); +f(140737488289792, 65536); +f(140739635773439, 65537); +f(281472829095937, 131071); +f(281474976579584, 131072); +f(281477124063231, 131073); +f(562947805675521, 262143); +f(562949953159168, 262144); +f(562952100642815, 262145); +f(1125897758834689, 524287); +f(1125899906318336, 524288); +f(1125902053801983, 524289); +x = 2147483648; +f(2147483648, 1); +f(4294967296, 2); +f(6442450944, 3); +f(8589934592, 4); +f(10737418240, 5); +f(15032385536, 7); +f(17179869184, 8); +f(19327352832, 9); +f(32212254720, 15); +f(34359738368, 16); +f(36507222016, 17); +f(66571993088, 31); +f(68719476736, 32); +f(70866960384, 33); +f(135291469824, 63); +f(137438953472, 64); +f(139586437120, 65); +f(272730423296, 127); +f(274877906944, 128); +f(277025390592, 129); +f(547608330240, 255); +f(549755813888, 256); +f(551903297536, 257); +f(1097364144128, 511); +f(1099511627776, 512); +f(1101659111424, 513); +f(2196875771904, 1023); +f(2199023255552, 1024); +f(2201170739200, 1025); +f(4395899027456, 2047); +f(4398046511104, 2048); +f(4400193994752, 2049); +f(8793945538560, 4095); +f(8796093022208, 4096); +f(8798240505856, 4097); +f(17590038560768, 8191); +f(17592186044416, 8192); +f(17594333528064, 8193); +f(35182224605184, 16383); +f(35184372088832, 16384); +f(35186519572480, 16385); +f(70366596694016, 32767); +f(70368744177664, 32768); +f(70370891661312, 32769); +f(140735340871680, 65535); +f(140737488355328, 65536); +f(140739635838976, 65537); +f(281472829227008, 131071); +f(281474976710656, 131072); +f(281477124194304, 131073); +f(562947805937664, 262143); +f(562949953421312, 262144); +f(562952100904960, 262145); +f(1125897759358976, 524287); +f(1125899906842624, 524288); +f(1125902054326272, 524289); +x = 2147483649; +f(2147483649, 1); +f(4294967298, 2); +f(6442450947, 3); +f(8589934596, 4); +f(10737418245, 5); +f(15032385543, 7); +f(17179869192, 8); +f(19327352841, 9); +f(32212254735, 15); +f(34359738384, 16); +f(36507222033, 17); +f(66571993119, 31); +f(68719476768, 32); +f(70866960417, 33); +f(135291469887, 63); +f(137438953536, 64); +f(139586437185, 65); +f(272730423423, 127); +f(274877907072, 128); +f(277025390721, 129); +f(547608330495, 255); +f(549755814144, 256); +f(551903297793, 257); +f(1097364144639, 511); +f(1099511628288, 512); +f(1101659111937, 513); +f(2196875772927, 1023); +f(2199023256576, 1024); +f(2201170740225, 1025); +f(4395899029503, 2047); +f(4398046513152, 2048); +f(4400193996801, 2049); +f(8793945542655, 4095); +f(8796093026304, 4096); +f(8798240509953, 4097); +f(17590038568959, 8191); +f(17592186052608, 8192); +f(17594333536257, 8193); +f(35182224621567, 16383); +f(35184372105216, 16384); +f(35186519588865, 16385); +f(70366596726783, 32767); +f(70368744210432, 32768); +f(70370891694081, 32769); +f(140735340937215, 65535); +f(140737488420864, 65536); +f(140739635904513, 65537); +f(281472829358079, 131071); +f(281474976841728, 131072); +f(281477124325377, 131073); +f(562947806199807, 262143); +f(562949953683456, 262144); +f(562952101167105, 262145); +f(1125897759883263, 524287); +f(1125899907366912, 524288); +f(1125902054850561, 524289); +x = 4294967295; +f(4294967295, 1); +f(8589934590, 2); +f(12884901885, 3); +f(17179869180, 4); +f(21474836475, 5); +f(30064771065, 7); +f(34359738360, 8); +f(38654705655, 9); +f(64424509425, 15); +f(68719476720, 16); +f(73014444015, 17); +f(133143986145, 31); +f(137438953440, 32); +f(141733920735, 33); +f(270582939585, 63); +f(274877906880, 64); +f(279172874175, 65); +f(545460846465, 127); +f(549755813760, 128); +f(554050781055, 129); +f(1095216660225, 255); +f(1099511627520, 256); +f(1103806594815, 257); +f(2194728287745, 511); +f(2199023255040, 512); +f(2203318222335, 513); +f(4393751542785, 1023); +f(4398046510080, 1024); +f(4402341477375, 1025); +f(8791798052865, 2047); +f(8796093020160, 2048); +f(8800387987455, 2049); +f(17587891073025, 4095); +f(17592186040320, 4096); +f(17596481007615, 4097); +f(35180077113345, 8191); +f(35184372080640, 8192); +f(35188667047935, 8193); +f(70364449193985, 16383); +f(70368744161280, 16384); +f(70373039128575, 16385); +f(140733193355265, 32767); +f(140737488322560, 32768); +f(140741783289855, 32769); +f(281470681677825, 65535); +f(281474976645120, 65536); +f(281479271612415, 65537); +f(562945658322945, 131071); +f(562949953290240, 131072); +f(562954248257535, 131073); +f(1125895611613185, 262143); +f(1125899906580480, 262144); +f(1125904201547775, 262145); +x = 4294967296; +f(4294967296, 1); +f(8589934592, 2); +f(12884901888, 3); +f(17179869184, 4); +f(21474836480, 5); +f(30064771072, 7); +f(34359738368, 8); +f(38654705664, 9); +f(64424509440, 15); +f(68719476736, 16); +f(73014444032, 17); +f(133143986176, 31); +f(137438953472, 32); +f(141733920768, 33); +f(270582939648, 63); +f(274877906944, 64); +f(279172874240, 65); +f(545460846592, 127); +f(549755813888, 128); +f(554050781184, 129); +f(1095216660480, 255); +f(1099511627776, 256); +f(1103806595072, 257); +f(2194728288256, 511); +f(2199023255552, 512); +f(2203318222848, 513); +f(4393751543808, 1023); +f(4398046511104, 1024); +f(4402341478400, 1025); +f(8791798054912, 2047); +f(8796093022208, 2048); +f(8800387989504, 2049); +f(17587891077120, 4095); +f(17592186044416, 4096); +f(17596481011712, 4097); +f(35180077121536, 8191); +f(35184372088832, 8192); +f(35188667056128, 8193); +f(70364449210368, 16383); +f(70368744177664, 16384); +f(70373039144960, 16385); +f(140733193388032, 32767); +f(140737488355328, 32768); +f(140741783322624, 32769); +f(281470681743360, 65535); +f(281474976710656, 65536); +f(281479271677952, 65537); +f(562945658454016, 131071); +f(562949953421312, 131072); +f(562954248388608, 131073); +f(1125895611875328, 262143); +f(1125899906842624, 262144); +f(1125904201809920, 262145); +x = 4294967297; +f(4294967297, 1); +f(8589934594, 2); +f(12884901891, 3); +f(17179869188, 4); +f(21474836485, 5); +f(30064771079, 7); +f(34359738376, 8); +f(38654705673, 9); +f(64424509455, 15); +f(68719476752, 16); +f(73014444049, 17); +f(133143986207, 31); +f(137438953504, 32); +f(141733920801, 33); +f(270582939711, 63); +f(274877907008, 64); +f(279172874305, 65); +f(545460846719, 127); +f(549755814016, 128); +f(554050781313, 129); +f(1095216660735, 255); +f(1099511628032, 256); +f(1103806595329, 257); +f(2194728288767, 511); +f(2199023256064, 512); +f(2203318223361, 513); +f(4393751544831, 1023); +f(4398046512128, 1024); +f(4402341479425, 1025); +f(8791798056959, 2047); +f(8796093024256, 2048); +f(8800387991553, 2049); +f(17587891081215, 4095); +f(17592186048512, 4096); +f(17596481015809, 4097); +f(35180077129727, 8191); +f(35184372097024, 8192); +f(35188667064321, 8193); +f(70364449226751, 16383); +f(70368744194048, 16384); +f(70373039161345, 16385); +f(140733193420799, 32767); +f(140737488388096, 32768); +f(140741783355393, 32769); +f(281470681808895, 65535); +f(281474976776192, 65536); +f(281479271743489, 65537); +f(562945658585087, 131071); +f(562949953552384, 131072); +f(562954248519681, 131073); +f(1125895612137471, 262143); +f(1125899907104768, 262144); +f(1125904202072065, 262145); +x = 8589934591; +f(8589934591, 1); +f(17179869182, 2); +f(25769803773, 3); +f(34359738364, 4); +f(42949672955, 5); +f(60129542137, 7); +f(68719476728, 8); +f(77309411319, 9); +f(128849018865, 15); +f(137438953456, 16); +f(146028888047, 17); +f(266287972321, 31); +f(274877906912, 32); +f(283467841503, 33); +f(541165879233, 63); +f(549755813824, 64); +f(558345748415, 65); +f(1090921693057, 127); +f(1099511627648, 128); +f(1108101562239, 129); +f(2190433320705, 255); +f(2199023255296, 256); +f(2207613189887, 257); +f(4389456576001, 511); +f(4398046510592, 512); +f(4406636445183, 513); +f(8787503086593, 1023); +f(8796093021184, 1024); +f(8804682955775, 1025); +f(17583596107777, 2047); +f(17592186042368, 2048); +f(17600775976959, 2049); +f(35175782150145, 4095); +f(35184372084736, 4096); +f(35192962019327, 4097); +f(70360154234881, 8191); +f(70368744169472, 8192); +f(70377334104063, 8193); +f(140728898404353, 16383); +f(140737488338944, 16384); +f(140746078273535, 16385); +f(281466386743297, 32767); +f(281474976677888, 32768); +f(281483566612479, 32769); +f(562941363421185, 65535); +f(562949953355776, 65536); +f(562958543290367, 65537); +f(1125891316776961, 131071); +f(1125899906711552, 131072); +f(1125908496646143, 131073); +x = 8589934592; +f(8589934592, 1); +f(17179869184, 2); +f(25769803776, 3); +f(34359738368, 4); +f(42949672960, 5); +f(60129542144, 7); +f(68719476736, 8); +f(77309411328, 9); +f(128849018880, 15); +f(137438953472, 16); +f(146028888064, 17); +f(266287972352, 31); +f(274877906944, 32); +f(283467841536, 33); +f(541165879296, 63); +f(549755813888, 64); +f(558345748480, 65); +f(1090921693184, 127); +f(1099511627776, 128); +f(1108101562368, 129); +f(2190433320960, 255); +f(2199023255552, 256); +f(2207613190144, 257); +f(4389456576512, 511); +f(4398046511104, 512); +f(4406636445696, 513); +f(8787503087616, 1023); +f(8796093022208, 1024); +f(8804682956800, 1025); +f(17583596109824, 2047); +f(17592186044416, 2048); +f(17600775979008, 2049); +f(35175782154240, 4095); +f(35184372088832, 4096); +f(35192962023424, 4097); +f(70360154243072, 8191); +f(70368744177664, 8192); +f(70377334112256, 8193); +f(140728898420736, 16383); +f(140737488355328, 16384); +f(140746078289920, 16385); +f(281466386776064, 32767); +f(281474976710656, 32768); +f(281483566645248, 32769); +f(562941363486720, 65535); +f(562949953421312, 65536); +f(562958543355904, 65537); +f(1125891316908032, 131071); +f(1125899906842624, 131072); +f(1125908496777216, 131073); +x = 8589934593; +f(8589934593, 1); +f(17179869186, 2); +f(25769803779, 3); +f(34359738372, 4); +f(42949672965, 5); +f(60129542151, 7); +f(68719476744, 8); +f(77309411337, 9); +f(128849018895, 15); +f(137438953488, 16); +f(146028888081, 17); +f(266287972383, 31); +f(274877906976, 32); +f(283467841569, 33); +f(541165879359, 63); +f(549755813952, 64); +f(558345748545, 65); +f(1090921693311, 127); +f(1099511627904, 128); +f(1108101562497, 129); +f(2190433321215, 255); +f(2199023255808, 256); +f(2207613190401, 257); +f(4389456577023, 511); +f(4398046511616, 512); +f(4406636446209, 513); +f(8787503088639, 1023); +f(8796093023232, 1024); +f(8804682957825, 1025); +f(17583596111871, 2047); +f(17592186046464, 2048); +f(17600775981057, 2049); +f(35175782158335, 4095); +f(35184372092928, 4096); +f(35192962027521, 4097); +f(70360154251263, 8191); +f(70368744185856, 8192); +f(70377334120449, 8193); +f(140728898437119, 16383); +f(140737488371712, 16384); +f(140746078306305, 16385); +f(281466386808831, 32767); +f(281474976743424, 32768); +f(281483566678017, 32769); +f(562941363552255, 65535); +f(562949953486848, 65536); +f(562958543421441, 65537); +f(1125891317039103, 131071); +f(1125899906973696, 131072); +f(1125908496908289, 131073); +x = 17179869183; +f(17179869183, 1); +f(34359738366, 2); +f(51539607549, 3); +f(68719476732, 4); +f(85899345915, 5); +f(120259084281, 7); +f(137438953464, 8); +f(154618822647, 9); +f(257698037745, 15); +f(274877906928, 16); +f(292057776111, 17); +f(532575944673, 31); +f(549755813856, 32); +f(566935683039, 33); +f(1082331758529, 63); +f(1099511627712, 64); +f(1116691496895, 65); +f(2181843386241, 127); +f(2199023255424, 128); +f(2216203124607, 129); +f(4380866641665, 255); +f(4398046510848, 256); +f(4415226380031, 257); +f(8778913152513, 511); +f(8796093021696, 512); +f(8813272890879, 513); +f(17575006174209, 1023); +f(17592186043392, 1024); +f(17609365912575, 1025); +f(35167192217601, 2047); +f(35184372086784, 2048); +f(35201551955967, 2049); +f(70351564304385, 4095); +f(70368744173568, 4096); +f(70385924042751, 4097); +f(140720308477953, 8191); +f(140737488347136, 8192); +f(140754668216319, 8193); +f(281457796825089, 16383); +f(281474976694272, 16384); +f(281492156563455, 16385); +f(562932773519361, 32767); +f(562949953388544, 32768); +f(562967133257727, 32769); +f(1125882726907905, 65535); +f(1125899906777088, 65536); +f(1125917086646271, 65537); +x = 17179869184; +f(17179869184, 1); +f(34359738368, 2); +f(51539607552, 3); +f(68719476736, 4); +f(85899345920, 5); +f(120259084288, 7); +f(137438953472, 8); +f(154618822656, 9); +f(257698037760, 15); +f(274877906944, 16); +f(292057776128, 17); +f(532575944704, 31); +f(549755813888, 32); +f(566935683072, 33); +f(1082331758592, 63); +f(1099511627776, 64); +f(1116691496960, 65); +f(2181843386368, 127); +f(2199023255552, 128); +f(2216203124736, 129); +f(4380866641920, 255); +f(4398046511104, 256); +f(4415226380288, 257); +f(8778913153024, 511); +f(8796093022208, 512); +f(8813272891392, 513); +f(17575006175232, 1023); +f(17592186044416, 1024); +f(17609365913600, 1025); +f(35167192219648, 2047); +f(35184372088832, 2048); +f(35201551958016, 2049); +f(70351564308480, 4095); +f(70368744177664, 4096); +f(70385924046848, 4097); +f(140720308486144, 8191); +f(140737488355328, 8192); +f(140754668224512, 8193); +f(281457796841472, 16383); +f(281474976710656, 16384); +f(281492156579840, 16385); +f(562932773552128, 32767); +f(562949953421312, 32768); +f(562967133290496, 32769); +f(1125882726973440, 65535); +f(1125899906842624, 65536); +f(1125917086711808, 65537); +x = 17179869185; +f(17179869185, 1); +f(34359738370, 2); +f(51539607555, 3); +f(68719476740, 4); +f(85899345925, 5); +f(120259084295, 7); +f(137438953480, 8); +f(154618822665, 9); +f(257698037775, 15); +f(274877906960, 16); +f(292057776145, 17); +f(532575944735, 31); +f(549755813920, 32); +f(566935683105, 33); +f(1082331758655, 63); +f(1099511627840, 64); +f(1116691497025, 65); +f(2181843386495, 127); +f(2199023255680, 128); +f(2216203124865, 129); +f(4380866642175, 255); +f(4398046511360, 256); +f(4415226380545, 257); +f(8778913153535, 511); +f(8796093022720, 512); +f(8813272891905, 513); +f(17575006176255, 1023); +f(17592186045440, 1024); +f(17609365914625, 1025); +f(35167192221695, 2047); +f(35184372090880, 2048); +f(35201551960065, 2049); +f(70351564312575, 4095); +f(70368744181760, 4096); +f(70385924050945, 4097); +f(140720308494335, 8191); +f(140737488363520, 8192); +f(140754668232705, 8193); +f(281457796857855, 16383); +f(281474976727040, 16384); +f(281492156596225, 16385); +f(562932773584895, 32767); +f(562949953454080, 32768); +f(562967133323265, 32769); +f(1125882727038975, 65535); +f(1125899906908160, 65536); +f(1125917086777345, 65537); diff --git a/deps/v8/test/mjsunit/multiple-return.js b/deps/v8/test/mjsunit/multiple-return.js new file mode 100644 index 0000000000..610a367f6d --- /dev/null +++ b/deps/v8/test/mjsunit/multiple-return.js @@ -0,0 +1,62 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function F() { + for (var x in [1,2,3]) { + return 42; + } + return 87; +} + + +function G() { + for (var x in [1,2,3]) { + try { + return 42; + } finally { + // Do nothing. + } + } + return 87; +} + + +function H() { + for (var x in [1,2,3]) { + try { + return 42; + } catch (e) { + // Do nothing. + } + } + return 87; +} + + +assertEquals(42, F()); +assertEquals(42, G()); +assertEquals(42, H()); diff --git a/deps/v8/test/mjsunit/negate-zero.js b/deps/v8/test/mjsunit/negate-zero.js new file mode 100644 index 0000000000..31d460a2de --- /dev/null +++ b/deps/v8/test/mjsunit/negate-zero.js @@ -0,0 +1,42 @@ +// Copyright 2008 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 IsNegativeZero(x) { + assertEquals(0, x); + var y = 1 / x; + assertFalse(isFinite(y)); + return y < 0; +} + +var pz = 0; +var nz = -0; + +assertTrue(IsNegativeZero(nz), "-0"); +assertFalse(IsNegativeZero(-nz), "-(-0)"); + +assertFalse(IsNegativeZero(pz), "0"); +assertTrue(IsNegativeZero(-pz), "-(0)"); diff --git a/deps/v8/test/mjsunit/negate.js b/deps/v8/test/mjsunit/negate.js new file mode 100644 index 0000000000..3bf411156b --- /dev/null +++ b/deps/v8/test/mjsunit/negate.js @@ -0,0 +1,59 @@ +// Copyright 2008 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. + +const SMI_MAX = (1 << 30) - 1; +const SMI_MIN = -(1 << 30); + +function testmulneg(a, b) { + var base = a * b; + assertEquals(-base, a * -b); + assertEquals(-base, -a * b); + assertEquals(base, -a * -b); +} + +testmulneg(2, 3); +testmulneg(SMI_MAX, 3); +testmulneg(SMI_MIN, 3); +testmulneg(3.2, 2.3); + +var x = { valueOf: function() { return 2; } }; +var y = { valueOf: function() { return 3; } }; + +testmulneg(x, y); + +// The test below depends on the correct evaluation order, which is not +// implemented by any of the known JS engines. +var z; +var v = { valueOf: function() { z+=2; return z; } }; +var w = { valueOf: function() { z+=3; return z; } }; + +z = 0; +var base = v * w; +z = 0; +assertEquals(-base, -v * w); +z = 0; +assertEquals(base, -v * -w); diff --git a/deps/v8/test/mjsunit/new.js b/deps/v8/test/mjsunit/new.js new file mode 100644 index 0000000000..1062628b20 --- /dev/null +++ b/deps/v8/test/mjsunit/new.js @@ -0,0 +1,56 @@ +// Copyright 2008 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 Construct(x) { return x; } + +assertFalse(null == new Construct(null)); +assertFalse(void 0 == new Construct(void 0)); +assertFalse(0 == new Construct(0)); +assertFalse(1 == new Construct(1)); +assertFalse(4.2 == new Construct(4.2)); +assertFalse('foo' == new Construct('foo')); +assertFalse(true == new Construct(true)); + +x = {}; +assertTrue(x === new Construct(x)); +assertFalse(x === new Construct(null)); +assertFalse(x === new Construct(void 0)); +assertFalse(x === new Construct(1)); +assertFalse(x === new Construct(3.2)); +assertFalse(x === new Construct(false)); +assertFalse(x === new Construct('bar')); +x = []; +assertTrue(x === new Construct(x)); +x = new Boolean(true); +assertTrue(x === new Construct(x)); +x = new Number(42); +assertTrue(x === new Construct(x)); +x = new String('foo'); +assertTrue(x === new Construct(x)); +x = function() { }; +assertTrue(x === new Construct(x)); + diff --git a/deps/v8/test/mjsunit/newline-in-string.js b/deps/v8/test/mjsunit/newline-in-string.js new file mode 100644 index 0000000000..8c3ff86402 --- /dev/null +++ b/deps/v8/test/mjsunit/newline-in-string.js @@ -0,0 +1,46 @@ +// Copyright 2008 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 multiline string literal. +var str = 'asdf\ +\nasdf\ +\rasdf\ +\tasdf\ +\\\ +\ +'; +assertEquals('asdf\nasdf\rasdf\tasdf\\', str); + +// Allow CR+LF in multiline string literals. +var code = "'asdf\\" + String.fromCharCode(0xD) + String.fromCharCode(0xA) + "asdf'"; +assertEquals('asdfasdf', eval(code)); + +// Allow LF+CR in multiline string literals. +code = "'asdf\\" + String.fromCharCode(0xA) + String.fromCharCode(0xD) + "asdf'"; +assertEquals('asdfasdf', eval(code)); + + diff --git a/deps/v8/test/mjsunit/no-branch-elimination.js b/deps/v8/test/mjsunit/no-branch-elimination.js new file mode 100644 index 0000000000..538039b232 --- /dev/null +++ b/deps/v8/test/mjsunit/no-branch-elimination.js @@ -0,0 +1,36 @@ +// Copyright 2008 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. + +// Branch elimination on ARM build eliminate bl branches. It was wrong. + +if (1 & true) { } + +try { + throw "error"; +} catch (e) { + assertEquals("error", e); +} diff --git a/deps/v8/test/mjsunit/no-octal-constants-above-256.js b/deps/v8/test/mjsunit/no-octal-constants-above-256.js new file mode 100644 index 0000000000..1525d6ae99 --- /dev/null +++ b/deps/v8/test/mjsunit/no-octal-constants-above-256.js @@ -0,0 +1,32 @@ +// Copyright 2008 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. + +// Octal constants above \377 should not be allowed; instead they +// should parse as two-digit octals constants followed by digits. +assertEquals(2, "\400".length); +assertEquals("\40".charCodeAt(0), "\400".charCodeAt(0)); +assertEquals("0", "\400".charAt(1)); diff --git a/deps/v8/test/mjsunit/no-semicolon.js b/deps/v8/test/mjsunit/no-semicolon.js new file mode 100644 index 0000000000..fa6ccba89d --- /dev/null +++ b/deps/v8/test/mjsunit/no-semicolon.js @@ -0,0 +1,45 @@ +// Copyright 2008 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. + +// Random tests to make sure you can leave out semicolons +// in various places. + +function f() { return } + +function g() { + return + 4; +} + +assertTrue(f() === void 0); +assertTrue(g() === void 0); + +for (var i = 0; i < 10; i++) { break } +assertEquals(0, i); + +for (var i = 0; i < 10; i++) { continue } +assertEquals(10, i);
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/non-ascii-replace.js b/deps/v8/test/mjsunit/non-ascii-replace.js new file mode 100644 index 0000000000..2ccaed1063 --- /dev/null +++ b/deps/v8/test/mjsunit/non-ascii-replace.js @@ -0,0 +1,30 @@ +// Copyright 2008 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Regression test for bug #743664. +assertEquals("uu", "\x60\x60".replace(/\x60/g, "u")); +assertEquals("uu", "\xAB\xAB".replace(/\xAB/g, "u")); diff --git a/deps/v8/test/mjsunit/nul-characters.js b/deps/v8/test/mjsunit/nul-characters.js new file mode 100644 index 0000000000..22da82d2e0 --- /dev/null +++ b/deps/v8/test/mjsunit/nul-characters.js @@ -0,0 +1,38 @@ +// Copyright 2008 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 = [ '\0', '\u0000', '\x00' ] +for (var i in a) { + assertEquals(1, a[i].length); + assertEquals(0, a[i].charCodeAt(0)); +} + +assertEquals(7, 'foo\0bar'.length); +assertEquals(7, 'foo\x00bar'.length); +assertEquals(7, 'foo\u0000bar'.length); + +assertEquals(2, ('\0' + '\0').length); diff --git a/deps/v8/test/mjsunit/number-limits.js b/deps/v8/test/mjsunit/number-limits.js new file mode 100644 index 0000000000..1d9a1e5585 --- /dev/null +++ b/deps/v8/test/mjsunit/number-limits.js @@ -0,0 +1,43 @@ +// Copyright 2008 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 that Number.MAX_VALUE and Number.MIN_VALUE are extreme. +function testLimits() { + var i; var eps; + for (i = 0, eps = 1; i < 1100; i++, eps /= 2) { + var mulAboveMax = Number.MAX_VALUE * (1 + eps); + var addAboveMax = Number.MAX_VALUE + 1/eps; + var mulBelowMin = Number.MIN_VALUE * (1 - eps); + var addBelowMin = Number.MIN_VALUE - eps; + assertTrue(mulAboveMax == Number.MAX_VALUE || mulAboveMax == Infinity); + assertTrue(addAboveMax == Number.MAX_VALUE || addAboveMax == Infinity); + assertTrue(mulBelowMin == Number.MIN_VALUE || mulBelowMin <= 0); + assertTrue(addBelowMin == Number.MIN_VALUE || addBelowMin <= 0); + } +} + +testLimits(); diff --git a/deps/v8/test/mjsunit/number-string-index-call.js b/deps/v8/test/mjsunit/number-string-index-call.js new file mode 100644 index 0000000000..6f540c008b --- /dev/null +++ b/deps/v8/test/mjsunit/number-string-index-call.js @@ -0,0 +1,32 @@ +// Copyright 2008 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: --call_regexp +var callbacks = [ function() {return 'foo'}, "nonobject", /abc/ ]; +assertEquals('foo', callbacks['0']()); +assertThrows("callbacks['1']()"); +assertEquals('abc', callbacks['2']("abcdefg")); diff --git a/deps/v8/test/mjsunit/number-tostring-small.js b/deps/v8/test/mjsunit/number-tostring-small.js new file mode 100644 index 0000000000..dbd2b59235 --- /dev/null +++ b/deps/v8/test/mjsunit/number-tostring-small.js @@ -0,0 +1,395 @@ +// Copyright 2008 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. + +// This file is a concatenation of the number-tostring and +// to-precision mjsunit tests where the mjsunit assert code has been +// removed. + +// ---------------------------------------------------------------------- +// toString +(NaN).toString(); +(1/0).toString(); +(-1/0).toString(); +(0).toString(); +(9).toString(); +(90).toString(); +(90.12).toString(); +(0.1).toString(); +(0.01).toString(); +(0.0123).toString(); +(111111111111111111111).toString(); +(1111111111111111111111).toString(); +(11111111111111111111111).toString(); +(0.00001).toString(); +(0.000001).toString(); +(0.0000001).toString(); +(0.00000012).toString(); +(0.000000123).toString(); +(0.00000001).toString(); +(0.000000012).toString(); +(0.0000000123).toString(); + +(-0).toString(); +(-9).toString(); +(-90).toString(); +(-90.12).toString(); +(-0.1).toString(); +(-0.01).toString(); +(-0.0123).toString(); +(-111111111111111111111).toString(); +(-1111111111111111111111).toString(); +(-11111111111111111111111).toString(); +(-0.00001).toString(); +(-0.000001).toString(); +(-0.0000001).toString(); +(-0.00000012).toString(); +(-0.000000123).toString(); +(-0.00000001).toString(); +(-0.000000012).toString(); +(-0.0000000123).toString(); + +(NaN).toString(16); +(1/0).toString(16); +(-1/0).toString(16); +(0).toString(16); +(9).toString(16); +(90).toString(16); +(90.12).toString(16); +(0.1).toString(16); +(0.01).toString(16); +(0.0123).toString(16); +(111111111111111111111).toString(16); +(1111111111111111111111).toString(16); +(11111111111111111111111).toString(16); +(0.00001).toString(16); +(0.000001).toString(16); +(0.0000001).toString(16); +(0.00000012).toString(16); +(0.000000123).toString(16); +(0.00000001).toString(16); +(0.000000012).toString(16); +(0.0000000123).toString(16); + +(-0).toString(16); +(-9).toString(16); +(-90).toString(16); +(-90.12).toString(16); +(-0.1).toString(16); +(-0.01).toString(16); +(-0.0123).toString(16); +(-111111111111111111111).toString(16); +(-1111111111111111111111).toString(16); +(-11111111111111111111111).toString(16); +(-0.00001).toString(16); +(-0.000001).toString(16); +(-0.0000001).toString(16); +(-0.00000012).toString(16); +(-0.000000123).toString(16); +(-0.00000001).toString(16); +(-0.000000012).toString(16); +(-0.0000000123).toString(16); + +(2,32).toString(); +(Math.pow(2,32)-1).toString(16); +(Math.pow(2,32)-1).toString(2); +(10000007).toString(36); +(0).toString(36); +(0).toString(16); +(0).toString(10); +(0).toString(8); +(0).toString(2); +(2,32).toString(2); +(Math.pow(2,32) + 1).toString(2); +(0x100000000000081).toString(16); +(-(-'0x1000000000000081')).toString(16); +(0x100000000000081).toString(2); +(-(Math.pow(2,32)-1)).toString(2); +(-10000007).toString(36); +(-Math.pow(2,32)).toString(2); +(-(Math.pow(2,32) + 1)).toString(2); +(-0x100000000000081).toString(16); +(-0x100000000000081).toString(2); +(1000).toString(); +(0.00001).toString(); +(1000000000000000128).toString(); +(1000000000000000012800).toString(); +(-1000000000000000012800).toString(); +(0.0000001).toString(); +(-0.0000001).toString(); +(1000000000000000128000).toString(); +(0.000001).toString(); +(0.0000001).toString(); +(8.5).toString(16); +(-8.5).toString(16); + +// ---------------------------------------------------------------------- +// toFixed +(NaN).toFixed(2); +(1/0).toFixed(2); +(-1/0).toFixed(2); + +(1111111111111111111111).toFixed(8); +(0.1).toFixed(1); +(0.1).toFixed(2); +(0.1).toFixed(3); +(0.01).toFixed(2); +(0.01).toFixed(3); +(0.01).toFixed(4); +(0.001).toFixed(2); +(0.001).toFixed(3); +(0.001).toFixed(4); +(1).toFixed(4); +(1).toFixed(1); +(1).toFixed(0); +(12).toFixed(0); +(1.1).toFixed(0); +(12.1).toFixed(0); +(1.12).toFixed(0); +(12.12).toFixed(0); +(0.0000006).toFixed(7); +(0.00000006).toFixed(8); +(0.00000006).toFixed(9); +(0.00000006).toFixed(10); +(0).toFixed(0); +(0).toFixed(1); +(0).toFixed(2); + +(-1111111111111111111111).toFixed(8); +(-0.1).toFixed(1); +(-0.1).toFixed(2); +(-0.1).toFixed(3); +(-0.01).toFixed(2); +(-0.01).toFixed(3); +(-0.01).toFixed(4); +(-0.001).toFixed(2); +(-0.001).toFixed(3); +(-0.001).toFixed(4); +(-1).toFixed(4); +(-1).toFixed(1); +(-1).toFixed(0); +(-1.1).toFixed(0); +(-12.1).toFixed(0); +(-1.12).toFixed(0); +(-12.12).toFixed(0); +(-0.0000006).toFixed(7); +(-0.00000006).toFixed(8); +(-0.00000006).toFixed(9); +(-0.00000006).toFixed(10); +(-0).toFixed(0); +(-0).toFixed(1); +(-0).toFixed(2); + +(1000).toFixed(); +(0.00001).toFixed(); +(0.00001).toFixed(5); +(0.0000000000000000001).toFixed(20); +(0.00001).toFixed(17); +(1).toFixed(17); +(1000000000000000128).toFixed(); +(100000000000000128).toFixed(1); +(10000000000000128).toFixed(2); +(10000000000000128).toFixed(20); +(0).toFixed(); +((-42).toFixed(3)); +(-1000000000000000128).toFixed(); +(-0.0000000000000000001).toFixed(20); +(0.123123123123123).toFixed(20); +// Test that we round up even when the last digit generated is even. +// dtoa does not do this in its original form. +(0.5).toFixed(0); +(-0.5).toFixed(0); +(1.25).toFixed(1); +// This is bizare, but Spidermonkey and KJS behave the same. +(234.20405).toFixed(4); +(234.2040506).toFixed(4); + +// ---------------------------------------------------------------------- +// toExponential +(1).toExponential(); +(11).toExponential(); +(112).toExponential(); +(1).toExponential(0); +(11).toExponential(0); +(112).toExponential(0); +(1).toExponential(1); +(11).toExponential(1); +(112).toExponential(1); +(1).toExponential(2); +(11).toExponential(2); +(112).toExponential(2); +(1).toExponential(3); +(11).toExponential(3); +(112).toExponential(3); +(0.1).toExponential(); +(0.11).toExponential(); +(0.112).toExponential(); +(0.1).toExponential(0); +(0.11).toExponential(0); +(0.112).toExponential(0); +(0.1).toExponential(1); +(0.11).toExponential(1); +(0.112).toExponential(1); +(0.1).toExponential(2); +(0.11).toExponential(2); +(0.112).toExponential(2); +(0.1).toExponential(3); +(0.11).toExponential(3); +(0.112).toExponential(3); + +(-1).toExponential(); +(-11).toExponential(); +(-112).toExponential(); +(-1).toExponential(0); +(-11).toExponential(0); +(-112).toExponential(0); +(-1).toExponential(1); +(-11).toExponential(1); +(-112).toExponential(1); +(-1).toExponential(2); +(-11).toExponential(2); +(-112).toExponential(2); +(-1).toExponential(3); +(-11).toExponential(3); +(-112).toExponential(3); +(-0.1).toExponential(); +(-0.11).toExponential(); +(-0.112).toExponential(); +(-0.1).toExponential(0); +(-0.11).toExponential(0); +(-0.112).toExponential(0); +(-0.1).toExponential(1); +(-0.11).toExponential(1); +(-0.112).toExponential(1); +(-0.1).toExponential(2); +(-0.11).toExponential(2); +(-0.112).toExponential(2); +(-0.1).toExponential(3); +(-0.11).toExponential(3); +(-0.112).toExponential(3); + +(NaN).toExponential(2); +(Infinity).toExponential(2); +(-Infinity).toExponential(2); +(1).toExponential(0); +(0).toExponential(); +(0).toExponential(2); +(11.2356).toExponential(0); +(11.2356).toExponential(4); +(0.000112356).toExponential(4); +(-0.000112356).toExponential(4); +(0.000112356).toExponential(); +(-0.000112356).toExponential(); + +// ---------------------------------------------------------------------- +// toPrecision +(NaN).toPrecision(1); +(Infinity).toPrecision(2); +(-Infinity).toPrecision(2); +(0.000555).toPrecision(15); +(0.000000555).toPrecision(15); +(-0.000000555).toPrecision(15); +(123456789).toPrecision(1); +(123456789).toPrecision(9); +(123456789).toPrecision(8); +(123456789).toPrecision(7); +(-123456789).toPrecision(7); +(-.0000000012345).toPrecision(2); +(-.000000012345).toPrecision(2); +(-.00000012345).toPrecision(2); +(-.0000012345).toPrecision(2); +(-.000012345).toPrecision(2); +(-.00012345).toPrecision(2); +(-.0012345).toPrecision(2); +(-.012345).toPrecision(2); +(-.12345).toPrecision(2); +(-1.2345).toPrecision(2); +(-12.345).toPrecision(2); +(-123.45).toPrecision(2); +(-1234.5).toPrecision(2); +(-12345).toPrecision(2); +(-12345.67).toPrecision(4); +Number(-12344.67).toPrecision(4); +// Test that we round up even when the last digit generated is even. +// dtoa does not do this in its original form. +(1.25).toPrecision(2); +(1.35).toPrecision(2); + +// Test the exponential notation output. +(1.2345e+27).toPrecision(1); +(1.2345e+27).toPrecision(2); +(1.2345e+27).toPrecision(3); +(1.2345e+27).toPrecision(4); +(1.2345e+27).toPrecision(5); +(1.2345e+27).toPrecision(6); +(1.2345e+27).toPrecision(7); + +(-1.2345e+27).toPrecision(1); +(-1.2345e+27).toPrecision(2); +(-1.2345e+27).toPrecision(3); +(-1.2345e+27).toPrecision(4); +(-1.2345e+27).toPrecision(5); +(-1.2345e+27).toPrecision(6); +(-1.2345e+27).toPrecision(7); + + +// Test the fixed notation output. +(7).toPrecision(1); +(7).toPrecision(2); +(7).toPrecision(3); + +(-7).toPrecision(1); +(-7).toPrecision(2); +(-7).toPrecision(3); + +(91).toPrecision(1); +(91).toPrecision(2); +(91).toPrecision(3); +(91).toPrecision(4); + +(-91).toPrecision(1); +(-91).toPrecision(2); +(-91).toPrecision(3); +(-91).toPrecision(4); + +(91.1234).toPrecision(1); +(91.1234).toPrecision(2); +(91.1234).toPrecision(3); +(91.1234).toPrecision(4); +(91.1234).toPrecision(5); +(91.1234).toPrecision(6); +(91.1234).toPrecision(7); +(91.1234).toPrecision(8); + +(-91.1234).toPrecision(1); +(-91.1234).toPrecision(2); +(-91.1234).toPrecision(3); +(-91.1234).toPrecision(4); +(-91.1234).toPrecision(5); +(-91.1234).toPrecision(6); +(-91.1234).toPrecision(7); +(-91.1234).toPrecision(8); + diff --git a/deps/v8/test/mjsunit/number-tostring.js b/deps/v8/test/mjsunit/number-tostring.js new file mode 100644 index 0000000000..04d027ff57 --- /dev/null +++ b/deps/v8/test/mjsunit/number-tostring.js @@ -0,0 +1,338 @@ +// Copyright 2008 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. + +// ---------------------------------------------------------------------- +// toString +assertEquals("NaN", (NaN).toString()); +assertEquals("Infinity", (1/0).toString()); +assertEquals("-Infinity", (-1/0).toString()); +assertEquals("0", (0).toString()); +assertEquals("9", (9).toString()); +assertEquals("90", (90).toString()); +assertEquals("90.12", (90.12).toString()); +assertEquals("0.1", (0.1).toString()); +assertEquals("0.01", (0.01).toString()); +assertEquals("0.0123", (0.0123).toString()); +assertEquals("111111111111111110000", (111111111111111111111).toString()); +assertEquals("1.1111111111111111e+21", (1111111111111111111111).toString()); +assertEquals("1.1111111111111111e+22", (11111111111111111111111).toString()); +assertEquals("0.00001", (0.00001).toString()); +assertEquals("0.000001", (0.000001).toString()); +assertEquals("1e-7", (0.0000001).toString()); +assertEquals("1.2e-7", (0.00000012).toString()); +assertEquals("1.23e-7", (0.000000123).toString()); +assertEquals("1e-8", (0.00000001).toString()); +assertEquals("1.2e-8", (0.000000012).toString()); +assertEquals("1.23e-8", (0.0000000123).toString()); + +assertEquals("0", (-0).toString()); +assertEquals("-9", (-9).toString()); +assertEquals("-90", (-90).toString()); +assertEquals("-90.12", (-90.12).toString()); +assertEquals("-0.1", (-0.1).toString()); +assertEquals("-0.01", (-0.01).toString()); +assertEquals("-0.0123", (-0.0123).toString()) +assertEquals("-111111111111111110000", (-111111111111111111111).toString()); +assertEquals("-1.1111111111111111e+21", (-1111111111111111111111).toString()); +assertEquals("-1.1111111111111111e+22", (-11111111111111111111111).toString()); +assertEquals("-0.00001", (-0.00001).toString()); +assertEquals("-0.000001", (-0.000001).toString()); +assertEquals("-1e-7", (-0.0000001).toString()); +assertEquals("-1.2e-7", (-0.00000012).toString()); +assertEquals("-1.23e-7", (-0.000000123).toString()); +assertEquals("-1e-8", (-0.00000001).toString()); +assertEquals("-1.2e-8", (-0.000000012).toString()); +assertEquals("-1.23e-8", (-0.0000000123).toString()); + +assertEquals("NaN", (NaN).toString(16)); +assertEquals("Infinity", (1/0).toString(16)); +assertEquals("-Infinity", (-1/0).toString(16)); +assertEquals("0", (0).toString(16)); +assertEquals("9", (9).toString(16)); +assertEquals("5a", (90).toString(16)); +assertEquals("5a.1eb851eb852", (90.12).toString(16)); +assertEquals("0.1999999999999a", (0.1).toString(16)); +assertEquals("0.028f5c28f5c28f6", (0.01).toString(16)); +assertEquals("0.032617c1bda511a", (0.0123).toString(16)); +assertEquals("605f9f6dd18bc8000", (111111111111111111111).toString(16)); +assertEquals("3c3bc3a4a2f75c0000", (1111111111111111111111).toString(16)); +assertEquals("25a55a46e5da9a00000", (11111111111111111111111).toString(16)); +assertEquals("0.0000a7c5ac471b4788", (0.00001).toString(16)); +assertEquals("0.000010c6f7a0b5ed8d", (0.000001).toString(16)); +assertEquals("0.000001ad7f29abcaf48", (0.0000001).toString(16)); +assertEquals("0.000002036565348d256", (0.00000012).toString(16)); +assertEquals("0.0000021047ee22aa466", (0.000000123).toString(16)); +assertEquals("0.0000002af31dc4611874", (0.00000001).toString(16)); +assertEquals("0.000000338a23b87483be", (0.000000012).toString(16)); +assertEquals("0.00000034d3fe36aaa0a2", (0.0000000123).toString(16)); + +assertEquals("0", (-0).toString(16)); +assertEquals("-9", (-9).toString(16)); +assertEquals("-5a", (-90).toString(16)); +assertEquals("-5a.1eb851eb852", (-90.12).toString(16)); +assertEquals("-0.1999999999999a", (-0.1).toString(16)); +assertEquals("-0.028f5c28f5c28f6", (-0.01).toString(16)); +assertEquals("-0.032617c1bda511a", (-0.0123).toString(16)); +assertEquals("-605f9f6dd18bc8000", (-111111111111111111111).toString(16)); +assertEquals("-3c3bc3a4a2f75c0000", (-1111111111111111111111).toString(16)); +assertEquals("-25a55a46e5da9a00000", (-11111111111111111111111).toString(16)); +assertEquals("-0.0000a7c5ac471b4788", (-0.00001).toString(16)); +assertEquals("-0.000010c6f7a0b5ed8d", (-0.000001).toString(16)); +assertEquals("-0.000001ad7f29abcaf48", (-0.0000001).toString(16)); +assertEquals("-0.000002036565348d256", (-0.00000012).toString(16)); +assertEquals("-0.0000021047ee22aa466", (-0.000000123).toString(16)); +assertEquals("-0.0000002af31dc4611874", (-0.00000001).toString(16)); +assertEquals("-0.000000338a23b87483be", (-0.000000012).toString(16)); +assertEquals("-0.00000034d3fe36aaa0a2", (-0.0000000123).toString(16)); + +assertEquals("4294967296", Math.pow(2,32).toString()); +assertEquals("ffffffff", (Math.pow(2,32)-1).toString(16)); +assertEquals("11111111111111111111111111111111", (Math.pow(2,32)-1).toString(2)); +assertEquals("5yc1z", (10000007).toString(36)); +assertEquals("0", (0).toString(36)); +assertEquals("0", (0).toString(16)); +assertEquals("0", (0).toString(10)); +assertEquals("0", (0).toString(8)); +assertEquals("0", (0).toString(2)); +assertEquals("100000000000000000000000000000000", Math.pow(2,32).toString(2)); +assertEquals("100000000000000000000000000000001", (Math.pow(2,32) + 1).toString(2)); +assertEquals("100000000000080", (0x100000000000081).toString(16)); +assertEquals("1000000000000100", (-(-'0x1000000000000081')).toString(16)); +assertEquals("100000000000000000000000000000000000000000000000010000000", (0x100000000000081).toString(2)); +assertEquals("-11111111111111111111111111111111", (-(Math.pow(2,32)-1)).toString(2)); +assertEquals("-5yc1z", (-10000007).toString(36)); +assertEquals("-100000000000000000000000000000000", (-Math.pow(2,32)).toString(2)); +assertEquals("-100000000000000000000000000000001", (-(Math.pow(2,32) + 1)).toString(2)); +assertEquals("-100000000000080", (-0x100000000000081).toString(16)); +assertEquals("-100000000000000000000000000000000000000000000000010000000", (-0x100000000000081).toString(2)); +assertEquals("1000", (1000).toString()); +assertEquals("0.00001", (0.00001).toString()); +assertEquals("1000000000000000100", (1000000000000000128).toString()); +assertEquals("1e+21", (1000000000000000012800).toString()); +assertEquals("-1e+21", (-1000000000000000012800).toString()); +assertEquals("1e-7", (0.0000001).toString()); +assertEquals("-1e-7", (-0.0000001).toString()); +assertEquals("1.0000000000000001e+21", (1000000000000000128000).toString()); +assertEquals("0.000001", (0.000001).toString()); +assertEquals("1e-7", (0.0000001).toString()); +assertEquals("8.8", (8.5).toString(16)); +assertEquals("-8.8", (-8.5).toString(16)); + +// ---------------------------------------------------------------------- +// toFixed +assertEquals("NaN", (NaN).toFixed(2)); +assertEquals("Infinity", (1/0).toFixed(2)); +assertEquals("-Infinity", (-1/0).toFixed(2)); + +assertEquals("1.1111111111111111e+21", (1111111111111111111111).toFixed(8)); +assertEquals("0.1", (0.1).toFixed(1)); +assertEquals("0.10", (0.1).toFixed(2)); +assertEquals("0.100", (0.1).toFixed(3)); +assertEquals("0.01", (0.01).toFixed(2)); +assertEquals("0.010", (0.01).toFixed(3)); +assertEquals("0.0100", (0.01).toFixed(4)); +assertEquals("0.00", (0.001).toFixed(2)); +assertEquals("0.001", (0.001).toFixed(3)); +assertEquals("0.0010", (0.001).toFixed(4)); +assertEquals("1.0000", (1).toFixed(4)); +assertEquals("1.0", (1).toFixed(1)); +assertEquals("1", (1).toFixed(0)); +assertEquals("12", (12).toFixed(0)); +assertEquals("1", (1.1).toFixed(0)); +assertEquals("12", (12.1).toFixed(0)); +assertEquals("1", (1.12).toFixed(0)); +assertEquals("12", (12.12).toFixed(0)); +assertEquals("0.0000006", (0.0000006).toFixed(7)); +assertEquals("0.00000006", (0.00000006).toFixed(8)); +assertEquals("0.000000060", (0.00000006).toFixed(9)); +assertEquals("0.0000000600", (0.00000006).toFixed(10)); +assertEquals("0", (0).toFixed(0)); +assertEquals("0.0", (0).toFixed(1)); +assertEquals("0.00", (0).toFixed(2)); + +assertEquals("-1.1111111111111111e+21", (-1111111111111111111111).toFixed(8)); +assertEquals("-0.1", (-0.1).toFixed(1)); +assertEquals("-0.10", (-0.1).toFixed(2)); +assertEquals("-0.100", (-0.1).toFixed(3)); +assertEquals("-0.01", (-0.01).toFixed(2)); +assertEquals("-0.010", (-0.01).toFixed(3)); +assertEquals("-0.0100", (-0.01).toFixed(4)); +assertEquals("-0.00", (-0.001).toFixed(2)); +assertEquals("-0.001", (-0.001).toFixed(3)); +assertEquals("-0.0010", (-0.001).toFixed(4)); +assertEquals("-1.0000", (-1).toFixed(4)); +assertEquals("-1.0", (-1).toFixed(1)); +assertEquals("-1", (-1).toFixed(0)); +assertEquals("-1", (-1.1).toFixed(0)); +assertEquals("-12", (-12.1).toFixed(0)); +assertEquals("-1", (-1.12).toFixed(0)); +assertEquals("-12", (-12.12).toFixed(0)); +assertEquals("-0.0000006", (-0.0000006).toFixed(7)); +assertEquals("-0.00000006", (-0.00000006).toFixed(8)); +assertEquals("-0.000000060", (-0.00000006).toFixed(9)); +assertEquals("-0.0000000600", (-0.00000006).toFixed(10)); +assertEquals("0", (-0).toFixed(0)); +assertEquals("0.0", (-0).toFixed(1)); +assertEquals("0.00", (-0).toFixed(2)); + +assertEquals("1000", (1000).toFixed()); +assertEquals("0", (0.00001).toFixed()); +assertEquals("0.00001", (0.00001).toFixed(5)); +assertEquals("0.00000000000000000010", (0.0000000000000000001).toFixed(20)); +assertEquals("0.00001000000000000", (0.00001).toFixed(17)); +assertEquals("1.00000000000000000", (1).toFixed(17)); +assertEquals("1000000000000000128", (1000000000000000128).toFixed()); +assertEquals("100000000000000128.0", (100000000000000128).toFixed(1)); +assertEquals("10000000000000128.00", (10000000000000128).toFixed(2)); +assertEquals("10000000000000128.00000000000000000000", (10000000000000128).toFixed(20)); +assertEquals("0", (0).toFixed()); +assertEquals("-42.000", ((-42).toFixed(3))); +assertEquals("-1000000000000000128", (-1000000000000000128).toFixed()); +assertEquals("-0.00000000000000000010", (-0.0000000000000000001).toFixed(20)); +assertEquals("0.12312312312312299889", (0.123123123123123).toFixed(20)); +// Test that we round up even when the last digit generated is even. +// dtoa does not do this in its original form. +assertEquals("1", 0.5.toFixed(0), "0.5.toFixed(0)"); +assertEquals("-1", -0.5.toFixed(0), "-0.5.toFixed(0)"); +assertEquals("1.3", 1.25.toFixed(1), "1.25.toFixed(1)"); +// This is bizare, but Spidermonkey and KJS behave the same. +assertEquals("234.2040", (234.20405).toFixed(4), "234.2040.toFixed(4)"); +assertEquals("234.2041", (234.2040506).toFixed(4)); + +// ---------------------------------------------------------------------- +// toExponential +assertEquals("1e+0", (1).toExponential()); +assertEquals("1.1e+1", (11).toExponential()); +assertEquals("1.12e+2", (112).toExponential()); +assertEquals("1e+0", (1).toExponential(0)); +assertEquals("1e+1", (11).toExponential(0)); +assertEquals("1e+2", (112).toExponential(0)); +assertEquals("1.0e+0", (1).toExponential(1)); +assertEquals("1.1e+1", (11).toExponential(1)); +assertEquals("1.1e+2", (112).toExponential(1)); +assertEquals("1.00e+0", (1).toExponential(2)); +assertEquals("1.10e+1", (11).toExponential(2)); +assertEquals("1.12e+2", (112).toExponential(2)); +assertEquals("1.000e+0", (1).toExponential(3)); +assertEquals("1.100e+1", (11).toExponential(3)); +assertEquals("1.120e+2", (112).toExponential(3)); +assertEquals("1e-1", (0.1).toExponential()); +assertEquals("1.1e-1", (0.11).toExponential()); +assertEquals("1.12e-1", (0.112).toExponential()); +assertEquals("1e-1", (0.1).toExponential(0)); +assertEquals("1e-1", (0.11).toExponential(0)); +assertEquals("1e-1", (0.112).toExponential(0)); +assertEquals("1.0e-1", (0.1).toExponential(1)); +assertEquals("1.1e-1", (0.11).toExponential(1)); +assertEquals("1.1e-1", (0.112).toExponential(1)); +assertEquals("1.00e-1", (0.1).toExponential(2)); +assertEquals("1.10e-1", (0.11).toExponential(2)); +assertEquals("1.12e-1", (0.112).toExponential(2)); +assertEquals("1.000e-1", (0.1).toExponential(3)); +assertEquals("1.100e-1", (0.11).toExponential(3)); +assertEquals("1.120e-1", (0.112).toExponential(3)); + +assertEquals("-1e+0", (-1).toExponential()); +assertEquals("-1.1e+1", (-11).toExponential()); +assertEquals("-1.12e+2", (-112).toExponential()); +assertEquals("-1e+0", (-1).toExponential(0)); +assertEquals("-1e+1", (-11).toExponential(0)); +assertEquals("-1e+2", (-112).toExponential(0)); +assertEquals("-1.0e+0", (-1).toExponential(1)); +assertEquals("-1.1e+1", (-11).toExponential(1)); +assertEquals("-1.1e+2", (-112).toExponential(1)); +assertEquals("-1.00e+0", (-1).toExponential(2)); +assertEquals("-1.10e+1", (-11).toExponential(2)); +assertEquals("-1.12e+2", (-112).toExponential(2)); +assertEquals("-1.000e+0", (-1).toExponential(3)); +assertEquals("-1.100e+1", (-11).toExponential(3)); +assertEquals("-1.120e+2", (-112).toExponential(3)); +assertEquals("-1e-1", (-0.1).toExponential()); +assertEquals("-1.1e-1", (-0.11).toExponential()); +assertEquals("-1.12e-1", (-0.112).toExponential()); +assertEquals("-1e-1", (-0.1).toExponential(0)); +assertEquals("-1e-1", (-0.11).toExponential(0)); +assertEquals("-1e-1", (-0.112).toExponential(0)); +assertEquals("-1.0e-1", (-0.1).toExponential(1)); +assertEquals("-1.1e-1", (-0.11).toExponential(1)); +assertEquals("-1.1e-1", (-0.112).toExponential(1)); +assertEquals("-1.00e-1", (-0.1).toExponential(2)); +assertEquals("-1.10e-1", (-0.11).toExponential(2)); +assertEquals("-1.12e-1", (-0.112).toExponential(2)); +assertEquals("-1.000e-1", (-0.1).toExponential(3)); +assertEquals("-1.100e-1", (-0.11).toExponential(3)); +assertEquals("-1.120e-1", (-0.112).toExponential(3)); + +assertEquals("NaN", (NaN).toExponential(2)); +assertEquals("Infinity", (Infinity).toExponential(2)); +assertEquals("-Infinity", (-Infinity).toExponential(2)); +assertEquals("1e+0", (1).toExponential(0)); +assertEquals("0e+0", (0).toExponential()); +assertEquals("0.00e+0", (0).toExponential(2)); +assertEquals("1e+1", (11.2356).toExponential(0)); +assertEquals("1.1236e+1", (11.2356).toExponential(4)); +assertEquals("1.1236e-4", (0.000112356).toExponential(4)); +assertEquals("-1.1236e-4", (-0.000112356).toExponential(4)); +assertEquals("1.12356e-4", (0.000112356).toExponential()); +assertEquals("-1.12356e-4", (-0.000112356).toExponential()); + +// ---------------------------------------------------------------------- +// toPrecision +assertEquals("NaN", (NaN).toPrecision(1)); +assertEquals("Infinity", (Infinity).toPrecision(2)); +assertEquals("-Infinity", (-Infinity).toPrecision(2)); +assertEquals("0.000555000000000000", (0.000555).toPrecision(15)); +assertEquals("5.55000000000000e-7", (0.000000555).toPrecision(15)); +assertEquals("-5.55000000000000e-7", (-0.000000555).toPrecision(15)); +assertEquals("1e+8", (123456789).toPrecision(1)); +assertEquals("123456789", (123456789).toPrecision(9)); +assertEquals("1.2345679e+8", (123456789).toPrecision(8)); +assertEquals("1.234568e+8", (123456789).toPrecision(7)); +assertEquals("-1.234568e+8", (-123456789).toPrecision(7)); +assertEquals("-1.2e-9", Number(-.0000000012345).toPrecision(2)); +assertEquals("-1.2e-8", Number(-.000000012345).toPrecision(2)); +assertEquals("-1.2e-7", Number(-.00000012345).toPrecision(2)); +assertEquals("-0.0000012", Number(-.0000012345).toPrecision(2)); +assertEquals("-0.000012", Number(-.000012345).toPrecision(2)); +assertEquals("-0.00012", Number(-.00012345).toPrecision(2)); +assertEquals("-0.0012", Number(-.0012345).toPrecision(2)); +assertEquals("-0.012", Number(-.012345).toPrecision(2)); +assertEquals("-0.12", Number(-.12345).toPrecision(2)); +assertEquals("-1.2", Number(-1.2345).toPrecision(2)); +assertEquals("-12", Number(-12.345).toPrecision(2)); +assertEquals("-1.2e+2", Number(-123.45).toPrecision(2)); +assertEquals("-1.2e+3", Number(-1234.5).toPrecision(2)); +assertEquals("-1.2e+4", Number(-12345).toPrecision(2)); +assertEquals("-1.235e+4", Number(-12345.67).toPrecision(4)); +assertEquals("-1.234e+4", Number(-12344.67).toPrecision(4)); +// Test that we round up even when the last digit generated is even. +// dtoa does not do this in its original form. +assertEquals("1.3", 1.25.toPrecision(2), "1.25.toPrecision(2)"); +assertEquals("1.4", 1.35.toPrecision(2), "1.35.toPrecision(2)"); + + + diff --git a/deps/v8/test/mjsunit/obj-construct.js b/deps/v8/test/mjsunit/obj-construct.js new file mode 100644 index 0000000000..98e09b2f95 --- /dev/null +++ b/deps/v8/test/mjsunit/obj-construct.js @@ -0,0 +1,46 @@ +// Copyright 2008 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 consCalled = false; + +function Object() { + consCalled = true; +} + +function Array() { + consCalled = true; +} + +assertFalse(consCalled); +var x1 = { }; +assertFalse(consCalled); +var x2 = { a: 3, b: 4 }; +assertFalse(consCalled); +var x3 = [ ]; +assertFalse(consCalled); +var x4 = [ 1, 2, 3 ]; +assertFalse(consCalled); diff --git a/deps/v8/test/mjsunit/object-literal-gc.js b/deps/v8/test/mjsunit/object-literal-gc.js new file mode 100644 index 0000000000..b9d6285cfe --- /dev/null +++ b/deps/v8/test/mjsunit/object-literal-gc.js @@ -0,0 +1,66 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Flags: --expose-gc + +// Test that the clearing of object literal when normalizing objects +// works. In particular, test that the garbage collector handles the +// normalized object literals correctly. +function testLiteral(size) { + + // Build object-literal string. + var literal = "var o = { "; + + for (var i = 0; i < size; i++) { + if (i > 0) literal += ","; + literal += ("a" + i + ":" + i); + } + literal += "}"; + + // Create the object literal. + eval(literal); + + // Force normalization of the properties. + delete o["a" + (size - 1)]; + + // Perform GC. + gc(); + + // Check that the properties have the expected values. + for (var i = 0; i < size - 1; i++) { + assertEquals(i, o["a"+i]); + } +} + +// The sizes to test. +var sizes = [0, 1, 2, 100, 200, 400, 1000]; + +// Run the test. +for (var i = 0; i < sizes.length; i++) { + testLiteral(sizes[i]); +} + diff --git a/deps/v8/test/mjsunit/object-literal.js b/deps/v8/test/mjsunit/object-literal.js new file mode 100644 index 0000000000..cc6f59dce6 --- /dev/null +++ b/deps/v8/test/mjsunit/object-literal.js @@ -0,0 +1,105 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +var obj = { + a: 7, + b: { x: 12, y: 24 }, + c: 'Zebra' +} + +assertEquals(7, obj.a); +assertEquals(12, obj.b.x); +assertEquals(24, obj.b.y); +assertEquals('Zebra', obj.c); + +var z = 24; + +var obj2 = { + a: 7, + b: { x: 12, y: z }, + c: 'Zebra' +} + +assertEquals(7, obj2.a); +assertEquals(12, obj2.b.x); +assertEquals(24, obj2.b.y); +assertEquals('Zebra', obj2.c); + +var arr = []; +for (var i = 0; i < 2; i++) { + arr[i] = { + a: 7, + b: { x: 12, y: 24 }, + c: 'Zebra' + } +} + +arr[0].b.x = 2; +assertEquals(2, arr[0].b.x); +assertEquals(12, arr[1].b.x); + + +function makeSparseArray() { + return { + '0': { x: 12, y: 24 }, + '1000000': { x: 0, y: 0 } + }; +} + +var sa1 = makeSparseArray(); +sa1[0].x = 0; +var sa2 = makeSparseArray(); +assertEquals(12, sa2[0].x); + +// Test that non-constant literals work. +var n = new Object(); + +function makeNonConstantArray() { return [ [ n ] ]; } + +var a = makeNonConstantArray(); +a[0][0].foo = "bar"; +assertEquals("bar", n.foo); + +function makeNonConstantObject() { return { a: { b: n } }; } + +a = makeNonConstantObject(); +a.a.b.bar = "foo"; +assertEquals("foo", n.bar); + +// Test that exceptions for regexps still hold. +function makeRegexpInArray() { return [ [ /a*/, {} ] ]; } + +a = makeRegexpInArray(); +var b = makeRegexpInArray(); +assertTrue(a[0][0] === b[0][0]); +assertFalse(a[0][1] === b[0][1]); + +function makeRegexpInObject() { return { a: { b: /b*/, c: {} } }; } +a = makeRegexpInObject(); +b = makeRegexpInObject(); +assertTrue(a.a.b === b.a.b); +assertFalse(a.a.c === b.a.c); diff --git a/deps/v8/test/mjsunit/override-read-only-property.js b/deps/v8/test/mjsunit/override-read-only-property.js new file mode 100644 index 0000000000..b8fa5015a3 --- /dev/null +++ b/deps/v8/test/mjsunit/override-read-only-property.js @@ -0,0 +1,64 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// According to ECMA-262, sections 8.6.2.2 and 8.6.2.3 you're not +// allowed to override read-only properties, not even if the read-only +// property is in the prototype chain. +// +// However, for compatibility with WebKit/JSC, we allow the overriding +// of read-only properties in prototype chains. + +function F() {}; +F.prototype = Number; + +var original_number_max = Number.MAX_VALUE; + +// Assignment to a property which does not exist on the object itself, +// but is read-only in a prototype takes effect. +var f = new F(); +assertEquals(original_number_max, f.MAX_VALUE); +f.MAX_VALUE = 42; +assertEquals(42, f.MAX_VALUE); + +// Assignment to a property which does not exist on the object itself, +// but is read-only in a prototype takes effect. +f = new F(); +with (f) { + MAX_VALUE = 42; +} +assertEquals(42, f.MAX_VALUE); + +// Assignment to read-only property on the object itself is ignored. +Number.MAX_VALUE = 42; +assertEquals(original_number_max, Number.MAX_VALUE); + +// G should be read-only on the global object and the assignment is +// ignored. +(function G() { + eval("G = 42;"); + assertTrue(typeof G === 'function'); +})(); diff --git a/deps/v8/test/mjsunit/parse-int-float.js b/deps/v8/test/mjsunit/parse-int-float.js new file mode 100644 index 0000000000..ad2275e661 --- /dev/null +++ b/deps/v8/test/mjsunit/parse-int-float.js @@ -0,0 +1,82 @@ +// Copyright 2008 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(0, parseInt('0')); +assertEquals(0, parseInt(' 0')); +assertEquals(0, parseInt(' 0 ')); + +assertEquals(63, parseInt('077')); +assertEquals(63, parseInt(' 077')); +assertEquals(63, parseInt(' 077 ')); +assertEquals(-63, parseInt(' -077')); + +assertEquals(3, parseInt('11', 2)); +assertEquals(4, parseInt('11', 3)); + +assertEquals(0x12, parseInt('0x12')); +assertEquals(0x12, parseInt('0x12', 16)); + +assertEquals(12, parseInt('12aaa')); + +assertEquals(0.1, parseFloat('0.1')); +assertEquals(0.1, parseFloat('0.1aaa')); +assertEquals(0, parseFloat('0x12')); +assertEquals(77, parseFloat('077')); + + +var i; +var y = 10; + +for (i = 1; i < 21; i++) { + var x = eval("1.2e" + i); + assertEquals(Math.floor(x), parseInt(x)); + x = eval("1e" + i); + assertEquals(x, y); + y *= 10; + assertEquals(Math.floor(x), parseInt(x)); + x = eval("-1e" + i); + assertEquals(Math.ceil(x), parseInt(x)); + x = eval("-1.2e" + i); + assertEquals(Math.ceil(x), parseInt(x)); +} + +for (i = 21; i < 53; i++) { + var x = eval("1e" + i); + assertEquals(1, parseInt(x)); + x = eval("-1e" + i); + assertEquals(-1, parseInt(x)); +} + +assertTrue(isNaN(parseInt(0/0))); +assertTrue(isNaN(parseInt(1/0)), "parseInt Infinity"); +assertTrue(isNaN(parseInt(-1/0)), "parseInt -Infinity"); + +assertTrue(isNaN(parseFloat(0/0))); +assertEquals(Infinity, parseFloat(1/0), "parseFloat Infinity"); +assertEquals(-Infinity, parseFloat(-1/0), "parseFloat -Infinity"); + + diff --git a/deps/v8/test/mjsunit/property-load-across-eval.js b/deps/v8/test/mjsunit/property-load-across-eval.js new file mode 100644 index 0000000000..8271f4cae9 --- /dev/null +++ b/deps/v8/test/mjsunit/property-load-across-eval.js @@ -0,0 +1,85 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Tests loading of properties across eval calls. + +var x = 1; + +// Test loading across an eval call that does not shadow variables. +function testNoShadowing() { + var y = 2; + function f() { + eval('1'); + assertEquals(1, x); + assertEquals(2, y); + function g() { + assertEquals(1, x); + assertEquals(2, y); + } + g(); + } + f(); +} + +testNoShadowing(); + +// Test loading across eval calls that do not shadow variables. +function testNoShadowing2() { + var y = 2; + eval('1'); + function f() { + eval('1'); + assertEquals(1, x); + assertEquals(2, y); + function g() { + assertEquals(1, x); + assertEquals(2, y); + } + g(); + } + f(); +} + +testNoShadowing2(); + +// Test loading across an eval call that shadows variables. +function testShadowing() { + var y = 2; + function f() { + eval('var x = 3; var y = 4;'); + assertEquals(3, x); + assertEquals(4, y); + function g() { + assertEquals(3, x); + assertEquals(4, y); + } + g(); + } + f(); +} + +testShadowing(); diff --git a/deps/v8/test/mjsunit/property-object-key.js b/deps/v8/test/mjsunit/property-object-key.js new file mode 100644 index 0000000000..5eb1e1b9ec --- /dev/null +++ b/deps/v8/test/mjsunit/property-object-key.js @@ -0,0 +1,36 @@ +// Copyright 2008 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 key = { toString: function() { return 'baz'; } } +var object = { baz: 42 }; + +assertEquals(42, object[key]); +object[key] = 87; +assertEquals(87, object[key]); +object[key]++; +assertEquals(88, object[key]); + diff --git a/deps/v8/test/mjsunit/proto.js b/deps/v8/test/mjsunit/proto.js new file mode 100644 index 0000000000..faf98b2251 --- /dev/null +++ b/deps/v8/test/mjsunit/proto.js @@ -0,0 +1,33 @@ +// Copyright 2008 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 o1 = { x: 12 }; + +var o2 = { x: 12, y: 13 }; +delete o2.x; // normalize + +assertTrue(o1.__proto__ === o2.__proto__); diff --git a/deps/v8/test/mjsunit/prototype.js b/deps/v8/test/mjsunit/prototype.js new file mode 100644 index 0000000000..bfc1a799d4 --- /dev/null +++ b/deps/v8/test/mjsunit/prototype.js @@ -0,0 +1,93 @@ +// Copyright 2008 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 A() { } +function B() { } +function C() { } + +function NewC() { + A.prototype = {}; + B.prototype = new A(); + C.prototype = new B(); + var result = new C(); + result.A = A.prototype; + result.B = B.prototype; + result.C = C.prototype; + return result; +} + +// Check that we can read properties defined in prototypes. +var c = NewC(); +c.A.x = 1; +c.B.y = 2; +c.C.z = 3; +assertEquals(1, c.x); +assertEquals(2, c.y); +assertEquals(3, c.z); + +var c = NewC(); +c.A.x = 0; +for (var i = 0; i < 2; i++) { + assertEquals(i, c.x); + c.B.x = 1; +} + + +// Regression test: +// Make sure we preserve the prototype of an object in the face of map transitions. + +function D() { + this.d = 1; +} +var p = new Object(); +p.y = 1; +new D(); + +D.prototype = p +assertEquals(1, (new D).y); + + +// Regression test: +// Make sure that arrays and functions in the prototype chain works; +// check length. +function X() { } +function Y() { } + +X.prototype = function(a,b) { }; +Y.prototype = [1,2,3]; + +assertEquals(2, (new X).length); +assertEquals(3, (new Y).length); + + +// Test setting the length of an object where the prototype is from an array. +var test = new Object; +test.__proto__ = (new Array()).__proto__; +test.length = 14; +assertEquals(14, test.length); + + diff --git a/deps/v8/test/mjsunit/regexp-UC16.js b/deps/v8/test/mjsunit/regexp-UC16.js new file mode 100644 index 0000000000..f609e17bb7 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-UC16.js @@ -0,0 +1,47 @@ +// Copyright 2008 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. + +// UC16 +// Characters used: +// "\u03a3\u03c2\u03c3\u039b\u03bb" - Sigma, final sigma, sigma, Lambda, lamda +assertEquals("x\u03a3\u03c3x,\u03a3", + String(/x(.)\1x/i.exec("x\u03a3\u03c3x")), "backref-UC16"); +assertFalse(/x(...)\1/i.test("x\u03a3\u03c2\u03c3\u03c2\u03c3"), + "\\1 ASCII, string short"); +assertTrue(/\u03a3((?:))\1\1x/i.test("\u03c2x"), "backref-UC16-empty"); +assertTrue(/x(?:...|(...))\1x/i.test("x\u03a3\u03c2\u03c3x"), + "backref-UC16-uncaptured"); +assertTrue(/x(?:...|(...))\1x/i.test("x\u03c2\u03c3\u039b\u03a3\u03c2\u03bbx"), + "backref-UC16-backtrack"); +var longUC16String = "x\u03a3\u03c2\u039b\u03c2\u03c3\u03bb\u03c3\u03a3\u03bb"; +assertEquals(longUC16String + "," + longUC16String.substring(1,4), + String(/x(...)\1\1/i.exec(longUC16String)), + "backref-UC16-twice"); + +assertFalse(/\xc1/i.test('fooA'), "quickcheck-uc16-pattern-ascii-subject"); +assertFalse(/[\xe9]/.test('i'), "charclass-uc16-pattern-ascii-subject"); +assertFalse(/\u5e74|\u6708/.test('t'), "alternation-uc16-pattern-ascii-subject"); diff --git a/deps/v8/test/mjsunit/regexp-capture.js b/deps/v8/test/mjsunit/regexp-capture.js new file mode 100755 index 0000000000..d4433d8cd2 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-capture.js @@ -0,0 +1,57 @@ +// Copyright 2009 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Tests from http://blog.stevenlevithan.com/archives/npcg-javascript
+
+assertEquals(true, /(x)?\1y/.test("y"));
+assertEquals(["y", undefined], /(x)?\1y/.exec("y"));
+assertEquals(["y", undefined], /(x)?y/.exec("y"));
+assertEquals(["y", undefined], "y".match(/(x)?\1y/));
+assertEquals(["y", undefined], "y".match(/(x)?y/));
+assertEquals(["y"], "y".match(/(x)?\1y/g));
+assertEquals(["", undefined, ""], "y".split(/(x)?\1y/));
+assertEquals(["", undefined, ""], "y".split(/(x)?y/));
+assertEquals(0, "y".search(/(x)?\1y/));
+assertEquals("z", "y".replace(/(x)?\1y/, "z"));
+assertEquals("", "y".replace(/(x)?y/, "$1"));
+assertEquals("undefined", "y".replace(/(x)?\1y/,
+ function($0, $1){
+ return String($1);
+ }));
+assertEquals("undefined", "y".replace(/(x)?y/,
+ function($0, $1){
+ return String($1);
+ }));
+assertEquals("undefined", "y".replace(/(x)?y/,
+ function($0, $1){
+ return $1;
+ }));
+
+// See https://bugzilla.mozilla.org/show_bug.cgi?id=476146
+assertEquals("bbc,b", /^(b+|a){1,2}?bc/.exec("bbc"));
+assertEquals("bbaa,a,,a", /((\3|b)\2(a)){2,}/.exec("bbaababbabaaaaabbaaaabba"));
+
diff --git a/deps/v8/test/mjsunit/regexp-indexof.js b/deps/v8/test/mjsunit/regexp-indexof.js new file mode 100644 index 0000000000..a504dd8d57 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-indexof.js @@ -0,0 +1,77 @@ +// Copyright 2008 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 CheckMatch(re, str, matches) { + assertEquals(matches.length > 0, re.test(str)); + var result = str.match(re); + if (matches.length > 0) { + assertEquals(matches.length, result.length); + var lastExpected; + var lastFrom; + var lastLength; + for (var idx = 0; idx < matches.length; idx++) { + var from = matches[idx][0]; + var length = matches[idx][1]; + var expected = str.substr(from, length); + var name = str + "[" + from + ".." + (from+length) + "]"; + assertEquals(expected, result[idx], name); + if (re.global || idx == 0) { + lastExpected = expected; + lastFrom = from; + lastLength = length; + } + } + assertEquals(lastExpected, RegExp.lastMatch, "lastMatch"); + assertEquals(str.substr(0, lastFrom), RegExp.leftContext, "leftContext"); + assertEquals( + str.substr(lastFrom + lastLength), RegExp.rightContext, "rightContext"); + } else { + assertTrue(result === null); + } +} + +CheckMatch(/abc/, "xxxabcxxxabcxxx", [[3, 3]]); +CheckMatch(/abc/g, "xxxabcxxxabcxxx", [[3, 3], [9, 3]]); +CheckMatch(/abc/, "xxxabababcxxxabcxxx", [[7, 3]]); +CheckMatch(/abc/g, "abcabcabc", [[0, 3], [3, 3], [6, 3]]); +CheckMatch(/aba/g, "ababababa", [[0, 3], [4, 3]]); +CheckMatch(/foo/g, "ofooofoooofofooofo", [[1, 3], [5, 3], [12, 3]]); +CheckMatch(/foobarbaz/, "xx", []); +CheckMatch(new RegExp(""), "xxx", [[0, 0]]); +CheckMatch(/abc/, "abababa", []); + +assertEquals("xxxdefxxxdefxxx", "xxxabcxxxabcxxx".replace(/abc/g, "def")); +assertEquals("o-o-oofo-ofo", "ofooofoooofofooofo".replace(/foo/g, "-")); +assertEquals("deded", "deded".replace(/x/g, "-")); +assertEquals("-a-b-c-d-e-f-", "abcdef".replace(new RegExp("", "g"), "-")); + +CheckMatch(/a(.)/, "xyzzyabxyzzzyacxyzzy", [[5, 2], [6, 1]]); +CheckMatch(/a(.)/g, "xyzzyabxyzzyacxyzzy", [[5, 2], [12, 2]]); + +CheckMatch(/a|(?:)/g, "aba", [[0, 1], [1, 0], [2, 1], [3, 0]]); +CheckMatch(/a|(?:)/g, "baba", [[0, 0], [1, 1], [2, 0], [3, 1], [4, 0]]); +CheckMatch(/a|(?:)/g, "bab", [[0, 0], [1, 1], [2, 0], [3, 0]]);
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/regexp-lookahead.js b/deps/v8/test/mjsunit/regexp-lookahead.js new file mode 100644 index 0000000000..1188b56078 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-lookahead.js @@ -0,0 +1,166 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Tests captures in positive and negative look-ahead in regular expressions. + +function stringEscape(string) { + // Converts string to source literal. + return '"' + string.replace(/["\\]/g, "\\$1") + '"'; +} + +function testRE(re, input, expected_result) { + var testName = re + ".test(" + stringEscape(input) +")"; + if (expected_result) { + assertTrue(re.test(input), testName); + } else { + assertFalse(re.test(input), testName); + } +} + +function execRE(re, input, expected_result) { + var testName = re + ".exec('" + stringEscape(input) +"')"; + assertEquals(expected_result, re.exec(input), testName); +} + +// Test of simple positive lookahead. + +var re = /^(?=a)/; +testRE(re, "a", true); +testRE(re, "b", false); +execRE(re, "a", [""]); + +re = /^(?=\woo)f\w/; +testRE(re, "foo", true); +testRE(re, "boo", false); +testRE(re, "fao", false); +testRE(re, "foa", false); +execRE(re, "foo", ["fo"]); + +re = /(?=\w).(?=\W)/; +testRE(re, ".a! ", true); +testRE(re, ".! ", false); +testRE(re, ".ab! ", true); +execRE(re, ".ab! ", ["b"]); + +re = /(?=f(?=[^f]o))../; +testRE(re, ", foo!", true); +testRE(re, ", fo!", false); +testRE(re, ", ffo", false); +execRE(re, ", foo!", ["fo"]); + +// Positive lookahead with captures. +re = /^[^\'\"]*(?=([\'\"])).*\1(\w+)\1/; +testRE(re, " 'foo' ", true); +testRE(re, ' "foo" ', true); +testRE(re, " \" 'foo' ", false); +testRE(re, " ' \"foo\" ", false); +testRE(re, " 'foo\" ", false); +testRE(re, " \"foo' ", false); +execRE(re, " 'foo' ", [" 'foo'", "'", "foo"]); +execRE(re, ' "foo" ', [' "foo"', '"', 'foo']); + +// Captures are cleared on backtrack past the look-ahead. +re = /^(?:(?=(.))a|b)\1$/; +testRE(re, "aa", true); +testRE(re, "b", true); +testRE(re, "bb", false); +testRE(re, "a", false); +execRE(re, "aa", ["aa", "a"]); +execRE(re, "b", ["b", undefined]); + +re = /^(?=(.)(?=(.)\1\2)\2\1)\1\2/; +testRE(re, "abab", true); +testRE(re, "ababxxxxxxxx", true); +testRE(re, "aba", false); +execRE(re, "abab", ["ab", "a", "b"]); + +re = /^(?:(?=(.))a|b|c)$/; +testRE(re, "a", true); +testRE(re, "b", true); +testRE(re, "c", true); +testRE(re, "d", false); +execRE(re, "a", ["a", "a"]); +execRE(re, "b", ["b", undefined]); +execRE(re, "c", ["c", undefined]); + +execRE(/^(?=(b))b/, "b", ["b", "b"]); +execRE(/^(?:(?=(b))|a)b/, "ab", ["ab", undefined]); +execRE(/^(?:(?=(b)(?:(?=(c))|d))|)bd/, "bd", ["bd", "b", undefined]); + + + +// Test of Negative Look-Ahead. + +re = /(?!x)./; +testRE(re, "y", true); +testRE(re, "x", false); +execRE(re, "y", ["y"]); + +re = /(?!(\d))|\d/; +testRE(re, "4", true); +execRE(re, "4", ["4", undefined]); +execRE(re, "x", ["", undefined]); + + +// Test mixed nested look-ahead with captures. + +re = /^(?=(x)(?=(y)))/; +testRE(re, "xy", true); +testRE(re, "xz", false); +execRE(re, "xy", ["", "x", "y"]); + +re = /^(?!(x)(?!(y)))/; +testRE(re, "xy", true); +testRE(re, "xz", false); +execRE(re, "xy", ["", undefined, undefined]); + +re = /^(?=(x)(?!(y)))/; +testRE(re, "xz", true); +testRE(re, "xy", false) +execRE(re, "xz", ["", "x", undefined]); + +re = /^(?!(x)(?=(y)))/; +testRE(re, "xz", true); +testRE(re, "xy", false); +execRE(re, "xz", ["", undefined, undefined]); + +re = /^(?=(x)(?!(y)(?=(z))))/; +testRE(re, "xaz", true); +testRE(re, "xya", true); +testRE(re, "xyz", false); +testRE(re, "a", false); +execRE(re, "xaz", ["", "x", undefined, undefined]); +execRE(re, "xya", ["", "x", undefined, undefined]); + +re = /^(?!(x)(?=(y)(?!(z))))/; +testRE(re, "a", true); +testRE(re, "xa", true); +testRE(re, "xyz", true); +testRE(re, "xya", false); +execRE(re, "a", ["", undefined, undefined, undefined]); +execRE(re, "xa", ["", undefined, undefined, undefined]); +execRE(re, "xyz", ["", undefined, undefined, undefined]); diff --git a/deps/v8/test/mjsunit/regexp-loop-capture.js b/deps/v8/test/mjsunit/regexp-loop-capture.js new file mode 100644 index 0000000000..9a0c99ceef --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-loop-capture.js @@ -0,0 +1,29 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +assertEquals(["abc",undefined,undefined,"c"], /(?:(a)|(b)|(c))+/.exec("abc")); +assertEquals(["ab",undefined], /(?:(a)|b)*/.exec("ab")); diff --git a/deps/v8/test/mjsunit/regexp-multiline-stack-trace.js b/deps/v8/test/mjsunit/regexp-multiline-stack-trace.js new file mode 100644 index 0000000000..aa2de8875b --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-multiline-stack-trace.js @@ -0,0 +1,114 @@ +// Copyright 2008 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: --trace-calls --preallocate-message-memory + +/** + * @fileoverview Check that various regexp constructs work as intended. + * Particularly those regexps that use ^ and $. + */ + +assertTrue(/^bar/.test("bar")); +assertTrue(/^bar/.test("bar\nfoo")); +assertFalse(/^bar/.test("foo\nbar")); +assertTrue(/^bar/m.test("bar")); +assertTrue(/^bar/m.test("bar\nfoo")); +assertTrue(/^bar/m.test("foo\nbar")); + +assertTrue(/bar$/.test("bar")); +assertFalse(/bar$/.test("bar\nfoo")); +assertTrue(/bar$/.test("foo\nbar")); +assertTrue(/bar$/m.test("bar")); +assertTrue(/bar$/m.test("bar\nfoo")); +assertTrue(/bar$/m.test("foo\nbar")); + +assertFalse(/^bxr/.test("bar")); +assertFalse(/^bxr/.test("bar\nfoo")); +assertFalse(/^bxr/m.test("bar")); +assertFalse(/^bxr/m.test("bar\nfoo")); +assertFalse(/^bxr/m.test("foo\nbar")); + +assertFalse(/bxr$/.test("bar")); +assertFalse(/bxr$/.test("foo\nbar")); +assertFalse(/bxr$/m.test("bar")); +assertFalse(/bxr$/m.test("bar\nfoo")); +assertFalse(/bxr$/m.test("foo\nbar")); + + +assertTrue(/^.*$/.test("")); +assertTrue(/^.*$/.test("foo")); +assertFalse(/^.*$/.test("\n")); +assertTrue(/^.*$/m.test("\n")); + +assertTrue(/^[\s]*$/.test(" ")); +assertTrue(/^[\s]*$/.test("\n")); + +assertTrue(/^[^]*$/.test("")); +assertTrue(/^[^]*$/.test("foo")); +assertTrue(/^[^]*$/.test("\n")); + +assertTrue(/^([()\s]|.)*$/.test("()\n()")); +assertTrue(/^([()\n]|.)*$/.test("()\n()")); +assertFalse(/^([()]|.)*$/.test("()\n()")); +assertTrue(/^([()]|.)*$/m.test("()\n()")); +assertTrue(/^([()]|.)*$/m.test("()\n")); +assertTrue(/^[()]*$/m.test("()\n.")); + +assertTrue(/^[\].]*$/.test("...]...")); + + +function check_case(lc, uc) { + var a = new RegExp("^" + lc + "$"); + assertFalse(a.test(uc)); + a = new RegExp("^" + lc + "$", "i"); + assertTrue(a.test(uc)); + + var A = new RegExp("^" + uc + "$"); + assertFalse(A.test(lc)); + A = new RegExp("^" + uc + "$", "i"); + assertTrue(A.test(lc)); + + a = new RegExp("^[" + lc + "]$"); + assertFalse(a.test(uc)); + a = new RegExp("^[" + lc + "]$", "i"); + assertTrue(a.test(uc)); + + A = new RegExp("^[" + uc + "]$"); + assertFalse(A.test(lc)); + A = new RegExp("^[" + uc + "]$", "i"); + assertTrue(A.test(lc)); +} + + +check_case("a", "A"); +// Aring +check_case(String.fromCharCode(229), String.fromCharCode(197)); +// Russian G +check_case(String.fromCharCode(0x413), String.fromCharCode(0x433)); + + +assertThrows("a = new RegExp('[z-a]');"); diff --git a/deps/v8/test/mjsunit/regexp-multiline.js b/deps/v8/test/mjsunit/regexp-multiline.js new file mode 100644 index 0000000000..32edf25e5e --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-multiline.js @@ -0,0 +1,112 @@ +// Copyright 2008 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. + +/** + * @fileoverview Check that various regexp constructs work as intended. + * Particularly those regexps that use ^ and $. + */ + +assertTrue(/^bar/.test("bar")); +assertTrue(/^bar/.test("bar\nfoo")); +assertFalse(/^bar/.test("foo\nbar")); +assertTrue(/^bar/m.test("bar")); +assertTrue(/^bar/m.test("bar\nfoo")); +assertTrue(/^bar/m.test("foo\nbar")); + +assertTrue(/bar$/.test("bar")); +assertFalse(/bar$/.test("bar\nfoo")); +assertTrue(/bar$/.test("foo\nbar")); +assertTrue(/bar$/m.test("bar")); +assertTrue(/bar$/m.test("bar\nfoo")); +assertTrue(/bar$/m.test("foo\nbar")); + +assertFalse(/^bxr/.test("bar")); +assertFalse(/^bxr/.test("bar\nfoo")); +assertFalse(/^bxr/m.test("bar")); +assertFalse(/^bxr/m.test("bar\nfoo")); +assertFalse(/^bxr/m.test("foo\nbar")); + +assertFalse(/bxr$/.test("bar")); +assertFalse(/bxr$/.test("foo\nbar")); +assertFalse(/bxr$/m.test("bar")); +assertFalse(/bxr$/m.test("bar\nfoo")); +assertFalse(/bxr$/m.test("foo\nbar")); + + +assertTrue(/^.*$/.test("")); +assertTrue(/^.*$/.test("foo")); +assertFalse(/^.*$/.test("\n")); +assertTrue(/^.*$/m.test("\n")); + +assertTrue(/^[\s]*$/.test(" ")); +assertTrue(/^[\s]*$/.test("\n")); + +assertTrue(/^[^]*$/.test("")); +assertTrue(/^[^]*$/.test("foo")); +assertTrue(/^[^]*$/.test("\n")); + +assertTrue(/^([()\s]|.)*$/.test("()\n()")); +assertTrue(/^([()\n]|.)*$/.test("()\n()")); +assertFalse(/^([()]|.)*$/.test("()\n()")); +assertTrue(/^([()]|.)*$/m.test("()\n()")); +assertTrue(/^([()]|.)*$/m.test("()\n")); +assertTrue(/^[()]*$/m.test("()\n.")); + +assertTrue(/^[\].]*$/.test("...]...")); + + +function check_case(lc, uc) { + var a = new RegExp("^" + lc + "$"); + assertFalse(a.test(uc)); + a = new RegExp("^" + lc + "$", "i"); + assertTrue(a.test(uc)); + + var A = new RegExp("^" + uc + "$"); + assertFalse(A.test(lc)); + A = new RegExp("^" + uc + "$", "i"); + assertTrue(A.test(lc)); + + a = new RegExp("^[" + lc + "]$"); + assertFalse(a.test(uc)); + a = new RegExp("^[" + lc + "]$", "i"); + assertTrue(a.test(uc)); + + A = new RegExp("^[" + uc + "]$"); + assertFalse(A.test(lc)); + A = new RegExp("^[" + uc + "]$", "i"); + assertTrue(A.test(lc)); +} + + +check_case("a", "A"); +// Aring +check_case(String.fromCharCode(229), String.fromCharCode(197)); +// Russian G +check_case(String.fromCharCode(0x413), String.fromCharCode(0x433)); + + +assertThrows("a = new RegExp('[z-a]');"); diff --git a/deps/v8/test/mjsunit/regexp-pcre.js b/deps/v8/test/mjsunit/regexp-pcre.js new file mode 100644 index 0000000000..dcb1b320fd --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-pcre.js @@ -0,0 +1,6603 @@ +// Autogenerated from the PCRE test suite Mon Feb 2 15:14:04 CET 2009 + +// Note that some regexps in the PCRE test suite use features not present +// in JavaScript. These don't work in JS, but they fail to work in a +// predictable way, and the expected results reflect this. + +// PCRE comes with the following license + +// PCRE LICENCE +// ------------ +// +// PCRE is a library of functions to support regular expressions whose syntax +// and semantics are as close as possible to those of the Perl 5 language. +// +// Release 7 of PCRE is distributed under the terms of the "BSD" licence, as +// specified below. The documentation for PCRE, supplied in the "doc" +// directory, is distributed under the same terms as the software itself. +// +// The basic library functions are written in C and are freestanding. Also +// included in the distribution is a set of C++ wrapper functions. +// +// +// THE BASIC LIBRARY FUNCTIONS +// --------------------------- +// +// Written by: Philip Hazel +// Email local part: ph10 +// Email domain: cam.ac.uk +// +// University of Cambridge Computing Service, +// Cambridge, England. +// +// Copyright (c) 1997-2007 University of Cambridge +// All rights reserved. +// +// +// THE C++ WRAPPER FUNCTIONS +// ------------------------- +// +// Contributed by: Google Inc. +// +// Copyright (c) 2007, Google Inc. +// All rights reserved. +// +// +// THE "BSD" LICENCE +// ----------------- +// +// 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 the University of Cambridge nor the name of Google +// Inc. nor the names of their 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. +// +// End + +var res = new Array(); +res[0] = /(a)b|/i; +res[1] = /abc/i; +res[2] = /^abc/i; +res[3] = /a+bc/i; +res[4] = /a*bc/i; +res[5] = /a{3}bc/i; +res[6] = /(abc|a+z)/i; +res[7] = /^abc$/i; +res[8] = /ab\idef/; +res[9] = /.*b/i; +res[10] = /.*?b/i; +res[11] = /cat|dog|elephant/i; +res[12] = /cat|dog|elephant/i; +res[13] = /cat|dog|elephant/i; +res[14] = /a|[bcd]/i; +res[15] = /(a|[^\dZ])/i; +res[16] = /(a|b)*[\s]/i; +res[17] = /(ab\2)/; +res[18] = /(a)(b)(c)\2/i; +res[19] = /(a)bc|(a)(b)\2/i; +res[20] = /abc$/i; +res[21] = /(a)(b)(c)(d)(e)\6/; +res[22] = /the quick brown fox/i; +res[23] = /^abc|def/i; +res[24] = /.*((abc)$|(def))/i; +res[25] = /abc/i; +res[26] = /^abc|def/i; +res[27] = /.*((abc)$|(def))/i; +res[28] = /the quick brown fox/i; +res[29] = /the quick brown fox/i; +res[30] = /abc.def/i; +res[31] = /abc$/i; +res[32] = /(abc)\2/i; +res[33] = /(abc\1)/i; +res[34] = /a[]b/; +res[35] = /[^aeiou ]{3,}/i; +res[36] = /<.*>/i; +res[37] = /<.*?>/i; +res[38] = /[abcd]/i; +res[39] = /(^a|^b)/im; +res[40] = /a$/i; +res[41] = /a$/im; +res[42] = /\Aabc/im; +res[43] = /^abc/im; +res[44] = /(?!alphabet)[ab]/i; +res[45] = /The next three are in testinput2 because they have variable length branches/; +res[46] = /This one is here because Perl 5.005_02 doesn't fail it/i; +res[47] = /This one is here because I think Perl 5.005_02 gets the setting of $1 wrong/i; +res[48] = /^(a\1?){4}$/i; +res[49] = /These are syntax tests from Perl 5.005/i; +res[50] = /a[]b/; +res[51] = /\1/; +res[52] = /\2/; +res[53] = /(a)|\2/; +res[54] = /a[]b/i; +res[55] = /abc/; +res[56] = /abc/; +res[57] = /abc/i; +res[58] = /(a)bc(d)/i; +res[59] = /(.{20})/i; +res[60] = /(.{15})/i; +res[61] = /(.{16})/i; +res[62] = /^(a|(bc))de(f)/i; +res[63] = /^abc\00def/i; +res[64] = /word ((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+\n)((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+ )((?:[a-zA-Z0-9]+\n)?)?)?)?)?)?)?)?)?otherword/i; +res[65] = /.*X/i; +res[66] = /.*X/i; +res[67] = /(.*X|^B)/i; +res[68] = /(.*X|^B)/i; +res[69] = /\Biss\B/i; +res[70] = /\Biss\B/i; +res[71] = /iss/ig; +res[72] = /\Biss\B/ig; +res[73] = /\Biss\B/ig; +res[74] = /^iss/ig; +res[75] = /.*iss/ig; +res[76] = /.i./ig; +res[77] = /^.is/ig; +res[78] = /^ab\n/ig; +res[79] = /^ab\n/img; +res[80] = /abc/i; +res[81] = /abc|bac/i; +res[82] = /(abc|bac)/i; +res[83] = /(abc|(c|dc))/i; +res[84] = /(abc|(d|de)c)/i; +res[85] = /a*/i; +res[86] = /a+/i; +res[87] = /(baa|a+)/i; +res[88] = /a{0,3}/i; +res[89] = /baa{3,}/i; +res[90] = /"([^\\"]+|\\.)*"/i; +res[91] = /(abc|ab[cd])/i; +res[92] = /(a|.)/i; +res[93] = /a|ba|\w/i; +res[94] = /abc(?=pqr)/i; +res[95] = /abc(?!pqr)/i; +res[96] = /ab./i; +res[97] = /ab[xyz]/i; +res[98] = /abc*/i; +res[99] = /ab.c*/i; +res[100] = /a.c*/i; +res[101] = /.c*/i; +res[102] = /ac*/i; +res[103] = /(a.c*|b.c*)/i; +res[104] = /a.c*|aba/i; +res[105] = /.+a/i; +res[106] = /(?=abcda)a.*/i; +res[107] = /(?=a)a.*/i; +res[108] = /a(b)*/i; +res[109] = /a\d*/i; +res[110] = /ab\d*/i; +res[111] = /a(\d)*/i; +res[112] = /abcde{0,0}/i; +res[113] = /ab\d+/i; +res[114] = /ab\d{0}e/i; +res[115] = /a?b?/i; +res[116] = /|-/i; +res[117] = /a*(b+)(z)(z)/i; +res[118] = /^.?abcd/i; +res[119] = /^[[:alnum:]]/; +res[120] = /^[[:^alnum:]]/; +res[121] = /^[[:alpha:]]/; +res[122] = /^[[:^alpha:]]/; +res[123] = /[_[:alpha:]]/i; +res[124] = /^[[:ascii:]]/; +res[125] = /^[[:^ascii:]]/; +res[126] = /^[[:blank:]]/; +res[127] = /^[[:^blank:]]/; +res[128] = /[\n\x0b\x0c\x0d[:blank:]]/i; +res[129] = /^[[:cntrl:]]/; +res[130] = /^[[:digit:]]/; +res[131] = /^[[:graph:]]/; +res[132] = /^[[:lower:]]/; +res[133] = /^[[:print:]]/; +res[134] = /^[[:punct:]]/; +res[135] = /^[[:space:]]/; +res[136] = /^[[:upper:]]/; +res[137] = /^[[:xdigit:]]/; +res[138] = /^[[:word:]]/; +res[139] = /^[[:^cntrl:]]/; +res[140] = /^[12[:^digit:]]/; +res[141] = /^[[:^blank:]]/; +res[142] = /[01[:alpha:]%]/; +res[143] = /[[.ch.]]/i; +res[144] = /[[=ch=]]/i; +res[145] = /[[:rhubarb:]]/i; +res[146] = /[[:upper:]]/i; +res[147] = /[[:lower:]]/i; +res[148] = /This one's here because of the large output vector needed/i; +res[149] = /(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\d+(?:\s|$))(\w+)\s+(\270)/i; +res[150] = /This one's here because Perl does this differently and PCRE can't at present/i; +res[151] = /(main(O)?)+/i; +res[152] = /These are all cases where Perl does it differently (nested captures)/i; +res[153] = /^(a(b)?)+$/i; +res[154] = /^(aa(bb)?)+$/i; +res[155] = /^(aa|aa(bb))+$/i; +res[156] = /^(aa(bb)??)+$/i; +res[157] = /^(?:aa(bb)?)+$/i; +res[158] = /^(aa(b(b))?)+$/i; +res[159] = /^(?:aa(b(b))?)+$/i; +res[160] = /^(?:aa(b(?:b))?)+$/i; +res[161] = /^(?:aa(bb(?:b))?)+$/i; +res[162] = /^(?:aa(b(?:bb))?)+$/i; +res[163] = /^(?:aa(?:b(b))?)+$/i; +res[164] = /^(?:aa(?:b(bb))?)+$/i; +res[165] = /^(aa(b(bb))?)+$/i; +res[166] = /^(aa(bb(bb))?)+$/i; +res[167] = /a/i; +res[168] = /[\s]/; +res[169] = /[\S]/; +res[170] = /123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/; +res[171] = /\Q123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890/; +res[172] = /\Q\E/; +res[173] = /\Q\Ex/; +res[174] = / \Q\E/; +res[175] = /a\Q\E/; +res[176] = /a\Q\Eb/; +res[177] = /\Q\Eabc/; +res[178] = /[.x.]/i; +res[179] = /[=x=]/i; +res[180] = /[:x:]/i; +res[181] = /\l/i; +res[182] = /\L/i; +res[183] = /\N{name}/i; +res[184] = /\u/i; +res[185] = /\U/i; +res[186] = /[[:space:]/i; +res[187] = /[\s]/i; +res[188] = /[[:space:]]/i; +res[189] = /[[:space:]abcde]/i; +res[190] = /(.*)\d+\1/i; +res[191] = /(.*)\d+/i; +res[192] = /(.*)\d+\1/i; +res[193] = /(.*)\d+/i; +res[194] = /(.*(xyz))\d+\2/i; +res[195] = /((.*))\d+\1/i; +res[196] = /a[b]/i; +res[197] = /(?=a).*/i; +res[198] = /(?=abc).xyz/i; +res[199] = /(?=a)(?=b)/i; +res[200] = /(?=.)a/i; +res[201] = /((?=abcda)a)/i; +res[202] = /((?=abcda)ab)/i; +res[203] = /()a/i; +res[204] = /(a)+/i; +res[205] = /(a){2,3}/i; +res[206] = /(a)*/i; +res[207] = /[a]/i; +res[208] = /[ab]/i; +res[209] = /[ab]/i; +res[210] = /[^a]/i; +res[211] = /\d456/i; +res[212] = /\d456/i; +res[213] = /a^b/i; +res[214] = /^a/im; +res[215] = /c|abc/i; +res[216] = /(.*)a/i; +res[217] = /(.*)a\1/i; +res[218] = /(.*)a(b)\2/i; +res[219] = /((.*)a|(.*)b)z/i; +res[220] = /((.*)a|(.*)b)z\1/i; +res[221] = /((.*)a|(.*)b)z\2/i; +res[222] = /((.*)a|(.*)b)z\3/i; +res[223] = /((.*)a|^(.*)b)z\3/i; +res[224] = /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a/i; +res[225] = /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\31/i; +res[226] = /(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)|(.*)a\32/i; +res[227] = /(a)(bc)/i; +res[228] = /(a+)*zz/i; +res[229] = /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/i; +res[230] = /((w\/|-|with)*(free|immediate)*.*?shipping\s*[!.-]*)/i; +res[231] = /a*.*b/i; +res[232] = /(a|b)*.?c/i; +res[233] = /abcde/i; +res[234] = /a*b/i; +res[235] = /a+b/i; +res[236] = /(abc|def)x/i; +res[237] = /(ab|cd){3,4}/i; +res[238] = /([ab]{,4}c|xy)/i; +res[239] = /([ab]{1,4}c|xy){4,5}?123/i; +res[240] = /\b.*/i; +res[241] = /\b.*/i; +res[242] = /(?!.bcd).*/i; +res[243] = /abcde/i; +res[244] = /0{0,2}ABC/i; +res[245] = /\d{3,}ABC/i; +res[246] = /\d*ABC/i; +res[247] = /[abc]+DE/i; +res[248] = /[abc]?123/i; +res[249] = /^(?:\d){3,5}X/i; +res[250] = /^a/i; +res[251] = /line\nbreak/i; +res[252] = /line\nbreak/i; +res[253] = /line\nbreak/im; +res[254] = /ab.cd/i; +res[255] = /ab.cd/i; +res[256] = /a(b)c/i; +res[257] = /Inthisnexttest,Jisnotsetattheouterlevel;consequentlyitisn'tsetinthepattern'soptions;consequentlypcre_get_named_substring()producesarandomvalue./i; +res[258] = /\777/i; +res[259] = /\s*,\s*/i; +res[260] = /^abc/im; +res[261] = /abc$/im; +res[262] = /^abc/im; +res[263] = /^abc/im; +res[264] = /^abc/im; +res[265] = /^abc/im; +res[266] = /abc/i; +res[267] = /.*/i; +res[268] = /\w+(.)(.)?def/i; +res[269] = /()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()()(.(.))/i; +res[270] = /()[ab]xyz/i; +res[271] = /(|)[ab]xyz/i; +res[272] = /(|c)[ab]xyz/i; +res[273] = /(|c?)[ab]xyz/i; +res[274] = /(d?|c?)[ab]xyz/i; +res[275] = /(d?|c)[ab]xyz/i; +res[276] = /^a*b\d/; +res[277] = /^a*?b\d/; +res[278] = /^a+A\d/; +res[279] = /^a*A\d/i; +res[280] = /(a*|b*)[cd]/i; +res[281] = /(a+|b*)[cd]/i; +res[282] = /(a*|b+)[cd]/i; +res[283] = /(a+|b+)[cd]/i; +res[284] = /(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((a)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))/i; +res[285] = /a*\d/; +res[286] = /a*\D/; +res[287] = /0*\d/; +res[288] = /0*\D/; +res[289] = /a*\s/; +res[290] = /a*\S/; +res[291] = / *\s/; +res[292] = / *\S/; +res[293] = /a*\w/; +res[294] = /a*\W/; +res[295] = /=*\w/; +res[296] = /=*\W/; +res[297] = /\d*a/; +res[298] = /\d*2/; +res[299] = /\d*\d/; +res[300] = /\d*\D/; +res[301] = /\d*\s/; +res[302] = /\d*\S/; +res[303] = /\d*\w/; +res[304] = /\d*\W/; +res[305] = /\D*a/; +res[306] = /\D*2/; +res[307] = /\D*\d/; +res[308] = /\D*\D/; +res[309] = /\D*\s/; +res[310] = /\D*\S/; +res[311] = /\D*\w/; +res[312] = /\D*\W/; +res[313] = /\s*a/; +res[314] = /\s*2/; +res[315] = /\s*\d/; +res[316] = /\s*\D/; +res[317] = /\s*\s/; +res[318] = /\s*\S/; +res[319] = /\s*\w/; +res[320] = /\s*\W/; +res[321] = /\S*a/; +res[322] = /\S*2/; +res[323] = /\S*\d/; +res[324] = /\S*\D/; +res[325] = /\S*\s/; +res[326] = /\S*\S/; +res[327] = /\S*\w/; +res[328] = /\S*\W/; +res[329] = /\w*a/; +res[330] = /\w*2/; +res[331] = /\w*\d/; +res[332] = /\w*\D/; +res[333] = /\w*\s/; +res[334] = /\w*\S/; +res[335] = /\w*\w/; +res[336] = /\w*\W/; +res[337] = /\W*a/; +res[338] = /\W*2/; +res[339] = /\W*\d/; +res[340] = /\W*\D/; +res[341] = /\W*\s/; +res[342] = /\W*\S/; +res[343] = /\W*\w/; +res[344] = /\W*\W/; +res[345] = /[^a]+a/; +res[346] = /[^a]+a/i; +res[347] = /[^a]+A/i; +res[348] = /[^a]+b/; +res[349] = /[^a]+\d/; +res[350] = /a*[^a]/; +res[351] = /^(?:(?:\1|X)(a|b))+/; +res[352] = /^[\E\Qa\E-\Qz\E]+/; +res[353] = /^[a\Q]bc\E]/; +res[354] = /(?=(\w+))\1:/i; +res[355] = /(a|)*\d/; +res[356] = /^a.b/; +res[357] = /^abc./mg; +res[358] = /abc.$/mg; +res[359] = /a/; +res[360] = /a/; +res[361] = /^a\Rb/i; +res[362] = /^a\R*b/i; +res[363] = /^a\R+b/i; +res[364] = /^a\R{1,3}b/i; +res[365] = /^a[\R]b/i; +res[366] = /^(a(b))\1\g1\g{1}\g-1\g{-1}\g{-02}Z/; +res[367] = /^(a)\g-2/; +res[368] = /^(a)\g/; +res[369] = /^(a)\g{0}/; +res[370] = /^(a)\g{3/; +res[371] = /^(a)\g{4a}/; +res[372] = /^a.b/; +res[373] = /.+foo/; +res[374] = /.+foo/; +res[375] = /.+foo/; +res[376] = /.+foo/; +res[377] = /^$/mg; +res[378] = /abc.$/mg; +res[379] = /^X/m; +res[380] = /(foo)\Kbar/; +res[381] = /(foo)(\Kbar|baz)/; +res[382] = /(foo\Kbar)baz/; +res[383] = /\g{A/; +res[384] = /\H\h\V\v/; +res[385] = /\H*\h+\V?\v{3,4}/; +res[386] = /\H{3,4}/; +res[387] = /.\h{3,4}./; +res[388] = /\h*X\h?\H+Y\H?Z/; +res[389] = /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/; +res[390] = /[\h]/; +res[391] = /[\h]+/; +res[392] = /[\v]/; +res[393] = /[\H]/; +res[394] = /[^\h]/; +res[395] = /[\V]/; +res[396] = /[\x0a\V]/; +res[397] = /\H+\hY/; +res[398] = /\H+ Y/; +res[399] = /\h+A/; +res[400] = /\v*B/; +res[401] = /\V+\x0a/; +res[402] = /A+\h/; +res[403] = / *\H/; +res[404] = /A*\v/; +res[405] = /\x0b*\V/; +res[406] = /\d+\h/; +res[407] = /\d*\v/; +res[408] = /S+\h\S+\v/; +res[409] = /\w{3,}\h\w+\v/; +res[410] = /\h+\d\h+\w\h+\S\h+\H/; +res[411] = /\v+\d\v+\w\v+\S\v+\V/; +res[412] = /\H+\h\H+\d/; +res[413] = /\V+\v\V+\w/; +res[414] = /[\E]AAA/; +res[415] = /[\Q\E]AAA/; +res[416] = /[^\E]AAA/; +res[417] = /[^\Q\E]AAA/; +res[418] = /[\E^]AAA/; +res[419] = /[\Q\E^]AAA/; +res[420] = /\g6666666666/; +res[421] = /[\g6666666666]/; +res[422] = /.+A/; +res[423] = /\nA/; +res[424] = /[\r\n]A/; +res[425] = /(\r|\n)A/; +res[426] = /a\Rb/i; +res[427] = /a\Rb/i; +res[428] = /a\R?b/i; +res[429] = /a\R?b/i; +res[430] = /a\R{2,4}b/i; +res[431] = /a\R{2,4}b/i; +res[432] = /\k''/; +res[433] = /\k<>/; +res[434] = /\k{}/; +res[435] = /[[:foo:]]/; +res[436] = /[[:1234:]]/; +res[437] = /[[:f\oo:]]/; +res[438] = /[[: :]]/; +res[439] = /[[:...:]]/; +res[440] = /[[:l\ower:]]/; +res[441] = /[[:abc\:]]/; +res[442] = /[abc[:x\]pqr:]]/; +res[443] = /[[:a\dz:]]/; +res[444] = /^(a|b\g<1>c)/; +res[445] = /^(a|b\g'1'c)/; +res[446] = /^(a|b\g'-1'c)/; +res[447] = /(^(a|b\g<-1>c))/; +res[448] = /(^(a|b\g<-1'c))/; +res[449] = /(^(a|b\g{-1}))/; +res[450] = /(\3)(\1)(a)/; +res[451] = /(\3)(\1)(a)/; +res[452] = /TA]/; +res[453] = /TA]/; +res[454] = /a[]b/; +res[455] = /a[^]b/; +res[456] = /a[]b/; +res[457] = /a[]+b/; +res[458] = /a[^]b/; +res[459] = /a[^]+b/; +res[460] = /a(?!)+b/; +res[461] = /(abc|pqr|123){0}[xyz]/i; +res[462] = / End of testinput2 /; +res[463] = /a.b/; +res[464] = /a(.{3})b/; +res[465] = /a(.*?)(.)/; +res[466] = /a(.*?)(.)/; +res[467] = /a(.*)(.)/; +res[468] = /a(.*)(.)/; +res[469] = /a(.)(.)/; +res[470] = /a(.)(.)/; +res[471] = /a(.?)(.)/; +res[472] = /a(.?)(.)/; +res[473] = /a(.??)(.)/; +res[474] = /a(.??)(.)/; +res[475] = /a(.{3})b/; +res[476] = /a(.{3,})b/; +res[477] = /a(.{3,}?)b/; +res[478] = /a(.{3,5})b/; +res[479] = /a(.{3,5}?)b/; +res[480] = /X(\C{3})/; +res[481] = /X(\C{4})/; +res[482] = /X\C*/; +res[483] = /X\C*?/; +res[484] = /X\C{3,5}/; +res[485] = /X\C{3,5}?/; +res[486] = /[^a]+/g; +res[487] = /^[^a]{2}/; +res[488] = /^[^a]{2,}/; +res[489] = /^[^a]{2,}?/; +res[490] = /[^a]+/ig; +res[491] = /^[^a]{2}/i; +res[492] = /^[^a]{2,}/i; +res[493] = /^[^a]{2,}?/i; +res[494] = /\D*/; +res[495] = /\D*/; +res[496] = /\D/; +res[497] = />\S/; +res[498] = /\d/; +res[499] = /\s/; +res[500] = /\D+/; +res[501] = /\D{2,3}/; +res[502] = /\D{2,3}?/; +res[503] = /\d+/; +res[504] = /\d{2,3}/; +res[505] = /\d{2,3}?/; +res[506] = /\S+/; +res[507] = /\S{2,3}/; +res[508] = /\S{2,3}?/; +res[509] = />\s+</; +res[510] = />\s{2,3}</; +res[511] = />\s{2,3}?</; +res[512] = /\w+/; +res[513] = /\w{2,3}/; +res[514] = /\w{2,3}?/; +res[515] = /\W+/; +res[516] = /\W{2,3}/; +res[517] = /\W{2,3}?/; +res[518] = /a\Cb/; +res[519] = /a\Cb/; +res[520] = /[\xFF]/; +res[521] = /[\xff]/; +res[522] = /[^\xFF]/; +res[523] = /[^\xff]/; +res[524] = /^[ac]*b/; +res[525] = /^[^x]*b/i; +res[526] = /^[^x]*b/; +res[527] = /^\d*b/; +res[528] = /(|a)/g; +res[529] = /\S\S/g; +res[530] = /\S{2}/g; +res[531] = /\W\W/g; +res[532] = /\W{2}/g; +res[533] = /\S/g; +res[534] = /[\S]/g; +res[535] = /\D/g; +res[536] = /[\D]/g; +res[537] = /\W/g; +res[538] = /[\W]/g; +res[539] = /[\S\s]*/; +res[540] = /.[^\S]./g; +res[541] = /.[^\S\n]./g; +res[542] = /[[:^alnum:]]/g; +res[543] = /[[:^alpha:]]/g; +res[544] = /[[:^ascii:]]/g; +res[545] = /[[:^blank:]]/g; +res[546] = /[[:^cntrl:]]/g; +res[547] = /[[:^digit:]]/g; +res[548] = /[[:^graph:]]/g; +res[549] = /[[:^lower:]]/g; +res[550] = /[[:^print:]]/g; +res[551] = /[[:^punct:]]/g; +res[552] = /[[:^space:]]/g; +res[553] = /[[:^upper:]]/g; +res[554] = /[[:^word:]]/g; +res[555] = /[[:^xdigit:]]/g; +res[556] = /^[^d]*?$/; +res[557] = /^[^d]*?$/; +res[558] = /^[^d]*?$/i; +res[559] = /^[^d]*?$/i; +res[560] = / End of testinput4 /; +res[561] = /\x80/; +res[562] = /\xff/; +res[563] = /.{3,5}X/; +res[564] = /.{3,5}?/; +res[565] = /X(\C)(.*)/; +res[566] = /^[ab]/; +res[567] = /^[^ab]/; +res[568] = /[^ab\xC0-\xF0]/; +res[569] = /[\xFF]/; +res[570] = /[\xff]/; +res[571] = /[^\xFF]/; +res[572] = /[^\xff]/; +res[573] = /anything/; +res[574] = /\W/; +res[575] = /\w/; +res[576] = /\777/i; +res[577] = /\777/i; +res[578] = /^abc./mg; +res[579] = /abc.$/mg; +res[580] = /^a\Rb/i; +res[581] = /^a\R*b/i; +res[582] = /^a\R+b/i; +res[583] = /^a\R{1,3}b/i; +res[584] = /\H\h\V\v/; +res[585] = /\H*\h+\V?\v{3,4}/; +res[586] = /\H\h\V\v/; +res[587] = /\H*\h+\V?\v{3,4}/; +res[588] = /[\h]/; +res[589] = /[\h]{3,}/; +res[590] = /[\v]/; +res[591] = /[\H]/; +res[592] = /[\V]/; +res[593] = /.*$/; +res[594] = /X/; +res[595] = /a\Rb/i; +res[596] = /a\Rb/i; +res[597] = /a\R?b/i; +res[598] = /a\R?b/i; +res[599] = /.*a.*=.b.*/; +res[600] = /a[^]b/; +res[601] = /a[^]+b/; +res[602] = /X/; +res[603] = / End of testinput5 /; +res[604] = /^\pC\pL\pM\pN\pP\pS\pZ</; +res[605] = /^\PC/; +res[606] = /^\PL/; +res[607] = /^\PM/; +res[608] = /^\PN/; +res[609] = /^\PP/; +res[610] = /^\PS/; +res[611] = /^\PZ/; +res[612] = /^\p{Cc}/; +res[613] = /^\p{Cf}/; +res[614] = /^\p{Cn}/; +res[615] = /^\p{Co}/; +res[616] = /^\p{Cs}/; +res[617] = /^\p{Ll}/; +res[618] = /^\p{Lm}/; +res[619] = /^\p{Lo}/; +res[620] = /^\p{Lt}/; +res[621] = /^\p{Lu}/; +res[622] = /^\p{Mc}/; +res[623] = /^\p{Me}/; +res[624] = /^\p{Mn}/; +res[625] = /^\p{Nl}/; +res[626] = /^\p{No}/; +res[627] = /^\p{Pc}/; +res[628] = /^\p{Pd}/; +res[629] = /^\p{Pe}/; +res[630] = /^\p{Pf}/; +res[631] = /^\p{Pi}/; +res[632] = /^\p{Po}/; +res[633] = /^\p{Ps}/; +res[634] = /^\p{Sk}/; +res[635] = /^\p{So}/; +res[636] = /^\p{Zl}/; +res[637] = /^\p{Zp}/; +res[638] = /^\p{Zs}/; +res[639] = /\p{Nd}{2,}(..)/; +res[640] = /\p{Nd}{2,}?(..)/; +res[641] = /\p{Nd}*(..)/; +res[642] = /\p{Nd}*?(..)/; +res[643] = /\p{Nd}{2}(..)/; +res[644] = /\p{Nd}{2,3}(..)/; +res[645] = /\p{Nd}{2,3}?(..)/; +res[646] = /\p{Nd}?(..)/; +res[647] = /\p{Nd}??(..)/; +res[648] = /\p{Lu}/i; +res[649] = /\p{^Lu}/i; +res[650] = /\P{Lu}/i; +res[651] = /[\p{L}]/; +res[652] = /[\p{^L}]/; +res[653] = /[\P{L}]/; +res[654] = /[\P{^L}]/; +res[655] = /[\p{Nd}]/; +res[656] = /[\P{Nd}]+/; +res[657] = /\D+/; +res[658] = /[\D]+/; +res[659] = /[\P{Nd}]+/; +res[660] = /[\D\P{Nd}]+/; +res[661] = /\pL/; +res[662] = /\pL/i; +res[663] = /\p{Lu}/; +res[664] = /\p{Lu}/i; +res[665] = /\p{Ll}/; +res[666] = /\p{Ll}/i; +res[667] = /^\X/; +res[668] = /^[\X]/; +res[669] = /^(\X*)C/; +res[670] = /^(\X*?)C/; +res[671] = /^(\X*)(.)/; +res[672] = /^(\X*?)(.)/; +res[673] = /^\X(.)/; +res[674] = /^\X{2,3}(.)/; +res[675] = /^\X{2,3}?(.)/; +res[676] = /^[\p{Arabic}]/; +res[677] = /^[\P{Yi}]/; +res[678] = /^\p{Any}X/; +res[679] = /^\P{Any}X/; +res[680] = /^\p{Any}?X/; +res[681] = /^\P{Any}?X/; +res[682] = /^\p{Any}*X/; +res[683] = /^\P{Any}*X/; +res[684] = /^[\p{Any}]X/; +res[685] = /^[\P{Any}]X/; +res[686] = /^[\p{Any}]?X/; +res[687] = /^[\P{Any}]?X/; +res[688] = /^[\p{Any}]+X/; +res[689] = /^[\P{Any}]+X/; +res[690] = /^[\p{Any}]*X/; +res[691] = /^[\P{Any}]*X/; +res[692] = /^\p{Any}{3,5}?/; +res[693] = /^\p{Any}{3,5}/; +res[694] = /^\P{Any}{3,5}?/; +res[695] = /^\p{L&}X/; +res[696] = /^[\p{L&}]X/; +res[697] = /^[\p{L&}]+X/; +res[698] = /^[\p{L&}]+?X/; +res[699] = /^\P{L&}X/; +res[700] = /^[\P{L&}]X/; +res[701] = /^(\p{Z}[^\p{C}\p{Z}]+)*$/; +res[702] = /([\pL]=(abc))*X/; +res[703] = /^\p{Balinese}\p{Cuneiform}\p{Nko}\p{Phags_Pa}\p{Phoenician}/; +res[704] = /The next two are special cases where the lengths of the different cases of the \nsame character differ. The first went wrong with heap frame storage; the 2nd\nwas broken in all cases./; +res[705] = /Check property support in non-UTF-8 mode/; +res[706] = /\p{L}{4}/; +res[707] = /\X{1,3}\d/; +res[708] = /\X?\d/; +res[709] = /\P{L}?\d/; +res[710] = /[\PPP\x8a]{1,}\x80/; +res[711] = /(?:[\PPa*]*){8,}/; +res[712] = /[\P{Any}]/; +res[713] = /[\P{Any}\E]/; +res[714] = /(\P{Yi}{2}\277)?/; +res[715] = /[\P{Yi}A]/; +res[716] = /[\P{Yi}\P{Yi}\P{Yi}A]/; +res[717] = /[^\P{Yi}A]/; +res[718] = /[^\P{Yi}\P{Yi}\P{Yi}A]/; +res[719] = /(\P{Yi}*\277)*/; +res[720] = /(\P{Yi}*?\277)*/; +res[721] = /(\P{Yi}?\277)*/; +res[722] = /(\P{Yi}??\277)*/; +res[723] = /(\P{Yi}{0,3}\277)*/; +res[724] = /(\P{Yi}{0,3}?\277)*/; +res[725] = /^[\p{Arabic}]/; +res[726] = /^\p{Cyrillic}/; +res[727] = /^\p{Common}/; +res[728] = /^\p{Inherited}/; +res[729] = /^\p{Shavian}/; +res[730] = /^\p{Deseret}/; +res[731] = /^\p{Osmanya}/; +res[732] = /\p{Zl}/; +res[733] = /\p{Carian}\p{Cham}\p{Kayah_Li}\p{Lepcha}\p{Lycian}\p{Lydian}\p{Ol_Chiki}\p{Rejang}\p{Saurashtra}\p{Sundanese}\p{Vai}/; +res[734] = /(A)\1/i; +res[735] = / End of testinput6 /; +res[736] = /abc/; +res[737] = /ab*c/; +res[738] = /ab+c/; +res[739] = /a*/; +res[740] = /(a|abcd|african)/; +res[741] = /^abc/; +res[742] = /^abc/m; +res[743] = /\Aabc/; +res[744] = /\Aabc/m; +res[745] = /\Gabc/; +res[746] = /x\dy\Dz/; +res[747] = /x\sy\Sz/; +res[748] = /x\wy\Wz/; +res[749] = /x.y/; +res[750] = /x.y/; +res[751] = /a\d\z/; +res[752] = /a\d\z/m; +res[753] = /a\d\Z/; +res[754] = /a\d\Z/m; +res[755] = /a\d$/; +res[756] = /a\d$/m; +res[757] = /abc/i; +res[758] = /[^a]/; +res[759] = /ab?\w/; +res[760] = /x{0,3}yz/; +res[761] = /x{3}yz/; +res[762] = /x{2,3}yz/; +res[763] = /[^a]+/; +res[764] = /[^a]*/; +res[765] = /[^a]{3,5}/; +res[766] = /\d*/; +res[767] = /\D*/; +res[768] = /\d+/; +res[769] = /\D+/; +res[770] = /\d?A/; +res[771] = /\D?A/; +res[772] = /a+/; +res[773] = /^.*xyz/; +res[774] = /^.+xyz/; +res[775] = /^.?xyz/; +res[776] = /^\d{2,3}X/; +res[777] = /^[abcd]\d/; +res[778] = /^[abcd]*\d/; +res[779] = /^[abcd]+\d/; +res[780] = /^a+X/; +res[781] = /^[abcd]?\d/; +res[782] = /^[abcd]{2,3}\d/; +res[783] = /^(abc)*\d/; +res[784] = /^(abc)+\d/; +res[785] = /^(abc)?\d/; +res[786] = /^(abc){2,3}\d/; +res[787] = /^(a*\w|ab)=(a*\w|ab)/; +res[788] = /^(?=abc)\w{5}:$/; +res[789] = /^(?!abc)\d\d$/; +res[790] = /(ab|cd){3,4}/; +res[791] = /^abc/; +res[792] = /^(a*|xyz)/; +res[793] = /xyz$/; +res[794] = /xyz$/m; +res[795] = /\Gabc/; +res[796] = /^abcdef/; +res[797] = /^a{2,4}\d+z/; +res[798] = /^abcdef/; +res[799] = /(ab*(cd|ef))+X/; +res[800] = /the quick brown fox/; +res[801] = /The quick brown fox/i; +res[802] = /abcd\t\n\r\f\a\e\071\x3b\$\\\?caxyz/; +res[803] = /a*abc?xyz+pqr{3}ab{2,}xy{4,5}pq{0,6}AB{0,}zz/; +res[804] = /^(abc){1,2}zz/; +res[805] = /^(b+?|a){1,2}?c/; +res[806] = /^(b+|a){1,2}c/; +res[807] = /^(b*|ba){1,2}?bc/; +res[808] = /^(ba|b*){1,2}?bc/; +res[809] = /^[ab\]cde]/; +res[810] = /^[]cde]/; +res[811] = /^[^ab\]cde]/; +res[812] = /^[^]cde]/; +res[813] = /^[0-9]+$/; +res[814] = /^.*nter/; +res[815] = /^xxx[0-9]+$/; +res[816] = /^.+[0-9][0-9][0-9]$/; +res[817] = /^.+?[0-9][0-9][0-9]$/; +res[818] = /^([^!]+)!(.+)=apquxz\.ixr\.zzz\.ac\.uk$/; +res[819] = /:/; +res[820] = /([\da-f:]+)$/i; +res[821] = /^.*\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})$/; +res[822] = /^(\d+)\s+IN\s+SOA\s+(\S+)\s+(\S+)\s*\(\s*$/; +res[823] = /^[a-zA-Z\d][a-zA-Z\d\-]*(\.[a-zA-Z\d][a-zA-z\d\-]*)*\.$/; +res[824] = /^\*\.[a-z]([a-z\-\d]*[a-z\d]+)?(\.[a-z]([a-z\-\d]*[a-z\d]+)?)*$/; +res[825] = /^(?=ab(de))(abd)(e)/; +res[826] = /^(?!(ab)de|x)(abd)(f)/; +res[827] = /^(?=(ab(cd)))(ab)/; +res[828] = /^[\da-f](\.[\da-f])*$/i; +res[829] = /^\".*\"\s*(;.*)?$/; +res[830] = /^$/; +res[831] = /^ab\sc$/; +res[832] = /^a\ b[c]d$/; +res[833] = /^(a(b(c)))(d(e(f)))(h(i(j)))(k(l(m)))$/; +res[834] = /^(?:a(b(c)))(?:d(e(f)))(?:h(i(j)))(?:k(l(m)))$/; +res[835] = /^[\w][\W][\s][\S][\d][\D][\b][\n][\c]][\022]/; +res[836] = /^a*\w/; +res[837] = /^a*?\w/; +res[838] = /^a+\w/; +res[839] = /^a+?\w/; +res[840] = /^\d{8}\w{2,}/; +res[841] = /^[aeiou\d]{4,5}$/; +res[842] = /^[aeiou\d]{4,5}?/; +res[843] = /^From +([^ ]+) +[a-zA-Z][a-zA-Z][a-zA-Z] +[a-zA-Z][a-zA-Z][a-zA-Z] +[0-9]?[0-9] +[0-9][0-9]:[0-9][0-9]/; +res[844] = /^From\s+\S+\s+([a-zA-Z]{3}\s+){2}\d{1,2}\s+\d\d:\d\d/; +res[845] = /^12.34/; +res[846] = /\w+(?=\t)/; +res[847] = /foo(?!bar)(.*)/; +res[848] = /(?:(?!foo)...|^.{0,2})bar(.*)/; +res[849] = /^(\D*)(?=\d)(?!123)/; +res[850] = /^1234/; +res[851] = /^1234/; +res[852] = /abcd/; +res[853] = /^abcd/; +res[854] = /(?!^)abc/; +res[855] = /(?=^)abc/; +res[856] = /^[ab]{1,3}(ab*|b)/; +res[857] = /^[ab]{1,3}?(ab*|b)/; +res[858] = /^[ab]{1,3}?(ab*?|b)/; +res[859] = /^[ab]{1,3}(ab*?|b)/; +res[860] = /(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*|(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")(?:[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\)|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")*<(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*,(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*)*:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*)?(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*")(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"(?:[^\\\x80-\xff\n\015"]|\\[^\x80-\xff])*"))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*@(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])(?:(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*\.(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\]))*(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*>)(?:[\040\t]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff]|\((?:[^\\\x80-\xff\n\015()]|\\[^\x80-\xff])*\))*\))*/; +res[861] = /[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*|(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]*(?:(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[^()<>@,;:".\\\[\]\x80-\xff\000-\010\012-\037]*)*<[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*(?:,[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*)*:[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)?(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|"[^\\\x80-\xff\n\015"]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015"]*)*")[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*@[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:\.[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*(?:[^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff]+(?![^(\040)<>@,;:".\\\[\]\000-\037\x80-\xff])|\[(?:[^\\\x80-\xff\n\015\[\]]|\\[^\x80-\xff])*\])[\040\t]*(?:\([^\\\x80-\xff\n\015()]*(?:(?:\\[^\x80-\xff]|\([^\\\x80-\xff\n\015()]*(?:\\[^\x80-\xff][^\\\x80-\xff\n\015()]*)*\))[^\\\x80-\xff\n\015()]*)*\)[\040\t]*)*)*>)/; +res[862] = /abc\x0def\x00pqr\x000xyz\x0000AB/; +res[863] = /^[\000-\037]/; +res[864] = /\0*/; +res[865] = /A\x0{2,3}Z/; +res[866] = /^\s/; +res[867] = /^abc/; +res[868] = /ab{1,3}bc/; +res[869] = /([^.]*)\.([^:]*):[T ]+(.*)/; +res[870] = /([^.]*)\.([^:]*):[T ]+(.*)/i; +res[871] = /([^.]*)\.([^:]*):[t ]+(.*)/i; +res[872] = /^[W-c]+$/; +res[873] = /^[W-c]+$/i; +res[874] = /^[\x3f-\x5F]+$/i; +res[875] = /^abc$/m; +res[876] = /^abc$/; +res[877] = /\Aabc\Z/m; +res[878] = /\A(.)*\Z/; +res[879] = /\A(.)*\Z/m; +res[880] = /(?:b)|(?::+)/; +res[881] = /[-az]+/; +res[882] = /[az-]+/; +res[883] = /[a\-z]+/; +res[884] = /[a-z]+/; +res[885] = /[\d-]+/; +res[886] = /[\d-z]+/; +res[887] = /\x5c/; +res[888] = /\x20Z/; +res[889] = /ab{3cd/; +res[890] = /ab{3,cd/; +res[891] = /ab{3,4a}cd/; +res[892] = /{4,5a}bc/; +res[893] = /^a.b/; +res[894] = /abc$/; +res[895] = /(abc)\123/; +res[896] = /(abc)\223/; +res[897] = /(abc)\323/; +res[898] = /(abc)\100/; +res[899] = /abc\81/; +res[900] = /abc\91/; +res[901] = /(a)(b)(c)(d)(e)(f)(g)(h)(i)(j)(k)\12\123/; +res[902] = /ab\idef/; +res[903] = /a{0}bc/; +res[904] = /(a|(bc)){0,0}?xyz/; +res[905] = /abc[\10]de/; +res[906] = /abc[\1]de/; +res[907] = /(abc)[\1]de/; +res[908] = /^([^a])([^\b])([^c]*)([^d]{3,4})/; +res[909] = /[^a]/; +res[910] = /[^a]/i; +res[911] = /[^a]+/; +res[912] = /[^a]+/i; +res[913] = /[^a]+/; +res[914] = /[^k]$/; +res[915] = /[^k]{2,3}$/; +res[916] = /^\d{8,}\@.+[^k]$/; +res[917] = /[^a]/; +res[918] = /[^a]/i; +res[919] = /[^az]/; +res[920] = /[^az]/i; +res[921] = /\000\001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037\040\041\042\043\044\045\046\047\050\051\052\053\054\055\056\057\060\061\062\063\064\065\066\067\070\071\072\073\074\075\076\077\100\101\102\103\104\105\106\107\110\111\112\113\114\115\116\117\120\121\122\123\124\125\126\127\130\131\132\133\134\135\136\137\140\141\142\143\144\145\146\147\150\151\152\153\154\155\156\157\160\161\162\163\164\165\166\167\170\171\172\173\174\175\176\177\200\201\202\203\204\205\206\207\210\211\212\213\214\215\216\217\220\221\222\223\224\225\226\227\230\231\232\233\234\235\236\237\240\241\242\243\244\245\246\247\250\251\252\253\254\255\256\257\260\261\262\263\264\265\266\267\270\271\272\273\274\275\276\277\300\301\302\303\304\305\306\307\310\311\312\313\314\315\316\317\320\321\322\323\324\325\326\327\330\331\332\333\334\335\336\337\340\341\342\343\344\345\346\347\350\351\352\353\354\355\356\357\360\361\362\363\364\365\366\367\370\371\372\373\374\375\376\377/; +res[922] = /P[^*]TAIRE[^*]{1,6}?LL/; +res[923] = /P[^*]TAIRE[^*]{1,}?LL/; +res[924] = /(\.\d\d[1-9]?)\d+/; +res[925] = /(\.\d\d((?=0)|\d(?=\d)))/; +res[926] = /\b(foo)\s+(\w+)/i; +res[927] = /foo(.*)bar/; +res[928] = /foo(.*?)bar/; +res[929] = /(.*)(\d*)/; +res[930] = /(.*)(\d+)/; +res[931] = /(.*?)(\d*)/; +res[932] = /(.*?)(\d+)/; +res[933] = /(.*)(\d+)$/; +res[934] = /(.*?)(\d+)$/; +res[935] = /(.*)\b(\d+)$/; +res[936] = /(.*\D)(\d+)$/; +res[937] = /^\D*(?!123)/; +res[938] = /^(\D*)(?=\d)(?!123)/; +res[939] = /^[W-]46]/; +res[940] = /^[W-\]46]/; +res[941] = /\d\d\/\d\d\/\d\d\d\d/; +res[942] = /word (?:[a-zA-Z0-9]+ ){0,10}otherword/; +res[943] = /word (?:[a-zA-Z0-9]+ ){0,300}otherword/; +res[944] = /^(a){0,0}/; +res[945] = /^(a){0,1}/; +res[946] = /^(a){0,2}/; +res[947] = /^(a){0,3}/; +res[948] = /^(a){0,}/; +res[949] = /^(a){1,1}/; +res[950] = /^(a){1,2}/; +res[951] = /^(a){1,3}/; +res[952] = /^(a){1,}/; +res[953] = /.*\.gif/; +res[954] = /.{0,}\.gif/; +res[955] = /.*\.gif/m; +res[956] = /.*\.gif/; +res[957] = /.*\.gif/m; +res[958] = /.*$/; +res[959] = /.*$/m; +res[960] = /.*$/; +res[961] = /.*$/m; +res[962] = /.*$/; +res[963] = /.*$/m; +res[964] = /.*$/; +res[965] = /.*$/m; +res[966] = /(.*X|^B)/; +res[967] = /(.*X|^B)/m; +res[968] = /(.*X|^B)/; +res[969] = /(.*X|^B)/m; +res[970] = /^.*B/; +res[971] = /^[0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9][0-9]/; +res[972] = /^\d\d\d\d\d\d\d\d\d\d\d\d/; +res[973] = /^[\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d][\d]/; +res[974] = /^[abc]{12}/; +res[975] = /^[a-c]{12}/; +res[976] = /^(a|b|c){12}/; +res[977] = /^[abcdefghijklmnopqrstuvwxy0123456789]/; +res[978] = /abcde{0,0}/; +res[979] = /ab[cd]{0,0}e/; +res[980] = /ab(c){0,0}d/; +res[981] = /a(b*)/; +res[982] = /ab\d{0}e/; +res[983] = /"([^\\"]+|\\.)*"/; +res[984] = /.*?/g; +res[985] = /\b/g; +res[986] = /\b/g; +res[987] = /<tr([\w\W\s\d][^<>]{0,})><TD([\w\W\s\d][^<>]{0,})>([\d]{0,}\.)(.*)((<BR>([\w\W\s\d][^<>]{0,})|[\s]{0,}))<\/a><\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><TD([\w\W\s\d][^<>]{0,})>([\w\W\s\d][^<>]{0,})<\/TD><\/TR>/i; +res[988] = /a[^a]b/; +res[989] = /a.b/; +res[990] = /a[^a]b/; +res[991] = /a.b/; +res[992] = /^(b+?|a){1,2}?c/; +res[993] = /^(b+|a){1,2}?c/; +res[994] = /(?!\A)x/m; +res[995] = /\x0{ab}/; +res[996] = /(A|B)*?CD/; +res[997] = /(A|B)*CD/; +res[998] = /\Aabc\z/m; +res[999] = /(\d+)(\w)/; +res[1000] = /(a+|b+|c+)*c/; +res[1001] = /(abc|)+/; +res[1002] = /([a]*)*/; +res[1003] = /([ab]*)*/; +res[1004] = /([^a]*)*/; +res[1005] = /([^ab]*)*/; +res[1006] = /([a]*?)*/; +res[1007] = /([ab]*?)*/; +res[1008] = /([^a]*?)*/; +res[1009] = /([^ab]*?)*/; +res[1010] = /The following tests are taken from the Perl 5.005 test suite; some of them/; +res[1011] = /are compatible with 5.004, but I'd rather not have to sort them out./; +res[1012] = /abc/; +res[1013] = /ab*c/; +res[1014] = /ab*bc/; +res[1015] = /.{1}/; +res[1016] = /.{3,4}/; +res[1017] = /ab{0,}bc/; +res[1018] = /ab+bc/; +res[1019] = /ab{1,}bc/; +res[1020] = /ab+bc/; +res[1021] = /ab{1,}bc/; +res[1022] = /ab{1,3}bc/; +res[1023] = /ab{3,4}bc/; +res[1024] = /ab{4,5}bc/; +res[1025] = /ab?bc/; +res[1026] = /ab{0,1}bc/; +res[1027] = /ab?bc/; +res[1028] = /ab?c/; +res[1029] = /ab{0,1}c/; +res[1030] = /^abc$/; +res[1031] = /^abc/; +res[1032] = /^abc$/; +res[1033] = /abc$/; +res[1034] = /^/; +res[1035] = /$/; +res[1036] = /a.c/; +res[1037] = /a.*c/; +res[1038] = /a[bc]d/; +res[1039] = /a[b-d]e/; +res[1040] = /a[b-d]/; +res[1041] = /a[-b]/; +res[1042] = /a[b-]/; +res[1043] = /a]/; +res[1044] = /a[]]b/; +res[1045] = /a[^bc]d/; +res[1046] = /a[^-b]c/; +res[1047] = /a[^]b]c/; +res[1048] = /\ba\b/; +res[1049] = /\by\b/; +res[1050] = /\Ba\B/; +res[1051] = /\By\b/; +res[1052] = /\by\B/; +res[1053] = /\By\B/; +res[1054] = /\w/; +res[1055] = /\W/; +res[1056] = /a\sb/; +res[1057] = /a\Sb/; +res[1058] = /\d/; +res[1059] = /\D/; +res[1060] = /[\w]/; +res[1061] = /[\W]/; +res[1062] = /a[\s]b/; +res[1063] = /a[\S]b/; +res[1064] = /[\d]/; +res[1065] = /[\D]/; +res[1066] = /ab|cd/; +res[1067] = /()ef/; +res[1068] = /$b/; +res[1069] = /a\(b/; +res[1070] = /a\\b/; +res[1071] = /((a))/; +res[1072] = /(a)b(c)/; +res[1073] = /a+b+c/; +res[1074] = /a{1,}b{1,}c/; +res[1075] = /a.+?c/; +res[1076] = /(a+|b)*/; +res[1077] = /(a+|b){0,}/; +res[1078] = /(a+|b)+/; +res[1079] = /(a+|b){1,}/; +res[1080] = /(a+|b)?/; +res[1081] = /(a+|b){0,1}/; +res[1082] = /[^ab]*/; +res[1083] = /abc/; +res[1084] = /a*/; +res[1085] = /([abc])*d/; +res[1086] = /([abc])*bcd/; +res[1087] = /a|b|c|d|e/; +res[1088] = /(a|b|c|d|e)f/; +res[1089] = /abcd*efg/; +res[1090] = /ab*/; +res[1091] = /(ab|cd)e/; +res[1092] = /[abhgefdc]ij/; +res[1093] = /^(ab|cd)e/; +res[1094] = /(abc|)ef/; +res[1095] = /(a|b)c*d/; +res[1096] = /(ab|ab*)bc/; +res[1097] = /a([bc]*)c*/; +res[1098] = /a([bc]*)(c*d)/; +res[1099] = /a([bc]+)(c*d)/; +res[1100] = /a([bc]*)(c+d)/; +res[1101] = /a[bcd]*dcdcde/; +res[1102] = /a[bcd]+dcdcde/; +res[1103] = /(ab|a)b*c/; +res[1104] = /((a)(b)c)(d)/; +res[1105] = /[a-zA-Z_][a-zA-Z0-9_]*/; +res[1106] = /^a(bc+|b[eh])g|.h$/; +res[1107] = /(bc+d$|ef*g.|h?i(j|k))/; +res[1108] = /((((((((((a))))))))))/; +res[1109] = /(((((((((a)))))))))/; +res[1110] = /multiple words of text/; +res[1111] = /multiple words/; +res[1112] = /(.*)c(.*)/; +res[1113] = /\((.*), (.*)\)/; +res[1114] = /[k]/; +res[1115] = /abcd/; +res[1116] = /a(bc)d/; +res[1117] = /a[-]?c/; +res[1118] = /abc/i; +res[1119] = /ab*c/i; +res[1120] = /ab*bc/i; +res[1121] = /ab*?bc/i; +res[1122] = /ab{0,}?bc/i; +res[1123] = /ab+?bc/i; +res[1124] = /ab+bc/i; +res[1125] = /ab{1,}bc/i; +res[1126] = /ab+bc/i; +res[1127] = /ab{1,}?bc/i; +res[1128] = /ab{1,3}?bc/i; +res[1129] = /ab{3,4}?bc/i; +res[1130] = /ab{4,5}?bc/i; +res[1131] = /ab??bc/i; +res[1132] = /ab{0,1}?bc/i; +res[1133] = /ab??bc/i; +res[1134] = /ab??c/i; +res[1135] = /ab{0,1}?c/i; +res[1136] = /^abc$/i; +res[1137] = /^abc/i; +res[1138] = /^abc$/i; +res[1139] = /abc$/i; +res[1140] = /^/i; +res[1141] = /$/i; +res[1142] = /a.c/i; +res[1143] = /a.*?c/i; +res[1144] = /a.*c/i; +res[1145] = /a[bc]d/i; +res[1146] = /a[b-d]e/i; +res[1147] = /a[b-d]/i; +res[1148] = /a[-b]/i; +res[1149] = /a[b-]/i; +res[1150] = /a]/i; +res[1151] = /a[]]b/i; +res[1152] = /a[^bc]d/i; +res[1153] = /a[^-b]c/i; +res[1154] = /a[^]b]c/i; +res[1155] = /ab|cd/i; +res[1156] = /()ef/i; +res[1157] = /$b/i; +res[1158] = /a\(b/i; +res[1159] = /a\\b/i; +res[1160] = /((a))/i; +res[1161] = /(a)b(c)/i; +res[1162] = /a+b+c/i; +res[1163] = /a{1,}b{1,}c/i; +res[1164] = /a.+?c/i; +res[1165] = /a.*?c/i; +res[1166] = /a.{0,5}?c/i; +res[1167] = /(a+|b)*/i; +res[1168] = /(a+|b){0,}/i; +res[1169] = /(a+|b)+/i; +res[1170] = /(a+|b){1,}/i; +res[1171] = /(a+|b)?/i; +res[1172] = /(a+|b){0,1}/i; +res[1173] = /(a+|b){0,1}?/i; +res[1174] = /[^ab]*/i; +res[1175] = /abc/i; +res[1176] = /a*/i; +res[1177] = /([abc])*d/i; +res[1178] = /([abc])*bcd/i; +res[1179] = /a|b|c|d|e/i; +res[1180] = /(a|b|c|d|e)f/i; +res[1181] = /abcd*efg/i; +res[1182] = /ab*/i; +res[1183] = /(ab|cd)e/i; +res[1184] = /[abhgefdc]ij/i; +res[1185] = /^(ab|cd)e/i; +res[1186] = /(abc|)ef/i; +res[1187] = /(a|b)c*d/i; +res[1188] = /(ab|ab*)bc/i; +res[1189] = /a([bc]*)c*/i; +res[1190] = /a([bc]*)(c*d)/i; +res[1191] = /a([bc]+)(c*d)/i; +res[1192] = /a([bc]*)(c+d)/i; +res[1193] = /a[bcd]*dcdcde/i; +res[1194] = /a[bcd]+dcdcde/i; +res[1195] = /(ab|a)b*c/i; +res[1196] = /((a)(b)c)(d)/i; +res[1197] = /[a-zA-Z_][a-zA-Z0-9_]*/i; +res[1198] = /^a(bc+|b[eh])g|.h$/i; +res[1199] = /(bc+d$|ef*g.|h?i(j|k))/i; +res[1200] = /((((((((((a))))))))))/i; +res[1201] = /(((((((((a)))))))))/i; +res[1202] = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a))))))))))/i; +res[1203] = /(?:(?:(?:(?:(?:(?:(?:(?:(?:(a|b|c))))))))))/i; +res[1204] = /multiple words of text/i; +res[1205] = /multiple words/i; +res[1206] = /(.*)c(.*)/i; +res[1207] = /\((.*), (.*)\)/i; +res[1208] = /[k]/i; +res[1209] = /abcd/i; +res[1210] = /a(bc)d/i; +res[1211] = /a[-]?c/i; +res[1212] = /a(?!b)./; +res[1213] = /a(?=d)./; +res[1214] = /a(?=c|d)./; +res[1215] = /a(?:b|c|d)(.)/; +res[1216] = /a(?:b|c|d)*(.)/; +res[1217] = /a(?:b|c|d)+?(.)/; +res[1218] = /a(?:b|c|d)+(.)/; +res[1219] = /a(?:b|c|d){2}(.)/; +res[1220] = /a(?:b|c|d){4,5}(.)/; +res[1221] = /a(?:b|c|d){4,5}?(.)/; +res[1222] = /((foo)|(bar))*/; +res[1223] = /a(?:b|c|d){6,7}(.)/; +res[1224] = /a(?:b|c|d){6,7}?(.)/; +res[1225] = /a(?:b|c|d){5,6}(.)/; +res[1226] = /a(?:b|c|d){5,6}?(.)/; +res[1227] = /a(?:b|c|d){5,7}(.)/; +res[1228] = /a(?:b|c|d){5,7}?(.)/; +res[1229] = /a(?:b|(c|e){1,2}?|d)+?(.)/; +res[1230] = /^(.+)?B/; +res[1231] = /^([^a-z])|(\^)$/; +res[1232] = /^[<>]&/; +res[1233] = /(?:(f)(o)(o)|(b)(a)(r))*/; +res[1234] = /(?:..)*a/; +res[1235] = /(?:..)*?a/; +res[1236] = /^(){3,5}/; +res[1237] = /^(a+)*ax/; +res[1238] = /^((a|b)+)*ax/; +res[1239] = /^((a|bc)+)*ax/; +res[1240] = /(a|x)*ab/; +res[1241] = /(a)*ab/; +res[1242] = /(?:c|d)(?:)(?:a(?:)(?:b)(?:b(?:))(?:b(?:)(?:b)))/; +res[1243] = /(?:c|d)(?:)(?:aaaaaaaa(?:)(?:bbbbbbbb)(?:bbbbbbbb(?:))(?:bbbbbbbb(?:)(?:bbbbbbbb)))/; +res[1244] = /foo\w*\d{4}baz/; +res[1245] = /x(~~)*(?:(?:F)?)?/; +res[1246] = /^a{3}c/; +res[1247] = /^a{3}c/; +res[1248] = /^(?:a?b?)*$/; +res[1249] = /^b/; +res[1250] = /()^b/; +res[1251] = /(\w+:)+/; +res[1252] = /([\w:]+::)?(\w+)$/; +res[1253] = /^[^bcd]*(c+)/; +res[1254] = /(a*)b+/; +res[1255] = /([\w:]+::)?(\w+)$/; +res[1256] = /^[^bcd]*(c+)/; +res[1257] = /(>a+)ab/; +res[1258] = /([[:]+)/; +res[1259] = /([[=]+)/; +res[1260] = /([[.]+)/; +res[1261] = /a\Z/; +res[1262] = /b\Z/; +res[1263] = /b\z/; +res[1264] = /b\Z/; +res[1265] = /b\z/; +res[1266] = /((Z)+|A)*/; +res[1267] = /(Z()|A)*/; +res[1268] = /(Z(())|A)*/; +res[1269] = /a*/g; +res[1270] = /^[\d-a]/; +res[1271] = /[[:space:]]+/; +res[1272] = /[[:blank:]]+/; +res[1273] = /[\s]+/; +res[1274] = /\s+/; +res[1275] = /ab/; +res[1276] = /(?!\A)x/m; +res[1277] = /(?!^)x/m; +res[1278] = /abc\Qabc\Eabc/; +res[1279] = /abc\Qabc\Eabc/; +res[1280] = /abc\Qliteral\E/; +res[1281] = /abc\Qliteral/; +res[1282] = /abc\Qliteral\E/; +res[1283] = /abc\Qliteral\E/; +res[1284] = /\Qabc\$xyz\E/; +res[1285] = /\Qabc\E\$\Qxyz\E/; +res[1286] = /\Gabc/; +res[1287] = /\Gabc./g; +res[1288] = /abc./g; +res[1289] = /[z\Qa-d]\E]/; +res[1290] = /[\z\C]/; +res[1291] = /\M/; +res[1292] = /(a+)*b/; +res[1293] = /line\nbreak/; +res[1294] = /line\nbreak/; +res[1295] = /line\nbreak/m; +res[1296] = /1234/; +res[1297] = /1234/; +res[1298] = /^/mg; +res[1299] = /Content-Type\x3A[^\r\n]{6,}/; +res[1300] = /Content-Type\x3A[^\r\n]{6,}z/; +res[1301] = /Content-Type\x3A[^a]{6,}/; +res[1302] = /Content-Type\x3A[^a]{6,}z/; +res[1303] = /^abc/m; +res[1304] = /abc$/m; +res[1305] = /^abc/m; +res[1306] = /^abc/m; +res[1307] = /^abc/m; +res[1308] = /.*/; +res[1309] = /\w+(.)(.)?def/; +res[1310] = /^\w+=.*(\\\n.*)*/; +res[1311] = /^(a()*)*/; +res[1312] = /^(?:a(?:(?:))*)*/; +res[1313] = /^(a()+)+/; +res[1314] = /^(?:a(?:(?:))+)+/; +res[1315] = /(a|)*\d/; +res[1316] = /(?:a|)*\d/; +res[1317] = /^a.b/; +res[1318] = /^abc./mg; +res[1319] = /abc.$/mg; +res[1320] = /^a\Rb/i; +res[1321] = /^a\R*b/i; +res[1322] = /^a\R+b/i; +res[1323] = /^a\R{1,3}b/i; +res[1324] = /^a[\R]b/i; +res[1325] = /.+foo/; +res[1326] = /.+foo/; +res[1327] = /.+foo/; +res[1328] = /.+foo/; +res[1329] = /^$/mg; +res[1330] = /^X/m; +res[1331] = /\H\h\V\v/; +res[1332] = /\H*\h+\V?\v{3,4}/; +res[1333] = /\H{3,4}/; +res[1334] = /.\h{3,4}./; +res[1335] = /\h*X\h?\H+Y\H?Z/; +res[1336] = /\v*X\v?Y\v+Z\V*\x0a\V+\x0b\V{2,3}\x0c/; +res[1337] = /.+A/; +res[1338] = /\nA/; +res[1339] = /[\r\n]A/; +res[1340] = /(\r|\n)A/; +res[1341] = /a\Rb/i; +res[1342] = /a\Rb/i; +res[1343] = /a\R?b/i; +res[1344] = /a\R?b/i; +res[1345] = /a\R{2,4}b/i; +res[1346] = /a\R{2,4}b/i; +res[1347] = /a(?!)|\wbc/; +res[1348] = /a[]b/; +res[1349] = /a[]+b/; +res[1350] = /a[^]b/; +res[1351] = /a[^]+b/; +res[1352] = / End of testinput7 /; +res[1353] = /\bX/; +res[1354] = /\BX/; +res[1355] = /X\b/; +res[1356] = /X\B/; +res[1357] = /[^a]/; +res[1358] = /abc/; +res[1359] = /a.b/; +res[1360] = /a(.{3})b/; +res[1361] = /a(.*?)(.)/; +res[1362] = /a(.*?)(.)/; +res[1363] = /a(.*)(.)/; +res[1364] = /a(.*)(.)/; +res[1365] = /a(.)(.)/; +res[1366] = /a(.)(.)/; +res[1367] = /a(.?)(.)/; +res[1368] = /a(.?)(.)/; +res[1369] = /a(.??)(.)/; +res[1370] = /a(.??)(.)/; +res[1371] = /a(.{3})b/; +res[1372] = /a(.{3,})b/; +res[1373] = /a(.{3,}?)b/; +res[1374] = /a(.{3,5})b/; +res[1375] = /a(.{3,5}?)b/; +res[1376] = /[^a]+/g; +res[1377] = /^[^a]{2}/; +res[1378] = /^[^a]{2,}/; +res[1379] = /^[^a]{2,}?/; +res[1380] = /[^a]+/ig; +res[1381] = /^[^a]{2}/i; +res[1382] = /^[^a]{2,}/i; +res[1383] = /^[^a]{2,}?/i; +res[1384] = /\D*/; +res[1385] = /\D*/; +res[1386] = /\D/; +res[1387] = />\S/; +res[1388] = /\d/; +res[1389] = /\s/; +res[1390] = /\D+/; +res[1391] = /\D{2,3}/; +res[1392] = /\D{2,3}?/; +res[1393] = /\d+/; +res[1394] = /\d{2,3}/; +res[1395] = /\d{2,3}?/; +res[1396] = /\S+/; +res[1397] = /\S{2,3}/; +res[1398] = /\S{2,3}?/; +res[1399] = />\s+</; +res[1400] = />\s{2,3}</; +res[1401] = />\s{2,3}?</; +res[1402] = /\w+/; +res[1403] = /\w{2,3}/; +res[1404] = /\w{2,3}?/; +res[1405] = /\W+/; +res[1406] = /\W{2,3}/; +res[1407] = /\W{2,3}?/; +res[1408] = /[\xFF]/; +res[1409] = /[\xff]/; +res[1410] = /[^\xFF]/; +res[1411] = /[^\xff]/; +res[1412] = /^[ac]*b/; +res[1413] = /^[^x]*b/i; +res[1414] = /^[^x]*b/; +res[1415] = /^\d*b/; +res[1416] = /(|a)/g; +res[1417] = /^abc./mg; +res[1418] = /abc.$/mg; +res[1419] = /^a\Rb/i; +res[1420] = /^a\R*b/i; +res[1421] = /^a\R+b/i; +res[1422] = /^a\R{1,3}b/i; +res[1423] = /\h+\V?\v{3,4}/; +res[1424] = /\V?\v{3,4}/; +res[1425] = /\h+\V?\v{3,4}/; +res[1426] = /\V?\v{3,4}/; +res[1427] = /\H\h\V\v/; +res[1428] = /\H*\h+\V?\v{3,4}/; +res[1429] = /\H\h\V\v/; +res[1430] = /\H*\h+\V?\v{3,4}/; +res[1431] = /a\Rb/i; +res[1432] = /a\Rb/i; +res[1433] = /a\R?b/i; +res[1434] = /a\R?b/i; +res[1435] = /X/; +res[1436] = / End of testinput 8 /; +res[1437] = /\pL\P{Nd}/; +res[1438] = /\X./; +res[1439] = /\X\X/; +res[1440] = /^\pL+/; +res[1441] = /^\PL+/; +res[1442] = /^\X+/; +res[1443] = /\X?abc/; +res[1444] = /^\X?abc/; +res[1445] = /\X*abc/; +res[1446] = /^\X*abc/; +res[1447] = /^\pL?=./; +res[1448] = /^\pL*=./; +res[1449] = /^\X{2,3}X/; +res[1450] = /^\pC\pL\pM\pN\pP\pS\pZ</; +res[1451] = /^\PC/; +res[1452] = /^\PL/; +res[1453] = /^\PM/; +res[1454] = /^\PN/; +res[1455] = /^\PP/; +res[1456] = /^\PS/; +res[1457] = /^\PZ/; +res[1458] = /^\p{Cc}/; +res[1459] = /^\p{Cf}/; +res[1460] = /^\p{Cn}/; +res[1461] = /^\p{Co}/; +res[1462] = /^\p{Cs}/; +res[1463] = /^\p{Ll}/; +res[1464] = /^\p{Lm}/; +res[1465] = /^\p{Lo}/; +res[1466] = /^\p{Lt}/; +res[1467] = /^\p{Lu}/; +res[1468] = /^\p{Mc}/; +res[1469] = /^\p{Me}/; +res[1470] = /^\p{Mn}/; +res[1471] = /^\p{Nl}/; +res[1472] = /^\p{No}/; +res[1473] = /^\p{Pc}/; +res[1474] = /^\p{Pd}/; +res[1475] = /^\p{Pe}/; +res[1476] = /^\p{Pf}/; +res[1477] = /^\p{Pi}/; +res[1478] = /^\p{Po}/; +res[1479] = /^\p{Ps}/; +res[1480] = /^\p{Sk}/; +res[1481] = /^\p{So}/; +res[1482] = /^\p{Zl}/; +res[1483] = /^\p{Zp}/; +res[1484] = /^\p{Zs}/; +res[1485] = /\p{Nd}{2,}(..)/; +res[1486] = /\p{Nd}{2,}?(..)/; +res[1487] = /\p{Nd}*(..)/; +res[1488] = /\p{Nd}*?(..)/; +res[1489] = /\p{Nd}{2}(..)/; +res[1490] = /\p{Nd}{2,3}(..)/; +res[1491] = /\p{Nd}{2,3}?(..)/; +res[1492] = /\p{Nd}?(..)/; +res[1493] = /\p{Nd}??(..)/; +res[1494] = /\p{Lu}/i; +res[1495] = /\p{^Lu}/i; +res[1496] = /\P{Lu}/i; +res[1497] = /[\p{Nd}]/; +res[1498] = /[\P{Nd}]+/; +res[1499] = /\D+/; +res[1500] = /[\D]+/; +res[1501] = /[\P{Nd}]+/; +res[1502] = /[\D\P{Nd}]+/; +res[1503] = /\pL/; +res[1504] = /\pL/i; +res[1505] = /\p{Lu}/; +res[1506] = /\p{Lu}/i; +res[1507] = /\p{Ll}/; +res[1508] = /\p{Ll}/i; +res[1509] = /^\X/; +res[1510] = /^[\X]/; +res[1511] = /^(\X*)C/; +res[1512] = /^(\X*?)C/; +res[1513] = /^(\X*)(.)/; +res[1514] = /^(\X*?)(.)/; +res[1515] = /^\X(.)/; +res[1516] = /^\X{2,3}(.)/; +res[1517] = /^\X{2,3}?(.)/; +res[1518] = /^\pN{2,3}X/; +res[1519] = /^[\p{Arabic}]/; +res[1520] = /^[\P{Yi}]/; +res[1521] = /^\p{Any}X/; +res[1522] = /^\P{Any}X/; +res[1523] = /^\p{Any}?X/; +res[1524] = /^\P{Any}?X/; +res[1525] = /^\p{Any}*X/; +res[1526] = /^\P{Any}*X/; +res[1527] = /^[\p{Any}]X/; +res[1528] = /^[\P{Any}]X/; +res[1529] = /^[\p{Any}]?X/; +res[1530] = /^[\P{Any}]?X/; +res[1531] = /^[\p{Any}]+X/; +res[1532] = /^[\P{Any}]+X/; +res[1533] = /^[\p{Any}]*X/; +res[1534] = /^[\P{Any}]*X/; +res[1535] = /^\p{Any}{3,5}?/; +res[1536] = /^\p{Any}{3,5}/; +res[1537] = /^\P{Any}{3,5}?/; +res[1538] = /^\p{L&}X/; +res[1539] = /^[\p{L&}]X/; +res[1540] = /^[\p{L&}]+X/; +res[1541] = /^[\p{L&}]+?X/; +res[1542] = /^\P{L&}X/; +res[1543] = /^[\P{L&}]X/; +res[1544] = /Check property support in non-UTF-8 mode/; +res[1545] = /\p{L}{4}/; +res[1546] = /\p{Carian}\p{Cham}\p{Kayah_Li}\p{Lepcha}\p{Lycian}\p{Lydian}\p{Ol_Chiki}\p{Rejang}\p{Saurashtra}\p{Sundanese}\p{Vai}/; +res[1547] = / End /; +res[1548] = /^[[:alnum:]]/m; +res[1549] = /a/im; +res[1550] = /abcde/m; +res[1551] = /\x80/m; +res[1552] = /\xff/m; +res[1553] = /[\p{L}]/m; +res[1554] = /[\p{^L}]/m; +res[1555] = /[\P{L}]/m; +res[1556] = /[\P{^L}]/m; +res[1557] = /[\p{Nd}]/m; +res[1558] = /[a]/m; +res[1559] = /[a]/m; +res[1560] = /[\xaa]/m; +res[1561] = /[\xaa]/m; +res[1562] = /[^a]/m; +res[1563] = /[^a]/m; +res[1564] = /[^\xaa]/m; +res[1565] = /[^\xaa]/m; +res[1566] = / End of testinput10 /; +assertEquals("abc", res[1].exec("abc"), 0); +assertEquals("abc", res[1].exec("defabc"), 1); +assertEquals("abc", res[1].exec("Aabc"), 2); +assertEquals(null, res[1].exec("*** Failers", 3)); +assertEquals("abc", res[1].exec("Adefabc"), 4); +assertEquals("ABC", res[1].exec("ABC"), 5); +assertEquals("abc", res[2].exec("abc"), 6); +assertEquals(null, res[2].exec("Aabc", 7)); +assertEquals(null, res[2].exec("*** Failers", 8)); +assertEquals(null, res[2].exec("defabc", 9)); +assertEquals(null, res[2].exec("Adefabc", 10)); +assertEquals("abc", res[7].exec("abc"), 11); +assertEquals(null, res[7].exec("*** Failers", 12)); +assertEquals(null, res[7].exec("def\nabc", 13)); +assertThrows("var re = /x{5,4}/;", 14); +assertThrows("var re = /[abcd/;", 15); +assertThrows("var re = /[z-a]/;", 16); +assertThrows("var re = /^*/;", 17); +assertThrows("var re = /(abc/;", 18); +assertThrows("var re = /(?# abc/;", 19); +assertEquals("cat", res[11].exec("this sentence eventually mentions a cat"), 20); +assertEquals("elephant", res[11].exec("this sentences rambles on and on for a while and then reaches elephant"), 21); +assertEquals("cat", res[12].exec("this sentence eventually mentions a cat"), 22); +assertEquals("elephant", res[12].exec("this sentences rambles on and on for a while and then reaches elephant"), 23); +assertEquals("CAT", res[13].exec("this sentence eventually mentions a CAT cat"), 24); +assertEquals("elephant", res[13].exec("this sentences rambles on and on for a while to elephant ElePhant"), 25); +assertThrows("var re = /{4,5}abc/;", 26); +assertEquals("abcb,a,b,c", res[18].exec("abcb"), 27); +assertEquals("abcb,a,b,c", res[18].exec("O0abcb"), 28); +assertEquals("abcb,a,b,c", res[18].exec("O3abcb"), 29); +assertEquals("abcb,a,b,c", res[18].exec("O6abcb"), 30); +assertEquals("abcb,a,b,c", res[18].exec("O9abcb"), 31); +assertEquals("abcb,a,b,c", res[18].exec("O12abcb"), 32); +assertEquals("abc,a,,", res[19].exec("abc"), 33); +assertEquals("abc,a,,", res[19].exec("O0abc"), 34); +assertEquals("abc,a,,", res[19].exec("O3abc"), 35); +assertEquals("abc,a,,", res[19].exec("O6abc"), 36); +assertEquals("aba,,a,b", res[19].exec("aba"), 37); +assertEquals("aba,,a,b", res[19].exec("O0aba"), 38); +assertEquals("aba,,a,b", res[19].exec("O3aba"), 39); +assertEquals("aba,,a,b", res[19].exec("O6aba"), 40); +assertEquals("aba,,a,b", res[19].exec("O9aba"), 41); +assertEquals("aba,,a,b", res[19].exec("O12aba"), 42); +assertEquals("abc", res[20].exec("abc"), 43); +assertEquals(null, res[20].exec("*** Failers", 44)); +assertEquals(null, res[20].exec("abc\n", 45)); +assertEquals(null, res[20].exec("abc\ndef", 46)); +assertEquals("the quick brown fox", res[22].exec("the quick brown fox"), 47); +assertEquals("the quick brown fox", res[22].exec("this is a line with the quick brown fox"), 48); +assertEquals("abc", res[23].exec("abcdef"), 49); +assertEquals("abc", res[23].exec("abcdefB"), 50); +assertEquals("defabc,abc,abc,", res[24].exec("defabc"), 51); +assertEquals("Zdefabc,abc,abc,", res[24].exec("Zdefabc"), 52); +assertEquals("abc", res[25].exec("abc"), 53); +assertEquals(null, res[25].exec("*** Failers", 54)); +assertEquals("abc", res[26].exec("abcdef"), 55); +assertEquals("abc", res[26].exec("abcdefB"), 56); +assertEquals("defabc,abc,abc,", res[27].exec("defabc"), 57); +assertEquals("Zdefabc,abc,abc,", res[27].exec("Zdefabc"), 58); +assertEquals("the quick brown fox", res[28].exec("the quick brown fox"), 59); +assertEquals(null, res[28].exec("*** Failers", 60)); +assertEquals("The Quick Brown Fox", res[28].exec("The Quick Brown Fox"), 61); +assertEquals("the quick brown fox", res[29].exec("the quick brown fox"), 62); +assertEquals("The Quick Brown Fox", res[29].exec("The Quick Brown Fox"), 63); +assertEquals(null, res[30].exec("*** Failers", 64)); +assertEquals(null, res[30].exec("abc\ndef", 65)); +assertEquals("abc", res[31].exec("abc"), 66); +assertEquals(null, res[31].exec("abc\n", 67)); +assertEquals("abc,abc", res[33].exec("abc"), 68); +assertThrows("var re = /)/;", 69); +assertEquals("-pr", res[35].exec("co-processors, and for"), 70); +assertEquals("<def>ghi<klm>", res[36].exec("abc<def>ghi<klm>nop"), 71); +assertEquals("<def>", res[37].exec("abc<def>ghi<klm>nop"), 72); +assertEquals("<def>", res[37].exec("abc<def>ghi<klm>nop"), 73); +assertEquals(null, res[37].exec("abc========def", 74)); +assertEquals(null, res[37].exec("foo", 75)); +assertEquals(null, res[37].exec("catfoo", 76)); +assertEquals(null, res[37].exec("*** Failers", 77)); +assertEquals(null, res[37].exec("the barfoo", 78)); +assertEquals(null, res[37].exec("and cattlefoo", 79)); +assertEquals("a", res[40].exec("a"), 80); +assertEquals(null, res[40].exec("a\n", 81)); +assertEquals(null, res[40].exec("*** Failers", 82)); +assertEquals("a", res[40].exec("Za"), 83); +assertEquals(null, res[40].exec("Za\n", 84)); +assertEquals("a", res[41].exec("a"), 85); +assertEquals("a", res[41].exec("a\n"), 86); +assertEquals("a", res[41].exec("Za\n"), 87); +assertEquals(null, res[41].exec("*** Failers", 88)); +assertEquals("a", res[41].exec("Za"), 89); +assertEquals("b", res[44].exec("foo\nbarbar"), 90); +assertEquals("a", res[44].exec("***Failers"), 91); +assertEquals("b", res[44].exec("rhubarb"), 92); +assertEquals("b", res[44].exec("barbell"), 93); +assertEquals("a", res[44].exec("abc\nbarton"), 94); +assertEquals("b", res[44].exec("foo\nbarbar"), 95); +assertEquals("a", res[44].exec("***Failers"), 96); +assertEquals("b", res[44].exec("rhubarb"), 97); +assertEquals("b", res[44].exec("barbell"), 98); +assertEquals("a", res[44].exec("abc\nbarton"), 99); +assertEquals("a", res[44].exec("abc"), 100); +assertEquals("a", res[44].exec("def\nabc"), 101); +assertEquals("a", res[44].exec("*** Failers"), 102); +assertEquals("a", res[44].exec("defabc"), 103); +assertEquals(null, res[45].exec("the bullock-cart", 104)); +assertEquals(null, res[45].exec("a donkey-cart race", 105)); +assertEquals(null, res[45].exec("*** Failers", 106)); +assertEquals(null, res[45].exec("cart", 107)); +assertEquals(null, res[45].exec("horse-and-cart", 108)); +assertEquals(null, res[45].exec("alphabetabcd", 109)); +assertEquals(null, res[45].exec("endingxyz", 110)); +assertEquals(null, res[45].exec("abxyZZ", 111)); +assertEquals(null, res[45].exec("abXyZZ", 112)); +assertEquals(null, res[45].exec("ZZZ", 113)); +assertEquals(null, res[45].exec("zZZ", 114)); +assertEquals(null, res[45].exec("bZZ", 115)); +assertEquals(null, res[45].exec("BZZ", 116)); +assertEquals(null, res[45].exec("*** Failers", 117)); +assertEquals(null, res[45].exec("ZZ", 118)); +assertEquals(null, res[45].exec("abXYZZ", 119)); +assertEquals(null, res[45].exec("zzz", 120)); +assertEquals(null, res[45].exec("bzz", 121)); +assertEquals(null, res[45].exec("bar", 122)); +assertEquals(null, res[45].exec("foobbar", 123)); +assertEquals(null, res[45].exec("*** Failers", 124)); +assertEquals(null, res[45].exec("fooabar", 125)); +assertEquals(null, res[46].exec("*** Failers", 126)); +assertEquals(null, res[46].exec("a", 127)); +assertEquals(null, res[48].exec("aaaaaa", 128)); +assertThrows("var re = /a[b-a]/;", 129); +assertThrows("var re = /a[/;", 130); +assertThrows("var re = /*a/;", 131); +assertThrows("var re = /abc)/;", 132); +assertThrows("var re = /(abc/;", 133); +assertThrows("var re = /a**/;", 134); +assertThrows("var re = /)(/;", 135); +assertThrows("var re = /a[b-a]/;", 136); +assertThrows("var re = /a[/;", 137); +assertThrows("var re = /*a/;", 138); +assertThrows("var re = /abc)/;", 139); +assertThrows("var re = /(abc/;", 140); +assertThrows("var re = /a**/;", 141); +assertThrows("var re = /)(/;", 142); +assertThrows("var re = /:(?:/;", 143); +assertThrows("var re = /a(?{)b/;", 144); +assertThrows("var re = /a(?{{})b/;", 145); +assertThrows("var re = /a(?{}})b/;", 146); +assertThrows("var re = /a(?{\"{\"})b/;", 147); +assertThrows("var re = /a(?{\"{\"}})b/;", 148); +assertThrows("var re = /[a[:xyz:/;", 149); +assertThrows("var re = /a{37,17}/;", 150); +assertEquals("abcd,a,d", res[58].exec("abcd"), 151); +assertEquals("abcd,a,d", res[58].exec("abcdC2"), 152); +assertEquals("abcd,a,d", res[58].exec("abcdC5"), 153); +assertEquals("abcdefghijklmnopqrst,abcdefghijklmnopqrst", res[59].exec("abcdefghijklmnopqrstuvwxyz"), 154); +assertEquals("abcdefghijklmnopqrst,abcdefghijklmnopqrst", res[59].exec("abcdefghijklmnopqrstuvwxyzC1"), 155); +assertEquals("abcdefghijklmnopqrst,abcdefghijklmnopqrst", res[59].exec("abcdefghijklmnopqrstuvwxyzG1"), 156); +assertEquals("abcdefghijklmno,abcdefghijklmno", res[60].exec("abcdefghijklmnopqrstuvwxyz"), 157); +assertEquals("abcdefghijklmno,abcdefghijklmno", res[60].exec("abcdefghijklmnopqrstuvwxyzC1G1"), 158); +assertEquals("abcdefghijklmnop,abcdefghijklmnop", res[61].exec("abcdefghijklmnopqrstuvwxyz"), 159); +assertEquals("abcdefghijklmnop,abcdefghijklmnop", res[61].exec("abcdefghijklmnopqrstuvwxyzC1G1L"), 160); +assertEquals("adef,a,,f", res[62].exec("adefG1G2G3G4L"), 161); +assertEquals("bcdef,bc,bc,f", res[62].exec("bcdefG1G2G3G4L"), 162); +assertEquals("adef,a,,f", res[62].exec("adefghijkC0"), 163); +assertEquals("abc\x00def", res[63].exec("abc\x00defLC0"), 164); +assertEquals("iss", res[69].exec("Mississippi"), 165); +assertEquals("iss", res[70].exec("Mississippi"), 166); +assertEquals("iss", res[71].exec("Mississippi"), 167); +assertEquals("iss", res[72].exec("Mississippi"), 168); +assertEquals("iss", res[73].exec("Mississippi"), 169); +assertEquals(null, res[73].exec("*** Failers", 170)); +assertEquals("iss", res[73].exec("MississippiA"), 171); +assertEquals("iss", res[73].exec("Mississippi"), 172); +assertEquals(null, res[73].exec("Mississippi", 173)); +assertEquals("iss", res[74].exec("ississippi"), 174); +assertEquals("abciss", res[75].exec("abciss\nxyzisspqr"), 175); +assertEquals("Mis", res[76].exec("Mississippi"), 176); +assertEquals("sis", res[76].exec("MississippiA"), 177); +assertEquals("ri ", res[76].exec("Missouri river"), 178); +assertEquals("riv", res[76].exec("Missouri riverA"), 179); +assertEquals("Mis", res[77].exec("Mississippi"), 180); +assertEquals("ab\n", res[78].exec("ab\nab\ncd"), 181); +assertEquals("ab\n", res[79].exec("ab\nab\ncd"), 182); +assertEquals("a", res[115].exec("a"), 183); +assertEquals("b", res[115].exec("b"), 184); +assertEquals("ab", res[115].exec("ab"), 185); +assertEquals("", res[115].exec("\\"), 186); +assertEquals("", res[115].exec("*** Failers"), 187); +assertEquals("", res[115].exec("N"), 188); +assertEquals("", res[116].exec("abcd"), 189); +assertEquals("", res[116].exec("-abc"), 190); +assertEquals("", res[116].exec("Nab-c"), 191); +assertEquals("", res[116].exec("*** Failers"), 192); +assertEquals("", res[116].exec("Nabc"), 193); +assertEquals("aaaabbbbzz,bbbb,z,z", res[117].exec("aaaabbbbzzzz"), 194); +assertEquals("aaaabbbbzz,bbbb,z,z", res[117].exec("aaaabbbbzzzzO0"), 195); +assertEquals("aaaabbbbzz,bbbb,z,z", res[117].exec("aaaabbbbzzzzO1"), 196); +assertEquals("aaaabbbbzz,bbbb,z,z", res[117].exec("aaaabbbbzzzzO2"), 197); +assertEquals("aaaabbbbzz,bbbb,z,z", res[117].exec("aaaabbbbzzzzO3"), 198); +assertEquals("aaaabbbbzz,bbbb,z,z", res[117].exec("aaaabbbbzzzzO4"), 199); +assertEquals("aaaabbbbzz,bbbb,z,z", res[117].exec("aaaabbbbzzzzO5"), 200); +assertEquals("(abcd", res[118].exec("(abcd)"), 201); +assertEquals("(abcd", res[118].exec("(abcd)xyz"), 202); +assertEquals(null, res[118].exec("xyz(abcd)", 203)); +assertEquals(null, res[118].exec("(ab(xy)cd)pqr", 204)); +assertEquals(null, res[118].exec("(ab(xycd)pqr", 205)); +assertEquals(null, res[118].exec("() abc ()", 206)); +assertEquals(null, res[118].exec("12(abcde(fsh)xyz(foo(bar))lmno)89", 207)); +assertEquals(null, res[118].exec("*** Failers", 208)); +assertEquals("abcd", res[118].exec("abcd"), 209); +assertEquals("abcd", res[118].exec("abcd)"), 210); +assertEquals("(abcd", res[118].exec("(abcd"), 211); +assertEquals(null, res[118].exec("(ab(xy)cd)pqr", 212)); +assertEquals(null, res[118].exec("1(abcd)(x(y)z)pqr", 213)); +assertEquals("(abcd", res[118].exec("(abcd)"), 214); +assertEquals(null, res[118].exec("(ab(xy)cd)", 215)); +assertEquals(null, res[118].exec("(a(b(c)d)e)", 216)); +assertEquals(null, res[118].exec("((ab))", 217)); +assertEquals(null, res[118].exec("*** Failers", 218)); +assertEquals(null, res[118].exec("()", 219)); +assertEquals(null, res[118].exec("()", 220)); +assertEquals(null, res[118].exec("12(abcde(fsh)xyz(foo(bar))lmno)89", 221)); +assertEquals(null, res[118].exec("(ab(xy)cd)", 222)); +assertEquals(null, res[118].exec("(ab(xy)cd)", 223)); +assertEquals(null, res[118].exec("(ab(xy)cd)", 224)); +assertEquals(null, res[118].exec("(123ab(xy)cd)", 225)); +assertEquals(null, res[118].exec("(ab(xy)cd)", 226)); +assertEquals(null, res[118].exec("(123ab(xy)cd)", 227)); +assertEquals(null, res[118].exec("(ab(xy)cd)", 228)); +assertEquals("(abcd", res[118].exec("(abcd(xyz<p>qrs)123)"), 229); +assertEquals(null, res[118].exec("(ab(cd)ef)", 230)); +assertEquals(null, res[118].exec("(ab(cd(ef)gh)ij)", 231)); +assertEquals(null, res[146].exec("A", 232)); +assertEquals(null, res[146].exec("a", 233)); +assertEquals(null, res[147].exec("A", 234)); +assertEquals(null, res[147].exec("a", 235)); +assertEquals(null, res[147].exec("ab", 236)); +assertEquals(null, res[147].exec("aB", 237)); +assertEquals(null, res[147].exec("*** Failers", 238)); +assertEquals(null, res[147].exec("Ab", 239)); +assertEquals(null, res[147].exec("AB", 240)); +assertThrows("var re = /[\\200-\\110]/;", 241); +assertEquals("1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC,1 ,2 ,3 ,4 ,5 ,6 ,7 ,8 ,9 ,10 ,11 ,12 ,13 ,14 ,15 ,16 ,17 ,18 ,19 ,20 ,21 ,22 ,23 ,24 ,25 ,26 ,27 ,28 ,29 ,30 ,31 ,32 ,33 ,34 ,35 ,36 ,37 ,38 ,39 ,40 ,41 ,42 ,43 ,44 ,45 ,46 ,47 ,48 ,49 ,50 ,51 ,52 ,53 ,54 ,55 ,56 ,57 ,58 ,59 ,60 ,61 ,62 ,63 ,64 ,65 ,66 ,67 ,68 ,69 ,70 ,71 ,72 ,73 ,74 ,75 ,76 ,77 ,78 ,79 ,80 ,81 ,82 ,83 ,84 ,85 ,86 ,87 ,88 ,89 ,90 ,91 ,92 ,93 ,94 ,95 ,96 ,97 ,98 ,99 ,100 ,101 ,102 ,103 ,104 ,105 ,106 ,107 ,108 ,109 ,110 ,111 ,112 ,113 ,114 ,115 ,116 ,117 ,118 ,119 ,120 ,121 ,122 ,123 ,124 ,125 ,126 ,127 ,128 ,129 ,130 ,131 ,132 ,133 ,134 ,135 ,136 ,137 ,138 ,139 ,140 ,141 ,142 ,143 ,144 ,145 ,146 ,147 ,148 ,149 ,150 ,151 ,152 ,153 ,154 ,155 ,156 ,157 ,158 ,159 ,160 ,161 ,162 ,163 ,164 ,165 ,166 ,167 ,168 ,169 ,170 ,171 ,172 ,173 ,174 ,175 ,176 ,177 ,178 ,179 ,180 ,181 ,182 ,183 ,184 ,185 ,186 ,187 ,188 ,189 ,190 ,191 ,192 ,193 ,194 ,195 ,196 ,197 ,198 ,199 ,200 ,201 ,202 ,203 ,204 ,205 ,206 ,207 ,208 ,209 ,210 ,211 ,212 ,213 ,214 ,215 ,216 ,217 ,218 ,219 ,220 ,221 ,222 ,223 ,224 ,225 ,226 ,227 ,228 ,229 ,230 ,231 ,232 ,233 ,234 ,235 ,236 ,237 ,238 ,239 ,240 ,241 ,242 ,243 ,244 ,245 ,246 ,247 ,248 ,249 ,250 ,251 ,252 ,253 ,254 ,255 ,256 ,257 ,258 ,259 ,260 ,261 ,262 ,263 ,264 ,265 ,266 ,267 ,268 ,269 ,ABC,ABC", res[149].exec("O900 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 ABC ABC"), 242); +assertEquals("mainmain,main,", res[151].exec("mainmain"), 243); +assertEquals("mainOmain,main,", res[151].exec("mainOmain"), 244); +assertEquals("aba,a,", res[153].exec("aba"), 245); +assertEquals("aabbaa,aa,", res[154].exec("aabbaa"), 246); +assertEquals("aabbaa,aa,", res[155].exec("aabbaa"), 247); +assertEquals("aabbaa,aa,", res[156].exec("aabbaa"), 248); +assertEquals("aabbaa,", res[157].exec("aabbaa"), 249); +assertEquals("aabbaa,aa,,", res[158].exec("aabbaa"), 250); +assertEquals("aabbaa,,", res[159].exec("aabbaa"), 251); +assertEquals("aabbaa,", res[160].exec("aabbaa"), 252); +assertEquals("aabbbaa,", res[161].exec("aabbbaa"), 253); +assertEquals("aabbbaa,", res[162].exec("aabbbaa"), 254); +assertEquals("aabbaa,", res[163].exec("aabbaa"), 255); +assertEquals("aabbbaa,", res[164].exec("aabbbaa"), 256); +assertEquals("aabbbaa,aa,,", res[165].exec("aabbbaa"), 257); +assertEquals("aabbbbaa,aa,,", res[166].exec("aabbbbaa"), 258); +assertThrows("var re = //;", 259); +assertEquals("a", res[169].exec("ab"), 260); +assertEquals("a", res[169].exec("aB"), 261); +assertEquals("*", res[169].exec("*** Failers"), 262); +assertEquals("A", res[169].exec("AB"), 263); +assertEquals("a", res[169].exec("ab"), 264); +assertEquals("a", res[169].exec("aB"), 265); +assertEquals("*", res[169].exec("*** Failers"), 266); +assertEquals("A", res[169].exec("AB"), 267); +assertEquals(null, res[172].exec("\\", 268)); +assertEquals(null, res[177].exec("*** Failers", 269)); +assertEquals(null, res[177].exec("xxxxx", 270)); +assertEquals(null, res[177].exec("now is the time for all good men to come to the aid of the party", 271)); +assertEquals(null, res[177].exec("*** Failers", 272)); +assertEquals(null, res[177].exec("this is not a line with only words and spaces!", 273)); +assertEquals(null, res[177].exec("12345a", 274)); +assertEquals(null, res[177].exec("*** Failers", 275)); +assertEquals(null, res[177].exec("12345+", 276)); +assertEquals(null, res[177].exec("aaab", 277)); +assertEquals(null, res[177].exec("aaab", 278)); +assertEquals(null, res[177].exec("aaab", 279)); +assertEquals(null, res[177].exec("((abc(ade)ufh()()x", 280)); +assertEquals(null, res[177].exec("(abc)", 281)); +assertEquals(null, res[177].exec("(abc(def)xyz)", 282)); +assertEquals(null, res[177].exec("*** Failers", 283)); +assertEquals(null, res[177].exec("((()aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 284)); +assertEquals(null, res[177].exec("xaaaab", 285)); +assertEquals(null, res[177].exec("xaaaab", 286)); +assertThrows("var re = /[/;", 287); +assertThrows("var re = /[a-/;", 288); +assertEquals(null, res[189].exec("<>", 289)); +assertEquals(null, res[189].exec("<abcd>", 290)); +assertEquals(null, res[189].exec("<abc <123> hij>", 291)); +assertEquals(null, res[189].exec("<abc <def> hij>", 292)); +assertEquals(null, res[189].exec("<abc<>def>", 293)); +assertEquals(null, res[189].exec("<abc<>", 294)); +assertEquals(null, res[189].exec("*** Failers", 295)); +assertEquals(null, res[189].exec("<abc", 296)); +assertEquals("bc123bc,bc,bc", res[195].exec("abc123bc"), 297); +assertEquals("abc", res[215].exec("abcdef"), 298); +assertEquals("abc", res[215].exec("1234abcdef"), 299); +assertEquals(null, res[215].exec("*** Failers", 300)); +assertEquals("abc", res[215].exec("abcxyz"), 301); +assertEquals("abc", res[215].exec("abcxyzf"), 302); +assertEquals("abc", res[215].exec("123abcdef"), 303); +assertEquals("abc", res[215].exec("1234abcdef"), 304); +assertEquals(null, res[215].exec("*** Failers", 305)); +assertEquals("abc", res[215].exec("abcdef"), 306); +assertEquals(null, res[215].exec("*** Failers", 307)); +assertEquals("abc", res[215].exec("\x83x0abcdef"), 308); +assertEquals("abc", res[215].exec("123abcdef"), 309); +assertEquals("abc", res[215].exec("123abcdefC+"), 310); +assertEquals("abc", res[215].exec("123abcdefC-"), 311); +assertEquals(null, res[215].exec("*** Failers", 312)); +assertEquals("abc", res[215].exec("123abcdefC!1"), 313); +assertEquals("abc", res[215].exec("abcabcabc"), 314); +assertEquals("abc", res[215].exec("abcabcC!1!3"), 315); +assertEquals(null, res[215].exec("*** Failers", 316)); +assertEquals("abc", res[215].exec("abcabcabcC!1!3"), 317); +assertEquals("C", res[215].exec("123C+"), 318); +assertEquals("C", res[215].exec("123456C+"), 319); +assertEquals("C", res[215].exec("123456789C+"), 320); +assertEquals("abc", res[215].exec("xyzabcC+"), 321); +assertEquals("abc", res[215].exec("XxyzabcC+"), 322); +assertEquals("abc", res[215].exec("abcdefC+"), 323); +assertEquals("abc", res[215].exec("abcxyzC+"), 324); +assertEquals("c", res[215].exec("abbbbbcccC*1"), 325); +assertEquals("c", res[215].exec("abbbbbcccC*1"), 326); +assertEquals(null, res[215].exec("xab", 327)); +assertEquals("c", res[215].exec("xbc"), 328); +assertEquals(null, res[215].exec("xde", 329)); +assertEquals(null, res[215].exec("xxab", 330)); +assertEquals(null, res[215].exec("xxxab", 331)); +assertEquals(null, res[215].exec("*** Failers", 332)); +assertEquals(null, res[215].exec("xyab", 333)); +assertEquals("abc", res[215].exec("abc"), 334); +assertEquals("c", res[215].exec("a(b)c"), 335); +assertEquals("c", res[215].exec("a(b(c))d"), 336); +assertEquals(null, res[215].exec("*** Failers)", 337)); +assertEquals("c", res[215].exec("a(b(c)d"), 338); +assertEquals(null, res[215].exec("1221", 339)); +assertEquals("c", res[215].exec("Satan, oscillate my metallic sonatas!"), 340); +assertEquals("c", res[215].exec("A man, a plan, a canal: Panama!"), 341); +assertEquals(null, res[215].exec("Able was I ere I saw Elba.", 342)); +assertEquals(null, res[215].exec("*** Failers", 343)); +assertEquals("c", res[215].exec("The quick brown fox"), 344); +assertEquals(null, res[215].exec("12", 345)); +assertEquals(null, res[215].exec("(((2+2)*-3)-7)", 346)); +assertEquals(null, res[215].exec("-12", 347)); +assertEquals(null, res[215].exec("*** Failers", 348)); +assertEquals(null, res[215].exec("((2+2)*-3)-7)", 349)); +assertEquals(null, res[215].exec("xyz", 350)); +assertEquals(null, res[215].exec("xxyzxyzz", 351)); +assertEquals(null, res[215].exec("*** Failers", 352)); +assertEquals(null, res[215].exec("xxyzz", 353)); +assertEquals(null, res[215].exec("xxyzxyzxyzz", 354)); +assertEquals(null, res[215].exec("<>", 355)); +assertEquals("abc", res[215].exec("<abcd>"), 356); +assertEquals("abc", res[215].exec("<abc <123> hij>"), 357); +assertEquals("abc", res[215].exec("<abc <def> hij>"), 358); +assertEquals("abc", res[215].exec("<abc<>def>"), 359); +assertEquals("abc", res[215].exec("<abc<>"), 360); +assertEquals(null, res[215].exec("*** Failers", 361)); +assertEquals("abc", res[215].exec("<abc"), 362); +assertEquals("abc", res[215].exec("abcdefabc"), 363); +assertEquals(null, res[215].exec("a=a", 364)); +assertEquals(null, res[215].exec("a=b", 365)); +assertEquals("c", res[215].exec("a=bc"), 366); +assertEquals(null, res[215].exec("a=a", 367)); +assertEquals(null, res[215].exec("a=b", 368)); +assertEquals("c", res[215].exec("a=bc"), 369); +assertEquals(null, res[215].exec("abde", 370)); +assertEquals("c", res[215].exec("acde"), 371); +assertEquals(null, res[215].exec("1221", 372)); +assertEquals("c", res[215].exec("Satan, oscillate my metallic sonatas!"), 373); +assertEquals("c", res[215].exec("A man, a plan, a canal: Panama!"), 374); +assertEquals(null, res[215].exec("Able was I ere I saw Elba.", 375)); +assertEquals(null, res[215].exec("*** Failers", 376)); +assertEquals("c", res[215].exec("The quick brown fox"), 377); +assertEquals(null, res[228].exec("abcdefgh", 378)); +assertEquals(null, res[228].exec("abcdefghC1Gtwo", 379)); +assertEquals(null, res[228].exec("abcdefghConeCtwo", 380)); +assertEquals(null, res[228].exec("abcdefghCthree", 381)); +assertEquals("zz,", res[228].exec("zzaaCZ"), 382); +assertEquals("zz,", res[228].exec("zzaaCA"), 383); +assertEquals(null, res[228].exec("[10,20,30,5,5,4,4,2,43,23,4234]", 384)); +assertEquals(null, res[228].exec("*** Failers", 385)); +assertEquals(null, res[228].exec("[]", 386)); +assertEquals(null, res[228].exec("[10,20,30,5,5,4,4,2,43,23,4234]", 387)); +assertEquals(null, res[228].exec("[]", 388)); +assertEquals(" Baby Bjorn Active Carrier - With free SHIPPING!!, Baby Bjorn Active Carrier - With free SHIPPING!!,,", res[229].exec(" Baby Bjorn Active Carrier - With free SHIPPING!!"), 389); +assertEquals(" Baby Bjorn Active Carrier - With free SHIPPING!!, Baby Bjorn Active Carrier - With free SHIPPING!!,,", res[230].exec(" Baby Bjorn Active Carrier - With free SHIPPING!!"), 390); +assertEquals(null, res[238].exec("Note: that { does NOT introduce a quantifier", 391)); +assertEquals("aacaacaacaacaac123,aac", res[239].exec("aacaacaacaacaac123"), 392); +assertEquals(null, res[243].exec("abP", 393)); +assertEquals(null, res[243].exec("abcP", 394)); +assertEquals(null, res[243].exec("abcdP", 395)); +assertEquals("abcde", res[243].exec("abcdeP"), 396); +assertEquals(null, res[243].exec("the quick brown abcP", 397)); +assertEquals(null, res[243].exec("** FailersP", 398)); +assertEquals(null, res[243].exec("the quick brown abxyz foxP", 399)); +assertEquals(null, res[243].exec("13/05/04P", 400)); +assertEquals(null, res[243].exec("13/5/2004P", 401)); +assertEquals(null, res[243].exec("02/05/09P", 402)); +assertEquals(null, res[243].exec("1P", 403)); +assertEquals(null, res[243].exec("1/2P", 404)); +assertEquals(null, res[243].exec("1/2/0P", 405)); +assertEquals(null, res[243].exec("1/2/04P", 406)); +assertEquals(null, res[243].exec("0P", 407)); +assertEquals(null, res[243].exec("02/P", 408)); +assertEquals(null, res[243].exec("02/0P", 409)); +assertEquals(null, res[243].exec("02/1P", 410)); +assertEquals(null, res[243].exec("** FailersP", 411)); +assertEquals(null, res[243].exec("P", 412)); +assertEquals(null, res[243].exec("123P", 413)); +assertEquals(null, res[243].exec("33/4/04P", 414)); +assertEquals(null, res[243].exec("3/13/04P", 415)); +assertEquals(null, res[243].exec("0/1/2003P", 416)); +assertEquals(null, res[243].exec("0/P", 417)); +assertEquals(null, res[243].exec("02/0/P", 418)); +assertEquals(null, res[243].exec("02/13P", 419)); +assertEquals("123", res[248].exec("123P"), 420); +assertEquals(null, res[248].exec("aP", 421)); +assertEquals(null, res[248].exec("bP", 422)); +assertEquals(null, res[248].exec("cP", 423)); +assertEquals(null, res[248].exec("c12P", 424)); +assertEquals("c123", res[248].exec("c123P"), 425); +assertEquals(null, res[249].exec("1P", 426)); +assertEquals(null, res[249].exec("123P", 427)); +assertEquals("123X", res[249].exec("123X"), 428); +assertEquals(null, res[249].exec("1234P", 429)); +assertEquals("1234X", res[249].exec("1234X"), 430); +assertEquals(null, res[249].exec("12345P", 431)); +assertEquals("12345X", res[249].exec("12345X"), 432); +assertEquals(null, res[249].exec("*** Failers", 433)); +assertEquals(null, res[249].exec("1X", 434)); +assertEquals(null, res[249].exec("123456P", 435)); +assertEquals(null, res[249].exec("abc", 436)); +assertEquals(null, res[249].exec("** Failers", 437)); +assertEquals(null, res[249].exec("bca", 438)); +assertEquals(null, res[249].exec("abc", 439)); +assertEquals(null, res[249].exec("** Failers", 440)); +assertEquals(null, res[249].exec("bca", 441)); +assertEquals(null, res[249].exec("abc", 442)); +assertEquals(null, res[249].exec("** Failers", 443)); +assertEquals(null, res[249].exec("def", 444)); +assertEquals(null, res[249].exec("abc", 445)); +assertEquals(null, res[249].exec("** Failers", 446)); +assertEquals(null, res[249].exec("def", 447)); +assertEquals(null, res[249].exec("<!DOCTYPE seite SYSTEM \"http://www.lco.lineas.de/xmlCms.dtd\">\n<seite>\n<dokumenteninformation>\n<seitentitel>Partner der LCO</seitentitel>\n<sprache>de</sprache>\n<seitenbeschreibung>Partner der LINEAS Consulting\nGmbH</seitenbeschreibung>\n<schluesselworte>LINEAS Consulting GmbH Hamburg\nPartnerfirmen</schluesselworte>\n<revisit>30 days</revisit>\n<robots>index,follow</robots>\n<menueinformation>\n<aktiv>ja</aktiv>\n<menueposition>3</menueposition>\n<menuetext>Partner</menuetext>\n</menueinformation>\n<lastedited>\n<autor>LCO</autor>\n<firma>LINEAS Consulting</firma>\n<datum>15.10.2003</datum>\n</lastedited>\n</dokumenteninformation>\n<inhalt>\n\n<absatzueberschrift>Die Partnerfirmen der LINEAS Consulting\nGmbH</absatzueberschrift>\n\n<absatz><link ziel=\"http://www.ca.com/\" zielfenster=\"_blank\">\n<bild name=\"logo_ca.gif\" rahmen=\"no\"/></link> <link\nziel=\"http://www.ey.com/\" zielfenster=\"_blank\"><bild\nname=\"logo_euy.gif\" rahmen=\"no\"/></link>\n</absatz>\n\n<absatz><link ziel=\"http://www.cisco.de/\" zielfenster=\"_blank\">\n<bild name=\"logo_cisco.gif\" rahmen=\"ja\"/></link></absatz>\n\n<absatz><link ziel=\"http://www.atelion.de/\"\nzielfenster=\"_blank\"><bild\nname=\"logo_atelion.gif\" rahmen=\"no\"/></link>\n</absatz>\n\n<absatz><link ziel=\"http://www.line-information.de/\"\nzielfenster=\"_blank\">\n<bild name=\"logo_line_information.gif\" rahmen=\"no\"/></link>\n</absatz>\n\n<absatz><bild name=\"logo_aw.gif\" rahmen=\"no\"/></absatz>\n\n<absatz><link ziel=\"http://www.incognis.de/\"\nzielfenster=\"_blank\"><bild\nname=\"logo_incognis.gif\" rahmen=\"no\"/></link></absatz>\n\n<absatz><link ziel=\"http://www.addcraft.com/\"\nzielfenster=\"_blank\"><bild\nname=\"logo_addcraft.gif\" rahmen=\"no\"/></link></absatz>\n\n<absatz><link ziel=\"http://www.comendo.com/\"\nzielfenster=\"_blank\"><bild\nname=\"logo_comendo.gif\" rahmen=\"no\"/></link></absatz>\n\n</inhalt>\n</seite>", 448)); +assertEquals("line\nbreak", res[251].exec("this is a line\nbreak"), 449); +assertEquals("line\nbreak", res[251].exec("line one\nthis is a line\nbreak in the second line"), 450); +assertEquals("line\nbreak", res[252].exec("this is a line\nbreak"), 451); +assertEquals(null, res[252].exec("** Failers", 452)); +assertEquals("line\nbreak", res[252].exec("line one\nthis is a line\nbreak in the second line"), 453); +assertEquals("line\nbreak", res[253].exec("this is a line\nbreak"), 454); +assertEquals(null, res[253].exec("** Failers", 455)); +assertEquals("line\nbreak", res[253].exec("line one\nthis is a line\nbreak in the second line"), 456); +assertEquals("ab-cd", res[254].exec("ab-cd"), 457); +assertEquals("ab=cd", res[254].exec("ab=cd"), 458); +assertEquals(null, res[254].exec("** Failers", 459)); +assertEquals(null, res[254].exec("ab\ncd", 460)); +assertEquals("ab-cd", res[255].exec("ab-cd"), 461); +assertEquals("ab=cd", res[255].exec("ab=cd"), 462); +assertEquals(null, res[255].exec("ab\ncd", 463)); +assertEquals(null, res[255].exec("AbCd", 464)); +assertEquals(null, res[255].exec("** Failers", 465)); +assertEquals(null, res[255].exec("abcd", 466)); +// We are compatible with JSC, and don't throw an exception in this case. +// assertThrows("var re = /(){2,4294967295}/;", 467); +assertEquals(null, res[255].exec("abcdefghijklAkB", 468)); +assertEquals(null, res[255].exec("abcdefghijklAkB", 469)); +assertEquals(null, res[255].exec("abcdefghijklAkB", 470)); +assertEquals(null, res[255].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 471)); +assertEquals(null, res[255].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 472)); +assertEquals(null, res[255].exec("(this(and)that", 473)); +assertEquals(null, res[255].exec("(this(and)that)", 474)); +assertEquals(null, res[255].exec("(this(and)that)stuff", 475)); +assertEquals(null, res[255].exec("(this(and)that", 476)); +assertEquals(null, res[255].exec("(this(and)that)", 477)); +assertEquals(null, res[255].exec("(this(and)that", 478)); +assertEquals(null, res[255].exec("(this(and)that)", 479)); +assertEquals(null, res[255].exec("(this(and)that", 480)); +assertEquals(null, res[255].exec("(this(and)that)", 481)); +assertEquals(null, res[255].exec("((this))", 482)); +assertEquals(null, res[255].exec("(this(and)that", 483)); +assertEquals(null, res[255].exec("(this(and)that)", 484)); +assertEquals(null, res[255].exec("(this)", 485)); +assertEquals(null, res[255].exec("((this))", 486)); +assertEquals("abc,b", res[256].exec("abc"), 487); +assertEquals("abc,b", res[256].exec("abc"), 488); +assertEquals(null, res[256].exec("a1bCA", 489)); +assertEquals(null, res[256].exec("a2bCA", 490)); +assertEquals(null, res[257].exec("a bc dCACBCC", 491)); +assertEquals(null, res[257].exec("aabc", 492)); +assertEquals(null, res[257].exec("bc", 493)); +assertEquals(null, res[257].exec("** Failers", 494)); +assertEquals(null, res[257].exec("abc", 495)); +assertEquals(null, res[257].exec("bXaX", 496)); +assertEquals(null, res[257].exec("bbXaaX", 497)); +assertEquals(null, res[257].exec("(b)\\Xa\\X", 498)); +assertEquals(null, res[257].exec("bXXaYYaY", 499)); +assertEquals(null, res[257].exec("bXYaXXaX", 500)); +assertEquals(null, res[257].exec("bXXaYYaY", 501)); +assertEquals("\x0b,\x0b", res[259].exec("\x0b,\x0b"), 502); +assertEquals("\x0c,\x0d", res[259].exec("\x0c,\x0d"), 503); +assertEquals("abc", res[260].exec("xyz\nabc"), 504); +assertEquals("abc", res[260].exec("xyz\nabc<lf>"), 505); +assertEquals("abc", res[260].exec("xyz\x0d\nabc<lf>"), 506); +assertEquals("abc", res[260].exec("xyz\x0dabc<cr>"), 507); +assertEquals("abc", res[260].exec("xyz\x0d\nabc<crlf>"), 508); +assertEquals(null, res[260].exec("** Failers", 509)); +assertEquals("abc", res[260].exec("xyz\nabc<cr>"), 510); +assertEquals("abc", res[260].exec("xyz\x0d\nabc<cr>"), 511); +assertEquals("abc", res[260].exec("xyz\nabc<crlf>"), 512); +assertEquals("abc", res[260].exec("xyz\x0dabc<crlf>"), 513); +assertEquals("abc", res[260].exec("xyz\x0dabc<lf>"), 514); +assertEquals("abc", res[261].exec("xyzabc"), 515); +assertEquals("abc", res[261].exec("xyzabc\n"), 516); +assertEquals("abc", res[261].exec("xyzabc\npqr"), 517); +assertEquals("abc", res[261].exec("xyzabc\x0d<cr>"), 518); +assertEquals("abc", res[261].exec("xyzabc\x0dpqr<cr>"), 519); +assertEquals("abc", res[261].exec("xyzabc\x0d\n<crlf>"), 520); +assertEquals("abc", res[261].exec("xyzabc\x0d\npqr<crlf>"), 521); +assertEquals(null, res[261].exec("** Failers", 522)); +assertEquals("abc", res[261].exec("xyzabc\x0d"), 523); +assertEquals("abc", res[261].exec("xyzabc\x0dpqr"), 524); +assertEquals("abc", res[261].exec("xyzabc\x0d\n"), 525); +assertEquals("abc", res[261].exec("xyzabc\x0d\npqr"), 526); +assertEquals("abc", res[262].exec("xyz\x0dabcdef"), 527); +assertEquals("abc", res[262].exec("xyz\nabcdef<lf>"), 528); +assertEquals(null, res[262].exec("** Failers", 529)); +assertEquals("abc", res[262].exec("xyz\nabcdef"), 530); +assertEquals("abc", res[263].exec("xyz\nabcdef"), 531); +assertEquals("abc", res[263].exec("xyz\x0dabcdef<cr>"), 532); +assertEquals(null, res[263].exec("** Failers", 533)); +assertEquals("abc", res[263].exec("xyz\x0dabcdef"), 534); +assertEquals("abc", res[264].exec("xyz\x0d\nabcdef"), 535); +assertEquals("abc", res[264].exec("xyz\x0dabcdef<cr>"), 536); +assertEquals(null, res[264].exec("** Failers", 537)); +assertEquals("abc", res[264].exec("xyz\x0dabcdef"), 538); +assertEquals("abc", res[266].exec("xyz\x0dabc<bad>"), 539); +assertEquals("abc", res[266].exec("abc"), 540); +assertEquals("abc", res[267].exec("abc\ndef"), 541); +assertEquals("abc", res[267].exec("abc\x0ddef"), 542); +assertEquals("abc", res[267].exec("abc\x0d\ndef"), 543); +assertEquals("<cr>abc", res[267].exec("<cr>abc\ndef"), 544); +assertEquals("<cr>abc", res[267].exec("<cr>abc\x0ddef"), 545); +assertEquals("<cr>abc", res[267].exec("<cr>abc\x0d\ndef"), 546); +assertEquals("<crlf>abc", res[267].exec("<crlf>abc\ndef"), 547); +assertEquals("<crlf>abc", res[267].exec("<crlf>abc\x0ddef"), 548); +assertEquals("<crlf>abc", res[267].exec("<crlf>abc\x0d\ndef"), 549); +assertEquals(null, res[268].exec("abc\ndef", 550)); +assertEquals(null, res[268].exec("abc\x0ddef", 551)); +assertEquals(null, res[268].exec("abc\x0d\ndef", 552)); +assertEquals("XY,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,XY,Y", res[269].exec("XYO400"), 553); +assertEquals("aaaA5", res[278].exec("aaaA5"), 554); +assertEquals(null, res[278].exec("** Failers", 555)); +assertEquals(null, res[278].exec("aaaa5", 556)); +assertEquals("aaaA5", res[279].exec("aaaA5"), 557); +assertEquals("aaaa5", res[279].exec("aaaa5"), 558); +assertEquals("x", res[350].exec("xyCabcCxyz"), 559); +assertEquals("x", res[350].exec("xyCabcCxyz"), 560); +assertEquals("b", res[350].exec("bXaX"), 561); +assertEquals("b", res[350].exec("bXbX"), 562); +assertEquals("*", res[350].exec("** Failers"), 563); +assertEquals("aX", res[350].exec("aXaX"), 564); +assertEquals("aX", res[350].exec("aXbX"), 565); +assertEquals("x", res[350].exec("xx"), 566); +assertEquals("x", res[350].exec("xy"), 567); +assertEquals("y", res[350].exec("yy"), 568); +assertEquals("y", res[350].exec("yx"), 569); +assertEquals("x", res[350].exec("xx"), 570); +assertEquals("x", res[350].exec("xy"), 571); +assertEquals("y", res[350].exec("yy"), 572); +assertEquals("y", res[350].exec("yx"), 573); +assertEquals("b", res[350].exec("bxay"), 574); +assertEquals("b", res[350].exec("bxby"), 575); +assertEquals("*", res[350].exec("** Failers"), 576); +assertEquals("ax", res[350].exec("axby"), 577); +assertEquals("X", res[350].exec("XxXxxx"), 578); +assertEquals("X", res[350].exec("XxXyyx"), 579); +assertEquals("X", res[350].exec("XxXyxx"), 580); +assertEquals("*", res[350].exec("** Failers"), 581); +assertEquals("x", res[350].exec("x"), 582); +assertEquals("ab", res[350].exec("abcabc"), 583); +assertEquals("Xaaa,a", res[351].exec("Xaaa"), 584); +assertEquals("Xaba,a", res[351].exec("Xaba"), 585); +assertThrows("var re = /^[a-\\Q\\E]/;", 586); +assertEquals(null, res[353].exec("(xy)x", 587)); +assertEquals(null, res[353].exec("1221", 588)); +assertEquals(null, res[353].exec("Satan, oscillate my metallic sonatas!", 589)); +assertEquals(null, res[353].exec("A man, a plan, a canal: Panama!", 590)); +assertEquals(null, res[353].exec("Able was I ere I saw Elba.", 591)); +assertEquals(null, res[353].exec("*** Failers", 592)); +assertEquals(null, res[353].exec("The quick brown fox", 593)); +assertEquals("abcd:,abcd", res[354].exec("abcd:"), 594); +assertEquals("abcd:,abcd", res[354].exec("abcd:"), 595); +assertEquals("a:,a", res[354].exec("a:aaxyz"), 596); +assertEquals("ab:,ab", res[354].exec("ab:ababxyz"), 597); +assertEquals(null, res[354].exec("** Failers", 598)); +assertEquals("a:,a", res[354].exec("a:axyz"), 599); +assertEquals("ab:,ab", res[354].exec("ab:abxyz"), 600); +assertEquals(null, res[354].exec("abd", 601)); +assertEquals(null, res[354].exec("ce", 602)); +assertEquals(null, res[354].exec("abcabc1Xabc2XabcXabcabc", 603)); +assertEquals(null, res[354].exec("abcabc1Xabc2XabcXabcabc", 604)); +assertEquals(null, res[354].exec("abcabc1Xabc2XabcXabcabc", 605)); +assertEquals(null, res[354].exec("abcd", 606)); +assertEquals(null, res[354].exec("metcalfe 33", 607)); +assertEquals(null, res[356].exec("a\x0db", 608)); +assertEquals(null, res[356].exec("a\nb<cr>", 609)); +assertEquals("a\x85b", res[356].exec("a\x85b<anycrlf> "), 610); +assertEquals(null, res[356].exec("** Failers", 611)); +assertEquals(null, res[356].exec("a\nb", 612)); +assertEquals(null, res[356].exec("a\nb<any>", 613)); +assertEquals(null, res[356].exec("a\x0db<cr>", 614)); +assertEquals(null, res[356].exec("a\x0db<any>", 615)); +assertEquals("a\x85b", res[356].exec("a\x85b<any> "), 616); +assertEquals(null, res[356].exec("a\x0db<anycrlf>", 617)); +assertEquals("abc1", res[357].exec("abc1 \nabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\nabc6 \x85abc7 JUNK"), 618); +assertEquals("abc1", res[358].exec("abc1\n abc2\x0b abc3\x0c abc4\x0d abc5\x0d\n abc6\x85 abc7 abc9"), 619); +assertEquals(null, res[361].exec("a\nb", 620)); +assertEquals(null, res[361].exec("a\x0db", 621)); +assertEquals(null, res[361].exec("a\x0d\nb", 622)); +assertEquals(null, res[361].exec("a\x0bb", 623)); +assertEquals(null, res[361].exec("a\x0cb", 624)); +assertEquals(null, res[361].exec("a\x85b", 625)); +assertEquals(null, res[361].exec("** Failers", 626)); +assertEquals(null, res[361].exec("a\n\x0db", 627)); +assertEquals("ab", res[362].exec("ab"), 628); +assertEquals(null, res[362].exec("a\nb", 629)); +assertEquals(null, res[362].exec("a\x0db", 630)); +assertEquals(null, res[362].exec("a\x0d\nb", 631)); +assertEquals(null, res[362].exec("a\x0bb", 632)); +assertEquals(null, res[362].exec("a\x0cb", 633)); +assertEquals(null, res[362].exec("a\x85b", 634)); +assertEquals(null, res[362].exec("a\n\x0db", 635)); +assertEquals(null, res[362].exec("a\n\x0d\x85\x0cb", 636)); +assertEquals(null, res[363].exec("a\nb", 637)); +assertEquals(null, res[363].exec("a\x0db", 638)); +assertEquals(null, res[363].exec("a\x0d\nb", 639)); +assertEquals(null, res[363].exec("a\x0bb", 640)); +assertEquals(null, res[363].exec("a\x0cb", 641)); +assertEquals(null, res[363].exec("a\x85b", 642)); +assertEquals(null, res[363].exec("a\n\x0db", 643)); +assertEquals(null, res[363].exec("a\n\x0d\x85\x0cb", 644)); +assertEquals(null, res[363].exec("** Failers", 645)); +assertEquals(null, res[363].exec("ab", 646)); +assertEquals(null, res[364].exec("a\nb", 647)); +assertEquals(null, res[364].exec("a\n\x0db", 648)); +assertEquals(null, res[364].exec("a\n\x0d\x85b", 649)); +assertEquals(null, res[364].exec("a\x0d\n\x0d\nb", 650)); +assertEquals(null, res[364].exec("a\x0d\n\x0d\n\x0d\nb", 651)); +assertEquals(null, res[364].exec("a\n\x0d\n\x0db", 652)); +assertEquals(null, res[364].exec("a\n\n\x0d\nb", 653)); +assertEquals(null, res[364].exec("** Failers", 654)); +assertEquals(null, res[364].exec("a\n\n\n\x0db", 655)); +assertEquals(null, res[364].exec("a\x0d", 656)); +assertEquals("aRb", res[365].exec("aRb"), 657); +assertEquals(null, res[365].exec("** Failers", 658)); +assertEquals(null, res[365].exec("a\nb", 659)); +assertEquals(null, res[365].exec("abcPXP123", 660)); +assertEquals(null, res[365].exec("abcPXP123", 661)); +assertEquals(null, res[365].exec("1.2.3.4", 662)); +assertEquals(null, res[365].exec("131.111.10.206", 663)); +assertEquals(null, res[365].exec("10.0.0.0", 664)); +assertEquals(null, res[365].exec("** Failers", 665)); +assertEquals(null, res[365].exec("10.6", 666)); +assertEquals(null, res[365].exec("455.3.4.5", 667)); +assertEquals(null, res[365].exec("1.2.3.4", 668)); +assertEquals(null, res[365].exec("131.111.10.206", 669)); +assertEquals(null, res[365].exec("10.0.0.0", 670)); +assertEquals(null, res[365].exec("** Failers", 671)); +assertEquals(null, res[365].exec("10.6", 672)); +assertEquals(null, res[365].exec("455.3.4.5", 673)); +assertEquals(null, res[365].exec("123axbaxbaxbx456", 674)); +assertEquals(null, res[365].exec("123axbaxbaxb456", 675)); +assertEquals(null, res[365].exec("123axbaxbaxbx456", 676)); +assertEquals(null, res[365].exec("123axbaxbaxbx456", 677)); +assertEquals(null, res[365].exec("123axbaxbaxbx456", 678)); +assertEquals(null, res[366].exec("ababababbbabZXXXX", 679)); +assertEquals(null, res[372].exec("a\x0db", 680)); +assertEquals(null, res[372].exec("*** Failers", 681)); +assertEquals(null, res[372].exec("a\nb", 682)); +assertEquals("afoo", res[373].exec("afoo"), 683); +assertEquals(null, res[373].exec("** Failers", 684)); +assertEquals(null, res[373].exec("\x0d\nfoo", 685)); +assertEquals(null, res[373].exec("\nfoo", 686)); +assertEquals("afoo", res[374].exec("afoo"), 687); +assertEquals(null, res[374].exec("\nfoo", 688)); +assertEquals(null, res[374].exec("** Failers", 689)); +assertEquals(null, res[374].exec("\x0d\nfoo", 690)); +assertEquals("afoo", res[375].exec("afoo"), 691); +assertEquals(null, res[375].exec("** Failers", 692)); +assertEquals(null, res[375].exec("\nfoo", 693)); +assertEquals(null, res[375].exec("\x0d\nfoo", 694)); +assertEquals("afoo", res[376].exec("afoo"), 695); +assertEquals(null, res[376].exec("\x0d\nfoo", 696)); +assertEquals(null, res[376].exec("\nfoo", 697)); +assertEquals("", res[377].exec("abc\x0d\x0dxyz"), 698); +assertEquals("", res[377].exec("abc\n\x0dxyz "), 699); +assertEquals(null, res[377].exec("** Failers ", 700)); +assertEquals("", res[377].exec("abc\x0d\nxyz"), 701); +assertEquals("", res[377].exec("abc\x0d\n\x0d\n"), 702); +assertEquals("", res[377].exec("abc\x0d\n\x0d\n"), 703); +assertEquals("", res[377].exec("abc\x0d\n\x0d\n"), 704); +assertEquals("abc1", res[378].exec("abc1\n abc2\x0b abc3\x0c abc4\x0d abc5\x0d\n abc6\x85 abc9"), 705); +assertEquals("X", res[379].exec("XABC"), 706); +assertEquals(null, res[379].exec("** Failers ", 707)); +assertEquals("X", res[379].exec("XABCB"), 708); +assertThrows("var re = /(ab|c)(?-1)/;", 709); +assertEquals(null, res[379].exec("abc", 710)); +assertEquals(null, res[379].exec("xyabcabc", 711)); +assertEquals(null, res[379].exec("** Failers", 712)); +assertEquals(null, res[379].exec("xyabc ", 713)); +assertThrows("var re = /x(?-0)y/;", 714); +assertThrows("var re = /x(?-1)y/;", 715); +assertEquals(null, res[379].exec("abcX", 716)); +assertEquals(null, res[379].exec("Y", 717)); +assertEquals(null, res[379].exec("** Failers", 718)); +assertEquals(null, res[379].exec("abcY ", 719)); +assertEquals(null, res[379].exec("YabcXabc", 720)); +assertEquals(null, res[379].exec("YabcXabcXabc", 721)); +assertEquals(null, res[379].exec("** Failers", 722)); +assertEquals("X", res[379].exec("XabcXabc "), 723); +assertEquals(null, res[379].exec("Y!", 724)); +assertEquals(null, res[380].exec("foobar", 725)); +assertEquals(null, res[381].exec("foobar", 726)); +assertEquals("foobaz,foo,baz", res[381].exec("foobaz "), 727); +assertEquals(null, res[382].exec("foobarbaz", 728)); +assertEquals(null, res[382].exec("tom-tom", 729)); +assertEquals(null, res[382].exec("bon-bon ", 730)); +assertEquals(null, res[382].exec("** Failers", 731)); +assertEquals(null, res[382].exec("tom-bon ", 732)); +assertEquals(null, res[382].exec("tom-tom", 733)); +assertEquals(null, res[382].exec("bon-bon ", 734)); +assertThrows("var re = /(?|(abc)|(xyz))/;", 735); +assertThrows("var re = /(x)(?|(abc)|(xyz))(x)/;", 736); +assertEquals(null, res[383].exec("xabcx", 737)); +assertEquals(null, res[383].exec("xxyzx ", 738)); +assertThrows("var re = /(x)(?|(abc)(pqr)|(xyz))(x)/;", 739); +assertEquals(null, res[383].exec("xabcpqrx", 740)); +assertEquals(null, res[383].exec("xxyzx ", 741)); +assertThrows("var re = /(?|(abc)|(xyz))\\1/;", 742); +assertEquals(null, res[383].exec("abcabc", 743)); +assertEquals(null, res[383].exec("xyzxyz ", 744)); +assertEquals(null, res[383].exec("** Failers", 745)); +assertEquals(null, res[383].exec("abcxyz", 746)); +assertEquals(null, res[383].exec("xyzabc ", 747)); +assertEquals(null, res[383].exec("abcabc", 748)); +assertEquals(null, res[383].exec("xyzabc ", 749)); +assertEquals(null, res[383].exec("** Failers ", 750)); +assertEquals(null, res[383].exec("xyzxyz ", 751)); +assertEquals(null, res[384].exec("X X\n", 752)); +assertEquals(null, res[384].exec("X\x09X\x0b", 753)); +assertEquals(null, res[384].exec("** Failers", 754)); +assertEquals(null, res[384].exec("\xa0 X\n ", 755)); +assertEquals(null, res[385].exec("\x09 \xa0X\n\x0b\x0c\x0d\n", 756)); +assertEquals(null, res[385].exec("\x09 \xa0\n\x0b\x0c\x0d\n", 757)); +assertEquals(null, res[385].exec("\x09 \xa0\n\x0b\x0c", 758)); +assertEquals(null, res[385].exec("** Failers ", 759)); +assertEquals(null, res[385].exec("\x09 \xa0\n\x0b", 760)); +assertEquals(null, res[385].exec(" ", 761)); +assertEquals(null, res[386].exec("XY ABCDE", 762)); +assertEquals(null, res[386].exec("XY PQR ST ", 763)); +assertEquals(null, res[387].exec("XY AB PQRS", 764)); +assertEquals(null, res[388].exec(">XNNNYZ", 765)); +assertEquals(null, res[388].exec("> X NYQZ", 766)); +assertEquals(null, res[388].exec("** Failers", 767)); +assertEquals(null, res[388].exec(">XYZ ", 768)); +assertEquals(null, res[388].exec("> X NY Z", 769)); +assertEquals(null, res[389].exec(">XY\nZ\nA\x0bNN\x0c", 770)); +assertEquals(null, res[389].exec(">\n\x0dX\nY\n\x0bZZZ\nAAA\x0bNNN\x0c", 771)); +assertEquals(null, res[390].exec(">\x09<", 772)); +assertEquals(null, res[391].exec(">\x09 \xa0<", 773)); +assertEquals(null, res[396].exec("** Failers", 774)); +assertEquals(null, res[396].exec("XXXX", 775)); +assertEquals(null, res[397].exec("XXXX Y ", 776)); +assertEquals(null, res[419].exec("aaaaaa", 777)); +assertEquals(null, res[419].exec("aaabccc", 778)); +assertEquals(null, res[419].exec("aaabccc", 779)); +assertEquals(null, res[419].exec("aaabccc", 780)); +assertEquals(null, res[419].exec("aaabcccaaabccc", 781)); +assertEquals(null, res[419].exec("aaaxxxxxx", 782)); +assertEquals(null, res[419].exec("aaa++++++ ", 783)); +assertEquals(null, res[419].exec("bbbxxxxx", 784)); +assertEquals(null, res[419].exec("bbb+++++ ", 785)); +assertEquals(null, res[419].exec("cccxxxx", 786)); +assertEquals(null, res[419].exec("ccc++++ ", 787)); +assertEquals(null, res[419].exec("dddddddd ", 788)); +assertEquals(null, res[419].exec("aaaxxxxxx", 789)); +assertEquals(null, res[419].exec("aaa++++++ ", 790)); +assertEquals(null, res[419].exec("bbbxxxxx", 791)); +assertEquals(null, res[419].exec("bbb+++++ ", 792)); +assertEquals(null, res[419].exec("cccxxxx", 793)); +assertEquals(null, res[419].exec("ccc++++ ", 794)); +assertEquals(null, res[419].exec("dddddddd ", 795)); +assertEquals(null, res[419].exec("aaabccc", 796)); +assertEquals(null, res[419].exec("ABX", 797)); +assertEquals(null, res[419].exec("AADE", 798)); +assertEquals(null, res[419].exec("ACDE", 799)); +assertEquals(null, res[419].exec("** Failers", 800)); +assertEquals(null, res[419].exec("AD ", 801)); +assertEquals(null, res[419].exec(" ", 802)); +assertEquals(null, res[419].exec("aaaaaa", 803)); +assertEquals(null, res[419].exec("aaabccc", 804)); +assertEquals(null, res[419].exec("aaabccc", 805)); +assertEquals(null, res[419].exec("aaabccc", 806)); +assertEquals(null, res[419].exec("aaabcccaaabccc", 807)); +assertEquals(null, res[419].exec("aaabccc", 808)); +assertEquals(null, res[422].exec("\x0d\nA", 809)); +assertEquals("\nA", res[423].exec("\x0d\nA "), 810); +assertEquals("\nA", res[424].exec("\x0d\nA "), 811); +assertEquals("\nA,\n", res[425].exec("\x0d\nA "), 812); +assertEquals(null, res[425].exec("a\nb", 813)); +assertEquals(null, res[425].exec("** Failers", 814)); +assertEquals(null, res[425].exec("a\x0db ", 815)); +assertEquals(null, res[425].exec("a\nb", 816)); +assertEquals(null, res[425].exec("** Failers", 817)); +assertEquals(null, res[425].exec("a\x0db ", 818)); +assertEquals(null, res[425].exec("a\x0db", 819)); +assertEquals(null, res[425].exec("** Failers", 820)); +assertEquals(null, res[425].exec("a\nb ", 821)); +assertEquals(null, res[425].exec("a\x0db", 822)); +assertEquals(null, res[425].exec("a\nb ", 823)); +assertEquals(null, res[425].exec("** Failers", 824)); +assertEquals(null, res[425].exec("a\x0d\nb ", 825)); +assertEquals(null, res[425].exec("** Failers", 826)); +assertEquals(null, res[425].exec("a\x0db", 827)); +assertEquals(null, res[425].exec("a\nb ", 828)); +assertEquals(null, res[425].exec("a\x0d\nb ", 829)); +assertEquals(null, res[425].exec("** Failers", 830)); +assertEquals(null, res[425].exec("a\x0db", 831)); +assertEquals(null, res[425].exec("a\nb ", 832)); +assertEquals(null, res[425].exec("a\x0d\nb ", 833)); +assertEquals(null, res[425].exec("a\x85b ", 834)); +assertEquals(null, res[426].exec("a\x0db", 835)); +assertEquals(null, res[426].exec("a\nb", 836)); +assertEquals(null, res[426].exec("a\x0d\nb", 837)); +assertEquals(null, res[426].exec("** Failers", 838)); +assertEquals(null, res[426].exec("a\x85b", 839)); +assertEquals(null, res[426].exec("a\x0bb ", 840)); +assertEquals(null, res[427].exec("a\x0db", 841)); +assertEquals(null, res[427].exec("a\nb", 842)); +assertEquals(null, res[427].exec("a\x0d\nb", 843)); +assertEquals(null, res[427].exec("a\x85b", 844)); +assertEquals(null, res[427].exec("a\x0bb ", 845)); +assertEquals(null, res[427].exec("** Failers ", 846)); +assertEquals(null, res[427].exec("a\x85b<bsr_anycrlf>", 847)); +assertEquals(null, res[427].exec("a\x0bb<bsr_anycrlf>", 848)); +assertEquals(null, res[428].exec("a\x0db", 849)); +assertEquals(null, res[428].exec("a\nb", 850)); +assertEquals(null, res[428].exec("a\x0d\nb", 851)); +assertEquals(null, res[428].exec("** Failers", 852)); +assertEquals(null, res[428].exec("a\x85b", 853)); +assertEquals(null, res[428].exec("a\x0bb ", 854)); +assertEquals(null, res[429].exec("a\x0db", 855)); +assertEquals(null, res[429].exec("a\nb", 856)); +assertEquals(null, res[429].exec("a\x0d\nb", 857)); +assertEquals(null, res[429].exec("a\x85b", 858)); +assertEquals(null, res[429].exec("a\x0bb ", 859)); +assertEquals(null, res[429].exec("** Failers ", 860)); +assertEquals(null, res[429].exec("a\x85b<bsr_anycrlf>", 861)); +assertEquals(null, res[429].exec("a\x0bb<bsr_anycrlf>", 862)); +assertEquals(null, res[430].exec("a\x0d\n\nb", 863)); +assertEquals(null, res[430].exec("a\n\x0d\x0db", 864)); +assertEquals(null, res[430].exec("a\x0d\n\x0d\n\x0d\n\x0d\nb", 865)); +assertEquals(null, res[430].exec("** Failers", 866)); +assertEquals(null, res[430].exec("a\x8585b", 867)); +assertEquals(null, res[430].exec("a\x0b\x00bb ", 868)); +assertEquals(null, res[431].exec("a\x0d\x0db", 869)); +assertEquals(null, res[431].exec("a\n\n\nb", 870)); +assertEquals(null, res[431].exec("a\x0d\n\n\x0d\x0db", 871)); +assertEquals(null, res[431].exec("a\x8585b", 872)); +assertEquals(null, res[431].exec("a\x0b\x00bb ", 873)); +assertEquals(null, res[431].exec("** Failers ", 874)); +assertEquals(null, res[431].exec("a\x0d\x0d\x0d\x0d\x0db ", 875)); +assertEquals(null, res[431].exec("a\x8585b<bsr_anycrlf>", 876)); +assertEquals(null, res[431].exec("a\x0b\x00bb<bsr_anycrlf>", 877)); +assertEquals(null, res[431].exec("a\nb", 878)); +assertEquals(null, res[431].exec("a\x0db ", 879)); +assertEquals(null, res[431].exec("a\x85b", 880)); +assertEquals(null, res[431].exec("a\nb", 881)); +assertEquals(null, res[431].exec("a\x0db ", 882)); +assertEquals(null, res[431].exec("a\x85b", 883)); +assertThrows("var re = /(?-+a)/;", 884); +assertEquals(null, res[443].exec("aaaa", 885)); +assertEquals(null, res[443].exec("bacxxx", 886)); +assertEquals(null, res[443].exec("bbaccxxx ", 887)); +assertEquals(null, res[443].exec("bbbacccxx", 888)); +assertEquals(null, res[443].exec("aaaa", 889)); +assertEquals(null, res[443].exec("bacxxx", 890)); +assertEquals(null, res[443].exec("bbaccxxx ", 891)); +assertEquals(null, res[443].exec("bbbacccxx", 892)); +assertEquals("a,a", res[444].exec("aaaa"), 893); +assertEquals(null, res[444].exec("bacxxx", 894)); +assertEquals(null, res[444].exec("bbaccxxx ", 895)); +assertEquals(null, res[444].exec("bbbacccxx", 896)); +assertEquals("a,a", res[445].exec("aaaa"), 897); +assertEquals(null, res[445].exec("bacxxx", 898)); +assertEquals(null, res[445].exec("bbaccxxx ", 899)); +assertEquals(null, res[445].exec("bbbacccxx", 900)); +assertEquals("a,a", res[446].exec("aaaa"), 901); +assertEquals(null, res[446].exec("bacxxx", 902)); +assertEquals(null, res[446].exec("bbaccxxx ", 903)); +assertEquals(null, res[446].exec("bbbacccxx", 904)); +assertEquals("a,a,a", res[447].exec("aaaa"), 905); +assertEquals(null, res[447].exec("bacxxx", 906)); +assertEquals(null, res[447].exec("bbaccxxx ", 907)); +assertEquals(null, res[447].exec("bbbacccxx", 908)); +assertEquals(null, res[449].exec("bacxxx", 909)); +assertEquals(null, res[449].exec("XaaX", 910)); +assertEquals(null, res[449].exec("XAAX ", 911)); +assertEquals(null, res[449].exec("XaaX", 912)); +assertEquals(null, res[449].exec("** Failers ", 913)); +assertEquals(null, res[449].exec("XAAX ", 914)); +assertEquals(null, res[449].exec("XaaX", 915)); +assertEquals(null, res[449].exec("XAAX ", 916)); +assertEquals(null, res[449].exec("xzxx", 917)); +assertEquals(null, res[449].exec("yzyy ", 918)); +assertEquals(null, res[449].exec("** Failers", 919)); +assertEquals(null, res[449].exec("xxz ", 920)); +assertEquals("a,,,a", res[450].exec("cat"), 921); +assertEquals("a,,,a", res[451].exec("cat"), 922); +assertEquals("TA]", res[452].exec("The ACTA] comes "), 923); +assertEquals("TA]", res[453].exec("The ACTA] comes "), 924); +assertEquals(null, res[453].exec("abcbabc", 925)); +assertEquals(null, res[453].exec("abcbabc", 926)); +assertEquals(null, res[453].exec("abcbabc", 927)); +assertEquals(null, res[453].exec("** Failers ", 928)); +assertEquals(null, res[453].exec("abcXabc", 929)); +assertEquals(null, res[453].exec("abcXabc", 930)); +assertEquals(null, res[453].exec("** Failers ", 931)); +assertEquals(null, res[453].exec("abcbabc", 932)); +assertEquals(null, res[453].exec("xyzbabcxyz", 933)); +assertEquals(null, res[456].exec("** Failers", 934)); +assertEquals(null, res[456].exec("ab", 935)); +assertEquals(null, res[457].exec("** Failers", 936)); +assertEquals(null, res[457].exec("ab ", 937)); +assertEquals(null, res[457].exec("** Failers", 938)); +assertEquals(null, res[457].exec("ab ", 939)); +assertEquals("aXb", res[458].exec("aXb"), 940); +assertEquals("a\nb", res[458].exec("a\nb "), 941); +assertEquals(null, res[458].exec("** Failers", 942)); +assertEquals(null, res[458].exec("ab ", 943)); +assertEquals("aXb", res[459].exec("aXb"), 944); +assertEquals("a\nX\nXb", res[459].exec("a\nX\nXb "), 945); +assertEquals(null, res[459].exec("** Failers", 946)); +assertEquals(null, res[459].exec("ab ", 947)); +assertEquals("acb", res[463].exec("acb"), 948); +assertEquals("ab", res[463].exec("ab"), 949); +assertEquals(null, res[463].exec("ax{100}b ", 950)); +assertEquals(null, res[463].exec("*** Failers", 951)); +assertEquals(null, res[463].exec("a\nb ", 952)); +assertEquals(null, res[464].exec("ax{4000}xyb ", 953)); +assertEquals(null, res[464].exec("ax{4000}yb ", 954)); +assertEquals(null, res[464].exec("ax{4000}x{100}yb ", 955)); +assertEquals(null, res[464].exec("*** Failers", 956)); +assertEquals(null, res[464].exec("ax{4000}b ", 957)); +assertEquals(null, res[464].exec("ac\ncb ", 958)); +assertEquals("a\xc0,,\xc0", res[465].exec("a\xc0\x88b"), 959); +assertEquals("ax,,x", res[466].exec("ax{100}b"), 960); +assertEquals("a\xc0\x88b,\xc0\x88,b", res[467].exec("a\xc0\x88b"), 961); +assertEquals("ax{100}b,x{100},b", res[468].exec("ax{100}b"), 962); +assertEquals("a\xc0\x92,\xc0,\x92", res[469].exec("a\xc0\x92bcd"), 963); +assertEquals("ax{,x,{", res[470].exec("ax{240}bcd"), 964); +assertEquals("a\xc0\x92,\xc0,\x92", res[471].exec("a\xc0\x92bcd"), 965); +assertEquals("ax{,x,{", res[472].exec("ax{240}bcd"), 966); +assertEquals("a\xc0,,\xc0", res[473].exec("a\xc0\x92bcd"), 967); +assertEquals("ax,,x", res[474].exec("ax{240}bcd"), 968); +assertEquals(null, res[475].exec("ax{1234}xyb ", 969)); +assertEquals(null, res[475].exec("ax{1234}x{4321}yb ", 970)); +assertEquals(null, res[475].exec("ax{1234}x{4321}x{3412}b ", 971)); +assertEquals(null, res[475].exec("*** Failers", 972)); +assertEquals(null, res[475].exec("ax{1234}b ", 973)); +assertEquals(null, res[475].exec("ac\ncb ", 974)); +assertEquals("ax{1234}xyb,x{1234}xy", res[476].exec("ax{1234}xyb "), 975); +assertEquals("ax{1234}x{4321}yb,x{1234}x{4321}y", res[476].exec("ax{1234}x{4321}yb "), 976); +assertEquals("ax{1234}x{4321}x{3412}b,x{1234}x{4321}x{3412}", res[476].exec("ax{1234}x{4321}x{3412}b "), 977); +assertEquals("axxxxbcdefghijb,xxxxbcdefghij", res[476].exec("axxxxbcdefghijb "), 978); +assertEquals("ax{1234}x{4321}x{3412}x{3421}b,x{1234}x{4321}x{3412}x{3421}", res[476].exec("ax{1234}x{4321}x{3412}x{3421}b "), 979); +assertEquals(null, res[476].exec("*** Failers", 980)); +assertEquals("ax{1234}b,x{1234}", res[476].exec("ax{1234}b "), 981); +assertEquals("ax{1234}xyb,x{1234}xy", res[477].exec("ax{1234}xyb "), 982); +assertEquals("ax{1234}x{4321}yb,x{1234}x{4321}y", res[477].exec("ax{1234}x{4321}yb "), 983); +assertEquals("ax{1234}x{4321}x{3412}b,x{1234}x{4321}x{3412}", res[477].exec("ax{1234}x{4321}x{3412}b "), 984); +assertEquals("axxxxb,xxxx", res[477].exec("axxxxbcdefghijb "), 985); +assertEquals("ax{1234}x{4321}x{3412}x{3421}b,x{1234}x{4321}x{3412}x{3421}", res[477].exec("ax{1234}x{4321}x{3412}x{3421}b "), 986); +assertEquals(null, res[477].exec("*** Failers", 987)); +assertEquals("ax{1234}b,x{1234}", res[477].exec("ax{1234}b "), 988); +assertEquals(null, res[478].exec("ax{1234}xyb ", 989)); +assertEquals(null, res[478].exec("ax{1234}x{4321}yb ", 990)); +assertEquals(null, res[478].exec("ax{1234}x{4321}x{3412}b ", 991)); +assertEquals("axxxxb,xxxx", res[478].exec("axxxxbcdefghijb "), 992); +assertEquals(null, res[478].exec("ax{1234}x{4321}x{3412}x{3421}b ", 993)); +assertEquals("axbxxb,xbxx", res[478].exec("axbxxbcdefghijb "), 994); +assertEquals("axxxxxb,xxxxx", res[478].exec("axxxxxbcdefghijb "), 995); +assertEquals(null, res[478].exec("*** Failers", 996)); +assertEquals(null, res[478].exec("ax{1234}b ", 997)); +assertEquals(null, res[478].exec("axxxxxxbcdefghijb ", 998)); +assertEquals(null, res[479].exec("ax{1234}xyb ", 999)); +assertEquals(null, res[479].exec("ax{1234}x{4321}yb ", 1000)); +assertEquals(null, res[479].exec("ax{1234}x{4321}x{3412}b ", 1001)); +assertEquals("axxxxb,xxxx", res[479].exec("axxxxbcdefghijb "), 1002); +assertEquals(null, res[479].exec("ax{1234}x{4321}x{3412}x{3421}b ", 1003)); +assertEquals("axbxxb,xbxx", res[479].exec("axbxxbcdefghijb "), 1004); +assertEquals("axxxxxb,xxxxx", res[479].exec("axxxxxbcdefghijb "), 1005); +assertEquals(null, res[479].exec("*** Failers", 1006)); +assertEquals(null, res[479].exec("ax{1234}b ", 1007)); +assertEquals(null, res[479].exec("axxxxxxbcdefghijb ", 1008)); +assertEquals(null, res[479].exec("*** Failers", 1009)); +assertEquals(null, res[479].exec("x{100}", 1010)); +assertEquals(null, res[479].exec("aXbcd", 1011)); +assertEquals(null, res[479].exec("ax{100}bcd", 1012)); +assertEquals(null, res[479].exec("ax{100000}bcd", 1013)); +assertEquals(null, res[479].exec("x{100}x{100}x{100}b", 1014)); +assertEquals(null, res[479].exec("*** Failers ", 1015)); +assertEquals(null, res[479].exec("x{100}x{100}b", 1016)); +assertEquals(null, res[479].exec("x{ab} ", 1017)); +assertEquals(null, res[479].exec("\xc2\xab", 1018)); +assertEquals(null, res[479].exec("*** Failers ", 1019)); +assertEquals(null, res[479].exec("\x00{ab}", 1020)); +assertEquals(null, res[479].exec("WXYZ", 1021)); +assertEquals(null, res[479].exec("x{256}XYZ ", 1022)); +assertEquals(null, res[479].exec("*** Failers", 1023)); +assertEquals(null, res[479].exec("XYZ ", 1024)); +assertEquals(null, res[480].exec("Xx{1234}", 1025)); +assertEquals(null, res[481].exec("Xx{1234}YZ", 1026)); +assertEquals("X", res[482].exec("XYZabcdce"), 1027); +assertEquals("X", res[483].exec("XYZabcde"), 1028); +assertEquals(null, res[484].exec("Xabcdefg ", 1029)); +assertEquals(null, res[484].exec("Xx{1234} ", 1030)); +assertEquals(null, res[484].exec("Xx{1234}YZ", 1031)); +assertEquals(null, res[484].exec("Xx{1234}x{512} ", 1032)); +assertEquals(null, res[484].exec("Xx{1234}x{512}YZ", 1033)); +assertEquals(null, res[485].exec("Xabcdefg ", 1034)); +assertEquals(null, res[485].exec("Xx{1234} ", 1035)); +assertEquals(null, res[485].exec("Xx{1234}YZ", 1036)); +assertEquals(null, res[485].exec("Xx{1234}x{512} ", 1037)); +assertEquals("bcd", res[486].exec("bcd"), 1038); +assertEquals("00}", res[486].exec("x{100}aYx{256}Z "), 1039); +assertEquals("x{", res[487].exec("x{100}bc"), 1040); +assertEquals("x{100}bcA", res[488].exec("x{100}bcAa"), 1041); +assertEquals("x{", res[489].exec("x{100}bca"), 1042); +assertEquals("bcd", res[490].exec("bcd"), 1043); +assertEquals("00}", res[490].exec("x{100}aYx{256}Z "), 1044); +assertEquals("x{", res[491].exec("x{100}bc"), 1045); +assertEquals("x{100}bc", res[492].exec("x{100}bcAa"), 1046); +assertEquals("x{", res[493].exec("x{100}bca"), 1047); +assertEquals(null, res[493].exec("abcd", 1048)); +assertEquals(null, res[493].exec("abcd", 1049)); +assertEquals("x{", res[493].exec("x{100}x{100} "), 1050); +assertEquals("x{", res[493].exec("x{100}x{100} "), 1051); +assertEquals("x{", res[493].exec("x{100}x{100}x{100}x{100} "), 1052); +assertEquals(null, res[493].exec("abce", 1053)); +assertEquals("x{", res[493].exec("x{100}x{100}x{100}x{100} "), 1054); +assertEquals(null, res[493].exec("abcdx{100}x{100}x{100}x{100} ", 1055)); +assertEquals(null, res[493].exec("abcdx{100}x{100}x{100}x{100} ", 1056)); +assertEquals(null, res[493].exec("abcdx{100}x{100}x{100}x{100} ", 1057)); +assertEquals(null, res[493].exec("abcdx{100}x{100}x{100}XX", 1058)); +assertEquals(null, res[493].exec("abcdx{100}x{100}x{100}x{100}x{100}x{100}x{100}XX", 1059)); +assertEquals(null, res[493].exec("abcdx{100}x{100}x{100}x{100}x{100}x{100}x{100}XX", 1060)); +assertEquals("Xy", res[493].exec("Xyyyax{100}x{100}bXzzz"), 1061); +assertEquals("X", res[496].exec("1X2"), 1062); +assertEquals("x", res[496].exec("1x{100}2 "), 1063); +assertEquals(">X", res[497].exec("> >X Y"), 1064); +assertEquals(">x", res[497].exec("> >x{100} Y"), 1065); +assertEquals("1", res[498].exec("x{100}3"), 1066); +assertEquals(" ", res[499].exec("x{100} X"), 1067); +assertEquals("abcd", res[500].exec("12abcd34"), 1068); +assertEquals("*** Failers", res[500].exec("*** Failers"), 1069); +assertEquals(" ", res[500].exec("1234 "), 1070); +assertEquals("abc", res[501].exec("12abcd34"), 1071); +assertEquals("ab", res[501].exec("12ab34"), 1072); +assertEquals("***", res[501].exec("*** Failers "), 1073); +assertEquals(null, res[501].exec("1234", 1074)); +assertEquals(" ", res[501].exec("12a34 "), 1075); +assertEquals("ab", res[502].exec("12abcd34"), 1076); +assertEquals("ab", res[502].exec("12ab34"), 1077); +assertEquals("**", res[502].exec("*** Failers "), 1078); +assertEquals(null, res[502].exec("1234", 1079)); +assertEquals(" ", res[502].exec("12a34 "), 1080); +assertEquals("12", res[503].exec("12abcd34"), 1081); +assertEquals(null, res[503].exec("*** Failers", 1082)); +assertEquals("12", res[504].exec("12abcd34"), 1083); +assertEquals("123", res[504].exec("1234abcd"), 1084); +assertEquals(null, res[504].exec("*** Failers ", 1085)); +assertEquals(null, res[504].exec("1.4 ", 1086)); +assertEquals("12", res[505].exec("12abcd34"), 1087); +assertEquals("12", res[505].exec("1234abcd"), 1088); +assertEquals(null, res[505].exec("*** Failers ", 1089)); +assertEquals(null, res[505].exec("1.4 ", 1090)); +assertEquals("12abcd34", res[506].exec("12abcd34"), 1091); +assertEquals("***", res[506].exec("*** Failers"), 1092); +assertEquals(null, res[506].exec(" ", 1093)); +assertEquals("12a", res[507].exec("12abcd34"), 1094); +assertEquals("123", res[507].exec("1234abcd"), 1095); +assertEquals("***", res[507].exec("*** Failers"), 1096); +assertEquals(null, res[507].exec(" ", 1097)); +assertEquals("12", res[508].exec("12abcd34"), 1098); +assertEquals("12", res[508].exec("1234abcd"), 1099); +assertEquals("**", res[508].exec("*** Failers"), 1100); +assertEquals(null, res[508].exec(" ", 1101)); +assertEquals("> <", res[509].exec("12> <34"), 1102); +assertEquals(null, res[509].exec("*** Failers", 1103)); +assertEquals("> <", res[510].exec("ab> <cd"), 1104); +assertEquals("> <", res[510].exec("ab> <ce"), 1105); +assertEquals(null, res[510].exec("*** Failers", 1106)); +assertEquals(null, res[510].exec("ab> <cd ", 1107)); +assertEquals("> <", res[511].exec("ab> <cd"), 1108); +assertEquals("> <", res[511].exec("ab> <ce"), 1109); +assertEquals(null, res[511].exec("*** Failers", 1110)); +assertEquals(null, res[511].exec("ab> <cd ", 1111)); +assertEquals("12", res[512].exec("12 34"), 1112); +assertEquals("Failers", res[512].exec("*** Failers"), 1113); +assertEquals(null, res[512].exec("+++=*! ", 1114)); +assertEquals("ab", res[513].exec("ab cd"), 1115); +assertEquals("abc", res[513].exec("abcd ce"), 1116); +assertEquals("Fai", res[513].exec("*** Failers"), 1117); +assertEquals(null, res[513].exec("a.b.c", 1118)); +assertEquals("ab", res[514].exec("ab cd"), 1119); +assertEquals("ab", res[514].exec("abcd ce"), 1120); +assertEquals("Fa", res[514].exec("*** Failers"), 1121); +assertEquals(null, res[514].exec("a.b.c", 1122)); +assertEquals("====", res[515].exec("12====34"), 1123); +assertEquals("*** ", res[515].exec("*** Failers"), 1124); +assertEquals(" ", res[515].exec("abcd "), 1125); +assertEquals("===", res[516].exec("ab====cd"), 1126); +assertEquals("==", res[516].exec("ab==cd"), 1127); +assertEquals("***", res[516].exec("*** Failers"), 1128); +assertEquals(null, res[516].exec("a.b.c", 1129)); +assertEquals("==", res[517].exec("ab====cd"), 1130); +assertEquals("==", res[517].exec("ab==cd"), 1131); +assertEquals("**", res[517].exec("*** Failers"), 1132); +assertEquals(null, res[517].exec("a.b.c", 1133)); +assertEquals(null, res[517].exec("x{100}", 1134)); +assertEquals(null, res[517].exec("Zx{100}", 1135)); +assertEquals(null, res[517].exec("x{100}Z", 1136)); +assertEquals("**", res[517].exec("*** Failers "), 1137); +assertEquals(null, res[517].exec("Zx{100}", 1138)); +assertEquals(null, res[517].exec("x{100}", 1139)); +assertEquals(null, res[517].exec("x{100}Z", 1140)); +assertEquals("**", res[517].exec("*** Failers "), 1141); +assertEquals(null, res[517].exec("abcx{200}X", 1142)); +assertEquals(null, res[517].exec("abcx{100}X ", 1143)); +assertEquals("**", res[517].exec("*** Failers"), 1144); +assertEquals(" ", res[517].exec("X "), 1145); +assertEquals(null, res[517].exec("abcx{200}X", 1146)); +assertEquals(null, res[517].exec("abcx{100}X ", 1147)); +assertEquals(null, res[517].exec("abQX ", 1148)); +assertEquals("**", res[517].exec("*** Failers"), 1149); +assertEquals(" ", res[517].exec("X "), 1150); +assertEquals(null, res[517].exec("abcx{100}x{200}x{100}X", 1151)); +assertEquals("**", res[517].exec("*** Failers"), 1152); +assertEquals(null, res[517].exec("abcx{200}X", 1153)); +assertEquals(" ", res[517].exec("X "), 1154); +assertEquals(null, res[517].exec("AX", 1155)); +assertEquals(null, res[517].exec("x{150}X", 1156)); +assertEquals(null, res[517].exec("x{500}X ", 1157)); +assertEquals("**", res[517].exec("*** Failers"), 1158); +assertEquals(null, res[517].exec("x{100}X", 1159)); +assertEquals(" ", res[517].exec("x{200}X "), 1160); +assertEquals(null, res[517].exec("AX", 1161)); +assertEquals(null, res[517].exec("x{150}X", 1162)); +assertEquals(null, res[517].exec("x{500}X ", 1163)); +assertEquals("**", res[517].exec("*** Failers"), 1164); +assertEquals(null, res[517].exec("x{100}X", 1165)); +assertEquals(" ", res[517].exec("x{200}X "), 1166); +assertEquals(null, res[517].exec("QX ", 1167)); +assertEquals(null, res[517].exec("AX", 1168)); +assertEquals(null, res[517].exec("x{500}X ", 1169)); +assertEquals("**", res[517].exec("*** Failers"), 1170); +assertEquals(null, res[517].exec("x{100}X", 1171)); +assertEquals(null, res[517].exec("x{150}X", 1172)); +assertEquals(" ", res[517].exec("x{200}X "), 1173); +assertEquals(null, res[518].exec("aXb", 1174)); +assertEquals(null, res[518].exec("a\nb", 1175)); +assertEquals(null, res[519].exec("aXb", 1176)); +assertEquals(null, res[519].exec("a\nb", 1177)); +assertEquals(null, res[519].exec("*** Failers ", 1178)); +assertEquals(null, res[519].exec("ax{100}b ", 1179)); +assertEquals(null, res[519].exec("z", 1180)); +assertEquals(null, res[519].exec("Z ", 1181)); +assertEquals(null, res[519].exec("x{100}", 1182)); +assertEquals(null, res[519].exec("*** Failers", 1183)); +assertEquals(null, res[519].exec("x{102}", 1184)); +assertEquals(null, res[519].exec("y ", 1185)); +assertEquals("\xff", res[520].exec(">\xff<"), 1186); +assertEquals(null, res[521].exec(">x{ff}<", 1187)); +assertEquals("X", res[522].exec("XYZ"), 1188); +assertEquals("X", res[523].exec("XYZ"), 1189); +assertEquals("x", res[523].exec("x{123} "), 1190); +assertEquals(",", res[528].exec("catac"), 1191); +assertEquals(",", res[528].exec("ax{256}a "), 1192); +assertEquals(",", res[528].exec("x{85}"), 1193); +assertEquals(",", res[528].exec("\u1234 "), 1194); +assertEquals(",", res[528].exec("\u1234 "), 1195); +assertEquals(",", res[528].exec("abcdefg"), 1196); +assertEquals(",", res[528].exec("ab"), 1197); +assertEquals(",", res[528].exec("a "), 1198); +assertEquals("Ax", res[529].exec("Ax{a3}BC"), 1199); +assertEquals("Ax", res[530].exec("Ax{a3}BC"), 1200); +assertEquals("}=", res[531].exec("+x{a3}== "), 1201); +assertEquals("}=", res[532].exec("+x{a3}== "), 1202); +assertEquals("x", res[533].exec("x{442}x{435}x{441}x{442}"), 1203); +assertEquals("x", res[534].exec("x{442}x{435}x{441}x{442}"), 1204); +assertEquals("x", res[535].exec("x{442}x{435}x{441}x{442}"), 1205); +assertEquals("x", res[536].exec("x{442}x{435}x{441}x{442}"), 1206); +assertEquals("{", res[537].exec("x{2442}x{2435}x{2441}x{2442}"), 1207); +assertEquals("{", res[538].exec("x{2442}x{2435}x{2441}x{2442}"), 1208); +assertEquals("abc\n\x0dx{442}x{435}x{441}x{442}xyz ", res[539].exec("abc\n\x0dx{442}x{435}x{441}x{442}xyz "), 1209); +assertEquals("x{442}x{435}x{441}x{442}", res[539].exec("x{442}x{435}x{441}x{442}"), 1210); +assertEquals("c d", res[540].exec("abc defx{442}x{443}xyz\npqr"), 1211); +assertEquals("c d", res[541].exec("abc defx{442}x{443}xyz\npqr"), 1212); +assertEquals(null, res[542].exec("+x{2442}", 1213)); +assertEquals(null, res[543].exec("+x{2442}", 1214)); +assertEquals(null, res[544].exec("Ax{442}", 1215)); +assertEquals(null, res[545].exec("Ax{442}", 1216)); +assertEquals(null, res[546].exec("Ax{442}", 1217)); +assertEquals(null, res[547].exec("Ax{442}", 1218)); +assertEquals(null, res[548].exec("\x19x{e01ff}", 1219)); +assertEquals(null, res[549].exec("Ax{422}", 1220)); +assertEquals(null, res[550].exec("x{19}x{e01ff}", 1221)); +assertEquals(null, res[551].exec("Ax{442}", 1222)); +assertEquals(null, res[552].exec("Ax{442}", 1223)); +assertEquals(null, res[553].exec("ax{442}", 1224)); +assertEquals(null, res[554].exec("+x{2442}", 1225)); +assertEquals(null, res[555].exec("Mx{442}", 1226)); +assertEquals("abc", res[556].exec("abc"), 1227); +assertEquals("abc", res[557].exec("abc"), 1228); +assertEquals("abc", res[558].exec("abc"), 1229); +assertEquals("abc", res[559].exec("abc"), 1230); +assertEquals(null, res[560].exec("x{100}ax{1234}bcd", 1231)); +assertEquals(null, res[562].exec("x{0041}x{2262}x{0391}x{002e}", 1232)); +assertEquals(null, res[562].exec("x{D55c}x{ad6d}x{C5B4} ", 1233)); +assertEquals(null, res[562].exec("x{65e5}x{672c}x{8a9e}", 1234)); +assertEquals("{861}X", res[563].exec("x{212ab}x{212ab}x{212ab}x{861}X"), 1235); +assertEquals("x{2", res[564].exec("x{212ab}x{212ab}x{212ab}x{861}"), 1236); +assertEquals("x{c", res[564].exec("x{c0}b"), 1237); +assertEquals("ax{", res[564].exec("ax{c0}aaaa/ "), 1238); +assertEquals("ax{", res[564].exec("ax{c0}aaaa/ "), 1239); +assertEquals("ax{", res[564].exec("ax{c0}ax{c0}aaa/ "), 1240); +assertEquals("ax{", res[564].exec("ax{c0}aaaa/ "), 1241); +assertEquals("ax{", res[564].exec("ax{c0}ax{c0}aaa/ "), 1242); +assertEquals("ax{", res[564].exec("ax{c0}aaaa/ "), 1243); +assertEquals("ax{", res[564].exec("ax{c0}ax{c0}aaa/ "), 1244); +assertEquals("Sho", res[564].exec("Should produce an error diagnostic"), 1245); +assertEquals(null, res[565].exec("Xx{1234}", 1246)); +assertEquals(null, res[565].exec("X\nabc ", 1247)); +assertEquals("b", res[566].exec("bar"), 1248); +assertEquals(null, res[566].exec("*** Failers", 1249)); +assertEquals(null, res[566].exec("c", 1250)); +assertEquals(null, res[566].exec("x{ff}", 1251)); +assertEquals(null, res[566].exec("x{100} ", 1252)); +assertEquals("c", res[567].exec("c"), 1253); +assertEquals("x", res[567].exec("x{ff}"), 1254); +assertEquals("x", res[567].exec("x{100} "), 1255); +assertEquals("*", res[567].exec("*** Failers "), 1256); +assertEquals(null, res[567].exec("aaa", 1257)); +assertEquals("x", res[568].exec("x{f1}"), 1258); +assertEquals("x", res[568].exec("x{bf}"), 1259); +assertEquals("x", res[568].exec("x{100}"), 1260); +assertEquals("x", res[568].exec("x{1000} "), 1261); +assertEquals("*", res[568].exec("*** Failers"), 1262); +assertEquals("x", res[568].exec("x{c0} "), 1263); +assertEquals("x", res[568].exec("x{f0} "), 1264); +assertEquals("1", res[568].exec("1234"), 1265); +assertEquals("\"", res[568].exec("\"1234\" "), 1266); +assertEquals("x", res[568].exec("x{100}1234"), 1267); +assertEquals("\"", res[568].exec("\"x{100}1234\" "), 1268); +assertEquals("x", res[568].exec("x{100}x{100}12ab "), 1269); +assertEquals("x", res[568].exec("x{100}x{100}\"12\" "), 1270); +assertEquals("*", res[568].exec("*** Failers "), 1271); +assertEquals("x", res[568].exec("x{100}x{100}abcd"), 1272); +assertEquals("A", res[568].exec("A"), 1273); +assertEquals("x", res[568].exec("x{100}"), 1274); +assertEquals("Z", res[568].exec("Zx{100}"), 1275); +assertEquals("x", res[568].exec("x{100}Z"), 1276); +assertEquals("*", res[568].exec("*** Failers "), 1277); +assertEquals("Z", res[568].exec("Zx{100}"), 1278); +assertEquals("x", res[568].exec("x{100}"), 1279); +assertEquals("x", res[568].exec("x{100}Z"), 1280); +assertEquals("*", res[568].exec("*** Failers "), 1281); +assertEquals("x", res[568].exec("x{100}"), 1282); +assertEquals("x", res[568].exec("x{104}"), 1283); +assertEquals("*", res[568].exec("*** Failers"), 1284); +assertEquals("x", res[568].exec("x{105}"), 1285); +assertEquals("x", res[568].exec("x{ff} "), 1286); +assertEquals("x", res[568].exec("x{100}"), 1287); +assertEquals("\u0100", res[568].exec("\u0100 "), 1288); +assertEquals("\xff", res[569].exec(">\xff<"), 1289); +assertEquals(null, res[570].exec(">x{ff}<", 1290)); +assertEquals("\xd6", res[572].exec("\xd6 # Matches without Study"), 1291); +assertEquals("x", res[572].exec("x{d6}"), 1292); +assertEquals("\xd6", res[572].exec("\xd6 <-- Same with Study"), 1293); +assertEquals("x", res[572].exec("x{d6}"), 1294); +assertEquals("\xd6", res[572].exec("\xd6 # Matches without Study"), 1295); +assertEquals("x", res[572].exec("x{d6} "), 1296); +assertEquals("\xd6", res[572].exec("\xd6 <-- Same with Study"), 1297); +assertEquals("x", res[572].exec("x{d6} "), 1298); +assertEquals("\ufffd", res[572].exec("\ufffd]"), 1299); +assertEquals("\ufffd", res[572].exec("\ufffd"), 1300); +assertEquals("\ufffd", res[572].exec("\ufffd\ufffd\ufffd"), 1301); +assertEquals("\ufffd", res[572].exec("\ufffd\ufffd\ufffd?"), 1302); +assertEquals(null, res[573].exec("\xc0\x80", 1303)); +assertEquals(null, res[573].exec("\xc1\x8f ", 1304)); +assertEquals(null, res[573].exec("\xe0\x9f\x80", 1305)); +assertEquals(null, res[573].exec("\xf0\x8f\x80\x80 ", 1306)); +assertEquals(null, res[573].exec("\xf8\x87\x80\x80\x80 ", 1307)); +assertEquals(null, res[573].exec("\xfc\x83\x80\x80\x80\x80", 1308)); +assertEquals(null, res[573].exec("\xfe\x80\x80\x80\x80\x80 ", 1309)); +assertEquals(null, res[573].exec("\xff\x80\x80\x80\x80\x80 ", 1310)); +assertEquals(null, res[573].exec("\xc3\x8f", 1311)); +assertEquals(null, res[573].exec("\xe0\xaf\x80", 1312)); +assertEquals(null, res[573].exec("\xe1\x80\x80", 1313)); +assertEquals(null, res[573].exec("\xf0\x9f\x80\x80 ", 1314)); +assertEquals(null, res[573].exec("\xf1\x8f\x80\x80 ", 1315)); +assertEquals(null, res[573].exec("\xf8\x88\x80\x80\x80 ", 1316)); +assertEquals(null, res[573].exec("\xf9\x87\x80\x80\x80 ", 1317)); +assertEquals(null, res[573].exec("\xfc\x84\x80\x80\x80\x80", 1318)); +assertEquals(null, res[573].exec("\xfd\x83\x80\x80\x80\x80", 1319)); +assertEquals(null, res[573].exec("?\xf8\x88\x80\x80\x80 ", 1320)); +assertEquals(null, res[573].exec("?\xf9\x87\x80\x80\x80 ", 1321)); +assertEquals(null, res[573].exec("?\xfc\x84\x80\x80\x80\x80", 1322)); +assertEquals(null, res[573].exec("?\xfd\x83\x80\x80\x80\x80", 1323)); +assertEquals(".", res[574].exec("A.B"), 1324); +assertEquals("{", res[574].exec("Ax{100}B "), 1325); +assertEquals("x", res[575].exec("x{100}X "), 1326); +assertEquals("a", res[575].exec("ax{1234}b"), 1327); +assertEquals(null, res[577].exec("AxxB ", 1328)); +assertEquals("abc1", res[578].exec("abc1 \nabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\nabc6 x{0085}abc7 x{2028}abc8 x{2029}abc9 JUNK"), 1329); +assertEquals("abc1", res[579].exec("abc1\n abc2\x0b abc3\x0c abc4\x0d abc5\x0d\n abc6x{0085} abc7x{2028} abc8x{2029} abc9"), 1330); +assertEquals(null, res[580].exec("a\nb", 1331)); +assertEquals(null, res[580].exec("a\x0db", 1332)); +assertEquals(null, res[580].exec("a\x0d\nb", 1333)); +assertEquals(null, res[580].exec("a\x0bb", 1334)); +assertEquals(null, res[580].exec("a\x0cb", 1335)); +assertEquals(null, res[580].exec("ax{85}b ", 1336)); +assertEquals(null, res[580].exec("ax{2028}b ", 1337)); +assertEquals(null, res[580].exec("ax{2029}b ", 1338)); +assertEquals(null, res[580].exec("** Failers", 1339)); +assertEquals(null, res[580].exec("a\n\x0db ", 1340)); +assertEquals("ab", res[581].exec("ab"), 1341); +assertEquals(null, res[581].exec("a\nb", 1342)); +assertEquals(null, res[581].exec("a\x0db", 1343)); +assertEquals(null, res[581].exec("a\x0d\nb", 1344)); +assertEquals(null, res[581].exec("a\x0bb", 1345)); +assertEquals(null, res[581].exec("a\x0cx{2028}x{2029}b", 1346)); +assertEquals(null, res[581].exec("ax{85}b ", 1347)); +assertEquals(null, res[581].exec("a\n\x0db ", 1348)); +assertEquals(null, res[581].exec("a\n\x0dx{85}\x0cb ", 1349)); +assertEquals(null, res[582].exec("a\nb", 1350)); +assertEquals(null, res[582].exec("a\x0db", 1351)); +assertEquals(null, res[582].exec("a\x0d\nb", 1352)); +assertEquals(null, res[582].exec("a\x0bb", 1353)); +assertEquals(null, res[582].exec("a\x0cx{2028}x{2029}b", 1354)); +assertEquals(null, res[582].exec("ax{85}b ", 1355)); +assertEquals(null, res[582].exec("a\n\x0db ", 1356)); +assertEquals(null, res[582].exec("a\n\x0dx{85}\x0cb ", 1357)); +assertEquals(null, res[582].exec("** Failers", 1358)); +assertEquals(null, res[582].exec("ab ", 1359)); +assertEquals(null, res[583].exec("a\nb", 1360)); +assertEquals(null, res[583].exec("a\n\x0db", 1361)); +assertEquals(null, res[583].exec("a\n\x0dx{85}b", 1362)); +assertEquals(null, res[583].exec("a\x0d\n\x0d\nb ", 1363)); +assertEquals(null, res[583].exec("a\x0d\n\x0d\n\x0d\nb ", 1364)); +assertEquals(null, res[583].exec("a\n\x0d\n\x0db", 1365)); +assertEquals(null, res[583].exec("a\n\n\x0d\nb ", 1366)); +assertEquals(null, res[583].exec("** Failers", 1367)); +assertEquals(null, res[583].exec("a\n\n\n\x0db", 1368)); +assertEquals(null, res[583].exec("a\x0d", 1369)); +assertEquals(null, res[584].exec("X X\n", 1370)); +assertEquals(null, res[584].exec("X\x09X\x0b", 1371)); +assertEquals(null, res[584].exec("** Failers", 1372)); +assertEquals(null, res[584].exec("x{a0} X\n ", 1373)); +assertEquals(null, res[585].exec("\x09 x{a0}X\n\x0b\x0c\x0d\n", 1374)); +assertEquals(null, res[585].exec("\x09 x{a0}\n\x0b\x0c\x0d\n", 1375)); +assertEquals(null, res[585].exec("\x09 x{a0}\n\x0b\x0c", 1376)); +assertEquals(null, res[585].exec("** Failers ", 1377)); +assertEquals(null, res[585].exec("\x09 x{a0}\n\x0b", 1378)); +assertEquals(null, res[585].exec(" ", 1379)); +assertEquals(null, res[586].exec("x{3001}x{3000}x{2030}x{2028}", 1380)); +assertEquals(null, res[586].exec("Xx{180e}Xx{85}", 1381)); +assertEquals(null, res[586].exec("** Failers", 1382)); +assertEquals(null, res[586].exec("x{2009} X\n ", 1383)); +assertEquals(null, res[587].exec("x{1680}x{180e}x{2007}Xx{2028}x{2029}\x0c\x0d\n", 1384)); +assertEquals(null, res[587].exec("\x09x{205f}x{a0}\nx{2029}\x0cx{2028}\n", 1385)); +assertEquals(null, res[587].exec("\x09 x{202f}\n\x0b\x0c", 1386)); +assertEquals(null, res[587].exec("** Failers ", 1387)); +assertEquals(null, res[587].exec("\x09x{200a}x{a0}x{2028}\x0b", 1388)); +assertEquals(null, res[587].exec(" ", 1389)); +assertEquals(null, res[588].exec(">x{1680}", 1390)); +assertEquals(null, res[589].exec(">x{1680}x{180e}x{2000}x{2003}x{200a}x{202f}x{205f}x{3000}<", 1391)); +assertEquals("x{1ec5} ", res[593].exec("x{1ec5} "), 1392); +assertEquals(null, res[594].exec("x{0}x{d7ff}x{e000}x{10ffff}", 1393)); +assertEquals(null, res[594].exec("x{d800}", 1394)); +assertEquals(null, res[594].exec("x{d800}?", 1395)); +assertEquals(null, res[594].exec("x{da00}", 1396)); +assertEquals(null, res[594].exec("x{da00}?", 1397)); +assertEquals(null, res[594].exec("x{dfff}", 1398)); +assertEquals(null, res[594].exec("x{dfff}?", 1399)); +assertEquals(null, res[594].exec("x{110000} ", 1400)); +assertEquals(null, res[594].exec("x{110000}? ", 1401)); +assertEquals(null, res[594].exec("x{2000000} ", 1402)); +assertEquals(null, res[594].exec("x{2000000}? ", 1403)); +assertEquals(null, res[594].exec("x{7fffffff} ", 1404)); +assertEquals(null, res[594].exec("x{7fffffff}? ", 1405)); +assertEquals(null, res[595].exec("a\x0db", 1406)); +assertEquals(null, res[595].exec("a\nb", 1407)); +assertEquals(null, res[595].exec("a\x0d\nb", 1408)); +assertEquals(null, res[595].exec("** Failers", 1409)); +assertEquals(null, res[595].exec("ax{85}b", 1410)); +assertEquals(null, res[595].exec("a\x0bb ", 1411)); +assertEquals(null, res[596].exec("a\x0db", 1412)); +assertEquals(null, res[596].exec("a\nb", 1413)); +assertEquals(null, res[596].exec("a\x0d\nb", 1414)); +assertEquals(null, res[596].exec("ax{85}b", 1415)); +assertEquals(null, res[596].exec("a\x0bb ", 1416)); +assertEquals(null, res[596].exec("** Failers ", 1417)); +assertEquals(null, res[596].exec("ax{85}b<bsr_anycrlf>", 1418)); +assertEquals(null, res[596].exec("a\x0bb<bsr_anycrlf>", 1419)); +assertEquals(null, res[597].exec("a\x0db", 1420)); +assertEquals(null, res[597].exec("a\nb", 1421)); +assertEquals(null, res[597].exec("a\x0d\nb", 1422)); +assertEquals(null, res[597].exec("** Failers", 1423)); +assertEquals(null, res[597].exec("ax{85}b", 1424)); +assertEquals(null, res[597].exec("a\x0bb ", 1425)); +assertEquals(null, res[598].exec("a\x0db", 1426)); +assertEquals(null, res[598].exec("a\nb", 1427)); +assertEquals(null, res[598].exec("a\x0d\nb", 1428)); +assertEquals(null, res[598].exec("ax{85}b", 1429)); +assertEquals(null, res[598].exec("a\x0bb ", 1430)); +assertEquals(null, res[598].exec("** Failers ", 1431)); +assertEquals(null, res[598].exec("ax{85}b<bsr_anycrlf>", 1432)); +assertEquals(null, res[598].exec("a\x0bb<bsr_anycrlf>", 1433)); +assertEquals("QQQx{2029}ABCaXYZ=!bPQR", res[599].exec("QQQx{2029}ABCaXYZ=!bPQR"), 1434); +assertEquals(null, res[599].exec("** Failers", 1435)); +assertEquals(null, res[599].exec("ax{2029}b", 1436)); +assertEquals(null, res[599].exec("a\xe2\x80\xa9b ", 1437)); +assertEquals(null, res[600].exec("ax{1234}b", 1438)); +assertEquals("a\nb", res[600].exec("a\nb "), 1439); +assertEquals(null, res[600].exec("** Failers", 1440)); +assertEquals(null, res[600].exec("ab ", 1441)); +assertEquals("aXb", res[601].exec("aXb"), 1442); +assertEquals("a\nX\nXx{1234}b", res[601].exec("a\nX\nXx{1234}b "), 1443); +assertEquals(null, res[601].exec("** Failers", 1444)); +assertEquals(null, res[601].exec("ab ", 1445)); +assertEquals(null, res[601].exec("x{de}x{de}", 1446)); +assertEquals(null, res[601].exec("x{123} ", 1447)); +assertEquals("X", res[602].exec("Ax{1ec5}ABCXYZ"), 1448); +assertEquals(null, res[604].exec("x{c0}x{30f}x{660}x{66c}x{f01}x{1680}<", 1449)); +assertEquals(null, res[604].exec("\npx{300}9!$ < ", 1450)); +assertEquals(null, res[604].exec("** Failers ", 1451)); +assertEquals(null, res[604].exec("apx{300}9!$ < ", 1452)); +assertEquals(null, res[605].exec("X", 1453)); +assertEquals(null, res[605].exec("** Failers ", 1454)); +assertEquals(null, res[605].exec("", 1455)); +assertEquals(null, res[606].exec("9", 1456)); +assertEquals(null, res[606].exec("** Failers ", 1457)); +assertEquals(null, res[606].exec("x{c0}", 1458)); +assertEquals(null, res[607].exec("X", 1459)); +assertEquals(null, res[607].exec("** Failers ", 1460)); +assertEquals(null, res[607].exec("x{30f}", 1461)); +assertEquals(null, res[608].exec("X", 1462)); +assertEquals(null, res[608].exec("** Failers ", 1463)); +assertEquals(null, res[608].exec("x{660}", 1464)); +assertEquals(null, res[609].exec("X", 1465)); +assertEquals(null, res[609].exec("** Failers ", 1466)); +assertEquals(null, res[609].exec("x{66c}", 1467)); +assertEquals(null, res[610].exec("X", 1468)); +assertEquals(null, res[610].exec("** Failers ", 1469)); +assertEquals(null, res[610].exec("x{f01}", 1470)); +assertEquals(null, res[611].exec("X", 1471)); +assertEquals(null, res[611].exec("** Failers ", 1472)); +assertEquals(null, res[611].exec("x{1680}", 1473)); +assertEquals(null, res[612].exec("x{017}", 1474)); +assertEquals(null, res[612].exec("x{09f} ", 1475)); +assertEquals(null, res[612].exec("** Failers", 1476)); +assertEquals(null, res[612].exec("x{0600} ", 1477)); +assertEquals(null, res[613].exec("x{601}", 1478)); +assertEquals(null, res[613].exec("** Failers", 1479)); +assertEquals(null, res[613].exec("x{09f} ", 1480)); +assertEquals(null, res[614].exec("x{e0000}", 1481)); +assertEquals(null, res[614].exec("** Failers", 1482)); +assertEquals(null, res[614].exec("x{09f} ", 1483)); +assertEquals(null, res[615].exec("x{f8ff}", 1484)); +assertEquals(null, res[615].exec("** Failers", 1485)); +assertEquals(null, res[615].exec("x{09f} ", 1486)); +assertEquals(null, res[616].exec("?x{dfff}", 1487)); +assertEquals(null, res[616].exec("** Failers", 1488)); +assertEquals(null, res[616].exec("x{09f} ", 1489)); +assertEquals(null, res[617].exec("a", 1490)); +assertEquals(null, res[617].exec("** Failers ", 1491)); +assertEquals(null, res[617].exec("Z", 1492)); +assertEquals(null, res[617].exec("x{e000} ", 1493)); +assertEquals(null, res[618].exec("x{2b0}", 1494)); +assertEquals(null, res[618].exec("** Failers", 1495)); +assertEquals(null, res[618].exec("a ", 1496)); +assertEquals(null, res[619].exec("x{1bb}", 1497)); +assertEquals(null, res[619].exec("x{3400}", 1498)); +assertEquals(null, res[619].exec("x{3401}", 1499)); +assertEquals(null, res[619].exec("x{4d00}", 1500)); +assertEquals(null, res[619].exec("x{4db4}", 1501)); +assertEquals(null, res[619].exec("x{4db5} ", 1502)); +assertEquals(null, res[619].exec("** Failers", 1503)); +assertEquals(null, res[619].exec("a ", 1504)); +assertEquals(null, res[619].exec("x{2b0}", 1505)); +assertEquals(null, res[619].exec("x{4db6} ", 1506)); +assertEquals(null, res[620].exec("x{1c5}", 1507)); +assertEquals(null, res[620].exec("** Failers", 1508)); +assertEquals(null, res[620].exec("a ", 1509)); +assertEquals(null, res[620].exec("x{2b0}", 1510)); +assertEquals(null, res[621].exec("A", 1511)); +assertEquals(null, res[621].exec("** Failers", 1512)); +assertEquals(null, res[621].exec("x{2b0}", 1513)); +assertEquals(null, res[622].exec("x{903}", 1514)); +assertEquals(null, res[622].exec("** Failers", 1515)); +assertEquals(null, res[622].exec("X", 1516)); +assertEquals(null, res[622].exec("x{300}", 1517)); +assertEquals(null, res[622].exec(" ", 1518)); +assertEquals(null, res[623].exec("x{488}", 1519)); +assertEquals(null, res[623].exec("** Failers", 1520)); +assertEquals(null, res[623].exec("X", 1521)); +assertEquals(null, res[623].exec("x{903}", 1522)); +assertEquals(null, res[623].exec("x{300}", 1523)); +assertEquals(null, res[624].exec("x{300}", 1524)); +assertEquals(null, res[624].exec("** Failers", 1525)); +assertEquals(null, res[624].exec("X", 1526)); +assertEquals(null, res[624].exec("x{903}", 1527)); +assertEquals(null, res[624].exec("0123456789x{660}x{661}x{662}x{663}x{664}x{665}x{666}x{667}x{668}x{669}x{66a}", 1528)); +assertEquals(null, res[624].exec("x{6f0}x{6f1}x{6f2}x{6f3}x{6f4}x{6f5}x{6f6}x{6f7}x{6f8}x{6f9}x{6fa}", 1529)); +assertEquals(null, res[624].exec("x{966}x{967}x{968}x{969}x{96a}x{96b}x{96c}x{96d}x{96e}x{96f}x{970}", 1530)); +assertEquals(null, res[624].exec("** Failers", 1531)); +assertEquals(null, res[624].exec("X", 1532)); +assertEquals(null, res[625].exec("x{16ee}", 1533)); +assertEquals(null, res[625].exec("** Failers", 1534)); +assertEquals(null, res[625].exec("X", 1535)); +assertEquals(null, res[625].exec("x{966}", 1536)); +assertEquals(null, res[626].exec("x{b2}", 1537)); +assertEquals(null, res[626].exec("x{b3}", 1538)); +assertEquals(null, res[626].exec("** Failers", 1539)); +assertEquals(null, res[626].exec("X", 1540)); +assertEquals(null, res[626].exec("x{16ee}", 1541)); +assertEquals(null, res[627].exec("_", 1542)); +assertEquals(null, res[627].exec("x{203f}", 1543)); +assertEquals(null, res[627].exec("** Failers", 1544)); +assertEquals(null, res[627].exec("X", 1545)); +assertEquals(null, res[627].exec("-", 1546)); +assertEquals(null, res[627].exec("x{58a}", 1547)); +assertEquals(null, res[628].exec("-", 1548)); +assertEquals(null, res[628].exec("x{58a}", 1549)); +assertEquals(null, res[628].exec("** Failers", 1550)); +assertEquals(null, res[628].exec("X", 1551)); +assertEquals(null, res[628].exec("x{203f}", 1552)); +assertEquals(null, res[629].exec(")", 1553)); +assertEquals(null, res[629].exec("]", 1554)); +assertEquals(null, res[629].exec("}", 1555)); +assertEquals(null, res[629].exec("x{f3b}", 1556)); +assertEquals(null, res[629].exec("** Failers", 1557)); +assertEquals(null, res[629].exec("X", 1558)); +assertEquals(null, res[629].exec("x{203f}", 1559)); +assertEquals(null, res[629].exec("(", 1560)); +assertEquals(null, res[629].exec("[", 1561)); +assertEquals(null, res[629].exec("{", 1562)); +assertEquals(null, res[629].exec("x{f3c}", 1563)); +assertEquals(null, res[630].exec("x{bb}", 1564)); +assertEquals(null, res[630].exec("x{2019}", 1565)); +assertEquals(null, res[630].exec("** Failers", 1566)); +assertEquals(null, res[630].exec("X", 1567)); +assertEquals(null, res[630].exec("x{203f}", 1568)); +assertEquals(null, res[631].exec("x{ab}", 1569)); +assertEquals(null, res[631].exec("x{2018}", 1570)); +assertEquals(null, res[631].exec("** Failers", 1571)); +assertEquals(null, res[631].exec("X", 1572)); +assertEquals(null, res[631].exec("x{203f}", 1573)); +assertEquals(null, res[632].exec("!", 1574)); +assertEquals(null, res[632].exec("x{37e}", 1575)); +assertEquals(null, res[632].exec("** Failers", 1576)); +assertEquals(null, res[632].exec("X", 1577)); +assertEquals(null, res[632].exec("x{203f}", 1578)); +assertEquals(null, res[633].exec("(", 1579)); +assertEquals(null, res[633].exec("[", 1580)); +assertEquals(null, res[633].exec("{", 1581)); +assertEquals(null, res[633].exec("x{f3c}", 1582)); +assertEquals(null, res[633].exec("** Failers", 1583)); +assertEquals(null, res[633].exec("X", 1584)); +assertEquals(null, res[633].exec(")", 1585)); +assertEquals(null, res[633].exec("]", 1586)); +assertEquals(null, res[633].exec("}", 1587)); +assertEquals(null, res[633].exec("x{f3b}", 1588)); +assertEquals(null, res[633].exec("$x{a2}x{a3}x{a4}x{a5}x{a6}", 1589)); +assertEquals(null, res[633].exec("x{9f2}", 1590)); +assertEquals(null, res[633].exec("** Failers", 1591)); +assertEquals(null, res[633].exec("X", 1592)); +assertEquals(null, res[633].exec("x{2c2}", 1593)); +assertEquals(null, res[634].exec("x{2c2}", 1594)); +assertEquals(null, res[634].exec("** Failers", 1595)); +assertEquals(null, res[634].exec("X", 1596)); +assertEquals(null, res[634].exec("x{9f2}", 1597)); +assertEquals(null, res[634].exec("+<|~x{ac}x{2044}", 1598)); +assertEquals(null, res[634].exec("** Failers", 1599)); +assertEquals(null, res[634].exec("X", 1600)); +assertEquals(null, res[634].exec("x{9f2}", 1601)); +assertEquals(null, res[635].exec("x{a6}", 1602)); +assertEquals(null, res[635].exec("x{482} ", 1603)); +assertEquals(null, res[635].exec("** Failers", 1604)); +assertEquals(null, res[635].exec("X", 1605)); +assertEquals(null, res[635].exec("x{9f2}", 1606)); +assertEquals(null, res[636].exec("x{2028}", 1607)); +assertEquals(null, res[636].exec("** Failers", 1608)); +assertEquals(null, res[636].exec("X", 1609)); +assertEquals(null, res[636].exec("x{2029}", 1610)); +assertEquals(null, res[637].exec("x{2029}", 1611)); +assertEquals(null, res[637].exec("** Failers", 1612)); +assertEquals(null, res[637].exec("X", 1613)); +assertEquals(null, res[637].exec("x{2028}", 1614)); +assertEquals(null, res[638].exec("\\ \\", 1615)); +assertEquals(null, res[638].exec("x{a0}", 1616)); +assertEquals(null, res[638].exec("x{1680}", 1617)); +assertEquals(null, res[638].exec("x{180e}", 1618)); +assertEquals(null, res[638].exec("x{2000}", 1619)); +assertEquals(null, res[638].exec("x{2001} ", 1620)); +assertEquals(null, res[638].exec("** Failers", 1621)); +assertEquals(null, res[638].exec("x{2028}", 1622)); +assertEquals(null, res[638].exec("x{200d} ", 1623)); +assertEquals(null, res[638].exec(" x{660}x{661}x{662}ABC", 1624)); +assertEquals(null, res[638].exec(" x{660}x{661}x{662}ABC", 1625)); +assertEquals(null, res[639].exec(" x{660}x{661}x{662}ABC", 1626)); +assertEquals(null, res[640].exec(" x{660}x{661}x{662}ABC", 1627)); +assertEquals(null, res[641].exec(" x{660}x{661}x{662}ABC", 1628)); +assertEquals(null, res[642].exec(" x{660}x{661}x{662}ABC", 1629)); +assertEquals(null, res[643].exec(" x{660}x{661}x{662}ABC", 1630)); +assertEquals(null, res[644].exec(" x{660}x{661}x{662}ABC", 1631)); +assertEquals(null, res[645].exec(" x{660}x{661}x{662}ABC", 1632)); +assertEquals(null, res[646].exec(" x{660}x{661}x{662}ABC", 1633)); +assertEquals(null, res[647].exec(" x{660}x{661}x{662}ABC", 1634)); +assertEquals(null, res[647].exec(" x{660}x{661}x{662}ABC", 1635)); +assertEquals(null, res[647].exec(" x{660}x{661}x{662}ABC", 1636)); +assertEquals(null, res[647].exec(" ** Failers", 1637)); +assertEquals(null, res[647].exec(" x{660}x{661}x{662}ABC", 1638)); +assertEquals(null, res[648].exec("A", 1639)); +assertEquals(null, res[648].exec("ax{10a0}B ", 1640)); +assertEquals(null, res[648].exec("** Failers ", 1641)); +assertEquals(null, res[648].exec("a", 1642)); +assertEquals(null, res[648].exec("x{1d00} ", 1643)); +assertEquals(null, res[649].exec("1234", 1644)); +assertEquals(null, res[649].exec("** Failers", 1645)); +assertEquals(null, res[649].exec("ABC ", 1646)); +assertEquals(null, res[650].exec("1234", 1647)); +assertEquals(null, res[650].exec("** Failers", 1648)); +assertEquals(null, res[650].exec("ABC ", 1649)); +assertEquals(null, res[650].exec("A2XYZ", 1650)); +assertEquals(null, res[650].exec("123A5XYZPQR", 1651)); +assertEquals(null, res[650].exec("ABAx{660}XYZpqr", 1652)); +assertEquals(null, res[650].exec("** Failers", 1653)); +assertEquals(null, res[650].exec("AXYZ", 1654)); +assertEquals(null, res[650].exec("XYZ ", 1655)); +assertEquals(null, res[650].exec("1XYZ", 1656)); +assertEquals(null, res[650].exec("AB=XYZ.. ", 1657)); +assertEquals(null, res[650].exec("XYZ ", 1658)); +assertEquals(null, res[650].exec("** Failers", 1659)); +assertEquals(null, res[650].exec("WXYZ ", 1660)); +assertEquals(null, res[655].exec("1234", 1661)); +assertEquals(null, res[655].exec("1234", 1662)); +assertEquals(null, res[655].exec("12-34", 1663)); +assertEquals("{", res[655].exec("12+x{661}-34 "), 1664); +assertEquals(null, res[655].exec("** Failers", 1665)); +assertEquals("d", res[655].exec("abcd "), 1666); +assertEquals("d", res[656].exec("abcd"), 1667); +assertEquals(null, res[656].exec("** Failers", 1668)); +assertEquals(null, res[656].exec("1234", 1669)); +assertEquals(null, res[657].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 1670)); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[657].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 1671); +assertEquals(" ", res[657].exec(" "), 1672); +assertEquals(null, res[657].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 1673)); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[657].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 1674); +assertEquals(null, res[658].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 1675)); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[658].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 1676); +assertEquals(null, res[659].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 1677)); +assertEquals(null, res[659].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 1678)); +assertEquals(null, res[660].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 1679)); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[660].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 1680); +assertEquals(null, res[661].exec("a", 1681)); +assertEquals(null, res[661].exec("A ", 1682)); +assertEquals(null, res[662].exec("a", 1683)); +assertEquals(null, res[662].exec("A ", 1684)); +assertEquals(null, res[663].exec("A", 1685)); +assertEquals(null, res[663].exec("aZ", 1686)); +assertEquals(null, res[663].exec("** Failers", 1687)); +assertEquals(null, res[663].exec("abc ", 1688)); +assertEquals(null, res[664].exec("A", 1689)); +assertEquals(null, res[664].exec("aZ", 1690)); +assertEquals(null, res[664].exec("** Failers", 1691)); +assertEquals(null, res[664].exec("abc ", 1692)); +assertEquals(null, res[665].exec("a", 1693)); +assertEquals(null, res[665].exec("Az", 1694)); +assertEquals(null, res[665].exec("** Failers", 1695)); +assertEquals(null, res[665].exec("ABC ", 1696)); +assertEquals(null, res[666].exec("a", 1697)); +assertEquals(null, res[666].exec("Az", 1698)); +assertEquals(null, res[666].exec("** Failers", 1699)); +assertEquals(null, res[666].exec("ABC ", 1700)); +assertEquals(null, res[666].exec("x{c0}", 1701)); +assertEquals(null, res[666].exec("x{e0} ", 1702)); +assertEquals(null, res[666].exec("x{c0}", 1703)); +assertEquals(null, res[666].exec("x{e0} ", 1704)); +assertEquals(null, res[666].exec("Ax{391}x{10427}x{ff3a}x{1fb0}", 1705)); +assertEquals(null, res[666].exec("** Failers", 1706)); +assertEquals(null, res[666].exec("ax{391}x{10427}x{ff3a}x{1fb0} ", 1707)); +assertEquals(null, res[666].exec("Ax{3b1}x{10427}x{ff3a}x{1fb0}", 1708)); +assertEquals(null, res[666].exec("Ax{391}x{1044F}x{ff3a}x{1fb0}", 1709)); +assertEquals(null, res[666].exec("Ax{391}x{10427}x{ff5a}x{1fb0}", 1710)); +assertEquals(null, res[666].exec("Ax{391}x{10427}x{ff3a}x{1fb8}", 1711)); +assertEquals(null, res[666].exec("Ax{391}x{10427}x{ff3a}x{1fb0}", 1712)); +assertEquals(null, res[666].exec("ax{391}x{10427}x{ff3a}x{1fb0} ", 1713)); +assertEquals(null, res[666].exec("Ax{3b1}x{10427}x{ff3a}x{1fb0}", 1714)); +assertEquals(null, res[666].exec("Ax{391}x{1044F}x{ff3a}x{1fb0}", 1715)); +assertEquals(null, res[666].exec("Ax{391}x{10427}x{ff5a}x{1fb0}", 1716)); +assertEquals(null, res[666].exec("Ax{391}x{10427}x{ff3a}x{1fb8}", 1717)); +assertEquals(null, res[666].exec("x{391}x{3b1}x{3b1}x{3b1}x{391}", 1718)); +assertEquals(null, res[666].exec("x{391}x{3b1}x{3b1}x{3b1}x{391}X", 1719)); +assertEquals(null, res[666].exec("x{391}x{3b1}x{3b1}x{3b1}x{391}X", 1720)); +assertEquals(null, res[666].exec("x{391}", 1721)); +assertEquals(null, res[666].exec("x{ff3a}", 1722)); +assertEquals(null, res[666].exec("x{3b1}", 1723)); +assertEquals(null, res[666].exec("x{ff5a} ", 1724)); +assertEquals(null, res[666].exec("x{c0}", 1725)); +assertEquals(null, res[666].exec("x{e0} ", 1726)); +assertEquals(null, res[666].exec("x{104}", 1727)); +assertEquals(null, res[666].exec("x{105}", 1728)); +assertEquals(null, res[666].exec("x{109} ", 1729)); +assertEquals(null, res[666].exec("** Failers", 1730)); +assertEquals(null, res[666].exec("x{100}", 1731)); +assertEquals(null, res[666].exec("x{10a} ", 1732)); +assertEquals(null, res[666].exec("Z", 1733)); +assertEquals(null, res[666].exec("z", 1734)); +assertEquals(null, res[666].exec("x{39c}", 1735)); +assertEquals(null, res[666].exec("x{178}", 1736)); +assertEquals(null, res[666].exec("|", 1737)); +assertEquals(null, res[666].exec("x{80}", 1738)); +assertEquals(null, res[666].exec("x{ff}", 1739)); +assertEquals(null, res[666].exec("x{100}", 1740)); +assertEquals(null, res[666].exec("x{101} ", 1741)); +assertEquals(null, res[666].exec("** Failers", 1742)); +assertEquals(null, res[666].exec("x{102}", 1743)); +assertEquals(null, res[666].exec("Y", 1744)); +assertEquals(null, res[666].exec("y ", 1745)); +assertEquals(null, res[667].exec("A", 1746)); +assertEquals(null, res[667].exec("Ax{300}BC ", 1747)); +assertEquals(null, res[667].exec("Ax{300}x{301}x{302}BC ", 1748)); +assertEquals(null, res[667].exec("*** Failers", 1749)); +assertEquals(null, res[667].exec("x{300} ", 1750)); +assertEquals("X", res[668].exec("X123"), 1751); +assertEquals(null, res[668].exec("*** Failers", 1752)); +assertEquals(null, res[668].exec("AXYZ", 1753)); +assertEquals(null, res[669].exec("Ax{300}x{301}x{302}BCAx{300}x{301} ", 1754)); +assertEquals(null, res[669].exec("Ax{300}x{301}x{302}BCAx{300}x{301}C ", 1755)); +assertEquals(null, res[670].exec("Ax{300}x{301}x{302}BCAx{300}x{301} ", 1756)); +assertEquals(null, res[670].exec("Ax{300}x{301}x{302}BCAx{300}x{301}C ", 1757)); +assertEquals("A,,A", res[671].exec("Ax{300}x{301}x{302}BCAx{300}x{301} "), 1758); +assertEquals("A,,A", res[671].exec("Ax{300}x{301}x{302}BCAx{300}x{301}C "), 1759); +assertEquals("A,,A", res[672].exec("Ax{300}x{301}x{302}BCAx{300}x{301} "), 1760); +assertEquals("A,,A", res[672].exec("Ax{300}x{301}x{302}BCAx{300}x{301}C "), 1761); +assertEquals(null, res[673].exec("*** Failers", 1762)); +assertEquals(null, res[673].exec("Ax{300}x{301}x{302}", 1763)); +assertEquals(null, res[674].exec("Ax{300}x{301}Bx{300}X", 1764)); +assertEquals(null, res[674].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}", 1765)); +assertEquals(null, res[674].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}X", 1766)); +assertEquals(null, res[674].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}DAx{300}X", 1767)); +assertEquals(null, res[675].exec("Ax{300}x{301}Bx{300}X", 1768)); +assertEquals(null, res[675].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}", 1769)); +assertEquals(null, res[675].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}X", 1770)); +assertEquals(null, res[675].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}DAx{300}X", 1771)); +assertEquals(null, res[675].exec("x{2e81}x{3007}x{2f804}x{31a0}", 1772)); +assertEquals(null, res[675].exec("** Failers", 1773)); +assertEquals(null, res[675].exec("x{2e7f} ", 1774)); +assertEquals(null, res[675].exec("x{3105}", 1775)); +assertEquals(null, res[675].exec("** Failers", 1776)); +assertEquals(null, res[675].exec("x{30ff} ", 1777)); +assertEquals(null, res[676].exec("x{06e9}", 1778)); +assertEquals(null, res[676].exec("x{060b}", 1779)); +assertEquals(null, res[676].exec("** Failers", 1780)); +assertEquals(null, res[676].exec("Xx{06e9} ", 1781)); +assertEquals(null, res[677].exec("x{2f800}", 1782)); +assertEquals(null, res[677].exec("** Failers", 1783)); +assertEquals(null, res[677].exec("x{a014}", 1784)); +assertEquals(null, res[677].exec("x{a4c6} ", 1785)); +assertEquals(null, res[678].exec("AXYZ", 1786)); +assertEquals(null, res[678].exec("x{1234}XYZ ", 1787)); +assertEquals(null, res[678].exec("** Failers", 1788)); +assertEquals(null, res[678].exec("X ", 1789)); +assertEquals(null, res[679].exec("** Failers", 1790)); +assertEquals(null, res[679].exec("AX", 1791)); +assertEquals(null, res[680].exec("XYZ", 1792)); +assertEquals(null, res[680].exec("AXYZ", 1793)); +assertEquals(null, res[680].exec("x{1234}XYZ ", 1794)); +assertEquals(null, res[680].exec("** Failers", 1795)); +assertEquals(null, res[680].exec("ABXYZ ", 1796)); +assertEquals(null, res[681].exec("XYZ", 1797)); +assertEquals(null, res[681].exec("** Failers", 1798)); +assertEquals(null, res[681].exec("AXYZ", 1799)); +assertEquals(null, res[681].exec("x{1234}XYZ ", 1800)); +assertEquals(null, res[681].exec("ABXYZ ", 1801)); +assertEquals(null, res[681].exec("AXYZ", 1802)); +assertEquals(null, res[681].exec("x{1234}XYZ", 1803)); +assertEquals(null, res[681].exec("Ax{1234}XYZ", 1804)); +assertEquals(null, res[681].exec("** Failers", 1805)); +assertEquals(null, res[681].exec("XYZ", 1806)); +assertEquals(null, res[681].exec("** Failers", 1807)); +assertEquals(null, res[681].exec("AXYZ", 1808)); +assertEquals(null, res[681].exec("x{1234}XYZ", 1809)); +assertEquals(null, res[681].exec("Ax{1234}XYZ", 1810)); +assertEquals(null, res[681].exec("XYZ", 1811)); +assertEquals(null, res[682].exec("XYZ", 1812)); +assertEquals(null, res[682].exec("AXYZ", 1813)); +assertEquals(null, res[682].exec("x{1234}XYZ", 1814)); +assertEquals(null, res[682].exec("Ax{1234}XYZ", 1815)); +assertEquals(null, res[682].exec("** Failers", 1816)); +assertEquals(null, res[683].exec("XYZ", 1817)); +assertEquals(null, res[683].exec("** Failers", 1818)); +assertEquals(null, res[683].exec("AXYZ", 1819)); +assertEquals(null, res[683].exec("x{1234}XYZ", 1820)); +assertEquals(null, res[683].exec("Ax{1234}XYZ", 1821)); +assertEquals("AX", res[684].exec("AXYZ"), 1822); +assertEquals(null, res[684].exec("x{1234}XYZ ", 1823)); +assertEquals(null, res[684].exec("** Failers", 1824)); +assertEquals(null, res[684].exec("X ", 1825)); +assertEquals(null, res[685].exec("** Failers", 1826)); +assertEquals("AX", res[685].exec("AX"), 1827); +assertEquals("X", res[686].exec("XYZ"), 1828); +assertEquals("AX", res[686].exec("AXYZ"), 1829); +assertEquals(null, res[686].exec("x{1234}XYZ ", 1830)); +assertEquals(null, res[686].exec("** Failers", 1831)); +assertEquals(null, res[686].exec("ABXYZ ", 1832)); +assertEquals("X", res[687].exec("XYZ"), 1833); +assertEquals(null, res[687].exec("** Failers", 1834)); +assertEquals("AX", res[687].exec("AXYZ"), 1835); +assertEquals(null, res[687].exec("x{1234}XYZ ", 1836)); +assertEquals(null, res[687].exec("ABXYZ ", 1837)); +assertEquals("AX", res[688].exec("AXYZ"), 1838); +assertEquals(null, res[688].exec("x{1234}XYZ", 1839)); +assertEquals(null, res[688].exec("Ax{1234}XYZ", 1840)); +assertEquals(null, res[688].exec("** Failers", 1841)); +assertEquals(null, res[688].exec("XYZ", 1842)); +assertEquals(null, res[689].exec("** Failers", 1843)); +assertEquals("AX", res[689].exec("AXYZ"), 1844); +assertEquals(null, res[689].exec("x{1234}XYZ", 1845)); +assertEquals(null, res[689].exec("Ax{1234}XYZ", 1846)); +assertEquals(null, res[689].exec("XYZ", 1847)); +assertEquals("X", res[690].exec("XYZ"), 1848); +assertEquals("AX", res[690].exec("AXYZ"), 1849); +assertEquals(null, res[690].exec("x{1234}XYZ", 1850)); +assertEquals(null, res[690].exec("Ax{1234}XYZ", 1851)); +assertEquals(null, res[690].exec("** Failers", 1852)); +assertEquals("X", res[691].exec("XYZ"), 1853); +assertEquals(null, res[691].exec("** Failers", 1854)); +assertEquals("AX", res[691].exec("AXYZ"), 1855); +assertEquals(null, res[691].exec("x{1234}XYZ", 1856)); +assertEquals(null, res[691].exec("Ax{1234}XYZ", 1857)); +assertEquals(null, res[692].exec("abcdefgh", 1858)); +assertEquals(null, res[692].exec("x{1234}\n\x0dx{3456}xyz ", 1859)); +assertEquals(null, res[693].exec("abcdefgh", 1860)); +assertEquals(null, res[693].exec("x{1234}\n\x0dx{3456}xyz ", 1861)); +assertEquals(null, res[694].exec("** Failers", 1862)); +assertEquals(null, res[694].exec("abcdefgh", 1863)); +assertEquals(null, res[694].exec("x{1234}\n\x0dx{3456}xyz ", 1864)); +assertEquals(null, res[695].exec(" AXY", 1865)); +assertEquals(null, res[695].exec(" aXY", 1866)); +assertEquals(null, res[695].exec(" x{1c5}XY", 1867)); +assertEquals(null, res[695].exec(" ** Failers", 1868)); +assertEquals(null, res[695].exec(" x{1bb}XY", 1869)); +assertEquals(null, res[695].exec(" x{2b0}XY", 1870)); +assertEquals(null, res[695].exec(" !XY ", 1871)); +assertEquals(null, res[696].exec(" AXY", 1872)); +assertEquals(null, res[696].exec(" aXY", 1873)); +assertEquals(null, res[696].exec(" x{1c5}XY", 1874)); +assertEquals(null, res[696].exec(" ** Failers", 1875)); +assertEquals(null, res[696].exec(" x{1bb}XY", 1876)); +assertEquals(null, res[696].exec(" x{2b0}XY", 1877)); +assertEquals(null, res[696].exec(" !XY ", 1878)); +assertEquals(null, res[696].exec(" AXY", 1879)); +assertEquals(null, res[696].exec(" aXY", 1880)); +assertEquals(null, res[696].exec(" AbcdeXyz ", 1881)); +assertEquals(null, res[696].exec(" x{1c5}AbXY", 1882)); +assertEquals(null, res[696].exec(" abcDEXypqreXlmn ", 1883)); +assertEquals(null, res[696].exec(" ** Failers", 1884)); +assertEquals(null, res[696].exec(" x{1bb}XY", 1885)); +assertEquals(null, res[696].exec(" x{2b0}XY", 1886)); +assertEquals(null, res[696].exec(" !XY ", 1887)); +assertEquals(null, res[697].exec(" AXY", 1888)); +assertEquals(null, res[697].exec(" aXY", 1889)); +assertEquals(null, res[697].exec(" AbcdeXyz ", 1890)); +assertEquals(null, res[697].exec(" x{1c5}AbXY", 1891)); +assertEquals(null, res[697].exec(" abcDEXypqreXlmn ", 1892)); +assertEquals(null, res[697].exec(" ** Failers", 1893)); +assertEquals(null, res[697].exec(" x{1bb}XY", 1894)); +assertEquals(null, res[697].exec(" x{2b0}XY", 1895)); +assertEquals(null, res[697].exec(" !XY ", 1896)); +assertEquals(null, res[697].exec(" AXY", 1897)); +assertEquals(null, res[697].exec(" aXY", 1898)); +assertEquals(null, res[697].exec(" AbcdeXyz ", 1899)); +assertEquals(null, res[697].exec(" x{1c5}AbXY", 1900)); +assertEquals(null, res[697].exec(" abcDEXypqreXlmn ", 1901)); +assertEquals(null, res[697].exec(" ** Failers", 1902)); +assertEquals(null, res[697].exec(" x{1bb}XY", 1903)); +assertEquals(null, res[697].exec(" x{2b0}XY", 1904)); +assertEquals(null, res[697].exec(" !XY ", 1905)); +assertEquals(null, res[698].exec(" AXY", 1906)); +assertEquals(null, res[698].exec(" aXY", 1907)); +assertEquals(null, res[698].exec(" AbcdeXyz ", 1908)); +assertEquals(null, res[698].exec(" x{1c5}AbXY", 1909)); +assertEquals(null, res[698].exec(" abcDEXypqreXlmn ", 1910)); +assertEquals(null, res[698].exec(" ** Failers", 1911)); +assertEquals(null, res[698].exec(" x{1bb}XY", 1912)); +assertEquals(null, res[698].exec(" x{2b0}XY", 1913)); +assertEquals(null, res[698].exec(" !XY ", 1914)); +assertEquals(null, res[699].exec(" !XY", 1915)); +assertEquals(null, res[699].exec(" x{1bb}XY", 1916)); +assertEquals(null, res[699].exec(" x{2b0}XY", 1917)); +assertEquals(null, res[699].exec(" ** Failers", 1918)); +assertEquals(null, res[699].exec(" x{1c5}XY", 1919)); +assertEquals(null, res[699].exec(" AXY ", 1920)); +assertEquals(null, res[700].exec(" !XY", 1921)); +assertEquals(null, res[700].exec(" x{1bb}XY", 1922)); +assertEquals(null, res[700].exec(" x{2b0}XY", 1923)); +assertEquals(null, res[700].exec(" ** Failers", 1924)); +assertEquals(null, res[700].exec(" x{1c5}XY", 1925)); +assertEquals(null, res[700].exec(" AXY ", 1926)); +assertEquals(null, res[701].exec("\xa0!", 1927)); +assertEquals(null, res[701].exec("AabcabcYZ ", 1928)); +assertEquals("L=abcX,L=abc,abc", res[702].exec("L=abcX"), 1929); +assertEquals(null, res[702].exec("x{c0}", 1930)); +assertEquals(null, res[702].exec("x{e0} ", 1931)); +assertEquals(null, res[702].exec("x{c0}", 1932)); +assertEquals(null, res[702].exec("x{e0} ", 1933)); +assertEquals(null, res[703].exec("x{1b00}x{12000}x{7c0}x{a840}x{10900}", 1934)); +assertEquals(null, res[706].exec("123abcdefg", 1935)); +assertEquals(null, res[706].exec("123abc\xc4\xc5zz", 1936)); +assertEquals(null, res[710].exec("A\x80", 1937)); +assertEquals(null, res[725].exec("x{60e} ", 1938)); +assertEquals(null, res[725].exec("x{656} ", 1939)); +assertEquals(null, res[725].exec("x{657} ", 1940)); +assertEquals(null, res[725].exec("x{658} ", 1941)); +assertEquals(null, res[725].exec("x{659} ", 1942)); +assertEquals(null, res[725].exec("x{65a} ", 1943)); +assertEquals(null, res[725].exec("x{65b} ", 1944)); +assertEquals(null, res[725].exec("x{65c} ", 1945)); +assertEquals(null, res[725].exec("x{65d} ", 1946)); +assertEquals(null, res[725].exec("x{65e} ", 1947)); +assertEquals(null, res[725].exec("x{66a} ", 1948)); +assertEquals(null, res[725].exec("x{6e9} ", 1949)); +assertEquals(null, res[725].exec("x{6ef}", 1950)); +assertEquals(null, res[725].exec("x{6fa} ", 1951)); +assertEquals(null, res[725].exec("** Failers", 1952)); +assertEquals(null, res[725].exec("x{600}", 1953)); +assertEquals(null, res[725].exec("x{650}", 1954)); +assertEquals(null, res[725].exec("x{651} ", 1955)); +assertEquals(null, res[725].exec("x{652} ", 1956)); +assertEquals(null, res[725].exec("x{653} ", 1957)); +assertEquals(null, res[725].exec("x{654} ", 1958)); +assertEquals(null, res[725].exec("x{655} ", 1959)); +assertEquals(null, res[725].exec("x{65f} ", 1960)); +assertEquals(null, res[726].exec("x{1d2b} ", 1961)); +assertEquals(null, res[727].exec("x{589}", 1962)); +assertEquals(null, res[727].exec("x{60c}", 1963)); +assertEquals(null, res[727].exec("x{61f} ", 1964)); +assertEquals(null, res[727].exec("x{964}", 1965)); +assertEquals(null, res[727].exec("x{965} ", 1966)); +assertEquals(null, res[727].exec("x{970} ", 1967)); +assertEquals(null, res[728].exec("x{64b}", 1968)); +assertEquals(null, res[728].exec("x{654}", 1969)); +assertEquals(null, res[728].exec("x{655}", 1970)); +assertEquals(null, res[728].exec("x{200c} ", 1971)); +assertEquals(null, res[728].exec("** Failers", 1972)); +assertEquals(null, res[728].exec("x{64a}", 1973)); +assertEquals(null, res[728].exec("x{656} ", 1974)); +assertEquals(null, res[729].exec("x{10450}", 1975)); +assertEquals(null, res[729].exec("x{1047f}", 1976)); +assertEquals(null, res[730].exec("x{10400}", 1977)); +assertEquals(null, res[730].exec("x{1044f}", 1978)); +assertEquals(null, res[731].exec("x{10480}", 1979)); +assertEquals(null, res[731].exec("x{1049d}", 1980)); +assertEquals(null, res[731].exec("x{104a0}", 1981)); +assertEquals(null, res[731].exec("x{104a9}", 1982)); +assertEquals(null, res[731].exec("** Failers", 1983)); +assertEquals(null, res[731].exec("x{1049e}", 1984)); +assertEquals(null, res[731].exec("x{1049f}", 1985)); +assertEquals(null, res[731].exec("x{104aa} ", 1986)); +assertEquals(null, res[731].exec("\xe2\x80\xa8\xe2\x80\xa8", 1987)); +assertEquals(null, res[731].exec("x{2028}x{2028}x{2028}", 1988)); +assertEquals(null, res[732].exec("x{c0}x{e0}x{116}x{117}", 1989)); +assertEquals(null, res[732].exec("x{c0}x{e0}x{116}x{117}", 1990)); +assertEquals(null, res[733].exec("x{102A4}x{AA52}x{A91D}x{1C46}x{10283}x{1092E}x{1C6B}x{A93B}x{A8BF}x{1BA0}x{A50A}====", 1991)); +assertEquals(null, res[733].exec("x{a77d}x{1d79}", 1992)); +assertEquals(null, res[733].exec("x{1d79}x{a77d} ", 1993)); +assertEquals(null, res[733].exec("x{a77d}x{1d79}", 1994)); +assertEquals(null, res[733].exec("** Failers ", 1995)); +assertEquals(null, res[733].exec("x{1d79}x{a77d} ", 1996)); +assertEquals("AA,A", res[734].exec("AA"), 1997); +assertEquals("Aa,A", res[734].exec("Aa"), 1998); +assertEquals("aa,a", res[734].exec("aa"), 1999); +assertEquals("aA,a", res[734].exec("aA"), 2000); +assertEquals(null, res[734].exec("x{de}x{de}", 2001)); +assertEquals(null, res[734].exec("x{de}x{fe}", 2002)); +assertEquals(null, res[734].exec("x{fe}x{fe}", 2003)); +assertEquals(null, res[734].exec("x{fe}x{de}", 2004)); +assertEquals(null, res[734].exec("x{10a}x{10a}", 2005)); +assertEquals(null, res[734].exec("x{10a}x{10b}", 2006)); +assertEquals(null, res[734].exec("x{10b}x{10b}", 2007)); +assertEquals(null, res[734].exec("x{10b}x{10a}", 2008)); +assertEquals("abc", res[736].exec("abc"), 2009); +assertEquals("abc", res[737].exec("abc"), 2010); +assertEquals("abbbbc", res[737].exec("abbbbc"), 2011); +assertEquals("ac", res[737].exec("ac"), 2012); +assertEquals("abc", res[738].exec("abc"), 2013); +assertEquals("abbbbbbc", res[738].exec("abbbbbbc"), 2014); +assertEquals(null, res[738].exec("*** Failers ", 2015)); +assertEquals(null, res[738].exec("ac", 2016)); +assertEquals(null, res[738].exec("ab", 2017)); +assertEquals("a", res[739].exec("a"), 2018); +assertEquals("aaaaaaaaaaaaaaaaa", res[739].exec("aaaaaaaaaaaaaaaaa"), 2019); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[739].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa "), 2020); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[739].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaF "), 2021); +assertEquals("a,a", res[740].exec("a"), 2022); +assertEquals("a,a", res[740].exec("abcd"), 2023); +assertEquals("a,a", res[740].exec("african"), 2024); +assertEquals("abc", res[741].exec("abcdef"), 2025); +assertEquals(null, res[741].exec("*** Failers", 2026)); +assertEquals(null, res[741].exec("xyzabc", 2027)); +assertEquals(null, res[741].exec("xyz\nabc ", 2028)); +assertEquals("abc", res[742].exec("abcdef"), 2029); +assertEquals("abc", res[742].exec("xyz\nabc "), 2030); +assertEquals(null, res[742].exec("*** Failers", 2031)); +assertEquals(null, res[742].exec("xyzabc", 2032)); +assertEquals(null, res[743].exec("abcdef", 2033)); +assertEquals(null, res[743].exec("*** Failers", 2034)); +assertEquals(null, res[743].exec("xyzabc", 2035)); +assertEquals(null, res[743].exec("xyz\nabc ", 2036)); +assertEquals(null, res[744].exec("abcdef", 2037)); +assertEquals(null, res[744].exec("*** Failers", 2038)); +assertEquals(null, res[744].exec("xyzabc", 2039)); +assertEquals(null, res[744].exec("xyz\nabc ", 2040)); +assertEquals(null, res[745].exec("abcdef", 2041)); +assertEquals(null, res[745].exec("xyzabc>3", 2042)); +assertEquals(null, res[745].exec("*** Failers", 2043)); +assertEquals(null, res[745].exec("xyzabc ", 2044)); +assertEquals(null, res[745].exec("xyzabc>2 ", 2045)); +assertEquals("x9yzz", res[746].exec("x9yzz"), 2046); +assertEquals("x0y+z", res[746].exec("x0y+z"), 2047); +assertEquals(null, res[746].exec("*** Failers", 2048)); +assertEquals(null, res[746].exec("xyz", 2049)); +assertEquals(null, res[746].exec("xxy0z ", 2050)); +assertEquals("x yzz", res[747].exec("x yzz"), 2051); +assertEquals("x y+z", res[747].exec("x y+z"), 2052); +assertEquals(null, res[747].exec("*** Failers", 2053)); +assertEquals(null, res[747].exec("xyz", 2054)); +assertEquals(null, res[747].exec("xxyyz", 2055)); +assertEquals("xxy+z", res[748].exec("xxy+z"), 2056); +assertEquals(null, res[748].exec("*** Failers", 2057)); +assertEquals(null, res[748].exec("xxy0z", 2058)); +assertEquals(null, res[748].exec("x+y+z ", 2059)); +assertEquals("x+y", res[749].exec("x+y"), 2060); +assertEquals("x-y", res[749].exec("x-y"), 2061); +assertEquals(null, res[749].exec("*** Failers", 2062)); +assertEquals(null, res[749].exec("x\ny", 2063)); +assertEquals("x+y", res[750].exec("x+y"), 2064); +assertEquals("x-y", res[750].exec("x-y"), 2065); +assertEquals(null, res[750].exec("x\ny", 2066)); +assertEquals(null, res[750].exec("a+bc+dp+q", 2067)); +assertEquals(null, res[750].exec("a+bc\ndp+q", 2068)); +assertEquals(null, res[750].exec("x\nyp+q ", 2069)); +assertEquals(null, res[750].exec("*** Failers ", 2070)); +assertEquals(null, res[750].exec("a\nbc\ndp+q", 2071)); +assertEquals(null, res[750].exec("a+bc\ndp\nq", 2072)); +assertEquals(null, res[750].exec("x\nyp\nq ", 2073)); +assertEquals(null, res[751].exec("ba0", 2074)); +assertEquals(null, res[751].exec("*** Failers", 2075)); +assertEquals(null, res[751].exec("ba0\n", 2076)); +assertEquals(null, res[751].exec("ba0\ncd ", 2077)); +assertEquals(null, res[752].exec("ba0", 2078)); +assertEquals(null, res[752].exec("*** Failers", 2079)); +assertEquals(null, res[752].exec("ba0\n", 2080)); +assertEquals(null, res[752].exec("ba0\ncd ", 2081)); +assertEquals(null, res[753].exec("ba0", 2082)); +assertEquals(null, res[753].exec("ba0\n", 2083)); +assertEquals(null, res[753].exec("*** Failers", 2084)); +assertEquals(null, res[753].exec("ba0\ncd ", 2085)); +assertEquals(null, res[754].exec("ba0", 2086)); +assertEquals(null, res[754].exec("ba0\n", 2087)); +assertEquals(null, res[754].exec("*** Failers", 2088)); +assertEquals(null, res[754].exec("ba0\ncd ", 2089)); +assertEquals("a0", res[755].exec("ba0"), 2090); +assertEquals(null, res[755].exec("ba0\n", 2091)); +assertEquals(null, res[755].exec("*** Failers", 2092)); +assertEquals(null, res[755].exec("ba0\ncd ", 2093)); +assertEquals("a0", res[756].exec("ba0"), 2094); +assertEquals("a0", res[756].exec("ba0\n"), 2095); +assertEquals("a0", res[756].exec("ba0\ncd "), 2096); +assertEquals(null, res[756].exec("*** Failers", 2097)); +assertEquals("abc", res[757].exec("abc"), 2098); +assertEquals("aBc", res[757].exec("aBc"), 2099); +assertEquals("ABC", res[757].exec("ABC"), 2100); +assertEquals("b", res[758].exec("abcd"), 2101); +assertEquals("abz", res[759].exec("abz"), 2102); +assertEquals("abb", res[759].exec("abbz"), 2103); +assertEquals("az", res[759].exec("azz "), 2104); +assertEquals("yz", res[760].exec("ayzq"), 2105); +assertEquals("xyz", res[760].exec("axyzq"), 2106); +assertEquals("xxyz", res[760].exec("axxyz"), 2107); +assertEquals("xxxyz", res[760].exec("axxxyzq"), 2108); +assertEquals("xxxyz", res[760].exec("axxxxyzq"), 2109); +assertEquals(null, res[760].exec("*** Failers", 2110)); +assertEquals(null, res[760].exec("ax", 2111)); +assertEquals(null, res[760].exec("axx ", 2112)); +assertEquals(null, res[760].exec(" ", 2113)); +assertEquals("xxxyz", res[761].exec("axxxyzq"), 2114); +assertEquals("xxxyz", res[761].exec("axxxxyzq"), 2115); +assertEquals(null, res[761].exec("*** Failers", 2116)); +assertEquals(null, res[761].exec("ax", 2117)); +assertEquals(null, res[761].exec("axx ", 2118)); +assertEquals(null, res[761].exec("ayzq", 2119)); +assertEquals(null, res[761].exec("axyzq", 2120)); +assertEquals(null, res[761].exec("axxyz", 2121)); +assertEquals(null, res[761].exec(" ", 2122)); +assertEquals("xxyz", res[762].exec("axxyz"), 2123); +assertEquals("xxxyz", res[762].exec("axxxyzq"), 2124); +assertEquals("xxxyz", res[762].exec("axxxxyzq"), 2125); +assertEquals(null, res[762].exec("*** Failers", 2126)); +assertEquals(null, res[762].exec("ax", 2127)); +assertEquals(null, res[762].exec("axx ", 2128)); +assertEquals(null, res[762].exec("ayzq", 2129)); +assertEquals(null, res[762].exec("axyzq", 2130)); +assertEquals(null, res[762].exec(" ", 2131)); +assertEquals("b", res[763].exec("bac"), 2132); +assertEquals("bcdef", res[763].exec("bcdefax"), 2133); +assertEquals("*** F", res[763].exec("*** Failers"), 2134); +assertEquals(" ", res[763].exec("aaaaa "), 2135); +assertEquals("b", res[764].exec("bac"), 2136); +assertEquals("bcdef", res[764].exec("bcdefax"), 2137); +assertEquals("*** F", res[764].exec("*** Failers"), 2138); +assertEquals("", res[764].exec("aaaaa "), 2139); +assertEquals("xyz", res[765].exec("xyz"), 2140); +assertEquals("wxyz", res[765].exec("awxyza"), 2141); +assertEquals("bcdef", res[765].exec("abcdefa"), 2142); +assertEquals("bcdef", res[765].exec("abcdefghijk"), 2143); +assertEquals("*** F", res[765].exec("*** Failers"), 2144); +assertEquals(null, res[765].exec("axya", 2145)); +assertEquals(null, res[765].exec("axa", 2146)); +assertEquals(" ", res[765].exec("aaaaa "), 2147); +assertEquals("1234", res[766].exec("1234b567"), 2148); +assertEquals("", res[766].exec("xyz"), 2149); +assertEquals("a", res[767].exec("a1234b567"), 2150); +assertEquals("xyz", res[767].exec("xyz"), 2151); +assertEquals(" ", res[767].exec(" "), 2152); +assertEquals("1234", res[768].exec("ab1234c56"), 2153); +assertEquals(null, res[768].exec("*** Failers", 2154)); +assertEquals(null, res[768].exec("xyz", 2155)); +assertEquals("ab", res[769].exec("ab123c56"), 2156); +assertEquals("*** Failers", res[769].exec("*** Failers"), 2157); +assertEquals(null, res[769].exec("789", 2158)); +assertEquals("5A", res[770].exec("045ABC"), 2159); +assertEquals("A", res[770].exec("ABC"), 2160); +assertEquals(null, res[770].exec("*** Failers", 2161)); +assertEquals(null, res[770].exec("XYZ", 2162)); +assertEquals("A", res[771].exec("ABC"), 2163); +assertEquals("BA", res[771].exec("BAC"), 2164); +assertEquals("A", res[771].exec("9ABC "), 2165); +assertEquals(null, res[771].exec("*** Failers", 2166)); +assertEquals("aaaa", res[772].exec("aaaa"), 2167); +assertEquals("xyz", res[773].exec("xyz"), 2168); +assertEquals("ggggggggxyz", res[773].exec("ggggggggxyz"), 2169); +assertEquals("abcdxyz", res[774].exec("abcdxyz"), 2170); +assertEquals("axyz", res[774].exec("axyz"), 2171); +assertEquals(null, res[774].exec("*** Failers", 2172)); +assertEquals(null, res[774].exec("xyz", 2173)); +assertEquals("xyz", res[775].exec("xyz"), 2174); +assertEquals("cxyz", res[775].exec("cxyz "), 2175); +assertEquals("12X", res[776].exec("12X"), 2176); +assertEquals("123X", res[776].exec("123X"), 2177); +assertEquals(null, res[776].exec("*** Failers", 2178)); +assertEquals(null, res[776].exec("X", 2179)); +assertEquals(null, res[776].exec("1X", 2180)); +assertEquals(null, res[776].exec("1234X ", 2181)); +assertEquals("a4", res[777].exec("a45"), 2182); +assertEquals("b9", res[777].exec("b93"), 2183); +assertEquals("c9", res[777].exec("c99z"), 2184); +assertEquals("d0", res[777].exec("d04"), 2185); +assertEquals(null, res[777].exec("*** Failers", 2186)); +assertEquals(null, res[777].exec("e45", 2187)); +assertEquals(null, res[777].exec("abcd ", 2188)); +assertEquals(null, res[777].exec("abcd1234", 2189)); +assertEquals(null, res[777].exec("1234 ", 2190)); +assertEquals("a4", res[778].exec("a45"), 2191); +assertEquals("b9", res[778].exec("b93"), 2192); +assertEquals("c9", res[778].exec("c99z"), 2193); +assertEquals("d0", res[778].exec("d04"), 2194); +assertEquals("abcd1", res[778].exec("abcd1234"), 2195); +assertEquals("1", res[778].exec("1234 "), 2196); +assertEquals(null, res[778].exec("*** Failers", 2197)); +assertEquals(null, res[778].exec("e45", 2198)); +assertEquals(null, res[778].exec("abcd ", 2199)); +assertEquals("a4", res[779].exec("a45"), 2200); +assertEquals("b9", res[779].exec("b93"), 2201); +assertEquals("c9", res[779].exec("c99z"), 2202); +assertEquals("d0", res[779].exec("d04"), 2203); +assertEquals("abcd1", res[779].exec("abcd1234"), 2204); +assertEquals(null, res[779].exec("*** Failers", 2205)); +assertEquals(null, res[779].exec("1234 ", 2206)); +assertEquals(null, res[779].exec("e45", 2207)); +assertEquals(null, res[779].exec("abcd ", 2208)); +assertEquals("aX", res[780].exec("aX"), 2209); +assertEquals("aaX", res[780].exec("aaX "), 2210); +assertEquals("a4", res[781].exec("a45"), 2211); +assertEquals("b9", res[781].exec("b93"), 2212); +assertEquals("c9", res[781].exec("c99z"), 2213); +assertEquals("d0", res[781].exec("d04"), 2214); +assertEquals("1", res[781].exec("1234 "), 2215); +assertEquals(null, res[781].exec("*** Failers", 2216)); +assertEquals(null, res[781].exec("abcd1234", 2217)); +assertEquals(null, res[781].exec("e45", 2218)); +assertEquals("ab4", res[782].exec("ab45"), 2219); +assertEquals("bcd9", res[782].exec("bcd93"), 2220); +assertEquals(null, res[782].exec("*** Failers", 2221)); +assertEquals(null, res[782].exec("1234 ", 2222)); +assertEquals(null, res[782].exec("a36 ", 2223)); +assertEquals(null, res[782].exec("abcd1234", 2224)); +assertEquals(null, res[782].exec("ee45", 2225)); +assertEquals("abc4,abc", res[783].exec("abc45"), 2226); +assertEquals("abcabcabc4,abc", res[783].exec("abcabcabc45"), 2227); +assertEquals("4,", res[783].exec("42xyz "), 2228); +assertEquals(null, res[783].exec("*** Failers", 2229)); +assertEquals("abc4,abc", res[784].exec("abc45"), 2230); +assertEquals("abcabcabc4,abc", res[784].exec("abcabcabc45"), 2231); +assertEquals(null, res[784].exec("*** Failers", 2232)); +assertEquals(null, res[784].exec("42xyz ", 2233)); +assertEquals("abc4,abc", res[785].exec("abc45"), 2234); +assertEquals("4,", res[785].exec("42xyz "), 2235); +assertEquals(null, res[785].exec("*** Failers", 2236)); +assertEquals(null, res[785].exec("abcabcabc45", 2237)); +assertEquals("abcabc4,abc", res[786].exec("abcabc45"), 2238); +assertEquals("abcabcabc4,abc", res[786].exec("abcabcabc45"), 2239); +assertEquals(null, res[786].exec("*** Failers", 2240)); +assertEquals(null, res[786].exec("abcabcabcabc45", 2241)); +assertEquals(null, res[786].exec("abc45", 2242)); +assertEquals(null, res[786].exec("42xyz ", 2243)); +assertEquals(null, res[786].exec("1abc2abc3456", 2244)); +assertEquals(null, res[786].exec("1abc2xyz3456 ", 2245)); +assertEquals("ab=ab,ab,ab", res[787].exec("ab=ab"), 2246); +assertEquals("ab=ab,ab,ab", res[787].exec("ab=ab"), 2247); +assertEquals(null, res[787].exec("abc", 2248)); +assertEquals(null, res[787].exec("a(b)c", 2249)); +assertEquals(null, res[787].exec("a(b(c))d ", 2250)); +assertEquals(null, res[787].exec("*** Failers)", 2251)); +assertEquals(null, res[787].exec("a(b(c)d ", 2252)); +assertEquals(null, res[787].exec(">abc>123<xyz<", 2253)); +assertEquals(null, res[787].exec(">abc>1(2)3<xyz<", 2254)); +assertEquals(null, res[787].exec(">abc>(1(2)3)<xyz<", 2255)); +assertEquals(null, res[787].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa9876", 2256)); +assertEquals(null, res[787].exec("*** Failers ", 2257)); +assertEquals(null, res[787].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 2258)); +assertEquals(null, res[787].exec("<>", 2259)); +assertEquals(null, res[787].exec("<abcd>", 2260)); +assertEquals(null, res[787].exec("<abc <123> hij>", 2261)); +assertEquals(null, res[787].exec("<abc <def> hij>", 2262)); +assertEquals(null, res[787].exec("<abc<>def> ", 2263)); +assertEquals(null, res[787].exec("<abc<> ", 2264)); +assertEquals(null, res[787].exec("*** Failers", 2265)); +assertEquals(null, res[787].exec("<abc", 2266)); +assertEquals(null, res[787].exec("abc: ", 2267)); +assertEquals(null, res[787].exec("12 ", 2268)); +assertEquals(null, res[787].exec("*** Failers ", 2269)); +assertEquals(null, res[787].exec("123 ", 2270)); +assertEquals(null, res[787].exec("xyz ", 2271)); +assertEquals(null, res[787].exec(" ", 2272)); +assertEquals(null, res[787].exec("abc: ", 2273)); +assertEquals(null, res[787].exec("12 ", 2274)); +assertEquals(null, res[787].exec("*** Failers", 2275)); +assertEquals(null, res[787].exec("123", 2276)); +assertEquals(null, res[787].exec("xyz ", 2277)); +assertEquals(null, res[788].exec("abcde: ", 2278)); +assertEquals(null, res[788].exec("*** Failers ", 2279)); +assertEquals(null, res[788].exec("abc.. ", 2280)); +assertEquals(null, res[788].exec("123 ", 2281)); +assertEquals(null, res[788].exec("vwxyz ", 2282)); +assertEquals(null, res[788].exec(" ", 2283)); +assertEquals(null, res[789].exec("12 ", 2284)); +assertEquals(null, res[789].exec("*** Failers", 2285)); +assertEquals(null, res[789].exec("abcde:", 2286)); +assertEquals(null, res[789].exec("abc.. ", 2287)); +assertEquals(null, res[789].exec("123", 2288)); +assertEquals(null, res[789].exec("vwxyz ", 2289)); +assertEquals(null, res[789].exec("abc12345", 2290)); +assertEquals(null, res[789].exec("wxy123z", 2291)); +assertEquals(null, res[789].exec("*** Failers", 2292)); +assertEquals(null, res[789].exec("123abc", 2293)); +assertEquals(null, res[789].exec("123abc", 2294)); +assertEquals(null, res[789].exec("mno123456 ", 2295)); +assertEquals(null, res[789].exec("*** Failers", 2296)); +assertEquals(null, res[789].exec("abc12345", 2297)); +assertEquals(null, res[789].exec("wxy123z", 2298)); +assertEquals(null, res[789].exec("abcxyz", 2299)); +assertEquals(null, res[789].exec("123abcxyz999 ", 2300)); +assertEquals("abc", res[791].exec("abcdef"), 2301); +assertEquals(null, res[791].exec("*** Failers", 2302)); +assertEquals("abc", res[791].exec("abcdefB "), 2303); +assertEquals(",", res[792].exec("bcd"), 2304); +assertEquals("aaa,aaa", res[792].exec("aaabcd"), 2305); +assertEquals(",", res[792].exec("xyz"), 2306); +assertEquals(",", res[792].exec("xyzN "), 2307); +assertEquals(",", res[792].exec("*** Failers"), 2308); +assertEquals(",", res[792].exec("bcdN "), 2309); +assertEquals("xyz", res[793].exec("xyz"), 2310); +assertEquals(null, res[793].exec("xyz\n", 2311)); +assertEquals(null, res[793].exec("*** Failers", 2312)); +assertEquals(null, res[793].exec("xyzZ", 2313)); +assertEquals(null, res[793].exec("xyz\nZ ", 2314)); +assertEquals("xyz", res[794].exec("xyz"), 2315); +assertEquals("xyz", res[794].exec("xyz\n "), 2316); +assertEquals("xyz", res[794].exec("abcxyz\npqr "), 2317); +assertEquals("xyz", res[794].exec("abcxyz\npqrZ "), 2318); +assertEquals("xyz", res[794].exec("xyz\nZ "), 2319); +assertEquals(null, res[794].exec("*** Failers", 2320)); +assertEquals(null, res[794].exec("xyzZ", 2321)); +assertEquals(null, res[795].exec("abcdef", 2322)); +assertEquals(null, res[795].exec("defabcxyz>3 ", 2323)); +assertEquals(null, res[795].exec("*** Failers ", 2324)); +assertEquals(null, res[795].exec("defabcxyz", 2325)); +assertEquals(null, res[796].exec("abP", 2326)); +assertEquals(null, res[796].exec("abcdeP", 2327)); +assertEquals("abcdef", res[796].exec("abcdefP"), 2328); +assertEquals(null, res[796].exec("*** Failers", 2329)); +assertEquals(null, res[796].exec("abxP ", 2330)); +assertEquals(null, res[797].exec("aP", 2331)); +assertEquals(null, res[797].exec("aaP", 2332)); +assertEquals(null, res[797].exec("aa2P ", 2333)); +assertEquals(null, res[797].exec("aaaP", 2334)); +assertEquals(null, res[797].exec("aaa23P ", 2335)); +assertEquals(null, res[797].exec("aaaa12345P", 2336)); +assertEquals("aa0z", res[797].exec("aa0zP"), 2337); +assertEquals("aaaa4444444444444z", res[797].exec("aaaa4444444444444zP "), 2338); +assertEquals(null, res[797].exec("*** Failers", 2339)); +assertEquals(null, res[797].exec("azP ", 2340)); +assertEquals(null, res[797].exec("aaaaaP ", 2341)); +assertEquals(null, res[797].exec("a56P ", 2342)); +assertEquals(null, res[799].exec("adfadadaklhlkalkajhlkjahdfasdfasdfladsfjkjPZ", 2343)); +assertEquals(null, res[799].exec("lkjhlkjhlkjhlkjhabbbbbbcdaefabbbbbbbefaPBZ", 2344)); +assertEquals(null, res[799].exec("cdabbbbbbbbPRBZ", 2345)); +assertEquals(null, res[799].exec("efabbbbbbbbbbbbbbbbPRBZ", 2346)); +assertEquals(null, res[799].exec("bbbbbbbbbbbbcdXyasdfadfPRBZ ", 2347)); +assertEquals(null, res[799].exec("abc", 2348)); +assertEquals(null, res[799].exec("** Failers", 2349)); +assertEquals(null, res[799].exec("def ", 2350)); +assertEquals("the quick brown fox", res[800].exec("the quick brown fox"), 2351); +assertEquals(null, res[800].exec("The quick brown FOX", 2352)); +assertEquals("the quick brown fox", res[800].exec("What do you know about the quick brown fox?"), 2353); +assertEquals(null, res[800].exec("What do you know about THE QUICK BROWN FOX?", 2354)); +assertEquals("the quick brown fox", res[801].exec("the quick brown fox"), 2355); +assertEquals("The quick brown FOX", res[801].exec("The quick brown FOX"), 2356); +assertEquals("the quick brown fox", res[801].exec("What do you know about the quick brown fox?"), 2357); +assertEquals("THE QUICK BROWN FOX", res[801].exec("What do you know about THE QUICK BROWN FOX?"), 2358); +assertEquals("abcd\x09\n\x0d\x0cae9;$\\?caxyz", res[802].exec("abcd\x09\n\x0d\x0cae9;$\\?caxyz"), 2359); +assertEquals("abxyzpqrrrabbxyyyypqAzz", res[803].exec("abxyzpqrrrabbxyyyypqAzz"), 2360); +assertEquals("abxyzpqrrrabbxyyyypqAzz", res[803].exec("abxyzpqrrrabbxyyyypqAzz"), 2361); +assertEquals("aabxyzpqrrrabbxyyyypqAzz", res[803].exec("aabxyzpqrrrabbxyyyypqAzz"), 2362); +assertEquals("aaabxyzpqrrrabbxyyyypqAzz", res[803].exec("aaabxyzpqrrrabbxyyyypqAzz"), 2363); +assertEquals("aaaabxyzpqrrrabbxyyyypqAzz", res[803].exec("aaaabxyzpqrrrabbxyyyypqAzz"), 2364); +assertEquals("abcxyzpqrrrabbxyyyypqAzz", res[803].exec("abcxyzpqrrrabbxyyyypqAzz"), 2365); +assertEquals("aabcxyzpqrrrabbxyyyypqAzz", res[803].exec("aabcxyzpqrrrabbxyyyypqAzz"), 2366); +assertEquals("aaabcxyzpqrrrabbxyyyypAzz", res[803].exec("aaabcxyzpqrrrabbxyyyypAzz"), 2367); +assertEquals("aaabcxyzpqrrrabbxyyyypqAzz", res[803].exec("aaabcxyzpqrrrabbxyyyypqAzz"), 2368); +assertEquals("aaabcxyzpqrrrabbxyyyypqqAzz", res[803].exec("aaabcxyzpqrrrabbxyyyypqqAzz"), 2369); +assertEquals("aaabcxyzpqrrrabbxyyyypqqqAzz", res[803].exec("aaabcxyzpqrrrabbxyyyypqqqAzz"), 2370); +assertEquals("aaabcxyzpqrrrabbxyyyypqqqqAzz", res[803].exec("aaabcxyzpqrrrabbxyyyypqqqqAzz"), 2371); +assertEquals("aaabcxyzpqrrrabbxyyyypqqqqqAzz", res[803].exec("aaabcxyzpqrrrabbxyyyypqqqqqAzz"), 2372); +assertEquals("aaabcxyzpqrrrabbxyyyypqqqqqqAzz", res[803].exec("aaabcxyzpqrrrabbxyyyypqqqqqqAzz"), 2373); +assertEquals("aaaabcxyzpqrrrabbxyyyypqAzz", res[803].exec("aaaabcxyzpqrrrabbxyyyypqAzz"), 2374); +assertEquals("abxyzzpqrrrabbxyyyypqAzz", res[803].exec("abxyzzpqrrrabbxyyyypqAzz"), 2375); +assertEquals("aabxyzzzpqrrrabbxyyyypqAzz", res[803].exec("aabxyzzzpqrrrabbxyyyypqAzz"), 2376); +assertEquals("aaabxyzzzzpqrrrabbxyyyypqAzz", res[803].exec("aaabxyzzzzpqrrrabbxyyyypqAzz"), 2377); +assertEquals("aaaabxyzzzzpqrrrabbxyyyypqAzz", res[803].exec("aaaabxyzzzzpqrrrabbxyyyypqAzz"), 2378); +assertEquals("abcxyzzpqrrrabbxyyyypqAzz", res[803].exec("abcxyzzpqrrrabbxyyyypqAzz"), 2379); +assertEquals("aabcxyzzzpqrrrabbxyyyypqAzz", res[803].exec("aabcxyzzzpqrrrabbxyyyypqAzz"), 2380); +assertEquals("aaabcxyzzzzpqrrrabbxyyyypqAzz", res[803].exec("aaabcxyzzzzpqrrrabbxyyyypqAzz"), 2381); +assertEquals("aaaabcxyzzzzpqrrrabbxyyyypqAzz", res[803].exec("aaaabcxyzzzzpqrrrabbxyyyypqAzz"), 2382); +assertEquals("aaaabcxyzzzzpqrrrabbbxyyyypqAzz", res[803].exec("aaaabcxyzzzzpqrrrabbbxyyyypqAzz"), 2383); +assertEquals("aaaabcxyzzzzpqrrrabbbxyyyyypqAzz", res[803].exec("aaaabcxyzzzzpqrrrabbbxyyyyypqAzz"), 2384); +assertEquals("aaabcxyzpqrrrabbxyyyypABzz", res[803].exec("aaabcxyzpqrrrabbxyyyypABzz"), 2385); +assertEquals("aaabcxyzpqrrrabbxyyyypABBzz", res[803].exec("aaabcxyzpqrrrabbxyyyypABBzz"), 2386); +assertEquals("aaabxyzpqrrrabbxyyyypqAzz", res[803].exec(">>>aaabxyzpqrrrabbxyyyypqAzz"), 2387); +assertEquals("aaaabxyzpqrrrabbxyyyypqAzz", res[803].exec(">aaaabxyzpqrrrabbxyyyypqAzz"), 2388); +assertEquals("abcxyzpqrrrabbxyyyypqAzz", res[803].exec(">>>>abcxyzpqrrrabbxyyyypqAzz"), 2389); +assertEquals(null, res[803].exec("*** Failers", 2390)); +assertEquals(null, res[803].exec("abxyzpqrrabbxyyyypqAzz", 2391)); +assertEquals(null, res[803].exec("abxyzpqrrrrabbxyyyypqAzz", 2392)); +assertEquals(null, res[803].exec("abxyzpqrrrabxyyyypqAzz", 2393)); +assertEquals(null, res[803].exec("aaaabcxyzzzzpqrrrabbbxyyyyyypqAzz", 2394)); +assertEquals(null, res[803].exec("aaaabcxyzzzzpqrrrabbbxyyypqAzz", 2395)); +assertEquals(null, res[803].exec("aaabcxyzpqrrrabbxyyyypqqqqqqqAzz", 2396)); +assertEquals("abczz,abc", res[804].exec("abczz"), 2397); +assertEquals("abcabczz,abc", res[804].exec("abcabczz"), 2398); +assertEquals(null, res[804].exec("*** Failers", 2399)); +assertEquals(null, res[804].exec("zz", 2400)); +assertEquals(null, res[804].exec("abcabcabczz", 2401)); +assertEquals(null, res[804].exec(">>abczz", 2402)); +assertEquals("bc,b", res[805].exec("bc"), 2403); +assertEquals("bbc,b", res[805].exec("bbc"), 2404); +assertEquals("bbbc,bb", res[805].exec("bbbc"), 2405); +assertEquals("bac,a", res[805].exec("bac"), 2406); +assertEquals("bbac,a", res[805].exec("bbac"), 2407); +assertEquals("aac,a", res[805].exec("aac"), 2408); +assertEquals("abbbbbbbbbbbc,bbbbbbbbbbb", res[805].exec("abbbbbbbbbbbc"), 2409); +assertEquals("bbbbbbbbbbbac,a", res[805].exec("bbbbbbbbbbbac"), 2410); +assertEquals(null, res[805].exec("*** Failers", 2411)); +assertEquals(null, res[805].exec("aaac", 2412)); +assertEquals(null, res[805].exec("abbbbbbbbbbbac", 2413)); +assertEquals("bc,b", res[806].exec("bc"), 2414); +assertEquals("bbc,bb", res[806].exec("bbc"), 2415); +assertEquals("bbbc,bbb", res[806].exec("bbbc"), 2416); +assertEquals("bac,a", res[806].exec("bac"), 2417); +assertEquals("bbac,a", res[806].exec("bbac"), 2418); +assertEquals("aac,a", res[806].exec("aac"), 2419); +assertEquals("abbbbbbbbbbbc,bbbbbbbbbbb", res[806].exec("abbbbbbbbbbbc"), 2420); +assertEquals("bbbbbbbbbbbac,a", res[806].exec("bbbbbbbbbbbac"), 2421); +assertEquals(null, res[806].exec("*** Failers", 2422)); +assertEquals(null, res[806].exec("aaac", 2423)); +assertEquals(null, res[806].exec("abbbbbbbbbbbac", 2424)); +assertEquals("bbc,bb", res[806].exec("bbc"), 2425); +assertEquals("babc,ba", res[807].exec("babc"), 2426); +assertEquals("bbabc,ba", res[807].exec("bbabc"), 2427); +assertEquals("bababc,ba", res[807].exec("bababc"), 2428); +assertEquals(null, res[807].exec("*** Failers", 2429)); +assertEquals(null, res[807].exec("bababbc", 2430)); +assertEquals(null, res[807].exec("babababc", 2431)); +assertEquals("babc,ba", res[808].exec("babc"), 2432); +assertEquals("bbabc,ba", res[808].exec("bbabc"), 2433); +assertEquals("bababc,ba", res[808].exec("bababc"), 2434); +assertEquals(null, res[808].exec("*** Failers", 2435)); +assertEquals(null, res[808].exec("bababbc", 2436)); +assertEquals(null, res[808].exec("babababc", 2437)); +assertThrows("var re = /^\\ca\\cA\\c[\\c{\\c:/;", 2438); +assertEquals(null, res[808].exec("\x01\x01e;z", 2439)); +assertEquals("a", res[809].exec("athing"), 2440); +assertEquals("b", res[809].exec("bthing"), 2441); +assertEquals("]", res[809].exec("]thing"), 2442); +assertEquals("c", res[809].exec("cthing"), 2443); +assertEquals("d", res[809].exec("dthing"), 2444); +assertEquals("e", res[809].exec("ething"), 2445); +assertEquals(null, res[809].exec("*** Failers", 2446)); +assertEquals(null, res[809].exec("fthing", 2447)); +assertEquals(null, res[809].exec("[thing", 2448)); +assertEquals(null, res[809].exec("\\thing", 2449)); +assertEquals(null, res[810].exec("]thing", 2450)); +assertEquals(null, res[810].exec("cthing", 2451)); +assertEquals(null, res[810].exec("dthing", 2452)); +assertEquals(null, res[810].exec("ething", 2453)); +assertEquals(null, res[810].exec("*** Failers", 2454)); +assertEquals(null, res[810].exec("athing", 2455)); +assertEquals(null, res[810].exec("fthing", 2456)); +assertEquals("f", res[811].exec("fthing"), 2457); +assertEquals("[", res[811].exec("[thing"), 2458); +assertEquals("\\", res[811].exec("\\thing"), 2459); +assertEquals("*", res[811].exec("*** Failers"), 2460); +assertEquals(null, res[811].exec("athing", 2461)); +assertEquals(null, res[811].exec("bthing", 2462)); +assertEquals(null, res[811].exec("]thing", 2463)); +assertEquals(null, res[811].exec("cthing", 2464)); +assertEquals(null, res[811].exec("dthing", 2465)); +assertEquals(null, res[811].exec("ething", 2466)); +assertEquals(null, res[812].exec("athing", 2467)); +assertEquals(null, res[812].exec("fthing", 2468)); +assertEquals(null, res[812].exec("*** Failers", 2469)); +assertEquals(null, res[812].exec("]thing", 2470)); +assertEquals(null, res[812].exec("cthing", 2471)); +assertEquals(null, res[812].exec("dthing", 2472)); +assertEquals(null, res[812].exec("ething", 2473)); +assertEquals(null, res[812].exec("\ufffd", 2474)); +assertEquals(null, res[812].exec("\ufffd", 2475)); +assertEquals("0", res[813].exec("0"), 2476); +assertEquals("1", res[813].exec("1"), 2477); +assertEquals("2", res[813].exec("2"), 2478); +assertEquals("3", res[813].exec("3"), 2479); +assertEquals("4", res[813].exec("4"), 2480); +assertEquals("5", res[813].exec("5"), 2481); +assertEquals("6", res[813].exec("6"), 2482); +assertEquals("7", res[813].exec("7"), 2483); +assertEquals("8", res[813].exec("8"), 2484); +assertEquals("9", res[813].exec("9"), 2485); +assertEquals("10", res[813].exec("10"), 2486); +assertEquals("100", res[813].exec("100"), 2487); +assertEquals(null, res[813].exec("*** Failers", 2488)); +assertEquals(null, res[813].exec("abc", 2489)); +assertEquals("enter", res[814].exec("enter"), 2490); +assertEquals("inter", res[814].exec("inter"), 2491); +assertEquals("uponter", res[814].exec("uponter"), 2492); +assertEquals("xxx0", res[815].exec("xxx0"), 2493); +assertEquals("xxx1234", res[815].exec("xxx1234"), 2494); +assertEquals(null, res[815].exec("*** Failers", 2495)); +assertEquals(null, res[815].exec("xxx", 2496)); +assertEquals("x123", res[816].exec("x123"), 2497); +assertEquals("xx123", res[816].exec("xx123"), 2498); +assertEquals("123456", res[816].exec("123456"), 2499); +assertEquals(null, res[816].exec("*** Failers", 2500)); +assertEquals(null, res[816].exec("123", 2501)); +assertEquals("x1234", res[816].exec("x1234"), 2502); +assertEquals("x123", res[817].exec("x123"), 2503); +assertEquals("xx123", res[817].exec("xx123"), 2504); +assertEquals("123456", res[817].exec("123456"), 2505); +assertEquals(null, res[817].exec("*** Failers", 2506)); +assertEquals(null, res[817].exec("123", 2507)); +assertEquals("x1234", res[817].exec("x1234"), 2508); +assertEquals("abc!pqr=apquxz.ixr.zzz.ac.uk,abc,pqr", res[818].exec("abc!pqr=apquxz.ixr.zzz.ac.uk"), 2509); +assertEquals(null, res[818].exec("*** Failers", 2510)); +assertEquals(null, res[818].exec("!pqr=apquxz.ixr.zzz.ac.uk", 2511)); +assertEquals(null, res[818].exec("abc!=apquxz.ixr.zzz.ac.uk", 2512)); +assertEquals(null, res[818].exec("abc!pqr=apquxz:ixr.zzz.ac.uk", 2513)); +assertEquals(null, res[818].exec("abc!pqr=apquxz.ixr.zzz.ac.ukk", 2514)); +assertEquals(":", res[819].exec("Well, we need a colon: somewhere"), 2515); +assertEquals(null, res[819].exec("*** Fail if we don't", 2516)); +assertEquals("0abc,0abc", res[820].exec("0abc"), 2517); +assertEquals("abc,abc", res[820].exec("abc"), 2518); +assertEquals("fed,fed", res[820].exec("fed"), 2519); +assertEquals("E,E", res[820].exec("E"), 2520); +assertEquals("::,::", res[820].exec("::"), 2521); +assertEquals("5f03:12C0::932e,5f03:12C0::932e", res[820].exec("5f03:12C0::932e"), 2522); +assertEquals("def,def", res[820].exec("fed def"), 2523); +assertEquals("ff,ff", res[820].exec("Any old stuff"), 2524); +assertEquals(null, res[820].exec("*** Failers", 2525)); +assertEquals(null, res[820].exec("0zzz", 2526)); +assertEquals(null, res[820].exec("gzzz", 2527)); +assertEquals(null, res[820].exec("fed ", 2528)); +assertEquals(null, res[820].exec("Any old rubbish", 2529)); +assertEquals(".1.2.3,1,2,3", res[821].exec(".1.2.3"), 2530); +assertEquals("A.12.123.0,12,123,0", res[821].exec("A.12.123.0"), 2531); +assertEquals(null, res[821].exec("*** Failers", 2532)); +assertEquals(null, res[821].exec(".1.2.3333", 2533)); +assertEquals(null, res[821].exec("1.2.3", 2534)); +assertEquals(null, res[821].exec("1234.2.3", 2535)); +assertEquals("1 IN SOA non-sp1 non-sp2(,1,non-sp1,non-sp2", res[822].exec("1 IN SOA non-sp1 non-sp2("), 2536); +assertEquals("1 IN SOA non-sp1 non-sp2 (,1,non-sp1,non-sp2", res[822].exec("1 IN SOA non-sp1 non-sp2 ("), 2537); +assertEquals(null, res[822].exec("*** Failers", 2538)); +assertEquals(null, res[822].exec("1IN SOA non-sp1 non-sp2(", 2539)); +assertEquals("a.,", res[823].exec("a."), 2540); +assertEquals("Z.,", res[823].exec("Z."), 2541); +assertEquals("2.,", res[823].exec("2."), 2542); +assertEquals("ab-c.pq-r.,.pq-r", res[823].exec("ab-c.pq-r."), 2543); +assertEquals("sxk.zzz.ac.uk.,.uk", res[823].exec("sxk.zzz.ac.uk."), 2544); +assertEquals("x-.y-.,.y-", res[823].exec("x-.y-."), 2545); +assertEquals(null, res[823].exec("*** Failers", 2546)); +assertEquals(null, res[823].exec("-abc.peq.", 2547)); +assertEquals("*.a,,,", res[824].exec("*.a"), 2548); +assertEquals("*.b0-a,0-a,,", res[824].exec("*.b0-a"), 2549); +assertEquals("*.c3-b.c,3-b,.c,", res[824].exec("*.c3-b.c"), 2550); +assertEquals("*.c-a.b-c,-a,.b-c,-c", res[824].exec("*.c-a.b-c"), 2551); +assertEquals(null, res[824].exec("*** Failers", 2552)); +assertEquals(null, res[824].exec("*.0", 2553)); +assertEquals(null, res[824].exec("*.a-", 2554)); +assertEquals(null, res[824].exec("*.a-b.c-", 2555)); +assertEquals(null, res[824].exec("*.c-a.0-c", 2556)); +assertEquals("abde,de,abd,e", res[825].exec("abde"), 2557); +assertEquals("abdf,,abd,f", res[826].exec("abdf"), 2558); +assertEquals("ab,abcd,cd,ab", res[827].exec("abcd"), 2559); +assertEquals("a.b.c.d,.d", res[828].exec("a.b.c.d"), 2560); +assertEquals("A.B.C.D,.D", res[828].exec("A.B.C.D"), 2561); +assertEquals("a.b.c.1.2.3.C,.C", res[828].exec("a.b.c.1.2.3.C"), 2562); +assertEquals("\"1234\",", res[829].exec("\"1234\""), 2563); +assertEquals("\"abcd\" ;,;", res[829].exec("\"abcd\" ;"), 2564); +assertEquals("\"\" ; rhubarb,; rhubarb", res[829].exec("\"\" ; rhubarb"), 2565); +assertEquals(null, res[829].exec("*** Failers", 2566)); +assertEquals(null, res[829].exec("\"1234\" : things", 2567)); +assertEquals(null, res[830].exec("\\", 2568)); +assertEquals(null, res[830].exec("*** Failers", 2569)); +assertEquals("ab c", res[831].exec("ab c"), 2570); +assertEquals(null, res[831].exec("*** Failers", 2571)); +assertEquals(null, res[831].exec("abc", 2572)); +assertEquals(null, res[831].exec("ab cde", 2573)); +assertEquals("ab c", res[831].exec("ab c"), 2574); +assertEquals(null, res[831].exec("*** Failers", 2575)); +assertEquals(null, res[831].exec("abc", 2576)); +assertEquals(null, res[831].exec("ab cde", 2577)); +assertEquals("a bcd", res[832].exec("a bcd"), 2578); +assertEquals(null, res[832].exec("a b d", 2579)); +assertEquals(null, res[832].exec("*** Failers", 2580)); +assertEquals(null, res[832].exec("abcd", 2581)); +assertEquals(null, res[832].exec("ab d", 2582)); +assertEquals("abcdefhijklm,abc,bc,c,def,ef,f,hij,ij,j,klm,lm,m", res[833].exec("abcdefhijklm"), 2583); +assertEquals("abcdefhijklm,bc,c,ef,f,ij,j,lm,m", res[834].exec("abcdefhijklm"), 2584); +assertEquals(null, res[835].exec("a+ Z0+\x08\n\x1d\x12", 2585)); +assertEquals(null, res[835].exec(".^$(*+)|{?,?}", 2586)); +assertEquals("z", res[836].exec("z"), 2587); +assertEquals("az", res[836].exec("az"), 2588); +assertEquals("aaaz", res[836].exec("aaaz"), 2589); +assertEquals("a", res[836].exec("a"), 2590); +assertEquals("aa", res[836].exec("aa"), 2591); +assertEquals("aaaa", res[836].exec("aaaa"), 2592); +assertEquals("a", res[836].exec("a+"), 2593); +assertEquals("aa", res[836].exec("aa+"), 2594); +assertEquals("z", res[837].exec("z"), 2595); +assertEquals("a", res[837].exec("az"), 2596); +assertEquals("a", res[837].exec("aaaz"), 2597); +assertEquals("a", res[837].exec("a"), 2598); +assertEquals("a", res[837].exec("aa"), 2599); +assertEquals("a", res[837].exec("aaaa"), 2600); +assertEquals("a", res[837].exec("a+"), 2601); +assertEquals("a", res[837].exec("aa+"), 2602); +assertEquals("az", res[838].exec("az"), 2603); +assertEquals("aaaz", res[838].exec("aaaz"), 2604); +assertEquals("aa", res[838].exec("aa"), 2605); +assertEquals("aaaa", res[838].exec("aaaa"), 2606); +assertEquals("aa", res[838].exec("aa+"), 2607); +assertEquals("az", res[839].exec("az"), 2608); +assertEquals("aa", res[839].exec("aaaz"), 2609); +assertEquals("aa", res[839].exec("aa"), 2610); +assertEquals("aa", res[839].exec("aaaa"), 2611); +assertEquals("aa", res[839].exec("aa+"), 2612); +assertEquals("1234567890", res[840].exec("1234567890"), 2613); +assertEquals("12345678ab", res[840].exec("12345678ab"), 2614); +assertEquals("12345678__", res[840].exec("12345678__"), 2615); +assertEquals(null, res[840].exec("*** Failers", 2616)); +assertEquals(null, res[840].exec("1234567", 2617)); +assertEquals("uoie", res[841].exec("uoie"), 2618); +assertEquals("1234", res[841].exec("1234"), 2619); +assertEquals("12345", res[841].exec("12345"), 2620); +assertEquals("aaaaa", res[841].exec("aaaaa"), 2621); +assertEquals(null, res[841].exec("*** Failers", 2622)); +assertEquals(null, res[841].exec("123456", 2623)); +assertEquals("uoie", res[842].exec("uoie"), 2624); +assertEquals("1234", res[842].exec("1234"), 2625); +assertEquals("1234", res[842].exec("12345"), 2626); +assertEquals("aaaa", res[842].exec("aaaaa"), 2627); +assertEquals("1234", res[842].exec("123456"), 2628); +assertEquals("From abcd Mon Sep 01 12:33,abcd", res[843].exec("From abcd Mon Sep 01 12:33:02 1997"), 2629); +assertEquals("From abcd Mon Sep 01 12:33,Sep ", res[844].exec("From abcd Mon Sep 01 12:33:02 1997"), 2630); +assertEquals("From abcd Mon Sep 1 12:33,Sep ", res[844].exec("From abcd Mon Sep 1 12:33:02 1997"), 2631); +assertEquals(null, res[844].exec("*** Failers", 2632)); +assertEquals(null, res[844].exec("From abcd Sep 01 12:33:02 1997", 2633)); +assertEquals(null, res[845].exec("12\n34", 2634)); +assertEquals(null, res[845].exec("12\x0d34", 2635)); +assertEquals("brown", res[846].exec("the quick brown\x09 fox"), 2636); +assertEquals("foolish see?,lish see?", res[847].exec("foobar is foolish see?"), 2637); +assertEquals("rowbar etc, etc", res[848].exec("foobar crowbar etc"), 2638); +assertEquals("barrel,rel", res[848].exec("barrel"), 2639); +assertEquals("2barrel,rel", res[848].exec("2barrel"), 2640); +assertEquals("A barrel,rel", res[848].exec("A barrel"), 2641); +assertEquals("abc,abc", res[849].exec("abc456"), 2642); +assertEquals(null, res[849].exec("*** Failers", 2643)); +assertEquals(null, res[849].exec("abc123", 2644)); +assertEquals("1234", res[850].exec("1234"), 2645); +assertEquals("1234", res[851].exec("1234"), 2646); +assertEquals("abcd", res[852].exec("abcd"), 2647); +assertEquals("abcd", res[853].exec("abcd"), 2648); +assertEquals("abc", res[854].exec("the abc"), 2649); +assertEquals(null, res[854].exec("*** Failers", 2650)); +assertEquals(null, res[854].exec("abc", 2651)); +assertEquals("abc", res[855].exec("abc"), 2652); +assertEquals(null, res[855].exec("*** Failers", 2653)); +assertEquals(null, res[855].exec("the abc", 2654)); +assertEquals("aabb,b", res[856].exec("aabbbbb"), 2655); +assertEquals("aabbbbb,abbbbb", res[857].exec("aabbbbb"), 2656); +assertEquals("aa,a", res[858].exec("aabbbbb"), 2657); +assertEquals("aabb,b", res[859].exec("aabbbbb"), 2658); +assertEquals("Alan Other <user@dom.ain>", res[860].exec("Alan Other <user@dom.ain>"), 2659); +assertEquals("user@dom.ain", res[860].exec("<user@dom.ain>"), 2660); +assertEquals("user@dom.ain", res[860].exec("user@dom.ain"), 2661); +assertEquals("\"A. Other\" <user.1234@dom.ain> (a comment)", res[860].exec("\"A. Other\" <user.1234@dom.ain> (a comment)"), 2662); +assertEquals(" Other <user.1234@dom.ain> (a comment)", res[860].exec("A. Other <user.1234@dom.ain> (a comment)"), 2663); +assertEquals("\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay", res[860].exec("\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay"), 2664); +assertEquals("user@some.where", res[860].exec("A missing angle <user@some.where"), 2665); +assertEquals(null, res[860].exec("*** Failers", 2666)); +assertEquals(null, res[860].exec("The quick brown fox", 2667)); +assertEquals("Alan Other <user@dom.ain>", res[861].exec("Alan Other <user@dom.ain>"), 2668); +assertEquals("user@dom.ain", res[861].exec("<user@dom.ain>"), 2669); +assertEquals("user@dom.ain", res[861].exec("user@dom.ain"), 2670); +assertEquals("\"A. Other\" <user.1234@dom.ain>", res[861].exec("\"A. Other\" <user.1234@dom.ain> (a comment)"), 2671); +assertEquals(" Other <user.1234@dom.ain>", res[861].exec("A. Other <user.1234@dom.ain> (a comment)"), 2672); +assertEquals("\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay", res[861].exec("\"/s=user/ou=host/o=place/prmd=uu.yy/admd= /c=gb/\"@x400-re.lay"), 2673); +assertEquals("user@some.where", res[861].exec("A missing angle <user@some.where"), 2674); +assertEquals(null, res[861].exec("*** Failers", 2675)); +assertEquals(null, res[861].exec("The quick brown fox", 2676)); +assertEquals(null, res[861].exec("abc\x00def\x00pqr\x00xyz\x000AB", 2677)); +assertEquals(null, res[861].exec("abc456 abc\x00def\x00pqr\x00xyz\x000ABCDE", 2678)); +assertEquals("abc\x0def\x00pqr\x000xyz\x0000AB", res[862].exec("abc\x0def\x00pqr\x000xyz\x0000AB"), 2679); +assertEquals("abc\x0def\x00pqr\x000xyz\x0000AB", res[862].exec("abc456 abc\x0def\x00pqr\x000xyz\x0000ABCDE"), 2680); +assertEquals("\x00", res[863].exec("\x00A"), 2681); +assertEquals("\x01", res[863].exec("\x01B"), 2682); +assertEquals("\x1f", res[863].exec("\x1fC"), 2683); +assertEquals("\x00\x00\x00\x00", res[864].exec("\x00\x00\x00\x00"), 2684); +assertEquals(null, res[865].exec("The Ax0x0Z", 2685)); +assertEquals(null, res[865].exec("An A\x00x0\x00Z", 2686)); +assertEquals(null, res[865].exec("*** Failers", 2687)); +assertEquals(null, res[865].exec("A\x00Z", 2688)); +assertEquals(null, res[865].exec("A\x00x0\x00x0Z", 2689)); +assertEquals(" ", res[866].exec(" abc"), 2690); +assertEquals("\x0c", res[866].exec("\x0cabc"), 2691); +assertEquals("\n", res[866].exec("\nabc"), 2692); +assertEquals("\x0d", res[866].exec("\x0dabc"), 2693); +assertEquals("\x09", res[866].exec("\x09abc"), 2694); +assertEquals(null, res[866].exec("*** Failers", 2695)); +assertEquals(null, res[866].exec("abc", 2696)); +assertEquals("abc", res[867].exec("abc"), 2697); +assertEquals("abbbbc", res[868].exec("abbbbc"), 2698); +assertEquals("abbbc", res[868].exec("abbbc"), 2699); +assertEquals("abbc", res[868].exec("abbc"), 2700); +assertEquals(null, res[868].exec("*** Failers", 2701)); +assertEquals(null, res[868].exec("abc", 2702)); +assertEquals(null, res[868].exec("abbbbbc", 2703)); +assertEquals("track1.title:TBlah blah blah,track1,title,Blah blah blah", res[869].exec("track1.title:TBlah blah blah"), 2704); +assertEquals("track1.title:TBlah blah blah,track1,title,Blah blah blah", res[870].exec("track1.title:TBlah blah blah"), 2705); +assertEquals("track1.title:TBlah blah blah,track1,title,Blah blah blah", res[871].exec("track1.title:TBlah blah blah"), 2706); +assertEquals("WXY_^abc", res[872].exec("WXY_^abc"), 2707); +assertEquals(null, res[872].exec("*** Failers", 2708)); +assertEquals(null, res[872].exec("wxy", 2709)); +assertEquals("WXY_^abc", res[873].exec("WXY_^abc"), 2710); +assertEquals("wxy_^ABC", res[873].exec("wxy_^ABC"), 2711); +assertEquals("WXY_^abc", res[874].exec("WXY_^abc"), 2712); +assertEquals("wxy_^ABC", res[874].exec("wxy_^ABC"), 2713); +assertEquals("abc", res[875].exec("abc"), 2714); +assertEquals("abc", res[875].exec("qqq\nabc"), 2715); +assertEquals("abc", res[875].exec("abc\nzzz"), 2716); +assertEquals("abc", res[875].exec("qqq\nabc\nzzz"), 2717); +assertEquals("abc", res[876].exec("abc"), 2718); +assertEquals(null, res[876].exec("*** Failers", 2719)); +assertEquals(null, res[876].exec("qqq\nabc", 2720)); +assertEquals(null, res[876].exec("abc\nzzz", 2721)); +assertEquals(null, res[876].exec("qqq\nabc\nzzz", 2722)); +assertEquals(null, res[877].exec("abc", 2723)); +assertEquals(null, res[877].exec("abc\n ", 2724)); +assertEquals(null, res[877].exec("*** Failers", 2725)); +assertEquals(null, res[877].exec("qqq\nabc", 2726)); +assertEquals(null, res[877].exec("abc\nzzz", 2727)); +assertEquals(null, res[877].exec("qqq\nabc\nzzz", 2728)); +assertEquals(null, res[878].exec("abc\ndef", 2729)); +assertEquals(null, res[879].exec("*** Failers", 2730)); +assertEquals(null, res[879].exec("abc\ndef", 2731)); +assertEquals("b", res[880].exec("b::c"), 2732); +assertEquals("::", res[880].exec("c::b"), 2733); +assertEquals("az-", res[881].exec("az-"), 2734); +assertEquals("a", res[881].exec("*** Failers"), 2735); +assertEquals(null, res[881].exec("b", 2736)); +assertEquals("za-", res[882].exec("za-"), 2737); +assertEquals("a", res[882].exec("*** Failers"), 2738); +assertEquals(null, res[882].exec("b", 2739)); +assertEquals("a-z", res[883].exec("a-z"), 2740); +assertEquals("a", res[883].exec("*** Failers"), 2741); +assertEquals(null, res[883].exec("b", 2742)); +assertEquals("abcdxyz", res[884].exec("abcdxyz"), 2743); +assertEquals("12-34", res[885].exec("12-34"), 2744); +assertEquals(null, res[885].exec("*** Failers", 2745)); +assertEquals(null, res[885].exec("aaa", 2746)); +assertEquals("12-34z", res[886].exec("12-34z"), 2747); +assertEquals(null, res[886].exec("*** Failers", 2748)); +assertEquals(null, res[886].exec("aaa", 2749)); +assertEquals("\\", res[887].exec("\\\\"), 2750); +assertEquals(" Z", res[888].exec("the Zoo"), 2751); +assertEquals(null, res[888].exec("*** Failers", 2752)); +assertEquals(null, res[888].exec("Zulu", 2753)); +assertEquals("ab{3cd", res[889].exec("ab{3cd"), 2754); +assertEquals("ab{3,cd", res[890].exec("ab{3,cd"), 2755); +assertEquals("ab{3,4a}cd", res[891].exec("ab{3,4a}cd"), 2756); +assertEquals("{4,5a}bc", res[892].exec("{4,5a}bc"), 2757); +assertEquals(null, res[893].exec("a\x0db", 2758)); +assertEquals(null, res[893].exec("*** Failers", 2759)); +assertEquals(null, res[893].exec("a\nb", 2760)); +assertEquals("abc", res[894].exec("abc"), 2761); +assertEquals(null, res[894].exec("abc\n", 2762)); +assertEquals(null, res[894].exec("*** Failers", 2763)); +assertEquals(null, res[894].exec("abc\ndef", 2764)); +assertEquals("abcS,abc", res[895].exec("abcS"), 2765); +assertEquals("abc\x93,abc", res[896].exec("abc\x93"), 2766); +assertEquals("abc\xd3,abc", res[897].exec("abc\xd3"), 2767); +assertEquals("abc@,abc", res[898].exec("abc@"), 2768); +assertEquals("abc@,abc", res[898].exec("abc@"), 2769); +assertEquals("abc@,abc", res[898].exec("abc@0"), 2770); +assertEquals("abc@,abc", res[898].exec("abc@0"), 2771); +assertEquals("abc@,abc", res[898].exec("abc@0"), 2772); +assertEquals("abc@,abc", res[898].exec("abc@0"), 2773); +assertEquals("abc@,abc", res[898].exec("abc@0"), 2774); +assertEquals("abc@,abc", res[898].exec("abc@0"), 2775); +assertEquals(null, res[899].exec("abc\x0081", 2776)); +assertEquals(null, res[899].exec("abc\x0081", 2777)); +assertEquals(null, res[900].exec("abc\x0091", 2778)); +assertEquals(null, res[900].exec("abc\x0091", 2779)); +assertEquals("abcdefghijk\nS,a,b,c,d,e,f,g,h,i,j,k", res[901].exec("abcdefghijk\nS"), 2780); +assertEquals("abidef", res[902].exec("abidef"), 2781); +assertEquals("bc", res[903].exec("bc"), 2782); +assertEquals("xyz,,", res[904].exec("xyz"), 2783); +assertEquals("abc\x08de", res[905].exec("abc\x08de"), 2784); +assertEquals("abc\x01de", res[906].exec("abc\x01de"), 2785); +assertEquals("abc\x01de,abc", res[907].exec("abc\x01de"), 2786); +assertEquals(null, res[907].exec("a\nb", 2787)); +assertEquals("baNOTcccc,b,a,NOT,cccc", res[908].exec("baNOTccccd"), 2788); +assertEquals("baNOTccc,b,a,NOT,ccc", res[908].exec("baNOTcccd"), 2789); +assertEquals("baNOTcc,b,a,NO,Tcc", res[908].exec("baNOTccd"), 2790); +assertEquals("baccc,b,a,,ccc", res[908].exec("bacccd"), 2791); +assertEquals("*** Failers,*,*,* Fail,ers", res[908].exec("*** Failers"), 2792); +assertEquals(null, res[908].exec("anything", 2793)); +assertEquals(null, res[908].exec("b\x08c ", 2794)); +assertEquals(null, res[908].exec("baccd", 2795)); +assertEquals("A", res[909].exec("Abc"), 2796); +assertEquals("b", res[910].exec("Abc "), 2797); +assertEquals("AAA", res[911].exec("AAAaAbc"), 2798); +assertEquals("bc ", res[912].exec("AAAaAbc "), 2799); +assertEquals("bbb\nccc", res[913].exec("bbb\nccc"), 2800); +assertEquals("c", res[914].exec("abc"), 2801); +assertEquals("s", res[914].exec("*** Failers"), 2802); +assertEquals(" ", res[914].exec("abk "), 2803); +assertEquals("abc", res[915].exec("abc"), 2804); +assertEquals("bc", res[915].exec("kbc"), 2805); +assertEquals("bc ", res[915].exec("kabc "), 2806); +assertEquals("ers", res[915].exec("*** Failers"), 2807); +assertEquals(null, res[915].exec("abk", 2808)); +assertEquals(null, res[915].exec("akb", 2809)); +assertEquals(null, res[915].exec("akk ", 2810)); +assertEquals("12345678@a.b.c.d", res[916].exec("12345678@a.b.c.d"), 2811); +assertEquals("123456789@x.y.z", res[916].exec("123456789@x.y.z"), 2812); +assertEquals(null, res[916].exec("*** Failers", 2813)); +assertEquals(null, res[916].exec("12345678@x.y.uk", 2814)); +assertEquals(null, res[916].exec("1234567@a.b.c.d ", 2815)); +assertEquals("b", res[917].exec("aaaabcd"), 2816); +assertEquals("A", res[917].exec("aaAabcd "), 2817); +assertEquals("b", res[918].exec("aaaabcd"), 2818); +assertEquals("b", res[918].exec("aaAabcd "), 2819); +assertEquals("b", res[919].exec("aaaabcd"), 2820); +assertEquals("A", res[919].exec("aaAabcd "), 2821); +assertEquals("b", res[920].exec("aaaabcd"), 2822); +assertEquals("b", res[920].exec("aaAabcd "), 2823); +assertEquals("PSTAIREISLL", res[922].exec("xxxxxxxxxxxPSTAIREISLLxxxxxxxxx"), 2824); +assertEquals("PSTAIREISLL", res[923].exec("xxxxxxxxxxxPSTAIREISLLxxxxxxxxx"), 2825); +assertEquals(".230003938,.23", res[924].exec("1.230003938"), 2826); +assertEquals(".875000282,.875", res[924].exec("1.875000282 "), 2827); +assertEquals(".235,.23", res[924].exec("1.235 "), 2828); +assertEquals(null, res[924].exec(" ", 2829)); +assertEquals(".23,.23,", res[925].exec("1.230003938 "), 2830); +assertEquals(".875,.875,5", res[925].exec("1.875000282"), 2831); +assertEquals(null, res[925].exec("*** Failers ", 2832)); +assertEquals(null, res[925].exec("1.235 ", 2833)); +assertThrows("var re = /a(?)b/;", 2834); +assertEquals(null, res[925].exec("ab ", 2835)); +assertEquals("foo table,foo,table", res[926].exec("Food is on the foo table"), 2836); +assertEquals("food is under the bar in the bar,d is under the bar in the ", res[927].exec("The food is under the bar in the barn."), 2837); +assertEquals("food is under the bar,d is under the ", res[928].exec("The food is under the bar in the barn."), 2838); +assertEquals("I have 2 numbers: 53147,I have 2 numbers: 53147,", res[929].exec("I have 2 numbers: 53147"), 2839); +assertEquals("I have 2 numbers: 53147,I have 2 numbers: 5314,7", res[930].exec("I have 2 numbers: 53147"), 2840); +assertEquals(",,", res[931].exec("I have 2 numbers: 53147"), 2841); +assertEquals("I have 2,I have ,2", res[932].exec("I have 2 numbers: 53147"), 2842); +assertEquals("I have 2 numbers: 53147,I have 2 numbers: 5314,7", res[933].exec("I have 2 numbers: 53147"), 2843); +assertEquals("I have 2 numbers: 53147,I have 2 numbers: ,53147", res[934].exec("I have 2 numbers: 53147"), 2844); +assertEquals("I have 2 numbers: 53147,I have 2 numbers: ,53147", res[935].exec("I have 2 numbers: 53147"), 2845); +assertEquals("I have 2 numbers: 53147,I have 2 numbers: ,53147", res[936].exec("I have 2 numbers: 53147"), 2846); +assertEquals("AB", res[937].exec("ABC123"), 2847); +assertEquals(" ", res[937].exec(" "), 2848); +assertEquals("ABC,ABC", res[938].exec("ABC445"), 2849); +assertEquals(null, res[938].exec("*** Failers", 2850)); +assertEquals(null, res[938].exec("ABC123", 2851)); +assertEquals("W46]", res[939].exec("W46]789 "), 2852); +assertEquals("-46]", res[939].exec("-46]789"), 2853); +assertEquals(null, res[939].exec("*** Failers", 2854)); +assertEquals(null, res[939].exec("Wall", 2855)); +assertEquals(null, res[939].exec("Zebra", 2856)); +assertEquals(null, res[939].exec("42", 2857)); +assertEquals(null, res[939].exec("[abcd] ", 2858)); +assertEquals(null, res[939].exec("]abcd[", 2859)); +assertEquals(null, res[939].exec(" ", 2860)); +assertEquals("W", res[940].exec("W46]789 "), 2861); +assertEquals("W", res[940].exec("Wall"), 2862); +assertEquals("Z", res[940].exec("Zebra"), 2863); +assertEquals("X", res[940].exec("Xylophone "), 2864); +assertEquals("4", res[940].exec("42"), 2865); +assertEquals("[", res[940].exec("[abcd] "), 2866); +assertEquals("]", res[940].exec("]abcd["), 2867); +assertEquals("\\", res[940].exec("\\backslash "), 2868); +assertEquals(null, res[940].exec("*** Failers", 2869)); +assertEquals(null, res[940].exec("-46]789", 2870)); +assertEquals(null, res[940].exec("well", 2871)); +assertEquals("01/01/2000", res[941].exec("01/01/2000"), 2872); +assertEquals(",", res[944].exec("bcd"), 2873); +assertEquals(",", res[944].exec("abc"), 2874); +assertEquals(",", res[944].exec("aab "), 2875); +assertEquals(",", res[945].exec("bcd"), 2876); +assertEquals("a,a", res[945].exec("abc"), 2877); +assertEquals("a,a", res[945].exec("aab "), 2878); +assertEquals(",", res[946].exec("bcd"), 2879); +assertEquals("a,a", res[946].exec("abc"), 2880); +assertEquals("aa,a", res[946].exec("aab "), 2881); +assertEquals(",", res[947].exec("bcd"), 2882); +assertEquals("a,a", res[947].exec("abc"), 2883); +assertEquals("aa,a", res[947].exec("aab"), 2884); +assertEquals("aaa,a", res[947].exec("aaa "), 2885); +assertEquals(",", res[948].exec("bcd"), 2886); +assertEquals("a,a", res[948].exec("abc"), 2887); +assertEquals("aa,a", res[948].exec("aab"), 2888); +assertEquals("aaa,a", res[948].exec("aaa"), 2889); +assertEquals("aaaaaaaa,a", res[948].exec("aaaaaaaa "), 2890); +assertEquals(null, res[949].exec("bcd", 2891)); +assertEquals("a,a", res[949].exec("abc"), 2892); +assertEquals("a,a", res[949].exec("aab "), 2893); +assertEquals(null, res[950].exec("bcd", 2894)); +assertEquals("a,a", res[950].exec("abc"), 2895); +assertEquals("aa,a", res[950].exec("aab "), 2896); +assertEquals(null, res[951].exec("bcd", 2897)); +assertEquals("a,a", res[951].exec("abc"), 2898); +assertEquals("aa,a", res[951].exec("aab"), 2899); +assertEquals("aaa,a", res[951].exec("aaa "), 2900); +assertEquals(null, res[952].exec("bcd", 2901)); +assertEquals("a,a", res[952].exec("abc"), 2902); +assertEquals("aa,a", res[952].exec("aab"), 2903); +assertEquals("aaa,a", res[952].exec("aaa"), 2904); +assertEquals("aaaaaaaa,a", res[952].exec("aaaaaaaa "), 2905); +assertEquals("bib.gif", res[953].exec("borfle\nbib.gif\nno"), 2906); +assertEquals("bib.gif", res[954].exec("borfle\nbib.gif\nno"), 2907); +assertEquals("bib.gif", res[955].exec("borfle\nbib.gif\nno"), 2908); +assertEquals("bib.gif", res[956].exec("borfle\nbib.gif\nno"), 2909); +assertEquals("bib.gif", res[957].exec("borfle\nbib.gif\nno"), 2910); +assertEquals("no", res[958].exec("borfle\nbib.gif\nno"), 2911); +assertEquals("borfle", res[959].exec("borfle\nbib.gif\nno"), 2912); +assertEquals("no", res[960].exec("borfle\nbib.gif\nno"), 2913); +assertEquals("borfle", res[961].exec("borfle\nbib.gif\nno"), 2914); +assertEquals("", res[962].exec("borfle\nbib.gif\nno\n"), 2915); +assertEquals("borfle", res[963].exec("borfle\nbib.gif\nno\n"), 2916); +assertEquals("", res[964].exec("borfle\nbib.gif\nno\n"), 2917); +assertEquals("borfle", res[965].exec("borfle\nbib.gif\nno\n"), 2918); +assertEquals("1234X,1234X", res[966].exec("abcde\n1234Xyz"), 2919); +assertEquals("B,B", res[966].exec("BarFoo "), 2920); +assertEquals(null, res[966].exec("*** Failers", 2921)); +assertEquals(null, res[966].exec("abcde\nBar ", 2922)); +assertEquals("1234X,1234X", res[967].exec("abcde\n1234Xyz"), 2923); +assertEquals("B,B", res[967].exec("BarFoo "), 2924); +assertEquals("B,B", res[967].exec("abcde\nBar "), 2925); +assertEquals("1234X,1234X", res[968].exec("abcde\n1234Xyz"), 2926); +assertEquals("B,B", res[968].exec("BarFoo "), 2927); +assertEquals(null, res[968].exec("*** Failers", 2928)); +assertEquals(null, res[968].exec("abcde\nBar ", 2929)); +assertEquals("1234X,1234X", res[969].exec("abcde\n1234Xyz"), 2930); +assertEquals("B,B", res[969].exec("BarFoo "), 2931); +assertEquals("B,B", res[969].exec("abcde\nBar "), 2932); +assertEquals("1234X,1234X", res[969].exec("abcde\n1234Xyz"), 2933); +assertEquals("B,B", res[969].exec("BarFoo "), 2934); +assertEquals(null, res[969].exec("*** Failers ", 2935)); +assertEquals("B,B", res[969].exec("abcde\nBar "), 2936); +assertEquals("1234X,1234X", res[969].exec("abcde\n1234Xyz"), 2937); +assertEquals("B,B", res[969].exec("BarFoo "), 2938); +assertEquals(null, res[969].exec("*** Failers ", 2939)); +assertEquals("B,B", res[969].exec("abcde\nBar "), 2940); +assertEquals(null, res[970].exec("**** Failers", 2941)); +assertEquals(null, res[970].exec("abc\nB", 2942)); +assertEquals(null, res[970].exec(" ", 2943)); +assertEquals(null, res[970].exec("abc\nB", 2944)); +assertEquals(null, res[970].exec("abc\nB", 2945)); +assertEquals(null, res[970].exec(" ", 2946)); +assertEquals(null, res[970].exec("abc\nB", 2947)); +assertEquals(null, res[970].exec("abc\nB", 2948)); +assertEquals("B", res[970].exec("B\n"), 2949); +assertEquals("123456654321", res[971].exec("123456654321"), 2950); +assertEquals("123456654321", res[972].exec("123456654321 "), 2951); +assertEquals("123456654321", res[973].exec("123456654321"), 2952); +assertEquals("abcabcabcabc", res[974].exec("abcabcabcabc"), 2953); +assertEquals("abcabcabcabc", res[975].exec("abcabcabcabc"), 2954); +assertEquals("abcabcabcabc,c", res[976].exec("abcabcabcabc "), 2955); +assertEquals("n", res[977].exec("n"), 2956); +assertEquals(null, res[977].exec("*** Failers ", 2957)); +assertEquals(null, res[977].exec("z ", 2958)); +assertEquals("abcd", res[978].exec("abcd"), 2959); +assertEquals(null, res[978].exec("*** Failers", 2960)); +assertEquals(null, res[978].exec("abce ", 2961)); +assertEquals("abe", res[979].exec("abe"), 2962); +assertEquals(null, res[979].exec("*** Failers", 2963)); +assertEquals(null, res[979].exec("abcde ", 2964)); +assertEquals("abd,", res[980].exec("abd"), 2965); +assertEquals(null, res[980].exec("*** Failers", 2966)); +assertEquals(null, res[980].exec("abcd ", 2967)); +assertEquals("a,", res[981].exec("a"), 2968); +assertEquals("ab,b", res[981].exec("ab"), 2969); +assertEquals("abbbb,bbbb", res[981].exec("abbbb"), 2970); +assertEquals("a,", res[981].exec("*** Failers"), 2971); +assertEquals(null, res[981].exec("bbbbb ", 2972)); +assertEquals("abe", res[982].exec("abe"), 2973); +assertEquals(null, res[982].exec("*** Failers", 2974)); +assertEquals(null, res[982].exec("ab1e ", 2975)); +assertEquals("\"quick\",quick", res[983].exec("the \"quick\" brown fox"), 2976); +assertEquals("\"the \\\"quick\\\" brown fox\", brown fox", res[983].exec("\"the \\\"quick\\\" brown fox\" "), 2977); +assertEquals("", res[984].exec("abc"), 2978); +assertEquals("", res[985].exec("abc "), 2979); +assertEquals("", res[986].exec("abc "), 2980); +assertThrows("var re = //;", 2981); +assertEquals("", res[986].exec("abc"), 2982); +assertEquals("acb", res[988].exec("acb"), 2983); +assertEquals("a\nb", res[988].exec("a\nb"), 2984); +assertEquals("acb", res[989].exec("acb"), 2985); +assertEquals(null, res[989].exec("*** Failers ", 2986)); +assertEquals(null, res[989].exec("a\nb ", 2987)); +assertEquals("acb", res[990].exec("acb"), 2988); +assertEquals("a\nb", res[990].exec("a\nb "), 2989); +assertEquals("acb", res[991].exec("acb"), 2990); +assertEquals(null, res[991].exec("a\nb ", 2991)); +assertEquals("bac,a", res[992].exec("bac"), 2992); +assertEquals("bbac,a", res[992].exec("bbac"), 2993); +assertEquals("bbbac,a", res[992].exec("bbbac"), 2994); +assertEquals("bbbbac,a", res[992].exec("bbbbac"), 2995); +assertEquals("bbbbbac,a", res[992].exec("bbbbbac "), 2996); +assertEquals("bac,a", res[993].exec("bac"), 2997); +assertEquals("bbac,a", res[993].exec("bbac"), 2998); +assertEquals("bbbac,a", res[993].exec("bbbac"), 2999); +assertEquals("bbbbac,a", res[993].exec("bbbbac"), 3000); +assertEquals("bbbbbac,a", res[993].exec("bbbbbac "), 3001); +assertEquals("x", res[994].exec("x\nb\n"), 3002); +assertEquals("x", res[994].exec("a\x08x\n "), 3003); +assertEquals(null, res[995].exec("\x00{ab} ", 3004)); +assertEquals("CD,", res[996].exec("CD "), 3005); +assertEquals("CD,", res[997].exec("CD "), 3006); +assertEquals(null, res[997].exec("foo", 3007)); +assertEquals(null, res[997].exec("catfood", 3008)); +assertEquals(null, res[997].exec("arfootle", 3009)); +assertEquals(null, res[997].exec("rfoosh", 3010)); +assertEquals(null, res[997].exec("*** Failers", 3011)); +assertEquals(null, res[997].exec("barfoo", 3012)); +assertEquals(null, res[997].exec("towbarfoo", 3013)); +assertEquals(null, res[997].exec("catfood", 3014)); +assertEquals(null, res[997].exec("*** Failers", 3015)); +assertEquals(null, res[997].exec("foo", 3016)); +assertEquals(null, res[997].exec("barfoo", 3017)); +assertEquals(null, res[997].exec("towbarfoo", 3018)); +assertEquals(null, res[997].exec("fooabar", 3019)); +assertEquals(null, res[997].exec("*** Failers", 3020)); +assertEquals(null, res[997].exec("bar", 3021)); +assertEquals(null, res[997].exec("foobbar", 3022)); +assertEquals(null, res[997].exec(" ", 3023)); +assertEquals(null, res[998].exec("abc", 3024)); +assertEquals(null, res[998].exec("*** Failers", 3025)); +assertEquals(null, res[998].exec("abc\n ", 3026)); +assertEquals(null, res[998].exec("qqq\nabc", 3027)); +assertEquals(null, res[998].exec("abc\nzzz", 3028)); +assertEquals(null, res[998].exec("qqq\nabc\nzzz", 3029)); +assertEquals(null, res[998].exec("/this/is/a/very/long/line/in/deed/with/very/many/slashes/in/it/you/see/", 3030)); +assertEquals(null, res[998].exec("/this/is/a/very/long/line/in/deed/with/very/many/slashes/in/and/foo", 3031)); +assertEquals(null, res[998].exec("1.230003938", 3032)); +assertEquals(null, res[998].exec("1.875000282", 3033)); +assertEquals(null, res[998].exec("*** Failers ", 3034)); +assertEquals(null, res[998].exec("1.235 ", 3035)); +assertEquals(null, res[998].exec("now is the time for all good men to come to the aid of the party", 3036)); +assertEquals(null, res[998].exec("*** Failers", 3037)); +assertEquals(null, res[998].exec("this is not a line with only words and spaces!", 3038)); +assertEquals("12345a,12345,a", res[999].exec("12345a"), 3039); +assertEquals("12345,1234,5", res[999].exec("12345+ "), 3040); +assertEquals("12345a,12345,a", res[999].exec("12345a"), 3041); +assertEquals(null, res[999].exec("*** Failers", 3042)); +assertEquals("12345,1234,5", res[999].exec("12345+ "), 3043); +assertEquals(null, res[999].exec("aaab", 3044)); +assertEquals(null, res[999].exec("aaab", 3045)); +assertEquals(null, res[999].exec("aaab", 3046)); +assertEquals(null, res[999].exec("aaabbbccc", 3047)); +assertEquals(null, res[999].exec("aaabbbbccccd", 3048)); +assertEquals("aaabbbbcccc,ccc", res[1000].exec("aaabbbbccccd"), 3049); +assertEquals("abc,b", res[1000].exec("((abc(ade)ufh()()x"), 3050); +assertEquals(null, res[1000].exec("", 3051)); +assertEquals("abc,b", res[1000].exec("(abc)"), 3052); +assertEquals("abc,b", res[1000].exec("(abc(def)xyz)"), 3053); +assertEquals(null, res[1000].exec("*** Failers", 3054)); +assertEquals(null, res[1000].exec("ab", 3055)); +assertEquals(null, res[1000].exec("Ab", 3056)); +assertEquals(null, res[1000].exec("*** Failers ", 3057)); +assertEquals(null, res[1000].exec("aB", 3058)); +assertEquals(null, res[1000].exec("AB", 3059)); +assertEquals(null, res[1000].exec(" ", 3060)); +assertEquals("bc,b", res[1000].exec("a bcd e"), 3061); +assertEquals(null, res[1000].exec("*** Failers", 3062)); +assertEquals("c,", res[1000].exec("a b cd e"), 3063); +assertEquals("abc,b", res[1000].exec("abcd e "), 3064); +assertEquals("bc,b", res[1000].exec("a bcde "), 3065); +assertEquals("bc,b", res[1000].exec("a bcde f"), 3066); +assertEquals(null, res[1000].exec("*** Failers", 3067)); +assertEquals("abc,b", res[1000].exec("abcdef "), 3068); +assertEquals("abc,b", res[1000].exec("abc"), 3069); +assertEquals("c,", res[1000].exec("aBc"), 3070); +assertEquals(null, res[1000].exec("*** Failers", 3071)); +assertEquals(null, res[1000].exec("abC", 3072)); +assertEquals(null, res[1000].exec("aBC ", 3073)); +assertEquals("bc,b", res[1000].exec("Abc"), 3074); +assertEquals("c,", res[1000].exec("ABc"), 3075); +assertEquals(null, res[1000].exec("ABC", 3076)); +assertEquals(null, res[1000].exec("AbC", 3077)); +assertEquals(null, res[1000].exec("", 3078)); +assertEquals("abc,b", res[1000].exec("abc"), 3079); +assertEquals("c,", res[1000].exec("aBc"), 3080); +assertEquals(null, res[1000].exec("*** Failers ", 3081)); +assertEquals(null, res[1000].exec("ABC", 3082)); +assertEquals(null, res[1000].exec("abC", 3083)); +assertEquals(null, res[1000].exec("aBC", 3084)); +assertEquals(null, res[1000].exec("", 3085)); +assertEquals("c,", res[1000].exec("aBc"), 3086); +assertEquals("c,", res[1000].exec("aBBc"), 3087); +assertEquals(null, res[1000].exec("*** Failers ", 3088)); +assertEquals(null, res[1000].exec("aBC", 3089)); +assertEquals(null, res[1000].exec("aBBC", 3090)); +assertEquals(null, res[1000].exec("", 3091)); +assertEquals("abc,b", res[1000].exec("abcd"), 3092); +assertEquals(null, res[1000].exec("abCd", 3093)); +assertEquals(null, res[1000].exec("*** Failers", 3094)); +assertEquals(null, res[1000].exec("aBCd", 3095)); +assertEquals("abc,b", res[1000].exec("abcD "), 3096); +assertEquals(null, res[1000].exec("", 3097)); +assertEquals(null, res[1000].exec("more than million", 3098)); +assertEquals(null, res[1000].exec("more than MILLION", 3099)); +assertEquals(null, res[1000].exec("more \n than Million ", 3100)); +assertEquals(null, res[1000].exec("*** Failers", 3101)); +assertEquals(null, res[1000].exec("MORE THAN MILLION ", 3102)); +assertEquals(null, res[1000].exec("more \n than \n million ", 3103)); +assertEquals(null, res[1000].exec("more than million", 3104)); +assertEquals(null, res[1000].exec("more than MILLION", 3105)); +assertEquals(null, res[1000].exec("more \n than Million ", 3106)); +assertEquals(null, res[1000].exec("*** Failers", 3107)); +assertEquals(null, res[1000].exec("MORE THAN MILLION ", 3108)); +assertEquals(null, res[1000].exec("more \n than \n million ", 3109)); +assertEquals(null, res[1000].exec("", 3110)); +assertEquals("abc,b", res[1000].exec("abc"), 3111); +assertEquals("bc,b", res[1000].exec("aBbc"), 3112); +assertEquals("c,", res[1000].exec("aBBc "), 3113); +assertEquals(null, res[1000].exec("*** Failers", 3114)); +assertEquals("bc,b", res[1000].exec("Abc"), 3115); +assertEquals(null, res[1000].exec("abAb ", 3116)); +assertEquals(null, res[1000].exec("abbC ", 3117)); +assertEquals(null, res[1000].exec("", 3118)); +assertEquals("abc,b", res[1000].exec("abc"), 3119); +assertEquals("c,", res[1000].exec("aBc"), 3120); +assertEquals(null, res[1000].exec("*** Failers", 3121)); +assertEquals(null, res[1000].exec("Ab ", 3122)); +assertEquals(null, res[1000].exec("abC", 3123)); +assertEquals(null, res[1000].exec("aBC ", 3124)); +assertEquals(null, res[1000].exec("", 3125)); +assertEquals("c,", res[1000].exec("abxxc"), 3126); +assertEquals("c,", res[1000].exec("aBxxc"), 3127); +assertEquals(null, res[1000].exec("*** Failers", 3128)); +assertEquals("c,", res[1000].exec("Abxxc"), 3129); +assertEquals("c,", res[1000].exec("ABxxc"), 3130); +assertEquals(null, res[1000].exec("abxxC ", 3131)); +assertEquals("abc,b", res[1000].exec("abc:"), 3132); +assertEquals(null, res[1000].exec("12", 3133)); +assertEquals(null, res[1000].exec("*** Failers", 3134)); +assertEquals(null, res[1000].exec("123", 3135)); +assertEquals(null, res[1000].exec("xyz ", 3136)); +assertEquals("abc,b", res[1000].exec("abc:"), 3137); +assertEquals(null, res[1000].exec("12", 3138)); +assertEquals(null, res[1000].exec("*** Failers", 3139)); +assertEquals(null, res[1000].exec("123", 3140)); +assertEquals(null, res[1000].exec("xyz ", 3141)); +assertEquals(null, res[1000].exec("", 3142)); +assertEquals(null, res[1000].exec("foobar", 3143)); +assertEquals("c,", res[1000].exec("cat"), 3144); +assertEquals("c,", res[1000].exec("fcat"), 3145); +assertEquals("c,", res[1000].exec("focat "), 3146); +assertEquals(null, res[1000].exec("*** Failers", 3147)); +assertEquals("c,", res[1000].exec("foocat "), 3148); +assertEquals(null, res[1000].exec("foobar", 3149)); +assertEquals("c,", res[1000].exec("cat"), 3150); +assertEquals("c,", res[1000].exec("fcat"), 3151); +assertEquals("c,", res[1000].exec("focat "), 3152); +assertEquals(null, res[1000].exec("*** Failers", 3153)); +assertEquals("c,", res[1000].exec("foocat "), 3154); +assertEquals(null, res[1000].exec("a", 3155)); +assertEquals(null, res[1000].exec("aa", 3156)); +assertEquals(null, res[1000].exec("aaaa", 3157)); +assertEquals(null, res[1000].exec("", 3158)); +assertEquals("abc,abc", res[1001].exec("abc"), 3159); +assertEquals("abcabc,abc", res[1001].exec("abcabc"), 3160); +assertEquals("abcabcabc,abc", res[1001].exec("abcabcabc"), 3161); +assertEquals(",", res[1001].exec("xyz "), 3162); +assertEquals("a,a", res[1002].exec("a"), 3163); +assertEquals("aaaaa,aaaaa", res[1002].exec("aaaaa "), 3164); +assertEquals("a,a", res[1003].exec("a"), 3165); +assertEquals("b,b", res[1003].exec("b"), 3166); +assertEquals("ababab,ababab", res[1003].exec("ababab"), 3167); +assertEquals("aaaab,aaaab", res[1003].exec("aaaabcde"), 3168); +assertEquals("bbbb,bbbb", res[1003].exec("bbbb "), 3169); +assertEquals("b,b", res[1004].exec("b"), 3170); +assertEquals("bbbb,bbbb", res[1004].exec("bbbb"), 3171); +assertEquals(",", res[1004].exec("aaa "), 3172); +assertEquals("cccc,cccc", res[1005].exec("cccc"), 3173); +assertEquals(",", res[1005].exec("abab "), 3174); +assertEquals("a,a", res[1006].exec("a"), 3175); +assertEquals("aaaa,a", res[1006].exec("aaaa "), 3176); +assertEquals("a,a", res[1007].exec("a"), 3177); +assertEquals("b,b", res[1007].exec("b"), 3178); +assertEquals("abab,b", res[1007].exec("abab"), 3179); +assertEquals("baba,a", res[1007].exec("baba "), 3180); +assertEquals("b,b", res[1008].exec("b"), 3181); +assertEquals("bbbb,b", res[1008].exec("bbbb"), 3182); +assertEquals(",", res[1008].exec("aaa "), 3183); +assertEquals("c,c", res[1009].exec("c"), 3184); +assertEquals("cccc,c", res[1009].exec("cccc"), 3185); +assertEquals(",", res[1009].exec("baba "), 3186); +assertEquals(",", res[1009].exec("a"), 3187); +assertEquals(",", res[1009].exec("aaabcde "), 3188); +assertEquals(",", res[1009].exec("aaaaa"), 3189); +assertEquals(",", res[1009].exec("aabbaa "), 3190); +assertEquals(",", res[1009].exec("aaaaa"), 3191); +assertEquals(",", res[1009].exec("aabbaa "), 3192); +assertEquals("12-sep-98,8", res[1009].exec("12-sep-98"), 3193); +assertEquals("12-09-98,8", res[1009].exec("12-09-98"), 3194); +assertEquals("*** F,F", res[1009].exec("*** Failers"), 3195); +assertEquals("sep-12-98,8", res[1009].exec("sep-12-98"), 3196); +assertEquals(" , ", res[1009].exec(" "), 3197); +assertEquals("s,s", res[1009].exec("saturday"), 3198); +assertEquals("sund,d", res[1009].exec("sunday"), 3199); +assertEquals("S,S", res[1009].exec("Saturday"), 3200); +assertEquals("Sund,d", res[1009].exec("Sunday"), 3201); +assertEquals("SATURDAY,Y", res[1009].exec("SATURDAY"), 3202); +assertEquals("SUNDAY,Y", res[1009].exec("SUNDAY"), 3203); +assertEquals("SunD,D", res[1009].exec("SunDay"), 3204); +assertEquals(",", res[1009].exec("abcx"), 3205); +assertEquals(",", res[1009].exec("aBCx"), 3206); +assertEquals(",", res[1009].exec("bbx"), 3207); +assertEquals("BBx,x", res[1009].exec("BBx"), 3208); +assertEquals("*** F,F", res[1009].exec("*** Failers"), 3209); +assertEquals(",", res[1009].exec("abcX"), 3210); +assertEquals(",", res[1009].exec("aBCX"), 3211); +assertEquals(",", res[1009].exec("bbX"), 3212); +assertEquals("BBX , ", res[1009].exec("BBX "), 3213); +assertEquals(",", res[1009].exec("ac"), 3214); +assertEquals(",", res[1009].exec("aC"), 3215); +assertEquals(",", res[1009].exec("bD"), 3216); +assertEquals("eleph,h", res[1009].exec("elephant"), 3217); +assertEquals("Europe , ", res[1009].exec("Europe "), 3218); +assertEquals("frog,g", res[1009].exec("frog"), 3219); +assertEquals("Fr,r", res[1009].exec("France"), 3220); +assertEquals("*** F,F", res[1009].exec("*** Failers"), 3221); +assertEquals("Afric,c", res[1009].exec("Africa "), 3222); +assertEquals(",", res[1009].exec("ab"), 3223); +assertEquals(",", res[1009].exec("aBd"), 3224); +assertEquals("xy,y", res[1009].exec("xy"), 3225); +assertEquals("xY,Y", res[1009].exec("xY"), 3226); +assertEquals("ze,e", res[1009].exec("zebra"), 3227); +assertEquals("Z,Z", res[1009].exec("Zambesi"), 3228); +assertEquals("*** F,F", res[1009].exec("*** Failers"), 3229); +assertEquals(",", res[1009].exec("aCD "), 3230); +assertEquals("XY , ", res[1009].exec("XY "), 3231); +assertEquals("foo\n,\n", res[1009].exec("foo\nbar"), 3232); +assertEquals("*** F,F", res[1009].exec("*** Failers"), 3233); +assertEquals(",", res[1009].exec("bar"), 3234); +assertEquals(",", res[1009].exec("baz\nbar "), 3235); +assertEquals(",", res[1009].exec("barbaz"), 3236); +assertEquals(",", res[1009].exec("barbarbaz "), 3237); +assertEquals("koo,o", res[1009].exec("koobarbaz "), 3238); +assertEquals("*** F,F", res[1009].exec("*** Failers"), 3239); +assertEquals(",", res[1009].exec("baz"), 3240); +assertEquals("foo,o", res[1009].exec("foobarbaz "), 3241); +assertEquals("abc", res[1012].exec("abc"), 3242); +assertEquals("abc", res[1012].exec("xabcy"), 3243); +assertEquals("abc", res[1012].exec("ababc"), 3244); +assertEquals(null, res[1012].exec("*** Failers", 3245)); +assertEquals(null, res[1012].exec("xbc", 3246)); +assertEquals(null, res[1012].exec("axc", 3247)); +assertEquals(null, res[1012].exec("abx", 3248)); +assertEquals("abc", res[1013].exec("abc"), 3249); +assertEquals("abc", res[1014].exec("abc"), 3250); +assertEquals("abbc", res[1014].exec("abbc"), 3251); +assertEquals("abbbbc", res[1014].exec("abbbbc"), 3252); +assertEquals("a", res[1015].exec("abbbbc"), 3253); +assertEquals("abbb", res[1016].exec("abbbbc"), 3254); +assertEquals("abbbbc", res[1017].exec("abbbbc"), 3255); +assertEquals("abbc", res[1018].exec("abbc"), 3256); +assertEquals(null, res[1018].exec("*** Failers", 3257)); +assertEquals(null, res[1018].exec("abc", 3258)); +assertEquals(null, res[1018].exec("abq", 3259)); +assertEquals("abbbbc", res[1020].exec("abbbbc"), 3260); +assertEquals("abbbbc", res[1021].exec("abbbbc"), 3261); +assertEquals("abbbbc", res[1022].exec("abbbbc"), 3262); +assertEquals("abbbbc", res[1023].exec("abbbbc"), 3263); +assertEquals(null, res[1024].exec("*** Failers", 3264)); +assertEquals(null, res[1024].exec("abq", 3265)); +assertEquals(null, res[1024].exec("abbbbc", 3266)); +assertEquals("abbc", res[1025].exec("abbc"), 3267); +assertEquals("abc", res[1025].exec("abc"), 3268); +assertEquals("abc", res[1026].exec("abc"), 3269); +assertEquals("abc", res[1028].exec("abc"), 3270); +assertEquals("abc", res[1029].exec("abc"), 3271); +assertEquals("abc", res[1030].exec("abc"), 3272); +assertEquals(null, res[1030].exec("*** Failers", 3273)); +assertEquals(null, res[1030].exec("abbbbc", 3274)); +assertEquals(null, res[1030].exec("abcc", 3275)); +assertEquals("abc", res[1031].exec("abcc"), 3276); +assertEquals("abc", res[1033].exec("aabc"), 3277); +assertEquals(null, res[1033].exec("*** Failers", 3278)); +assertEquals("abc", res[1033].exec("aabc"), 3279); +assertEquals(null, res[1033].exec("aabcd", 3280)); +assertEquals("", res[1034].exec("abc"), 3281); +assertEquals("", res[1035].exec("abc"), 3282); +assertEquals("abc", res[1036].exec("abc"), 3283); +assertEquals("axc", res[1036].exec("axc"), 3284); +assertEquals("axyzc", res[1037].exec("axyzc"), 3285); +assertEquals("abd", res[1038].exec("abd"), 3286); +assertEquals(null, res[1038].exec("*** Failers", 3287)); +assertEquals(null, res[1038].exec("axyzd", 3288)); +assertEquals(null, res[1038].exec("abc", 3289)); +assertEquals("ace", res[1039].exec("ace"), 3290); +assertEquals("ac", res[1040].exec("aac"), 3291); +assertEquals("a-", res[1041].exec("a-"), 3292); +assertEquals("a-", res[1042].exec("a-"), 3293); +assertEquals("a]", res[1043].exec("a]"), 3294); +assertEquals(null, res[1044].exec("a]b", 3295)); +assertEquals("aed", res[1045].exec("aed"), 3296); +assertEquals(null, res[1045].exec("*** Failers", 3297)); +assertEquals(null, res[1045].exec("abd", 3298)); +assertEquals(null, res[1045].exec("abd", 3299)); +assertEquals("adc", res[1046].exec("adc"), 3300); +assertEquals(null, res[1047].exec("adc", 3301)); +assertEquals(null, res[1047].exec("*** Failers", 3302)); +assertEquals(null, res[1047].exec("a-c", 3303)); +assertEquals(null, res[1047].exec("a]c", 3304)); +assertEquals("a", res[1048].exec("a-"), 3305); +assertEquals("a", res[1048].exec("-a"), 3306); +assertEquals("a", res[1048].exec("-a-"), 3307); +assertEquals(null, res[1049].exec("*** Failers", 3308)); +assertEquals(null, res[1049].exec("xy", 3309)); +assertEquals(null, res[1049].exec("yz", 3310)); +assertEquals(null, res[1049].exec("xyz", 3311)); +assertEquals("a", res[1050].exec("*** Failers"), 3312); +assertEquals(null, res[1050].exec("a-", 3313)); +assertEquals(null, res[1050].exec("-a", 3314)); +assertEquals(null, res[1050].exec("-a-", 3315)); +assertEquals("y", res[1051].exec("xy"), 3316); +assertEquals("y", res[1052].exec("yz"), 3317); +assertEquals("y", res[1053].exec("xyz"), 3318); +assertEquals("a", res[1054].exec("a"), 3319); +assertEquals("-", res[1055].exec("-"), 3320); +assertEquals("*", res[1055].exec("*** Failers"), 3321); +assertEquals("-", res[1055].exec("-"), 3322); +assertEquals(null, res[1055].exec("a", 3323)); +assertEquals("a b", res[1056].exec("a b"), 3324); +assertEquals("a-b", res[1057].exec("a-b"), 3325); +assertEquals(null, res[1057].exec("*** Failers", 3326)); +assertEquals("a-b", res[1057].exec("a-b"), 3327); +assertEquals(null, res[1057].exec("a b", 3328)); +assertEquals("1", res[1058].exec("1"), 3329); +assertEquals("-", res[1059].exec("-"), 3330); +assertEquals("*", res[1059].exec("*** Failers"), 3331); +assertEquals("-", res[1059].exec("-"), 3332); +assertEquals(null, res[1059].exec("1", 3333)); +assertEquals("a", res[1060].exec("a"), 3334); +assertEquals("-", res[1061].exec("-"), 3335); +assertEquals("*", res[1061].exec("*** Failers"), 3336); +assertEquals("-", res[1061].exec("-"), 3337); +assertEquals(null, res[1061].exec("a", 3338)); +assertEquals("a b", res[1062].exec("a b"), 3339); +assertEquals("a-b", res[1063].exec("a-b"), 3340); +assertEquals(null, res[1063].exec("*** Failers", 3341)); +assertEquals("a-b", res[1063].exec("a-b"), 3342); +assertEquals(null, res[1063].exec("a b", 3343)); +assertEquals("1", res[1064].exec("1"), 3344); +assertEquals("-", res[1065].exec("-"), 3345); +assertEquals("*", res[1065].exec("*** Failers"), 3346); +assertEquals("-", res[1065].exec("-"), 3347); +assertEquals(null, res[1065].exec("1", 3348)); +assertEquals("ab", res[1066].exec("abc"), 3349); +assertEquals("ab", res[1066].exec("abcd"), 3350); +assertEquals("ef,", res[1067].exec("def"), 3351); +assertEquals("a(b", res[1069].exec("a(b"), 3352); +assertEquals(null, res[1069].exec("ab", 3353)); +assertEquals(null, res[1069].exec("a((b", 3354)); +assertEquals(null, res[1070].exec("a\x08", 3355)); +assertEquals("a,a,a", res[1071].exec("abc"), 3356); +assertEquals("abc,a,c", res[1072].exec("abc"), 3357); +assertEquals("abc", res[1073].exec("aabbabc"), 3358); +assertEquals("abc", res[1074].exec("aabbabc"), 3359); +assertEquals("abc", res[1075].exec("abcabc"), 3360); +assertEquals("ab,b", res[1076].exec("ab"), 3361); +assertEquals("ab,b", res[1077].exec("ab"), 3362); +assertEquals("ab,b", res[1078].exec("ab"), 3363); +assertEquals("ab,b", res[1079].exec("ab"), 3364); +assertEquals("a,a", res[1080].exec("ab"), 3365); +assertEquals("a,a", res[1081].exec("ab"), 3366); +assertEquals("cde", res[1082].exec("cde"), 3367); +assertEquals(null, res[1083].exec("*** Failers", 3368)); +assertEquals(null, res[1083].exec("b", 3369)); +assertEquals("abbbcd,c", res[1085].exec("abbbcd"), 3370); +assertEquals("abcd,a", res[1086].exec("abcd"), 3371); +assertEquals("e", res[1087].exec("e"), 3372); +assertEquals("ef,e", res[1088].exec("ef"), 3373); +assertEquals("abcdefg", res[1089].exec("abcdefg"), 3374); +assertEquals("ab", res[1090].exec("xabyabbbz"), 3375); +assertEquals("a", res[1090].exec("xayabbbz"), 3376); +assertEquals("cde,cd", res[1091].exec("abcde"), 3377); +assertEquals("hij", res[1092].exec("hij"), 3378); +assertEquals("ef,", res[1094].exec("abcdef"), 3379); +assertEquals("bcd,b", res[1095].exec("abcd"), 3380); +assertEquals("abc,a", res[1096].exec("abc"), 3381); +assertEquals("abc,bc", res[1097].exec("abc"), 3382); +assertEquals("abcd,bc,d", res[1098].exec("abcd"), 3383); +assertEquals("abcd,bc,d", res[1099].exec("abcd"), 3384); +assertEquals("abcd,b,cd", res[1100].exec("abcd"), 3385); +assertEquals("adcdcde", res[1101].exec("adcdcde"), 3386); +assertEquals(null, res[1102].exec("*** Failers", 3387)); +assertEquals(null, res[1102].exec("abcde", 3388)); +assertEquals(null, res[1102].exec("adcdcde", 3389)); +assertEquals("abc,ab", res[1103].exec("abc"), 3390); +assertEquals("abcd,abc,a,b,d", res[1104].exec("abcd"), 3391); +assertEquals("alpha", res[1105].exec("alpha"), 3392); +assertEquals("bh,", res[1106].exec("abh"), 3393); +assertEquals("effgz,effgz,", res[1107].exec("effgz"), 3394); +assertEquals("ij,ij,j", res[1107].exec("ij"), 3395); +assertEquals("effgz,effgz,", res[1107].exec("reffgz"), 3396); +assertEquals(null, res[1107].exec("*** Failers", 3397)); +assertEquals(null, res[1107].exec("effg", 3398)); +assertEquals(null, res[1107].exec("bcdd", 3399)); +assertEquals("a,a,a,a,a,a,a,a,a,a,a", res[1108].exec("a"), 3400); +assertEquals("a,a,a,a,a,a,a,a,a,a", res[1109].exec("a"), 3401); +assertEquals(null, res[1110].exec("*** Failers", 3402)); +assertEquals(null, res[1110].exec("aa", 3403)); +assertEquals(null, res[1110].exec("uh-uh", 3404)); +assertEquals("multiple words", res[1111].exec("multiple words, yeah"), 3405); +assertEquals("abcde,ab,de", res[1112].exec("abcde"), 3406); +assertEquals("(a, b),a,b", res[1113].exec("(a, b)"), 3407); +assertEquals("abcd", res[1115].exec("abcd"), 3408); +assertEquals("abcd,bc", res[1116].exec("abcd"), 3409); +assertEquals("ac", res[1117].exec("ac"), 3410); +assertEquals("ABC", res[1118].exec("ABC"), 3411); +assertEquals("ABC", res[1118].exec("XABCY"), 3412); +assertEquals("ABC", res[1118].exec("ABABC"), 3413); +assertEquals(null, res[1118].exec("*** Failers", 3414)); +assertEquals(null, res[1118].exec("aaxabxbaxbbx", 3415)); +assertEquals(null, res[1118].exec("XBC", 3416)); +assertEquals(null, res[1118].exec("AXC", 3417)); +assertEquals(null, res[1118].exec("ABX", 3418)); +assertEquals("ABC", res[1119].exec("ABC"), 3419); +assertEquals("ABC", res[1120].exec("ABC"), 3420); +assertEquals("ABBC", res[1120].exec("ABBC"), 3421); +assertEquals("ABBBBC", res[1121].exec("ABBBBC"), 3422); +assertEquals("ABBBBC", res[1122].exec("ABBBBC"), 3423); +assertEquals("ABBC", res[1123].exec("ABBC"), 3424); +assertEquals(null, res[1124].exec("*** Failers", 3425)); +assertEquals(null, res[1124].exec("ABC", 3426)); +assertEquals(null, res[1124].exec("ABQ", 3427)); +assertEquals("ABBBBC", res[1126].exec("ABBBBC"), 3428); +assertEquals("ABBBBC", res[1127].exec("ABBBBC"), 3429); +assertEquals("ABBBBC", res[1128].exec("ABBBBC"), 3430); +assertEquals("ABBBBC", res[1129].exec("ABBBBC"), 3431); +assertEquals(null, res[1130].exec("*** Failers", 3432)); +assertEquals(null, res[1130].exec("ABQ", 3433)); +assertEquals(null, res[1130].exec("ABBBBC", 3434)); +assertEquals("ABBC", res[1131].exec("ABBC"), 3435); +assertEquals("ABC", res[1131].exec("ABC"), 3436); +assertEquals("ABC", res[1132].exec("ABC"), 3437); +assertEquals("ABC", res[1134].exec("ABC"), 3438); +assertEquals("ABC", res[1135].exec("ABC"), 3439); +assertEquals("ABC", res[1136].exec("ABC"), 3440); +assertEquals(null, res[1136].exec("*** Failers", 3441)); +assertEquals(null, res[1136].exec("ABBBBC", 3442)); +assertEquals(null, res[1136].exec("ABCC", 3443)); +assertEquals("ABC", res[1137].exec("ABCC"), 3444); +assertEquals("ABC", res[1139].exec("AABC"), 3445); +assertEquals("", res[1140].exec("ABC"), 3446); +assertEquals("", res[1141].exec("ABC"), 3447); +assertEquals("ABC", res[1142].exec("ABC"), 3448); +assertEquals("AXC", res[1142].exec("AXC"), 3449); +assertEquals("AXYZC", res[1143].exec("AXYZC"), 3450); +assertEquals(null, res[1144].exec("*** Failers", 3451)); +assertEquals("AABC", res[1144].exec("AABC"), 3452); +assertEquals(null, res[1144].exec("AXYZD", 3453)); +assertEquals("ABD", res[1145].exec("ABD"), 3454); +assertEquals("ACE", res[1146].exec("ACE"), 3455); +assertEquals(null, res[1146].exec("*** Failers", 3456)); +assertEquals(null, res[1146].exec("ABC", 3457)); +assertEquals(null, res[1146].exec("ABD", 3458)); +assertEquals("AC", res[1147].exec("AAC"), 3459); +assertEquals("A-", res[1148].exec("A-"), 3460); +assertEquals("A-", res[1149].exec("A-"), 3461); +assertEquals("A]", res[1150].exec("A]"), 3462); +assertEquals(null, res[1151].exec("A]B", 3463)); +assertEquals("AED", res[1152].exec("AED"), 3464); +assertEquals("ADC", res[1153].exec("ADC"), 3465); +assertEquals(null, res[1153].exec("*** Failers", 3466)); +assertEquals(null, res[1153].exec("ABD", 3467)); +assertEquals(null, res[1153].exec("A-C", 3468)); +assertEquals(null, res[1154].exec("ADC", 3469)); +assertEquals("AB", res[1155].exec("ABC"), 3470); +assertEquals("AB", res[1155].exec("ABCD"), 3471); +assertEquals("EF,", res[1156].exec("DEF"), 3472); +assertEquals(null, res[1157].exec("*** Failers", 3473)); +assertEquals(null, res[1157].exec("A]C", 3474)); +assertEquals(null, res[1157].exec("B", 3475)); +assertEquals("A(B", res[1158].exec("A(B"), 3476); +assertEquals(null, res[1158].exec("AB", 3477)); +assertEquals(null, res[1158].exec("A((B", 3478)); +assertEquals(null, res[1159].exec("AB", 3479)); +assertEquals("A,A,A", res[1160].exec("ABC"), 3480); +assertEquals("ABC,A,C", res[1161].exec("ABC"), 3481); +assertEquals("ABC", res[1162].exec("AABBABC"), 3482); +assertEquals("ABC", res[1163].exec("AABBABC"), 3483); +assertEquals("ABC", res[1164].exec("ABCABC"), 3484); +assertEquals("ABC", res[1165].exec("ABCABC"), 3485); +assertEquals("ABC", res[1166].exec("ABCABC"), 3486); +assertEquals("AB,B", res[1167].exec("AB"), 3487); +assertEquals("AB,B", res[1168].exec("AB"), 3488); +assertEquals("AB,B", res[1169].exec("AB"), 3489); +assertEquals("AB,B", res[1170].exec("AB"), 3490); +assertEquals("A,A", res[1171].exec("AB"), 3491); +assertEquals("A,A", res[1172].exec("AB"), 3492); +assertEquals(",", res[1173].exec("AB"), 3493); +assertEquals("CDE", res[1174].exec("CDE"), 3494); +assertEquals("ABBBCD,C", res[1177].exec("ABBBCD"), 3495); +assertEquals("ABCD,A", res[1178].exec("ABCD"), 3496); +assertEquals("E", res[1179].exec("E"), 3497); +assertEquals("EF,E", res[1180].exec("EF"), 3498); +assertEquals("ABCDEFG", res[1181].exec("ABCDEFG"), 3499); +assertEquals("AB", res[1182].exec("XABYABBBZ"), 3500); +assertEquals("A", res[1182].exec("XAYABBBZ"), 3501); +assertEquals("CDE,CD", res[1183].exec("ABCDE"), 3502); +assertEquals("HIJ", res[1184].exec("HIJ"), 3503); +assertEquals(null, res[1185].exec("ABCDE", 3504)); +assertEquals("EF,", res[1186].exec("ABCDEF"), 3505); +assertEquals("BCD,B", res[1187].exec("ABCD"), 3506); +assertEquals("ABC,A", res[1188].exec("ABC"), 3507); +assertEquals("ABC,BC", res[1189].exec("ABC"), 3508); +assertEquals("ABCD,BC,D", res[1190].exec("ABCD"), 3509); +assertEquals("ABCD,BC,D", res[1191].exec("ABCD"), 3510); +assertEquals("ABCD,B,CD", res[1192].exec("ABCD"), 3511); +assertEquals("ADCDCDE", res[1193].exec("ADCDCDE"), 3512); +assertEquals("ABC,AB", res[1195].exec("ABC"), 3513); +assertEquals("ABCD,ABC,A,B,D", res[1196].exec("ABCD"), 3514); +assertEquals("ALPHA", res[1197].exec("ALPHA"), 3515); +assertEquals("BH,", res[1198].exec("ABH"), 3516); +assertEquals("EFFGZ,EFFGZ,", res[1199].exec("EFFGZ"), 3517); +assertEquals("IJ,IJ,J", res[1199].exec("IJ"), 3518); +assertEquals("EFFGZ,EFFGZ,", res[1199].exec("REFFGZ"), 3519); +assertEquals(null, res[1199].exec("*** Failers", 3520)); +assertEquals(null, res[1199].exec("ADCDCDE", 3521)); +assertEquals(null, res[1199].exec("EFFG", 3522)); +assertEquals(null, res[1199].exec("BCDD", 3523)); +assertEquals("A,A,A,A,A,A,A,A,A,A,A", res[1200].exec("A"), 3524); +assertEquals("A,A,A,A,A,A,A,A,A,A", res[1201].exec("A"), 3525); +assertEquals("A,A", res[1202].exec("A"), 3526); +assertEquals("C,C", res[1203].exec("C"), 3527); +assertEquals(null, res[1204].exec("*** Failers", 3528)); +assertEquals(null, res[1204].exec("AA", 3529)); +assertEquals(null, res[1204].exec("UH-UH", 3530)); +assertEquals("MULTIPLE WORDS", res[1205].exec("MULTIPLE WORDS, YEAH"), 3531); +assertEquals("ABCDE,AB,DE", res[1206].exec("ABCDE"), 3532); +assertEquals("(A, B),A,B", res[1207].exec("(A, B)"), 3533); +assertEquals("ABCD", res[1209].exec("ABCD"), 3534); +assertEquals("ABCD,BC", res[1210].exec("ABCD"), 3535); +assertEquals("AC", res[1211].exec("AC"), 3536); +assertEquals("ad", res[1212].exec("abad"), 3537); +assertEquals("ad", res[1213].exec("abad"), 3538); +assertEquals("ad", res[1214].exec("abad"), 3539); +assertEquals("ace,e", res[1215].exec("ace"), 3540); +assertEquals("ace,e", res[1216].exec("ace"), 3541); +assertEquals("ace,e", res[1217].exec("ace"), 3542); +assertEquals("acd,d", res[1217].exec("acdbcdbe"), 3543); +assertEquals("acdbcdbe,e", res[1218].exec("acdbcdbe"), 3544); +assertEquals("acdb,b", res[1219].exec("acdbcdbe"), 3545); +assertEquals("acdbcdb,b", res[1220].exec("acdbcdbe"), 3546); +assertEquals("acdbcd,d", res[1221].exec("acdbcdbe"), 3547); +assertEquals("foobar,bar,,bar", res[1222].exec("foobar"), 3548); +assertEquals("acdbcdbe,e", res[1223].exec("acdbcdbe"), 3549); +assertEquals("acdbcdbe,e", res[1224].exec("acdbcdbe"), 3550); +assertEquals("acdbcdbe,e", res[1225].exec("acdbcdbe"), 3551); +assertEquals("acdbcdb,b", res[1226].exec("acdbcdbe"), 3552); +assertEquals("acdbcdbe,e", res[1227].exec("acdbcdbe"), 3553); +assertEquals("acdbcdb,b", res[1228].exec("acdbcdbe"), 3554); +assertEquals("ace,c,e", res[1229].exec("ace"), 3555); +assertEquals("AB,A", res[1230].exec("AB"), 3556); +assertEquals(".,.,", res[1231].exec("."), 3557); +assertEquals("<&", res[1232].exec("<&OUT"), 3558); +assertEquals("foobar,,,,b,a,r", res[1233].exec("foobar"), 3559); +assertEquals(",,,,,,", res[1233].exec("ab"), 3560); +assertEquals(",,,,,,", res[1233].exec("*** Failers"), 3561); +assertEquals(",,,,,,", res[1233].exec("cb"), 3562); +assertEquals(",,,,,,", res[1233].exec("b"), 3563); +assertEquals(",,,,,,", res[1233].exec("ab"), 3564); +assertEquals(",,,,,,", res[1233].exec("b"), 3565); +assertEquals(",,,,,,", res[1233].exec("b"), 3566); +assertEquals("aba", res[1234].exec("aba"), 3567); +assertEquals("a", res[1235].exec("aba"), 3568); +assertEquals(",", res[1236].exec("abc"), 3569); +assertEquals("aax,a", res[1237].exec("aax"), 3570); +assertEquals("aax,a,a", res[1238].exec("aax"), 3571); +assertEquals("aax,a,a", res[1239].exec("aax"), 3572); +assertEquals("ab,", res[1240].exec("cab"), 3573); +assertEquals("ab,", res[1241].exec("cab"), 3574); +assertEquals("ab,", res[1241].exec("ab"), 3575); +assertEquals("ab,", res[1241].exec("ab"), 3576); +assertEquals(null, res[1241].exec("Ab", 3577)); +assertEquals(null, res[1241].exec("Ab", 3578)); +assertEquals(null, res[1241].exec("*** Failers", 3579)); +assertEquals(null, res[1241].exec("cb", 3580)); +assertEquals(null, res[1241].exec("aB", 3581)); +assertEquals("ab,", res[1241].exec("ab"), 3582); +assertEquals("ab,", res[1241].exec("ab"), 3583); +assertEquals(null, res[1241].exec("Ab", 3584)); +assertEquals(null, res[1241].exec("Ab", 3585)); +assertEquals(null, res[1241].exec("*** Failers", 3586)); +assertEquals(null, res[1241].exec("aB", 3587)); +assertEquals(null, res[1241].exec("aB", 3588)); +assertEquals("ab,", res[1241].exec("ab"), 3589); +assertEquals("ab,", res[1241].exec("ab"), 3590); +assertEquals(null, res[1241].exec("aB", 3591)); +assertEquals(null, res[1241].exec("aB", 3592)); +assertEquals(null, res[1241].exec("*** Failers", 3593)); +assertEquals(null, res[1241].exec("aB", 3594)); +assertEquals(null, res[1241].exec("Ab", 3595)); +assertEquals(null, res[1241].exec("aB", 3596)); +assertEquals(null, res[1241].exec("aB", 3597)); +assertEquals(null, res[1241].exec("*** Failers", 3598)); +assertEquals(null, res[1241].exec("Ab", 3599)); +assertEquals(null, res[1241].exec("AB", 3600)); +assertEquals("ab,", res[1241].exec("ab"), 3601); +assertEquals("ab,", res[1241].exec("ab"), 3602); +assertEquals(null, res[1241].exec("aB", 3603)); +assertEquals(null, res[1241].exec("aB", 3604)); +assertEquals(null, res[1241].exec("*** Failers", 3605)); +assertEquals(null, res[1241].exec("AB", 3606)); +assertEquals(null, res[1241].exec("Ab", 3607)); +assertEquals(null, res[1241].exec("aB", 3608)); +assertEquals(null, res[1241].exec("aB", 3609)); +assertEquals(null, res[1241].exec("*** Failers", 3610)); +assertEquals(null, res[1241].exec("Ab", 3611)); +assertEquals(null, res[1241].exec("AB", 3612)); +assertEquals(null, res[1241].exec("*** Failers", 3613)); +assertEquals(null, res[1241].exec("AB", 3614)); +assertEquals(null, res[1241].exec("a\nB", 3615)); +assertEquals(null, res[1241].exec("a\nB", 3616)); +assertEquals("cabbbb", res[1242].exec("cabbbb"), 3617); +assertEquals("caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb", res[1243].exec("caaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"), 3618); +assertEquals("foobar1234baz", res[1244].exec("foobar1234baz"), 3619); +assertEquals("x~~,~~", res[1245].exec("x~~"), 3620); +assertEquals("aaac", res[1246].exec("aaac"), 3621); +assertEquals("aaac", res[1247].exec("aaac"), 3622); +assertEquals(null, res[1247].exec("*** Failers", 3623)); +assertEquals(null, res[1247].exec("B\nB", 3624)); +assertEquals(null, res[1247].exec("dbcb", 3625)); +assertEquals(null, res[1247].exec("dbaacb", 3626)); +assertEquals(null, res[1247].exec("dbaacb", 3627)); +assertEquals(null, res[1247].exec("cdaccb", 3628)); +assertEquals(null, res[1248].exec("*** Failers", 3629)); +assertEquals(null, res[1248].exec("dbcb", 3630)); +assertEquals(null, res[1248].exec("a--", 3631)); +assertEquals(null, res[1248].exec("a\nb\nc\n", 3632)); +assertEquals(null, res[1248].exec("a\nb\nc\n", 3633)); +assertEquals(null, res[1248].exec("a\nb\n", 3634)); +assertEquals(null, res[1248].exec("a\nb\n", 3635)); +assertEquals(null, res[1248].exec("a\nb\n", 3636)); +assertEquals(null, res[1248].exec("a\nb\n", 3637)); +assertEquals(null, res[1248].exec("a\nb\nc\n", 3638)); +assertEquals(null, res[1248].exec("a\nb\nc\n", 3639)); +assertEquals(null, res[1248].exec("a\nb\nc\n", 3640)); +assertEquals(null, res[1248].exec("a\nb\nc\n", 3641)); +assertEquals(null, res[1250].exec("*** Failers", 3642)); +assertEquals(null, res[1250].exec("a\nb\nc\n", 3643)); +assertEquals(null, res[1250].exec("a\nb\nc\n", 3644)); +assertEquals(null, res[1250].exec("a\nb\nc\n", 3645)); +assertEquals(null, res[1250].exec("a", 3646)); +assertEquals(null, res[1250].exec("*** Failers", 3647)); +assertEquals(null, res[1250].exec("a", 3648)); +assertEquals(null, res[1250].exec("a", 3649)); +assertEquals(null, res[1250].exec("a", 3650)); +assertEquals("one:,one:", res[1251].exec("one:"), 3651); +assertEquals(null, res[1251].exec("a", 3652)); +assertEquals("abcd,,abcd", res[1252].exec("abcd"), 3653); +assertEquals("xy:z:::abcd,xy:z:::,abcd", res[1252].exec("xy:z:::abcd"), 3654); +assertEquals("aexyc,c", res[1253].exec("aexycd"), 3655); +assertEquals("aab,aa", res[1254].exec("caab"), 3656); +assertEquals("abcd,,abcd", res[1255].exec("abcd"), 3657); +assertEquals("xy:z:::abcd,xy:z:::,abcd", res[1255].exec("xy:z:::abcd"), 3658); +assertEquals("Failers,,Failers", res[1255].exec("*** Failers"), 3659); +assertEquals(null, res[1255].exec("abcd:", 3660)); +assertEquals(null, res[1255].exec("abcd:", 3661)); +assertEquals("aexyc,c", res[1256].exec("aexycd"), 3662); +assertEquals(null, res[1257].exec("aaab", 3663)); +assertEquals(":[,:[", res[1258].exec("a:[b]:"), 3664); +assertEquals("=[,=[", res[1259].exec("a=[b]="), 3665); +assertEquals(".[,.[", res[1260].exec("a.[b]."), 3666); +assertEquals(null, res[1260].exec("aaab", 3667)); +assertEquals(null, res[1260].exec("aaab", 3668)); +assertEquals(null, res[1260].exec("((abc(ade)ufh()()x", 3669)); +assertEquals(null, res[1261].exec("*** Failers", 3670)); +assertEquals(null, res[1261].exec("aaab", 3671)); +assertEquals(null, res[1261].exec("a\nb\n", 3672)); +assertEquals(null, res[1262].exec("a\nb\n", 3673)); +assertEquals(null, res[1264].exec("a\nb", 3674)); +assertEquals(null, res[1265].exec("a\nb", 3675)); +assertEquals(null, res[1265].exec("*** Failers", 3676)); +assertEquals(null, res[1265].exec("alphabetabcd", 3677)); +assertEquals(null, res[1265].exec("endingwxyz", 3678)); +assertEquals(null, res[1265].exec("*** Failers", 3679)); +assertEquals(null, res[1265].exec("a rather long string that doesn't end with one of them", 3680)); +assertEquals(null, res[1265].exec("word cat dog elephant mussel cow horse canary baboon snake shark otherword", 3681)); +assertEquals(null, res[1265].exec("word cat dog elephant mussel cow horse canary baboon snake shark", 3682)); +assertEquals(null, res[1265].exec("word cat dog elephant mussel cow horse canary baboon snake shark the quick brown fox and the lazy dog and several other words getting close to thirty by now I hope", 3683)); +assertEquals(null, res[1265].exec("999foo", 3684)); +assertEquals(null, res[1265].exec("123999foo ", 3685)); +assertEquals(null, res[1265].exec("*** Failers", 3686)); +assertEquals(null, res[1265].exec("123abcfoo", 3687)); +assertEquals(null, res[1265].exec("999foo", 3688)); +assertEquals(null, res[1265].exec("123999foo ", 3689)); +assertEquals(null, res[1265].exec("*** Failers", 3690)); +assertEquals(null, res[1265].exec("123abcfoo", 3691)); +assertEquals(null, res[1265].exec("123abcfoo", 3692)); +assertEquals(null, res[1265].exec("123456foo ", 3693)); +assertEquals(null, res[1265].exec("*** Failers", 3694)); +assertEquals(null, res[1265].exec("123999foo ", 3695)); +assertEquals(null, res[1265].exec("123abcfoo ", 3696)); +assertEquals(null, res[1265].exec("123456foo ", 3697)); +assertEquals(null, res[1265].exec("*** Failers", 3698)); +assertEquals(null, res[1265].exec("123999foo ", 3699)); +assertEquals("ZA,A,", res[1266].exec("ZABCDEFG"), 3700); +assertEquals("ZA,A,", res[1267].exec("ZABCDEFG"), 3701); +assertEquals("ZA,A,,", res[1268].exec("ZABCDEFG"), 3702); +assertEquals("ZA,A,,", res[1268].exec("ZABCDEFG"), 3703); +assertEquals("ZA,A,,", res[1268].exec("ZABCDEFG"), 3704); +assertEquals("a", res[1269].exec("abbab"), 3705); +assertEquals("", res[1269].exec("abcde"), 3706); +assertEquals("", res[1269].exec("-things"), 3707); +assertEquals("", res[1269].exec("0digit"), 3708); +assertEquals("", res[1269].exec("*** Failers"), 3709); +assertEquals("", res[1269].exec("bcdef "), 3710); +assertEquals("a", res[1270].exec("abcde"), 3711); +assertEquals("-", res[1270].exec("-things"), 3712); +assertEquals("0", res[1270].exec("0digit"), 3713); +assertEquals(null, res[1270].exec("*** Failers", 3714)); +assertEquals(null, res[1270].exec("bcdef ", 3715)); +assertEquals(null, res[1271].exec("> \x09\n\x0c\x0d\x0b<", 3716)); +assertEquals(null, res[1271].exec(" ", 3717)); +assertEquals(null, res[1272].exec("> \x09\n\x0c\x0d\x0b<", 3718)); +assertEquals(null, res[1272].exec(" ", 3719)); +assertEquals(" \x09\n\x0c\x0d\x0b", res[1273].exec("> \x09\n\x0c\x0d\x0b<"), 3720); +assertEquals(" ", res[1273].exec(" "), 3721); +assertEquals(" \x09\n\x0c\x0d\x0b", res[1274].exec("> \x09\n\x0c\x0d\x0b<"), 3722); +assertEquals(" ", res[1274].exec(" "), 3723); +assertEquals(null, res[1275].exec("ab", 3724)); +assertEquals(null, res[1278].exec("abcabcabc", 3725)); +assertEquals(null, res[1278].exec("abc(*+|abc ", 3726)); +assertEquals(null, res[1279].exec("abc abcabc", 3727)); +assertEquals(null, res[1279].exec("*** Failers", 3728)); +assertEquals(null, res[1279].exec("abcabcabc ", 3729)); +assertEquals(null, res[1280].exec("abc#not comment\n literal ", 3730)); +assertEquals(null, res[1281].exec("abc#not comment\n literal ", 3731)); +assertEquals(null, res[1282].exec("abc#not comment\n literal ", 3732)); +assertEquals(null, res[1283].exec("abc#not comment\n literal ", 3733)); +assertEquals(null, res[1284].exec("abc\\$xyz", 3734)); +assertEquals(null, res[1285].exec("abc$xyz", 3735)); +assertEquals(null, res[1286].exec("abc", 3736)); +assertEquals(null, res[1286].exec("*** Failers", 3737)); +assertEquals(null, res[1286].exec("xyzabc ", 3738)); +assertEquals(null, res[1287].exec("abc1abc2xyzabc3", 3739)); +assertEquals("abc1", res[1288].exec("abc1abc2xyzabc3 "), 3740); +assertEquals(null, res[1288].exec("XabcdY", 3741)); +assertEquals(null, res[1288].exec("*** Failers ", 3742)); +assertEquals(null, res[1288].exec("Xa b c d Y ", 3743)); +assertEquals("abcY", res[1288].exec("XabcY"), 3744); +assertEquals(null, res[1288].exec("AxyzB ", 3745)); +assertEquals(null, res[1288].exec("XabCY", 3746)); +assertEquals(null, res[1288].exec("*** Failers", 3747)); +assertEquals("abcY", res[1288].exec("XabcY "), 3748); +assertEquals(null, res[1288].exec("abCE", 3749)); +assertEquals(null, res[1288].exec("DE", 3750)); +assertEquals(null, res[1288].exec("*** Failers", 3751)); +assertEquals("abcE", res[1288].exec("abcE"), 3752); +assertEquals(null, res[1288].exec("abCe ", 3753)); +assertEquals(null, res[1288].exec("dE", 3754)); +assertEquals(null, res[1288].exec("De ", 3755)); +assertEquals(null, res[1289].exec("z", 3756)); +assertEquals(null, res[1289].exec("a", 3757)); +assertEquals(null, res[1289].exec("-", 3758)); +assertEquals(null, res[1289].exec("d", 3759)); +assertEquals(null, res[1289].exec("] ", 3760)); +assertEquals(null, res[1289].exec("*** Failers", 3761)); +assertEquals(null, res[1289].exec("b ", 3762)); +assertEquals("z", res[1290].exec("z"), 3763); +assertEquals("C", res[1290].exec("C "), 3764); +assertEquals("M", res[1291].exec("M "), 3765); +assertEquals(null, res[1292].exec("", 3766)); +assertEquals(null, res[1292].exec("REGular", 3767)); +assertEquals(null, res[1292].exec("regulaer", 3768)); +assertEquals(null, res[1292].exec("Regex ", 3769)); +assertEquals(null, res[1292].exec("regul\ufffdr ", 3770)); +assertEquals(null, res[1292].exec("\ufffd\ufffd\ufffd\ufffd\ufffd", 3771)); +assertEquals(null, res[1292].exec("\ufffd\ufffd\ufffd\ufffd\ufffd", 3772)); +assertEquals(null, res[1292].exec("\ufffd\ufffd\ufffd\ufffd\ufffd", 3773)); +assertEquals(null, res[1292].exec("\ufffd\ufffd\ufffd\ufffd\ufffd", 3774)); +assertEquals(null, res[1292].exec("\x84XAZXB", 3775)); +assertEquals(null, res[1292].exec("123a", 3776)); +assertEquals(null, res[1292].exec("ac", 3777)); +assertEquals("b,", res[1292].exec("bbbbc"), 3778); +assertEquals("ab,a", res[1292].exec("abc"), 3779); +assertEquals(null, res[1292].exec("*** Failers", 3780)); +assertEquals("b,", res[1292].exec("bca"), 3781); +assertEquals(null, res[1292].exec("", 3782)); +assertEquals("ab,a", res[1292].exec("abc"), 3783); +assertEquals(null, res[1292].exec("*** Failers", 3784)); +assertEquals("b,", res[1292].exec("bca"), 3785); +assertEquals("ab,a", res[1292].exec("abc"), 3786); +assertEquals(null, res[1292].exec("*** Failers", 3787)); +assertEquals(null, res[1292].exec("def ", 3788)); +assertEquals(null, res[1292].exec("", 3789)); +assertEquals("ab,a", res[1292].exec("abc"), 3790); +assertEquals(null, res[1292].exec("*** Failers", 3791)); +assertEquals(null, res[1292].exec("def ", 3792)); +assertEquals(null, res[1292].exec("", 3793)); +assertEquals("line\nbreak", res[1293].exec("this is a line\nbreak"), 3794); +assertEquals("line\nbreak", res[1293].exec("line one\nthis is a line\nbreak in the second line "), 3795); +assertEquals("line\nbreak", res[1294].exec("this is a line\nbreak"), 3796); +assertEquals(null, res[1294].exec("** Failers ", 3797)); +assertEquals("line\nbreak", res[1294].exec("line one\nthis is a line\nbreak in the second line "), 3798); +assertEquals("line\nbreak", res[1295].exec("this is a line\nbreak"), 3799); +assertEquals(null, res[1295].exec("** Failers ", 3800)); +assertEquals("line\nbreak", res[1295].exec("line one\nthis is a line\nbreak in the second line "), 3801); +assertEquals(null, res[1296].exec("123P", 3802)); +assertEquals(null, res[1296].exec("a4PR", 3803)); +assertEquals(null, res[1297].exec("123P", 3804)); +assertEquals(null, res[1297].exec("4PR", 3805)); +assertEquals("", res[1298].exec("a\nb\nc\n"), 3806); +assertEquals("", res[1298].exec(" "), 3807); +assertEquals("", res[1298].exec("A\nC\nC\n "), 3808); +assertEquals("", res[1298].exec("AB"), 3809); +assertEquals("", res[1298].exec("aB "), 3810); +assertEquals("", res[1298].exec("AB"), 3811); +assertEquals("", res[1298].exec("aB "), 3812); +assertEquals("", res[1298].exec("AB"), 3813); +assertEquals("", res[1298].exec("aB "), 3814); +assertEquals("", res[1298].exec("AB"), 3815); +assertEquals("", res[1298].exec("aB "), 3816); +assertEquals("Content-Type:xxxxxyyy ", res[1299].exec("Content-Type:xxxxxyyy "), 3817); +assertEquals("Content-Type:xxxxxyyyz", res[1300].exec("Content-Type:xxxxxyyyz"), 3818); +assertEquals("Content-Type:xxxyyy ", res[1301].exec("Content-Type:xxxyyy "), 3819); +assertEquals("Content-Type:xxxyyyz", res[1302].exec("Content-Type:xxxyyyz"), 3820); +assertEquals("abc", res[1303].exec("xyz\nabc"), 3821); +assertEquals("abc", res[1303].exec("xyz\nabc<lf>"), 3822); +assertEquals("abc", res[1303].exec("xyz\x0d\nabc<lf>"), 3823); +assertEquals("abc", res[1303].exec("xyz\x0dabc<cr>"), 3824); +assertEquals("abc", res[1303].exec("xyz\x0d\nabc<crlf>"), 3825); +assertEquals(null, res[1303].exec("** Failers ", 3826)); +assertEquals("abc", res[1303].exec("xyz\nabc<cr>"), 3827); +assertEquals("abc", res[1303].exec("xyz\x0d\nabc<cr>"), 3828); +assertEquals("abc", res[1303].exec("xyz\nabc<crlf>"), 3829); +assertEquals("abc", res[1303].exec("xyz\x0dabc<crlf>"), 3830); +assertEquals("abc", res[1303].exec("xyz\x0dabc<lf>"), 3831); +assertEquals("abc", res[1304].exec("xyzabc"), 3832); +assertEquals("abc", res[1304].exec("xyzabc\n "), 3833); +assertEquals("abc", res[1304].exec("xyzabc\npqr "), 3834); +assertEquals("abc", res[1304].exec("xyzabc\x0d<cr> "), 3835); +assertEquals("abc", res[1304].exec("xyzabc\x0dpqr<cr> "), 3836); +assertEquals("abc", res[1304].exec("xyzabc\x0d\n<crlf> "), 3837); +assertEquals("abc", res[1304].exec("xyzabc\x0d\npqr<crlf> "), 3838); +assertEquals(null, res[1304].exec("** Failers", 3839)); +assertEquals("abc", res[1304].exec("xyzabc\x0d "), 3840); +assertEquals("abc", res[1304].exec("xyzabc\x0dpqr "), 3841); +assertEquals("abc", res[1304].exec("xyzabc\x0d\n "), 3842); +assertEquals("abc", res[1304].exec("xyzabc\x0d\npqr "), 3843); +assertEquals("abc", res[1305].exec("xyz\x0dabcdef"), 3844); +assertEquals("abc", res[1305].exec("xyz\nabcdef<lf>"), 3845); +assertEquals(null, res[1305].exec("** Failers ", 3846)); +assertEquals("abc", res[1305].exec("xyz\nabcdef"), 3847); +assertEquals(null, res[1305].exec(" ", 3848)); +assertEquals("abc", res[1306].exec("xyz\nabcdef"), 3849); +assertEquals("abc", res[1306].exec("xyz\x0dabcdef<cr>"), 3850); +assertEquals(null, res[1306].exec("** Failers ", 3851)); +assertEquals("abc", res[1306].exec("xyz\x0dabcdef"), 3852); +assertEquals(null, res[1306].exec(" ", 3853)); +assertEquals("abc", res[1307].exec("xyz\x0d\nabcdef"), 3854); +assertEquals("abc", res[1307].exec("xyz\x0dabcdef<cr>"), 3855); +assertEquals(null, res[1307].exec("** Failers ", 3856)); +assertEquals("abc", res[1307].exec("xyz\x0dabcdef"), 3857); +assertEquals("abc", res[1308].exec("abc\ndef"), 3858); +assertEquals("abc", res[1308].exec("abc\x0ddef"), 3859); +assertEquals("abc", res[1308].exec("abc\x0d\ndef"), 3860); +assertEquals("<cr>abc", res[1308].exec("<cr>abc\ndef"), 3861); +assertEquals("<cr>abc", res[1308].exec("<cr>abc\x0ddef"), 3862); +assertEquals("<cr>abc", res[1308].exec("<cr>abc\x0d\ndef"), 3863); +assertEquals("<crlf>abc", res[1308].exec("<crlf>abc\ndef"), 3864); +assertEquals("<crlf>abc", res[1308].exec("<crlf>abc\x0ddef"), 3865); +assertEquals("<crlf>abc", res[1308].exec("<crlf>abc\x0d\ndef"), 3866); +assertEquals(null, res[1309].exec("abc\ndef", 3867)); +assertEquals(null, res[1309].exec("abc\x0ddef", 3868)); +assertEquals(null, res[1309].exec("abc\x0d\ndef", 3869)); +assertEquals("abc=xyz\\,", res[1310].exec("abc=xyz\\\npqr"), 3870); +assertEquals("aaaa,a,", res[1311].exec("aaaa"), 3871); +assertEquals("aaaa", res[1312].exec("aaaa"), 3872); +assertEquals("aaaa,a,", res[1313].exec("aaaa"), 3873); +assertEquals("aaaa", res[1314].exec("aaaa"), 3874); +assertEquals(null, res[1317].exec("a\x0db", 3875)); +assertEquals(null, res[1317].exec("a\nb<cr> ", 3876)); +assertEquals(null, res[1317].exec("** Failers", 3877)); +assertEquals(null, res[1317].exec("a\nb", 3878)); +assertEquals(null, res[1317].exec("a\nb<any>", 3879)); +assertEquals(null, res[1317].exec("a\x0db<cr> ", 3880)); +assertEquals(null, res[1317].exec("a\x0db<any> ", 3881)); +assertEquals("abc1", res[1318].exec("abc1 \nabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\nabc6 \x85abc7 JUNK"), 3882); +assertEquals("abc1", res[1319].exec("abc1\n abc2\x0b abc3\x0c abc4\x0d abc5\x0d\n abc6\x85 abc9"), 3883); +assertEquals(null, res[1320].exec("a\nb", 3884)); +assertEquals(null, res[1320].exec("a\x0db", 3885)); +assertEquals(null, res[1320].exec("a\x0d\nb", 3886)); +assertEquals(null, res[1320].exec("a\x0bb", 3887)); +assertEquals(null, res[1320].exec("a\x0cb", 3888)); +assertEquals(null, res[1320].exec("a\x85b ", 3889)); +assertEquals(null, res[1320].exec("** Failers", 3890)); +assertEquals(null, res[1320].exec("a\n\x0db ", 3891)); +assertEquals("ab", res[1321].exec("ab"), 3892); +assertEquals(null, res[1321].exec("a\nb", 3893)); +assertEquals(null, res[1321].exec("a\x0db", 3894)); +assertEquals(null, res[1321].exec("a\x0d\nb", 3895)); +assertEquals(null, res[1321].exec("a\x0bb", 3896)); +assertEquals(null, res[1321].exec("a\x0cb", 3897)); +assertEquals(null, res[1321].exec("a\x85b ", 3898)); +assertEquals(null, res[1321].exec("a\n\x0db ", 3899)); +assertEquals(null, res[1321].exec("a\n\x0d\x85\x0cb ", 3900)); +assertEquals(null, res[1322].exec("a\nb", 3901)); +assertEquals(null, res[1322].exec("a\x0db", 3902)); +assertEquals(null, res[1322].exec("a\x0d\nb", 3903)); +assertEquals(null, res[1322].exec("a\x0bb", 3904)); +assertEquals(null, res[1322].exec("a\x0cb", 3905)); +assertEquals(null, res[1322].exec("a\x85b ", 3906)); +assertEquals(null, res[1322].exec("a\n\x0db ", 3907)); +assertEquals(null, res[1322].exec("a\n\x0d\x85\x0cb ", 3908)); +assertEquals(null, res[1322].exec("** Failers", 3909)); +assertEquals(null, res[1322].exec("ab ", 3910)); +assertEquals(null, res[1323].exec("a\nb", 3911)); +assertEquals(null, res[1323].exec("a\n\x0db", 3912)); +assertEquals(null, res[1323].exec("a\n\x0d\x85b", 3913)); +assertEquals(null, res[1323].exec("a\x0d\n\x0d\nb ", 3914)); +assertEquals(null, res[1323].exec("a\x0d\n\x0d\n\x0d\nb ", 3915)); +assertEquals(null, res[1323].exec("a\n\x0d\n\x0db", 3916)); +assertEquals(null, res[1323].exec("a\n\n\x0d\nb ", 3917)); +assertEquals(null, res[1323].exec("** Failers", 3918)); +assertEquals(null, res[1323].exec("a\n\n\n\x0db", 3919)); +assertEquals(null, res[1323].exec("a\x0d", 3920)); +assertEquals("aRb", res[1324].exec("aRb"), 3921); +assertEquals(null, res[1324].exec("** Failers", 3922)); +assertEquals(null, res[1324].exec("a\nb ", 3923)); +assertEquals("afoo", res[1325].exec("afoo"), 3924); +assertEquals(null, res[1325].exec("** Failers ", 3925)); +assertEquals(null, res[1325].exec("\x0d\nfoo ", 3926)); +assertEquals(null, res[1325].exec("\nfoo ", 3927)); +assertEquals("afoo", res[1326].exec("afoo"), 3928); +assertEquals(null, res[1326].exec("\nfoo ", 3929)); +assertEquals(null, res[1326].exec("** Failers ", 3930)); +assertEquals(null, res[1326].exec("\x0d\nfoo ", 3931)); +assertEquals("afoo", res[1327].exec("afoo"), 3932); +assertEquals(null, res[1327].exec("** Failers ", 3933)); +assertEquals(null, res[1327].exec("\nfoo ", 3934)); +assertEquals(null, res[1327].exec("\x0d\nfoo ", 3935)); +assertEquals("afoo", res[1328].exec("afoo"), 3936); +assertEquals(null, res[1328].exec("\x0d\nfoo ", 3937)); +assertEquals(null, res[1328].exec("\nfoo ", 3938)); +assertEquals("", res[1329].exec("abc\x0d\x0dxyz"), 3939); +assertEquals("", res[1329].exec("abc\n\x0dxyz "), 3940); +assertEquals(null, res[1329].exec("** Failers ", 3941)); +assertEquals("", res[1329].exec("abc\x0d\nxyz"), 3942); +assertEquals("X", res[1330].exec("XABC"), 3943); +assertEquals(null, res[1330].exec("** Failers ", 3944)); +assertEquals("X", res[1330].exec("XABCB"), 3945); +assertEquals(null, res[1330].exec("abc\x0d\n\x0d\n", 3946)); +assertEquals(null, res[1330].exec("abc\x0d\n\x0d\n", 3947)); +assertEquals(null, res[1330].exec("abc\x0d\n\x0d\n", 3948)); +assertThrows("var re = /(?|(abc)|(xyz))/;", 3949); +assertThrows("var re = /(x)(?|(abc)|(xyz))(x)/;", 3950); +assertEquals(null, res[1330].exec("xabcx", 3951)); +assertEquals(null, res[1330].exec("xxyzx ", 3952)); +assertThrows("var re = /(x)(?|(abc)(pqr)|(xyz))(x)/;", 3953); +assertEquals(null, res[1330].exec("xabcpqrx", 3954)); +assertEquals(null, res[1330].exec("xxyzx ", 3955)); +assertEquals(null, res[1330].exec("abcabc", 3956)); +assertEquals(null, res[1330].exec("xyzabc ", 3957)); +assertEquals(null, res[1330].exec("** Failers ", 3958)); +assertEquals(null, res[1330].exec("xyzxyz ", 3959)); +assertEquals(null, res[1331].exec("X X\n", 3960)); +assertEquals(null, res[1331].exec("X\x09X\x0b", 3961)); +assertEquals(null, res[1331].exec("** Failers", 3962)); +assertEquals(null, res[1331].exec("\xa0 X\n ", 3963)); +assertEquals(null, res[1332].exec("\x09 \xa0X\n\x0b\x0c\x0d\n", 3964)); +assertEquals(null, res[1332].exec("\x09 \xa0\n\x0b\x0c\x0d\n", 3965)); +assertEquals(null, res[1332].exec("\x09 \xa0\n\x0b\x0c", 3966)); +assertEquals(null, res[1332].exec("** Failers ", 3967)); +assertEquals(null, res[1332].exec("\x09 \xa0\n\x0b", 3968)); +assertEquals(null, res[1332].exec(" ", 3969)); +assertEquals(null, res[1333].exec("XY ABCDE", 3970)); +assertEquals(null, res[1333].exec("XY PQR ST ", 3971)); +assertEquals(null, res[1334].exec("XY AB PQRS", 3972)); +assertEquals(null, res[1335].exec(">XNNNYZ", 3973)); +assertEquals(null, res[1335].exec("> X NYQZ", 3974)); +assertEquals(null, res[1335].exec("** Failers", 3975)); +assertEquals(null, res[1335].exec(">XYZ ", 3976)); +assertEquals(null, res[1335].exec("> X NY Z", 3977)); +assertEquals(null, res[1336].exec(">XY\nZ\nA\x0bNN\x0c", 3978)); +assertEquals(null, res[1336].exec(">\n\x0dX\nY\n\x0bZZZ\nAAA\x0bNNN\x0c", 3979)); +assertEquals(null, res[1337].exec("\x0d\nA", 3980)); +assertEquals("\nA", res[1338].exec("\x0d\nA "), 3981); +assertEquals("\nA", res[1339].exec("\x0d\nA "), 3982); +assertEquals("\nA,\n", res[1340].exec("\x0d\nA "), 3983); +assertEquals(null, res[1341].exec("a\x0db", 3984)); +assertEquals(null, res[1341].exec("a\nb", 3985)); +assertEquals(null, res[1341].exec("a\x0d\nb", 3986)); +assertEquals(null, res[1341].exec("** Failers", 3987)); +assertEquals(null, res[1341].exec("a\x85b", 3988)); +assertEquals(null, res[1341].exec("a\x0bb ", 3989)); +assertEquals(null, res[1342].exec("a\x0db", 3990)); +assertEquals(null, res[1342].exec("a\nb", 3991)); +assertEquals(null, res[1342].exec("a\x0d\nb", 3992)); +assertEquals(null, res[1342].exec("a\x85b", 3993)); +assertEquals(null, res[1342].exec("a\x0bb ", 3994)); +assertEquals(null, res[1342].exec("** Failers ", 3995)); +assertEquals(null, res[1342].exec("a\x85b<bsr_anycrlf>", 3996)); +assertEquals(null, res[1342].exec("a\x0bb<bsr_anycrlf>", 3997)); +assertEquals(null, res[1343].exec("a\x0db", 3998)); +assertEquals(null, res[1343].exec("a\nb", 3999)); +assertEquals(null, res[1343].exec("a\x0d\nb", 4000)); +assertEquals(null, res[1343].exec("** Failers", 4001)); +assertEquals(null, res[1343].exec("a\x85b", 4002)); +assertEquals(null, res[1343].exec("a\x0bb ", 4003)); +assertEquals(null, res[1344].exec("a\x0db", 4004)); +assertEquals(null, res[1344].exec("a\nb", 4005)); +assertEquals(null, res[1344].exec("a\x0d\nb", 4006)); +assertEquals(null, res[1344].exec("a\x85b", 4007)); +assertEquals(null, res[1344].exec("a\x0bb ", 4008)); +assertEquals(null, res[1344].exec("** Failers ", 4009)); +assertEquals(null, res[1344].exec("a\x85b<bsr_anycrlf>", 4010)); +assertEquals(null, res[1344].exec("a\x0bb<bsr_anycrlf>", 4011)); +assertEquals(null, res[1345].exec("a\x0d\n\nb", 4012)); +assertEquals(null, res[1345].exec("a\n\x0d\x0db", 4013)); +assertEquals(null, res[1345].exec("a\x0d\n\x0d\n\x0d\n\x0d\nb", 4014)); +assertEquals(null, res[1345].exec("** Failers", 4015)); +assertEquals(null, res[1345].exec("a\x8585b", 4016)); +assertEquals(null, res[1345].exec("a\x0b\x00bb ", 4017)); +assertEquals(null, res[1346].exec("a\x0d\x0db", 4018)); +assertEquals(null, res[1346].exec("a\n\n\nb", 4019)); +assertEquals(null, res[1346].exec("a\x0d\n\n\x0d\x0db", 4020)); +assertEquals(null, res[1346].exec("a\x8585b", 4021)); +assertEquals(null, res[1346].exec("a\x0b\x00bb ", 4022)); +assertEquals(null, res[1346].exec("** Failers ", 4023)); +assertEquals(null, res[1346].exec("a\x0d\x0d\x0d\x0d\x0db ", 4024)); +assertEquals(null, res[1346].exec("a\x8585b<bsr_anycrlf>", 4025)); +assertEquals(null, res[1346].exec("a\x0b\x00bb<bsr_anycrlf>", 4026)); +assertEquals("abc", res[1347].exec("abc "), 4027); +assertEquals(null, res[1348].exec("** Failers", 4028)); +assertEquals(null, res[1348].exec("ab", 4029)); +assertEquals(null, res[1349].exec("** Failers", 4030)); +assertEquals(null, res[1349].exec("ab ", 4031)); +assertEquals(null, res[1349].exec("** Failers", 4032)); +assertEquals(null, res[1349].exec("ab ", 4033)); +assertEquals("aXb", res[1350].exec("aXb"), 4034); +assertEquals("a\nb", res[1350].exec("a\nb "), 4035); +assertEquals(null, res[1350].exec("** Failers", 4036)); +assertEquals(null, res[1350].exec("ab ", 4037)); +assertEquals("aXb", res[1351].exec("aXb"), 4038); +assertEquals("a\nX\nXb", res[1351].exec("a\nX\nXb "), 4039); +assertEquals(null, res[1351].exec("** Failers", 4040)); +assertEquals(null, res[1351].exec("ab ", 4041)); +assertEquals(null, res[1352].exec("ab", 4042)); +assertEquals(null, res[1352].exec("ax{100}b ", 4043)); +assertEquals(null, res[1352].exec("ax{100}x{100}b ", 4044)); +assertEquals(null, res[1352].exec("ax{100}b ", 4045)); +assertEquals(null, res[1352].exec("ax{100}x{100}b ", 4046)); +assertEquals(null, res[1352].exec("*** Failers ", 4047)); +assertEquals(null, res[1352].exec("ab", 4048)); +assertEquals(null, res[1352].exec(" ", 4049)); +assertEquals("X", res[1353].exec("Xoanon"), 4050); +assertEquals("X", res[1353].exec("+Xoanon"), 4051); +assertEquals("X", res[1353].exec("x{300}Xoanon "), 4052); +assertEquals(null, res[1353].exec("*** Failers ", 4053)); +assertEquals(null, res[1353].exec("YXoanon ", 4054)); +assertEquals("X", res[1354].exec("YXoanon"), 4055); +assertEquals(null, res[1354].exec("*** Failers", 4056)); +assertEquals(null, res[1354].exec("Xoanon", 4057)); +assertEquals(null, res[1354].exec("+Xoanon ", 4058)); +assertEquals(null, res[1354].exec("x{300}Xoanon ", 4059)); +assertEquals("X", res[1355].exec("X+oanon"), 4060); +assertEquals(null, res[1355].exec("ZXx{300}oanon ", 4061)); +assertEquals("X", res[1355].exec("FAX "), 4062); +assertEquals(null, res[1355].exec("*** Failers ", 4063)); +assertEquals(null, res[1355].exec("Xoanon ", 4064)); +assertEquals("X", res[1356].exec("Xoanon "), 4065); +assertEquals(null, res[1356].exec("*** Failers", 4066)); +assertEquals(null, res[1356].exec("X+oanon", 4067)); +assertEquals("X", res[1356].exec("ZXx{300}oanon "), 4068); +assertEquals(null, res[1356].exec("FAX ", 4069)); +assertEquals("b", res[1357].exec("abcd"), 4070); +assertEquals("x", res[1357].exec("ax{100} "), 4071); +assertEquals("b", res[1357].exec("ab99"), 4072); +assertEquals("x", res[1357].exec("x{123}x{123}45"), 4073); +assertEquals("x", res[1357].exec("x{400}x{401}x{402}6 "), 4074); +assertEquals("*", res[1357].exec("*** Failers"), 4075); +assertEquals("d", res[1357].exec("d99"), 4076); +assertEquals("x", res[1357].exec("x{123}x{122}4 "), 4077); +assertEquals("x", res[1357].exec("x{400}x{403}6 "), 4078); +assertEquals("x", res[1357].exec("x{400}x{401}x{402}x{402}6 "), 4079); +assertEquals(null, res[1358].exec("\ufffd]", 4080)); +assertEquals(null, res[1358].exec("\ufffd", 4081)); +assertEquals(null, res[1358].exec("\ufffd\ufffd\ufffd", 4082)); +assertEquals(null, res[1358].exec("\ufffd\ufffd\ufffd?", 4083)); +assertEquals("acb", res[1359].exec("acb"), 4084); +assertEquals("ab", res[1359].exec("ab"), 4085); +assertEquals(null, res[1359].exec("ax{100}b ", 4086)); +assertEquals(null, res[1359].exec("*** Failers", 4087)); +assertEquals(null, res[1359].exec("a\nb ", 4088)); +assertEquals(null, res[1360].exec("ax{4000}xyb ", 4089)); +assertEquals(null, res[1360].exec("ax{4000}yb ", 4090)); +assertEquals(null, res[1360].exec("ax{4000}x{100}yb ", 4091)); +assertEquals(null, res[1360].exec("*** Failers", 4092)); +assertEquals(null, res[1360].exec("ax{4000}b ", 4093)); +assertEquals(null, res[1360].exec("ac\ncb ", 4094)); +assertEquals("a\xc0,,\xc0", res[1361].exec("a\xc0\x88b"), 4095); +assertEquals("ax,,x", res[1362].exec("ax{100}b"), 4096); +assertEquals("a\xc0\x88b,\xc0\x88,b", res[1363].exec("a\xc0\x88b"), 4097); +assertEquals("ax{100}b,x{100},b", res[1364].exec("ax{100}b"), 4098); +assertEquals("a\xc0\x92,\xc0,\x92", res[1365].exec("a\xc0\x92bcd"), 4099); +assertEquals("ax{,x,{", res[1366].exec("ax{240}bcd"), 4100); +assertEquals("a\xc0\x92,\xc0,\x92", res[1367].exec("a\xc0\x92bcd"), 4101); +assertEquals("ax{,x,{", res[1368].exec("ax{240}bcd"), 4102); +assertEquals("a\xc0,,\xc0", res[1369].exec("a\xc0\x92bcd"), 4103); +assertEquals("ax,,x", res[1370].exec("ax{240}bcd"), 4104); +assertEquals(null, res[1371].exec("ax{1234}xyb ", 4105)); +assertEquals(null, res[1371].exec("ax{1234}x{4321}yb ", 4106)); +assertEquals(null, res[1371].exec("ax{1234}x{4321}x{3412}b ", 4107)); +assertEquals(null, res[1371].exec("*** Failers", 4108)); +assertEquals(null, res[1371].exec("ax{1234}b ", 4109)); +assertEquals(null, res[1371].exec("ac\ncb ", 4110)); +assertEquals("ax{1234}xyb,x{1234}xy", res[1372].exec("ax{1234}xyb "), 4111); +assertEquals("ax{1234}x{4321}yb,x{1234}x{4321}y", res[1372].exec("ax{1234}x{4321}yb "), 4112); +assertEquals("ax{1234}x{4321}x{3412}b,x{1234}x{4321}x{3412}", res[1372].exec("ax{1234}x{4321}x{3412}b "), 4113); +assertEquals("axxxxbcdefghijb,xxxxbcdefghij", res[1372].exec("axxxxbcdefghijb "), 4114); +assertEquals("ax{1234}x{4321}x{3412}x{3421}b,x{1234}x{4321}x{3412}x{3421}", res[1372].exec("ax{1234}x{4321}x{3412}x{3421}b "), 4115); +assertEquals(null, res[1372].exec("*** Failers", 4116)); +assertEquals("ax{1234}b,x{1234}", res[1372].exec("ax{1234}b "), 4117); +assertEquals("ax{1234}xyb,x{1234}xy", res[1373].exec("ax{1234}xyb "), 4118); +assertEquals("ax{1234}x{4321}yb,x{1234}x{4321}y", res[1373].exec("ax{1234}x{4321}yb "), 4119); +assertEquals("ax{1234}x{4321}x{3412}b,x{1234}x{4321}x{3412}", res[1373].exec("ax{1234}x{4321}x{3412}b "), 4120); +assertEquals("axxxxb,xxxx", res[1373].exec("axxxxbcdefghijb "), 4121); +assertEquals("ax{1234}x{4321}x{3412}x{3421}b,x{1234}x{4321}x{3412}x{3421}", res[1373].exec("ax{1234}x{4321}x{3412}x{3421}b "), 4122); +assertEquals(null, res[1373].exec("*** Failers", 4123)); +assertEquals("ax{1234}b,x{1234}", res[1373].exec("ax{1234}b "), 4124); +assertEquals(null, res[1374].exec("ax{1234}xyb ", 4125)); +assertEquals(null, res[1374].exec("ax{1234}x{4321}yb ", 4126)); +assertEquals(null, res[1374].exec("ax{1234}x{4321}x{3412}b ", 4127)); +assertEquals("axxxxb,xxxx", res[1374].exec("axxxxbcdefghijb "), 4128); +assertEquals(null, res[1374].exec("ax{1234}x{4321}x{3412}x{3421}b ", 4129)); +assertEquals("axbxxb,xbxx", res[1374].exec("axbxxbcdefghijb "), 4130); +assertEquals("axxxxxb,xxxxx", res[1374].exec("axxxxxbcdefghijb "), 4131); +assertEquals(null, res[1374].exec("*** Failers", 4132)); +assertEquals(null, res[1374].exec("ax{1234}b ", 4133)); +assertEquals(null, res[1374].exec("axxxxxxbcdefghijb ", 4134)); +assertEquals(null, res[1375].exec("ax{1234}xyb ", 4135)); +assertEquals(null, res[1375].exec("ax{1234}x{4321}yb ", 4136)); +assertEquals(null, res[1375].exec("ax{1234}x{4321}x{3412}b ", 4137)); +assertEquals("axxxxb,xxxx", res[1375].exec("axxxxbcdefghijb "), 4138); +assertEquals(null, res[1375].exec("ax{1234}x{4321}x{3412}x{3421}b ", 4139)); +assertEquals("axbxxb,xbxx", res[1375].exec("axbxxbcdefghijb "), 4140); +assertEquals("axxxxxb,xxxxx", res[1375].exec("axxxxxbcdefghijb "), 4141); +assertEquals(null, res[1375].exec("*** Failers", 4142)); +assertEquals(null, res[1375].exec("ax{1234}b ", 4143)); +assertEquals(null, res[1375].exec("axxxxxxbcdefghijb ", 4144)); +assertEquals(null, res[1375].exec("*** Failers", 4145)); +assertEquals(null, res[1375].exec("x{100}", 4146)); +assertEquals(null, res[1375].exec("aXbcd", 4147)); +assertEquals(null, res[1375].exec("ax{100}bcd", 4148)); +assertEquals(null, res[1375].exec("ax{100000}bcd", 4149)); +assertEquals(null, res[1375].exec("x{100}x{100}x{100}b", 4150)); +assertEquals(null, res[1375].exec("*** Failers ", 4151)); +assertEquals(null, res[1375].exec("x{100}x{100}b", 4152)); +assertEquals(null, res[1375].exec("x{ab} ", 4153)); +assertEquals(null, res[1375].exec("\xc2\xab", 4154)); +assertEquals(null, res[1375].exec("*** Failers ", 4155)); +assertEquals(null, res[1375].exec("\x00{ab}", 4156)); +assertEquals(null, res[1375].exec("WXYZ", 4157)); +assertEquals(null, res[1375].exec("x{256}XYZ ", 4158)); +assertEquals(null, res[1375].exec("*** Failers", 4159)); +assertEquals(null, res[1375].exec("XYZ ", 4160)); +assertEquals("bcd", res[1376].exec("bcd"), 4161); +assertEquals("00}", res[1376].exec("x{100}aYx{256}Z "), 4162); +assertEquals("x{", res[1377].exec("x{100}bc"), 4163); +assertEquals("x{100}bcA", res[1378].exec("x{100}bcAa"), 4164); +assertEquals("x{", res[1379].exec("x{100}bca"), 4165); +assertEquals("bcd", res[1380].exec("bcd"), 4166); +assertEquals("00}", res[1380].exec("x{100}aYx{256}Z "), 4167); +assertEquals("x{", res[1381].exec("x{100}bc"), 4168); +assertEquals("x{100}bc", res[1382].exec("x{100}bcAa"), 4169); +assertEquals("x{", res[1383].exec("x{100}bca"), 4170); +assertEquals(null, res[1383].exec("abcd", 4171)); +assertEquals(null, res[1383].exec("abcd", 4172)); +assertEquals("x{", res[1383].exec("x{100}x{100} "), 4173); +assertEquals("x{", res[1383].exec("x{100}x{100} "), 4174); +assertEquals("x{", res[1383].exec("x{100}x{100}x{100}x{100} "), 4175); +assertEquals(null, res[1383].exec("abce", 4176)); +assertEquals("x{", res[1383].exec("x{100}x{100}x{100}x{100} "), 4177); +assertEquals(null, res[1383].exec("abcdx{100}x{100}x{100}x{100} ", 4178)); +assertEquals(null, res[1383].exec("abcdx{100}x{100}x{100}x{100} ", 4179)); +assertEquals(null, res[1383].exec("abcdx{100}x{100}x{100}x{100} ", 4180)); +assertEquals(null, res[1383].exec("abcdx{100}x{100}x{100}XX", 4181)); +assertEquals(null, res[1383].exec("abcdx{100}x{100}x{100}x{100}x{100}x{100}x{100}XX", 4182)); +assertEquals(null, res[1383].exec("abcdx{100}x{100}x{100}x{100}x{100}x{100}x{100}XX", 4183)); +assertEquals("Xy", res[1383].exec("Xyyyax{100}x{100}bXzzz"), 4184); +assertEquals("X", res[1386].exec("1X2"), 4185); +assertEquals("x", res[1386].exec("1x{100}2 "), 4186); +assertEquals(">X", res[1387].exec("> >X Y"), 4187); +assertEquals(">x", res[1387].exec("> >x{100} Y"), 4188); +assertEquals("1", res[1388].exec("x{100}3"), 4189); +assertEquals(" ", res[1389].exec("x{100} X"), 4190); +assertEquals("abcd", res[1390].exec("12abcd34"), 4191); +assertEquals("*** Failers", res[1390].exec("*** Failers"), 4192); +assertEquals(" ", res[1390].exec("1234 "), 4193); +assertEquals("abc", res[1391].exec("12abcd34"), 4194); +assertEquals("ab", res[1391].exec("12ab34"), 4195); +assertEquals("***", res[1391].exec("*** Failers "), 4196); +assertEquals(null, res[1391].exec("1234", 4197)); +assertEquals(" ", res[1391].exec("12a34 "), 4198); +assertEquals("ab", res[1392].exec("12abcd34"), 4199); +assertEquals("ab", res[1392].exec("12ab34"), 4200); +assertEquals("**", res[1392].exec("*** Failers "), 4201); +assertEquals(null, res[1392].exec("1234", 4202)); +assertEquals(" ", res[1392].exec("12a34 "), 4203); +assertEquals("12", res[1393].exec("12abcd34"), 4204); +assertEquals(null, res[1393].exec("*** Failers", 4205)); +assertEquals("12", res[1394].exec("12abcd34"), 4206); +assertEquals("123", res[1394].exec("1234abcd"), 4207); +assertEquals(null, res[1394].exec("*** Failers ", 4208)); +assertEquals(null, res[1394].exec("1.4 ", 4209)); +assertEquals("12", res[1395].exec("12abcd34"), 4210); +assertEquals("12", res[1395].exec("1234abcd"), 4211); +assertEquals(null, res[1395].exec("*** Failers ", 4212)); +assertEquals(null, res[1395].exec("1.4 ", 4213)); +assertEquals("12abcd34", res[1396].exec("12abcd34"), 4214); +assertEquals("***", res[1396].exec("*** Failers"), 4215); +assertEquals(null, res[1396].exec(" ", 4216)); +assertEquals("12a", res[1397].exec("12abcd34"), 4217); +assertEquals("123", res[1397].exec("1234abcd"), 4218); +assertEquals("***", res[1397].exec("*** Failers"), 4219); +assertEquals(null, res[1397].exec(" ", 4220)); +assertEquals("12", res[1398].exec("12abcd34"), 4221); +assertEquals("12", res[1398].exec("1234abcd"), 4222); +assertEquals("**", res[1398].exec("*** Failers"), 4223); +assertEquals(null, res[1398].exec(" ", 4224)); +assertEquals("> <", res[1399].exec("12> <34"), 4225); +assertEquals(null, res[1399].exec("*** Failers", 4226)); +assertEquals("> <", res[1400].exec("ab> <cd"), 4227); +assertEquals("> <", res[1400].exec("ab> <ce"), 4228); +assertEquals(null, res[1400].exec("*** Failers", 4229)); +assertEquals(null, res[1400].exec("ab> <cd ", 4230)); +assertEquals("> <", res[1401].exec("ab> <cd"), 4231); +assertEquals("> <", res[1401].exec("ab> <ce"), 4232); +assertEquals(null, res[1401].exec("*** Failers", 4233)); +assertEquals(null, res[1401].exec("ab> <cd ", 4234)); +assertEquals("12", res[1402].exec("12 34"), 4235); +assertEquals("Failers", res[1402].exec("*** Failers"), 4236); +assertEquals(null, res[1402].exec("+++=*! ", 4237)); +assertEquals("ab", res[1403].exec("ab cd"), 4238); +assertEquals("abc", res[1403].exec("abcd ce"), 4239); +assertEquals("Fai", res[1403].exec("*** Failers"), 4240); +assertEquals(null, res[1403].exec("a.b.c", 4241)); +assertEquals("ab", res[1404].exec("ab cd"), 4242); +assertEquals("ab", res[1404].exec("abcd ce"), 4243); +assertEquals("Fa", res[1404].exec("*** Failers"), 4244); +assertEquals(null, res[1404].exec("a.b.c", 4245)); +assertEquals("====", res[1405].exec("12====34"), 4246); +assertEquals("*** ", res[1405].exec("*** Failers"), 4247); +assertEquals(" ", res[1405].exec("abcd "), 4248); +assertEquals("===", res[1406].exec("ab====cd"), 4249); +assertEquals("==", res[1406].exec("ab==cd"), 4250); +assertEquals("***", res[1406].exec("*** Failers"), 4251); +assertEquals(null, res[1406].exec("a.b.c", 4252)); +assertEquals("==", res[1407].exec("ab====cd"), 4253); +assertEquals("==", res[1407].exec("ab==cd"), 4254); +assertEquals("**", res[1407].exec("*** Failers"), 4255); +assertEquals(null, res[1407].exec("a.b.c", 4256)); +assertEquals(null, res[1407].exec("x{100}", 4257)); +assertEquals(null, res[1407].exec("Zx{100}", 4258)); +assertEquals(null, res[1407].exec("x{100}Z", 4259)); +assertEquals("**", res[1407].exec("*** Failers "), 4260); +assertEquals(null, res[1407].exec("Zx{100}", 4261)); +assertEquals(null, res[1407].exec("x{100}", 4262)); +assertEquals(null, res[1407].exec("x{100}Z", 4263)); +assertEquals("**", res[1407].exec("*** Failers "), 4264); +assertEquals(null, res[1407].exec("abcx{200}X", 4265)); +assertEquals(null, res[1407].exec("abcx{100}X ", 4266)); +assertEquals("**", res[1407].exec("*** Failers"), 4267); +assertEquals(" ", res[1407].exec("X "), 4268); +assertEquals(null, res[1407].exec("abcx{200}X", 4269)); +assertEquals(null, res[1407].exec("abcx{100}X ", 4270)); +assertEquals(null, res[1407].exec("abQX ", 4271)); +assertEquals("**", res[1407].exec("*** Failers"), 4272); +assertEquals(" ", res[1407].exec("X "), 4273); +assertEquals(null, res[1407].exec("abcx{100}x{200}x{100}X", 4274)); +assertEquals("**", res[1407].exec("*** Failers"), 4275); +assertEquals(null, res[1407].exec("abcx{200}X", 4276)); +assertEquals(" ", res[1407].exec("X "), 4277); +assertEquals(null, res[1407].exec("AX", 4278)); +assertEquals(null, res[1407].exec("x{150}X", 4279)); +assertEquals(null, res[1407].exec("x{500}X ", 4280)); +assertEquals("**", res[1407].exec("*** Failers"), 4281); +assertEquals(null, res[1407].exec("x{100}X", 4282)); +assertEquals(" ", res[1407].exec("x{200}X "), 4283); +assertEquals(null, res[1407].exec("AX", 4284)); +assertEquals(null, res[1407].exec("x{150}X", 4285)); +assertEquals(null, res[1407].exec("x{500}X ", 4286)); +assertEquals("**", res[1407].exec("*** Failers"), 4287); +assertEquals(null, res[1407].exec("x{100}X", 4288)); +assertEquals(" ", res[1407].exec("x{200}X "), 4289); +assertEquals(null, res[1407].exec("QX ", 4290)); +assertEquals(null, res[1407].exec("AX", 4291)); +assertEquals(null, res[1407].exec("x{500}X ", 4292)); +assertEquals("**", res[1407].exec("*** Failers"), 4293); +assertEquals(null, res[1407].exec("x{100}X", 4294)); +assertEquals(null, res[1407].exec("x{150}X", 4295)); +assertEquals(" ", res[1407].exec("x{200}X "), 4296); +assertEquals(null, res[1407].exec("z", 4297)); +assertEquals(null, res[1407].exec("Z ", 4298)); +assertEquals(null, res[1407].exec("x{100}", 4299)); +assertEquals("**", res[1407].exec("*** Failers"), 4300); +assertEquals(null, res[1407].exec("x{102}", 4301)); +assertEquals(" ", res[1407].exec("y "), 4302); +assertEquals("\xff", res[1408].exec(">\xff<"), 4303); +assertEquals(null, res[1409].exec(">x{ff}<", 4304)); +assertEquals("X", res[1410].exec("XYZ"), 4305); +assertEquals("X", res[1411].exec("XYZ"), 4306); +assertEquals("x", res[1411].exec("x{123} "), 4307); +assertEquals(",", res[1416].exec("catac"), 4308); +assertEquals(",", res[1416].exec("ax{256}a "), 4309); +assertEquals(",", res[1416].exec("x{85}"), 4310); +assertEquals("abc1", res[1417].exec("abc1 \nabc2 \x0babc3xx \x0cabc4 \x0dabc5xx \x0d\nabc6 x{0085}abc7 x{2028}abc8 x{2029}abc9 JUNK"), 4311); +assertEquals("abc1", res[1418].exec("abc1\n abc2\x0b abc3\x0c abc4\x0d abc5\x0d\n abc6x{0085} abc7x{2028} abc8x{2029} abc9"), 4312); +assertEquals(null, res[1419].exec("a\nb", 4313)); +assertEquals(null, res[1419].exec("a\x0db", 4314)); +assertEquals(null, res[1419].exec("a\x0d\nb", 4315)); +assertEquals(null, res[1419].exec("a\x0bb", 4316)); +assertEquals(null, res[1419].exec("a\x0cb", 4317)); +assertEquals(null, res[1419].exec("ax{85}b ", 4318)); +assertEquals(null, res[1419].exec("ax{2028}b ", 4319)); +assertEquals(null, res[1419].exec("ax{2029}b ", 4320)); +assertEquals(null, res[1419].exec("** Failers", 4321)); +assertEquals(null, res[1419].exec("a\n\x0db ", 4322)); +assertEquals("ab", res[1420].exec("ab"), 4323); +assertEquals(null, res[1420].exec("a\nb", 4324)); +assertEquals(null, res[1420].exec("a\x0db", 4325)); +assertEquals(null, res[1420].exec("a\x0d\nb", 4326)); +assertEquals(null, res[1420].exec("a\x0bb", 4327)); +assertEquals(null, res[1420].exec("a\x0cx{2028}x{2029}b", 4328)); +assertEquals(null, res[1420].exec("ax{85}b ", 4329)); +assertEquals(null, res[1420].exec("a\n\x0db ", 4330)); +assertEquals(null, res[1420].exec("a\n\x0dx{85}\x0cb ", 4331)); +assertEquals(null, res[1421].exec("a\nb", 4332)); +assertEquals(null, res[1421].exec("a\x0db", 4333)); +assertEquals(null, res[1421].exec("a\x0d\nb", 4334)); +assertEquals(null, res[1421].exec("a\x0bb", 4335)); +assertEquals(null, res[1421].exec("a\x0cx{2028}x{2029}b", 4336)); +assertEquals(null, res[1421].exec("ax{85}b ", 4337)); +assertEquals(null, res[1421].exec("a\n\x0db ", 4338)); +assertEquals(null, res[1421].exec("a\n\x0dx{85}\x0cb ", 4339)); +assertEquals(null, res[1421].exec("** Failers", 4340)); +assertEquals(null, res[1421].exec("ab ", 4341)); +assertEquals(null, res[1422].exec("a\nb", 4342)); +assertEquals(null, res[1422].exec("a\n\x0db", 4343)); +assertEquals(null, res[1422].exec("a\n\x0dx{85}b", 4344)); +assertEquals(null, res[1422].exec("a\x0d\n\x0d\nb ", 4345)); +assertEquals(null, res[1422].exec("a\x0d\n\x0d\n\x0d\nb ", 4346)); +assertEquals(null, res[1422].exec("a\n\x0d\n\x0db", 4347)); +assertEquals(null, res[1422].exec("a\n\n\x0d\nb ", 4348)); +assertEquals(null, res[1422].exec("** Failers", 4349)); +assertEquals(null, res[1422].exec("a\n\n\n\x0db", 4350)); +assertEquals(null, res[1422].exec("a\x0d", 4351)); +assertEquals(null, res[1423].exec("\x09 x{a0}X\n\x0b\x0c\x0d\n", 4352)); +assertEquals(null, res[1424].exec(" x{a0}X\n\x0b\x0c\x0d\n", 4353)); +assertEquals(null, res[1425].exec(">\x09 x{a0}X\n\n\n<", 4354)); +assertEquals(null, res[1426].exec(">\x09 x{a0}X\n\n\n<", 4355)); +assertEquals(null, res[1427].exec("X X\n", 4356)); +assertEquals(null, res[1427].exec("X\x09X\x0b", 4357)); +assertEquals(null, res[1427].exec("** Failers", 4358)); +assertEquals(null, res[1427].exec("x{a0} X\n ", 4359)); +assertEquals(null, res[1428].exec("\x09 x{a0}X\n\x0b\x0c\x0d\n", 4360)); +assertEquals(null, res[1428].exec("\x09 x{a0}\n\x0b\x0c\x0d\n", 4361)); +assertEquals(null, res[1428].exec("\x09 x{a0}\n\x0b\x0c", 4362)); +assertEquals(null, res[1428].exec("** Failers ", 4363)); +assertEquals(null, res[1428].exec("\x09 x{a0}\n\x0b", 4364)); +assertEquals(null, res[1428].exec(" ", 4365)); +assertEquals(null, res[1429].exec("x{3001}x{3000}x{2030}x{2028}", 4366)); +assertEquals(null, res[1429].exec("Xx{180e}Xx{85}", 4367)); +assertEquals(null, res[1429].exec("** Failers", 4368)); +assertEquals(null, res[1429].exec("x{2009} X\n ", 4369)); +assertEquals(null, res[1430].exec("x{1680}x{180e}x{2007}Xx{2028}x{2029}\x0c\x0d\n", 4370)); +assertEquals(null, res[1430].exec("\x09x{205f}x{a0}\nx{2029}\x0cx{2028}\n", 4371)); +assertEquals(null, res[1430].exec("\x09 x{202f}\n\x0b\x0c", 4372)); +assertEquals(null, res[1430].exec("** Failers ", 4373)); +assertEquals(null, res[1430].exec("\x09x{200a}x{a0}x{2028}\x0b", 4374)); +assertEquals(null, res[1430].exec(" ", 4375)); +assertEquals(null, res[1431].exec("a\x0db", 4376)); +assertEquals(null, res[1431].exec("a\nb", 4377)); +assertEquals(null, res[1431].exec("a\x0d\nb", 4378)); +assertEquals(null, res[1431].exec("** Failers", 4379)); +assertEquals(null, res[1431].exec("ax{85}b", 4380)); +assertEquals(null, res[1431].exec("a\x0bb ", 4381)); +assertEquals(null, res[1432].exec("a\x0db", 4382)); +assertEquals(null, res[1432].exec("a\nb", 4383)); +assertEquals(null, res[1432].exec("a\x0d\nb", 4384)); +assertEquals(null, res[1432].exec("ax{85}b", 4385)); +assertEquals(null, res[1432].exec("a\x0bb ", 4386)); +assertEquals(null, res[1432].exec("** Failers ", 4387)); +assertEquals(null, res[1432].exec("ax{85}b<bsr_anycrlf>", 4388)); +assertEquals(null, res[1432].exec("a\x0bb<bsr_anycrlf>", 4389)); +assertEquals(null, res[1433].exec("a\x0db", 4390)); +assertEquals(null, res[1433].exec("a\nb", 4391)); +assertEquals(null, res[1433].exec("a\x0d\nb", 4392)); +assertEquals(null, res[1433].exec("** Failers", 4393)); +assertEquals(null, res[1433].exec("ax{85}b", 4394)); +assertEquals(null, res[1433].exec("a\x0bb ", 4395)); +assertEquals(null, res[1434].exec("a\x0db", 4396)); +assertEquals(null, res[1434].exec("a\nb", 4397)); +assertEquals(null, res[1434].exec("a\x0d\nb", 4398)); +assertEquals(null, res[1434].exec("ax{85}b", 4399)); +assertEquals(null, res[1434].exec("a\x0bb ", 4400)); +assertEquals(null, res[1434].exec("** Failers ", 4401)); +assertEquals(null, res[1434].exec("ax{85}b<bsr_anycrlf>", 4402)); +assertEquals(null, res[1434].exec("a\x0bb<bsr_anycrlf>", 4403)); +assertEquals("X", res[1435].exec("Ax{1ec5}ABCXYZ"), 4404); +assertEquals(null, res[1437].exec("AB", 4405)); +assertEquals(null, res[1437].exec("*** Failers", 4406)); +assertEquals(null, res[1437].exec("A0", 4407)); +assertEquals(null, res[1437].exec("00 ", 4408)); +assertEquals(null, res[1438].exec("AB", 4409)); +assertEquals(null, res[1438].exec("Ax{300}BC ", 4410)); +assertEquals(null, res[1438].exec("Ax{300}x{301}x{302}BC ", 4411)); +assertEquals(null, res[1438].exec("*** Failers", 4412)); +assertEquals(null, res[1438].exec("x{300} ", 4413)); +assertEquals(null, res[1439].exec("ABC", 4414)); +assertEquals(null, res[1439].exec("Ax{300}Bx{300}x{301}C ", 4415)); +assertEquals(null, res[1439].exec("Ax{300}x{301}x{302}BC ", 4416)); +assertEquals(null, res[1439].exec("*** Failers", 4417)); +assertEquals(null, res[1439].exec("x{300} ", 4418)); +assertEquals(null, res[1440].exec("abcd", 4419)); +assertEquals(null, res[1440].exec("a ", 4420)); +assertEquals(null, res[1440].exec("*** Failers ", 4421)); +assertEquals(null, res[1441].exec("1234", 4422)); +assertEquals(null, res[1441].exec("= ", 4423)); +assertEquals(null, res[1441].exec("*** Failers ", 4424)); +assertEquals(null, res[1441].exec("abcd ", 4425)); +assertEquals(null, res[1442].exec("abcdAx{300}x{301}x{302}", 4426)); +assertEquals(null, res[1442].exec("Ax{300}x{301}x{302}", 4427)); +assertEquals(null, res[1442].exec("Ax{300}x{301}x{302}Ax{300}x{301}x{302}", 4428)); +assertEquals(null, res[1442].exec("a ", 4429)); +assertEquals(null, res[1442].exec("*** Failers ", 4430)); +assertEquals(null, res[1442].exec("x{300}x{301}x{302}", 4431)); +assertEquals("abc", res[1443].exec("abc"), 4432); +assertEquals("abc", res[1443].exec("Ax{300}abc"), 4433); +assertEquals("abc", res[1443].exec("Ax{300}x{301}x{302}Ax{300}Ax{300}Ax{300}abcxyz"), 4434); +assertEquals("abc", res[1443].exec("x{300}abc "), 4435); +assertEquals(null, res[1443].exec("*** Failers", 4436)); +assertEquals("abc", res[1444].exec("abc"), 4437); +assertEquals(null, res[1444].exec("Ax{300}abc", 4438)); +assertEquals(null, res[1444].exec("*** Failers", 4439)); +assertEquals(null, res[1444].exec("Ax{300}x{301}x{302}Ax{300}Ax{300}Ax{300}abcxyz", 4440)); +assertEquals(null, res[1444].exec("x{300}abc ", 4441)); +assertEquals("abc", res[1445].exec("abc"), 4442); +assertEquals("abc", res[1445].exec("Ax{300}abc"), 4443); +assertEquals("abc", res[1445].exec("Ax{300}x{301}x{302}Ax{300}Ax{300}Ax{300}abcxyz"), 4444); +assertEquals("abc", res[1445].exec("x{300}abc "), 4445); +assertEquals(null, res[1445].exec("*** Failers", 4446)); +assertEquals("abc", res[1446].exec("abc"), 4447); +assertEquals(null, res[1446].exec("Ax{300}abc", 4448)); +assertEquals(null, res[1446].exec("Ax{300}x{301}x{302}Ax{300}Ax{300}Ax{300}abcxyz", 4449)); +assertEquals(null, res[1446].exec("*** Failers", 4450)); +assertEquals(null, res[1446].exec("x{300}abc ", 4451)); +assertEquals(null, res[1447].exec("A=b", 4452)); +assertEquals(null, res[1447].exec("=c ", 4453)); +assertEquals(null, res[1447].exec("*** Failers", 4454)); +assertEquals(null, res[1447].exec("1=2 ", 4455)); +assertEquals(null, res[1447].exec("AAAA=b ", 4456)); +assertEquals(null, res[1448].exec("AAAA=b", 4457)); +assertEquals(null, res[1448].exec("=c ", 4458)); +assertEquals(null, res[1448].exec("*** Failers", 4459)); +assertEquals(null, res[1448].exec("1=2 ", 4460)); +assertEquals(null, res[1449].exec("Ax{300}x{301}x{302}Ax{300}x{301}x{302}X", 4461)); +assertEquals(null, res[1449].exec("Ax{300}x{301}x{302}Ax{300}x{301}x{302}Ax{300}x{301}x{302}X ", 4462)); +assertEquals(null, res[1449].exec("*** Failers", 4463)); +assertEquals(null, res[1449].exec("X", 4464)); +assertEquals(null, res[1449].exec("Ax{300}x{301}x{302}X", 4465)); +assertEquals(null, res[1449].exec("Ax{300}x{301}x{302}Ax{300}x{301}x{302}Ax{300}x{301}x{302}Ax{300}x{301}x{302}X", 4466)); +assertEquals(null, res[1450].exec("x{c0}x{30f}x{660}x{66c}x{f01}x{1680}<", 4467)); +assertEquals(null, res[1450].exec("\npx{300}9!$ < ", 4468)); +assertEquals(null, res[1450].exec("** Failers ", 4469)); +assertEquals(null, res[1450].exec("apx{300}9!$ < ", 4470)); +assertEquals(null, res[1451].exec("X", 4471)); +assertEquals(null, res[1451].exec("** Failers ", 4472)); +assertEquals(null, res[1451].exec("", 4473)); +assertEquals(null, res[1452].exec("9", 4474)); +assertEquals(null, res[1452].exec("** Failers ", 4475)); +assertEquals(null, res[1452].exec("x{c0}", 4476)); +assertEquals(null, res[1453].exec("X", 4477)); +assertEquals(null, res[1453].exec("** Failers ", 4478)); +assertEquals(null, res[1453].exec("x{30f}", 4479)); +assertEquals(null, res[1454].exec("X", 4480)); +assertEquals(null, res[1454].exec("** Failers ", 4481)); +assertEquals(null, res[1454].exec("x{660}", 4482)); +assertEquals(null, res[1455].exec("X", 4483)); +assertEquals(null, res[1455].exec("** Failers ", 4484)); +assertEquals(null, res[1455].exec("x{66c}", 4485)); +assertEquals(null, res[1456].exec("X", 4486)); +assertEquals(null, res[1456].exec("** Failers ", 4487)); +assertEquals(null, res[1456].exec("x{f01}", 4488)); +assertEquals(null, res[1457].exec("X", 4489)); +assertEquals(null, res[1457].exec("** Failers ", 4490)); +assertEquals(null, res[1457].exec("x{1680}", 4491)); +assertEquals(null, res[1458].exec("x{017}", 4492)); +assertEquals(null, res[1458].exec("x{09f} ", 4493)); +assertEquals(null, res[1458].exec("** Failers", 4494)); +assertEquals(null, res[1458].exec("x{0600} ", 4495)); +assertEquals(null, res[1459].exec("x{601}", 4496)); +assertEquals(null, res[1459].exec("** Failers", 4497)); +assertEquals(null, res[1459].exec("x{09f} ", 4498)); +assertEquals(null, res[1460].exec("** Failers", 4499)); +assertEquals(null, res[1460].exec("x{09f} ", 4500)); +assertEquals(null, res[1461].exec("x{f8ff}", 4501)); +assertEquals(null, res[1461].exec("** Failers", 4502)); +assertEquals(null, res[1461].exec("x{09f} ", 4503)); +assertEquals(null, res[1462].exec("?x{dfff}", 4504)); +assertEquals(null, res[1462].exec("** Failers", 4505)); +assertEquals(null, res[1462].exec("x{09f} ", 4506)); +assertEquals(null, res[1463].exec("a", 4507)); +assertEquals(null, res[1463].exec("** Failers ", 4508)); +assertEquals(null, res[1463].exec("Z", 4509)); +assertEquals(null, res[1463].exec("x{e000} ", 4510)); +assertEquals(null, res[1464].exec("x{2b0}", 4511)); +assertEquals(null, res[1464].exec("** Failers", 4512)); +assertEquals(null, res[1464].exec("a ", 4513)); +assertEquals(null, res[1465].exec("x{1bb}", 4514)); +assertEquals(null, res[1465].exec("** Failers", 4515)); +assertEquals(null, res[1465].exec("a ", 4516)); +assertEquals(null, res[1465].exec("x{2b0}", 4517)); +assertEquals(null, res[1466].exec("x{1c5}", 4518)); +assertEquals(null, res[1466].exec("** Failers", 4519)); +assertEquals(null, res[1466].exec("a ", 4520)); +assertEquals(null, res[1466].exec("x{2b0}", 4521)); +assertEquals(null, res[1467].exec("A", 4522)); +assertEquals(null, res[1467].exec("** Failers", 4523)); +assertEquals(null, res[1467].exec("x{2b0}", 4524)); +assertEquals(null, res[1468].exec("x{903}", 4525)); +assertEquals(null, res[1468].exec("** Failers", 4526)); +assertEquals(null, res[1468].exec("X", 4527)); +assertEquals(null, res[1468].exec("x{300}", 4528)); +assertEquals(null, res[1468].exec(" ", 4529)); +assertEquals(null, res[1469].exec("x{488}", 4530)); +assertEquals(null, res[1469].exec("** Failers", 4531)); +assertEquals(null, res[1469].exec("X", 4532)); +assertEquals(null, res[1469].exec("x{903}", 4533)); +assertEquals(null, res[1469].exec("x{300}", 4534)); +assertEquals(null, res[1470].exec("x{300}", 4535)); +assertEquals(null, res[1470].exec("** Failers", 4536)); +assertEquals(null, res[1470].exec("X", 4537)); +assertEquals(null, res[1470].exec("x{903}", 4538)); +assertEquals(null, res[1470].exec("0123456789x{660}x{661}x{662}x{663}x{664}x{665}x{666}x{667}x{668}x{669}x{66a}", 4539)); +assertEquals(null, res[1470].exec("x{6f0}x{6f1}x{6f2}x{6f3}x{6f4}x{6f5}x{6f6}x{6f7}x{6f8}x{6f9}x{6fa}", 4540)); +assertEquals(null, res[1470].exec("x{966}x{967}x{968}x{969}x{96a}x{96b}x{96c}x{96d}x{96e}x{96f}x{970}", 4541)); +assertEquals(null, res[1470].exec("** Failers", 4542)); +assertEquals(null, res[1470].exec("X", 4543)); +assertEquals(null, res[1471].exec("x{16ee}", 4544)); +assertEquals(null, res[1471].exec("** Failers", 4545)); +assertEquals(null, res[1471].exec("X", 4546)); +assertEquals(null, res[1471].exec("x{966}", 4547)); +assertEquals(null, res[1472].exec("x{b2}", 4548)); +assertEquals(null, res[1472].exec("x{b3}", 4549)); +assertEquals(null, res[1472].exec("** Failers", 4550)); +assertEquals(null, res[1472].exec("X", 4551)); +assertEquals(null, res[1472].exec("x{16ee}", 4552)); +assertEquals(null, res[1473].exec("_", 4553)); +assertEquals(null, res[1473].exec("x{203f}", 4554)); +assertEquals(null, res[1473].exec("** Failers", 4555)); +assertEquals(null, res[1473].exec("X", 4556)); +assertEquals(null, res[1473].exec("-", 4557)); +assertEquals(null, res[1473].exec("x{58a}", 4558)); +assertEquals(null, res[1474].exec("-", 4559)); +assertEquals(null, res[1474].exec("x{58a}", 4560)); +assertEquals(null, res[1474].exec("** Failers", 4561)); +assertEquals(null, res[1474].exec("X", 4562)); +assertEquals(null, res[1474].exec("x{203f}", 4563)); +assertEquals(null, res[1475].exec(")", 4564)); +assertEquals(null, res[1475].exec("]", 4565)); +assertEquals(null, res[1475].exec("}", 4566)); +assertEquals(null, res[1475].exec("x{f3b}", 4567)); +assertEquals(null, res[1475].exec("** Failers", 4568)); +assertEquals(null, res[1475].exec("X", 4569)); +assertEquals(null, res[1475].exec("x{203f}", 4570)); +assertEquals(null, res[1475].exec("(", 4571)); +assertEquals(null, res[1475].exec("[", 4572)); +assertEquals(null, res[1475].exec("{", 4573)); +assertEquals(null, res[1475].exec("x{f3c}", 4574)); +assertEquals(null, res[1476].exec("x{bb}", 4575)); +assertEquals(null, res[1476].exec("x{2019}", 4576)); +assertEquals(null, res[1476].exec("** Failers", 4577)); +assertEquals(null, res[1476].exec("X", 4578)); +assertEquals(null, res[1476].exec("x{203f}", 4579)); +assertEquals(null, res[1477].exec("x{ab}", 4580)); +assertEquals(null, res[1477].exec("x{2018}", 4581)); +assertEquals(null, res[1477].exec("** Failers", 4582)); +assertEquals(null, res[1477].exec("X", 4583)); +assertEquals(null, res[1477].exec("x{203f}", 4584)); +assertEquals(null, res[1478].exec("!", 4585)); +assertEquals(null, res[1478].exec("x{37e}", 4586)); +assertEquals(null, res[1478].exec("** Failers", 4587)); +assertEquals(null, res[1478].exec("X", 4588)); +assertEquals(null, res[1478].exec("x{203f}", 4589)); +assertEquals(null, res[1479].exec("(", 4590)); +assertEquals(null, res[1479].exec("[", 4591)); +assertEquals(null, res[1479].exec("{", 4592)); +assertEquals(null, res[1479].exec("x{f3c}", 4593)); +assertEquals(null, res[1479].exec("** Failers", 4594)); +assertEquals(null, res[1479].exec("X", 4595)); +assertEquals(null, res[1479].exec(")", 4596)); +assertEquals(null, res[1479].exec("]", 4597)); +assertEquals(null, res[1479].exec("}", 4598)); +assertEquals(null, res[1479].exec("x{f3b}", 4599)); +assertEquals(null, res[1479].exec("$x{a2}x{a3}x{a4}x{a5}x{a6}", 4600)); +assertEquals(null, res[1479].exec("x{9f2}", 4601)); +assertEquals(null, res[1479].exec("** Failers", 4602)); +assertEquals(null, res[1479].exec("X", 4603)); +assertEquals(null, res[1479].exec("x{2c2}", 4604)); +assertEquals(null, res[1480].exec("x{2c2}", 4605)); +assertEquals(null, res[1480].exec("** Failers", 4606)); +assertEquals(null, res[1480].exec("X", 4607)); +assertEquals(null, res[1480].exec("x{9f2}", 4608)); +assertEquals(null, res[1480].exec("+<|~x{ac}x{2044}", 4609)); +assertEquals(null, res[1480].exec("** Failers", 4610)); +assertEquals(null, res[1480].exec("X", 4611)); +assertEquals(null, res[1480].exec("x{9f2}", 4612)); +assertEquals(null, res[1481].exec("x{a6}", 4613)); +assertEquals(null, res[1481].exec("x{482} ", 4614)); +assertEquals(null, res[1481].exec("** Failers", 4615)); +assertEquals(null, res[1481].exec("X", 4616)); +assertEquals(null, res[1481].exec("x{9f2}", 4617)); +assertEquals(null, res[1482].exec("x{2028}", 4618)); +assertEquals(null, res[1482].exec("** Failers", 4619)); +assertEquals(null, res[1482].exec("X", 4620)); +assertEquals(null, res[1482].exec("x{2029}", 4621)); +assertEquals(null, res[1483].exec("x{2029}", 4622)); +assertEquals(null, res[1483].exec("** Failers", 4623)); +assertEquals(null, res[1483].exec("X", 4624)); +assertEquals(null, res[1483].exec("x{2028}", 4625)); +assertEquals(null, res[1484].exec("\\ \\", 4626)); +assertEquals(null, res[1484].exec("x{a0}", 4627)); +assertEquals(null, res[1484].exec("x{1680}", 4628)); +assertEquals(null, res[1484].exec("x{180e}", 4629)); +assertEquals(null, res[1484].exec("x{2000}", 4630)); +assertEquals(null, res[1484].exec("x{2001} ", 4631)); +assertEquals(null, res[1484].exec("** Failers", 4632)); +assertEquals(null, res[1484].exec("x{2028}", 4633)); +assertEquals(null, res[1484].exec("x{200d} ", 4634)); +assertEquals(null, res[1484].exec(" x{660}x{661}x{662}ABC", 4635)); +assertEquals(null, res[1484].exec(" x{660}x{661}x{662}ABC", 4636)); +assertEquals(null, res[1485].exec(" x{660}x{661}x{662}ABC", 4637)); +assertEquals(null, res[1486].exec(" x{660}x{661}x{662}ABC", 4638)); +assertEquals(null, res[1487].exec(" x{660}x{661}x{662}ABC", 4639)); +assertEquals(null, res[1488].exec(" x{660}x{661}x{662}ABC", 4640)); +assertEquals(null, res[1489].exec(" x{660}x{661}x{662}ABC", 4641)); +assertEquals(null, res[1490].exec(" x{660}x{661}x{662}ABC", 4642)); +assertEquals(null, res[1491].exec(" x{660}x{661}x{662}ABC", 4643)); +assertEquals(null, res[1492].exec(" x{660}x{661}x{662}ABC", 4644)); +assertEquals(null, res[1493].exec(" x{660}x{661}x{662}ABC", 4645)); +assertEquals(null, res[1493].exec(" x{660}x{661}x{662}ABC", 4646)); +assertEquals(null, res[1493].exec(" x{660}x{661}x{662}ABC", 4647)); +assertEquals(null, res[1493].exec(" ** Failers", 4648)); +assertEquals(null, res[1493].exec(" x{660}x{661}x{662}ABC", 4649)); +assertEquals(null, res[1494].exec("A", 4650)); +assertEquals(null, res[1494].exec("ax{10a0}B ", 4651)); +assertEquals(null, res[1494].exec("** Failers ", 4652)); +assertEquals(null, res[1494].exec("a", 4653)); +assertEquals(null, res[1494].exec("x{1d00} ", 4654)); +assertEquals(null, res[1495].exec("1234", 4655)); +assertEquals(null, res[1495].exec("** Failers", 4656)); +assertEquals(null, res[1495].exec("ABC ", 4657)); +assertEquals(null, res[1496].exec("1234", 4658)); +assertEquals(null, res[1496].exec("** Failers", 4659)); +assertEquals(null, res[1496].exec("ABC ", 4660)); +assertEquals(null, res[1496].exec("A2XYZ", 4661)); +assertEquals(null, res[1496].exec("123A5XYZPQR", 4662)); +assertEquals(null, res[1496].exec("ABAx{660}XYZpqr", 4663)); +assertEquals(null, res[1496].exec("** Failers", 4664)); +assertEquals(null, res[1496].exec("AXYZ", 4665)); +assertEquals(null, res[1496].exec("XYZ ", 4666)); +assertEquals(null, res[1496].exec("1XYZ", 4667)); +assertEquals(null, res[1496].exec("AB=XYZ.. ", 4668)); +assertEquals(null, res[1496].exec("XYZ ", 4669)); +assertEquals(null, res[1496].exec("** Failers", 4670)); +assertEquals(null, res[1496].exec("WXYZ ", 4671)); +assertEquals(null, res[1497].exec("1234", 4672)); +assertEquals(null, res[1497].exec("1234", 4673)); +assertEquals(null, res[1497].exec("12-34", 4674)); +assertEquals("{", res[1497].exec("12+x{661}-34 "), 4675); +assertEquals(null, res[1497].exec("** Failers", 4676)); +assertEquals("d", res[1497].exec("abcd "), 4677); +assertEquals("d", res[1498].exec("abcd"), 4678); +assertEquals(null, res[1498].exec("** Failers", 4679)); +assertEquals(null, res[1498].exec("1234", 4680)); +assertEquals(null, res[1499].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 4681)); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[1499].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 4682); +assertEquals(" ", res[1499].exec(" "), 4683); +assertEquals(null, res[1499].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 4684)); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[1499].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 4685); +assertEquals(null, res[1500].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 4686)); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[1500].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 4687); +assertEquals(null, res[1501].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 4688)); +assertEquals(null, res[1501].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", 4689)); +assertEquals(null, res[1502].exec("11111111111111111111111111111111111111111111111111111111111111111111111", 4690)); +assertEquals("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", res[1502].exec("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"), 4691); +assertEquals(null, res[1503].exec("a", 4692)); +assertEquals(null, res[1503].exec("A ", 4693)); +assertEquals(null, res[1504].exec("a", 4694)); +assertEquals(null, res[1504].exec("A ", 4695)); +assertEquals(null, res[1505].exec("A", 4696)); +assertEquals(null, res[1505].exec("aZ", 4697)); +assertEquals(null, res[1505].exec("** Failers", 4698)); +assertEquals(null, res[1505].exec("abc ", 4699)); +assertEquals(null, res[1506].exec("A", 4700)); +assertEquals(null, res[1506].exec("aZ", 4701)); +assertEquals(null, res[1506].exec("** Failers", 4702)); +assertEquals(null, res[1506].exec("abc ", 4703)); +assertEquals(null, res[1507].exec("a", 4704)); +assertEquals(null, res[1507].exec("Az", 4705)); +assertEquals(null, res[1507].exec("** Failers", 4706)); +assertEquals(null, res[1507].exec("ABC ", 4707)); +assertEquals(null, res[1508].exec("a", 4708)); +assertEquals(null, res[1508].exec("Az", 4709)); +assertEquals(null, res[1508].exec("** Failers", 4710)); +assertEquals(null, res[1508].exec("ABC ", 4711)); +assertEquals(null, res[1508].exec("x{c0}", 4712)); +assertEquals(null, res[1508].exec("x{e0} ", 4713)); +assertEquals(null, res[1508].exec("x{c0}", 4714)); +assertEquals(null, res[1508].exec("x{e0} ", 4715)); +assertEquals(null, res[1508].exec("Ax{391}x{10427}x{ff3a}x{1fb0}", 4716)); +assertEquals(null, res[1508].exec("** Failers", 4717)); +assertEquals(null, res[1508].exec("ax{391}x{10427}x{ff3a}x{1fb0} ", 4718)); +assertEquals(null, res[1508].exec("Ax{3b1}x{10427}x{ff3a}x{1fb0}", 4719)); +assertEquals(null, res[1508].exec("Ax{391}x{1044F}x{ff3a}x{1fb0}", 4720)); +assertEquals(null, res[1508].exec("Ax{391}x{10427}x{ff5a}x{1fb0}", 4721)); +assertEquals(null, res[1508].exec("Ax{391}x{10427}x{ff3a}x{1fb8}", 4722)); +assertEquals(null, res[1508].exec("Ax{391}x{10427}x{ff3a}x{1fb0}", 4723)); +assertEquals(null, res[1508].exec("ax{391}x{10427}x{ff3a}x{1fb0} ", 4724)); +assertEquals(null, res[1508].exec("Ax{3b1}x{10427}x{ff3a}x{1fb0}", 4725)); +assertEquals(null, res[1508].exec("Ax{391}x{1044F}x{ff3a}x{1fb0}", 4726)); +assertEquals(null, res[1508].exec("Ax{391}x{10427}x{ff5a}x{1fb0}", 4727)); +assertEquals(null, res[1508].exec("Ax{391}x{10427}x{ff3a}x{1fb8}", 4728)); +assertEquals(null, res[1508].exec("x{391}x{3b1}x{3b1}x{3b1}x{391}", 4729)); +assertEquals(null, res[1508].exec("x{391}x{3b1}x{3b1}x{3b1}x{391}X", 4730)); +assertEquals(null, res[1508].exec("x{391}x{3b1}x{3b1}x{3b1}x{391}X", 4731)); +assertEquals(null, res[1508].exec("x{391}", 4732)); +assertEquals(null, res[1508].exec("x{ff3a}", 4733)); +assertEquals(null, res[1508].exec("x{3b1}", 4734)); +assertEquals(null, res[1508].exec("x{ff5a} ", 4735)); +assertEquals(null, res[1508].exec("x{c0}", 4736)); +assertEquals(null, res[1508].exec("x{e0} ", 4737)); +assertEquals(null, res[1508].exec("x{104}", 4738)); +assertEquals(null, res[1508].exec("x{105}", 4739)); +assertEquals(null, res[1508].exec("x{109} ", 4740)); +assertEquals(null, res[1508].exec("** Failers", 4741)); +assertEquals(null, res[1508].exec("x{100}", 4742)); +assertEquals(null, res[1508].exec("x{10a} ", 4743)); +assertEquals(null, res[1508].exec("Z", 4744)); +assertEquals(null, res[1508].exec("z", 4745)); +assertEquals(null, res[1508].exec("x{39c}", 4746)); +assertEquals(null, res[1508].exec("x{178}", 4747)); +assertEquals(null, res[1508].exec("|", 4748)); +assertEquals(null, res[1508].exec("x{80}", 4749)); +assertEquals(null, res[1508].exec("x{ff}", 4750)); +assertEquals(null, res[1508].exec("x{100}", 4751)); +assertEquals(null, res[1508].exec("x{101} ", 4752)); +assertEquals(null, res[1508].exec("** Failers", 4753)); +assertEquals(null, res[1508].exec("x{102}", 4754)); +assertEquals(null, res[1508].exec("Y", 4755)); +assertEquals(null, res[1508].exec("y ", 4756)); +assertEquals(null, res[1509].exec("A", 4757)); +assertEquals(null, res[1509].exec("Ax{300}BC ", 4758)); +assertEquals(null, res[1509].exec("Ax{300}x{301}x{302}BC ", 4759)); +assertEquals(null, res[1509].exec("*** Failers", 4760)); +assertEquals(null, res[1509].exec("x{300} ", 4761)); +assertEquals("X", res[1510].exec("X123"), 4762); +assertEquals(null, res[1510].exec("*** Failers", 4763)); +assertEquals(null, res[1510].exec("AXYZ", 4764)); +assertEquals(null, res[1511].exec("Ax{300}x{301}x{302}BCAx{300}x{301} ", 4765)); +assertEquals(null, res[1511].exec("Ax{300}x{301}x{302}BCAx{300}x{301}C ", 4766)); +assertEquals(null, res[1512].exec("Ax{300}x{301}x{302}BCAx{300}x{301} ", 4767)); +assertEquals(null, res[1512].exec("Ax{300}x{301}x{302}BCAx{300}x{301}C ", 4768)); +assertEquals("A,,A", res[1513].exec("Ax{300}x{301}x{302}BCAx{300}x{301} "), 4769); +assertEquals("A,,A", res[1513].exec("Ax{300}x{301}x{302}BCAx{300}x{301}C "), 4770); +assertEquals("A,,A", res[1514].exec("Ax{300}x{301}x{302}BCAx{300}x{301} "), 4771); +assertEquals("A,,A", res[1514].exec("Ax{300}x{301}x{302}BCAx{300}x{301}C "), 4772); +assertEquals(null, res[1515].exec("*** Failers", 4773)); +assertEquals(null, res[1515].exec("Ax{300}x{301}x{302}", 4774)); +assertEquals(null, res[1516].exec("Ax{300}x{301}Bx{300}X", 4775)); +assertEquals(null, res[1516].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}", 4776)); +assertEquals(null, res[1516].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}X", 4777)); +assertEquals(null, res[1516].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}DAx{300}X", 4778)); +assertEquals(null, res[1517].exec("Ax{300}x{301}Bx{300}X", 4779)); +assertEquals(null, res[1517].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}", 4780)); +assertEquals(null, res[1517].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}X", 4781)); +assertEquals(null, res[1517].exec("Ax{300}x{301}Bx{300}Cx{300}x{301}DAx{300}X", 4782)); +assertEquals(null, res[1518].exec("12X", 4783)); +assertEquals(null, res[1518].exec("123X", 4784)); +assertEquals(null, res[1518].exec("*** Failers", 4785)); +assertEquals(null, res[1518].exec("X", 4786)); +assertEquals(null, res[1518].exec("1X", 4787)); +assertEquals(null, res[1518].exec("1234X ", 4788)); +assertEquals(null, res[1518].exec("x{100} ", 4789)); +assertEquals(null, res[1518].exec("x{101} ", 4790)); +assertEquals(null, res[1518].exec("x{2e81}x{3007}x{2f804}x{31a0}", 4791)); +assertEquals(null, res[1518].exec("** Failers", 4792)); +assertEquals(null, res[1518].exec("x{2e7f} ", 4793)); +assertEquals(null, res[1518].exec("x{3105}", 4794)); +assertEquals(null, res[1518].exec("** Failers", 4795)); +assertEquals(null, res[1518].exec("x{30ff} ", 4796)); +assertEquals(null, res[1519].exec("x{06e9}", 4797)); +assertEquals(null, res[1519].exec("x{060b}", 4798)); +assertEquals(null, res[1519].exec("** Failers", 4799)); +assertEquals(null, res[1519].exec("Xx{06e9} ", 4800)); +assertEquals(null, res[1520].exec("x{2f800}", 4801)); +assertEquals(null, res[1520].exec("** Failers", 4802)); +assertEquals(null, res[1520].exec("x{a014}", 4803)); +assertEquals(null, res[1520].exec("x{a4c6} ", 4804)); +assertEquals(null, res[1521].exec("AXYZ", 4805)); +assertEquals(null, res[1521].exec("x{1234}XYZ ", 4806)); +assertEquals(null, res[1521].exec("** Failers", 4807)); +assertEquals(null, res[1521].exec("X ", 4808)); +assertEquals(null, res[1522].exec("** Failers", 4809)); +assertEquals(null, res[1522].exec("AX", 4810)); +assertEquals(null, res[1523].exec("XYZ", 4811)); +assertEquals(null, res[1523].exec("AXYZ", 4812)); +assertEquals(null, res[1523].exec("x{1234}XYZ ", 4813)); +assertEquals(null, res[1523].exec("** Failers", 4814)); +assertEquals(null, res[1523].exec("ABXYZ ", 4815)); +assertEquals(null, res[1524].exec("XYZ", 4816)); +assertEquals(null, res[1524].exec("** Failers", 4817)); +assertEquals(null, res[1524].exec("AXYZ", 4818)); +assertEquals(null, res[1524].exec("x{1234}XYZ ", 4819)); +assertEquals(null, res[1524].exec("ABXYZ ", 4820)); +assertEquals(null, res[1524].exec("AXYZ", 4821)); +assertEquals(null, res[1524].exec("x{1234}XYZ", 4822)); +assertEquals(null, res[1524].exec("Ax{1234}XYZ", 4823)); +assertEquals(null, res[1524].exec("** Failers", 4824)); +assertEquals(null, res[1524].exec("XYZ", 4825)); +assertEquals(null, res[1524].exec("** Failers", 4826)); +assertEquals(null, res[1524].exec("AXYZ", 4827)); +assertEquals(null, res[1524].exec("x{1234}XYZ", 4828)); +assertEquals(null, res[1524].exec("Ax{1234}XYZ", 4829)); +assertEquals(null, res[1524].exec("XYZ", 4830)); +assertEquals(null, res[1525].exec("XYZ", 4831)); +assertEquals(null, res[1525].exec("AXYZ", 4832)); +assertEquals(null, res[1525].exec("x{1234}XYZ", 4833)); +assertEquals(null, res[1525].exec("Ax{1234}XYZ", 4834)); +assertEquals(null, res[1525].exec("** Failers", 4835)); +assertEquals(null, res[1526].exec("XYZ", 4836)); +assertEquals(null, res[1526].exec("** Failers", 4837)); +assertEquals(null, res[1526].exec("AXYZ", 4838)); +assertEquals(null, res[1526].exec("x{1234}XYZ", 4839)); +assertEquals(null, res[1526].exec("Ax{1234}XYZ", 4840)); +assertEquals("AX", res[1527].exec("AXYZ"), 4841); +assertEquals(null, res[1527].exec("x{1234}XYZ ", 4842)); +assertEquals(null, res[1527].exec("** Failers", 4843)); +assertEquals(null, res[1527].exec("X ", 4844)); +assertEquals(null, res[1528].exec("** Failers", 4845)); +assertEquals("AX", res[1528].exec("AX"), 4846); +assertEquals("X", res[1529].exec("XYZ"), 4847); +assertEquals("AX", res[1529].exec("AXYZ"), 4848); +assertEquals(null, res[1529].exec("x{1234}XYZ ", 4849)); +assertEquals(null, res[1529].exec("** Failers", 4850)); +assertEquals(null, res[1529].exec("ABXYZ ", 4851)); +assertEquals("X", res[1530].exec("XYZ"), 4852); +assertEquals(null, res[1530].exec("** Failers", 4853)); +assertEquals("AX", res[1530].exec("AXYZ"), 4854); +assertEquals(null, res[1530].exec("x{1234}XYZ ", 4855)); +assertEquals(null, res[1530].exec("ABXYZ ", 4856)); +assertEquals("AX", res[1531].exec("AXYZ"), 4857); +assertEquals(null, res[1531].exec("x{1234}XYZ", 4858)); +assertEquals(null, res[1531].exec("Ax{1234}XYZ", 4859)); +assertEquals(null, res[1531].exec("** Failers", 4860)); +assertEquals(null, res[1531].exec("XYZ", 4861)); +assertEquals(null, res[1532].exec("** Failers", 4862)); +assertEquals("AX", res[1532].exec("AXYZ"), 4863); +assertEquals(null, res[1532].exec("x{1234}XYZ", 4864)); +assertEquals(null, res[1532].exec("Ax{1234}XYZ", 4865)); +assertEquals(null, res[1532].exec("XYZ", 4866)); +assertEquals("X", res[1533].exec("XYZ"), 4867); +assertEquals("AX", res[1533].exec("AXYZ"), 4868); +assertEquals(null, res[1533].exec("x{1234}XYZ", 4869)); +assertEquals(null, res[1533].exec("Ax{1234}XYZ", 4870)); +assertEquals(null, res[1533].exec("** Failers", 4871)); +assertEquals("X", res[1534].exec("XYZ"), 4872); +assertEquals(null, res[1534].exec("** Failers", 4873)); +assertEquals("AX", res[1534].exec("AXYZ"), 4874); +assertEquals(null, res[1534].exec("x{1234}XYZ", 4875)); +assertEquals(null, res[1534].exec("Ax{1234}XYZ", 4876)); +assertEquals(null, res[1535].exec("abcdefgh", 4877)); +assertEquals(null, res[1535].exec("x{1234}\n\x0dx{3456}xyz ", 4878)); +assertEquals(null, res[1536].exec("abcdefgh", 4879)); +assertEquals(null, res[1536].exec("x{1234}\n\x0dx{3456}xyz ", 4880)); +assertEquals(null, res[1537].exec("** Failers", 4881)); +assertEquals(null, res[1537].exec("abcdefgh", 4882)); +assertEquals(null, res[1537].exec("x{1234}\n\x0dx{3456}xyz ", 4883)); +assertEquals(null, res[1538].exec(" AXY", 4884)); +assertEquals(null, res[1538].exec(" aXY", 4885)); +assertEquals(null, res[1538].exec(" x{1c5}XY", 4886)); +assertEquals(null, res[1538].exec(" ** Failers", 4887)); +assertEquals(null, res[1538].exec(" x{1bb}XY", 4888)); +assertEquals(null, res[1538].exec(" x{2b0}XY", 4889)); +assertEquals(null, res[1538].exec(" !XY ", 4890)); +assertEquals(null, res[1539].exec(" AXY", 4891)); +assertEquals(null, res[1539].exec(" aXY", 4892)); +assertEquals(null, res[1539].exec(" x{1c5}XY", 4893)); +assertEquals(null, res[1539].exec(" ** Failers", 4894)); +assertEquals(null, res[1539].exec(" x{1bb}XY", 4895)); +assertEquals(null, res[1539].exec(" x{2b0}XY", 4896)); +assertEquals(null, res[1539].exec(" !XY ", 4897)); +assertEquals(null, res[1539].exec(" AXY", 4898)); +assertEquals(null, res[1539].exec(" aXY", 4899)); +assertEquals(null, res[1539].exec(" AbcdeXyz ", 4900)); +assertEquals(null, res[1539].exec(" x{1c5}AbXY", 4901)); +assertEquals(null, res[1539].exec(" abcDEXypqreXlmn ", 4902)); +assertEquals(null, res[1539].exec(" ** Failers", 4903)); +assertEquals(null, res[1539].exec(" x{1bb}XY", 4904)); +assertEquals(null, res[1539].exec(" x{2b0}XY", 4905)); +assertEquals(null, res[1539].exec(" !XY ", 4906)); +assertEquals(null, res[1540].exec(" AXY", 4907)); +assertEquals(null, res[1540].exec(" aXY", 4908)); +assertEquals(null, res[1540].exec(" AbcdeXyz ", 4909)); +assertEquals(null, res[1540].exec(" x{1c5}AbXY", 4910)); +assertEquals(null, res[1540].exec(" abcDEXypqreXlmn ", 4911)); +assertEquals(null, res[1540].exec(" ** Failers", 4912)); +assertEquals(null, res[1540].exec(" x{1bb}XY", 4913)); +assertEquals(null, res[1540].exec(" x{2b0}XY", 4914)); +assertEquals(null, res[1540].exec(" !XY ", 4915)); +assertEquals(null, res[1540].exec(" AXY", 4916)); +assertEquals(null, res[1540].exec(" aXY", 4917)); +assertEquals(null, res[1540].exec(" AbcdeXyz ", 4918)); +assertEquals(null, res[1540].exec(" x{1c5}AbXY", 4919)); +assertEquals(null, res[1540].exec(" abcDEXypqreXlmn ", 4920)); +assertEquals(null, res[1540].exec(" ** Failers", 4921)); +assertEquals(null, res[1540].exec(" x{1bb}XY", 4922)); +assertEquals(null, res[1540].exec(" x{2b0}XY", 4923)); +assertEquals(null, res[1540].exec(" !XY ", 4924)); +assertEquals(null, res[1541].exec(" AXY", 4925)); +assertEquals(null, res[1541].exec(" aXY", 4926)); +assertEquals(null, res[1541].exec(" AbcdeXyz ", 4927)); +assertEquals(null, res[1541].exec(" x{1c5}AbXY", 4928)); +assertEquals(null, res[1541].exec(" abcDEXypqreXlmn ", 4929)); +assertEquals(null, res[1541].exec(" ** Failers", 4930)); +assertEquals(null, res[1541].exec(" x{1bb}XY", 4931)); +assertEquals(null, res[1541].exec(" x{2b0}XY", 4932)); +assertEquals(null, res[1541].exec(" !XY ", 4933)); +assertEquals(null, res[1542].exec(" !XY", 4934)); +assertEquals(null, res[1542].exec(" x{1bb}XY", 4935)); +assertEquals(null, res[1542].exec(" x{2b0}XY", 4936)); +assertEquals(null, res[1542].exec(" ** Failers", 4937)); +assertEquals(null, res[1542].exec(" x{1c5}XY", 4938)); +assertEquals(null, res[1542].exec(" AXY ", 4939)); +assertEquals(null, res[1543].exec(" !XY", 4940)); +assertEquals(null, res[1543].exec(" x{1bb}XY", 4941)); +assertEquals(null, res[1543].exec(" x{2b0}XY", 4942)); +assertEquals(null, res[1543].exec(" ** Failers", 4943)); +assertEquals(null, res[1543].exec(" x{1c5}XY", 4944)); +assertEquals(null, res[1543].exec(" AXY ", 4945)); +assertEquals(null, res[1543].exec("x{c0}x{e0}x{116}x{117}", 4946)); +assertEquals(null, res[1543].exec("x{c0}x{e0}x{116}x{117}", 4947)); +assertEquals(null, res[1545].exec("123abcdefg", 4948)); +assertEquals(null, res[1545].exec("123abc\xc4\xc5zz", 4949)); +assertEquals(null, res[1546].exec("x{102A4}x{AA52}x{A91D}x{1C46}x{10283}x{1092E}x{1C6B}x{A93B}x{A8BF}x{1BA0}x{A50A}====", 4950)); +assertEquals(null, res[1546].exec("x{a77d}x{1d79}", 4951)); +assertEquals(null, res[1546].exec("x{1d79}x{a77d} ", 4952)); +assertEquals(null, res[1546].exec("x{a77d}x{1d79}", 4953)); +assertEquals(null, res[1546].exec("** Failers ", 4954)); +assertEquals(null, res[1546].exec("x{1d79}x{a77d} ", 4955)); +assertThrows("var re = //;", 4956); diff --git a/deps/v8/test/mjsunit/regexp-standalones.js b/deps/v8/test/mjsunit/regexp-standalones.js new file mode 100644 index 0000000000..4699754b8f --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-standalones.js @@ -0,0 +1,78 @@ +// Copyright 2008 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. + +/* Many of the Mozilla regexp tests used 'toSource' to test their + * results. Since we don't currently support toSource, those tests + * are disabled and standalone versions are included here. + */ + +// Tests from ecma_3/RegExp/regress-78156.js +var string = 'aaa\n789\r\nccc\r\n345'; +var pattern = /^\d/gm; +var result = string.match(pattern); +assertEquals(2, result.length, "1"); +assertEquals('7', result[0], "2"); +assertEquals('3', result[1], "3"); + +pattern = /\d$/gm; +result = string.match(pattern); +assertEquals(2, result.length, "4"); +assertEquals('9', result[0], "5"); +assertEquals('5', result[1], "6"); + +string = 'aaa\n789\r\nccc\r\nddd'; +pattern = /^\d/gm; +result = string.match(pattern); +assertEquals(1, result.length, "7"); +assertEquals('7', result[0], "8"); + +pattern = /\d$/gm; +result = string.match(pattern); +assertEquals(1, result.length, "9"); +assertEquals('9', result[0], "10"); + +// Tests from ecma_3/RegExp/regress-72964.js +pattern = /[\S]+/; +string = '\u00BF\u00CD\u00BB\u00A7'; +result = string.match(pattern); +assertEquals(1, result.length, "11"); +assertEquals(string, result[0], "12"); + +string = '\u00BF\u00CD \u00BB\u00A7'; +result = string.match(pattern); +assertEquals(1, result.length, "13"); +assertEquals('\u00BF\u00CD', result[0], "14"); + +string = '\u4e00\uac00\u4e03\u4e00'; +result = string.match(pattern); +assertEquals(1, result.length, "15"); +assertEquals(string, result[0], "16"); + +string = '\u4e00\uac00 \u4e03\u4e00'; +result = string.match(pattern); +assertEquals(1, result.length, "17"); +assertEquals('\u4e00\uac00', result[0], "18"); diff --git a/deps/v8/test/mjsunit/regexp-static.js b/deps/v8/test/mjsunit/regexp-static.js new file mode 100644 index 0000000000..9e73f3d6ff --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-static.js @@ -0,0 +1,167 @@ +// Copyright 2008 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 we throw exceptions when calling test and exec with no +// input. This is not part of the spec, but we do it for +// compatibility with JSC. +assertThrows("/a/.test()"); +assertThrows("/a/.exec()"); + +// Test that we do not throw exceptions once the static RegExp.input +// field has been set. +RegExp.input = "a"; +assertDoesNotThrow("/a/.test()"); +assertDoesNotThrow("/a/.exec()"); + +// Test the (deprecated as of JS 1.5) properties of the RegExp function. +var re = /((\d+)\.(\d+))/; +var s = 'abc123.456def'; + +re.exec(s); + +assertEquals(s, RegExp.input); +assertEquals('123.456', RegExp.lastMatch); +assertEquals('456', RegExp.lastParen); +assertEquals('abc', RegExp.leftContext); +assertEquals('def', RegExp.rightContext); + +assertEquals(s, RegExp['$_']); +assertEquals('123.456', RegExp['$&']); +assertEquals('456', RegExp['$+']); +assertEquals('abc', RegExp['$`']); +assertEquals('def', RegExp["$'"]); + +assertEquals('123.456', RegExp['$1']); +assertEquals('123', RegExp['$2']); +assertEquals('456', RegExp['$3']); +for (var i = 4; i < 10; ++i) { + assertEquals('', RegExp['$' + i]); +} + +// They should be read only. +RegExp['$1'] = 'fisk'; +assertEquals('123.456', RegExp['$1']); + +// String.prototype.match and String.prototype.replace (when given a +// regexp) and also RegExp.prototype.test should all behave as if +// RegExp.prototype.exec were called. +s = 'ghi789.012jkl'; +s.match(re); +assertEquals(s, RegExp.input); +assertEquals('789.012', RegExp.lastMatch); +assertEquals('012', RegExp.lastParen); +assertEquals('ghi', RegExp.leftContext); +assertEquals('jkl', RegExp.rightContext); +assertEquals(s, RegExp['$_']); +assertEquals('789.012', RegExp['$&']); +assertEquals('012', RegExp['$+']); +assertEquals('ghi', RegExp['$`']); +assertEquals('jkl', RegExp["$'"]); +assertEquals('789.012', RegExp['$1']); +assertEquals('789', RegExp['$2']); +assertEquals('012', RegExp['$3']); +for (var i = 4; i < 10; ++i) { + assertEquals('', RegExp['$' + i]); +} + +s = 'abc123.456def'; +s.replace(re, 'whocares'); +assertEquals(s, RegExp.input); +assertEquals('123.456', RegExp.lastMatch); +assertEquals('456', RegExp.lastParen); +assertEquals('abc', RegExp.leftContext); +assertEquals('def', RegExp.rightContext); +assertEquals(s, RegExp['$_']); +assertEquals('123.456', RegExp['$&']); +assertEquals('456', RegExp['$+']); +assertEquals('abc', RegExp['$`']); +assertEquals('def', RegExp["$'"]); +assertEquals('123.456', RegExp['$1']); +assertEquals('123', RegExp['$2']); +assertEquals('456', RegExp['$3']); +for (var i = 4; i < 10; ++i) { + assertEquals('', RegExp['$' + i]); +} + +s = 'ghi789.012jkl'; +re.test(s); +assertEquals(s, RegExp.input); +assertEquals('789.012', RegExp.lastMatch); +assertEquals('012', RegExp.lastParen); +assertEquals('ghi', RegExp.leftContext); +assertEquals('jkl', RegExp.rightContext); +assertEquals(s, RegExp['$_']); +assertEquals('789.012', RegExp['$&']); +assertEquals('012', RegExp['$+']); +assertEquals('ghi', RegExp['$`']); +assertEquals('jkl', RegExp["$'"]); +assertEquals('789.012', RegExp['$1']); +assertEquals('789', RegExp['$2']); +assertEquals('012', RegExp['$3']); +for (var i = 4; i < 10; ++i) { + assertEquals('', RegExp['$' + i]); +} + +// String.prototype.replace must interleave matching and replacing when a +// global regexp is matched and replaced with the result of a function, in +// case the function uses the static properties of the regexp constructor. +re = /(.)/g; +function f() { return RegExp.$1; }; +assertEquals('abcd', 'abcd'.replace(re, f)); + +// lastParen where the last parenthesis didn't match. +assertEquals("foo,", /foo(?:a(x))?/.exec("foobx"), "lastParen setup"); +assertEquals("", RegExp.lastParen, "lastParen"); + +// The same test for $1 to $9. +for (var i = 1; i <= 9; i++) { + var haystack = "foo"; + var re_text = "^foo"; + for (var j = 0; j < i - 1; j++) { + haystack += "x"; + re_text += "(x)"; + } + re_text += "(?:a(x))?"; + haystack += "bx"; + var re = new RegExp(re_text); + assertTrue(re.test(haystack), "$" + i + " setup"); + for (var j = 1; j < i - 1; j++) { + assertEquals("x", RegExp['$' + j], "$" + j + " in $" + i + " setup"); + } + assertEquals("", RegExp['$' + (i)], "$" + i); +} + +RegExp.multiline = "foo"; +assertTrue(typeof RegExp.multiline == typeof Boolean(), "RegExp.multiline coerces values to booleans"); +RegExp.input = Number(); +assertTrue(typeof RegExp.input == typeof String(), "RegExp.input coerces values to booleans"); + +// Ensure that we save the correct string as the last subject when +// we do a match on a sliced string (the top one not the underlying). +var foo = "lsdfj sldkfj sdklfj læsdfjl sdkfjlsdk fjsdl fjsdljskdj flsj flsdkj flskd regexp: /foobar/\nldkfj sdlkfj sdkl"; +assertTrue(/^([a-z]+): (.*)/.test(foo.substring(foo.indexOf("regexp:"))), "regexp: setup"); +assertEquals("regexp", RegExp.$1, "RegExp.$1"); diff --git a/deps/v8/test/mjsunit/regexp-string-methods.js b/deps/v8/test/mjsunit/regexp-string-methods.js new file mode 100644 index 0000000000..ef3bf6eaf1 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp-string-methods.js @@ -0,0 +1,51 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Regexp shouldn't use String.prototype.slice() +var s = new String("foo"); +assertEquals("f", s.slice(0,1)); +String.prototype.slice = function() { return "x"; } +assertEquals("x", s.slice(0,1)); +assertEquals("g", /g/.exec("gg")); + +// Regexp shouldn't use String.prototype.charAt() +var f1 = new RegExp("f", "i"); +assertEquals("F", f1.exec("F")); +assertEquals("f", "foo".charAt(0)); +String.prototype.charAt = function(idx) { return 'g'; }; +assertEquals("g", "foo".charAt(0)); +var f2 = new RegExp("[g]", "i"); +assertEquals("G", f2.exec("G")); +assertTrue(f2.ignoreCase); + +// On the other hand test is defined in a semi-coherent way as a call to exec. +// 15.10.6.3 +// We match other browsers in using the original value of RegExp.prototype.exec. +// I.e., RegExp.prototype.test shouldn't use the current value of +// RegExp.prototype.exec. +RegExp.prototype.exec = function(string) { return 'x'; } +assertFalse(/f/.test('x')); diff --git a/deps/v8/test/mjsunit/regexp.js b/deps/v8/test/mjsunit/regexp.js new file mode 100644 index 0000000000..e562df0902 --- /dev/null +++ b/deps/v8/test/mjsunit/regexp.js @@ -0,0 +1,377 @@ +// Copyright 2008 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 testEscape(str, regex) { + assertEquals("foo:bar:baz", str.split(regex).join(":")); +} + +testEscape("foo\nbar\nbaz", /\n/); +testEscape("foo bar baz", /\s/); +testEscape("foo\tbar\tbaz", /\s/); +testEscape("foo-bar-baz", /\u002D/); + +// Test containing null char in regexp. +var s = '[' + String.fromCharCode(0) + ']'; +var re = new RegExp(s); +assertEquals(s.match(re).length, 1); +assertEquals(s.match(re)[0], String.fromCharCode(0)); + +// Test strings containing all line separators +s = 'aA\nbB\rcC\r\ndD\u2028eE\u2029fF'; +re = /^./gm; // any non-newline character at the beginning of a line +var result = s.match(re); +assertEquals(result.length, 6); +assertEquals(result[0], 'a'); +assertEquals(result[1], 'b'); +assertEquals(result[2], 'c'); +assertEquals(result[3], 'd'); +assertEquals(result[4], 'e'); +assertEquals(result[5], 'f'); + +re = /.$/gm; // any non-newline character at the end of a line +result = s.match(re); +assertEquals(result.length, 6); +assertEquals(result[0], 'A'); +assertEquals(result[1], 'B'); +assertEquals(result[2], 'C'); +assertEquals(result[3], 'D'); +assertEquals(result[4], 'E'); +assertEquals(result[5], 'F'); + +re = /^[^]/gm; // *any* character at the beginning of a line +result = s.match(re); +assertEquals(result.length, 7); +assertEquals(result[0], 'a'); +assertEquals(result[1], 'b'); +assertEquals(result[2], 'c'); +assertEquals(result[3], '\n'); +assertEquals(result[4], 'd'); +assertEquals(result[5], 'e'); +assertEquals(result[6], 'f'); + +re = /[^]$/gm; // *any* character at the end of a line +result = s.match(re); +assertEquals(result.length, 7); +assertEquals(result[0], 'A'); +assertEquals(result[1], 'B'); +assertEquals(result[2], 'C'); +assertEquals(result[3], '\r'); +assertEquals(result[4], 'D'); +assertEquals(result[5], 'E'); +assertEquals(result[6], 'F'); + +// Some tests from the Mozilla tests, where our behavior differs from +// SpiderMonkey. +// From ecma_3/RegExp/regress-334158.js +assertTrue(/\ca/.test( "\x01" )); +assertFalse(/\ca/.test( "\\ca" )); +// Passes in KJS, fails in IrregularExpressions. +// See http://code.google.com/p/v8/issues/detail?id=152 +//assertTrue(/\c[a/]/.test( "\x1ba/]" )); + + +// Test \c in character class +re = /^[\cM]$/; +assertTrue(re.test("\r")); +assertFalse(re.test("M")); +assertFalse(re.test("c")); +assertFalse(re.test("\\")); +assertFalse(re.test("\x03")); // I.e., read as \cc + +re = /^[\c]]$/; +assertTrue(re.test("c]")); +assertFalse(re.test("\\]")); +assertFalse(re.test("\x1d")); // ']' & 0x1f +assertFalse(re.test("\\]")); +assertFalse(re.test("\x03]")); // I.e., read as \cc + + +// Test that we handle \s and \S correctly inside some bizarre +// character classes. +re = /[\s-:]/; +assertTrue(re.test('-')); +assertTrue(re.test(':')); +assertTrue(re.test(' ')); +assertTrue(re.test('\t')); +assertTrue(re.test('\n')); +assertFalse(re.test('a')); +assertFalse(re.test('Z')); + +re = /[\S-:]/; +assertTrue(re.test('-')); +assertTrue(re.test(':')); +assertFalse(re.test(' ')); +assertFalse(re.test('\t')); +assertFalse(re.test('\n')); +assertTrue(re.test('a')); +assertTrue(re.test('Z')); + +re = /[^\s-:]/; +assertFalse(re.test('-')); +assertFalse(re.test(':')); +assertFalse(re.test(' ')); +assertFalse(re.test('\t')); +assertFalse(re.test('\n')); +assertTrue(re.test('a')); +assertTrue(re.test('Z')); + +re = /[^\S-:]/; +assertFalse(re.test('-')); +assertFalse(re.test(':')); +assertTrue(re.test(' ')); +assertTrue(re.test('\t')); +assertTrue(re.test('\n')); +assertFalse(re.test('a')); +assertFalse(re.test('Z')); + +re = /[\s]/; +assertFalse(re.test('-')); +assertFalse(re.test(':')); +assertTrue(re.test(' ')); +assertTrue(re.test('\t')); +assertTrue(re.test('\n')); +assertFalse(re.test('a')); +assertFalse(re.test('Z')); + +re = /[^\s]/; +assertTrue(re.test('-')); +assertTrue(re.test(':')); +assertFalse(re.test(' ')); +assertFalse(re.test('\t')); +assertFalse(re.test('\n')); +assertTrue(re.test('a')); +assertTrue(re.test('Z')); + +re = /[\S]/; +assertTrue(re.test('-')); +assertTrue(re.test(':')); +assertFalse(re.test(' ')); +assertFalse(re.test('\t')); +assertFalse(re.test('\n')); +assertTrue(re.test('a')); +assertTrue(re.test('Z')); + +re = /[^\S]/; +assertFalse(re.test('-')); +assertFalse(re.test(':')); +assertTrue(re.test(' ')); +assertTrue(re.test('\t')); +assertTrue(re.test('\n')); +assertFalse(re.test('a')); +assertFalse(re.test('Z')); + +re = /[\s\S]/; +assertTrue(re.test('-')); +assertTrue(re.test(':')); +assertTrue(re.test(' ')); +assertTrue(re.test('\t')); +assertTrue(re.test('\n')); +assertTrue(re.test('a')); +assertTrue(re.test('Z')); + +re = /[^\s\S]/; +assertFalse(re.test('-')); +assertFalse(re.test(':')); +assertFalse(re.test(' ')); +assertFalse(re.test('\t')); +assertFalse(re.test('\n')); +assertFalse(re.test('a')); +assertFalse(re.test('Z')); + +// Test beginning and end of line assertions with or without the +// multiline flag. +re = /^\d+/; +assertFalse(re.test("asdf\n123")); +re = /^\d+/m; +assertTrue(re.test("asdf\n123")); + +re = /\d+$/; +assertFalse(re.test("123\nasdf")); +re = /\d+$/m; +assertTrue(re.test("123\nasdf")); + +// Test that empty matches are handled correctly for multiline global +// regexps. +re = /^(.*)/mg; +assertEquals(3, "a\n\rb".match(re).length); +assertEquals("*a\n*b\r*c\n*\r*d\r*\n*e", "a\nb\rc\n\rd\r\ne".replace(re, "*$1")); + +// Test that empty matches advance one character +re = new RegExp("", "g"); +assertEquals("xAx", "A".replace(re, "x")); +assertEquals(3, String.fromCharCode(161).replace(re, "x").length); + +// Test that we match the KJS behavior with regard to undefined constructor +// arguments: +re = new RegExp(); +// KJS actually shows this as '//'. Here we match the Firefox behavior (ie, +// giving a syntactically legal regexp literal). +assertEquals('/(?:)/', re.toString()); +re = new RegExp(void 0); +assertEquals('/(?:)/', re.toString()); +re.compile(); +assertEquals('/(?:)/', re.toString()); +re.compile(void 0); +assertEquals('/undefined/', re.toString()); + + +// Check for lazy RegExp literal creation +function lazyLiteral(doit) { + if (doit) return "".replace(/foo(/gi, ""); + return true; +} + +assertTrue(lazyLiteral(false)); +assertThrows("lazyLiteral(true)"); + +// Check $01 and $10 +re = new RegExp("(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)"); +assertEquals("t", "123456789t".replace(re, "$10"), "$10"); +assertEquals("15", "123456789t".replace(re, "$15"), "$10"); +assertEquals("1", "123456789t".replace(re, "$01"), "$01"); +assertEquals("$001", "123456789t".replace(re, "$001"), "$001"); +re = new RegExp("foo(.)"); +assertEquals("bar$0", "foox".replace(re, "bar$0"), "$0"); +assertEquals("bar$00", "foox".replace(re, "bar$00"), "$00"); +assertEquals("bar$000", "foox".replace(re, "bar$000"), "$000"); +assertEquals("barx", "foox".replace(re, "bar$01"), "$01 2"); +assertEquals("barx5", "foox".replace(re, "bar$15"), "$15"); + +assertFalse(/()foo$\1/.test("football"), "football1"); +assertFalse(/foo$(?=ball)/.test("football"), "football2"); +assertFalse(/foo$(?!bar)/.test("football"), "football3"); +assertTrue(/()foo$\1/.test("foo"), "football4"); +assertTrue(/foo$(?=(ball)?)/.test("foo"), "football5"); +assertTrue(/()foo$(?!bar)/.test("foo"), "football6"); +assertFalse(/(x?)foo$\1/.test("football"), "football7"); +assertFalse(/foo$(?=ball)/.test("football"), "football8"); +assertFalse(/foo$(?!bar)/.test("football"), "football9"); +assertTrue(/(x?)foo$\1/.test("foo"), "football10"); +assertTrue(/foo$(?=(ball)?)/.test("foo"), "football11"); +assertTrue(/foo$(?!bar)/.test("foo"), "football12"); + +// Check that the back reference has two successors. See +// BackReferenceNode::PropagateForward. +assertFalse(/f(o)\b\1/.test('foo')); +assertTrue(/f(o)\B\1/.test('foo')); + +// Back-reference, ignore case: +// ASCII +assertEquals("xaAx,a", String(/x(a)\1x/i.exec("xaAx")), "backref-ASCII"); +assertFalse(/x(...)\1/i.test("xaaaaa"), "backref-ASCII-short"); +assertTrue(/x((?:))\1\1x/i.test("xx"), "backref-ASCII-empty"); +assertTrue(/x(?:...|(...))\1x/i.test("xabcx"), "backref-ASCII-uncaptured"); +assertTrue(/x(?:...|(...))\1x/i.test("xabcABCx"), "backref-ASCII-backtrack"); +assertEquals("xaBcAbCABCx,aBc", + String(/x(...)\1\1x/i.exec("xaBcAbCABCx")), + "backref-ASCII-twice"); + +for (var i = 0; i < 128; i++) { + var testName = "backref-ASCII-char-" + i + "," + (i^0x20); + var test = /^(.)\1$/i.test(String.fromCharCode(i, i ^ 0x20)) + var c = String.fromCharCode(i); + if (('A' <= c && c <= 'Z') || ('a' <= c && c <= 'z')) { + assertTrue(test, testName); + } else { + assertFalse(test, testName); + } +} + +assertFalse(/f(o)$\1/.test('foo'), "backref detects at_end"); + +// Check decimal escapes doesn't overflow. +// (Note: \214 is interpreted as octal). +assertEquals(/\2147483648/.exec("\x8c7483648"), + ["\x8c7483648"], + "Overflow decimal escape"); + + +// Check numbers in quantifiers doesn't overflow and doesn't throw on +// too large numbers. +assertFalse(/a{111111111111111111111111111111111111111111111}/.test('b'), + "overlarge1"); +assertFalse(/a{999999999999999999999999999999999999999999999}/.test('b'), + "overlarge2"); +assertFalse(/a{1,111111111111111111111111111111111111111111111}/.test('b'), + "overlarge3"); +assertFalse(/a{1,999999999999999999999999999999999999999999999}/.test('b'), + "overlarge4"); +assertFalse(/a{2147483648}/.test('b'), + "overlarge5"); +assertFalse(/a{21474836471}/.test('b'), + "overlarge6"); +assertFalse(/a{1,2147483648}/.test('b'), + "overlarge7"); +assertFalse(/a{1,21474836471}/.test('b'), + "overlarge8"); +assertFalse(/a{2147483648,2147483648}/.test('b'), + "overlarge9"); +assertFalse(/a{21474836471,21474836471}/.test('b'), + "overlarge10"); +assertFalse(/a{2147483647}/.test('b'), + "overlarge11"); +assertFalse(/a{1,2147483647}/.test('b'), + "overlarge12"); +assertTrue(/a{1,2147483647}/.test('a'), + "overlarge13"); +assertFalse(/a{2147483647,2147483647}/.test('a'), + "overlarge14"); + + +// Check that we don't read past the end of the string. +assertFalse(/f/.test('b')); +assertFalse(/[abc]f/.test('x')); +assertFalse(/[abc]f/.test('xa')); +assertFalse(/[abc]</.test('x')); +assertFalse(/[abc]</.test('xa')); +assertFalse(/f/i.test('b')); +assertFalse(/[abc]f/i.test('x')); +assertFalse(/[abc]f/i.test('xa')); +assertFalse(/[abc]</i.test('x')); +assertFalse(/[abc]</i.test('xa')); +assertFalse(/f[abc]/.test('x')); +assertFalse(/f[abc]/.test('xa')); +assertFalse(/<[abc]/.test('x')); +assertFalse(/<[abc]/.test('xa')); +assertFalse(/f[abc]/i.test('x')); +assertFalse(/f[abc]/i.test('xa')); +assertFalse(/<[abc]/i.test('x')); +assertFalse(/<[abc]/i.test('xa')); + +// Test that merging of quick test masks gets it right. +assertFalse(/x([0-7]%%x|[0-6]%%y)/.test('x7%%y'), 'qt'); +assertFalse(/()x\1(y([0-7]%%%x|[0-6]%%%y)|dkjasldkas)/.test('xy7%%%y'), 'qt2'); +assertFalse(/()x\1(y([0-7]%%%x|[0-6]%%%y)|dkjasldkas)/.test('xy%%%y'), 'qt3'); +assertFalse(/()x\1y([0-7]%%%x|[0-6]%%%y)/.test('xy7%%%y'), 'qt4'); +assertFalse(/()x\1(y([0-7]%%%x|[0-6]%%%y)|dkjasldkas)/.test('xy%%%y'), 'qt5'); +assertFalse(/()x\1y([0-7]%%%x|[0-6]%%%y)/.test('xy7%%%y'), 'qt6'); +assertFalse(/xy([0-7]%%%x|[0-6]%%%y)/.test('xy7%%%y'), 'qt7'); +assertFalse(/x([0-7]%%%x|[0-6]%%%y)/.test('x7%%%y'), 'qt8'); + + +// Don't hang on this one. +/[^\xfe-\xff]*/.test(""); diff --git a/deps/v8/test/mjsunit/regress/regress-1030466.js b/deps/v8/test/mjsunit/regress/regress-1030466.js new file mode 100644 index 0000000000..8427ba028a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1030466.js @@ -0,0 +1,45 @@ +// Copyright 2008 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. + +// Whenever we enter a with-scope, we copy the context. This in itself is fine +// (contexts may escape), but when leaving a with-scope, we currently also copy +// the context instead of reverting to the original. This does not work because +// inner functions may already have been created using the original context. In +// the failing test case below, the inner function is run in the original context +// (where x is undefined), but the assignment to x after the with-statement is +// run in the copied context: + +var result = (function outer() { + with ({}) { } + var x = 10; + function inner() { + return x; + }; + return inner(); +})(); + +assertEquals(10, result); diff --git a/deps/v8/test/mjsunit/regress/regress-1036894.js b/deps/v8/test/mjsunit/regress/regress-1036894.js new file mode 100644 index 0000000000..d89ceda11c --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1036894.js @@ -0,0 +1,38 @@ +// Copyright 2008 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. + +xeval = function(s) { eval(s); } +xeval("$=function anonymous() { /*noex*/do {} while(({ get x(x) { break ; }, set x() { (undefined);} })); }"); + +foo = function() { eval("$=function anonymous() { /*noex*/do {} while(({ get x(x) { break ; }, set x() { (undefined);} })); }"); } +foo(); + +xeval = function(s) { eval(s); } +eval("$=function anonymous() { /*noex*/do {} while(({ get x(x) { break ; }, set x() { (undefined);} })); }"); + +xeval = function(s) { eval(s); } +xeval('$=function(){L: {break L;break L;}};'); diff --git a/deps/v8/test/mjsunit/regress/regress-1039610.js b/deps/v8/test/mjsunit/regress/regress-1039610.js new file mode 100644 index 0000000000..fd5c549c1c --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1039610.js @@ -0,0 +1,29 @@ +// Copyright 2008 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. + +// Make sure that the Debug object does not return to the global object +assertTrue(typeof(Debug) === 'undefined');
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/regress/regress-1050043.js b/deps/v8/test/mjsunit/regress/regress-1050043.js new file mode 100644 index 0000000000..e42728fc50 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1050043.js @@ -0,0 +1,51 @@ +// Copyright 2008 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 unsignedShiftRight(val, shift) { + return val >>> shift; +} + +assertEquals( 15, unsignedShiftRight(15, 0), "15 >>> 0"); +assertEquals( 7, unsignedShiftRight(15, 1), "15 >>> 1"); +assertEquals( 3, unsignedShiftRight(15, 2), "15 >>> 2"); + +assertEquals(4294967288, unsignedShiftRight(-8, 0), "-8 >>> 0"); +assertEquals(2147483644, unsignedShiftRight(-8, 1), "-8 >>> 1"); +assertEquals(1073741822, unsignedShiftRight(-8, 2), "-8 >>> 2"); + +assertEquals( 1, unsignedShiftRight(-8, 31), "-8 >>> 31"); +assertEquals(4294967288, unsignedShiftRight(-8, 32), "-8 >>> 32"); +assertEquals(2147483644, unsignedShiftRight(-8, 33), "-8 >>> 33"); +assertEquals(1073741822, unsignedShiftRight(-8, 34), "-8 >>> 34"); + +assertEquals(2147483648, unsignedShiftRight(0x80000000, 0), "0x80000000 >>> 0"); +assertEquals(1073741824, unsignedShiftRight(0x80000000, 1), "0x80000000 >>> 1"); +assertEquals( 536870912, unsignedShiftRight(0x80000000, 2), "0x80000000 >>> 2"); + +assertEquals(1073741824, unsignedShiftRight(0x40000000, 0), "0x40000000 >>> 0"); +assertEquals( 536870912, unsignedShiftRight(0x40000000, 1), "0x40000000 >>> 1"); +assertEquals( 268435456, unsignedShiftRight(0x40000000, 2), "0x40000000 >>> 2"); diff --git a/deps/v8/test/mjsunit/regress/regress-1062422.js b/deps/v8/test/mjsunit/regress/regress-1062422.js new file mode 100644 index 0000000000..1e2c7988c1 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1062422.js @@ -0,0 +1,30 @@ +// Copyright 2008 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. + +// 1062422 Ensure that accessors can handle unexpected receivers. +Number.prototype.__proto__ = String.prototype; +assertEquals((123).length, 0) diff --git a/deps/v8/test/mjsunit/regress/regress-1066899.js b/deps/v8/test/mjsunit/regress/regress-1066899.js new file mode 100644 index 0000000000..37fd554b54 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1066899.js @@ -0,0 +1,37 @@ +// Copyright 2008 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. + +// This test case segfaults in generated code. See +// issue #1066899. +function Crash() { + for (var key in [0]) { + try { } finally { continue; } + } +} + +Crash(); + diff --git a/deps/v8/test/mjsunit/regress/regress-1081309.js b/deps/v8/test/mjsunit/regress/regress-1081309.js new file mode 100644 index 0000000000..a771ac0448 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1081309.js @@ -0,0 +1,110 @@ +// Copyright 2008 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 + +// Make sure that the backtrace command can be processed when the receiver is +// undefined. +listenerCalled = false; +exception = false; + +function ParsedResponse(json) { + this.response_ = eval('(' + json + ')'); + this.refs_ = []; + if (this.response_.refs) { + for (var i = 0; i < this.response_.refs.length; i++) { + this.refs_[this.response_.refs[i].handle] = this.response_.refs[i]; + } + } +} + + +ParsedResponse.prototype.response = function() { + return this.response_; +} + + +ParsedResponse.prototype.body = function() { + return this.response_.body; +} + + +ParsedResponse.prototype.lookup = function(handle) { + return this.refs_[handle]; +} + + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Exception) + { + // The expected backtrace is + // 1: g + // 0: [anonymous] + + // Get the debug command processor. + var dcp = exec_state.debugCommandProcessor(); + + // Get the backtrace. + var json; + json = '{"seq":0,"type":"request","command":"backtrace"}' + var response = new ParsedResponse(dcp.processDebugJSONRequest(json)); + var backtrace = response.body(); + assertEquals(2, backtrace.totalFrames); + assertEquals(2, backtrace.frames.length); + + assertEquals("g", response.lookup(backtrace.frames[0].func.ref).name); + assertEquals("", response.lookup(backtrace.frames[1].func.ref).name); + + listenerCalled = true; + } + } catch (e) { + exception = e + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Call method on undefined. +function g() { + (void 0).f(); +}; + +// Break on the exception to do a backtrace with undefined as receiver. +Debug.setBreakOnException(true); +try { + g(); +} catch(e) { + // Ignore the exception "Cannot call method 'x' of undefined" +} + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerCalled, "listener not called"); +assertFalse(exception, "exception in listener", exception) diff --git a/deps/v8/test/mjsunit/regress/regress-1102760.js b/deps/v8/test/mjsunit/regress/regress-1102760.js new file mode 100644 index 0000000000..890ecabcaa --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1102760.js @@ -0,0 +1,35 @@ +// Copyright 2008 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 F() { + return arguments.length; +} + +assertEquals(0, F.apply(), "no receiver or args"); +assertEquals(0, F.apply(this), "no args"); +assertEquals(0, F.apply(this, []), "empty args"); +assertEquals(0, F.apply(this, [], 0), "empty args, extra argument"); diff --git a/deps/v8/test/mjsunit/regress/regress-1110164.js b/deps/v8/test/mjsunit/regress/regress-1110164.js new file mode 100644 index 0000000000..33f96af3ec --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1110164.js @@ -0,0 +1,46 @@ +// Copyright 2008 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 o = { x: 0, f: function() { return 42; } }; +delete o.x; // go dictionary + +function CallF(o) { + return o.f(); +} + +// Make sure the call IC in CallF is initialized. +for (var i = 0; i < 10; i++) assertEquals(42, CallF(o)); + +var caught = false; +o.f = 87; +try { + CallF(o); +} catch (e) { + caught = true; + assertTrue(e instanceof TypeError); +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/regress/regress-1112051.js b/deps/v8/test/mjsunit/regress/regress-1112051.js new file mode 100644 index 0000000000..0af6bb4358 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1112051.js @@ -0,0 +1,33 @@ +// Copyright 2008 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Regression test for issue #1112051. +function f() { } +assertThrows("f.call.apply()"); +assertThrows("f.call.apply(null)"); +assertThrows("f.call.apply(null, [], 0)"); +assertThrows("f.call.apply(null, [1,2,3,4,5,6,7,8,9], 0)"); diff --git a/deps/v8/test/mjsunit/regress/regress-1114040.js b/deps/v8/test/mjsunit/regress/regress-1114040.js new file mode 100644 index 0000000000..9d1b320a9a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1114040.js @@ -0,0 +1,58 @@ +// Copyright 2008 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 TestBreak() { + var sequence = ""; + for (var a in [0,1]) { + L: { + for (var b in [2,3,4]) { + break L; + } + } + sequence += a; + } + return sequence; +} + + +function TestContinue() { + var sequence = ""; + for (var a in [0,1]) { + L: do { + for (var b in [2,3,4]) { + continue L; + } + } while (false); + sequence += a; + } + return sequence; +} + + +assertEquals("01", TestBreak()); +assertEquals("01", TestContinue()); + diff --git a/deps/v8/test/mjsunit/regress/regress-1134697.js b/deps/v8/test/mjsunit/regress/regress-1134697.js new file mode 100644 index 0000000000..3d851ae775 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1134697.js @@ -0,0 +1,31 @@ +// Copyright 2008 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Regression test case for issue 1134697. +// Must run using valgrind. + +(-90).toPrecision(6); diff --git a/deps/v8/test/mjsunit/regress/regress-114.js b/deps/v8/test/mjsunit/regress/regress-114.js new file mode 100644 index 0000000000..6c1a6a348e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-114.js @@ -0,0 +1,43 @@ +// Copyright 2008 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. + +// German eszett +assertEquals("FRIEDRICHSTRASSE 14", "friedrichstra\xDFe 14".toUpperCase()); +assertEquals("XXSSSSSSXX", "xx\xDF\xDF\xDFxx".toUpperCase()); +assertEquals("(SS)", "(\xDF)".toUpperCase()); +assertEquals("SS", "\xDF".toUpperCase()); + +// Turkish dotted upper-case I lower-case converts to two characters +assertEquals("i\u0307", "\u0130".toLowerCase()); +assertEquals("(i\u0307)", "(\u0130)".toLowerCase()); +assertEquals("xxi\u0307xx", "XX\u0130XX".toLowerCase()); + +// Greek small upsilon with dialytika and tonos upper-case converts to three +// characters +assertEquals("\u03A5\u0308\u0301", "\u03B0".toUpperCase()); +assertEquals("(\u03A5\u0308\u0301)", "(\u03B0)".toUpperCase()); +assertEquals("XX\u03A5\u0308\u0301XX", "xx\u03B0xx".toUpperCase()); diff --git a/deps/v8/test/mjsunit/regress/regress-116.js b/deps/v8/test/mjsunit/regress/regress-116.js new file mode 100644 index 0000000000..7b4620ca1d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-116.js @@ -0,0 +1,40 @@ +// Copyright 2008 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 testCache = {}; +var doLookup = function(id) { + return testCache[id] = 'foo'; +}; + +var r2 = doLookup(0); +var r1 = doLookup([0]); + +assertFalse(r1 === testCache); +assertEquals('foo', r1); +assertEquals('f', r1[0]); +assertEquals('foo', r2); +assertEquals('f', r2[0]); diff --git a/deps/v8/test/mjsunit/regress/regress-1170187.js b/deps/v8/test/mjsunit/regress/regress-1170187.js new file mode 100644 index 0000000000..5e82f8a83b --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1170187.js @@ -0,0 +1,80 @@ +// Copyright 2008 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 +// Make sure that the retreival of local variables are performed correctly even +// when an adapter frame is present. + +// Get the Debug object exposed from the debug context global object. +Debug = debug.Debug + +listenerCalled = false; +exception = false; + + +function checkName(name) { + assertTrue(name == 'a' || name == 'b' || name == 'c'); +} + + +function checkValue(value) { + assertEquals(void 0, value); +} + + +function listener(event, exec_state, event_data, data) { + try { + if (event == Debug.DebugEvent.Break) { + var local0Name = exec_state.frame(0).localName(0); + var local1Name = exec_state.frame(0).localName(1); + var local2Name = exec_state.frame(0).localName(2); + checkName(local0Name); + checkName(local1Name); + checkName(local2Name); + var local0Value = exec_state.frame(0).localValue(0).value(); + var local1Value = exec_state.frame(0).localValue(1).value(); + var local2Value = exec_state.frame(0).localValue(2).value(); + checkValue(local0Value); + checkValue(local1Value); + checkValue(local2Value); + listenerCalled = true; + } + } catch (e) { + exception = e; + }; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +// Call a function with local variables passing a different number parameters +// that the number of arguments. +(function(x,y){var a,b,c; debugger; return 3})() + +// Make sure that the debug event listener vas invoked (again). +assertTrue(listenerCalled); +assertFalse(exception, "exception in listener") diff --git a/deps/v8/test/mjsunit/regress/regress-1173979.js b/deps/v8/test/mjsunit/regress/regress-1173979.js new file mode 100644 index 0000000000..42649d0abf --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1173979.js @@ -0,0 +1,48 @@ +// Copyright 2008 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 that null only equals null and undefined, also for variables. + +var null_var = null; +var undef_var = [][0]; +var boolean_var = false; +var number_var = 0; +var string_var = ""; +var object_var = { foo : 0 }; + +assertTrue(null_var == null_var); +assertTrue(null_var == undef_var); +assertTrue(null_var != boolean_var); +assertTrue(null_var != number_var); +assertTrue(null_var != string_var); +assertTrue(null_var != object_var); + +assertTrue(undef_var == null_var); +assertTrue(boolean_var != null_var); +assertTrue(number_var != null_var); +assertTrue(string_var != null_var); +assertTrue(object_var != null_var); diff --git a/deps/v8/test/mjsunit/regress/regress-1175390.js b/deps/v8/test/mjsunit/regress/regress-1175390.js new file mode 100644 index 0000000000..7b1a7e077a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1175390.js @@ -0,0 +1,30 @@ +// Copyright 2008 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: --print-code --debug-code +// Simply ensure that we can generate comments without crashing. +a = 0; diff --git a/deps/v8/test/mjsunit/regress/regress-1177518.js b/deps/v8/test/mjsunit/regress/regress-1177518.js new file mode 100644 index 0000000000..2ba3c11952 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1177518.js @@ -0,0 +1,39 @@ +// Copyright 2008 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. + +// Make sure that natives and delayed natives don't use methods from the global +// scope that could have been modified by input javascript. + +isFinite = 0; +Math.floor = 0; +Math.abs = 0; + +// uses Math.floor +assertEquals(4, parseInt(4.5)); + +// uses Math.abs, Math.floor and isFinite +assertEquals('string', typeof (new Date(9999)).toString()); diff --git a/deps/v8/test/mjsunit/regress/regress-1177809.js b/deps/v8/test/mjsunit/regress/regress-1177809.js new file mode 100644 index 0000000000..703e60739f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1177809.js @@ -0,0 +1,31 @@ +// Copyright 2008 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. + +// The encoding of large pc jumps caused code to be overwritten with +// relocation information. We pass this test if it does not crash. + +String.fromCharCode(48,48,48,59,32,102,111,110,116,45,119,101,105,103,104,116,58,98,111,108,100,59,102,111,110,116,45,102,97,109,105,108,121,58,65,114,105,97,108,44,32,72,101,108,118,101,116,105,99,97,44,32,115,97,110,115,45,115,101,114,105,102,44,86,101,114,100,97,110,97,34,32,99,111,108,111,114,61,34,35,70,70,48,48,48,48,34,62,70,79,82,69,88,47,80,65,82,38,35,51,48,52,59,60,119,98,114,32,47,62,84,69,32,38,35,51,48,52,59,38,35,51,53,48,59,76,69,77,76,69,82,38,35,51,48,52,59,60,47,102,111,110,116,62,60,47,115,112,97,110,62,60,47,116,100,62,10,60,47,116,114,62,60,116,114,62,10,60,116,100,32,97,108,105,103,110,61,34,108,101,102,116,34,62,60,115,112,97,110,32,105,100,61,34,97,99,95,100,101,115,99,34,62,60,102,111,110,116,32,115,116,121,108,101,61,34,102,111,110,116,45,115,105,122,101,58,49,49,112,120,59,32,99,111,108,111,114,58,35,48,48,48,48,48,48,59,32,102,111,110,116,45,102,97,109,105,108,121,58,65,114,105,97,108,44,32,72,101,108,118,101,116,105,99,97,44,32,115,97,110,115,45,115,101,114,105,102,44,86,101,114,100,97,110,97,34,62,38,112,111,117,110,100,59,47,36,32,50,32,112,105,112,44,32,89,84,76,32,49,50,32,112,105,112,44,65,108,116,38,35,51,48,53,59,110,32,51,32,99,101,110,116,46,32,83,97,98,105,116,32,83,112,114,101,97,100,45,84,38,117,117,109,108,59,114,60,119,98,114,32,47,62,107,32,66,97,110,107,97,115,38,35,51,48,53,59,32,65,86,65,78,84,65,74,73,60,47,102,111,110,116,62,60,47,115,112,97,110,62,60,47,116,100,62,10,60,47,116,114,62,60,116,114,62,10,60,116,100,32,97,108,105,103,110,61,34,108,101,102,116,34,62,60,100,105,118,32,105,100,61,34,97,99,95,117,114,108,34,62,60,102,111,110,116,32,115,116,121,108,101,61,34,102,111,110,116,45,115,105,122,101,58,49,48,112,120,59,32,99,111,108,111,114,58,35,70,70,54,54,57,57,59,32,102,111,110,116,45,102,97,109,105,108,121,58,65,114,105,97,108,44,32,72,101,108,118,101,116,105,99,97,44,32,115,97,110,115,45,115,101,114,105,102,44,86,101,114,100,97,110,97,34,62,119,119,119,46,104,101,100,101,102,111,60,119,98,114,32,47,62,110,108,105,110,101,46,99,111,109,60,47,102,111,110,116,62,60,47,100,105,118,62,60,47,116,100,62,60,47,116,114,62,60,47,116,97,98,108,101,62,60,47,116,100,62,60,47,116,114,62,60,116,114,62,10,60,116,100,32,99,108,97,115,115,61,34,97,99,95,107,97,114,105,109,34,32,104,101,105,103,104,116,61,34,50,48,37,34,32,98,103,99,111,108,111,114,61,34,35,70,70,70,70,70,70,34,32,105,100,61,34,116,97,119,52,34,32,97,108,105,103,110,61,34,108,101,102,116,34,32,118,97,108,105,103,110,61,34,109,105,100,100,108,101,34,32,111,110,70,111,99,117,115,61,34,115,115,40,39,103,111,32,116,111,32,119,119,119,46,107,97,108,101,100,101,60,119,98,114,32,47,62,46,99,111,109,39,44,39,97,119,52,39,41,34,32,111,110,77,111,117,115,101,79,118,101,114,61,34,115,115,40,39,103,111,32,116,111,32,119,119,119,46,107,97,108,101,100,101,60,119,98,114,32,47,62,46,99,111,109,39,44,39,97,119,52,39,41,34,32,32,111,110,77,111,117,115,101,79,117,116,61,34,99,115,40,41,34,32,111,110,67,108,105,99,107,61,34,103,97,40,39,104,116,116,112,58,47,47,97,100,115,101,114,118,101,114,46,109,121,110,101,116,46,99,111,109,47,65,100,83,101,114,118,101,114,47,99,108,105,99,107,46,106,115,112,63,117,114,108,61,56,56,49,48,48,50,53,49,50,49,55,54,51,57,52,54,50,51,49,56,52,52,48,51,57,54,48,48,54,51,49,51,54,54,52,52,56,50,56,54,50,48,49,49,49,52,55,51,55,54,52,51,50,57,50,52,50,56,51,53,56,51,54,53,48,48,48,48,53,56,49,55,50,56,57,53,48,48,52,49,57,48,54,56,56,55,50,56,49,55,48,55,53,48,57,50,55,53,55,57,57,51,54,53,50,52,54,49,51,56,49,57,53,55,52,53,50,49,52,50,55,54,48,57,53,57,56,52,55,50,55,48,56,52,51,49,54,52,49,54,57,53,48,56,57,50,54,54,54,48,57,49,54,53,55,57,48,57,49,55,57,52,55,52,55,57,50,48,55,50,55,51,51,53,51,50,55,53,50,54,55,50,56,48,51,57,49,56,54,50,56,55,49,51,55,48,52,51,49,51,52,55,56,51,54,51,52,53,50,54,55,53,57,48,57,48,56,54,57,49,52,53,49,49,52,55,53,50,120,49,57,50,88,49,54,56,88,51,56,88,52,49,88,56,48,56,48,88,65,39,41,34,32,115,116,121,108,101,61,34,99,117,114,115,111,114,58,112,111,105,110,116,101,114,34,62,10,60,116,97,98,108,101,32,119,105,100,116,104,61,34,49,53,54,34,32,98,111,114,100,101,114,61,34,48,34,32,99,101,108,108,115,112,97,99,105,110,103,61,34,49,34,32,99,101,108,108,112,97,100,100,105,110,103,61,34,49,34,62,10,60,116,114,62,10,32,32,60,116,100,32,97,108,105,103,110,61,34,108,101,102,116,34,32,62,60,115,112,97,110,32,105,100,61,34,97,99,95,116,105,116,108,101,34,62,60,102,111,110,116,32,115,116,121,108,101,61,34,102,111,110,116,45,115,105,122,101,58,49,50,112,120,59,32,99,111,108,111,114,58,35,70,70,48,48,48,48,59,32,102,111,110,116,45,119,101,105,103,104,116,58,98,111,108,100,59,102,111,110,116,45,102,97,109,105,108,121,58,65,114,105,97,108,44,32,72,101,108,118,101,116,105,99,97,44,32,115,97,110,115,45,115,101,114,105,102,44,86,101,114,100,97,110,97,34,32,99,111,108,111,114,61,34,35,70,70,48,48,48,48,34,62,66,108,117,101,32,72,111,117,115,101,32,77,105,107,115,101,114,39,100,101,32,38,35,51,53,48,59,111,107,33,60,47,102,111,110,116,62,60,47,115,112,97,110,62,60,47,116,100,62,10,60,47,116,114,62,60,116,114,62,10,60,116,100,32,97,108,105,103,110,61,34,108,101,102,116,34,62,60,115,112,97,110,32,105,100,61,34,97,99,95,100,101,115,99,34,62,60,102,111,110,116,32,115,116,121,108,101,61,34,102,111,110,116,45,115,105,122,101,58,49,49,112,120,59,32,99,111,108,111,114,58,35,48,48,48,48,48,48,59,32,102,111,110,116,45,102,97,109,105,108,121,58,65,114,105,97,108,44,32,72,101,108,118,101,116,105,99,97,44,32,115,97,110,115,45,115,101,114,105,102,44,86,101,114,100,97,110,97,34,62,66,108,117,101,32,72,111,117,115,101,32,77,105,107,115,101,114,39,100,101,32,65,110,110,101,108,101,114,101,32,38,79,117,109,108,59,122,101,108,32,70,105,121,97,116,32,83,65,68,69,67,69,32,50,57,44,57,54,32,89,84,76,33,60,47,102,111,110,116,62,60,47,115,112,97,110,62,60,47,116,100,62,10,60,47,116,114,62,60,116,114,62,10,60,116,100,32,97,108,105,103,110,61,34,108,101,102,116,34,62,60,100,105,118,32,105,100,61,34,97,99,95,117,114,108,34,62,60,102,111,110,116,32,115,116,121,108,101,61,34,102,111,110,116,45,115,105,122,101,58,49,48,112,120,59,32,99,111,108,111,114,58,35,70,70,54,54,57,57,59,32,102,111,110,116,45,102,97,109,105,108,121,58,65,114,105,97,108,44,32,72,101,108,118,101,116,105,99,97,44,32,115,97,110,115,45,115,101,114,105,102,44,86,101,114,100,97,110,97,34,62,119,119,119,46,107,97,108,101,100,101,60,119,98,114,32,47,62,46,99,111,109,60,47,102,111,110,116,62,60,47,100,105,118,62,60,47,116,100,62,60,47,116,114,62,60,47,116,97,98,108,101,62,60,47,116,100,62,60,47,116,114,62,60,116,114,62,10,60,116,100,32,99,108,97,115,115,61,34,97,99,95,107,97,114,105,109,34,32,104,101,105,103,104,116,61,34,50,48,37,34,32,98,103,99,111,108,111,114,61,34,35,70,70,70,70,70,70,34,32,105,100,61,34,116,97,119,53,34,32,97,108,105,103,110,61,34,108,101,102,116,34,32,118,97,108,105,103,110,61,34,109,105,100,100,108,101,34,32,111,110,70,111,99,117,115,61,34,115,115,40,39,103,111,32,116,111,32,119,119,119,46,98,105,116,109,101,100,60,119,98,114,32,47,62,101,110,46,99,111,109,39,44,39,97,119,53,39,41,34,32,111,110,77,111,117,115,101,79,118,101,114,61,34,115,115,40,39,103,111,32,116,111,32,119,119,119,46,98,105,116,109,101,100,60,119,98,114,32,47,62,101,110,46,99,111,109,39,44,39,97,119,53,39,41,34,32,32,111,110,77,111,117,115,101,79,117,116,61,34,99,115,40,41,34,32,111,110,67,108,105,99,107,61,34,103,97,40,39,104,116,116,112,58,47,47,97,100,115,101,114,118,101,114,46,109,121,110,101,116,46,99,111,109,47,65,100,83,101,114,118,101,114,47,99,108,105,99,107,46,106,115,112,63,117,114,108,61,51,51,54,49,55,53,56,50,56,51,56,50,53,52,57,55,54,49,48) diff --git a/deps/v8/test/mjsunit/regress/regress-1178598.js b/deps/v8/test/mjsunit/regress/regress-1178598.js new file mode 100644 index 0000000000..9caaec2f01 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1178598.js @@ -0,0 +1,90 @@ +// Copyright 2008 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Regression test cases for issue 1178598. + +// Make sure const-initialization doesn't conflict +// with heap-allocated locals for catch variables. +var value = (function(){ + try { } catch(e) { + // Force the 'e' variable to be heap-allocated + // by capturing it in a function closure. + (function() { e; }); + } + // Make sure the two definitions of 'e' do + // not conflict in any way. + eval("const e=1"); + return e; +})(); + +assertEquals(1, value); + + + +// Make sure that catch variables can be accessed using eval. +var value = (function() { + var result; + try { + throw 42; + } catch (e) { + result = eval("e"); + } + return result; +})(); + +assertEquals(42, value); + + + +// Make sure that heap-allocated locals for catch variables aren't +// visible outside the catch scope and that they are visible from +// within. +var value = (function() { + var result; + try { + throw 87; + } catch(e) { + // Force the 'e' variable to be heap-allocated + // by capturing it in a function closure. + (function() { e; }); + result = eval("e"); + } + + // Expect accessing 'e' to yield an exception because + // it is not defined in the current scope. + try { + eval("e"); + assertTrue(false); // should throw exception + } catch(exception) { + assertTrue(exception instanceof ReferenceError); + return result; + } +})(); + +assertEquals(87, value); + + diff --git a/deps/v8/test/mjsunit/regress/regress-1182832.js b/deps/v8/test/mjsunit/regress/regress-1182832.js new file mode 100644 index 0000000000..6c4fcb413e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1182832.js @@ -0,0 +1,38 @@ +// Copyright 2008 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 caught = false; +try { + (function () { + var e = 0; + eval("const e = 1;"); + })(); +} catch (e) { + caught = true; + assertTrue(e instanceof TypeError); +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/regress/regress-1187524.js b/deps/v8/test/mjsunit/regress/regress-1187524.js new file mode 100644 index 0000000000..2aeb1c5170 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1187524.js @@ -0,0 +1,34 @@ +// Copyright 2008 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. + +// Make sure we don't die on conversion to Smi in string indexing + +assertEquals(undefined, ""[0x40000000]); +assertEquals(undefined, ""[0x80000000]); +assertEquals(undefined, ""[-1]); +assertEquals(undefined, ""[-0x40000001]); +assertEquals(undefined, ""[-0x80000000]); diff --git a/deps/v8/test/mjsunit/regress/regress-1199401.js b/deps/v8/test/mjsunit/regress/regress-1199401.js new file mode 100644 index 0000000000..792faea982 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1199401.js @@ -0,0 +1,61 @@ +// Copyright 2008 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 that we can correctly change the sign of the most negative smi. + +assertEquals(1073741824, -1073741824 * -1); +assertEquals(1073741824, -1073741824 / -1); +assertEquals(1073741824, -(-1073741824)); +assertEquals(1073741824, 0 - (-1073741824)); + +var min_smi = -1073741824; + +assertEquals(1073741824, min_smi * -1); +assertEquals(1073741824, min_smi / -1); +assertEquals(1073741824, -min_smi); +assertEquals(1073741824, 0 - min_smi); + +var zero = 0; +var minus_one = -1; + +assertEquals(1073741824, min_smi * minus_one); +assertEquals(1073741824, min_smi / minus_one); +assertEquals(1073741824, -min_smi); +assertEquals(1073741824, zero - min_smi); + +assertEquals(1073741824, -1073741824 * minus_one); +assertEquals(1073741824, -1073741824 / minus_one); +assertEquals(1073741824, -(-1073741824)); +assertEquals(1073741824, zero - (-1073741824)); + +var half_min_smi = -(1<<15); +var half_max_smi = (1<<15); + +assertEquals(1073741824, -half_min_smi * half_max_smi); +assertEquals(1073741824, half_min_smi * -half_max_smi); +assertEquals(1073741824, half_max_smi * -half_min_smi); +assertEquals(1073741824, -half_max_smi * half_min_smi); diff --git a/deps/v8/test/mjsunit/regress/regress-1199637.js b/deps/v8/test/mjsunit/regress/regress-1199637.js new file mode 100644 index 0000000000..d9116c1d58 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1199637.js @@ -0,0 +1,78 @@ +// Copyright 2008 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 + +// Make sure that we can introduce global variables (using +// both var and const) that shadow even READ_ONLY variables +// in the prototype chain. +const NONE = 0; +const READ_ONLY = 1; + +// Use DeclareGlobal... +%SetProperty(this.__proto__, "a", "1234", NONE); +assertEquals(1234, a); +eval("var a = 5678;"); +assertEquals(5678, a); + +%SetProperty(this.__proto__, "b", "1234", NONE); +assertEquals(1234, b); +eval("const b = 5678;"); +assertEquals(5678, b); + +%SetProperty(this.__proto__, "c", "1234", READ_ONLY); +assertEquals(1234, c); +eval("var c = 5678;"); +assertEquals(5678, c); + +%SetProperty(this.__proto__, "d", "1234", READ_ONLY); +assertEquals(1234, d); +eval("const d = 5678;"); +assertEquals(5678, d); + +// Use DeclareContextSlot... +%SetProperty(this.__proto__, "x", "1234", NONE); +assertEquals(1234, x); +eval("with({}) { var x = 5678; }"); +assertEquals(5678, x); + +%SetProperty(this.__proto__, "y", "1234", NONE); +assertEquals(1234, y); +eval("with({}) { const y = 5678; }"); +assertEquals(5678, y); + +%SetProperty(this.__proto__, "z", "1234", READ_ONLY); +assertEquals(1234, z); +eval("with({}) { var z = 5678; }"); +assertEquals(5678, z); + +%SetProperty(this.__proto__, "w", "1234", READ_ONLY); +assertEquals(1234, w); +eval("with({}) { const w = 5678; }"); +assertEquals(5678, w); + + diff --git a/deps/v8/test/mjsunit/regress/regress-1200351.js b/deps/v8/test/mjsunit/regress/regress-1200351.js new file mode 100644 index 0000000000..f752a1e1a4 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1200351.js @@ -0,0 +1,2032 @@ +// Copyright 2008 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. + +// Make sure the 'constructor' property isn't enumerable. +var enums = ""; +for (var k in this) enums += (k + '|'); +assertEquals(-1, enums.split('|').indexOf("constructor")); + +// Make sure this doesn't crash. +new this.constructor; +new this.constructor(); +new this.constructor(1,2,3,4,5,6); + +var x = 0; +try { + eval("SetValueOf(typeof(break.prototype.name), Math.max(typeof(break)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export Join((void), false.className(), null instanceof continue, return 'a', 0.__defineGetter__(x,function(){native}))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ void&&null.push(goto NaN) : Math.max(undef).toText }) { {-1/null,1.isNull} }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new break>>>=native.charCodeAt(-1.valueOf())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Number(this > native)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new {native,0.2}?continue+undef:IsSmi(0.2)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = break.toString()&&return continue") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (-1==continue.toJSONProtocol, GetFunctionFor(break.call(NaN)), (!new RegExp).prototype.new Object()<<void) { debugger.__defineSetter__(null,function(){continue})>>>=GetFunctionFor(-1) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (parseFloat(NaN).splice() in null.add(1).className()) { true[0.2]<<x.splice() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (debugger.constructor.valueOf()) { this.sort().true.splice() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("unescape(break.toObject()).prototype.new RegExp.continue.__lookupGetter__(x.slice(1, NaN)) = typeof(null.push(0.2))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(Iterator(continue.pop()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return new RegExp.shift().concat({debugger,continue}) }; X(return goto 0)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(0.add(break)&&x > null)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ eval(Array(x)) : 1.call('a').superConstructor }) { debugger.lastIndex.toLocaleString() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = return true.__defineGetter__(this,function(){0.2})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new typeof(0)&this.lastIndex") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("String(new RegExp.call(1)).prototype.unescape(parseFloat(-1)) = false<<true.x.lastIndexOf(1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ 1+debugger.valueOf() : continue.join().name() }) { parseInt(true)==undef.sort() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new RegExp>>0.2.superConstructor.prototype.eval(void).className() = false.join().prototype.name") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export (new Object()?undef:native)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new null.isNull.slice(x.prototype.value, Iterator(undef))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export function () { 0.2 }.unshift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Math.max(continue.valueOf())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = return debugger.toObject()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (-1.length+new Object().prototype.name) { case (debugger.constructor.sort()): IsPrimitive(undef.__defineSetter__(undef,function(){native})); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete (!new Object().toLocaleString())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(0<<'a'>>>=new RegExp['a'])") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native {unescape(true),new RegExp.isNull}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = -1.lastIndexOf(false)?parseFloat(void):Join(null, continue, new Object(), x, break)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label null/void-break.__lookupGetter__(native)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(0.2.join().constructor)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label function () { false }.__lookupGetter__(this==1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(-1.prototype.0.2.unshift())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new return goto -1") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new {Number(debugger)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (parseInt(break) instanceof 0.length) { this.(!0.2) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(break.superConstructor[throw new false(true)], this.~x)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(function () { IsSmi(-1) }, unescape(IsPrimitive(void)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (new RegExp.join().className() in new Object().length()>>true.toObject()) { parseFloat(escape(debugger)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new String(debugger).toJSONProtocol") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(1.indexOf('a')<<break.__lookupGetter__('a'), new Object().null.prototype.new RegExp.charCodeAt(-1))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new {parseInt(0)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(void.join().add(escape(undef)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native parseFloat(false.charAt(new RegExp))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(~Iterator(void))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(NaN.shift().toJSONProtocol)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(native-debugger<<continue.slice(x, new RegExp))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = parseFloat(~new Object())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (null.size/true.add(void) in 0+continue&true.null) { continue.toObject()/throw new true(debugger) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (Iterator(native+break) in debugger.superConstructor.constructor) { Math.max(0.add(undef)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new {-1.add(native),true.sort()}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new {IsSmi(break),throw new 'a'(null)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (parseInt(0).length()) { case ('a'.toObject().__defineSetter__(GetFunctionFor(null),function(){(!x)})): IsSmi(void).constructor; break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new 0.lastIndexOf(NaN).shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ 0>>>=this.lastIndex : new Object().lastIndexOf(true).toObject() }) { x.lastIndex > 1.__defineSetter__(false,function(){this}) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ throw new false(0.2).prototype.name : parseFloat(false)+(!debugger) }) { escape(undef.lastIndex) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Math.pow(0.2).toJSONProtocol.prototype.break.superConstructor.slice(NaN.exec(undef), -1.lastIndexOf(NaN)) = true.splice().length") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native continue.className().constructor") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (0.2.isNull&undef.toString()) { continue/void+parseInt(null) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new Math.pow(break==this)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(continue.__lookupGetter__(null).constructor, debugger.filter(0.2)>>>=this.'a')") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ 0.2.unshift() > true.size : return Math.max(new RegExp) }) { void.splice().toString() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new unescape(false).unshift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return this.true?'a'==this:0.2.__lookupGetter__(void) }; X(Iterator(false).length)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = function () { null }.__defineSetter__(0.charCodeAt(new Object()),function(){null>>>=new Object()})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import goto 'a'.charAt(native.className())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import 0.2.isNull.__lookupGetter__(debugger.size)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (~new Object().push(Array(null)) in new RegExp>>>=void.prototype.name) { goto break.lastIndex }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete String(x).slice(String('a'), parseFloat(false))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new parseInt(continue.__defineGetter__(0.2,function(){1}))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(true.concat(undef)==0.2.new RegExp)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return NaN['a']?-1.exec(0):NaN.prototype.this }; X(native.prototype.name.toLocaleString())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (debugger==continue.toObject(), Array(NaN.className()), Math.max(new RegExp).prototype.value) { GetFunctionFor('a').prototype.value }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new parseInt(break)==Array(x)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (parseInt(0.2.charCodeAt(this)), this.continue.prototype.name, native.superConstructor.superConstructor) { Join(0.__defineGetter__(continue,function(){undef}), {1}, parseFloat(0), undef.__defineSetter__(break,function(){null}), x?-1:-1) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export Join(debugger.splice(), parseInt(NaN), new RegExp.pop(), this.false, x.-1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = Math.max(native).charCodeAt(continue==break)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (void==NaN.sort(), new Object()==new RegExp.toObject(), -1/NaN.unshift()) { GetFunctionFor(true).name() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for ((!'a'.join()), ~NaN.__defineGetter__(undef,function(){this}), Math.pow(NaN).__lookupGetter__(typeof(false))) { throw new debugger.toObject()(Math.max(-1)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (NaN.shift()&&undef&&continue in throw new x(NaN).prototype.-1&x) { return native.toJSONProtocol }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new (0).charAt(this.charCodeAt(new Object()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return x.valueOf().size }; X(0.2.unshift().unshift())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (eval(new Object().valueOf())) { break.prototype.name.__defineGetter__(eval(NaN),function(){Math.max(native)}) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (Math.pow(1).isNull in Iterator(continue.length())) { Join(true, 0.2, null, x, new Object()).length }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(0>>>=void.unshift(), void.exec('a').undef.length())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete throw new this(0.2).pop()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Iterator(unescape(continue))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return unescape(goto debugger) }; X(new RegExp.push(break).name())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = undef/'a'.indexOf(-1.exec(false))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (continue.isNull.filter(this.toText), function () { throw new 'a'(0.2) }, native?break:undef.prototype.return continue) { Array(void.toText) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new this.slice(new Object(), 1).isNull") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (0.2.className().call((!debugger)), native.__defineGetter__(0,function(){x}).name(), null.splice().splice()) { NaN.charCodeAt(new Object()) > true.toString() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native false.length?new RegExp instanceof this:Array(undef)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new ~0.2.call(typeof(false))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Number(0.2.sort())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new x.join().shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (~new Object().toText) { case (new RegExp.unshift().exec(new RegExp<<debugger)): -1.length.exec(this.isNull); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new parseInt(~true)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new unescape(debugger.call(null))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new GetFunctionFor(0.2).toObject()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete IsPrimitive(null.join())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (eval(0.2) instanceof debugger.splice() in null.superConstructor==new Object()&void) { Number(0+x) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let ('a'-continue?null.length():escape(continue)) { return undef.push(false.shift()) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (Array(x.length) in 'a'.length().sort()) { goto (new Object()) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (NaN==true.length) { IsPrimitive(0.2).prototype.value }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(return true&&void, new RegExp.toObject().length())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Math.pow(void).length") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(void.add(continue).charCodeAt(this.toObject()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export Join(break.toObject(), 0.2.isNull, false.call(0), break.filter(break), 1.length())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (1/NaN.__lookupGetter__(undef.prototype.value)) { escape(eval(this)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(Join(unescape(x), new RegExp.__defineGetter__(debugger,function(){NaN}), 'a'.indexOf(0.2), false.prototype.name, (this)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new Math.pow(native).indexOf(1>>>=-1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new RegExp?native:continue.join().prototype.Math.max(x.__defineSetter__(1,function(){continue})) = parseFloat(parseInt(null))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native function () { new RegExp }.new RegExp.pop()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import typeof(new RegExp.valueOf())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (0.2.size>>NaN-continue) { case ('a'.push(true).indexOf(NaN.lastIndexOf(-1))): {0.2,x}.toObject(); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (IsSmi(new Object())/false.filter('a')) { function () { Iterator(debugger) } }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = break.lastIndex.size") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(new Object() > 0.length())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native IsPrimitive(continue)==break.charCodeAt(new Object())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new break.true<<'a'-NaN") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Number(-1?'a':-1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (parseFloat('a'.exec(continue)) in (!new RegExp)&&0.2.toObject()) { {true,x}.add(void.prototype.NaN) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (-1.prototype.value.join()) { (!1.prototype.name) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new GetFunctionFor(continue).toJSONProtocol") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (Math.pow(continue.slice(null, native)), goto (!0), native?1:this.charAt(String(debugger))) { parseFloat(~this) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(debugger.pop().length, new RegExp.isNull.toText)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (typeof(new RegExp.slice(new RegExp, 0)) in native.toLocaleString().lastIndexOf(0.2.length())) { native>>>=new RegExp.length() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native x.join().className()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new 0?0:true.toLocaleString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = IsPrimitive(0).concat(new Object().name())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new parseFloat(x)?this.valueOf():IsSmi(x)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new 'a'.slice(null, -1).shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label 'a'+void.concat('a'>>>=-1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(escape(0.length))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = parseInt(0.lastIndexOf(NaN))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(null&debugger.valueOf(), 0[false].push(false.add(debugger)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = parseInt(new RegExp.__lookupGetter__(break))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(~false&&break>>0, new RegExp.lastIndex.add({this}))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = Join(break, continue, 0, debugger, NaN).toLocaleString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import new Object().sort().superConstructor") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new IsSmi(goto -1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return Iterator(null).toObject() }; X(-1==new Object()==0.__lookupGetter__(native))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native void.join().add(parseFloat(continue))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (function () { -1 }.shift()) { escape(1.unshift()) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(new RegExp.indexOf(1).filter(continue instanceof break))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (NaN?continue:NaN.shift()) { native.push(null).add(new Object().superConstructor) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return new Object().length().toText }; X(debugger.indexOf(this).toText)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new Object().call('a').charCodeAt(native.size)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new function () { continue }.add(true.slice(continue, new RegExp))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x[native] instanceof -1.join().prototype.this.null.size = 0.2.prototype.x+0.2.indexOf(false)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (this instanceof new RegExp.splice() in null>>>=new RegExp.valueOf()) { function () { unescape(1) } }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (true.shift()/native.null in undef.call(NaN).isNull) { native+this-x.size }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return false.pop()<<Join(continue, false, break, NaN, -1) }; X(IsSmi(debugger>>x))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if ({parseFloat(null),Math.max(native)}) { 0.2-new Object().__lookupGetter__(eval(new Object())) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(Array(1).toLocaleString(), null.name().exec(undef.filter(false)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(true.filter(this).pop())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (break.lastIndex.superConstructor) { new Object().toString().length() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label (!0.2/debugger)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ NaN.concat(new RegExp)+Join(1, false, new Object(), new Object(), x) : unescape(x).concat(Iterator(-1)) }) { 'a'.isNull.__lookupGetter__(this+native) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export break.name()/IsPrimitive(this)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new {null}.prototype.value") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new true+false.__lookupGetter__(null&continue)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (-1.push(new RegExp)[void.valueOf()]) { new RegExp.className().__lookupGetter__(Array(0)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export NaN.__lookupGetter__(undef).__lookupGetter__(void.isNull)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ ~new RegExp.filter(undef&&this) : String(continue)<<NaN.toText }) { this.exec(this).length }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (true&void.exec(void.exec(continue)) in Join('a', undef, new Object(), continue, x) instanceof {undef}) { unescape(-1.prototype.name) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import void.push(true).join()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf({break}&x.name(), 1.charAt(false).slice(continue.superConstructor, this&&break))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (this.call(this) > Iterator(continue)) { new Object().prototype.value.slice(1.slice(native, -1), (!false)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export parseInt(new RegExp>>>=x)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (escape(x==debugger), NaN.shift()&debugger?false:0.2, (!new RegExp)&goto break) { unescape(x.toText) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(throw new NaN.toObject()(this?break:true))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new (typeof(this))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (unescape('a'/0) in ~new Object().lastIndex) { IsSmi(0).push(0.concat(0.2)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("(!new RegExp)[0.2 > new Object()].prototype.Number(debugger.join()) = native&-1.size") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new false.toJSONProtocol&&0.2.constructor") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (~0?0.2:undef in new RegExp.charCodeAt(0).prototype.name) { NaN.toLocaleString().splice() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (~IsPrimitive(new RegExp), true.toString().size, null.charCodeAt('a') > null.concat(0)) { break.toJSONProtocol/IsPrimitive(break) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new parseInt(new Object()).lastIndexOf(NaN > void)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export break.splice()&&-1.prototype.new Object()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("{{true,0}}.prototype.break.length.splice() = 'a'.toText.superConstructor") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (debugger>>>=continue > break.exec(1)) { Math.pow(new RegExp)==NaN>>>=0.2 }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ 0.2==0.2/goto true : IsSmi(native).isNull }) { throw new {x,null}(false.className()) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = {false.concat(null),Math.pow(NaN)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export Array(null).add(NaN.valueOf())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (parseFloat(new Object()==true) in GetFunctionFor('a'&false)) { native&undef.toJSONProtocol }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new {eval(null),(debugger)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import {this.0,debugger.filter(NaN)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import break.charAt(-1)<<false.__defineSetter__(0,function(){x})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = goto false > new Object()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("null.superConstructor[debugger.isNull].prototype.Math.max('a').shift() = parseInt(0).size") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native eval(void.add(break))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(x > void.join())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ {this.toObject()} : Number(NaN).toJSONProtocol }) { 0.2.className().prototype.name }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (false.__defineGetter__(undef,function(){undef}).exec(NaN.splice())) { typeof(Join(void, new RegExp, break, -1, -1)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (false.splice().toObject(), continue.name().size, Join(void?debugger:this, new RegExp.__defineSetter__(NaN,function(){NaN}), x.unshift(), this.true, parseInt(break))) { undef<<continue.toText }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (this.0.indexOf(break)) { break.charAt(this).unshift() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import Join(new Object().splice(), this instanceof 1, parseFloat(NaN), undef.concat(x), void.className())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(goto NaN.toString())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label 'a'<<break.shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = Iterator(continue)[new Object()>>NaN]") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = Join(new RegExp, 'a', this, void, true)>>>=continue>>native") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import new Object().toJSONProtocol.splice()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return undef.__defineSetter__(native,function(){void}).toJSONProtocol }; X(eval(x).charCodeAt('a'.concat(true)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(throw new 0.2.__defineGetter__(NaN,function(){-1})(void&&new RegExp))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = 0.unshift() > IsSmi(NaN)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label x.call(null).lastIndex") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(IsSmi(0.2.add(0)), x.add(break).this.__defineGetter__(undef,function(){new RegExp}))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native Number(this).toObject()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new NaN.shift().add(String(new Object()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new null.name().splice()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = 1.undef.push(new Object().call(null))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(parseInt(1).size)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = this.x.sort()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(continue.valueOf().prototype.new RegExp.splice())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(this.charAt(continue)?undef+'a':unescape(1))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf({throw new 'a'(0.2),void.lastIndexOf(NaN)}, Math.pow(new Object().className()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (1.slice(new Object(), this).valueOf()) { parseInt(true).pop() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ 0.2.superConstructor.lastIndex : goto debugger<<Join(undef, 1, true, undef, debugger) }) { function () { NaN }.prototype.name }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("-1.exec(debugger).length.prototype.debugger > null.slice(Iterator(void), continue.concat(0)) = parseInt(throw new 1(1))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(new Object().constructor.call(Number(1)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new null.unshift().call(escape(x))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (Math.pow(native).toLocaleString()) { case (false instanceof native.join()): Math.pow(NaN).size; break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label function () { new Object() }.prototype.true.size") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = Join('a', 0.2, false, new Object(), void).continue.className()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = IsPrimitive(break.__lookupGetter__(-1))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new Object()>>0.2.prototype.name") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new IsPrimitive(new Object()).shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (Array(parseInt(break))) { 'a'.toString().unshift() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = return 0.2>>>=-1?undef:undef") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Object().splice().unshift().prototype.null&&native.__lookupGetter__(undef>>>=NaN) = (1<<break)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete NaN.charAt(1).concat(NaN.0.2)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(new RegExp.sort().toJSONProtocol)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return GetFunctionFor(false).lastIndexOf(1.shift()) }; X(this.0.2.charCodeAt(0.2))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (goto NaN.toObject(), ~true.'a', parseInt(debugger)+eval(false)) { eval(0.2.constructor) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (parseInt(debugger).pop()) { case (this.push(true).valueOf()): Join(continue, debugger, native, native, debugger).filter(Array(continue)); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new debugger.sort() instanceof this>>1") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ parseFloat(false).prototype.(!new Object()) : {unescape(-1)} }) { Math.max(new RegExp.superConstructor) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate({Math.pow(break)})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import typeof(break.valueOf())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(Math.pow(-1[new RegExp]))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native IsPrimitive(1).concat({x,null})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("NaN.length.prototype.value.prototype.function () { null==new Object() } = break.name()&IsPrimitive(0)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete NaN.prototype.-1.toString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new continue.unshift()+parseFloat(undef)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new NaN-break.call(false.pop())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native new RegExp.exec(break).pop()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf({'a',null}.prototype.value, 1.shift() instanceof {'a',0})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (debugger.valueOf().size, function () { x.unshift() }, IsSmi(1)&&true==native) { new Object().__defineGetter__(this,function(){'a'})&&eval(native) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export 'a'.pop().charCodeAt(x.className())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export String(IsSmi(debugger))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("typeof(debugger).valueOf().prototype.(1).lastIndexOf(this.break) = x.prototype.name.toLocaleString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native Array(typeof(false))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(1.__defineGetter__(1,function(){1}).null.constructor)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = 1.charAt(0).toObject()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(Math.max('a'.filter(new Object())))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(void.prototype.name.unshift())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (-1.toJSONProtocol.call(-1.size) in ~x.sort()) { eval(0&debugger) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for ('a'==undef.join() in Math.pow(IsSmi(false))) { undef > this>>goto x }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate('a'.constructor.isNull)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (GetFunctionFor(this.slice(0.2, this)), this.prototype.void?null.unshift():native.className(), Number(new Object().call(-1))) { 0.splice() > debugger&&this }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ {goto new RegExp,Join(new Object(), native, continue, -1, x)} : NaN&x/{0,break} }) { this.lastIndexOf(new RegExp).join() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (typeof(break.length())) { native&&false.sort() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new parseFloat(-1 instanceof break)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label throw new continue.unshift()(null.shift())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import Math.max(0.2.toLocaleString())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return false.unshift().className() }; X(escape(NaN&NaN))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(Join(native.toText, goto x, 0.2.splice(), Join('a', 0, void, NaN, 1), eval(native)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (GetFunctionFor(true.prototype.name)) { parseInt(NaN).toLocaleString() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new escape(native).__defineSetter__(return native,function(){undef > native})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new typeof(true > 'a')") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (debugger.prototype.0.2<<new RegExp+false) { case (native.splice().filter({x})): false&true.indexOf(1.__defineGetter__(native,function(){continue})); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label true-NaN.prototype.native.shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new typeof(new RegExp.splice())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (function () { this.NaN }) { case (this.continue.prototype.parseFloat(false)): IsPrimitive(new Object()-'a'); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export break.__lookupGetter__(debugger).indexOf(native.pop())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (GetFunctionFor(NaN.lastIndex)) { case (new RegExp.lastIndex.toLocaleString()): NaN.join().indexOf(eval(-1)); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native {void.charAt(true)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new new Object()==NaN.join()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(typeof(Array(new Object())))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label throw new (false)(eval(x))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new new RegExp.size.charAt(true > -1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = debugger.toObject().charAt(this<<undef)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ 'a'.valueOf()+parseInt(undef) : IsPrimitive(null).lastIndex }) { NaN.toObject().isNull }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new new Object()&&void.lastIndexOf(0.2.splice())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ 1+1.name() : Join(Math.pow(debugger), new RegExp-1, x > 1, x<<-1, new RegExp.size) }) { undef[undef].size }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete native.call(-1).isNull") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (new Object()>>>=break==Math.pow(debugger)) { IsPrimitive(this).lastIndex }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for ((!x&&new RegExp) in undef.toLocaleString().slice(new RegExp.indexOf(NaN), IsPrimitive(-1))) { false.size+debugger[x] }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import 0.length.__defineGetter__(0.2.shift(),function(){'a'.className()})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(goto new Object().push(void))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ Array(this.0) : parseFloat(void).pop() }) { escape(true).slice(continue.lastIndex, false.toObject()) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new native==true.filter({NaN,-1})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for ('a'.__defineSetter__(continue,function(){-1}).unshift(), Array(undef).toLocaleString(), undef.__lookupGetter__(void).toLocaleString()) { parseInt(false/native) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("this.x<<false.prototype.true.toLocaleString()==NaN.pop() = this.superConstructor>>Math.max(true)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return this.prototype.name.splice() }; X(unescape(x).__lookupGetter__(Number(debugger)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new (!NaN).unshift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(escape(Iterator(this)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return Number(new RegExp)<<this?true:-1 }; X(Number(null).lastIndex)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export this.void.splice()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (this.prototype.null.sort() in -1.className()&void.filter(new Object())) { GetFunctionFor(new Object()).pop() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label 0[break].sort()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (null.length().toString(), eval(-1).toObject(), (!continue.concat(continue))) { true.name()/native<<new RegExp }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (unescape(null).sort(), Number(undef).charCodeAt(IsPrimitive(NaN)), null>>true/null.join()) { 0.2.toObject() > IsPrimitive(new RegExp) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date({NaN,native}&&1+undef)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(IsPrimitive(undef>>>=1))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (Join(true, 'a', true, 1, NaN).add({1}), GetFunctionFor(new Object().push(new Object())), goto 1.length) { Math.pow(GetFunctionFor(native)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return break.isNull > parseInt(continue) }; X((new RegExp instanceof 1))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ Number(false).indexOf(x instanceof new Object()) : function () { x.toString() } }) { false.name().indexOf(GetFunctionFor(null)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date('a'.constructor.prototype.name)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("GetFunctionFor(void&new Object()).prototype.debugger.add(null)[void.unshift()] = new RegExp.isNull.Iterator(this)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete false?break:undef.constructor") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ (native.filter(1)) : eval(this&&0.2) }) { undef.length instanceof new Object().toText }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export String(break.lastIndexOf(null))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label (!Iterator(new RegExp))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(String(null==-1), {1&0})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(parseInt('a' > 0))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(debugger.toJSONProtocol.indexOf(escape(0)), this.filter(null).__defineSetter__(continue.break,function(){debugger>>null}))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("this.name().length().prototype.goto false.exec(true.charCodeAt(continue)) = Join(-1-false, undef.superConstructor, 'a'.shift(), (!x), NaN.this)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(typeof(new RegExp).sort())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new 0.2.concat(x).splice()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (goto void.indexOf(throw new x(1)), typeof(return new RegExp), IsPrimitive(-1).add(void.lastIndexOf(debugger))) { null.indexOf(void).toText }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("return new RegExp.pop().prototype.String(x.toObject()) = 1.superConstructor.charCodeAt(new RegExp.charCodeAt(null))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new null&true.prototype.name") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = -1>>>=NaN.indexOf((debugger))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new parseFloat(null).splice()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import -1.lastIndexOf(new RegExp) instanceof throw new void(0.2)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if ((0.shift())) { Join(IsPrimitive(-1), break.__defineSetter__(true,function(){break}), parseInt(null), parseFloat(break), true/null) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new escape(1 > continue)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (parseInt(undef)>>false.filter(continue)) { case (this.undef/new Object()): 'a'.toJSONProtocol.__defineGetter__(new RegExp-undef,function(){parseFloat(new RegExp)}); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("{void}.shift().prototype.this.Array(new Object()) = {0.2,new RegExp}.lastIndexOf(break.splice())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new continue&&new Object().lastIndexOf(new Object() instanceof 1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (throw new 'a'.exec(x)(return false), native/void.constructor, {native}==true.toLocaleString()) { goto 1 instanceof 1.isNull }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (break.concat(break) > native>>>=-1, (debugger.x), Join(x, void, void, new RegExp, null).name()) { void.charCodeAt(true).valueOf() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new 'a'>>0 instanceof new Object().push(new RegExp)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (return ~break) { break.__defineGetter__(break,function(){-1}).shift() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(Join(null, -1, undef, null, 0).toString())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let ({new RegExp,void}.slice(break.isNull, false.shift())) { eval(debugger.slice(this, 1)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return {GetFunctionFor(0)} }; X('a'.prototype.debugger.concat(void.constructor))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (~true instanceof continue) { escape(new RegExp.toObject()) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("escape(0[native]).prototype.debugger.add(1).unshift() = (true.join())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (unescape(void).length, undef.toObject() instanceof x.toObject(), 0.2+true.concat(true.__lookupGetter__(this))) { (x).toJSONProtocol }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(escape(null).__lookupGetter__(undef.size))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label Array(continue[false])") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return Number(this&&false) }; X(NaN.toJSONProtocol.toJSONProtocol)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("null.toString().shift().prototype.Array(x).__lookupGetter__('a'.prototype.x) = {1.length,break.join()}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new 1.charCodeAt(break)+IsSmi(false)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(String(this) > 0.2.toText, new RegExp.length.lastIndexOf(1<<0.2))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (new RegExp.pop().charAt(IsSmi(new RegExp))) { case (native.indexOf(this)/native.lastIndex): this.debugger.indexOf(debugger); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(Number(x)[debugger.prototype.break])") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return new RegExp>>>=x.unshift() }; X(Math.max(continue.name()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(IsSmi(null.size))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = native?0.2:1+GetFunctionFor(void)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (IsPrimitive(-1)>>>=break.valueOf() in String(0 > 0.2)) { Math.max(true.length()) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (escape(unescape(NaN))) { case (Math.pow(eval(undef))): true.charAt(null)&new RegExp.pop(); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete Join(new RegExp, 1, false, new Object(), this).toLocaleString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label return x.filter(x.join())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new new RegExp.pop().shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new (!debugger.size)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label Math.max(debugger.__lookupGetter__(NaN))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(eval(debugger[debugger]))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new 0.2.filter(true)&throw new true(debugger)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(continue.exec(debugger) > Math.pow(0.2))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("void.prototype.value.name().prototype.Number(undef&NaN) = false.__lookupGetter__(-1).name()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(null.__defineGetter__(native,function(){continue}).valueOf())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ {new Object()[continue],native.length()} : undef.name().superConstructor }) { Math.pow(break).indexOf(0.toJSONProtocol) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (Iterator(native.call(new RegExp))) { case (String(new RegExp).isNull): goto new RegExp.pop(); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new x.constructor instanceof undef.indexOf(-1)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(this.~null, continue.pop()&0&'a')") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (GetFunctionFor(~0)) { case ('a'.'a'<<undef.__defineGetter__(false,function(){true})): (!1).lastIndex; break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return debugger.unshift().0.toString() }; X(Number(break).0.2>>>=false)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(Iterator(x)/undef.pop())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(undef.join().toLocaleString(), null.add(false).valueOf())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("IsSmi(x).toString().prototype.0>>continue.indexOf(NaN.__lookupGetter__(new Object())) = ~-1&typeof(0)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (continue.__lookupGetter__(new RegExp).toObject(), false-0.toString(), return native.sort()) { new RegExp.name().className() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (escape(new RegExp).toString()) { case (goto eval(1)): this.filter(new Object()).call(new RegExp.slice(null, this)); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = debugger-false.toText") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = Number(null>>new RegExp)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete this&native.indexOf('a'.splice())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(~Math.max(break), 0.2.valueOf().length)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(Number(native.charCodeAt(x)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new goto continue.add(0)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete typeof(debugger).name()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("'a'<<false.toText.prototype.throw new true(1).lastIndex = 'a'.name().length") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native 'a'.indexOf(debugger).charAt(NaN.add(new Object()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(break>>false.toString(), (false.indexOf(this)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete goto NaN==(!debugger)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(0.2.join().superConstructor)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new this.void.toLocaleString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("SetValueOf(x.exec(debugger)[GetFunctionFor(0)], native.toObject().exec(new RegExp.sort()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(0.2.valueOf().toLocaleString())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(-1.toJSONProtocol.prototype.name)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(Array(-1.shift()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export break.concat(undef).unshift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native parseFloat(-1)?NaN.toText:debugger.toString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (void-continue/continue.prototype.undef in String(break.toText)) { parseInt(false).isNull }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(true.isNull.toObject())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ typeof(debugger).toObject() : x.constructor>>>=null.__defineGetter__(native,function(){debugger}) }) { unescape(undef.lastIndexOf(false)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export unescape(continue)<<native[0]") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (String(0).unescape(debugger)) { {break.pop(),0.2.constructor} }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("String({true}).prototype.break.length.call(false > 0.2) = GetFunctionFor(0.prototype.new RegExp)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ false.push(0.2).indexOf(Math.max(debugger)) : x&x.prototype.name }) { goto 1.lastIndex }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(0.2.lastIndex&0.2?break:NaN)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = -1.prototype.value.toText") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import native.toLocaleString()-1.prototype.0") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export debugger[-1].indexOf(Join(new Object(), 0, x, new Object(), 0.2))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return (!true).lastIndexOf(true.splice()) }; X(NaN.toString().prototype.value)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return continue.slice(-1, 1).prototype.true.name() }; X('a'.push(void).prototype.value)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (goto new RegExp.length(), x.sort().className(), Math.max(new RegExp.toJSONProtocol)) { (IsSmi(-1)) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = 0.splice()&&-1.sort()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (Math.max(-1>>1)) { break.toLocaleString().toJSONProtocol }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new {void.prototype.break,new RegExp.toString()}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new IsSmi(debugger).name()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new 'a'.concat(undef).sort()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new {debugger.toObject(),'a' > false}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (goto 1.concat(Join(x, undef, native, x, new Object()))) { new RegExp.prototype.name==new RegExp.superConstructor }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return new Object().__defineGetter__(0.2,function(){0.2}).length() }; X(void.isNull<<parseFloat(NaN))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete continue.toJSONProtocol.toLocaleString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (continue.constructor.toObject() in true&&undef.toJSONProtocol) { String(0+break) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import true.call(continue)>>break.toString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label escape(this) > Math.pow(new RegExp)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new {void}/IsSmi(new Object())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (native==null?debugger.prototype.name:null.toLocaleString()) { case (NaN.push(this).join()): (break instanceof continue); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new Math.pow(x.push(0))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new (Array(NaN))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label IsSmi(new RegExp).toLocaleString()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label NaN.push(1).shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("{escape(undef),debugger.filter(0.2)}.prototype.-1 > new RegExp[0.2.valueOf()] = new RegExp.prototype.value.splice()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new Join(0.2, x, continue, debugger, new Object()).size") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("with ({ Number(null).name() : Math.pow(true).__defineGetter__(debugger.toString(),function(){false+0.2}) }) { this.{x,break} }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Math.pow(goto debugger)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = IsPrimitive(void.pop())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new Object().toString().toJSONProtocol") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(this.String(0.2))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let ({-1.call(new RegExp)}) { break.length().splice() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import null.size.__defineGetter__(void.filter(x),function(){null.pop()})") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new IsPrimitive(null.superConstructor)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new eval(-1.prototype.continue)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (typeof(Iterator('a'))) { case (0.constructor>>~1): void.__defineGetter__(void,function(){1})/GetFunctionFor(0); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for (false instanceof x.add(true.charAt(new RegExp)) in Join(undef.lastIndexOf(break), 0.2.add(new Object()), Iterator(1), {'a',x}, Array(new Object()))) { function () { null }/1&&-1 }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new escape('a'.concat(undef))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(Math.pow(NaN).toText)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new throw new 0(NaN).className()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete String(GetFunctionFor(new Object()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = Iterator(new Object()).charAt((0.2))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Number(undef.charAt(1)).prototype.undef.lastIndexOf(true).slice(1.className(), undef.filter(-1)) = null<<null.push(parseInt('a'))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = {Math.max(1),IsSmi(new Object())}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch (new Object().exec(0).isNull) { case (escape(IsSmi(false))): false.toObject()-null.size; break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new 'a'.__defineSetter__(debugger,function(){false}).name()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = debugger?-1:0+true.prototype.1") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new {false instanceof continue,native.size}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("GetFunctionFor(continue.__lookupGetter__(0.2)).prototype.Math.max(1.splice()) = true.__defineGetter__(undef,function(){NaN}).filter(String(new RegExp))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("null.size-1.toLocaleString().prototype.(this).shift() = GetFunctionFor(native.charAt(break))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate((!null.indexOf(-1)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = {break.sort()}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new throw new debugger.splice()(this.__lookupGetter__(undef))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("unescape(x[native]).prototype.0.splice().-1.prototype.true = x.prototype.value.className()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export x+true.length") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export debugger.indexOf(-1).indexOf(true.constructor)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("for ({break}.exec(new Object().continue) in eval(0.2.charAt(new Object()))) { throw new null.length(null?break:-1) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = NaN.toLocaleString().toObject()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return Math.pow(break+false) }; X(Join(true.add(new Object()), null[-1], new RegExp[true], NaN&&debugger, x.charAt(undef)))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("switch ((break).add(true.sort())) { case (undef.charAt(native).__defineGetter__(IsPrimitive(1),function(){NaN<<new RegExp})): -1.__defineSetter__(null,function(){-1}) > this.charCodeAt(this); break; }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import return 0.2.length") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("continue.join().toText.prototype.Number(debugger).slice(new RegExp.-1, (NaN)) = function () { (!null) }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export Number(break.__lookupGetter__(false))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Date(return null/x)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export Number(undef).shift()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = 1[native]/this&true") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete typeof(debugger.unshift())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import x.charAt(false)&-1>>x") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("if (null.toText.superConstructor) { typeof(-1).toString() }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (parseFloat(continue.superConstructor)) { 0.2.toText.prototype.value }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label parseInt(IsSmi(null))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete new Object().valueOf().indexOf(true-x)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new unescape(1.__defineGetter__(new Object(),function(){x}))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("let (undef.size.splice()) { 1.constructor.charCodeAt(0+'a') }") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("this.new RegExp.pop().prototype.eval(debugger).toJSONProtocol = unescape(continue).valueOf()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("const x = new this.new RegExp.indexOf(unescape(new Object()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = new break instanceof false instanceof native.length()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate(parseFloat(x).valueOf())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label {escape(true),Math.max(null)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("'a'>>>=void.prototype.value.prototype.break.prototype.break.indexOf(0.className()) = (!this&native)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("import Number(NaN).push(IsSmi(break))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("export true.exec(void).toObject()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function({'a',true}/eval(new Object()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("label null.concat(null).toObject()") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("native {0.2.length,new RegExp.lastIndexOf(-1)}") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("function X(x) { return Math.max({0.2}) }; X(true.charCodeAt(null).add(new RegExp.name()))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("delete -1.lastIndex.length") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("new Function(0.2[1].call(true > break))") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("Instantiate('a'.toLocaleString().splice())") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; + +try { + eval("x = typeof(void&&void)") +} catch (e) { if (e.message.length > 0) { print (e.message); } }; diff --git a/deps/v8/test/mjsunit/regress/regress-1201933.js b/deps/v8/test/mjsunit/regress/regress-1201933.js new file mode 100644 index 0000000000..d4827e41cf --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1201933.js @@ -0,0 +1,40 @@ +// Copyright 2008 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. + +// Make sure this doesn't fail with an assertion +// failure during lazy compilation. + +var caught = false; +try { + (function() { + const a; + var a; + })(); +} catch (e) { + caught = true; +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/regress/regress-1203459.js b/deps/v8/test/mjsunit/regress/regress-1203459.js new file mode 100644 index 0000000000..da1e0eda12 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1203459.js @@ -0,0 +1,29 @@ +// Copyright 2008 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 that we allow non-index number properties in object literals. +var obj = { 0.2 : 'a' } diff --git a/deps/v8/test/mjsunit/regress/regress-1207276.js b/deps/v8/test/mjsunit/regress/regress-1207276.js new file mode 100644 index 0000000000..ce7efe9880 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1207276.js @@ -0,0 +1,36 @@ +// Copyright 2008 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. + +try { + const x=n,Glo0al; +} catch(e){} + +delete Date; +function X(){String(Glo0al)} +X(); +X(); +X(); diff --git a/deps/v8/test/mjsunit/regress/regress-1213516.js b/deps/v8/test/mjsunit/regress/regress-1213516.js new file mode 100644 index 0000000000..6703f32604 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1213516.js @@ -0,0 +1,40 @@ +// Copyright 2008 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 run() { + var a = 0; + L: try { + throw "x"; + } catch(x) { + break L; + } finally { + a = 1; + } + assertEquals(1, a); +} + +run(); diff --git a/deps/v8/test/mjsunit/regress/regress-1213575.js b/deps/v8/test/mjsunit/regress/regress-1213575.js new file mode 100644 index 0000000000..0c3dcc28c6 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1213575.js @@ -0,0 +1,41 @@ +// Copyright 2008 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. + +// Make sure that a const definition always +// conflicts with a defined setter. This avoid +// trying to pass 'the hole' to the setter. + +this.__defineSetter__('x', function(value) { assertTrue(false); }); + +var caught = false; +try { + eval('const x'); +} catch(e) { + assertTrue(e instanceof TypeError); + caught = true; +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/regress/regress-1215653.js b/deps/v8/test/mjsunit/regress/regress-1215653.js new file mode 100644 index 0000000000..881e22c021 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1215653.js @@ -0,0 +1,365 @@ +// Copyright 2008 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. + +// Make sure this doesn't crash the VM. + +var caught = false; +try { + OverflowParserStack(); + assertTrue(false); +} catch (e) { + assertTrue(e instanceof RangeError); + caught = true; +} +assertTrue(caught); + + +function OverflowParserStack() { + var s = + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((" + + "(((((((((((((((((((((((((((((((((((((((((((((((((((((((((((((("; + eval(s); +} diff --git a/deps/v8/test/mjsunit/regress/regress-124.js b/deps/v8/test/mjsunit/regress/regress-124.js new file mode 100644 index 0000000000..81526b0edd --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-124.js @@ -0,0 +1,57 @@ +// Copyright 2008 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("[object global]", this.toString()); +assertEquals("[object global]", toString()); + +assertEquals("[object global]", eval("this.toString()")); +assertEquals("[object global]", eval("toString()")); + +assertEquals("[object global]", eval("var f; this.toString()")); +assertEquals("[object global]", eval("var f; toString()")); + + +function F(f) { + assertEquals("[object global]", this.toString()); + assertEquals("[object global]", toString()); + + assertEquals("[object global]", eval("this.toString()")); + assertEquals("[object global]", eval("toString()")); + + assertEquals("[object global]", eval("var f; this.toString()")); + assertEquals("[object global]", eval("var f; toString()")); + + assertEquals("[object global]", eval("f()")); + + // Receiver should be the arguments object here. + assertEquals("[object Object]", eval("arguments[0]()")); + with (arguments) { + assertEquals("[object Object]", toString()); + } +} + +F(Object.prototype.toString); diff --git a/deps/v8/test/mjsunit/regress/regress-1254366.js b/deps/v8/test/mjsunit/regress/regress-1254366.js new file mode 100644 index 0000000000..2f9e011e94 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1254366.js @@ -0,0 +1,38 @@ +// Copyright 2008 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 gee() {}; + +Object.prototype.findOrStore = function() { + var z = this.vvv = gee; + return z; +}; + +var a = new Object(); +assertEquals(gee, a.findOrStore()); +assertEquals(gee, a.findOrStore()); + diff --git a/deps/v8/test/mjsunit/regress/regress-1327557.js b/deps/v8/test/mjsunit/regress/regress-1327557.js new file mode 100644 index 0000000000..bdf4277cca --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1327557.js @@ -0,0 +1,36 @@ +// Copyright 2008 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 x = { valueOf: function() { throw "x"; } }; +var y = { valueOf: function() { throw "y"; } }; + +try { + x * -y; + assertUnreachable("Didn't throw an exception"); +} catch (e) { + assertEquals("y", e); +} diff --git a/deps/v8/test/mjsunit/regress/regress-1341167.js b/deps/v8/test/mjsunit/regress/regress-1341167.js new file mode 100644 index 0000000000..194a7b886a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1341167.js @@ -0,0 +1,33 @@ +// Copyright 2008 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. + +// Make sure that 'this' is bound to the global object when using +// execScript. + +var result; +execScript("result = this"); +assertTrue(result === this); diff --git a/deps/v8/test/mjsunit/regress/regress-1346700.js b/deps/v8/test/mjsunit/regress/regress-1346700.js new file mode 100644 index 0000000000..fe2d6fac4a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1346700.js @@ -0,0 +1,29 @@ +// Copyright 2007-2008 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 o = {"\u59cb\u53d1\u7ad9": 1}; +assertEquals(1, o.\u59cb\u53d1\u7ad9); diff --git a/deps/v8/test/mjsunit/regress/regress-137.js b/deps/v8/test/mjsunit/regress/regress-137.js new file mode 100644 index 0000000000..cc7b68c0f2 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-137.js @@ -0,0 +1,46 @@ +// Copyright 2008 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. + +// See <URL:http://code.google.com/p/v8/issues/detail?id=137> + +(function () { + var strNum = 170; + var base = strNum / 16; + var rem = strNum % 16; + var base = base - (rem / 16); // base is now HeapNumber with valid Smi value. + + switch(base) { + case 10: return "A"; // Expected result. + case 11: return "B"; + case 12: return "C"; + case 13: return "D"; + case 14: return "E"; + case 15: return "F"; // Enough cases to trigger fast-case Smi switch. + }; + fail("case 10", "Default case", "Heap number not recognized as Smi value"); +})(); + diff --git a/deps/v8/test/mjsunit/regress/regress-1439135.js b/deps/v8/test/mjsunit/regress/regress-1439135.js new file mode 100644 index 0000000000..737a7ba082 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1439135.js @@ -0,0 +1,40 @@ +// Copyright 2008 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 Test() { + var left = "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"; + var right = "YYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYYY"; + for (var i = 0; i < 100000; i++) { + var cons = left + right; + var substring = cons.substring(20, 80); + var index = substring.indexOf('Y'); + assertEquals(34, index); + } +} + +Test(); diff --git a/deps/v8/test/mjsunit/regress/regress-149.js b/deps/v8/test/mjsunit/regress/regress-149.js new file mode 100644 index 0000000000..6377a5b755 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-149.js @@ -0,0 +1,28 @@ +// Copyright 2008 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(String.fromCharCode(0x26B), String.fromCharCode(0x2C62).toLowerCase()); diff --git a/deps/v8/test/mjsunit/regress/regress-1493017.js b/deps/v8/test/mjsunit/regress/regress-1493017.js new file mode 100644 index 0000000000..99a1dad2e0 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-1493017.js @@ -0,0 +1,52 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test collection of abandoned maps. Tests that deleted map +// transitions do not show up as properties in for in. + +// Flags: --expose-gc --collect-maps + +function C() {} + + +// Create an instance of C. Add a property to the instance and then +// remove all references to instances of C. +var o = new C(); +o.x = 42; +o = null; + +// Force a global GC. This will collect the maps starting from C and +// delete map transitions. +gc(); + +// Create a new instance of C. +o = new C(); + +// Test that the deleted map transitions do not show up in for in. +for (var p in o) { + assertTrue(false); +} diff --git a/deps/v8/test/mjsunit/regress/regress-171.js b/deps/v8/test/mjsunit/regress/regress-171.js new file mode 100644 index 0000000000..fe981dad0d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-171.js @@ -0,0 +1,41 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function f(s) { return s.length; } +function g(s, key) { return s[key]; } + +assertEquals(f(new String("a")), 1); +assertEquals(f(new String("a")), 1); +assertEquals(f(new String("a")), 1); +assertEquals(f("a"), 1); +assertEquals(f(new String("a")), 1); + +assertEquals(g(new String("a"), "length"), 1); +assertEquals(g(new String("a"), "length"), 1); +assertEquals(g(new String("a"), "length"), 1); +assertEquals(g("a", "length"), 1); +assertEquals(g(new String("a"), "length"), 1); diff --git a/deps/v8/test/mjsunit/regress/regress-176.js b/deps/v8/test/mjsunit/regress/regress-176.js new file mode 100644 index 0000000000..b204812468 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-176.js @@ -0,0 +1,50 @@ +// Copyright 2008 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. + +// See http://code.google.com/p/v8/issues/detail?id=176 + +assertEquals("f,", + "foo".match(/(?:(?=(f)o))?f/).toString(), + "zero length match in (?:) with capture in lookahead"); +assertEquals("f,", + "foo".match(/(?=(f)o)?f/).toString(), + "zero length match in (?=) with capture in lookahead"); +assertEquals("fo,f", + "foo".match(/(?:(?=(f)o)f)?o/), + "non-zero length match with capture in lookahead"); +assertEquals("fo,f", + "foo".match(/(?:(?=(f)o)f?)?o/), + "non-zero length match with greedy ? in (?:)"); +assertEquals("fo,f", + "foo".match(/(?:(?=(f)o)f??)?o/), + "non-zero length match with non-greedy ? in (?:), o forces backtrack"); +assertEquals("fo,f", + "foo".match(/(?:(?=(f)o)f??)?./), + "non-zero length match with non-greedy ? in (?:), zero length match causes backtrack"); +assertEquals("f,", + "foo".match(/(?:(?=(f)o)fx)?./), + "x causes backtrack inside (?:)"); diff --git a/deps/v8/test/mjsunit/regress/regress-186.js b/deps/v8/test/mjsunit/regress/regress-186.js new file mode 100644 index 0000000000..335869d6b0 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-186.js @@ -0,0 +1,72 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Make sure that eval can introduce a local variable called __proto__. +// See http://code.google.com/p/v8/issues/detail?id=186 + +var setterCalled = false; + +var o = {}; +o.__defineSetter__("x", function() { setterCalled = true; }); + +function runTest(test) { + setterCalled = false; + test(); +} + +function testLocal() { + // Add property called __proto__ to the extension object. + eval("var __proto__ = o"); + // Check that the extension object's prototype did not change. + eval("var x = 27"); + assertFalse(setterCalled, "prototype of extension object changed"); + assertEquals(o, eval("__proto__")); +} + +function testConstLocal() { + // Add const property called __proto__ to the extension object. + eval("const __proto__ = o"); + // Check that the extension object's prototype did not change. + eval("var x = 27"); + assertFalse(setterCalled, "prototype of extension object changed"); + assertEquals(o, eval("__proto__")); +} + +function testGlobal() { + // Assign to the global __proto__ property. + eval("__proto__ = o"); + // Check that the prototype of the global object changed. + eval("x = 27"); + assertTrue(setterCalled, "prototype of global object did not change"); + setterCalled = false; + assertEquals(o, eval("__proto__")); +} + +runTest(testLocal); +runTest(testConstLocal); +runTest(testGlobal); + diff --git a/deps/v8/test/mjsunit/regress/regress-187.js b/deps/v8/test/mjsunit/regress/regress-187.js new file mode 100644 index 0000000000..44d8d7a521 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-187.js @@ -0,0 +1,30 @@ +// Copyright 2008 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. + +// See http://code.google.com/p/v8/issues/detail?id=187 + +assertEquals("f,", "foo".match(/(?:(?=(f)o)fx|)./)); diff --git a/deps/v8/test/mjsunit/regress/regress-189.js b/deps/v8/test/mjsunit/regress/regress-189.js new file mode 100644 index 0000000000..a84b62058f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-189.js @@ -0,0 +1,36 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that we can handle initialization of a deleted const variable. + +// See http://code.google.com/p/v8/issues/detail?id=189. + +function f() { + eval("delete x; const x = 32"); +} + +f(); diff --git a/deps/v8/test/mjsunit/regress/regress-191.js b/deps/v8/test/mjsunit/regress/regress-191.js new file mode 100644 index 0000000000..ca513c991d --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-191.js @@ -0,0 +1,42 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Make sure that accessor setters are ignored on context extension +// objects. +// See http://code.google.com/p/v8/issues/detail?id=191 + +var setterCalled = false; + +Object.prototype.__defineSetter__("x", function() { setterCalled = true; }); + +function test() { + eval("var x = 42"); + assertFalse(setterCalled, "accessor setter call on context object"); + assertEquals(42, eval("x")); +} + +test(); diff --git a/deps/v8/test/mjsunit/regress/regress-192.js b/deps/v8/test/mjsunit/regress/regress-192.js new file mode 100644 index 0000000000..8f0978f1b6 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-192.js @@ -0,0 +1,38 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that exceptions are correctly propagated when creating object +// literals. + +// See http://code.google.com/p/v8/issues/detail?id=192 + +Object.prototype.__defineGetter__("x", function() {}); + +// Creating this object literal will throw an exception because we are +// assigning to a property that has only a getter. +assertThrows("({ x: 42 })"); + diff --git a/deps/v8/test/mjsunit/regress/regress-193.js b/deps/v8/test/mjsunit/regress/regress-193.js new file mode 100644 index 0000000000..f803483106 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-193.js @@ -0,0 +1,44 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that context extension objects do not have a constructor +// property. + +// See http://code.google.com/p/v8/issues/detail?id=193. + +function f() { + return eval("var x; constructor"); +} + +// It should be ok to call the constructor function returned by f. +f()(); + +// The call to f should get the constructor of the receiver which is +// the constructor of the global object. +assertEquals(constructor, f()); + + diff --git a/deps/v8/test/mjsunit/regress/regress-20070207.js b/deps/v8/test/mjsunit/regress/regress-20070207.js new file mode 100644 index 0000000000..e90b2ec589 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-20070207.js @@ -0,0 +1,42 @@ +// Copyright 2008 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. + +// The following regression test illustrates a problem in using the +// value of setting a property in the arguments object. + +function f(s) { + arguments.length; + return (s += 10) < 0; +} + +assertTrue(f(-100)); +assertTrue(f(-20)); +assertFalse(f(-10)); +assertFalse(f(-5)); +assertFalse(f(0)); +assertFalse(f(10)); + diff --git a/deps/v8/test/mjsunit/regress/regress-201.js b/deps/v8/test/mjsunit/regress/regress-201.js new file mode 100644 index 0000000000..8847fc0173 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-201.js @@ -0,0 +1,37 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See http://code.google.com/p/v8/issues/detail?id=201. + +function testsort(n) { + n=1*n; + var numbers=new Array(n); + for (var i=0;i<n;i++) numbers[i]=i; + numbers.sort(); +} + +testsort("5001") diff --git a/deps/v8/test/mjsunit/regress/regress-219.js b/deps/v8/test/mjsunit/regress/regress-219.js new file mode 100644 index 0000000000..4bfabdcf43 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-219.js @@ -0,0 +1,176 @@ +// Copyright 2008 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 handling of flags for regexps. + +// We should now allow duplicates of flags. +// (See http://code.google.com/p/v8/issues/detail?id=219) + +// Base tests: we recognize the basic flags + +function assertFlags(re, global, multiline, ignoreCase) { + var name = re + " flag: "; + (global ? assertTrue : assertFalse)(re.global, name + "g"); + (multiline ? assertTrue : assertFalse)(re.multiline, name + "m"); + (ignoreCase ? assertTrue : assertFalse)(re.ignoreCase, name + "i"); +} + +var re = /a/; +assertFlags(re, false, false, false) + +re = /a/gim; +assertFlags(re, true, true, true) + +re = RegExp("a",""); +assertFlags(re, false, false, false) + +re = RegExp("a", "gim"); +assertFlags(re, true, true, true) + +// Double i's + +re = /a/ii; +assertFlags(re, false, false, true) + +re = /a/gii; +assertFlags(re, true, false, true) + +re = /a/igi; +assertFlags(re, true, false, true) + +re = /a/iig; +assertFlags(re, true, false, true) + +re = /a/gimi; +assertFlags(re, true, true, true) + +re = /a/giim; +assertFlags(re, true, true, true) + +re = /a/igim; +assertFlags(re, true, true, true) + + +re = RegExp("a", "ii"); +assertFlags(re, false, false, true) + +re = RegExp("a", "gii"); +assertFlags(re, true, false, true) + +re = RegExp("a", "igi"); +assertFlags(re, true, false, true) + +re = RegExp("a", "iig"); +assertFlags(re, true, false, true) + +re = RegExp("a", "gimi"); +assertFlags(re, true, true, true) + +re = RegExp("a", "giim"); +assertFlags(re, true, true, true) + +re = RegExp("a", "igim"); +assertFlags(re, true, true, true) + +// Tripple i's + +re = /a/iii; +assertFlags(re, false, false, true) + +re = /a/giii; +assertFlags(re, true, false, true) + +re = /a/igii; +assertFlags(re, true, false, true) + +re = /a/iigi; +assertFlags(re, true, false, true) + +re = /a/iiig; +assertFlags(re, true, false, true) + +re = /a/miiig; +assertFlags(re, true, true, true) + + +re = RegExp("a", "iii"); +assertFlags(re, false, false, true) + +re = RegExp("a", "giii"); +assertFlags(re, true, false, true) + +re = RegExp("a", "igii"); +assertFlags(re, true, false, true) + +re = RegExp("a", "iigi"); +assertFlags(re, true, false, true) + +re = RegExp("a", "iiig"); +assertFlags(re, true, false, true) + +re = RegExp("a", "miiig"); +assertFlags(re, true, true, true) + +// Illegal flags - flags late in string. + +re = /a/arglebargleglopglyf; +assertFlags(re, true, false, false) + +re = /a/arglebargleglopglif; +assertFlags(re, true, false, true) + +re = /a/arglebargleglopglym; +assertFlags(re, true, true, false) + +re = /a/arglebargleglopglim; +assertFlags(re, true, true, true) + +// Case of flags still matters. + +re = /a/gmi; +assertFlags(re, true, true, true) + +re = /a/Gmi; +assertFlags(re, false, true, true) + +re = /a/gMi; +assertFlags(re, true, false, true) + +re = /a/gmI; +assertFlags(re, true, true, false) + +re = /a/GMi; +assertFlags(re, false, false, true) + +re = /a/GmI; +assertFlags(re, false, true, false) + +re = /a/gMI; +assertFlags(re, true, false, false) + +re = /a/GMI; +assertFlags(re, false, false, false) diff --git a/deps/v8/test/mjsunit/regress/regress-220.js b/deps/v8/test/mjsunit/regress/regress-220.js new file mode 100644 index 0000000000..416aa4166e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-220.js @@ -0,0 +1,31 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function foo(f) { eval(f); } + +// Ensure that compiling a declaration of a function does not crash. +foo("function (x) { with ({x: []}) function x(){} }"); diff --git a/deps/v8/test/mjsunit/regress/regress-221.js b/deps/v8/test/mjsunit/regress/regress-221.js new file mode 100644 index 0000000000..d3f2e35539 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-221.js @@ -0,0 +1,34 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that direct eval calls handle the case where eval has been +// deleted correctly. + +// See http://code.google.com/p/v8/issues/detail?id=221 + +assertThrows('eval(delete eval)'); + diff --git a/deps/v8/test/mjsunit/regress/regress-225.js b/deps/v8/test/mjsunit/regress/regress-225.js new file mode 100644 index 0000000000..e101ca070f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-225.js @@ -0,0 +1,32 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See http://code.google.com/p/v8/issues/detail?id=225 + +assertEquals("foo", "foo".replace(/(?:)/g, function() { return ""; })); + +assertEquals("foo", "foo".replace(/(?:)/g, "")); diff --git a/deps/v8/test/mjsunit/regress/regress-227.js b/deps/v8/test/mjsunit/regress/regress-227.js new file mode 100644 index 0000000000..ebb46272dc --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-227.js @@ -0,0 +1,33 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +var re = /\u23a1|x/; +var res = re.exec("!"); +assertEquals(null, res, "Throwing away high bits on ASCII string"); + +res = re.exec("!x"); +assertEquals(["x"], res, "Throwing away high bits on ASCII string"); diff --git a/deps/v8/test/mjsunit/regress/regress-231.js b/deps/v8/test/mjsunit/regress/regress-231.js new file mode 100644 index 0000000000..0c6e5b3495 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-231.js @@ -0,0 +1,92 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See issue 231 <URL: http://code.google.com/p/v8/issues/detail?id=231 > +// A stack growth during a look-ahead could restore a pointer to the old stack. +// (Test derived from crash at ibs.blumex.com). + +var re = /Ggcy\b[^D]*D((?:(?=([^G]+))\2|G(?!gcy\b[^D]*D))*?)GIgcyD/; + +var str = 'GgcyDGgcy.saaaa.aDGaaa.aynaaaaaaaaacaaaaagcaaaaaaaancaDGgnayr' + + '.aryycnaaaataaaa.aryyacnaaataaaa.aaaaraaaaa.aaagaaaaaaaaDGgaaaaDGga' + + '.aaagaaaaaaaaDGga.nyataaaaragraa.anyataaagaca.agayraaarataga.aaacaa' + + '.aaagaa.aaacaaaDGaaa.aynaaaaaaaaacaaaaagcaaaaaacaagaa.agayraaaGgaaa' + + '.trgaaaaaagaatGanyara.caagaaGaD.araaaa_aat_aayDDaaDGaaa.aynaaaaaaaa' + + 'acaaaaagcaaaaaacaaaaa.agayraaaGgaaa.trgaaaaaaatGanyaraDDaaDGacna.ay' + + 'naaaaaaaaacaaaaagcaaaaaacaaaraGgaaa.naaaaagaaaaaaraynaaGanyaraDDaaD' + + 'aGgaaa.saaangaaaaraaaGgaaa.trgaaaragaaaarGanyaraDDDaGIacnaDGIaaaDGI' + + 'aaaDGIgaDGga.anyataaagaca.agayraaaaagaa.aaaaa.cnaaaata.aca.aca.aca.' + + 'acaaaDGgnayr.aaaaraaaaa.aaagaaaaaaaaDGgaaaaDGgaDGga.aayacnaaaaa.ayn' + + 'aaaaaaaaacaaaaagcaaaaaanaraDGaDacaaaaag_anaraGIaDGIgaDGIgaDGgaDGga.' + + 'aayacnaaaaa.aaagaaaaaaaaDGaa.aaagaaaaaaaa.aaaraaaa.aaaanaraaaa.IDGI' + + 'gaDGIgaDGgaDGga.aynaaaaaaaaacaaaaagcaaaaaaaraaaa.anyataaagacaDaGgaa' + + 'a.trgGragaaaacgGaaaaaaaG_aaaaa_Gaaaaaaaaa,.aGanar.anaraDDaaGIgaDGga' + + '.aynaaaaaaaaacaaaaagcaaaaaaanyara.anyataaagacaDGaDaaaaag_caaaaag_an' + + 'araGIaDGIgaDGIgaDGgaDGga.aynaaaaaaaaacaaaaagcaaaaaaaraaaa.anyataaag' + + 'acaDaGgaaa.trgGragaaaacgGaaaaaaaG_aaaaa_aaaaaa,.aaaaacaDDaaGIgaDGga' + + '.aynaaaaaaaaacaaaaagcaaaaaaanyara.anyataaagacaDGaDataaac_araaaaGIaD' + + 'GIgaDGIgaDaagcyaaGgaDGga.aayacnaaaaa.aaagaaaaaaaaDGaa.aaagaaaaaaaa.' + + 'aaaraaaa.aaaanaraaaa.IDGIgaDGIgaDGgcy.asaadanyaga.aa.aaaDGgaDGga.ay' + + 'naaaaaaaaacaaaaagcaaaaaaaraaaa.anyataaagacaDaGgaaa.trgGragaaaacgGaa' + + 'aaaaaG_aaaaa_DaaaaGaa,.aDanyagaaDDaaGIgaDGga.aynaaaaaaaaacaaaaagcaa' + + 'aaaaanyara.anyataaagacaDGaDadanyagaaGIaDGIgaDGIgaDGIgcyDGgcy.asaaga' + + 'cras.agra_yratga.aa.aaaarsaaraa.aa.agra_yratga.aa.aaaDGgaDGga.aynaa' + + 'aaaaaaacaaaaagcaaaaaaaraaaa.anyataaagacaDaGgaaa.trgGragaaaacgGaaaaa' + + 'aaG_aaaaa_aGaaaaaaGaa,.aaratgaaDDaaGIgaDGga.aynaaaaaaaaacaaaaagcaaa' + + 'aaaanyara.anyataaagacaDGaDaagra_yratgaaGIaDGIgaDGIgaDGIgcyDGgcy.asa' + + 'agacras.aratag.aa.aaaarsaaraa.aa.aratag.aa.aaaDGgaDGga.aynaaaaaaaaa' + + 'caaaaagcaaaaaaaraaaa.anyataaagacaDaGgaaa.trgGragaaaacgGaaaaaaaG_aaa' + + 'aa_aaaaaGa,.aaratagaDDaaGIgaDGga.aynaaaaaaaaacaaaaagcaaaaaaanyara.a' + + 'nyataaagacaDGaDaaratagaGIaDGIgaDGIgaDGIgcyDGgcy.asaagacras.gaaax_ar' + + 'atag.aa.aaaarsaaraa.aa.gaaax_aratag.aa.aaaDGgaDGga.aynaaaaaaaaacaaa' + + 'aagcaaaaaaaraaaa.anyataaagacaDaGgaaa.trgGragaaaacgGaaaaaaaG_aaaaa_G' + + 'aaaaaaaaaGa,.aaratagaDDaaGIgaDGga.aynaaaaaaaaacaaaaagcaaaaaaanyara.' + + 'anyataaagacaDGaDagaaax_aratagaGIaDGIgaDGIgaDGIgcyDGgcy.asaagacras.c' + + 'ag_aaar.aa.aaaarsaaraa.aa.cag_aaar.aa.aaaDGgaDGga.aynaaaaaaaaacaaaa' + + 'agcaaaaaaaraaaa.anyataaagacaDaGgaaa.trgGragaaaacgGaaaaaaaG_aaaaa_aa' + + 'Gaaaaa,.aaagaaaraDDaaGIgaDGga.aynaaaaaaaaacaaaaagcaaaaaaanyara.anya' + + 'taaagacaDGaDacag_aaaraGIaDGIgaDGIgaDGIgcyDGgcy.asaagacras.aaggaata_' + + 'aa_cynaga_cc.aa.aaaarsaaraa.aa.aaggaata_aa_cynaga_cc.aa.aaaDGgaDGga' + + '.aynaaaaaaaaacaaaaagcaaaaaaaraaaa.anyataaagacaDaGgaaa.trgGragaaaacg' + + 'GaaaaaaaG_aaaaa_aaGGaaaa_aa_aaaaGa_aaa,.aaynagaIcagaDDaaGIgaDGga.ay' + + 'naaaaaaaaacaaaaagcaaaaaaanyara.anyataaagacaDGaDaaaggaata_aa_cynaga_' + + 'ccaGIaDGIgaDGIgaDGIgcyDGgcy.asaagacras.syaara_aanargra.aa.aaaarsaar' + + 'aa.aa.syaara_aanargra.aa.aaaDGgaDGga.aynaaaaaaaaacaaaaagcaaaaaaaraa' + + 'aa.anyataaagacaDaGgaaa.trgGragaaaacgGaaaaaaaG_aaaaa_aaaaaaaaaaaGaaa' + + ',.aaanargraaDDaaGIgaDGga.aynaaaaaaaaacaaaaagcaaaaaaanyara.anyataaag' + + 'acaDGaDasyaara_aanargraaGIaDGIgaDGIgaDGIgcyDGgcy.asaagacras.cynag_a' + + 'anargra.aa.aaaarsaaraa.aa.cynag_aanargra.aa.aaaDGgaDGga.aynaaaaaaaa' + + 'acaaaaagcaaaaaaaraaaa.anyataaagacaDaGgaaa.trgGragaaaacgGaaaaaaaG_aa' + + 'aaa_aaaaGaaaaaGaaa,.aaanargraaDDaaGIgaDGga.aynaaaaaaaaacaaaaagcaaaa' + + 'aaanyara.anyataaagacaDGaDacynag_aanargraaGIaDGIgaDGIgaDGIgcyDGgaDGg' + + 'a.aynaaaaaaaaacaaaaagcaaaaaaaraaaa.anyataaagacaDaGgaaa.trgGragaaaac' + + 'gGaaaaaaaG'; + +//Shouldn't crash. + +var res = re.test(str); +assertTrue(res);
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/regress/regress-233.js b/deps/v8/test/mjsunit/regress/regress-233.js new file mode 100644 index 0000000000..8723679baf --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-233.js @@ -0,0 +1,39 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See issue 233 <URL: http://code.google.com/p/v8/issues/detail?id=233 > +// A stack overflow detected by a global regexp match wasn't handled correctly. + +// This code shouldn't segmentation fault. +function loop(s) { + loop(s.replace(/\s/g, "")); +} +try { + loop("No"); +} catch(e) { + // Stack overflow caught. +} diff --git a/deps/v8/test/mjsunit/regress/regress-244.js b/deps/v8/test/mjsunit/regress/regress-244.js new file mode 100644 index 0000000000..ffddcf8355 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-244.js @@ -0,0 +1,67 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +var kLegalPairs = [ + [0x00, '%00'], + [0x01, '%01'], + [0x7f, '%7F'], + [0x80, '%C2%80'], + [0x81, '%C2%81'], + [0x7ff, '%DF%BF'], + [0x800, '%E0%A0%80'], + [0x801, '%E0%A0%81'], + [0xd7ff, '%ED%9F%BF'], + [0xffff, '%EF%BF%BF'] +]; + +var kIllegalEncoded = [ + '%80', '%BF', '%80%BF', '%80%BF%80', '%C0%22', '%DF', + '%EF%BF', '%F7BFBF', '%FE', '%FF', '%FE%FE%FF%FF', + '%C0%AF', '%E0%9F%BF', '%F0%8F%BF%BF', '%C0%80', + '%E0%80%80' +]; + +function run() { + for (var i = 0; i < kLegalPairs.length; i++) { + var decoded = String.fromCharCode(kLegalPairs[i][0]); + var encoded = kLegalPairs[i][1]; + assertEquals(decodeURI(encoded), decoded); + assertEquals(encodeURI(decoded), encoded); + } + for (var i = 0; i < kIllegalEncoded.length; i++) { + var value = kIllegalEncoded[i]; + var threw = false; + try { + decodeURI(value); + fail(value); + } catch (e) { + assertInstanceof(e, URIError); + } + } +} + +run(); diff --git a/deps/v8/test/mjsunit/regress/regress-246.js b/deps/v8/test/mjsunit/regress/regress-246.js new file mode 100755 index 0000000000..4324b54041 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-246.js @@ -0,0 +1,31 @@ +// Copyright 2008 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.
+
+// See: http://code.google.com/p/v8/issues/detail?id=246
+
+assertTrue(/(?:text)/.test("text"));
+assertEquals(["text"], /(?:text)/.exec("text"));
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/regress/regress-253.js b/deps/v8/test/mjsunit/regress/regress-253.js new file mode 100644 index 0000000000..72c5dc1499 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-253.js @@ -0,0 +1,31 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +var x = 0; +x[0] = 0; +x[0] = 1; +x[0] = 2; diff --git a/deps/v8/test/mjsunit/regress/regress-254.js b/deps/v8/test/mjsunit/regress/regress-254.js new file mode 100755 index 0000000000..ec4b40ac67 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-254.js @@ -0,0 +1,58 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See: http://code.google.com/p/v8/issues/detail?id=254 + +// RegExp with global flag: exec and test updates lastIndex. +var re = /x/g; + +assertEquals(0, re.lastIndex, "Global, initial lastIndex"); + +assertTrue(re.test("x"), "Global, test 1"); +assertEquals(1, re.lastIndex, "Global, lastIndex after test 1"); +assertFalse(re.test("x"), "Global, test 2"); +assertEquals(0, re.lastIndex, "Global, lastIndex after test 2"); + +assertEquals(["x"], re.exec("x"), "Global, exec 1"); +assertEquals(1, re.lastIndex, "Global, lastIndex after exec 1"); +assertEquals(null, re.exec("x"), "Global, exec 2"); +assertEquals(0, re.lastIndex, "Global, lastIndex after exec 2"); + +// RegExp without global flag: exec and test leavs lastIndex at zero. +var re2 = /x/; + +assertEquals(0, re2.lastIndex, "Non-global, initial lastIndex"); + +assertTrue(re2.test("x"), "Non-global, test 1"); +assertEquals(0, re2.lastIndex, "Non-global, lastIndex after test 1"); +assertTrue(re2.test("x"), "Non-global, test 2"); +assertEquals(0, re2.lastIndex, "Non-global, lastIndex after test 2"); + +assertEquals(["x"], re2.exec("x"), "Non-global, exec 1"); +assertEquals(0, re2.lastIndex, "Non-global, lastIndex after exec 1"); +assertEquals(["x"], re2.exec("x"), "Non-global, exec 2"); +assertEquals(0, re2.lastIndex, "Non-global, lastIndex after exec 2"); diff --git a/deps/v8/test/mjsunit/regress/regress-259.js b/deps/v8/test/mjsunit/regress/regress-259.js new file mode 100644 index 0000000000..f0476ffc37 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-259.js @@ -0,0 +1,33 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that we do not crash when compiling a try/finally with an +// infinite loop (with no normal exits) in the try block. + +// See http://code.google.com/p/v8/issues/detail?id=259 + +assertThrows("try { while (true) { throw 0; }} finally {}"); diff --git a/deps/v8/test/mjsunit/regress/regress-260.js b/deps/v8/test/mjsunit/regress/regress-260.js new file mode 100644 index 0000000000..65242bcf57 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-260.js @@ -0,0 +1,33 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// We should not compile the bodies of function literals in loop +// conditions twice, even in cases where the loop condition is +// compiled twice. + +function test() { eval("while(!function () { var x; });"); } +test(); diff --git a/deps/v8/test/mjsunit/regress/regress-263.js b/deps/v8/test/mjsunit/regress/regress-263.js new file mode 100644 index 0000000000..123bde67e7 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-263.js @@ -0,0 +1,38 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Exits via return, break, or continue from within try/finally or +// for/in should not crash or trigger a debug assert. + +// See http://code.google.com/p/v8/issues/detail?id=263 + +function test0() { with({}) for(var x in {}) return; } +test0(); + + +function test1() { with({}) try { } finally { with({}) return; } } +test1(); diff --git a/deps/v8/test/mjsunit/regress/regress-265.js b/deps/v8/test/mjsunit/regress/regress-265.js new file mode 100644 index 0000000000..21ac1a6a2f --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-265.js @@ -0,0 +1,64 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// When returning or breaking out of a deeply nested try/finally, we +// should not crash. + +// See http://code.google.com/p/v8/issues/detail?id=263 + +function test0() { + try { + try { + return 0; + } finally { + try { + return 0; + } finally { + } + } + } finally { + } +} + +test0(); + +function test1() { +L0: + try { + try { + break L0; + } finally { + try { + break L0; + } finally { + } + } + } finally { + } +} + +test1(); diff --git a/deps/v8/test/mjsunit/regress/regress-267.js b/deps/v8/test/mjsunit/regress/regress-267.js new file mode 100644 index 0000000000..bb61606a3e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-267.js @@ -0,0 +1,35 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See http://code.google.com/p/v8/issues/detail?id=267 + +var global = (function(){ return this; })(); +function taint(fn){var v = fn(); eval("taint"); return v; } +function getThis(){ return this; } +var obj = taint(getThis); + +assertEquals(global, obj, "Should be the global object."); diff --git a/deps/v8/test/mjsunit/regress/regress-269.js b/deps/v8/test/mjsunit/regress/regress-269.js new file mode 100644 index 0000000000..49b24c0b43 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-269.js @@ -0,0 +1,49 @@ +// Copyright 2008 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 listener(event, exec_state, event_data, data) { + if (event == Debug.DebugEvent.Break) { + exec_state.prepareStep(Debug.StepAction.StepIn); + } +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function g() { +} + +function f() { + debugger; + g.apply(null, ['']); +} + +f()
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/regress/regress-279.js b/deps/v8/test/mjsunit/regress/regress-279.js new file mode 100644 index 0000000000..e500dd6ff8 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-279.js @@ -0,0 +1,62 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function makeArrayInObject() { + return { foo: [] }; +} + +var a = makeArrayInObject(); +a.foo.push(5); +var b = makeArrayInObject(); +assertEquals(0, b.foo.length, "Array in object"); + +function makeObjectInObject() { + return { foo: {} }; +} + +a = makeObjectInObject(); +a.foo.bar = 1; +b = makeObjectInObject(); +assertEquals('undefined', typeof(b.foo.bar), "Object in object"); + +function makeObjectInArray() { + return [ {} ]; +} + +a = makeObjectInArray(); +a[0].bar = 1; +b = makeObjectInArray(); +assertEquals('undefined', typeof(b[0].bar), "Object in array"); + +function makeArrayInArray() { + return [ [] ]; +} + +a = makeArrayInArray(); +a[0].push(5); +b = makeArrayInArray(); +assertEquals(0, b[0].length, "Array in array"); diff --git a/deps/v8/test/mjsunit/regress/regress-284.js b/deps/v8/test/mjsunit/regress/regress-284.js new file mode 100644 index 0000000000..ecfdeeac03 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-284.js @@ -0,0 +1,50 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See http://code.google.com/p/v8/issues/detail?id=284 + +function continueWithinLoop() { + var result; + for (var key in [0]) { + result = "hopla"; + continue; + } + return result; +}; + +assertEquals("hopla", continueWithinLoop()); + +function breakWithinLoop() { + var result; + for (var key in [0]) { + result = "hopla"; + break; + } + return result; +}; + +assertEquals("hopla", continueWithinLoop()); diff --git a/deps/v8/test/mjsunit/regress/regress-286.js b/deps/v8/test/mjsunit/regress/regress-286.js new file mode 100644 index 0000000000..361b72655e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-286.js @@ -0,0 +1,36 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// See http://code.google.com/p/v8/issues/detail?id=286 + +function test() { + var o = [1]; + var a = o[o ^= 1]; + return a; +}; + +assertEquals(1, test()); diff --git a/deps/v8/test/mjsunit/regress/regress-294.js b/deps/v8/test/mjsunit/regress/regress-294.js new file mode 100644 index 0000000000..285b447fb5 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-294.js @@ -0,0 +1,43 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Should not crash. +// See http://code.google.com/p/v8/issues/detail?id=294 + +function f() { return false; } + +function test(x) { + var y = x; + if (x == "kat") x = "kat"; + else { + x = "hund"; + var z = f(); + if (!z) x = "kat"; + } +} + +test("hund"); diff --git a/deps/v8/test/mjsunit/regress/regress-312.js b/deps/v8/test/mjsunit/regress/regress-312.js new file mode 100644 index 0000000000..0fb8c21f5e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-312.js @@ -0,0 +1,31 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Should not trigger debug ASSERT. +// See http://code.google.com/p/v8/issues/detail?id=312 + +var o = { f: "x" ? function () {} : function () {} }; diff --git a/deps/v8/test/mjsunit/regress/regress-317.js b/deps/v8/test/mjsunit/regress/regress-317.js new file mode 100644 index 0000000000..b742fa1f86 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-317.js @@ -0,0 +1,31 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Ensure replacement with string allows $ in replacement string. + +assertEquals("a$ec", "abc".replace("b", "$e"), "$e isn't meaningful"); + diff --git a/deps/v8/test/mjsunit/regress/regress-318.js b/deps/v8/test/mjsunit/regress/regress-318.js new file mode 100644 index 0000000000..9e00b5fba5 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-318.js @@ -0,0 +1,35 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Should not raise an exception. + +function test(value) { + if (typeof(value) == 'boolean') value = value + ''; + if (typeof(value) == 'number') value = value + ''; +} + +assertDoesNotThrow(test(0)); diff --git a/deps/v8/test/mjsunit/regress/regress-35.js b/deps/v8/test/mjsunit/regress/regress-35.js new file mode 100644 index 0000000000..2fcdbe75d2 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-35.js @@ -0,0 +1,33 @@ +// Copyright 2008 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 result; +eval("result = 42; while(true)break"); +assertEquals(42, result); + +eval("result = 87; while(false)continue"); +assertEquals(87, result); diff --git a/deps/v8/test/mjsunit/regress/regress-57.js b/deps/v8/test/mjsunit/regress/regress-57.js new file mode 100644 index 0000000000..1d410b92e9 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-57.js @@ -0,0 +1,32 @@ +// Copyright 2008 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. + +try { + delete (void 0).x; +} catch (e) { + print(e.toString()); +} diff --git a/deps/v8/test/mjsunit/regress/regress-588599.js b/deps/v8/test/mjsunit/regress/regress-588599.js new file mode 100644 index 0000000000..a1c16e245a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-588599.js @@ -0,0 +1,31 @@ +// Copyright 2008 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(Infinity == -Infinity); +assertEquals(Infinity, 1 / 1e-9999); +assertEquals(-Infinity, 1 / -1e-9999); + diff --git a/deps/v8/test/mjsunit/regress/regress-662254.js b/deps/v8/test/mjsunit/regress/regress-662254.js new file mode 100644 index 0000000000..daf5e17d0b --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-662254.js @@ -0,0 +1,40 @@ +// Copyright 2008 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 f() { + for (var c in []) { } +} + +f(); + + +function g() { + var c; + for (c in []) { } +} + +g(); diff --git a/deps/v8/test/mjsunit/regress/regress-666721.js b/deps/v8/test/mjsunit/regress/regress-666721.js new file mode 100644 index 0000000000..e2c632f2f8 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-666721.js @@ -0,0 +1,53 @@ +// Copyright 2008 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 len0(a) { return a.length; } +function len1(a) { return a.length; } +function len2(a) { return a.length; } +function len3(a) { return a.length; } + +assertEquals(0, len0([])); +assertEquals(1, len0({length:1})); +assertEquals(2, len0([1,2])); +assertEquals(3, len0('123')); + +assertEquals(0, len1('')); +assertEquals(1, len1({length:1})); +assertEquals(2, len1('12')); +assertEquals(3, len1([1,2,3])); + +assertEquals(0, len2({length:0})); +assertEquals(1, len2([1])); +assertEquals(2, len2({length:2})); +assertEquals(3, len2([1,2,3])); +assertEquals(4, len2('1234')); + +assertEquals(0, len3({length:0})); +assertEquals(1, len3('1')); +assertEquals(2, len3({length:2})); +assertEquals(3, len3('123')); +assertEquals(4, len3([1,2,3,4])); diff --git a/deps/v8/test/mjsunit/regress/regress-667061.js b/deps/v8/test/mjsunit/regress/regress-667061.js new file mode 100644 index 0000000000..4d29a1adb6 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-667061.js @@ -0,0 +1,90 @@ +// Copyright 2008 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 non-ICC case. +var caught = false; +try { + (('foo'))(); +} catch (o) { + assertTrue(o instanceof TypeError); + caught = true; +} +assertTrue(caught); + + +// Test uninitialized case. +function h(o) { + return o.x(); +} + +var caught = false; +try { + h({ x: 1 }); +} catch (o) { + assertTrue(o instanceof TypeError); + caught = true; +} +assertTrue(caught); + + +// Test monomorphic case. +function g(o) { + return o.x(); +} + +function O(x) { this.x = x; }; +var o = new O(function() { return 1; }); +assertEquals(1, g(o)); // go monomorphic +assertEquals(1, g(o)); // stay monomorphic + +var caught = false; +try { + g(new O(3)); +} catch (o) { + assertTrue(o instanceof TypeError); + caught = true; +} +assertTrue(caught); + + +// Test megamorphic case. +function f(o) { + return o.x(); +} + +assertEquals(1, f({ x: function () { return 1; }})); // go monomorphic +assertEquals(2, f({ x: function () { return 2; }})); // go megamorphic +assertEquals(3, f({ x: function () { return 3; }})); // stay megamorphic + +var caught = false; +try { + f({ x: 4 }); +} catch (o) { + assertTrue(o instanceof TypeError); + caught = true; +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/regress/regress-670147.js b/deps/v8/test/mjsunit/regress/regress-670147.js new file mode 100644 index 0000000000..b5b00d071a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-670147.js @@ -0,0 +1,34 @@ +// Copyright 2008 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 XXX(x) { + var k = delete x; + return k; +} + +assertFalse(XXX('Hello')); + diff --git a/deps/v8/test/mjsunit/regress/regress-674753.js b/deps/v8/test/mjsunit/regress/regress-674753.js new file mode 100644 index 0000000000..361b457e47 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-674753.js @@ -0,0 +1,87 @@ +// Copyright 2008 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 +assertTrue(typeof 0 == 'number'); +assertTrue(typeof 0 === 'number'); +assertTrue(typeof 1.2 == 'number'); +assertTrue(typeof 1.2 === 'number'); +assertFalse(typeof 'x' == 'number'); +assertFalse(typeof 'x' === 'number'); + +// String +assertTrue(typeof 'x' == 'string'); +assertTrue(typeof 'x' === 'string'); +assertTrue(typeof ('x' + 'x') == 'string'); +assertTrue(typeof ('x' + 'x') === 'string'); +assertFalse(typeof 1 == 'string'); +assertFalse(typeof 1 === 'string'); +assertFalse(typeof Object() == 'string'); +assertFalse(typeof Object() === 'string'); + +// Boolean +assertTrue(typeof true == 'boolean'); +assertTrue(typeof true === 'boolean'); +assertTrue(typeof false == 'boolean'); +assertTrue(typeof false === 'boolean'); +assertFalse(typeof 1 == 'boolean'); +assertFalse(typeof 1 === 'boolean'); +assertFalse(typeof Object() == 'boolean'); +assertFalse(typeof Object() === 'boolean'); + +// Undefined +assertTrue(typeof void 0 == 'undefined'); +assertTrue(typeof void 0 === 'undefined'); +assertFalse(typeof 1 == 'undefined'); +assertFalse(typeof 1 === 'undefined'); +assertFalse(typeof Object() == 'undefined'); +assertFalse(typeof Object() === 'undefined'); + +// Function +assertTrue(typeof Object == 'function'); +assertTrue(typeof Object === 'function'); +assertFalse(typeof 1 == 'function'); +assertFalse(typeof 1 === 'function'); +assertFalse(typeof Object() == 'function'); +assertFalse(typeof Object() === 'function'); + +// Object +assertTrue(typeof Object() == 'object'); +assertTrue(typeof Object() === 'object'); +assertTrue(typeof new String('x') == 'object'); +assertTrue(typeof new String('x') === 'object'); +assertTrue(typeof ['x'] == 'object'); +assertTrue(typeof ['x'] === 'object'); +assertTrue(typeof null == 'object'); +assertTrue(typeof null === 'object'); +assertFalse(typeof 1 == 'object'); +assertFalse(typeof 1 === 'object'); +assertFalse(typeof 'x' == 'object'); // bug #674753 +assertFalse(typeof 'x' === 'object'); +assertFalse(typeof Object == 'object'); +assertFalse(typeof Object === 'object'); + diff --git a/deps/v8/test/mjsunit/regress/regress-676025.js b/deps/v8/test/mjsunit/regress/regress-676025.js new file mode 100644 index 0000000000..15157f2c09 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-676025.js @@ -0,0 +1,31 @@ +// Copyright 2008 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 result; +try { eval('a=/(/'); } catch (e) { result = e; } +assertEquals('object', typeof result); +assertTrue(result instanceof SyntaxError); diff --git a/deps/v8/test/mjsunit/regress/regress-678525.js b/deps/v8/test/mjsunit/regress/regress-678525.js new file mode 100644 index 0000000000..5ff9c3d9e4 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-678525.js @@ -0,0 +1,59 @@ +// Copyright 2008 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(0, '\0'.charCodeAt(0)); +assertEquals(1, '\1'.charCodeAt(0)); +assertEquals(2, '\2'.charCodeAt(0)); +assertEquals(3, '\3'.charCodeAt(0)); +assertEquals(4, '\4'.charCodeAt(0)); +assertEquals(5, '\5'.charCodeAt(0)); +assertEquals(6, '\6'.charCodeAt(0)); +assertEquals(7, '\7'.charCodeAt(0)); +assertEquals(56, '\8'.charCodeAt(0)); + +assertEquals('\010', '\10'); +assertEquals('\011', '\11'); +assertEquals('\012', '\12'); +assertEquals('\013', '\13'); +assertEquals('\014', '\14'); +assertEquals('\015', '\15'); +assertEquals('\016', '\16'); +assertEquals('\017', '\17'); + +assertEquals('\020', '\20'); +assertEquals('\021', '\21'); +assertEquals('\022', '\22'); +assertEquals('\023', '\23'); +assertEquals('\024', '\24'); +assertEquals('\025', '\25'); +assertEquals('\026', '\26'); +assertEquals('\027', '\27'); + +assertEquals(73, '\111'.charCodeAt(0)); +assertEquals(105, '\151'.charCodeAt(0)); + + diff --git a/deps/v8/test/mjsunit/regress/regress-682649.js b/deps/v8/test/mjsunit/regress/regress-682649.js new file mode 100644 index 0000000000..f23aed5a85 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-682649.js @@ -0,0 +1,30 @@ +// Copyright 2008 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. + +// Should return [object global], v8 returns [object Object] + +assertEquals(this.toString(), eval("this.toString()")); diff --git a/deps/v8/test/mjsunit/regress/regress-69.js b/deps/v8/test/mjsunit/regress/regress-69.js new file mode 100644 index 0000000000..3fb1f76bde --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-69.js @@ -0,0 +1,43 @@ +// Copyright 2008 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. + +// This tests a switch statement with only default clause leaves +// balanced stack. It should not trigger the break point when --debug_code +// flag is turned on. +// See issue: http://code.google.com/p/v8/issues/detail?id=69 + +// Flags: --debug-code --expose-gc +function unbalanced_switch(a) { + try { + switch (a) { + default: break; + } + } catch (e) {} + gc(); +} + +unbalanced_switch(1); diff --git a/deps/v8/test/mjsunit/regress/regress-734862.js b/deps/v8/test/mjsunit/regress/regress-734862.js new file mode 100644 index 0000000000..6239047310 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-734862.js @@ -0,0 +1,37 @@ +// Copyright 2008 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 catcher(o, p) { + try { o[p]; } catch (e) { return e; } + throw p; +} + +assertTrue(catcher(null, 'foo') instanceof TypeError); +assertTrue(catcher(void 0, 'foo') instanceof TypeError); +assertTrue(catcher(null, 123) instanceof TypeError); +assertTrue(catcher(void 0, 123) instanceof TypeError); + diff --git a/deps/v8/test/mjsunit/regress/regress-737588.js b/deps/v8/test/mjsunit/regress/regress-737588.js new file mode 100644 index 0000000000..0f71dfc0bc --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-737588.js @@ -0,0 +1,34 @@ +// Copyright 2008 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 goog = goog || {} ; +goog.global = this; +goog.globalEval = function(script) { + return goog.global.eval(script); +}; + +assertEquals(125, goog.globalEval('var foofoofoo = 125; foofoofoo')); diff --git a/deps/v8/test/mjsunit/regress/regress-74.js b/deps/v8/test/mjsunit/regress/regress-74.js new file mode 100644 index 0000000000..f22b33c155 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-74.js @@ -0,0 +1,41 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test that the variable introduced by catch blocks is DontDelete. +// See http://code.google.com/p/v8/issues/detail?id=74 + +function test() { + try { + throw 42; + } catch(e) { + assertFalse(delete e, "deleting catch variable"); + assertEquals(42, e); + } +} + +test(); + diff --git a/deps/v8/test/mjsunit/regress/regress-780423.js b/deps/v8/test/mjsunit/regress/regress-780423.js new file mode 100644 index 0000000000..862db324ab --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-780423.js @@ -0,0 +1,39 @@ +// Copyright 2008 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 Class = { + create: function() { + return function kurt() { + } + } +}; + +var o1 = Class.create(); +var o2 = Class.create(); + +assertTrue(o1 !== o2, "different functions"); +assertTrue(o1.prototype !== o2.prototype, "different protos"); diff --git a/deps/v8/test/mjsunit/regress/regress-799761.js b/deps/v8/test/mjsunit/regress/regress-799761.js new file mode 100644 index 0000000000..d3be1bdadf --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-799761.js @@ -0,0 +1,92 @@ +// Copyright 2008 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. + +// const variables should be read-only +const c = 42; +c = 87; +assertEquals(42, c); + + +// const variables are not behaving like other JS variables when it comes +// to scoping - in fact they behave more sanely. Inside a 'with' they do +// not interfere with the 'with' scopes. + +(function () { + with ({ x: 42 }) { + const x = 7; + } + x = 5; + assertEquals(7, x); +})(); + + +// const variables may be declared but never initialized, in which case +// their value is undefined. + +(function (sel) { + if (sel == 0) + with ({ x: 42 }) { + const x; + } + else + x = 3; + x = 5; + assertTrue(typeof x == 'undefined'); +})(1); + + +// const variables may be initialized to undefined. +(function () { + with ({ x: 42 }) { + const x = undefined; + } + x = 5; + assertTrue(typeof x == 'undefined'); +})(); + + +// const variables may be accessed in inner scopes like any other variable. +(function () { + function bar() { + assertEquals(7, x); + } + with ({ x: 42 }) { + const x = 7; + } + x = 5 + bar(); +})(); + + +// const variables may be declared via 'eval' +(function () { + with ({ x: 42 }) { + eval('const x = 7'); + } + x = 5; + assertEquals(7, x); +})(); diff --git a/deps/v8/test/mjsunit/regress/regress-806473.js b/deps/v8/test/mjsunit/regress/regress-806473.js new file mode 100644 index 0000000000..6d6485d6e9 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-806473.js @@ -0,0 +1,60 @@ +// Copyright 2008 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 + +function catchThese() { + L: { + try { + break L; + } catch (e) {} + } +} + +function finallyThese() { + L: { + try { + break L; + } finally {} + } +} + + +for (var i = 0; i < 10; i++) { + catchThese(); + gc(); +} + +for (var j = 0; j < 10; j++) { + finallyThese(); + gc(); +} + +assertEquals(10, i); +assertEquals(10, j); + + diff --git a/deps/v8/test/mjsunit/regress/regress-842017.js b/deps/v8/test/mjsunit/regress/regress-842017.js new file mode 100644 index 0000000000..3a367bbddb --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-842017.js @@ -0,0 +1,60 @@ +// Copyright 2008 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 + +function break_from_for_in() { + L: { + try { + for (var x in [1,2,3]) { + break L; + } + } finally {} + } +} + +function break_from_finally() { + L: { + try { + } finally { + break L; + } + } +} + +for (var i = 0; i < 10; i++) { + break_from_for_in(); + gc(); +} + +for (var j = 0; j < 10; j++) { + break_from_finally(); + gc(); +} + +assertEquals(10, i); +assertEquals(10, j); diff --git a/deps/v8/test/mjsunit/regress/regress-86.js b/deps/v8/test/mjsunit/regress/regress-86.js new file mode 100644 index 0000000000..a33b60bc98 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-86.js @@ -0,0 +1,46 @@ +// Copyright 2008 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 aList = [1, 2, 3]; +var loopCount = 0; +var leftThroughFinally = false; +var enteredFinally = false; +for (x in aList) { + leftThroughFinally = true; + try { + throw "ex1"; + } catch(er1) { + loopCount += 1; + } finally { + enteredFinally = true; + continue; + } + leftThroughFinally = false; +} +assertEquals(3, loopCount); +assertTrue(enteredFinally); +assertTrue(leftThroughFinally); diff --git a/deps/v8/test/mjsunit/regress/regress-87.js b/deps/v8/test/mjsunit/regress/regress-87.js new file mode 100644 index 0000000000..131cb58edc --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-87.js @@ -0,0 +1,58 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function testFlags(flagstring, global, ignoreCase, multiline) { + var text = "/x/"+flagstring; + var re = eval(text); + assertEquals(global, re.global, text + ".global"); + assertEquals(ignoreCase, re.ignoreCase, text + ".ignoreCase"); + assertEquals(multiline, re.multiline, text + ".multiline"); +} + +testFlags("", false, false, false); + +testFlags("\u0067", true, false, false); + +testFlags("\u0069", false, true, false) + +testFlags("\u006d", false, false, true); + +testFlags("\u0068", false, false, false); + +testFlags("\u0020", false, false, false); + + +testFlags("\u0067g", true, false, false); + +testFlags("g\u0067", true, false, false); + +testFlags("abc\u0067efg", true, false, false); + +testFlags("i\u0067", true, true, false); + +testFlags("\u0067i", true, true, false); + diff --git a/deps/v8/test/mjsunit/regress/regress-874178.js b/deps/v8/test/mjsunit/regress/regress-874178.js new file mode 100644 index 0000000000..0ed5434a1e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-874178.js @@ -0,0 +1,32 @@ +// Copyright 2008 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 foo(){} +assertTrue(Function.prototype.isPrototypeOf(foo)); + +foo.bar = 'hello'; +assertTrue(foo.propertyIsEnumerable('bar')); diff --git a/deps/v8/test/mjsunit/regress/regress-875031.js b/deps/v8/test/mjsunit/regress/regress-875031.js new file mode 100644 index 0000000000..f18b08475b --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-875031.js @@ -0,0 +1,37 @@ +// Copyright 2008 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Regression test for issue 875031. + +var caught = false; +try { + eval("return;"); + assertTrue(false); // should not reach here +} catch (e) { + caught = true; +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/regress/regress-877615.js b/deps/v8/test/mjsunit/regress/regress-877615.js new file mode 100644 index 0000000000..d35aba62d3 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-877615.js @@ -0,0 +1,37 @@ +// Copyright 2008 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.toLocaleString = function() { return 'invalid'}; +assertEquals([1].toLocaleString(), 'invalid'); // invalid + +Number.prototype.toLocaleString = 'invalid'; +assertEquals([1].toLocaleString(), '1'); // 1 + +Number.prototype.toString = function() { return 'invalid' }; +assertEquals([1].toLocaleString(), '1'); // 1 +assertEquals([1].toString(), '1'); // 1 + diff --git a/deps/v8/test/mjsunit/regress/regress-892742.js b/deps/v8/test/mjsunit/regress/regress-892742.js new file mode 100644 index 0000000000..a60395e872 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-892742.js @@ -0,0 +1,50 @@ +// Copyright 2008 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 f() { + return/* useless*/1; +}; + + +// According to ECMA-262, this comment should actually be parsed as a +// line terminator making g() return undefined, but this is not the +// way it's handled by Spidermonkey or KJS. +function g() { + return/* useless + */2; +}; + +function h() { + return// meaningful + 3; +}; + + +assertEquals(1, f()); +assertEquals(2, g()); +assertTrue(typeof h() == 'undefined', 'h'); + diff --git a/deps/v8/test/mjsunit/regress/regress-900055.js b/deps/v8/test/mjsunit/regress/regress-900055.js new file mode 100644 index 0000000000..9a02f222c2 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-900055.js @@ -0,0 +1,42 @@ +// Copyright 2008 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 alias = eval; +function e(s) { return alias(s); } + +assertEquals(42, e("42")); +assertEquals(Object, e("Object")); +assertEquals(e, e("e")); + +var caught = false; +try { + e('s'); // should throw exception since aliased eval is global +} catch (e) { + caught = true; + assertTrue(e instanceof ReferenceError); +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/regress/regress-900966.js b/deps/v8/test/mjsunit/regress/regress-900966.js new file mode 100644 index 0000000000..b95d10ec08 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-900966.js @@ -0,0 +1,38 @@ +// Copyright 2008 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. + +assertTrue('abc'[10] === undefined); +String.prototype[10] = 'x'; +assertEquals('abc'[10], 'x'); + +assertTrue(2[11] === undefined); +Number.prototype[11] = 'y'; +assertEquals(2[11], 'y'); + +assertTrue(true[12] === undefined); +Boolean.prototype[12] = 'z'; +assertEquals(true[12], 'z'); diff --git a/deps/v8/test/mjsunit/regress/regress-91.js b/deps/v8/test/mjsunit/regress/regress-91.js new file mode 100644 index 0000000000..7f6263d91a --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-91.js @@ -0,0 +1,38 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +var date = new Date(); +var year = date.getYear(); +date.setMilliseconds(Number.NaN); +date.setYear(1900 + year); +assertEquals(year, date.getYear()); +assertEquals(0, date.getMonth()); +assertEquals(1, date.getDate()); +assertEquals(0, date.getHours()); +assertEquals(0, date.getMinutes()); +assertEquals(0, date.getSeconds()); +assertEquals(0, date.getMilliseconds()); diff --git a/deps/v8/test/mjsunit/regress/regress-925537.js b/deps/v8/test/mjsunit/regress/regress-925537.js new file mode 100644 index 0000000000..11582eaf90 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-925537.js @@ -0,0 +1,42 @@ +// Copyright 2008 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 assertClose(expected, actual) { + var delta = 0.00001; + if (Math.abs(expected - actual) > delta) { + print('Failure: Expected <' + actual + '> to be close to <' + + expected + '>'); + } +} + +assertEquals(1, Math.pow(NaN, 0)); +var pinf = Number.POSITIVE_INFINITY, ninf = Number.NEGATIVE_INFINITY; +assertClose( Math.PI / 4, Math.atan2(pinf, pinf)); +assertClose(-Math.PI / 4, Math.atan2(ninf, pinf)); +assertClose( 3 * Math.PI / 4, Math.atan2(pinf, ninf)); +assertClose(-3 * Math.PI / 4, Math.atan2(ninf, ninf)); + diff --git a/deps/v8/test/mjsunit/regress/regress-937896.js b/deps/v8/test/mjsunit/regress/regress-937896.js new file mode 100644 index 0000000000..e8e5ef21b7 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-937896.js @@ -0,0 +1,50 @@ +// Copyright 2008 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. + +// This used to crash because the label collector in the parser didn't +// discard duplicates which caused the outer-most continue statement +// to try to unlink the inner try-handler that wasn't on the stack. + +function f() { + try { + for (var i = 0; i < 2; i++) { + continue; + try { + continue; + continue; + } catch (ex) { + // Empty. + } + } + } catch (e) { + // Empty. + } + return 42; +} + + +assertEquals(42, f()); diff --git a/deps/v8/test/mjsunit/regress/regress-990205.js b/deps/v8/test/mjsunit/regress/regress-990205.js new file mode 100644 index 0000000000..1ab5bf88b4 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-990205.js @@ -0,0 +1,35 @@ +// Copyright 2008 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 f() { + // Force eager compilation of x through the use of eval. The break + // in function x should not try to break out of the enclosing while. + return eval("while(0) function x() { break; }; 42"); +}; + +assertEquals(42, f()); + diff --git a/deps/v8/test/mjsunit/regress/regress-992733.js b/deps/v8/test/mjsunit/regress/regress-992733.js new file mode 100644 index 0000000000..d0f7511c0c --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-992733.js @@ -0,0 +1,35 @@ +// Copyright 2008 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("object", typeof this); +var threw = false; +try { + this(); +} catch (e) { + threw = true; +} +assertTrue(threw); diff --git a/deps/v8/test/mjsunit/regress/regress-996542.js b/deps/v8/test/mjsunit/regress/regress-996542.js new file mode 100644 index 0000000000..8fc704eb28 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-996542.js @@ -0,0 +1,40 @@ +// Copyright 2008 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 zero = 0; +var one = 1; +var minus_one = -1; + +assertEquals(-Infinity, 1 / (0 / -1)); +assertEquals(-Infinity, one / (zero / minus_one)); +assertEquals(Infinity, 1 / (0 / 1)); +assertEquals(Infinity, one / (zero / one)); + +assertEquals(-Infinity, 1 / (-1 % 1)); +assertEquals(-Infinity, one / (minus_one % one)) +assertEquals(Infinity, 1 / (1 % 1)); +assertEquals(Infinity, one / (one % one)); diff --git a/deps/v8/test/mjsunit/regress/regress-998565.js b/deps/v8/test/mjsunit/regress/regress-998565.js new file mode 100644 index 0000000000..260b791186 --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-998565.js @@ -0,0 +1,51 @@ +// Copyright 2008 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 + +listenerCalled = false; + +function listener(event, exec_state, event_data, data) { + listenerCalled = true; + throw 1; +}; + +// Add the debug event listener. +Debug.setListener(listener); + +function f() { + a=1 +}; + +// Set a break point and call to invoke the debug event listener. +Debug.setBreakPoint(f, 0, 0); +f(); + +// Make sure that the debug event listener vas invoked. +assertTrue(listenerCalled);
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/scanner.js b/deps/v8/test/mjsunit/scanner.js new file mode 100644 index 0000000000..516a4e8880 --- /dev/null +++ b/deps/v8/test/mjsunit/scanner.js @@ -0,0 +1,30 @@ +// Copyright 2008 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 we check if escaped characters are valid indentifier +// start characters. +assertThrows('var \\u0030') diff --git a/deps/v8/test/mjsunit/short-circuit-boolean.js b/deps/v8/test/mjsunit/short-circuit-boolean.js new file mode 100644 index 0000000000..df40c2232b --- /dev/null +++ b/deps/v8/test/mjsunit/short-circuit-boolean.js @@ -0,0 +1,46 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test some code paths through the compiler for short-circuited +// boolean expressions. + +function andTest0() { + var a = 0; + // Left subexpression is known false at compile time. + return a != 0 && "failure"; +} + +assertFalse(andTest0()); + + +function orTest0() { + var a = 0; + // Left subexpression is known true at compile time. + return a == 0 || "failure"; +} + +assertTrue(orTest0()); diff --git a/deps/v8/test/mjsunit/smi-negative-zero.js b/deps/v8/test/mjsunit/smi-negative-zero.js new file mode 100644 index 0000000000..99ddc97207 --- /dev/null +++ b/deps/v8/test/mjsunit/smi-negative-zero.js @@ -0,0 +1,100 @@ +// Copyright 2008 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 that operations on small integers handle -0. + +var zero = 0; +var one = 1; +var minus_one = -1; +var two = 2; +var four = 4; +var minus_two = -2; +var minus_four = -4; + +// variable op variable + +assertEquals(one / (-zero), -Infinity); + +assertEquals(one / (zero * minus_one), -Infinity); +assertEquals(one / (minus_one * zero), -Infinity); +assertEquals(one / (zero * zero), Infinity); +assertEquals(one / (minus_one * minus_one), 1); + +assertEquals(one / (zero / minus_one), -Infinity); +assertEquals(one / (zero / one), Infinity); + +assertEquals(one / (minus_four % two), -Infinity); +assertEquals(one / (minus_four % minus_two), -Infinity); +assertEquals(one / (four % two), Infinity); +assertEquals(one / (four % minus_two), Infinity); + +// literal op variable + +assertEquals(one / (0 * minus_one), -Infinity); +assertEquals(one / (-1 * zero), -Infinity); +assertEquals(one / (0 * zero), Infinity); +assertEquals(one / (-1 * minus_one), 1); + +assertEquals(one / (0 / minus_one), -Infinity); +assertEquals(one / (0 / one), Infinity); + +assertEquals(one / (-4 % two), -Infinity); +assertEquals(one / (-4 % minus_two), -Infinity); +assertEquals(one / (4 % two), Infinity); +assertEquals(one / (4 % minus_two), Infinity); + +// variable op literal + +assertEquals(one / (zero * -1), -Infinity); +assertEquals(one / (minus_one * 0), -Infinity); +assertEquals(one / (zero * 0), Infinity); +assertEquals(one / (minus_one * -1), 1); + +assertEquals(one / (zero / -1), -Infinity); +assertEquals(one / (zero / 1), Infinity); + +assertEquals(one / (minus_four % 2), -Infinity); +assertEquals(one / (minus_four % -2), -Infinity); +assertEquals(one / (four % 2), Infinity); +assertEquals(one / (four % -2), Infinity); + +// literal op literal + +assertEquals(one / (-0), -Infinity); + +assertEquals(one / (0 * -1), -Infinity); +assertEquals(one / (-1 * 0), -Infinity); +assertEquals(one / (0 * 0), Infinity); +assertEquals(one / (-1 * -1), 1); + +assertEquals(one / (0 / -1), -Infinity); +assertEquals(one / (0 / 1), Infinity); + +assertEquals(one / (-4 % 2), -Infinity); +assertEquals(one / (-4 % -2), -Infinity); +assertEquals(one / (4 % 2), Infinity); +assertEquals(one / (4 % -2), Infinity); diff --git a/deps/v8/test/mjsunit/smi-ops.js b/deps/v8/test/mjsunit/smi-ops.js new file mode 100644 index 0000000000..bdd7509c9e --- /dev/null +++ b/deps/v8/test/mjsunit/smi-ops.js @@ -0,0 +1,102 @@ +// Copyright 2008 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. + +const SMI_MAX = (1 << 30) - 1; +const SMI_MIN = -(1 << 30); +const ONE = 1; +const ONE_HUNDRED = 100; + +const OBJ_42 = new (function() { + this.valueOf = function() { return 42; }; +})(); + +assertEquals(42, OBJ_42.valueOf()); + + +function Add1(x) { + return x + 1; +} + +function Add100(x) { + return x + 100; +} + +function Add1Reversed(x) { + return 1 + x; +} + +function Add100Reversed(x) { + return 100 + x; +} + + +assertEquals(1, Add1(0)); // fast case +assertEquals(1, Add1Reversed(0)); // fast case +assertEquals(SMI_MAX + ONE, Add1(SMI_MAX)); // overflow +assertEquals(SMI_MAX + ONE, Add1Reversed(SMI_MAX)); // overflow +assertEquals(42 + ONE, Add1(OBJ_42)); // non-smi +assertEquals(42 + ONE, Add1Reversed(OBJ_42)); // non-smi + +assertEquals(100, Add100(0)); // fast case +assertEquals(100, Add100Reversed(0)); // fast case +assertEquals(SMI_MAX + ONE_HUNDRED, Add100(SMI_MAX)); // overflow +assertEquals(SMI_MAX + ONE_HUNDRED, Add100Reversed(SMI_MAX)); // overflow +assertEquals(42 + ONE_HUNDRED, Add100(OBJ_42)); // non-smi +assertEquals(42 + ONE_HUNDRED, Add100Reversed(OBJ_42)); // non-smi + + + +function Sub1(x) { + return x - 1; +} + +function Sub100(x) { + return x - 100; +} + +function Sub1Reversed(x) { + return 1 - x; +} + +function Sub100Reversed(x) { + return 100 - x; +} + + +assertEquals(0, Sub1(1)); // fast case +assertEquals(-1, Sub1Reversed(2)); // fast case +assertEquals(SMI_MIN - ONE, Sub1(SMI_MIN)); // overflow +assertEquals(ONE - SMI_MIN, Sub1Reversed(SMI_MIN)); // overflow +assertEquals(42 - ONE, Sub1(OBJ_42)); // non-smi +assertEquals(ONE - 42, Sub1Reversed(OBJ_42)); // non-smi + +assertEquals(0, Sub100(100)); // fast case +assertEquals(1, Sub100Reversed(99)); // fast case +assertEquals(SMI_MIN - ONE_HUNDRED, Sub100(SMI_MIN)); // overflow +assertEquals(ONE_HUNDRED - SMI_MIN, Sub100Reversed(SMI_MIN)); // overflow +assertEquals(42 - ONE_HUNDRED, Sub100(OBJ_42)); // non-smi +assertEquals(ONE_HUNDRED - 42, Sub100Reversed(OBJ_42)); // non-smi diff --git a/deps/v8/test/mjsunit/sparse-array-reverse.js b/deps/v8/test/mjsunit/sparse-array-reverse.js new file mode 100644 index 0000000000..45a6da4b5e --- /dev/null +++ b/deps/v8/test/mjsunit/sparse-array-reverse.js @@ -0,0 +1,131 @@ +// Copyright 2008 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. + +/** + * @fileoverview Test reverse on small * and large arrays. + */ + +var VERYLARGE = 4000000000; + +// Nicer for firefox 1.5. Unless you uncomment the following line, +// smjs will appear to hang on this file. +//var VERYLARGE = 40000; + + +// Simple test of reverse on sparse array. +var a = []; +a.length = 2000; +a[15] = 'a'; +a[30] = 'b'; +Array.prototype[30] = 'B'; // Should be hidden by a[30]. +a[40] = 'c'; +a[50] = 'deleted'; +delete a[50]; // Should leave no trace once deleted. +a[1959] = 'd'; // Swapped with a[40] when reversing. +a[1999] = 'e'; +assertEquals("abcde", a.join('')); +a.reverse(); +delete Array.prototype[30]; +assertEquals("edcba", a.join('')); + + + +var seed = 43; + +// CONG pseudo random number generator. Used for fuzzing the sparse array +// reverse code. +function DoOrDont() { + seed = (69069 * seed + 1234567) % 0x100000000; + return (seed & 0x100000) != 0; +} + +var sizes = [140, 40000, VERYLARGE]; +var poses = [0, 10, 50, 69]; + + +// Fuzzing test of reverse on sparse array. +for (var iterations = 0; iterations < 20; iterations++) { + for (var size_pos = 0; size_pos < sizes.length; size_pos++) { + var size = sizes[size_pos]; + + var to_delete = []; + + var a; + // Make sure we test both array-backed and hash-table backed + // arrays. + if (size < 1000) { + a = new Array(size); + } else { + a = new Array(); + a.length = size; + } + + var expected = ''; + var expected_reversed = ''; + + for (var pos_pos = 0; pos_pos < poses.length; pos_pos++) { + var pos = poses[pos_pos]; + var letter = String.fromCharCode(97 + pos_pos); + if (DoOrDont()) { + a[pos] = letter; + expected += letter; + expected_reversed = letter + expected_reversed; + } else if (DoOrDont()) { + Array.prototype[pos] = letter; + expected += letter; + expected_reversed = letter + expected_reversed; + to_delete.push(pos); + } + } + var expected2 = ''; + var expected_reversed2 = ''; + for (var pos_pos = poses.length - 1; pos_pos >= 0; pos_pos--) { + var letter = String.fromCharCode(110 + pos_pos); + var pos = size - poses[pos_pos] - 1; + if (DoOrDont()) { + a[pos] = letter; + expected2 += letter; + expected_reversed2 = letter + expected_reversed2; + } else if (DoOrDont()) { + Array.prototype[pos] = letter; + expected2 += letter; + expected_reversed2 = letter + expected_reversed2; + to_delete.push(pos); + } + } + + assertEquals(expected + expected2, a.join(''), 'join' + size); + a.reverse(); + + while (to_delete.length != 0) { + var pos = to_delete.pop(); + delete(Array.prototype[pos]); + } + + assertEquals(expected_reversed2 + expected_reversed, a.join(''), 'reverse then join' + size); + } +} diff --git a/deps/v8/test/mjsunit/sparse-array.js b/deps/v8/test/mjsunit/sparse-array.js new file mode 100644 index 0000000000..0952f2caaa --- /dev/null +++ b/deps/v8/test/mjsunit/sparse-array.js @@ -0,0 +1,41 @@ +// Copyright 2008 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. + +// Because of a bug in the heuristics used to figure out when to +// convert a slow-case elements backing storage to fast case, the +// following took a very long time. +// +// This test passes if it finishes almost immediately. +for (var repetitions = 0; repetitions < 20; repetitions++) { + var stride = 500; + var array = []; + for (var i = 0; i < 1000; i++) { + array[i * stride] = i; + } +} + + diff --git a/deps/v8/test/mjsunit/str-to-num.js b/deps/v8/test/mjsunit/str-to-num.js new file mode 100644 index 0000000000..12a3716247 --- /dev/null +++ b/deps/v8/test/mjsunit/str-to-num.js @@ -0,0 +1,158 @@ +// Copyright 2008 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 toNumber(val) { + return Number(val); +} + +// assertEquals(, toNumber()); + + +assertEquals(123, toNumber(" 123")); +assertEquals(123, toNumber("\n123")); +assertEquals(123, toNumber("\r123")); +assertEquals(123, toNumber("\t123")); +assertEquals(123, toNumber("\f123")); + +assertEquals(123, toNumber("123 ")); +assertEquals(123, toNumber("123\n")); +assertEquals(123, toNumber("123\r")); +assertEquals(123, toNumber("123\t")); +assertEquals(123, toNumber("123\f")); + +assertEquals(123, toNumber(" 123 ")); +assertEquals(123, toNumber("\n123\n")); +assertEquals(123, toNumber("\r123\r")); +assertEquals(123, toNumber("\t123\t")); +assertEquals(123, toNumber("\f123\f")); + +assertTrue(isNaN(toNumber(" NaN "))); +assertEquals(Infinity, toNumber(" Infinity ") ," Infinity"); +assertEquals(-Infinity, toNumber(" -Infinity ")); +assertEquals(Infinity, toNumber(" +Infinity "), " +Infinity"); +assertEquals(Infinity, toNumber("Infinity ") ,"Infinity"); +assertEquals(-Infinity, toNumber("-Infinity ")); +assertEquals(Infinity, toNumber("+Infinity "), "+Infinity"); + +assertEquals(0, toNumber("0")); +assertEquals(0, toNumber("+0")); +assertEquals(-0, toNumber("-0")); + +assertEquals(1, toNumber("1")); +assertEquals(1, toNumber("+1")); +assertEquals(-1, toNumber("-1")); + +assertEquals(2, toNumber("2")); +assertEquals(2, toNumber("+2")); +assertEquals(-2, toNumber("-2")); + +assertEquals(3.1415926, toNumber("3.1415926")); +assertEquals(3.1415926, toNumber("+3.1415926")); +assertEquals(-3.1415926, toNumber("-3.1415926")); + +assertEquals(5, toNumber("5.")); +assertEquals(5, toNumber("+5.")); +assertEquals(-5, toNumber("-5.")); + +assertEquals(500, toNumber("5e2")); +assertEquals(500, toNumber("+5e2")); +assertEquals(-500, toNumber("-5e2")); +assertEquals(500, toNumber("5e+2")); +assertEquals(500, toNumber("+5e+2")); +assertEquals(-500, toNumber("-5e+2")); +assertEquals(0.05, toNumber("5e-2")); +assertEquals(0.05, toNumber("+5e-2")); +assertEquals(-0.05, toNumber("-5e-2")); + +assertEquals(0.00001, toNumber(".00001")); +assertEquals(0.00001, toNumber("+.00001")); +assertEquals(-0.00001, toNumber("-.00001")); +assertEquals(1, toNumber(".00001e5")); +assertEquals(1, toNumber("+.00001e5")); +assertEquals(-1, toNumber("-.00001e5")); +assertEquals(1, toNumber(".00001e+5")); +assertEquals(1, toNumber("+.00001e+5")); +assertEquals(-1, toNumber("-.00001e+5")); +assertEquals(0.00001, toNumber(".001e-2")); +assertEquals(0.00001, toNumber("+.001e-2")); +assertEquals(-0.00001, toNumber("-.001e-2")); + +assertEquals(12340000, toNumber("1234e4")); +assertEquals(12340000, toNumber("+1234e4")); +assertEquals(-12340000, toNumber("-1234e4")); +assertEquals(12340000, toNumber("1234e+4")); +assertEquals(12340000, toNumber("+1234e+4")); +assertEquals(-12340000, toNumber("-1234e+4")); +assertEquals(0.1234, toNumber("1234e-4")); +assertEquals(0.1234, toNumber("+1234e-4")); +assertEquals(-0.1234, toNumber("-1234e-4")); + +assertEquals(0, toNumber("0x0")); +assertEquals(1, toNumber("0x1")); +assertEquals(2, toNumber("0x2")); +assertEquals(9, toNumber("0x9")); +assertEquals(10, toNumber("0xa")); +assertEquals(11, toNumber("0xb")); +assertEquals(15, toNumber("0xf")); +assertEquals(10, toNumber("0xA")); +assertEquals(11, toNumber("0xB")); +assertEquals(15, toNumber("0xF")); + +assertEquals(0, toNumber("0X0")); +assertEquals(9, toNumber("0X9")); +assertEquals(10, toNumber("0Xa")); +assertEquals(10, toNumber("0XA")); +assertEquals(15, toNumber("0Xf")); +assertEquals(15, toNumber("0XF")); + +assertEquals(0, toNumber("0x000")); +assertEquals(9, toNumber("0x009")); +assertEquals(10, toNumber("0x00a")); +assertEquals(10, toNumber("0x00A")); +assertEquals(15, toNumber("0x00f")); +assertEquals(15, toNumber("0x00F")); + +assertEquals(0, toNumber("00")); +assertEquals(1, toNumber("01")); +assertEquals(2, toNumber("02")); +assertEquals(10, toNumber("010")); +assertEquals(100, toNumber("0100")); +assertEquals(100, toNumber("000100")); + +assertEquals(Infinity, toNumber("1e999"), "1e999"); +assertEquals(-Infinity, toNumber("-1e999")); +assertEquals(0, toNumber("1e-999")); +assertEquals(0, toNumber("-1e-999")); +assertEquals(Infinity, 1 / toNumber("1e-999"), "1e-999"); +assertEquals(-Infinity, 1 / toNumber("-1e-999")); + +assertTrue(isNaN(toNumber("junk")), "junk"); +assertTrue(isNaN(toNumber("100 junk")), "100 junk"); +assertTrue(isNaN(toNumber("0x100 junk")), "0x100 junk"); +assertTrue(isNaN(toNumber("100.0 junk")), "100.0 junk"); +assertTrue(isNaN(toNumber(".1e4 junk")), ".1e4 junk"); +assertTrue(isNaN(toNumber("Infinity junk")), "Infinity junk"); diff --git a/deps/v8/test/mjsunit/stress-array-push.js b/deps/v8/test/mjsunit/stress-array-push.js new file mode 100644 index 0000000000..1db2e2ae83 --- /dev/null +++ b/deps/v8/test/mjsunit/stress-array-push.js @@ -0,0 +1,34 @@ +// Copyright 2008 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. + +// Rewrite of mozilla_js_tests/js1_5/GC/regress-278725 +// to stress test pushing elements to an array. +var results = []; +for (var k = 0; k < 60000; k++) { + if ((k%10000) == 0) results.length = 0; + results.push({}); +} diff --git a/deps/v8/test/mjsunit/strict-equals.js b/deps/v8/test/mjsunit/strict-equals.js new file mode 100644 index 0000000000..d080ce8c4c --- /dev/null +++ b/deps/v8/test/mjsunit/strict-equals.js @@ -0,0 +1,90 @@ +// Copyright 2008 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 n = null; +var u = void 0; +assertTrue(null === null); +assertTrue(null === n); +assertTrue(n === null); +assertTrue(n === n); +assertFalse(null === void 0); +assertFalse(void 0 === null); +assertFalse(u === null); +assertFalse(null === u); +assertFalse(n === u); +assertFalse(u === n); +assertTrue(void 0 === void 0); +assertTrue(u === u); +assertTrue(u === void 0); +assertTrue(void 0 === u); + +assertTrue('foo' === 'foo'); +assertFalse('bar' === 'foo'); +assertFalse('foo' === new String('foo')); +assertFalse(new String('foo') === new String('foo')); +var s = new String('foo'); +assertTrue(s === s); +assertFalse(s === null); +assertFalse(s === void 0); +assertFalse('foo' === null); +assertFalse('foo' === 7); +assertFalse('foo' === true); +assertFalse('foo' === void 0); +assertFalse('foo' === {}); + +assertFalse({} === {}); +var x = {}; +assertTrue(x === x); +assertFalse(x === null); +assertFalse(x === 7); +assertFalse(x === true); +assertFalse(x === void 0); +assertFalse(x === {}); + +assertTrue(true === true); +assertTrue(false === false); +assertFalse(false === true); +assertFalse(true === false); +assertFalse(true === new Boolean(true)); +assertFalse(true === new Boolean(false)); +assertFalse(false === new Boolean(true)); +assertFalse(false === new Boolean(false)); +assertFalse(true === 0); +assertFalse(true === 1); + +assertTrue(0 === 0); +assertTrue(-0 === -0); +assertTrue(-0 === 0); +assertTrue(0 === -0); +assertFalse(0 === new Number(0)); +assertFalse(1 === new Number(1)); +assertTrue(4.2 === 4.2); +assertTrue(4.2 === Number(4.2)); + + + + diff --git a/deps/v8/test/mjsunit/string-add.js b/deps/v8/test/mjsunit/string-add.js new file mode 100644 index 0000000000..c42cf793b9 --- /dev/null +++ b/deps/v8/test/mjsunit/string-add.js @@ -0,0 +1,175 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +assertEquals("ab", "a" + "b", "ll"); + +assertEquals("12", "1" + "2", "dd"); +assertEquals("123", "1" + "2" + "3", "ddd"); +assertEquals("123", 1 + "2" + "3", "ndd"); +assertEquals("123", "1" + 2 + "3", "dnd"); +assertEquals("123", "1" + "2" + 3, "ddn"); + +assertEquals("123", "1" + 2 + 3, "dnn"); +assertEquals("123", 1 + "2" + 3, "ndn"); +assertEquals("33", 1 + 2 + "3", "nnd"); + +var x = "1"; +assertEquals("12", x + 2, "vn"); +assertEquals("12", x + "2", "vd"); +assertEquals("21", 2 + x, "nv"); +assertEquals("21", "2" + x, "dv"); + +var y = "2"; +assertEquals("12", x + y, "vdvd"); + +x = 1; +assertEquals("12", x + y, "vnvd"); + +y = 2; +assertEquals(3, x + y, "vnvn"); + +x = "1"; +assertEquals("12", x + y, "vdvn"); + +y = "2"; +assertEquals("12", x + y, "vdvd2"); + +(function(x, y) { + var z = "3"; + var w = "4"; + + assertEquals("11", x + x, "xx"); + assertEquals("12", x + y, "xy"); + assertEquals("13", x + z, "xz"); + assertEquals("14", x + w, "xw"); + + assertEquals("21", y + x, "yx"); + assertEquals("22", y + y, "yy"); + assertEquals("23", y + z, "yz"); + assertEquals("24", y + w, "yw"); + + assertEquals("31", z + x, "zx"); + assertEquals("32", z + y, "zy"); + assertEquals("33", z + z, "zz"); + assertEquals("34", z + w, "zw"); + + assertEquals("41", w + x, "wx"); + assertEquals("42", w + y, "wy"); + assertEquals("43", w + z, "wz"); + assertEquals("44", w + w, "ww"); + + (function(){x = 1; z = 3;})(); + + assertEquals(2, x + x, "x'x"); + assertEquals("12", x + y, "x'y"); + assertEquals(4, x + z, "x'z'"); + assertEquals("14", x + w, "x'w"); + + assertEquals("21", y + x, "yx'"); + assertEquals("22", y + y, "yy"); + assertEquals("23", y + z, "yz'"); + assertEquals("24", y + w, "yw"); + + assertEquals(4, z + x, "z'x'"); + assertEquals("32", z + y, "z'y"); + assertEquals(6, z + z, "z'z'"); + assertEquals("34", z + w, "z'w"); + + assertEquals("41", w + x, "wx'"); + assertEquals("42", w + y, "wy"); + assertEquals("43", w + z, "wz'"); + assertEquals("44", w + w, "ww"); +})("1", "2"); + +assertEquals("142", "1" + new Number(42), "sN"); +assertEquals("421", new Number(42) + "1", "Ns"); +assertEquals(84, new Number(42) + new Number(42), "NN"); + +assertEquals("142", "1" + new String("42"), "sS"); +assertEquals("421", new String("42") + "1", "Ss"); +assertEquals("142", "1" + new String("42"), "sS"); +assertEquals("4242", new String("42") + new String("42"), "SS"); + +assertEquals("1true", "1" + true, "sb"); +assertEquals("true1", true + "1", "bs"); +assertEquals(2, true + true, "bs"); + +assertEquals("1true", "1" + new Boolean(true), "sB"); +assertEquals("true1", new Boolean(true) + "1", "Bs"); +assertEquals(2, new Boolean(true) + new Boolean(true), "Bs"); + +assertEquals("1undefined", "1" + void 0, "sv"); +assertEquals("undefined1", (void 0) + "1", "vs"); +assertTrue(isNaN(void 0 + void 0), "vv"); + +assertEquals("1null", "1" + null, "su"); +assertEquals("null1", null + "1", "us"); +assertEquals(0, null + null, "uu"); + +(function (i) { + // Check that incoming frames are merged correctly. + var x; + var y; + var z; + var w; + switch (i) { + case 1: x = 42; y = "stry"; z = "strz"; w = 42; break; + default: x = "strx", y = 42; z = "strz"; w = 42; break; + } + var resxx = x + x; + var resxy = x + y; + var resxz = x + z; + var resxw = x + w; + var resyx = y + x; + var resyy = y + y; + var resyz = y + z; + var resyw = y + w; + var reszx = z + x; + var reszy = z + y; + var reszz = z + z; + var reszw = z + w; + var reswx = w + x; + var reswy = w + y; + var reswz = w + z; + var resww = w + w; + assertEquals(84, resxx, "swxx"); + assertEquals("42stry", resxy, "swxy"); + assertEquals("42strz", resxz, "swxz"); + assertEquals(84, resxw, "swxw"); + assertEquals("stry42", resyx, "swyx"); + assertEquals("strystry", resyy, "swyy"); + assertEquals("strystrz", resyz, "swyz"); + assertEquals("stry42", resyw, "swyw"); + assertEquals("strz42", reszx, "swzx"); + assertEquals("strzstry", reszy, "swzy"); + assertEquals("strzstrz", reszz, "swzz"); + assertEquals("strz42", reszw, "swzw"); + assertEquals(84, reswx, "swwx"); + assertEquals("42stry", reswy, "swwy"); + assertEquals("42strz", reswz, "swwz"); + assertEquals(84, resww, "swww"); +})(1); diff --git a/deps/v8/test/mjsunit/string-case.js b/deps/v8/test/mjsunit/string-case.js new file mode 100644 index 0000000000..13dcd3ea81 --- /dev/null +++ b/deps/v8/test/mjsunit/string-case.js @@ -0,0 +1,28 @@ +// Copyright 2008 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("ΚΟΣΜΟΣ ΚΟΣΜΟΣ".toLowerCase(), "κοσμος κοσμος"); diff --git a/deps/v8/test/mjsunit/string-charat.js b/deps/v8/test/mjsunit/string-charat.js new file mode 100644 index 0000000000..8ec8f1e08f --- /dev/null +++ b/deps/v8/test/mjsunit/string-charat.js @@ -0,0 +1,53 @@ +// Copyright 2008 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 s = "test"; + +assertEquals("t", s.charAt()); +assertEquals("t", s.charAt("string")); +assertEquals("t", s.charAt(null)); +assertEquals("t", s.charAt(void 0)); +assertEquals("t", s.charAt(false)); +assertEquals("e", s.charAt(true)); +assertEquals("", s.charAt(-1)); +assertEquals("", s.charAt(4)); +assertEquals("t", s.charAt(0)); +assertEquals("t", s.charAt(3)); +assertEquals("t", s.charAt(NaN)); + +assertEquals(116, s.charCodeAt()); +assertEquals(116, s.charCodeAt("string")); +assertEquals(116, s.charCodeAt(null)); +assertEquals(116, s.charCodeAt(void 0)); +assertEquals(116, s.charCodeAt(false)); +assertEquals(101, s.charCodeAt(true)); +assertEquals(116, s.charCodeAt(0)); +assertEquals(116, s.charCodeAt(3)); +assertEquals(116, s.charCodeAt(NaN)); +assertTrue(isNaN(s.charCodeAt(-1))); +assertTrue(isNaN(s.charCodeAt(4))); + diff --git a/deps/v8/test/mjsunit/string-charcodeat.js b/deps/v8/test/mjsunit/string-charcodeat.js new file mode 100644 index 0000000000..f66dd3ef68 --- /dev/null +++ b/deps/v8/test/mjsunit/string-charcodeat.js @@ -0,0 +1,189 @@ +// Copyright 2008 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. + +/** + * @fileoverview Check all sorts of borderline cases for charCodeAt. + */ + +function Cons() { + return "Te" + "st"; +} + + +function Deep() { + var a = "T"; + a += "e"; + a += "s"; + a += "t"; + return a; +} + + +function Slice() { + return "testing Testing".substring(8, 12); +} + + +function Flat() { + return "Test"; +} + +function Cons16() { + return "Te" + "\u1234t"; +} + + +function Deep16() { + var a = "T"; + a += "e"; + a += "\u1234"; + a += "t"; + return a; +} + + +function Slice16Beginning() { + return "Te\u1234t test".substring(0, 4); +} + + +function Slice16Middle() { + return "test Te\u1234t test".substring(5, 9); +} + + +function Slice16End() { + return "test Te\u1234t".substring(5, 9); +} + + +function Flat16() { + return "Te\u1234t"; +} + + +function Thing() { +} + + +function NotAString() { + var n = new Thing(); + n.toString = function() { return "Test"; }; + n.charCodeAt = String.prototype.charCodeAt; + return n; +} + + +function NotAString16() { + var n = new Thing(); + n.toString = function() { return "Te\u1234t"; }; + n.charCodeAt = String.prototype.charCodeAt; + return n; +} + + +function TestStringType(generator, sixteen) { + var g = generator; + assertTrue(isNaN(g().charCodeAt(-1e19))); + assertTrue(isNaN(g().charCodeAt(-0x80000001))); + assertTrue(isNaN(g().charCodeAt(-0x80000000))); + assertTrue(isNaN(g().charCodeAt(-0x40000000))); + assertTrue(isNaN(g().charCodeAt(-1))); + assertTrue(isNaN(g().charCodeAt(4))); + assertTrue(isNaN(g().charCodeAt(5))); + assertTrue(isNaN(g().charCodeAt(0x3fffffff))); + assertTrue(isNaN(g().charCodeAt(0x7fffffff))); + assertTrue(isNaN(g().charCodeAt(0x80000000))); + assertTrue(isNaN(g().charCodeAt(1e9))); + assertEquals(84, g().charCodeAt(0)); + assertEquals(84, g().charCodeAt("test")); + assertEquals(84, g().charCodeAt("")); + assertEquals(84, g().charCodeAt(null)); + assertEquals(84, g().charCodeAt(undefined)); + assertEquals(84, g().charCodeAt()); + assertEquals(84, g().charCodeAt(void 0)); + assertEquals(84, g().charCodeAt(false)); + assertEquals(101, g().charCodeAt(true)); + assertEquals(101, g().charCodeAt(1)); + assertEquals(sixteen ? 0x1234 : 115, g().charCodeAt(2)); + assertEquals(116, g().charCodeAt(3)); + assertEquals(101, g().charCodeAt(1.1)); + assertEquals(sixteen ? 0x1234 : 115, g().charCodeAt(2.1718)); + assertEquals(116, g().charCodeAt(3.14159)); +} + + +TestStringType(Cons, false); +TestStringType(Deep, false); +TestStringType(Slice, false); +TestStringType(Flat, false); +TestStringType(NotAString, false); +TestStringType(Cons16, true); +TestStringType(Deep16, true); +TestStringType(Slice16Beginning, true); +TestStringType(Slice16Middle, true); +TestStringType(Slice16End, true); +TestStringType(Flat16, true); +TestStringType(NotAString16, true); + + +function StupidThing() { + // Doesn't return a string from toString! + this.toString = function() { return 42; } + this.charCodeAt = String.prototype.charCodeAt; +} + +assertEquals(52, new StupidThing().charCodeAt(0)); +assertEquals(50, new StupidThing().charCodeAt(1)); +assertTrue(isNaN(new StupidThing().charCodeAt(2))); +assertTrue(isNaN(new StupidThing().charCodeAt(-1))); + + +// Medium (>255) and long (>65535) strings. + +var medium = "12345678"; +medium += medium; // 16. +medium += medium; // 32. +medium += medium; // 64. +medium += medium; // 128. +medium += medium; // 256. + +var long = medium; +long += long + long + long; // 1024. +long += long + long + long; // 4096. +long += long + long + long; // 16384. +long += long + long + long; // 65536. + +assertTrue(isNaN(medium.charCodeAt(-1))); +assertEquals(49, medium.charCodeAt(0)); +assertEquals(56, medium.charCodeAt(255)); +assertTrue(isNaN(medium.charCodeAt(256))); + +assertTrue(isNaN(long.charCodeAt(-1))); +assertEquals(49, long.charCodeAt(0)); +assertEquals(56, long.charCodeAt(65535)); +assertTrue(isNaN(long.charCodeAt(65536))); diff --git a/deps/v8/test/mjsunit/string-compare-alignment.js b/deps/v8/test/mjsunit/string-compare-alignment.js new file mode 100644 index 0000000000..a291417ba5 --- /dev/null +++ b/deps/v8/test/mjsunit/string-compare-alignment.js @@ -0,0 +1,47 @@ +// Copyright 2008 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 we can compare two strings that are not 4-byte aligned. +// This situation can arise with sliced strings. This tests for an ARM bug +// that was fixed in r554. + +var base = "Now is the time for all good men to come to the aid of the party. " + + "Now is the time for all good men to come to the aid of the party." +var s1 = base.substring(0, 64); +var s2 = base.substring(66, 130); + +var o = new Object(); +o[s1] = 1; +o[s2] = 2; + +var first_time = true; + +for (var x in o) { + assertTrue(o[x] == 2, "expect 2"); + assertTrue(first_time, "once only"); + first_time = false; +} diff --git a/deps/v8/test/mjsunit/string-flatten.js b/deps/v8/test/mjsunit/string-flatten.js new file mode 100644 index 0000000000..91877b2df6 --- /dev/null +++ b/deps/v8/test/mjsunit/string-flatten.js @@ -0,0 +1,37 @@ +// Copyright 2008 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. + +// Check for regression of bug 1011505 (out of memory when flattening strings). +var i; +var s = ""; + +for (i = 0; i < 1024; i++) { + s = s + (i + (i+1)); + s = s.substring(1); +} +// Flatten the string. +assertEquals(57, s.charCodeAt(0)); diff --git a/deps/v8/test/mjsunit/string-index.js b/deps/v8/test/mjsunit/string-index.js new file mode 100644 index 0000000000..2256286eec --- /dev/null +++ b/deps/v8/test/mjsunit/string-index.js @@ -0,0 +1,154 @@ +// Copyright 2008 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. + +/** + * @fileoverview Test indexing on strings with []. + */ + +var foo = "Foo"; +assertEquals("Foo", foo); +assertEquals("F", foo[0]); +assertEquals("o", foo[1]); +assertEquals("o", foo[2]); + +assertEquals("F", foo["0" + ""], "string index"); +assertEquals("o", foo["1"], "string index"); +assertEquals("o", foo["2"], "string index"); + +assertEquals("undefined", typeof(foo[3]), "out of range"); +// SpiderMonkey 1.5 fails this next one. So does FF 2.0.6. +assertEquals("undefined", typeof(foo[-1]), "known failure in SpiderMonkey 1.5"); +assertEquals("undefined", typeof(foo[-2]), "negative index"); + +foo[0] = "f"; +assertEquals("Foo", foo); + +foo[3] = "t"; +assertEquals("Foo", foo); +assertEquals("undefined", typeof(foo[3]), "out of range"); +assertEquals("undefined", typeof(foo[-2]), "negative index"); + +var S = new String("foo"); +assertEquals("foo", S); +assertEquals("f", S[0], "string object"); +assertEquals("f", S["0"], "string object"); +S[0] = 'bente'; +assertEquals("f", S[0], "string object"); +assertEquals("f", S["0"], "string object"); +S[-2] = 'spider'; +assertEquals('spider', S[-2]); +S[3] = 'monkey'; +assertEquals('monkey', S[3]); +S['foo'] = 'Fu'; +assertEquals("Fu", S.foo); + +// In FF this is ignored I think. In V8 it puts a property on the String object +// but you won't ever see it because it is hidden by the 0th character in the +// string. The net effect is pretty much the same. +S["0"] = 'bente'; +assertEquals("f", S[0], "string object"); +assertEquals("f", S["0"], "string object"); + +assertEquals(true, 0 in S, "0 in"); +assertEquals(false, -1 in S, "-1 in"); +assertEquals(true, 2 in S, "2 in"); +assertEquals(true, 3 in S, "3 in"); +assertEquals(false, 4 in S, "3 in"); + +assertEquals(true, "0" in S, '"0" in'); +assertEquals(false, "-1" in S, '"-1" in'); +assertEquals(true, "2" in S, '"2" in'); +assertEquals(true, "3" in S, '"3" in'); +assertEquals(false, "4" in S, '"3" in'); + +assertEquals(true, S.hasOwnProperty(0), "0 hasOwnProperty"); +assertEquals(false, S.hasOwnProperty(-1), "-1 hasOwnProperty"); +assertEquals(true, S.hasOwnProperty(2), "2 hasOwnProperty"); +assertEquals(true, S.hasOwnProperty(3), "3 hasOwnProperty"); +assertEquals(false, S.hasOwnProperty(4), "3 hasOwnProperty"); + +assertEquals(true, S.hasOwnProperty("0"), '"0" hasOwnProperty'); +assertEquals(false, S.hasOwnProperty("-1"), '"-1" hasOwnProperty'); +assertEquals(true, S.hasOwnProperty("2"), '"2" hasOwnProperty'); +assertEquals(true, S.hasOwnProperty("3"), '"3" hasOwnProperty'); +assertEquals(false, S.hasOwnProperty("4"), '"3" hasOwnProperty'); + +assertEquals(true, "foo".hasOwnProperty(0), "foo 0 hasOwnProperty"); +assertEquals(false, "foo".hasOwnProperty(-1), "foo -1 hasOwnProperty"); +assertEquals(true, "foo".hasOwnProperty(2), "foo 2 hasOwnProperty"); +assertEquals(false, "foo".hasOwnProperty(4), "foo 3 hasOwnProperty"); + +assertEquals(true, "foo".hasOwnProperty("0"), 'foo "0" hasOwnProperty'); +assertEquals(false, "foo".hasOwnProperty("-1"), 'foo "-1" hasOwnProperty'); +assertEquals(true, "foo".hasOwnProperty("2"), 'foo "2" hasOwnProperty'); +assertEquals(false, "foo".hasOwnProperty("4"), 'foo "3" hasOwnProperty'); + +//assertEquals(true, 0 in "foo", "0 in"); +//assertEquals(false, -1 in "foo", "-1 in"); +//assertEquals(true, 2 in "foo", "2 in"); +//assertEquals(false, 3 in "foo", "3 in"); +// +//assertEquals(true, "0" in "foo", '"0" in'); +//assertEquals(false, "-1" in "foo", '"-1" in'); +//assertEquals(true, "2" in "foo", '"2" in'); +//assertEquals(false, "3" in "foo", '"3" in'); + +delete S[3]; +assertEquals("undefined", typeof(S[3])); +assertEquals(false, 3 in S); +assertEquals(false, "3" in S); + +var N = new Number(43); +assertEquals(43, N); +N[-2] = "Alpha"; +assertEquals("Alpha", N[-2]); +N[0] = "Zappa"; +assertEquals("Zappa", N[0]); +assertEquals("Zappa", N["0"]); + +var A = ["V", "e", "t", "t", "e", "r"]; +var A2 = (A[0] = "v"); +assertEquals('v', A[0]); +assertEquals('v', A2); + +var S = new String("Onkel"); +var S2 = (S[0] = 'o'); +assertEquals('O', S[0]); +assertEquals('o', S2); + +var s = "Tante"; +var s2 = (s[0] = 't'); +assertEquals('T', s[0]); +assertEquals('t', s2); + +var S2 = (S[-2] = 'o'); +assertEquals('o', S[-2]); +assertEquals('o', S2); + +var s2 = (s[-2] = 't'); +assertEquals('undefined', typeof(s[-2])); +assertEquals('t', s2); diff --git a/deps/v8/test/mjsunit/string-indexof.js b/deps/v8/test/mjsunit/string-indexof.js new file mode 100644 index 0000000000..2018da72f3 --- /dev/null +++ b/deps/v8/test/mjsunit/string-indexof.js @@ -0,0 +1,142 @@ +// Copyright 2008 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 s = "test test test"; + +assertEquals(0, s.indexOf("t")); +assertEquals(3, s.indexOf("t", 1)); +assertEquals(5, s.indexOf("t", 4)); +assertEquals(1, s.indexOf("e")); +assertEquals(2, s.indexOf("s")); + +assertEquals(5, s.indexOf("test", 4)); +assertEquals(5, s.indexOf("test", 5)); +assertEquals(10, s.indexOf("test", 6)); +assertEquals(0, s.indexOf("test", 0)); +assertEquals(0, s.indexOf("test", -1)); +assertEquals(0, s.indexOf("test")); +assertEquals(-1, s.indexOf("notpresent")); +assertEquals(-1, s.indexOf()); + +for (var i = 0; i < s.length+10; i++) { + var expected = i < s.length ? i : s.length; + assertEquals(expected, s.indexOf("", i)); +} + +var reString = "asdf[a-z]+(asdf)?"; + +assertEquals(4, reString.indexOf("[a-z]+")); +assertEquals(10, reString.indexOf("(asdf)?")); + +assertEquals(1, String.prototype.indexOf.length); + +// Random greek letters +var twoByteString = "\u039a\u0391\u03a3\u03a3\u0395"; + +// Test single char pattern +assertEquals(0, twoByteString.indexOf("\u039a"), "Lamda"); +assertEquals(1, twoByteString.indexOf("\u0391"), "Alpha"); +assertEquals(2, twoByteString.indexOf("\u03a3"), "First Sigma"); +assertEquals(3, twoByteString.indexOf("\u03a3",3), "Second Sigma"); +assertEquals(4, twoByteString.indexOf("\u0395"), "Epsilon"); +assertEquals(-1, twoByteString.indexOf("\u0392"), "Not beta"); + +// Test multi-char pattern +assertEquals(0, twoByteString.indexOf("\u039a\u0391"), "lambda Alpha"); +assertEquals(1, twoByteString.indexOf("\u0391\u03a3"), "Alpha Sigma"); +assertEquals(2, twoByteString.indexOf("\u03a3\u03a3"), "Sigma Sigma"); +assertEquals(3, twoByteString.indexOf("\u03a3\u0395"), "Sigma Epsilon"); + +assertEquals(-1, twoByteString.indexOf("\u0391\u03a3\u0395"), + "Not Alpha Sigma Epsilon"); + +//single char pattern +assertEquals(4, twoByteString.indexOf("\u0395")); + +// Test complex string indexOf algorithms. Only trigger for long strings. + +// Long string that isn't a simple repeat of a shorter string. +var long = "A"; +for(var i = 66; i < 76; i++) { // from 'B' to 'K' + long = long + String.fromCharCode(i) + long; +} + +// pattern of 15 chars, repeated every 16 chars in long +var pattern = "ABACABADABACABA"; +for(var i = 0; i < long.length - pattern.length; i+= 7) { + var index = long.indexOf(pattern, i); + assertEquals((i + 15) & ~0xf, index, "Long ABACABA...-string at index " + i); +} +assertEquals(510, long.indexOf("AJABACA"), "Long AJABACA, First J"); +assertEquals(1534, long.indexOf("AJABACA", 511), "Long AJABACA, Second J"); + +pattern = "JABACABADABACABA"; +assertEquals(511, long.indexOf(pattern), "Long JABACABA..., First J"); +assertEquals(1535, long.indexOf(pattern, 512), "Long JABACABA..., Second J"); + + +var lipsum = "lorem ipsum per se esse fugiendum. itaque aiunt hanc quasi " + + "naturalem atque insitam in animis nostris inesse notionem, ut " + + "alterum esse appetendum, alterum aspernandum sentiamus. Alii autem," + + " quibus ego assentior, cum a philosophis compluribus permulta " + + "dicantur, cur nec voluptas in bonis sit numeranda nec in malis " + + "dolor, non existimant oportere nimium nos causae confidere, sed et" + + " argumentandum et accurate disserendum et rationibus conquisitis de" + + " voluptate et dolore disputandum putant.\n" + + "Sed ut perspiciatis, unde omnis iste natus error sit voluptatem " + + "accusantium doloremque laudantium, totam rem aperiam eaque ipsa," + + "quae ab illo inventore veritatis et quasi architecto beatae vitae " + + "dicta sunt, explicabo. nemo enim ipsam voluptatem, quia voluptas" + + "sit, aspernatur aut odit aut fugit, sed quia consequuntur magni" + + " dolores eos, qui ratione voluptatem sequi nesciunt, neque porro" + + " quisquam est, qui dolorem ipsum, quia dolor sit, amet, " + + "consectetur, adipisci velit, sed quia non numquam eius modi" + + " tempora incidunt, ut labore et dolore magnam aliquam quaerat " + + "voluptatem. ut enim ad minima veniam, quis nostrum exercitationem " + + "ullam corporis suscipit laboriosam, nisi ut aliquid ex ea commodi " + + "consequatur? quis autem vel eum iure reprehenderit, qui in ea " + + "voluptate velit esse, quam nihil molestiae consequatur, vel illum, " + + "qui dolorem eum fugiat, quo voluptas nulla pariatur?\n"; + +assertEquals(893, lipsum.indexOf("lorem ipsum, quia dolor sit, amet"), + "Lipsum"); +// test a lot of substrings of differing length and start-position. +for(var i = 0; i < lipsum.length; i += 3) { + for(var len = 1; i + len < lipsum.length; len += 7) { + var substring = lipsum.substring(i, i + len); + var index = -1; + do { + index = lipsum.indexOf(substring, index + 1); + assertTrue(index != -1, + "Lipsum substring " + i + ".." + (i + len-1) + " not found"); + assertEquals(lipsum.substring(index, index + len), substring, + "Wrong lipsum substring found: " + i + ".." + (i + len - 1) + "/" + + index + ".." + (index + len - 1)); + } while (index >= 0 && index < i); + assertEquals(i, index, "Lipsum match at " + i + ".." + (i + len - 1)); + } +} diff --git a/deps/v8/test/mjsunit/string-lastindexof.js b/deps/v8/test/mjsunit/string-lastindexof.js new file mode 100644 index 0000000000..bf46666ee0 --- /dev/null +++ b/deps/v8/test/mjsunit/string-lastindexof.js @@ -0,0 +1,51 @@ +// Copyright 2008 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 s = "test test test"; + +assertEquals(5, s.lastIndexOf("test", 5)); +assertEquals(5, s.lastIndexOf("test", 6)); +assertEquals(0, s.lastIndexOf("test", 4)); +assertEquals(0, s.lastIndexOf("test", 0)); +assertEquals(-1, s.lastIndexOf("test", -1)); +assertEquals(10, s.lastIndexOf("test")); +assertEquals(-1, s.lastIndexOf("notpresent")); +assertEquals(-1, s.lastIndexOf()); +assertEquals(10, s.lastIndexOf("test", "not a number")); + +for (var i = s.length + 10; i >= 0; i--) { + var expected = i < s.length ? i : s.length; + assertEquals(expected, s.lastIndexOf("", i)); +} + + +var reString = "asdf[a-z]+(asdf)?"; + +assertEquals(4, reString.lastIndexOf("[a-z]+")); +assertEquals(10, reString.lastIndexOf("(asdf)?")); + +assertEquals(1, String.prototype.lastIndexOf.length); diff --git a/deps/v8/test/mjsunit/string-localecompare.js b/deps/v8/test/mjsunit/string-localecompare.js new file mode 100644 index 0000000000..90a1813336 --- /dev/null +++ b/deps/v8/test/mjsunit/string-localecompare.js @@ -0,0 +1,40 @@ +// Copyright 2008 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. + +// String.prototype.localeCompare. +// +// Implementation dependent function. For now, we do not do anything +// locale specific. + +// Equal prefix. +assertTrue("asdf".localeCompare("asdf") == 0); +assertTrue("asd".localeCompare("asdf") < 0); +assertTrue("asdff".localeCompare("asdf") > 0); + +// Chars differ. +assertTrue("asdf".localeCompare("asdq") < 0); +assertTrue("asdq".localeCompare("asdf") > 0); diff --git a/deps/v8/test/mjsunit/string-match.js b/deps/v8/test/mjsunit/string-match.js new file mode 100644 index 0000000000..202396d308 --- /dev/null +++ b/deps/v8/test/mjsunit/string-match.js @@ -0,0 +1,149 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/** + * @fileoverview Test String.prototype.match + */ + + +function testMatch(name, input, regexp, result, captures, from, to) { + var matchResult = input.match(regexp); + assertEquals(result, matchResult, name + "-match"); + + var match = input.substring(from, to); + var preMatch = input.substring(0, from); + var postMatch = input.substring(to); + var lastParen = captures.length > 0 ? captures[captures.length - 1] : ""; + + if (regexp.global) { + // Returns array of matched strings. + var lastMatch = matchResult[matchResult.length - 1]; + assertEquals(match, lastMatch, name + "-match-string_g"); + } else { + // Returns array of match and captures. + assertEquals(match, matchResult[0], name + "-match-string"); + assertEquals(captures.length + 1, matchResult.length, name + "-cap-return"); + for (var i = 1; i < matchResult.length; i++) { + assertEquals(captures[i - 1], matchResult[i], name + "-cap-return-" + i); + } + } + + assertEquals(match, RegExp["$&"], name + "-$&"); + assertEquals(match, RegExp.lastMatch, name + "-lastMatch"); + + assertEquals(undefined, RegExp.$0, name + "-nocapture-10"); + for (var i = 1; i <= 9; i++) { + if (i <= captures.length) { + assertEquals(captures[i - 1], RegExp["$" + i], name + "-capture-" + i); + } else { + assertEquals("", RegExp["$" + i], name + "-nocapture-" + i); + } + } + assertEquals(undefined, RegExp.$10, name + "-nocapture-10"); + + assertEquals(input, RegExp.input, name + "-input"); + assertEquals(input, RegExp.$input, name + "-$input"); + assertEquals(input, RegExp.$_, name + "-$_"); + + assertEquals(preMatch, RegExp["$`"], name + "-$`"); + assertEquals(preMatch, RegExp.leftContext, name + "-leftContex"); + + assertEquals(postMatch, RegExp["$'"], name + "-$'"); + assertEquals(postMatch, RegExp.rightContext, name + "-rightContex"); + + assertEquals(lastParen, RegExp["$+"], name + "-$+"); + assertEquals(lastParen, RegExp.lastParen, name + "-lastParen"); + +} + + +var stringSample = "A man, a plan, a canal: Panama"; +var stringSample2 = "Argle bargle glop glyf!"; +var stringSample3 = "abcdefghijxxxxxxxxxx"; + + +// Non-capturing, non-global regexp. + +var re_nog = /\w+/; + +testMatch("Nonglobal", stringSample, re_nog, + ["A"], + [], 0, 1); + + +re_nog.lastIndex = 2; + +testMatch("Nonglobal-ignore-lastIndex", stringSample, re_nog, + ["A"], + [], 0, 1); + + +// Capturing non-global regexp. + +var re_multicap = /(.)(.)(.)(.)(.)(.)(.)(.)(.)(.)/; +testMatch("Capture-Nonglobal", stringSample3, re_multicap, + ["abcdefghij", "a", "b", "c", "d", "e", "f", "g", "h", "i", "j"], + ["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"], 0, 10); + + +// Global regexp (also check that capture from before are cleared) + +var re = /\w+/g; +testMatch("Global", stringSample2, re, + ["Argle", "bargle", "glop", "glyf"], [], 18, 22); + +re.lastIndex = 10; + +testMatch("Global-ignore-lastIndex", stringSample2, re, + ["Argle", "bargle", "glop", "glyf"], [], 18, 22); + + +// Capturing global regexp + +var re_cap = /\w(\w*)/g; + +testMatch("Capture-Global", stringSample, re_cap, + ["A", "man", "a", "plan", "a", "canal", "Panama"], + ["anama"], 24, 30); + + +// Atom, non-global + +var re_atom = /an/; + +testMatch("Atom", stringSample, re_atom, + ["an"], + [], 3, 5); + + +// Atom, global + +var re_atomg = /an/g; + +testMatch("Global-Atom", stringSample, re_atomg, + ["an", "an", "an", "an"], + [], 25, 27); diff --git a/deps/v8/test/mjsunit/string-replace-gc.js b/deps/v8/test/mjsunit/string-replace-gc.js new file mode 100644 index 0000000000..26fba103b7 --- /dev/null +++ b/deps/v8/test/mjsunit/string-replace-gc.js @@ -0,0 +1,57 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Flags: --always-compact +// +// Regression test for the r1512 fix. + +var foo = "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"; + +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; +foo = foo + foo; + +foo.replace(/[b]/, "c"); // Flatten foo. + +var moving_string = "b" + "c"; + +var bar = foo.replace(/[a]/g, moving_string); + +print(bar.length); + diff --git a/deps/v8/test/mjsunit/string-replace.js b/deps/v8/test/mjsunit/string-replace.js new file mode 100644 index 0000000000..d72f73bc46 --- /dev/null +++ b/deps/v8/test/mjsunit/string-replace.js @@ -0,0 +1,182 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +/** + * @fileoverview Test String.prototype.replace + */ + +function replaceTest(result, subject, pattern, replacement) { + var name = + "\"" + subject + "\".replace(" + pattern + ", " + replacement + ")"; + assertEquals(result, subject.replace(pattern, replacement), name); +} + + +var short = "xaxbxcx"; + +replaceTest("axbxcx", short, "x", ""); +replaceTest("axbxcx", short, /x/, ""); +replaceTest("abc", short, /x/g, ""); + +replaceTest("xaxxcx", short, "b", ""); +replaceTest("xaxxcx", short, /b/, ""); +replaceTest("xaxxcx", short, /b/g, ""); + + +replaceTest("[]axbxcx", short, "x", "[]"); +replaceTest("[]axbxcx", short, /x/, "[]"); +replaceTest("[]a[]b[]c[]", short, /x/g, "[]"); + +replaceTest("xax[]xcx", short, "b", "[]"); +replaceTest("xax[]xcx", short, /b/, "[]"); +replaceTest("xax[]xcx", short, /b/g, "[]"); + + +replaceTest("[$]axbxcx", short, "x", "[$$]"); +replaceTest("[$]axbxcx", short, /x/, "[$$]"); +replaceTest("[$]a[$]b[$]c[$]", short, /x/g, "[$$]"); + +replaceTest("xax[$]xcx", short, "b", "[$$]"); +replaceTest("xax[$]xcx", short, /b/, "[$$]"); +replaceTest("xax[$]xcx", short, /b/g, "[$$]"); + + +replaceTest("[]axbxcx", short, "x", "[$`]"); +replaceTest("[]axbxcx", short, /x/, "[$`]"); +replaceTest("[]a[xa]b[xaxb]c[xaxbxc]", short, /x/g, "[$`]"); + +replaceTest("xax[xax]xcx", short, "b", "[$`]"); +replaceTest("xax[xax]xcx", short, /b/, "[$`]"); +replaceTest("xax[xax]xcx", short, /b/g, "[$`]"); + + +replaceTest("[x]axbxcx", short, "x", "[$&]"); +replaceTest("[x]axbxcx", short, /x/, "[$&]"); +replaceTest("[x]a[x]b[x]c[x]", short, /x/g, "[$&]"); + +replaceTest("xax[b]xcx", short, "b", "[$&]"); +replaceTest("xax[b]xcx", short, /b/, "[$&]"); +replaceTest("xax[b]xcx", short, /b/g, "[$&]"); + + +replaceTest("[axbxcx]axbxcx", short, "x", "[$']"); +replaceTest("[axbxcx]axbxcx", short, /x/, "[$']"); +replaceTest("[axbxcx]a[bxcx]b[cx]c[]", short, /x/g, "[$']"); + +replaceTest("xax[xcx]xcx", short, "b", "[$']"); +replaceTest("xax[xcx]xcx", short, /b/, "[$']"); +replaceTest("xax[xcx]xcx", short, /b/g, "[$']"); + + +replaceTest("[$1]axbxcx", short, "x", "[$1]"); +replaceTest("[$1]axbxcx", short, /x/, "[$1]"); +replaceTest("[]axbxcx", short, /x()/, "[$1]"); +replaceTest("[$1]a[$1]b[$1]c[$1]", short, /x/g, "[$1]"); +replaceTest("[]a[]b[]c[]", short, /x()/g, "[$1]"); + +replaceTest("xax[$1]xcx", short, "b", "[$1]"); +replaceTest("xax[$1]xcx", short, /b/, "[$1]"); +replaceTest("xax[]xcx", short, /b()/, "[$1]"); +replaceTest("xax[$1]xcx", short, /b/g, "[$1]"); +replaceTest("xax[]xcx", short, /b()/g, "[$1]"); + +// Bug 317 look-alikes. If "$e" has no meaning, the "$" must be retained. +replaceTest("xax$excx", short, "b", "$e"); +replaceTest("xax$excx", short, /b/, "$e"); +replaceTest("xax$excx", short, /b/g, "$e"); + +replaceTest("xaxe$xcx", short, "b", "e$"); +replaceTest("xaxe$xcx", short, /b/, "e$"); +replaceTest("xaxe$xcx", short, /b/g, "e$"); + + +replaceTest("[$$$1$$a1abb1bb0$002$3$03][$$$1$$b1bcc1cc0$002$3$03]c", + "abc", /(.)(?=(.))/g, "[$$$$$$1$$$$$11$01$2$21$02$020$002$3$03]"); + +// Replace with functions. + + +var ctr = 0; +replaceTest("0axbxcx", short, "x", function r(m, i, s) { + assertEquals(3, arguments.length, "replace('x',func) func-args"); + assertEquals("x", m, "replace('x',func(m,..))"); + assertEquals(0, i, "replace('x',func(..,i,..))"); + assertEquals(short, s, "replace('x',func(..,s))"); + return String(ctr++); +}); +assertEquals(1, ctr, "replace('x',func) num-match"); + +ctr = 0; +replaceTest("0axbxcx", short, /x/, function r(m, i, s) { + assertEquals(3, arguments.length, "replace(/x/,func) func-args"); + assertEquals("x", m, "replace(/x/,func(m,..))"); + assertEquals(0, i, "replace(/x/,func(..,i,..))"); + assertEquals(short, s, "replace(/x/,func(..,s))"); + return String(ctr++); +}); +assertEquals(1, ctr, "replace(/x/,func) num-match"); + +ctr = 0; +replaceTest("0a1b2c3", short, /x/g, function r(m, i, s) { + assertEquals(3, arguments.length, "replace(/x/g,func) func-args"); + assertEquals("x", m, "replace(/x/g,func(m,..))"); + assertEquals(ctr * 2, i, "replace(/x/g,func(..,i,.))"); + assertEquals(short, s, "replace(/x/g,func(..,s))"); + return String(ctr++); +}); +assertEquals(4, ctr, "replace(/x/g,func) num-match"); + +ctr = 0; +replaceTest("0a1b2cx", short, /(x)(?=(.))/g, function r(m, c1, c2, i, s) { + assertEquals(5, arguments.length, "replace(/(x)(?=(.))/g,func) func-args"); + assertEquals("x", m, "replace(/(x)(?=(.))/g,func(m,..))"); + assertEquals("x", c1, "replace(/(x)(?=(.))/g,func(..,c1,..))"); + assertEquals(["a","b","c"][ctr], c2, "replace(/(x)(?=(.))/g,func(..,c2,..))"); + assertEquals(ctr * 2, i, "replace(/(x)(?=(.))/g,func(..,i,..))"); + assertEquals(short, s, "replace(/(x)(?=(.))/g,func(..,s))"); + return String(ctr++); +}); +assertEquals(3, ctr, "replace(/x/g,func) num-match"); + + +// Test special cases of replacement parts longer than 1<<11. +var longstring = "xyzzy"; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +longstring = longstring + longstring; +// longstring.length == 5 << 11 + +replaceTest(longstring + longstring, + "<" + longstring + ">", /<(.*)>/g, "$1$1"); diff --git a/deps/v8/test/mjsunit/string-search.js b/deps/v8/test/mjsunit/string-search.js new file mode 100644 index 0000000000..36891c24cb --- /dev/null +++ b/deps/v8/test/mjsunit/string-search.js @@ -0,0 +1,30 @@ +// Copyright 2008 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="ABC abc"; +var r = str.search('a'); +assertEquals(r, 4); diff --git a/deps/v8/test/mjsunit/string-split.js b/deps/v8/test/mjsunit/string-split.js new file mode 100644 index 0000000000..59d3ad3ee3 --- /dev/null +++ b/deps/v8/test/mjsunit/string-split.js @@ -0,0 +1,126 @@ +// Copyright 2008 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. + +expected = ["A", undefined, "B", "bold", "/", "B", "and", undefined, "CODE", "coded", "/", "CODE", ""]; +result = "A<B>bold</B>and<CODE>coded</CODE>".split(/<(\/)?([^<>]+)>/); +assertArrayEquals(expected, result, 1); + +expected = ["a", "b"]; +result = "ab".split(/a*?/); +assertArrayEquals(expected, result, 2); + +expected = ["", "b"]; +result = "ab".split(/a*/); +assertArrayEquals(expected, result, 3); + +expected = ["a"]; +result = "ab".split(/a*?/, 1); +assertArrayEquals(expected, result, 4); + +expected = [""]; +result = "ab".split(/a*/, 1); +assertArrayEquals(expected, result, 5); + +expected = ["as","fas","fas","f"]; +result = "asdfasdfasdf".split("d"); +assertArrayEquals(expected, result, 6); + +expected = ["as","fas","fas","f"]; +result = "asdfasdfasdf".split("d", -1); +assertArrayEquals(expected, result, 7); + +expected = ["as", "fas"]; +result = "asdfasdfasdf".split("d", 2); +assertArrayEquals(expected, result, 8); + +expected = []; +result = "asdfasdfasdf".split("d", 0); +assertArrayEquals(expected, result, 9); + +expected = ["as","fas","fas",""]; +result = "asdfasdfasd".split("d"); +assertArrayEquals(expected, result, 10); + +expected = []; +result = "".split(""); +assertArrayEquals(expected, result, 11); + +expected = [""] +result = "".split("a"); +assertArrayEquals(expected, result, 12); + +expected = ["a","b"] +result = "axxb".split(/x*/); +assertArrayEquals(expected, result, 13); + +expected = ["a","b"] +result = "axxb".split(/x+/); +assertArrayEquals(expected, result, 14); + +expected = ["a","","b"] +result = "axxb".split(/x/); +assertArrayEquals(expected, result, 15); + +// This was http://b/issue?id=1151354 +expected = ["div", "#id", ".class"] +result = "div#id.class".split(/(?=[#.])/); +assertArrayEquals(expected, result, 16); + +expected = ["div", "#i", "d", ".class"] +result = "div#id.class".split(/(?=[d#.])/); +assertArrayEquals(expected, result, 17); + +expected = ["a", "b", "c"] +result = "abc".split(/(?=.)/); +assertArrayEquals(expected, result, 18); + +/* "ab".split(/((?=.))/) + * + * KJS: ,a,,b + * SM: a,,b, + * IE: a,b + * Opera: a,,b + * V8: a,,b + * + * Opera seems to have this right. The others make no sense. + */ +expected = ["a", "", "b"] +result = "ab".split(/((?=.))/); +assertArrayEquals(expected, result, 19); + +/* "ab".split(/(?=)/) + * + * KJS: a,b + * SM: ab + * IE: a,b + * Opera: a,b + * V8: a,b + */ +expected = ["a", "b"] +result = "ab".split(/(?=)/); +assertArrayEquals(expected, result, 20); + diff --git a/deps/v8/test/mjsunit/substr.js b/deps/v8/test/mjsunit/substr.js new file mode 100644 index 0000000000..8c276f9418 --- /dev/null +++ b/deps/v8/test/mjsunit/substr.js @@ -0,0 +1,65 @@ +// Copyright 2008 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 s = 'abcdefghijklmn'; +assertEquals(s, s.substr()); +assertEquals(s, s.substr(0)); +assertEquals(s, s.substr('0')); +assertEquals(s, s.substr(void 0)); +assertEquals(s, s.substr(null)); +assertEquals(s, s.substr(false)); +assertEquals(s, s.substr(0.9)); +assertEquals(s, s.substr({ valueOf: function() { return 0; } })); +assertEquals(s, s.substr({ toString: function() { return '0'; } })); + +var s1 = s.substring(1); +assertEquals(s1, s.substr(1)); +assertEquals(s1, s.substr('1')); +assertEquals(s1, s.substr(true)); +assertEquals(s1, s.substr(1.1)); +assertEquals(s1, s.substr({ valueOf: function() { return 1; } })); +assertEquals(s1, s.substr({ toString: function() { return '1'; } })); + +for (var i = 0; i < s.length; i++) + for (var j = i; j < s.length + 5; j++) + assertEquals(s.substring(i, j), s.substr(i, j - i)); + +assertEquals(s.substring(s.length - 1), s.substr(-1)); +assertEquals(s.substring(s.length - 1), s.substr(-1.2)); +assertEquals(s.substring(s.length - 1), s.substr(-1.7)); +assertEquals(s.substring(s.length - 2), s.substr(-2)); +assertEquals(s.substring(s.length - 2), s.substr(-2.3)); +assertEquals(s.substring(s.length - 2, s.length - 1), s.substr(-2, 1)); +assertEquals(s, s.substr(-100)); +assertEquals('abc', s.substr(-100, 3)); +assertEquals(s1, s.substr(-s.length + 1)); + +// assertEquals('', s.substr(0, void 0)); // smjs and rhino +assertEquals('abcdefghijklmn', s.substr(0, void 0)); // kjs and v8 +assertEquals('', s.substr(0, null)); +assertEquals(s, s.substr(0, String(s.length))); +assertEquals('a', s.substr(0, true)); diff --git a/deps/v8/test/mjsunit/switch.js b/deps/v8/test/mjsunit/switch.js new file mode 100644 index 0000000000..4044490a1f --- /dev/null +++ b/deps/v8/test/mjsunit/switch.js @@ -0,0 +1,289 @@ +// Copyright 2008 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 f0() { + switch (0) { + // switch deliberately left empty + } +} + +f0(); // no errors + +function f1(x) { + switch (x) { + default: return "f1"; + } + return "foo"; +} + +assertEquals("f1", f1(0), "default-switch.0"); +assertEquals("f1", f1(1), "default-switch.1"); + +function f2(x) { + var r; + switch (x) { + case 0: + r = "zero"; + break; + case 1: + r = "one"; + break; + case 2: + r = "two"; + break; + case 3: + r = "three"; + break; + default: + r = "default"; + } + return r; +} + +assertEquals("zero", f2(0), "0-1-switch.0"); +assertEquals("one", f2(1), "0-1-switch.1"); +assertEquals("default", f2(7), "0-1-switch.2"); +assertEquals("default", f2(-1), "0-1-switch.-1"); +assertEquals("default", f2(NaN), "0-1-switch.NaN"); +assertEquals("default", f2(Math.pow(2,34)), "0-1-switch.largeNum"); +assertEquals("default", f2("0"), "0-1-switch.string"); +assertEquals("default", f2(false), "0-1-switch.bool"); +assertEquals("default", f2(null), "0-1-switch.null"); +assertEquals("default", f2(undefined), "0-1-switch.undef"); +assertEquals("default", f2(new Number(2)), "0-1-switch.undef"); +assertEquals("default", f2({valueOf: function(){return 2; }}), "0-1-switch.obj"); + + +function f3(x, c) { + var r = 0; + switch (x) { + default: + r = "default"; + break; + case c: + r = "value is c = " + c; + break; + case 2: + r = "two"; + break; + case -5: + r = "minus 5"; + break; + case 9: + r = "nine"; + break; + } + return r; +} + +assertEquals("two", f3(2,0), "value-switch.2-0"); +assertEquals("minus 5", f3(-5,0), "value-switch.-5-0"); +assertEquals("nine", f3(9,0), "value-switch.9-0"); +assertEquals("value is c = 0", f3(0,0), "value-switch.0-0"); +assertEquals("value is c = 2", f3(2,2), "value-switch.2-2"); +assertEquals("default", f3(7,0), "value-switch.7-0"); + + +function f4(x) { + switch(x) { + case 0: + x++; + default: + x++; + case 2: + x++; + } + return x; +} + + +assertEquals(3, f4(0), "fallthrough-switch.0"); +assertEquals(3, f4(1), "fallthrough-switch.1"); +assertEquals(3, f4(2), "fallthrough-switch.2"); +assertEquals(5, f4(3), "fallthrough-switch.3"); + + +function f5(x) { + switch(x) { + case -2: return true; + case -1: return false; + case 0: return true; + case 2: return false; + default: return 42; + } +} + +assertTrue(f5(-2), "negcase.-2"); +assertFalse(f5(-1), "negcase.-1"); +assertTrue(f5(0), "negcase.-0"); +assertEquals(42, f5(1), "negcase.1"); +assertFalse(f5(2), "negcase.2"); + +function f6(N) { + // long enough case that code buffer grows during code-generation + var res = 0; + for(var i = 0; i < N; i++) { + switch(i & 0x3f) { + case 0: res += 0; break; + case 1: res += 1; break; + case 2: res += 2; break; + case 3: res += 3; break; + case 4: res += 4; break; + case 5: res += 5; break; + case 6: res += 6; break; + case 7: res += 7; break; + case 8: res += 8; break; + case 9: res += 9; break; + case 10: res += 10; break; + case 11: res += 11; break; + case 12: res += 12; break; + case 13: res += 13; break; + case 14: res += 14; break; + case 15: res += 15; break; + case 16: res += 16; break; + case 17: res += 17; break; + case 18: res += 18; break; + case 19: res += 19; break; + case 20: res += 20; break; + case 21: res += 21; break; + case 22: res += 22; break; + case 23: res += 23; break; + case 24: res += 24; break; + case 25: res += 25; break; + case 26: res += 26; break; + case 27: res += 27; break; + case 28: res += 28; break; + case 29: res += 29; break; + case 30: res += 30; break; + case 31: res += 31; break; + case 32: res += 32; break; + case 33: res += 33; break; + case 34: res += 34; break; + case 35: res += 35; break; + case 36: res += 36; break; + case 37: res += 37; break; + case 38: res += 38; break; + case 39: res += 39; break; + case 40: res += 40; break; + case 41: res += 41; break; + case 42: res += 42; break; + case 43: res += 43; break; + case 44: res += 44; break; + case 45: res += 45; break; + case 46: res += 46; break; + case 47: res += 47; break; + case 48: res += 48; break; + case 49: res += 49; break; + case 50: res += 50; break; + case 51: res += 51; break; + case 52: res += 52; break; + case 53: res += 53; break; + case 54: res += 54; break; + case 55: res += 55; break; + case 56: res += 56; break; + case 57: res += 57; break; + case 58: res += 58; break; + case 59: res += 59; break; + case 60: res += 60; break; + case 61: res += 61; break; + case 62: res += 62; break; + case 63: res += 63; break; + case 64: break; + default: break; + } + } + return res; +} + +assertEquals(190, f6(20), "largeSwitch.20"); +assertEquals(2016, f6(64), "largeSwitch.64"); +assertEquals(4032, f6(128), "largeSwitch.128"); +assertEquals(4222, f6(148), "largeSwitch.148"); + + +function f7(value) { + switch (value) { + case 0: return "0"; + case -0: return "-0"; + case 1: case 2: case 3: case 4: // Dummy fillers. + } + switch (value) { + case 0x3fffffff: return "MaxSmi"; + case 0x3ffffffe: + case 0x3ffffffd: + case 0x3ffffffc: + case 0x3ffffffb: + case 0x3ffffffa: // Dummy fillers + } + switch (value) { + case -0x40000000: return "MinSmi"; + case -0x3fffffff: + case -0x3ffffffe: + case -0x3ffffffd: + case -0x3ffffffc: + case -0x3ffffffb: // Dummy fillers + } + switch (value) { + case 10: return "A"; + case 11: + case 12: + case 13: + case 14: + case 15: // Dummy fillers + } + return "default"; +} + + +assertEquals("default", f7(0.1), "0-1-switch.double-0.1"); +assertEquals("0", f7(-0), "0-1-switch.double-neg0"); +assertEquals("MaxSmi", f7((1<<30)-1), "0-1-switch.maxsmi"); +assertEquals("MinSmi", f7(-(1<<30)), "0-1-switch.minsmi"); +assertEquals("default", f7(1<<30), "0-1-switch.maxsmi++"); +assertEquals("default", f7(-(1<<30)-1), "0-1-switch.minsmi--"); +assertEquals("A", f7((170/16)-(170%16/16)), "0-1-switch.heapnum"); + + +function makeVeryLong(length) { + var res = "function() {\n" + + " var res = 0;\n" + + " for (var i = 0; i <= " + length + "; i++) {\n" + + " switch(i) {\n"; + for (var i = 0; i < length; i++) { + res += " case " + i + ": res += 2; break;\n"; + } + res += " default: res += 1;\n" + + " }\n" + + " }\n" + + " return res;\n" + + "}"; + return eval(res); +} +var verylong_size = 1000; +var verylong = makeVeryLong(verylong_size); + +assertEquals(verylong_size * 2 + 1, verylong()); diff --git a/deps/v8/test/mjsunit/testcfg.py b/deps/v8/test/mjsunit/testcfg.py new file mode 100644 index 0000000000..9c7e028078 --- /dev/null +++ b/deps/v8/test/mjsunit/testcfg.py @@ -0,0 +1,106 @@ +# Copyright 2008 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. + +import test +import os +from os.path import join, dirname, exists +import re + + +FLAGS_PATTERN = re.compile(r"//\s+Flags:(.*)") +FILES_PATTERN = re.compile(r"//\s+Files:(.*)") + + +class MjsunitTestCase(test.TestCase): + + def __init__(self, path, file, mode, context, config): + super(MjsunitTestCase, self).__init__(context, path) + self.file = file + self.config = config + self.mode = mode + + def GetLabel(self): + return "%s %s" % (self.mode, self.GetName()) + + def GetName(self): + return self.path[-1] + + def GetCommand(self): + result = [self.config.context.GetVm(self.mode)] + source = open(self.file).read() + flags_match = FLAGS_PATTERN.search(source) + if flags_match: + result += flags_match.group(1).strip().split() + files_match = FILES_PATTERN.search(source); + additional_files = [] + if files_match: + additional_files += files_match.group(1).strip().split() + for a_file in additional_files: + result.append(join(dirname(self.config.root), '..', a_file)) + framework = join(dirname(self.config.root), 'mjsunit', 'mjsunit.js') + result += [framework, self.file] + return result + + def GetSource(self): + return open(self.file).read() + + +class MjsunitTestConfiguration(test.TestConfiguration): + + def __init__(self, context, root): + super(MjsunitTestConfiguration, self).__init__(context, root) + + def Ls(self, path): + def SelectTest(name): + return name.endswith('.js') and name != 'mjsunit.js' + return [f[:-3] for f in os.listdir(path) if SelectTest(f)] + + def ListTests(self, current_path, path, mode): + mjsunit = [current_path + [t] for t in self.Ls(self.root)] + regress = [current_path + ['regress', t] for t in self.Ls(join(self.root, 'regress'))] + bugs = [current_path + ['bugs', t] for t in self.Ls(join(self.root, 'bugs'))] + tools = [current_path + ['tools', t] for t in self.Ls(join(self.root, 'tools'))] + all_tests = mjsunit + regress + bugs + tools + result = [] + for test in all_tests: + if self.Contains(path, test): + file_path = join(self.root, reduce(join, test[1:], "") + ".js") + result.append(MjsunitTestCase(test, file_path, mode, self.context, self)) + return result + + def GetBuildRequirements(self): + return ['sample', 'sample=shell'] + + def GetTestStatus(self, sections, defs): + status_file = join(self.root, 'mjsunit.status') + if exists(status_file): + test.ReadConfigurationInto(status_file, sections, defs) + + + +def GetConfiguration(context, root): + return MjsunitTestConfiguration(context, root) diff --git a/deps/v8/test/mjsunit/this-in-callbacks.js b/deps/v8/test/mjsunit/this-in-callbacks.js new file mode 100644 index 0000000000..d50be6c193 --- /dev/null +++ b/deps/v8/test/mjsunit/this-in-callbacks.js @@ -0,0 +1,47 @@ +// Copyright 2008 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 'this' is the right global object of callback functions passed to +// builtin functions. +// See bug 1231592 + +var my_identity = 'id'; +// test Array.sort +function cp(x, y) { + assertEquals('id', this.my_identity); + return 0; +} + +[1, 2].sort(cp); + +// test String.replace +function r(x) { + return this.my_identity; +} + +assertEquals('id', 'hello'.replace('hello', r)); +assertEquals('id', 'hello'.replace(/hello/, r)); diff --git a/deps/v8/test/mjsunit/this.js b/deps/v8/test/mjsunit/this.js new file mode 100644 index 0000000000..890dea4f25 --- /dev/null +++ b/deps/v8/test/mjsunit/this.js @@ -0,0 +1,46 @@ +// Copyright 2008 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 f() { return this; } + +assertFalse(this == null); // the global object shouldn't be null or undefined +assertEquals('[object global]', String(this)); + +assertTrue(this === this); +assertTrue(this === (function() { return this; })()); +assertTrue(this === f()); + +var x = {}, y = {}; +x.f = y.f = f; +assertFalse(x === f()); +assertFalse(y === f()); +assertTrue(x === x.f()); +assertTrue(x === x[new String('f')]()); +assertTrue(y === y.f(), "y.f()"); +assertTrue(y === y[new String('f')]()); +assertFalse(x === y.f()); +assertFalse(y === x.f()); diff --git a/deps/v8/test/mjsunit/throw-and-catch-function.js b/deps/v8/test/mjsunit/throw-and-catch-function.js new file mode 100644 index 0000000000..fd24f6e665 --- /dev/null +++ b/deps/v8/test/mjsunit/throw-and-catch-function.js @@ -0,0 +1,50 @@ +// Copyright 2008 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 g = this; +var x = new Object(); +x.e = function() { return this; }; +try { + throw x.e; +} catch (e) { + assertTrue(e() === g); +} +try { + throw x.e; +} catch (e) { + with(x) { assertTrue(e() === x); } +} +with(x) { + try { throw e; } catch (e) { assertTrue(e() === g); } +} +var e = 0; +try { + throw x.e; +} catch (e) { + var e = 7; +} +assertEquals(0, e); diff --git a/deps/v8/test/mjsunit/throw-exception-for-null-access.js b/deps/v8/test/mjsunit/throw-exception-for-null-access.js new file mode 100644 index 0000000000..018cfef9ec --- /dev/null +++ b/deps/v8/test/mjsunit/throw-exception-for-null-access.js @@ -0,0 +1,37 @@ +// Copyright 2008 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. + +// Must throw TypeError when accessing properties of null. +var caught = false +try { + null[0]; + assertTrue(false); +} catch (e) { + caught = true; + assertTrue(e instanceof TypeError); +} +assertTrue(caught); diff --git a/deps/v8/test/mjsunit/to-precision.js b/deps/v8/test/mjsunit/to-precision.js new file mode 100644 index 0000000000..04c7d7614e --- /dev/null +++ b/deps/v8/test/mjsunit/to-precision.js @@ -0,0 +1,82 @@ +// Copyright 2008 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 the exponential notation output. +assertEquals("1e+27", (1.2345e+27).toPrecision(1)); +assertEquals("1.2e+27", (1.2345e+27).toPrecision(2)); +assertEquals("1.23e+27", (1.2345e+27).toPrecision(3)); +assertEquals("1.234e+27", (1.2345e+27).toPrecision(4)); +assertEquals("1.2345e+27", (1.2345e+27).toPrecision(5)); +assertEquals("1.23450e+27", (1.2345e+27).toPrecision(6)); +assertEquals("1.234500e+27", (1.2345e+27).toPrecision(7)); + +assertEquals("-1e+27", (-1.2345e+27).toPrecision(1)); +assertEquals("-1.2e+27", (-1.2345e+27).toPrecision(2)); +assertEquals("-1.23e+27", (-1.2345e+27).toPrecision(3)); +assertEquals("-1.234e+27", (-1.2345e+27).toPrecision(4)); +assertEquals("-1.2345e+27", (-1.2345e+27).toPrecision(5)); +assertEquals("-1.23450e+27", (-1.2345e+27).toPrecision(6)); +assertEquals("-1.234500e+27", (-1.2345e+27).toPrecision(7)); + + +// Test the fixed notation output. +assertEquals("7", (7).toPrecision(1)); +assertEquals("7.0", (7).toPrecision(2)); +assertEquals("7.00", (7).toPrecision(3)); + +assertEquals("-7", (-7).toPrecision(1)); +assertEquals("-7.0", (-7).toPrecision(2)); +assertEquals("-7.00", (-7).toPrecision(3)); + +assertEquals("9e+1", (91).toPrecision(1)); +assertEquals("91", (91).toPrecision(2)); +assertEquals("91.0", (91).toPrecision(3)); +assertEquals("91.00", (91).toPrecision(4)); + +assertEquals("-9e+1", (-91).toPrecision(1)); +assertEquals("-91", (-91).toPrecision(2)); +assertEquals("-91.0", (-91).toPrecision(3)); +assertEquals("-91.00", (-91).toPrecision(4)); + +assertEquals("9e+1", (91.1234).toPrecision(1)); +assertEquals("91", (91.1234).toPrecision(2)); +assertEquals("91.1", (91.1234).toPrecision(3)); +assertEquals("91.12", (91.1234).toPrecision(4)); +assertEquals("91.123", (91.1234).toPrecision(5)); +assertEquals("91.1234", (91.1234).toPrecision(6)); +assertEquals("91.12340", (91.1234).toPrecision(7)); +assertEquals("91.123400", (91.1234).toPrecision(8)); + +assertEquals("-9e+1", (-91.1234).toPrecision(1)); +assertEquals("-91", (-91.1234).toPrecision(2)); +assertEquals("-91.1", (-91.1234).toPrecision(3)); +assertEquals("-91.12", (-91.1234).toPrecision(4)); +assertEquals("-91.123", (-91.1234).toPrecision(5)); +assertEquals("-91.1234", (-91.1234).toPrecision(6)); +assertEquals("-91.12340", (-91.1234).toPrecision(7)); +assertEquals("-91.123400", (-91.1234).toPrecision(8)); + diff --git a/deps/v8/test/mjsunit/tobool.js b/deps/v8/test/mjsunit/tobool.js new file mode 100644 index 0000000000..65bffb624f --- /dev/null +++ b/deps/v8/test/mjsunit/tobool.js @@ -0,0 +1,36 @@ +// Copyright 2008 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. + +// All objects, including wrappers, must convert to true. +assertTrue(!!new Boolean(true), "new Boolean(true)"); +assertTrue(!!new Boolean(false), "new Boolean(false)"); + +assertTrue(!!new Number(-1), "new Number(-1)"); +assertTrue(!!new Number(0), "new Number(0)"); +assertTrue(!!new Number(1), "new Number(1)"); + + diff --git a/deps/v8/test/mjsunit/toint32.js b/deps/v8/test/mjsunit/toint32.js new file mode 100644 index 0000000000..a5582956bf --- /dev/null +++ b/deps/v8/test/mjsunit/toint32.js @@ -0,0 +1,129 @@ +// Copyright 2008 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 toInt32(x) { + return x | 0; +} + +assertEquals(0, toInt32(Infinity)); +assertEquals(0, toInt32(-Infinity)); +assertEquals(0, toInt32(NaN)); +assertEquals(0, toInt32(0.0)); +assertEquals(0, toInt32(-0.0)); + +assertEquals(0, toInt32(Number.MIN_VALUE)); +assertEquals(0, toInt32(-Number.MIN_VALUE)); +assertEquals(0, toInt32(0.1)); +assertEquals(0, toInt32(-0.1)); +assertEquals(1, toInt32(1)); +assertEquals(1, toInt32(1.1)); +assertEquals(-1, toInt32(-1)); +assertEquals(0, toInt32(0.6), "truncate positive (0.6)"); +assertEquals(1, toInt32(1.6), "truncate positive (1.6)"); +assertEquals(0, toInt32(-0.6), "truncate negative (-0.6)"); +assertEquals(-1, toInt32(-1.6), "truncate negative (-1.6)"); + +assertEquals(2147483647, toInt32(2147483647)); +assertEquals(-2147483648, toInt32(2147483648)); +assertEquals(-2147483647, toInt32(2147483649)); + +assertEquals(-1, toInt32(4294967295)); +assertEquals(0, toInt32(4294967296)); +assertEquals(1, toInt32(4294967297)); + +assertEquals(-2147483647, toInt32(-2147483647)); +assertEquals(-2147483648, toInt32(-2147483648)); +assertEquals(2147483647, toInt32(-2147483649)); + +assertEquals(1, toInt32(-4294967295)); +assertEquals(0, toInt32(-4294967296)); +assertEquals(-1, toInt32(-4294967297)); + +assertEquals(-2147483648, toInt32(2147483648.25)); +assertEquals(-2147483648, toInt32(2147483648.5)); +assertEquals(-2147483648, toInt32(2147483648.75)); +assertEquals(-1, toInt32(4294967295.25)); +assertEquals(-1, toInt32(4294967295.5)); +assertEquals(-1, toInt32(4294967295.75)); +assertEquals(-1294967296, toInt32(3000000000.25)); +assertEquals(-1294967296, toInt32(3000000000.5)); +assertEquals(-1294967296, toInt32(3000000000.75)); + +assertEquals(-2147483648, toInt32(-2147483648.25)); +assertEquals(-2147483648, toInt32(-2147483648.5)); +assertEquals(-2147483648, toInt32(-2147483648.75)); +assertEquals(1, toInt32(-4294967295.25)); +assertEquals(1, toInt32(-4294967295.5)); +assertEquals(1, toInt32(-4294967295.75)); +assertEquals(1294967296, toInt32(-3000000000.25)); +assertEquals(1294967296, toInt32(-3000000000.5)); +assertEquals(1294967296, toInt32(-3000000000.75)); + +var base = Math.pow(2, 64); +assertEquals(0, toInt32(base + 0)); +assertEquals(0, toInt32(base + 1117)); +assertEquals(4096, toInt32(base + 2234)); +assertEquals(4096, toInt32(base + 3351)); +assertEquals(4096, toInt32(base + 4468)); +assertEquals(4096, toInt32(base + 5585)); +assertEquals(8192, toInt32(base + 6702)); +assertEquals(8192, toInt32(base + 7819)); +assertEquals(8192, toInt32(base + 8936)); +assertEquals(8192, toInt32(base + 10053)); +assertEquals(12288, toInt32(base + 11170)); +assertEquals(12288, toInt32(base + 12287)); +assertEquals(12288, toInt32(base + 13404)); +assertEquals(16384, toInt32(base + 14521)); +assertEquals(16384, toInt32(base + 15638)); +assertEquals(16384, toInt32(base + 16755)); +assertEquals(16384, toInt32(base + 17872)); +assertEquals(20480, toInt32(base + 18989)); +assertEquals(20480, toInt32(base + 20106)); +assertEquals(20480, toInt32(base + 21223)); +assertEquals(20480, toInt32(base + 22340)); +assertEquals(24576, toInt32(base + 23457)); +assertEquals(24576, toInt32(base + 24574)); +assertEquals(24576, toInt32(base + 25691)); +assertEquals(28672, toInt32(base + 26808)); +assertEquals(28672, toInt32(base + 27925)); +assertEquals(28672, toInt32(base + 29042)); +assertEquals(28672, toInt32(base + 30159)); +assertEquals(32768, toInt32(base + 31276)); + +// bignum is (2^53 - 1) * 2^31 - highest number with bit 31 set. +var bignum = Math.pow(2, 84) - Math.pow(2, 31); +assertEquals(-Math.pow(2,31), toInt32(bignum)); +assertEquals(-Math.pow(2,31), toInt32(-bignum)); +assertEquals(0, toInt32(2 * bignum)); +assertEquals(0, toInt32(-(2 * bignum))); +assertEquals(0, toInt32(bignum - Math.pow(2,31))); +assertEquals(0, toInt32(-(bignum - Math.pow(2,31)))); + +// max_fraction is largest number below 1. +var max_fraction = (1 - Math.pow(2,-53)); +assertEquals(0, toInt32(max_fraction)); +assertEquals(0, toInt32(-max_fraction)); diff --git a/deps/v8/test/mjsunit/tools/splaytree.js b/deps/v8/test/mjsunit/tools/splaytree.js new file mode 100644 index 0000000000..3beba0b9f2 --- /dev/null +++ b/deps/v8/test/mjsunit/tools/splaytree.js @@ -0,0 +1,166 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Load the Splay tree implementation from <project root>/tools. +// Files: tools/splaytree.js + + +(function testIsEmpty() { + var tree = new goog.structs.SplayTree(); + assertTrue(tree.isEmpty()); + tree.insert(0, 'value'); + assertFalse(tree.isEmpty()); +})(); + + +(function testExportValues() { + var tree = new goog.structs.SplayTree(); + assertArrayEquals([], tree.exportValues()); + tree.insert(0, 'value'); + assertArrayEquals(['value'], tree.exportValues()); + tree.insert(0, 'value'); + assertArrayEquals(['value'], tree.exportValues()); +})(); + + +function createSampleTree() { + // Creates the following tree: + // 50 + // / \ + // 30 60 + // / \ \ + // 10 40 90 + // \ / \ + // 20 70 100 + // / \ + // 15 80 + // + // We can't use the 'insert' method because it also uses 'splay_'. + return { key: 50, value: 50, + left: { key: 30, value: 30, + left: { key: 10, value: 10, left: null, + right: { key: 20, value: 20, + left: { key: 15, value: 15, + left: null, right: null }, + right: null } }, + right: { key: 40, value: 40, left: null, right: null } }, + right: { key: 60, value: 60, left: null, + right: { key: 90, value: 90, + left: { key: 70, value: 70, left: null, + right: { key: 80, value: 80, + left: null, right: null } }, + right: { key: 100, value: 100, + left: null, right: null } } } }; +}; + + +(function testSplay() { + var tree = new goog.structs.SplayTree(); + tree.root_ = createSampleTree(); + assertArrayEquals(['50', '30', '60', '10', '40', '90', '20', '70', '100', '15', '80'], + tree.exportValues()); + tree.splay_(50); + assertArrayEquals(['50', '30', '60', '10', '40', '90', '20', '70', '100', '15', '80'], + tree.exportValues()); + tree.splay_(80); + assertArrayEquals(['80', '60', '90', '50', '70', '100', '30', '10', '40', '20', '15'], + tree.exportValues()); +})(); + + +(function testInsert() { + var tree = new goog.structs.SplayTree(); + tree.insert(5, 'root'); + tree.insert(3, 'left'); + assertArrayEquals(['left', 'root'], tree.exportValues()); + tree.insert(7, 'right'); + assertArrayEquals(['right', 'root', 'left'], tree.exportValues()); +})(); + + +(function testFind() { + var tree = new goog.structs.SplayTree(); + tree.insert(5, 'root'); + tree.insert(3, 'left'); + tree.insert(7, 'right'); + assertEquals('root', tree.find(5).value); + assertEquals('left', tree.find(3).value); + assertEquals('right', tree.find(7).value); + assertEquals(null, tree.find(0)); + assertEquals(null, tree.find(100)); + assertEquals(null, tree.find(-100)); +})(); + + +(function testFindMin() { + var tree = new goog.structs.SplayTree(); + assertEquals(null, tree.findMin()); + tree.insert(5, 'root'); + tree.insert(3, 'left'); + tree.insert(7, 'right'); + assertEquals('left', tree.findMin().value); +})(); + + +(function testFindMax() { + var tree = new goog.structs.SplayTree(); + assertEquals(null, tree.findMax()); + tree.insert(5, 'root'); + tree.insert(3, 'left'); + tree.insert(7, 'right'); + assertEquals('right', tree.findMax().value); +})(); + + +(function testFindGreatestLessThan() { + var tree = new goog.structs.SplayTree(); + assertEquals(null, tree.findGreatestLessThan(10)); + tree.insert(5, 'root'); + tree.insert(3, 'left'); + tree.insert(7, 'right'); + assertEquals('right', tree.findGreatestLessThan(10).value); + assertEquals('right', tree.findGreatestLessThan(7).value); + assertEquals('root', tree.findGreatestLessThan(6).value); + assertEquals('left', tree.findGreatestLessThan(4).value); + assertEquals(null, tree.findGreatestLessThan(2)); +})(); + + +(function testRemove() { + var tree = new goog.structs.SplayTree(); + assertThrows('tree.remove(5)'); + tree.insert(5, 'root'); + tree.insert(3, 'left'); + tree.insert(7, 'right'); + assertThrows('tree.remove(1)'); + assertThrows('tree.remove(6)'); + assertThrows('tree.remove(10)'); + assertEquals('root', tree.remove(5).value); + assertEquals('left', tree.remove(3).value); + assertEquals('right', tree.remove(7).value); + assertArrayEquals([], tree.exportValues()); +})(); diff --git a/deps/v8/test/mjsunit/top-level-assignments.js b/deps/v8/test/mjsunit/top-level-assignments.js new file mode 100644 index 0000000000..7acc9c114c --- /dev/null +++ b/deps/v8/test/mjsunit/top-level-assignments.js @@ -0,0 +1,107 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Testing that optimization of top-level object initialization doesn't +// break V8. + +var x = new Object(); +x.a = 7; +x.b = function() { return 42; }; +x.c = 88; +x.d = "A Man Called Horse"; + +assertEquals(7, x.a); +assertEquals(42, x.b()); +assertEquals(88, x.c); +assertEquals("A Man Called Horse", x.d); + +var y = new Object(); +y.a = 7; +y.b = function() { return 42; }; +y.c = 12 * y.a; +y.d = "A Man Called Horse"; + +assertEquals(84, y.c); + +var z = new Object(); +z.a = 3; +function forty_two() { return 42; }; +z.a += 4; +z.b = forty_two; +z.c = 12; +z.c *= z.a; +z.d = "A Man Called Horse"; + +assertEquals(84, z.c); + +var x1 = new Object(); +var x2 = new Object(); +x1.a = 7; +x1.b = function() { return 42; }; +x2.a = 7; +x2.b = function() { return 42; }; +x1.c = 88; +x1.d = "A Man Called Horse"; +x2.c = 88; +x2.d = "A Man Called Horse"; + +assertEquals(7, x1.a); +assertEquals(42, x1.b()); +assertEquals(88, x1.c); +assertEquals("A Man Called Horse", x1.d); + +assertEquals(7, x2.a); +assertEquals(42, x2.b()); +assertEquals(88, x2.c); +assertEquals("A Man Called Horse", x2.d); + +function Calculator(x, y) { + this.x = x; + this.y = y; +} + +Calculator.prototype.sum = function() { return this.x + this.y; }; +Calculator.prototype.difference = function() { return this.x - this.y; }; +Calculator.prototype.product = function() { return this.x * this.y; }; +Calculator.prototype.quotient = function() { return this.x / this.y; }; + +var calc = new Calculator(20, 10); +assertEquals(30, calc.sum()); +assertEquals(10, calc.difference()); +assertEquals(200, calc.product()); +assertEquals(2, calc.quotient()); + +var x = new Object(); +x.__defineGetter__('a', function() { return 7 }); +x.b = function() { return 42; }; +x.c = 88; +x.d = "A Man Called Horse"; + +assertEquals(7, x.a); +assertEquals(42, x.b()); +assertEquals(88, x.c); +assertEquals("A Man Called Horse", x.d); diff --git a/deps/v8/test/mjsunit/touint32.js b/deps/v8/test/mjsunit/touint32.js new file mode 100644 index 0000000000..f06bddfcf5 --- /dev/null +++ b/deps/v8/test/mjsunit/touint32.js @@ -0,0 +1,72 @@ +// Copyright 2008 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 ToUInt32(x) { + return x >>> 0; +} + +assertEquals(0, ToUInt32(0), "0"); +assertEquals(0, ToUInt32(-0), "-0"); +assertEquals(0, ToUInt32(Infinity), "Infinity"); +assertEquals(0, ToUInt32(-Infinity), "-Infinity"); +assertEquals(0, ToUInt32(NaN), "NaN"); + +assertEquals(0, ToUInt32(Number.MIN_VALUE), "MIN"); +assertEquals(0, ToUInt32(-Number.MIN_VALUE), "-MIN"); +assertEquals(0, ToUInt32(0.1), "0.1"); +assertEquals(0, ToUInt32(-0.1), "-0.1"); +assertEquals(1, ToUInt32(1), "1"); +assertEquals(1, ToUInt32(1.1), "1.1"); + +assertEquals(4294967295, ToUInt32(-1), "-1"); +assertEquals(4294967295, ToUInt32(-1.1), "-1.1"); + +assertEquals(2147483647, ToUInt32(2147483647), "2147483647"); +assertEquals(2147483648, ToUInt32(2147483648), "2147483648"); +assertEquals(2147483649, ToUInt32(2147483649), "2147483649"); + +assertEquals(4294967295, ToUInt32(4294967295), "4294967295"); +assertEquals(0, ToUInt32(4294967296), "4294967296"); +assertEquals(1, ToUInt32(4294967297), "4294967297"); + +assertEquals(2147483649, ToUInt32(-2147483647), "-2147483647"); +assertEquals(2147483648, ToUInt32(-2147483648), "-2147483648"); +assertEquals(2147483647, ToUInt32(-2147483649), "-2147483649"); + +assertEquals(1, ToUInt32(-4294967295), "-4294967295"); +assertEquals(0, ToUInt32(-4294967296), "-4294967296"); +assertEquals(4294967295, ToUInt32(-4294967297), "-4294967297"); + +assertEquals(2147483647, ToUInt32('2147483647'), "'2147483647'"); +assertEquals(2147483648, ToUInt32('2147483648'), "'2147483648'"); +assertEquals(2147483649, ToUInt32('2147483649'), "'2147483649'"); + +assertEquals(4294967295, ToUInt32('4294967295'), "'4294967295'"); +assertEquals(0, ToUInt32('4294967296'), "'4294967296'"); +assertEquals(1, ToUInt32('4294967297'), "'4294967297'"); + + diff --git a/deps/v8/test/mjsunit/try-catch-extension-object.js b/deps/v8/test/mjsunit/try-catch-extension-object.js new file mode 100644 index 0000000000..efab821663 --- /dev/null +++ b/deps/v8/test/mjsunit/try-catch-extension-object.js @@ -0,0 +1,58 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Try catch scopes should be implemented with special extension +// objects so that __proto__ accessors and accessor setters in the +// Object prototype have no effect. + +var setterCalled = false; +Object.prototype.__defineSetter__("x", function() { setterCalled = true; }); + +function runTest(test) { + setterCalled = false; + test(); +} + +function testProto() { + try { + throw 42; + } catch(__proto__) { + assertEquals(42, __proto__); + } +} + +function testAccessorSetter() { + try { + throw 42; + } catch(x) { + assertFalse(setterCalled); + assertEquals(42, x); + } +} + +runTest(testProto); +runTest(testAccessorSetter); diff --git a/deps/v8/test/mjsunit/try-catch-scopes.js b/deps/v8/test/mjsunit/try-catch-scopes.js new file mode 100644 index 0000000000..c5bada273f --- /dev/null +++ b/deps/v8/test/mjsunit/try-catch-scopes.js @@ -0,0 +1,42 @@ +// Copyright 2008 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. + +// Exception variables used in try-catch should be scoped, e.g. only +// visible inside the catch block. They should *not* just be treated +// as local variables and they should be allowed to nest. +var e = 0; +try { + throw e + 1; +} catch(e) { + try { + throw e + 1; + } catch (e) { + assertEquals(2, e); + } + assertEquals(1, e); +} +assertEquals(0, e); diff --git a/deps/v8/test/mjsunit/try-finally-nested.js b/deps/v8/test/mjsunit/try-finally-nested.js new file mode 100644 index 0000000000..c05f96a9eb --- /dev/null +++ b/deps/v8/test/mjsunit/try-finally-nested.js @@ -0,0 +1,46 @@ +// Copyright 2008 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 f() { + try { + return 42; + } finally { + var executed = false; + while (!executed) { + try { + break; + } finally { + executed = true; + } + assertTrue(false, "should not reach here"); + } + assertTrue(executed, "finally block executed"); + } + return 87; +}; + +assertEquals(42, f()); diff --git a/deps/v8/test/mjsunit/try.js b/deps/v8/test/mjsunit/try.js new file mode 100644 index 0000000000..0bd78b4332 --- /dev/null +++ b/deps/v8/test/mjsunit/try.js @@ -0,0 +1,349 @@ +// Copyright 2008 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 + +function Catch(f, g) { + var r; + try { r = f(); } catch (o) { return g(o); } + return r; +} + +function CatchReturn(f, g) { + try { return f(); } catch (o) { return g(o); } +} + + +var a = [Catch, CatchReturn] +for (var n in a) { + var c = a[n]; + assertEquals(1, c(function() { return 1; })); + assertEquals('bar', c(function() { return 'bar'; })); + assertEquals(1, c(function () { throw 1; }, function (x) { return x; })); + assertEquals('bar', c(function () { throw 'bar'; }, function (x) { return x; })); +} + + +assertEquals(1, (function() { try { return 1; } finally { } })()); +assertEquals(1, (function() { try { return 1; } finally { var x = 12; } })()); +assertEquals(2, (function() { try { } finally { return 2; } })()); +assertEquals(4, (function() { try { return 3; } finally { return 4; } })()); + +function f(x, n, v) { try { return x; } finally { x[n] = v; } } +assertEquals(2, f({}, 'foo', 2).foo); +assertEquals(5, f({}, 'bar', 5).bar); + +function guard(f) { try { f(); } catch (o) { return o; } } +assertEquals('baz', guard(function() { throw 'baz'; })); +assertEquals(2, (function() { try { throw {}; } catch(e) {} finally { return 2; } })()); +assertEquals(1, guard(function() { try { throw 1; } finally { } })); +assertEquals(2, guard(function() { try { throw 2; } finally { var x = 12; } })); +assertEquals(4, guard(function() { try { throw 3; } finally { throw 4; } })); + +(function () { + var iter = 1000000; + for (var i = 1; i <= iter; i++) { + try { + if (i == iter) gc(); + } finally { + if (i == iter) gc(); + } + } +})(); + +function trycatch(a) { + var o; + try { + throw 1; + } catch (o) { + a.push(o); + try { + throw 2; + } catch (o) { + a.push(o); + } + a.push(o); + } + a.push(o); +} +var a = []; +trycatch(a); +assertEquals(4, a.length); +assertEquals(1, a[0], "a[0]"); +assertEquals(2, a[1], "a[1]"); + +assertEquals(1, a[2], "a[2]"); +assertTrue(typeof a[3] === 'undefined', "a[3]"); + +assertTrue(typeof o === 'undefined', "global.o"); + + +function return_from_nested_catch(x) { + try { + try { + return x; + } catch (o) { + return -1; + } + } catch (o) { + return -2; + } +} + +assertEquals(0, return_from_nested_catch(0)); +assertEquals(1, return_from_nested_catch(1)); + + +function return_from_nested_finally(x) { + var a = [x-2]; + try { + try { + return a; + } finally { + a[0]++; + } + } finally { + a[0]++; + } +} + +assertEquals(0, return_from_nested_finally(0)[0]); +assertEquals(1, return_from_nested_finally(1)[0]); + + +function break_from_catch(x) { + x--; + L: + { + try { + x++; + if (false) return -1; + break L; + } catch (o) { + x--; + } + } + return x; +} + +assertEquals(0, break_from_catch(0)); +assertEquals(1, break_from_catch(1)); + + +function break_from_finally(x) { + L: + { + try { + x++; + if (false) return -1; + break L; + } finally { + x--; + } + x--; + } + return x; +} + +assertEquals(0, break_from_finally(0), "break from finally"); +assertEquals(1, break_from_finally(1), "break from finally"); + + +function continue_from_catch(x) { + x--; + var cont = true; + while (cont) { + try { + x++; + if (false) return -1; + cont = false; + continue; + } catch (o) { + x--; + } + } + return x; +} + +assertEquals(0, continue_from_catch(0)); +assertEquals(1, continue_from_catch(1)); + + +function continue_from_finally(x) { + var cont = true; + while (cont) { + try { + x++; + if (false) return -1; + cont = false; + continue; + } finally { + x--; + } + x--; + } + return x; +} + +assertEquals(0, continue_from_finally(0)); +assertEquals(1, continue_from_finally(1)); + + +function continue_alot_from_finally(x) { + var j = 0; + for (var i = 0; i < x;) { + try { + j++; + continue; + j++; // should not happen + } finally { + i++; // must happen + } + j++; // should not happen + } + return j; +} + + +assertEquals(100, continue_alot_from_finally(100)); +assertEquals(200, continue_alot_from_finally(200)); + + + +function break_from_nested_catch(x) { + x -= 2; + L: + { + try { + x++; + try { + x++; + if (false) return -1; + break L; + } catch (o) { + x--; + } + } catch (o) { + x--; + } + } + return x; +} + +assertEquals(0, break_from_nested_catch(0)); +assertEquals(1, break_from_nested_catch(1)); + + +function break_from_nested_finally(x) { + L: + { + try { + x++; + try { + x++; + if (false) return -1; + break L; + } finally { + x--; + } + } finally { + x--; + } + x--; // should not happen + } + return x; +} + +assertEquals(0, break_from_nested_finally(0)); +assertEquals(1, break_from_nested_finally(1)); + + +function continue_from_nested_catch(x) { + x -= 2; + var cont = true; + while (cont) { + try { + x++; + try { + x++; + if (false) return -1; + cont = false; + continue; + } catch (o) { + x--; + } + } catch (o) { + x--; + } + } + return x; +} + +assertEquals(0, continue_from_nested_catch(0)); +assertEquals(1, continue_from_nested_catch(1)); + + +function continue_from_nested_finally(x) { + var cont = true; + while (cont) { + try { + x++; + try { + x++; + if (false) return -1; + cont = false; + continue; + } finally { + x--; + } + } finally { + x--; + } + x--; // should not happen + } + return x; +} + +assertEquals(0, continue_from_nested_finally(0)); +assertEquals(1, continue_from_nested_finally(1)); + + +var caught = false; +var finalized = false; +var broke = true; +L: try { + break L; + broke = false; +} catch (o) { + caught = true; +} finally { + finalized = true; +} +assertTrue(broke); +assertFalse(caught); +assertTrue(finalized); + diff --git a/deps/v8/test/mjsunit/unicode-string-to-number.js b/deps/v8/test/mjsunit/unicode-string-to-number.js new file mode 100644 index 0000000000..13a7acfbc2 --- /dev/null +++ b/deps/v8/test/mjsunit/unicode-string-to-number.js @@ -0,0 +1,46 @@ +// Copyright 2008 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. + +// Make sure not to treat 16-bit unicode characters as ASCII +// characters when converting to numbers. +assertEquals(272, Number('2\u00372')); +assertTrue(isNaN(Number('2\u11372')), "short-string"); + +// Check that long string can convert to proper numbers. +var s = '\u0031'; +for (var i = 0; i < 7; i++) { + s += s; +} +assertTrue(isFinite(Number(s))); + +// Check that long strings with non-ASCII characters cannot convert. +var s = '\u1131'; +for (var i = 0; i < 7; i++) { + s += s; +} +assertTrue(isNaN(Number(s)), "long-string"); + diff --git a/deps/v8/test/mjsunit/unicode-test.js b/deps/v8/test/mjsunit/unicode-test.js new file mode 100644 index 0000000000..59a684e053 --- /dev/null +++ b/deps/v8/test/mjsunit/unicode-test.js @@ -0,0 +1,9169 @@ +// Copyright 2008 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. + +// Texts are from the Unibrow test suite. + +// Note that this file is in UTF-8. smjs and testkjs do not read their +// source files as UTF-8, so they will fail on this test. If you want +// to run the test on them you can do so after filtering it with the +// following piece of perl-based line noise: + +// perl -CIO -ne '$_ =~ s/([^\n -~])/"\\u" . sprintf("%04x", ord($1))/ge; print $_;' < unicode-test.js > unicode-test-ascii.js + +// The result is predictably illegible even for those fluent in Hindi. + +var chinese = +"中国历史\n" + +"[编辑首段]维基百科,自由的百科全书\n" + +"跳转到: 导航, 搜索\n" + +"中國歷史\n" + +"中国历史系列条目\n" + +"史前时期\n" + +"传说时期\n" + +"(另见三皇五帝)\n" + +"夏\n" + +"商\n" + +"西周 周\n" + +"春秋 东周\n" + +"战国\n" + +"秦\n" + +"西汉 汉\n" + +"新朝\n" + +"东汉\n" + +"魏 蜀 吴 三\n" + +"国\n" + +"西晋 晋\n" + +"东晋 十六国\n" + +"宋 南\n" + +"朝 北魏 北\n" + +"朝 南\n" + +"北\n" + +"朝\n" + +"齐\n" + +"梁 东\n" + +"魏 西\n" + +"魏\n" + +"陈 北\n" + +"齐 北\n" + +"周\n" + +"隋\n" + +"唐\n" + +"(另见武周)\n" + +"五代十国\n" + +"辽\n" + +"(西辽) 西\n" + +"夏 北宋 宋\n" + +"金 南宋\n" + +"元\n" + +"明\n" + +"清\n" + +"中华民国\n" + +"中华人民\n" + +"共和国 中华\n" + +"民国\n" + +"(见台湾问题)\n" + +"\n" + +" * 中国历史年表\n" + +" * 中国军事史\n" + +" * 中国美术史\n" + +" * 中国科学技术史\n" + +" * 中国教育史\n" + +"\n" + +"中国\n" + +"天坛\n" + +"文化\n" + +"中文 - 文学 - 哲学 - 教育\n" + +"艺术 - 国画 - 戏曲 - 音乐\n" + +"神话 - 宗教 - 术数 - 建筑\n" + +"文物 - 电影 - 服饰 - 饮食\n" + +"武术 - 书法 - 节日 - 姓名\n" + +"地理\n" + +"疆域 - 行政区划 - 城市\n" + +"地图 - 旅游 - 环境 - 生物\n" + +"人口 - 民族 - 交通 - 时区\n" + +"历史\n" + +"年表 - 传说时代 - 朝代\n" + +"民国史 - 共和国史\n" + +"文化史 - 科技史 - 教育史\n" + +"人口史 - 经济史 - 政治史\n" + +"政治\n" + +"中华人民共和国政治 - 中华民国政治\n" + +"宪法 - 外交 - 军事 - 国旗\n" + +"两岸问题 - 两岸关系\n" + +"一个中国 - 中国统一\n" + +"经济\n" + +"金融 - 农业 - 工业 - 商业\n" + +"中国各省经济 - 五年计划\n" + +"其他\n" + +"列表 - 体育 - 人权 - 媒体\n" + +"\n" + +"中国历史自商朝起算约有3600年,自黄帝时代起算约有4000多年。有历史学者认为,在人类文明史中,“历史时代”的定义是指从有文字发明时起算,那之前则称为“史前”;中国历史中传说伏羲做八卦,黄帝时代仓颉造文字;近代考古发现了3600多年前(公元前1600年)商朝的甲骨文、约4000年前至7000年前的陶文、约7000年前至10000年前具有文字性貭的龟骨契刻符号。另外,目前在中国发现最早的史前人类遗址距今约200万年。\n" + +"\n" + +"从政治形态区分中国历史,可见夏朝以前长达3000年以上的三皇五帝是母系氏族社会到父系氏族社会的过渡时代,而夏朝开始君王世袭,周朝建立完备的封建制度至东周逐渐解构,秦朝首度一统各国政治和许多民间分歧的文字和丈量制度,并建立中央集权政治,汉朝起则以文官主治国家直至清朝,清末以降,民主政治、马克思主义等各种政治思潮流传,先促成中华民国的建立,并于其后四、五十年再出现中华人民共和国,而由于内战失败,中华民国政府退守台湾。\n" + +"\n" + +"由经济形态观察,中国古代人口主要由自由民构成,私有制、商业活动发达。周朝时商业主要由封建领主阶层控制的官商贸易和庶民的自由贸易构成。秦汉以后实行中央集权,人口由士、农、工、商等构成,其中以从事农业的自由民为主体,是一个君权官僚制下的以土地为主要生产资本的较为自由的商业经济社会,一些重要的行业由官商垄断。除了农业,手工业以及商业贸易也有很大的发展。早在汉朝丝路的开通,促进了东亚与中亚至欧洲的陆上交通时,国际贸易早已起步;隋唐时大运河的开通促进了南北贸易;唐朝的盛世及外交的开放、交通的建设,更使各国文化、物资得以交流;宋代时出现了纸币;元代时与中亚的商业交流十分繁荣;明清两代受到西方国家海上发展的影响,海上国际贸易发展迅猛。自中华民国成立起试图建立民主国家,实行自由经济,直到1990年代台湾落实民主制度,1950年代以后30多年迅速实现了向工业化社会的转型;而中国大陆则在1949年后采用一党制统治,起先为公有制的计划经济社会,改革开放后逐步向私有制的市场经济社会転型,同时,1980年代以来工业化发展迅猛,数亿人口在短短20多年内从农民转为产业工人(目前仅仅被称为“农民工”的产业工人就达到约2亿)。伴随经济的迅速国际化,中国经济成为全球经济中越来越重要的组成部分。\n" + +"目录\n" + +"[隐藏]\n" + +"\n" + +" * 1 史前时代\n" + +" * 2 传说时代\n" + +" * 3 先秦时期\n" + +" o 3.1 三代\n" + +" o 3.2 春秋战国\n" + +" * 4 秦汉时期\n" + +" * 5 魏晋南北朝时期\n" + +" * 6 隋唐五代时期\n" + +" * 7 宋元时期\n" + +" * 8 明清时期\n" + +" o 8.1 清末的内忧外患\n" + +" * 9 20世纪至今\n" + +" * 10 参见\n" + +" * 11 其他特定主题中国史\n" + +" * 12 注解\n" + +" * 13 参考文献\n" + +" * 14 相关著作\n" + +" * 15 外部链接\n" + +"\n" + +"[编辑] 史前时代\n" + +"大汶口文化的陶鬹,山東莒县大朱村出土\n" + +"大汶口文化的陶鬹,山东莒县大朱村出土\n" + +"\n" + +"迄今为止发现的最早的高等灵长类中华曙猿在4500万年前生活在中国江南一带。考古证据显示224万年至25万年前,中国就有直立人居住,目前考古发现的有巫山人、元谋人、蓝田人、南京直立人、北京直立人等。这些都是目前所知较早的原始人类踪迹。\n" + +"\n" + +"中国史前时代的各种文化是经过了以下几个阶段:以直立猿\n" + +"人为主的旧石器时代早中期(距今约50至40多万年前),接着进入了旧石器时代中晚期,以山顶洞人为代表,距今约在20至10余万年前。新石器时代早期的代表性文化是裴李岗文化,紧接着是以仰韶文化为代表的新石器时代中期。而以龙山文化为代表的新石器时代晚期,大约出现在公元前2500年到公元前1300年间。\n" + +"\n" + +"根据现在的考古学研究,中国的新石器时代呈现多元并立的情形:约西元前5000年到3000年前在河南省、河北省南部、甘肃省南部和山西省南部出现的仰韶文化便具备使用红陶、彩陶以及食用粟和畜养家畜的特质。而大约在同一时间,尚有在浙江省北边出现的河姆渡文化、山东省的大汶口文化。而之后发现的如二里头遗址和三星堆遗址则为青铜器时代的代表。\n" + +"\n" + +"[编辑] 传说时代\n" + +"\n" + +" 主条目:三皇五帝\n" + +"\n" + +"後人所繪的黄帝像\n" + +"后人所绘的黄帝像\n" + +"\n" + +"华夏文明形成于黄河流域中原地区。早期的历史,口口相传。神话中有盘古开天地、女娲造人的说法。传说中的三皇五帝,是夏朝以前数千年杰出首领的代表,具体而言有不同的说法。一般认为,三皇是燧人、伏羲、神农以及女娲、祝融中的三人,五帝一般指黄帝、颛顼、帝喾、尧、舜。自三皇至五帝,历年无确数,最少当不下数千年。\n" + +"\n" + +"据现今整理出来的传说,黄帝原系炎帝部落的一个分支的首领,强大之后在阪泉之战中击败炎帝,成为新部落联盟首领,之后又与东南方的蚩尤部落发生冲突,在涿鹿之战中彻底击败对手,树立了自己的霸主地位。\n" + +"\n" + +"后来黄帝的孙子颛顼和玄孙帝喾继续担任部落联盟的首领。帝喾的儿子尧继位,他是一名贤君,创立了禅让制,传位给了舜。在舜时期,洪水泛滥,鲧采用堵塞的方法,结果洪水更厉害了,鲧被处决,他的儿子禹采用疏导的方法,成功治理了洪水,因此被推举为首领。然而他的儿子启破坏了禅让制方式,自立为王(但据《史记》及香港中学课本所述,启是被推举为领袖),建立了第一个世袭王朝——夏朝,夏朝持续了400多年,在最后一个夏朝君主——桀末期,东方诸侯国商首领成汤夺取了政权,建立了商朝。\n" + +"\n" + +"[编辑] 先秦时期\n" + +"\n" + +"[编辑] 三代\n" + +"\n" + +" 主条目:夏朝、商朝、周朝和西周\n" + +"\n" + +"甲骨文\n" + +"甲骨文\n" + +"\n" + +"最早的世袭朝代夏朝约在前21世纪到前16世纪,由于这段历史目前没有发现文字性文物做印证,所以只能靠后世的记录和出土文物互相对照考证,中国学者一般认为河南洛阳二里头遗址是夏朝首都遗址,有学者对此持有疑问。根据文字记载,夏朝有了中国最早的历法--夏小正。不过之后的商朝是目前所发现的最早有文字文物的历史时期,存在于前16世纪到约前1046年。据说夏朝最后一个君主——桀,由于荒淫无道而被汤推翻。而商代时文明已经十分发达,有历法、青铜器以及成熟的文字——甲骨文等。商王朝时已经有一个完整的国家组织,并且具有了封建王朝的规模。当时的主要生产部门是农业,不过手工业,特别是青铜器的冶铸水平也已经十分高超。并且已经出现了原始的瓷器。商朝自盘庚之后,定都于殷(今河南安阳),因此也称为殷朝。商朝的王位继承制度是传子或传弟,多按年龄的长幼继承。\n" + +"\n" + +"与此同时,黄河上游的另一个部落周正在逐步兴起,到了大约前1046年,周武王伐纣,在牧野之战中取得决定性胜利,商朝灭亡。周朝正式建立,建都渭河流域的镐京(今陕西西安附近)。之后周朝的势力又慢慢渗透到黄河下游和淮河一带。周王朝依然是封建贵族统治,有许多贵族的封国(诸侯)。到鼎盛时,周朝的影响力已经在南方跨过长江,东北到今天的辽宁,西至甘肃,东到山东。周朝时的宗法制度已经建立,政权机构也较完善。自唐尧、虞舜至周朝皆封建时代,帝王与诸侯分而治之[1]。中国最早有确切时间的历史事件是发生于公元前841年西周的国人暴动。\n" + +"\n" + +"[编辑] 春秋战国\n" + +"\n" + +" 主条目:周朝、东周、春秋时期和战国 (中国)\n" + +"\n" + +"先師孔子行教像,為唐朝画家吳道子所画\n" + +"先师孔子行教像,为唐朝画家吴道子所画\n" + +"\n" + +"前770年,由于遭到北方游牧部落犬戎的侵袭,周平王东迁黄河中游的洛邑(今河南洛阳),东周开始。此后,周王朝的影响力逐渐减弱,取而代之的是大大小小一百多个小国(诸侯国和附属国),史称春秋时期。春秋时期的大国共有十几个,其中包括了晋、秦、郑、齐及楚等。这一时期社会动荡,战争不断,先后有五个国家称霸,即齐、宋、晋、楚、秦(又有一说是齐、晋、楚、吴、越),合称春秋五霸。到了前546年左右,黄河流域的争霸基本结束,晋、楚两国平分了霸权。前403年,晋国被分成韩、赵、魏三个诸侯国,史称“三家分晋”。再加上被田氏夺去了政权的齐国,和秦、楚及燕,并称战国七雄,战国时期正式开始。大部分马克思主义史学家将战国开始划为封建社会,然而大部分西方及台湾学者却又将之划为封建社会的崩溃。前356年秦国商鞅变法开始后,秦国国力大大增强,最后终于在前221年消灭六国最后的齐国,完成统一,中国历史也进入了新时代。\n" + +"\n" + +"春秋战国时期学术思想比较自由,史称百家争鸣。出现了多位对之后中国有深远影响的思想家(诸子百家),例如老子、孔子、墨子、庄子、孟子、荀子、韩非等人。出现了很多学术流派,较出名的有十大家,即道家(自然)、儒家(伦理)、阴阳家(星象占卜)、法家(法治)、名家(修辞辩论)、墨家(科技)、众、杂、农家(农业)、小说家(小说)等。文化上则出现了第一个以个人名字出现在中国文学史上的诗人屈原,他著有楚辞、离骚等文学作品。孔子编成了诗经。战争史上出现了杰出的兵法家孙武、孙膑、吴起等等。科技史上出现了墨子,建筑史上有鲁班,首次发明了瓦当,奠定了中国建筑技术的基础。能制造精良的战车与骑兵,同时此时中国的冶金也十分发达,能制造精良的铁器,在农业上出现了各种灌溉机械,大大提高了生产率,从而为以后人口大大膨胀奠定了基础。历史上出现了春秋(左传),国语,战国策。中华文化的源头基本上都可以在这一时期找到。\n" + +"\n" + +"这一时期科技方面也取得了很大进步。夏朝发明了干支纪年,出现了十进位制。西周人用圭表测日影来确定季节;春秋时期确定了二十八宿;后期则产生了古四分历。\n" + +"\n" + +"[编辑] 秦汉时期\n" + +"\n" + +" 主条目:秦朝、汉朝、西汉、新朝和东汉\n" + +"\n" + +"北京八達嶺長城\n" + +"北京八达岭长城\n" + +"\n" + +"前221年,秦并其他六国后统一了中国主体部分,成为了中国历史上第一个统一的中央集权君主统治国家,定都咸阳(今西安附近)。由于秦王嬴政自认“功盖三皇,德过五帝”,于是改用皇帝称号,自封始皇帝,人称秦始皇,传位后的皇帝称二世,直至千世万世。他对国家进行了许多项改革,包括了中央集权的确立,取代了周朝的诸侯分封制;统一了文字,方便官方行文;统一度量衡,便于工程上的计算。秦始皇还大力修筑驰道,并连接了战国时赵国、燕国和秦国的北面围城,筑成了西起临洮、东至辽东的万里长城以抵御北方来自匈奴,东胡等游牧民族的侵袭。秦始皇推崇法治,重用法家的李斯作为丞相,并听其意见,下令焚书坑儒,收缴天下兵器,役使七十万人修筑阿房宫以及自己的陵墓——包括兵马俑等。部分史学家对以上事件存有怀疑,认为由于秦始皇的一系列激进改革得罪了贵族,平民无法适应,才在史书上留此一笔。[来源请求]\n" + +"\n" + +"前210年,秦始皇病死于出巡途中,胡亥(即秦二世)杀害太子扶苏即位。但十个月后,陈胜、吴广在大泽乡揭竿而起,包括六国遗臣等野心家乘势作乱,前206年刘邦围攻咸阳,秦王子婴自缚出城投降,秦亡。此后,汉王刘邦与西楚霸王项羽展开了争夺天下的楚汉战争。 前202年十二月,项羽被汉军围困于垓下(今安徽灵壁),四面楚歌。项羽在乌江自刎而死。楚汉之争至此结束。汉高祖刘邦登基,定都长安(今陕西西安),西汉开始。到了汉武帝时,西汉到达鼎盛。并与罗马,安息(帕提亚),贵霜并称为四大帝国。武帝实行推恩令,彻底削弱了封国势力,强化监察制度,实现中央集权;他派遣卫青、霍去病、李广等大将北伐,成功地击溃了匈奴,控制了西域,还派遣张骞出使西域,开拓了著名的丝绸之路,发展了对外贸易,使中国真正了解了外面的世界,促进中西文化交流。儒家学说也被确立为官方的主流意识形态,成为了占统治地位的思想。其他艺术与文化也蒸蒸日上。同时期还出现了第一部通史性质的巨著——《史记》,同时这时的中国出现造纸术,大大推动了文化发展。\n" + +"\n" + +"西汉发展到了一世纪左右开始逐渐衰败。公元9年,外戚王莽夺权,宣布进行一系列的改革,改国号为新。然而这些改革却往往不切实际,最终导致农民纷纷起义。公元25年刘秀复辟了汉朝,定都洛阳,史称东汉,而他就是汉光武帝。东汉的发展延续了西汉的传统,此时出现了天文学家张衡。汉的文化吸取了秦的教训,显得相当开明,当时佛教通过西域到达中国,在河南洛阳修建了中国的第一座佛教寺庙——白马寺,佛教正式传入中国。\n" + +"\n" + +"[编辑] 魏晋南北朝时期\n" + +"\n" + +" 主条目:魏晋南北朝、三国、晋朝、十六国和南北朝\n" + +"\n" + +"赤壁\n" + +"赤壁\n" + +"\n" + +"东汉中后期,宦官和外戚长期争权,在黄巾起义的打击下,到了公元二世纪左右时再度衰败,196年曹操控制了东汉朝廷,把汉献帝迎至许都,“挟天子以令诸侯”,220年,曹操死后,长子曹丕废汉献帝自立,建立魏国,同时尚有刘氏的汉和孙氏的吴,历史进入了三国时期。\n" + +"\n" + +"265年,魏权臣司马炎称帝,建立晋朝。280年三国归晋,再度统一。晋朝的文化也有一定发展,当时由于战乱纷纷,很多学士选择归隐,不问世事,典型的代表人物是陶渊明(陶潜),当时的书法艺术也十分兴盛。290年晋武帝死后不到一年,十六年的朝廷权利斗争开始,史称“八王之乱”。与此同时,中原周边的五个游牧民族(匈奴、鲜卑、羌、氐、羯)与各地流民起来反晋,史称五胡乱华。这些游牧民族纷纷建立自己的国家,从304年到409年,北部中国陆陆续续有多个国家建立,包括了汉、前赵、后赵、前燕、前凉、前秦、后秦、后燕、西秦、后凉、北凉、南凉、南燕、西凉、夏和北燕, 史称十六国。\n" + +"\n" + +"自东汉后期开始,为躲避战乱,北方的汉族人民大量迁居南方,造成经济重心南移;晋朝南迁,建都建康(今江苏南京),历史上称此前为西晋,南迁后为东晋。最后,拓跋鲜卑统一北方,建立北朝的第一个王朝——北魏,形成了南北朝的对立。南朝经历了宋、齐、梁、陈的更替,而北朝则有北魏、东魏、西魏、北齐和北周。南北朝时期是佛教十分盛行的时期,西方的佛教大师络绎不绝地来到中国,许多佛经被翻译成汉文。\n" + +"\n" + +"[编辑] 隋唐五代时期\n" + +"\n" + +" 主条目:隋朝、唐朝和五代十国\n" + +"\n" + +"唐代画家张萱作《捣练图》。\n" + +"唐代画家张萱作《捣练图》。\n" + +"\n" + +"581年,杨坚取代北周建立了隋朝,并于589年灭掉南朝最后一个政权——陈,中国历经了三百多年的分裂之后再度实现了统一。不过隋朝也是一个短命的王朝,在修筑了巨大工程——京杭大运河后就灭亡了,只经历了两代37年。\n" + +"\n" + +"618年,唐高祖李渊推翻隋朝建立了唐朝,它是中国历史上延续时间最长的朝代之一。626年,唐太宗李世民即位,唐朝开始进入鼎盛时期,史称贞观之治。长安(今陕西西安)是当时世界上最大的城市,唐王朝也是当时最发达的文明。高宗李治之妻武则天迁都洛阳,并称帝,成为中国史上唯一的女皇帝,改国号周,并定佛教为国教,广修佛寺,大兴土木。隋唐时期开创的科举制是当时比较科学与公平的人材选拔制度。唐王朝与许多邻国发展了良好的关系,文成公主嫁到吐蕃,带去了大批丝织品和手工艺品。日本则不断派遣使节、学问僧和留学生到中国。唐朝的文化也处于鼎盛,特别是诗文得到较大的发展,还编撰了许多纪传体史书。唐代涌现出许多伟大的文学家,例如诗人李白、杜甫、白居易、杜牧,以及散文家韩愈、柳宗元。唐代的佛教是最兴盛的宗教,玄奘曾赴天竺取经,回国后译成1335卷的经文,并于西安修建了大雁塔以存放佛经。唐朝前期对宗教采取宽容政策,佛教外,道教、摩尼教(Manicheism)、景教和伊斯兰教等也得到了广泛传播。这一切都在李世民的曾孙唐玄宗李隆基统治时期达到顶峰,史称开元盛世。然而在755年,爆发了安史之乱,唐朝由此开始走向衰落。\n" + +"\n" + +"875年,黄巢起义爆发,唐朝再度分裂,并于907年灭亡,形成了五代十国的混乱局面。\n" + +"\n" + +"[编辑] 宋元时期\n" + +"\n" + +" 主条目:辽朝、金朝、西夏、宋朝和元朝\n" + +"\n" + +"清明上河圖局部,描繪了清明時節,北宋京城汴梁及汴河兩岸的繁華和熱鬧的景象和優美的自然風光。\n" + +"清明上河图局部,描绘了清明时节,北宋京城汴梁及汴河两岸的繁华和热闹的景象和优美的自然风光。\n" + +"\n" + +"经过了五十多年的纷争后,960年北宋控制了中国大部分地区,但是燕云十六州在北方契丹族建立的辽朝手中(五代中的后晋太祖“儿皇帝”石敬瑭所献),河西走廊被党项族建立的西夏趁中原内乱占据,北宋初期虽然曾出兵讨还(宋太宗)但是以失败告终,木以成舟,无可奈何,不得不向日益坐大的辽和西夏交纳岁币。北宋晚期发生了分别以王安石、司马光为首的党派斗争,增加了社会的不安。到了1125年松花江流域女真族,也就是后来的满族,建立的金国势力逐渐强大,1125年,金国灭辽。金国随即开始进攻积弱的北宋,1127年(靖康元年)金国攻破北宋首都汴京(今河南开封),俘虏三千多皇族,其中包括了当时的皇帝宋钦宗和太上皇宋徽宗,因为钦宗其时的年号为靖康,史称靖康之难,北宋灭亡。同年宋钦宗的弟弟赵构在南京应天府(今河南商丘)即皇位,定都临安(今浙江杭州),史称南宋,偏安江南。\n" + +"\n" + +"此后金与南宋多次交战,英雄人物层出不穷(如名将岳飞)。直到1234年,蒙古南宋联合灭金。随即蒙古与南宋对抗,经历了空前绝后的大规模血腥战争(如襄樊之战, 钓鱼城之战)。1271年忽必烈建立元朝,定都大都(今北京)。元军于1279年与南宋进行了崖山海战,8岁的小皇帝赵昺被民族英雄陆秀夫背着以身殉国惨烈地跳海而死。崖山海战以元朝的胜利告终,南宋随之灭亡。另有一说, 原华夏文明至此夭折.[来源请求]\n" + +"\n" + +"北宋时期中国出现印刷术和火药。当时中国经济发达,中国海上贸易十分兴盛,福建泉州一带成为繁华的港口,中国当时的经济总量占世界的一半,财政收入超过一亿两白银,首都开封和杭州人口达到400到500万人口,相对当时佛罗伦萨和巴黎十几万人口来讲确实是十分繁华,各国商人云集,文化也极盛,出现了程颐、朱熹等理学家,提倡三从四德。与唐诗并驾齐驱的宋词,有苏轼等词文优秀的词人,出现了中国历史上最著名的女词人李清照,社会文化发达,出现了白蛇传,梁祝等浪漫爱情传说,以至于宋朝被西方学者称为中国的“文艺复兴”。\n" + +"\n" + +"元朝建立后,一方面吸收了许多中原、汉族文化,以中原的统治机构和方式来统治人民,并大力宣扬朱熹一派的理论(即程朱理学),使得程朱理学成为元朝(以及其后朝代)的官方思想,另一方面却实行了民族等级制度,第一等是蒙古人;第二等是“色目人”,包括原西夏统治区以及来自西域、中亚等地的人口;第三等是“汉人”,包括原金统治区的汉族和契丹、女真等族人;第四等是“南人”,包括原南宋统治区的汉族和其他族人。这种民族制度导致汉族的不满,许多汉族人将元朝视为外来政权,并发动多次反抗。元朝政府除了传统的农业外,也比较重视商业。元朝首都大都十分繁华,来自世界各国的商人云集。在文化上,则出现了与唐诗、宋词并称的元曲,涌现出诸如关汉卿、马致远、王实甫等著名作曲家。\n" + +"\n" + +"[编辑] 明清时期\n" + +"紫禁城太和殿\n" + +"紫禁城太和殿\n" + +"\n" + +" 主条目:明朝、南明、清朝和中国近代史\n" + +"\n" + +"1368年,农民起义军领袖朱元璋推翻元朝并建立了明朝。明朝前期建都南京,1405年曾帮助明成祖篡位的太监郑和奉命七次下西洋,曾经到达印度洋、东南亚及非洲等地,但后来明朝逐渐走向闭关锁国。1421年,明朝迁都北京。明朝文化上则出现了王阳明、李贽等思想家,以及《三国演义》、《水浒传》、《西游记》和《金瓶梅》等长篇小说。由于明朝末年行政混乱及严重自然灾害,1627年,明末农民大起义爆发,1644年,起义首领李自成攻克北京,明思宗自缢。南方大臣先后拥护福王朱由崧(弘光)、唐王朱聿键(隆武)、桂王朱由榔(永历)为帝,史称南明,最终因实力不足及政治内斗,仍为当时强盛的清朝所灭。\n" + +"\n" + +"明朝晚期,居住在东北地区的满族开始兴盛起来,终于在1644年李自成攻克北京后不久,驱逐李自成,进入北京,建立了清朝,当时明朝旧臣郑成功南撤到台湾岛,并驱逐了那里的荷兰殖民者,后来被清朝军队攻下。清朝在之后的半个世纪还成功地征服了许多地区,例如新疆、西藏、蒙古以及台湾。康熙年间,清廷还与沙俄在黑龙江地区发生战争,最终于1689年签订停战条约——《中俄尼布楚条约》。清朝由于取消了丁税(人头税),导致人口增加,到19世纪已达当时世界总人口的三分之一,人口的增多促进当时农业的兴盛,为当时世界上第一强国,到1820年时中国的经济总量占世界的三分之一。\n" + +"\n" + +"然而到了19世纪初,清朝已经走向衰落,在嘉庆年间先后爆发白莲教、天理教的大规模起义。与此同时海上强国英国、荷兰与葡萄牙等纷纷开始强制与中国进行贸易。1787年,英国商人开始向华输入鸦片,导致中国的国际贸易由顺差变为巨额逆差。清廷于1815年颁布搜查洋船鸦片章程,然而英商无视禁令依然走私大量鸦片,道光皇帝不得不于1838年派林则徐赴广州禁烟。1839年6月,将237万多斤鸦片在虎门销毁,史称虎门销烟。英国政府因此于1840年6月发动鸦片战争。一般中国大陆史学界认为这是中国近代史的开始。\n" + +"\n" + +"[编辑] 清末的内忧外患\n" + +"一幅描繪列強瓜分中國情形的漫畫\n" + +"一幅描绘列强瓜分中国情形的漫画\n" + +"\n" + +"鸦片战争持续了一年多,1841年8月英军到达南京,清廷恐惧英军会进逼北京,于是求和,1842年8月29日,《南京条约》签署。香港岛被割让;上海、广州、厦门、福州和宁波开放作为通商口岸,还赔偿款银(西班牙银圆)2100万元。1844年,美国与法国也与清廷分别签订了《望厦条约》和《黄埔条约》,中国的主权受到破坏。\n" + +"\n" + +"与此同时中国国内反抗清朝的斗争再度兴起。1851年至1864年间,受到基督教影响的秀才洪秀全建立拜上帝会,发动金田起义并创建了太平天国。太平天国曾经一度占领南方部分省份,并定都南京(改名“天京”),建立政教合一的中央政权。同一时期其它的运动还有天地会、捻军、上海小刀会起义、甘肃回民起义等。这些反抗清朝的斗争直到1860年代才基本平息下来。\n" + +"\n" + +"19世纪后期,英、美、法、俄、日等国多次侵入中国,强迫中国与之签定不平等条约。1858年中俄签定《瑷珲条约》,俄国割去黑龙江以北、外兴安岭以南60多万平方公里的中国领土。1860年,英法联军发动第二次鸦片战争,侵入北京,掠夺并烧毁皇家园林圆明园,并于1860年与清廷签定《北京条约》,各赔英法800万两白银,开放更多通商口岸。同年中俄《北京条约》将乌苏里江以东,包括库页岛(萨哈林岛)、海参崴(符拉迪沃斯托克)约40万平方公里的中国领土,划归俄国。1864年,《中俄勘分西北界约记》将巴尔喀什湖以东、以南和斋桑卓尔南北44万平方公里的中国领土,割给俄国。\n" + +"\n" + +"为了增强国力并巩固国防,清朝自1860年代开始推行洋务运动,国力有所恢复,并一度出现了同治中兴的局面。1877年清军收复新疆,1881年通过《伊犁条约》清军收复被沙俄占据多年的伊犁。中法战争后清朝还建立了当时号称亚洲第一、世界第六的近代海军舰队—北洋水师。然而在1894年爆发的中日甲午战争中,中国战败,次年被迫与日本签定《马关条约》,赔偿日本2亿两白银,并割让台湾、澎湖列岛给日本。甲午战争的失败,对当时的中国产生了很大的影响。1898年,光绪帝在亲政后同意康有为、梁启超等人提出的变法主张,从6月11日到9月21日的被称为百日维新的103天中进行了多项改革,但最终在慈禧太后发动政变后失败落幕,康有为、梁启超逃亡国外,谭嗣同、刘光第等六人被杀,史称“戊戌六君子”。\n" + +"\n" + +"1899年,义和团运动爆发,以“扶清灭洋”为宗旨并在慈禧太后默许下开始围攻外国驻北京使馆。于是,各国以解救驻京使馆人员的名义侵入中国,史称八国联军。1901年,清政府被迫与各国签定辛丑条约,赔款4.5亿两白银,分39年还清(本息合计9.8亿两),同时从北京到山海关铁路沿线由各国派兵驻扎,开北京东交民巷为使馆区,国人不得入内等。\n" + +"\n" + +"[编辑] 20世纪至今\n" + +"\n" + +" 主条目:中华民国历史和中华人民共和国史\n" + +"\n" + +"1901年,革命党开始兴起,孙中山等人在海外积极筹款,指挥国内的多次起义运动。经过十次失败的起义后,与革命党互不沟通的湖北新军在武昌起义获得成功。1912年元月,中华民国宣告成立。孙中山就任临时大总统。以清帝退位为条件,孙中山辞去总统位置,由袁世凯接任。但袁世凯妄图恢复帝制。此后,孙中山发起护法运动与护国运动讨伐袁世凯。1916年,袁世凯在称帝83天之后死去,中华民国进入北洋军阀控制中央政府统治时期,地方政府分别由各个军阀派系占据。\n" + +"\n" + +"孙中山之后多次试图联合南方地方军阀北伐北京中央政府未果。1921年,在共产国际的指导下中国共产党成立,并成为共产国际中国支部。1924年,孙中山提出新三民主义并确定联俄联共扶助农工的政策,国民党在共产国际帮助下改组,共产党员以个人身份加入国民党,国共两党进行第一次合作。孙中山自建立广州军政府(1923年改称大元帅府)以后,曾经三次进行北伐,均因条件不具备而未果。1925年春,孙中山病逝于北京。同年,广州国民政府为统一与巩固广东革命根据地,先后举行第一次东征第二次东征与南征,肃清广东境内的军阀势力和反革命武装,并将广东境内倾向革命的军队统一改编为国民革命军,下辖第1至第6军。不久又将广西部队改编为第7军。为北伐战争作了重要准备。1926年6月5日,国民党中央执行委员会正式通过国民革命军出师北伐案,并任命蒋介石为国民革命军总司令正式开始北伐。然而随着北伐和国民革命的深入,国民党不能容忍共产党激进的工人运动,国共两党分裂,大量共产党员及其支持者被清出国民党,有的被拘捕和杀害。1927年8月1日,以周恩来、贺龙、叶挺为首的共产党员在江西南昌发动南昌叛乱,共产党从此有自己独立的军队(中华人民共和国成立后,8月1日被定为建军节)。并于江西瑞金建立了第一个红色苏维埃地方割据政权。此后南京国民政府先后对中央苏区进行五次围剿,红军逃过了前四次围剿,在第五次战争失败,不得不离开红区。1934年开始,红军进行战略转移,在贵州遵义确立了毛泽东对红军的领导和指挥权,四渡赤水河,终于摆脱了追击,途经江西,贵州,四川,甘肃,陕西,经过二万五千里长征,最后在陕西北部与陕北红军刘志丹部会师,建立陕甘宁共产党临时政府。\n" + +"毛泽東在天安门城楼上宣布中华人民共和國的成立\n" + +"毛泽东在天安门城楼上宣布中华人民共和国的成立\n" + +"\n" + +"1931年9月18日,日本开始侵华,占领了东北全境。1936年12月12日,西安事变后国共第二次合作抗日。1937年7月7日,抗日战争全面爆发,蒋中正在庐山发表著名的“最后关头”的演说,号召全国人民一致抗日。在日军进行南京大屠杀前夕,中华民国首都从南京迁至武汉,后来迁至重庆,在八年间蒋中正为统帅的抗日力量共进行了22次大会战,和成千上万次大小战斗。1945年,二战结束后,当时的中国国民政府从日本手里获得了台湾及澎湖列岛以及其他一些领土,但也在1946年与苏联签订的条约中承认了外蒙古的独立(1951年,迁往台湾的国民党国民政府以苏联未履约为由,不承认该条约及依据该条约而独立的外蒙古的独立地位;但是,蒙古独立已为既成事实)。1946年6月,国共两党又进行了内战。中国共产党最终于1949年获得决定性胜利,中华民国中央政府迁往战后的台湾。中华人民共和国在北平成立,并将北平改名为北京,毛泽东宣布中华人民共和国政府为包括台湾在内的全中国的唯一合法政府。与此同时,蒋介石宣布台北为中华民国临时首都,宣誓三年内反攻大陆。(请参看台湾问题)\n" + +"\n" + +"中共执政之初,采取“土地革命”“公私合营”等手段,国内纷乱的局势暂时得到了稳定。按照中共的史观,自1956年“三大改造”完成后,中国正式进入社会主义阶段。并制订第一个五年计划,大力发展重工业,国家经济一度好转。但是1958年,毛泽东发动“大跃进”运动与人民公社话运动,各地浮夸风“放卫星”等谎报数据的情况盛行。自1959年到1961年,国家经济又陷入濒临崩溃的境地,中共称其为“三年自然灾害”。毛泽东因此退居幕后,以刘少奇为首的一批官僚着手恢复经济,国家形式得到了回稳。1966年,文化大革命爆发,刘少奇、贺龙等人被打倒,毛泽东再度成为政治领导,林彪一度成为内定接班人。在林彪阴谋败露后,四人帮成为新的重要政治势力。1976年,周恩来朱德先后去世;9月9日,毛泽东去世。华国锋接替了毛的领导地位,四人帮被打倒。但是华提出了“两个凡是”的路线,国家实质上仍然没有完全脱离文化大革命阶段。 1978年,邓小平复出,中共十一届三中全会召开,改革开放时代正式到来。中国的经济开始步入正轨。但是,由于通货膨胀与政治腐败,民间不满情绪开始酝酿。胡耀邦的去世成为愤怒爆发的导火索,终致爆发了六四事件。从此以后,改革的步伐一度停滞,直到1992年邓小平南巡后才得以改变。1997年,中国收复香港的主权,江泽民也接替邓成为了新的中国领导人。2002 年后,胡锦涛成为新的国家领导人,上海帮淡出政治中心。中共政府近几年渐渐放弃“韬光养晦”的外交方针,在外交舞台上动作频繁,并加强对台湾的攻势。经济改革依然得到了持续,但政治改革的话题仍然是禁忌。而由于贫富差距的拉大与政治腐败不见好转,民间对中共的评价与看法也日益两极。\n" + +"\n" + +"至于中华民国,在国府迁台后,国民党始终保持对政治与言论自由的强力控制。1986年,中华民国第一个反对党民主进步党成立,威权时代的戒严体制开始松动。1987年,中华民国政府正式宣告台湾省解严,进入了一个新的时代。之后,1996年实现了第一次民选总统;2000年更实现第一次政党和平轮替。2005年,末代国民大会召开,中华民国宪法出现了重大修改。今后,民主化的中华民国仍然充满变量。\n" + +"\n" + +"[编辑] 参见\n" + +"\n" + +" * 中国\n" + +" * 中国历史年表\n" + +" * 中国历史事件列表\n" + +" * 诸侯会盟\n" + +" * 中国历史地图\n" + +"\n" + +" \n" + +"\n" + +" * 中华人民共和国历史年表\n" + +" * 中华人民共和国史\n" + +" * 汉学\n" + +" * 中华文明\n" + +" * 中国历史大事年表\n" + +"\n" + +" \n" + +"\n" + +" * 中国文化\n" + +" * 中国行政区划\n" + +" * 中国朝代\n" + +" * 夏商周断代工程\n" + +" * 中国古都\n" + +"\n" + +" \n" + +"\n" + +" * 中国战争列表\n" + +" * 中国国旗\n" + +" * 中国皇帝\n" + +" * 中国历代王朝君主世系表\n" + +" * 中国君王诸子女列表\n" + +" * 中华民国历史\n" + +"\n" + +"[编辑] 其他特定主题中国史\n" + +"\n" + +" * 中国军事史\n" + +" * 中国科学技术史\n" + +" * 中国文化史\n" + +" * 中国文学史\n" + +" * 中国艺术史\n" + +" * 中国经济史\n" + +" * 中国体育史\n" + +" * 中国人口史\n" + +" * 中国疆域史\n" + +" * 中国盗墓史\n" + +" * 中国酷刑史\n" + +" * 中国食人史\n" + +" * 中国盐业史\n" + +"\n" + +"[编辑] 注解\n" + +"\n" + +" 1. ↑ 柳翼谋:《中国文化史》\n" + +"\n" + +"[编辑] 参考文献\n" + +"\n" + +" 1. 白寿彝主编:中国通史纲要,1993年上海:人民出版社,ISBN 7208001367\n" + +" 2. 周谷城著:中国通史,1995年上海:人民出版社,ISBN 7208003300\n" + +" 3. 李敖著:独白下的传统,2000年香港:三联书店(香港)有限公司,ISBN 9620418913\n" + +" 4. 范文澜著:中国近代史,1962年北京:人民出版社,统一书号 11001241\n" + +" 5. 徐中约著:中国近代史(上册),香港2001 中文大学出版社,ISBN 9622019870\n" + +" 6. Korotayev A., Malkov A., Khaltourina D. Introduction to Social Macrodynamics: Secular Cycles and Millennial Trends. Moscow: URSS, 2006. ISBN 5-484-00559-0 [1] (Chapter 2: Historical Population Dynamics in China).\n" + +"\n" + +"[编辑] 相关著作\n" + +"\n" + +" * 《二十四史》 (正史)\n" + +" * 《国史要义》 柳诒徵\n" + +" * 《国史大纲》 钱穆\n" + +" * 《中华五千年史》 张其昀\n" + +"\n" + +"[编辑] 外部链接\n" + +"维基共享资源中相关的多媒体资源:\n" + +"中国历史\n" + +"\n" + +" * 中华万年网\n" + +" * 一个全面专门研究中华历史的论坛:中华历史网论坛\n" + +" * (正体中文 - 台湾)《中国大百科全书》:中国历史概述\n"; + +var cyrillic = +"История Китая\n" + +"[править]\n" + +"Материал из Википедии — свободной энциклопедии\n" + +"Перейти к: навигация, поиск\n" + +"История Китая\n" + +"История Китая\n" + +"Три властителя и пять императоров\n" + +"Династия Ся\n" + +"Династия Шан\n" + +"Династия Чжоу \n" + +"Западное Чжоу\n" + +"Восточное Чжоу Чуньцю\n" + +"Чжаньго\n" + +"Династия Цинь\n" + +"(Династия Чу) - смутное время\n" + +"Династия Хань Западная Хань\n" + +"Синь, Ван Ман\n" + +"Восточная Хань\n" + +"Эпоха Троецарствия Вэй Шу У\n" + +"Цзинь\n" + +" Западная Цзинь\n" + +"Шестнадцать варварских государств Восточная Цзинь\n" + +"Северные и Южные Династии\n" + +"Династия Суй\n" + +"Династия Тан\n" + +"Ляо\n" + +" \n" + +"5 династий и 10 царств\n" + +"Северная Сун\n" + +" \n" + +"Сун\n" + +"Цзинь\n" + +" \n" + +"Западная Ся\n" + +" \n" + +"Южная Сун\n" + +"Династия Юань\n" + +"Династия Мин\n" + +"Династия Цин\n" + +"Китайская республика\n" + +"Китайская Народная Республика\n" + +" Китайская республика (Тайвань)\n" + +"\n" + +"Китайская цивилизация — одна из старейших в мире. По утверждениям китайских учёных, её возраст может составлять пять тысяч лет, при этом имеющиеся письменные источники покрывают период не менее 3500 лет. Наличие систем административного управления, которые совершенствовались сменявшими друг друга династиями, ранняя освоенность крупнейших аграрных очагов в бассейнах рек Хуанхэ и Янцзы создавало преимущества для китайского государства, экономика которого основывалась на развитом земледелии, по сравнению с соседями-кочевниками и горцами. Ещё более укрепило китайскую цивилизацию введение конфуцианства в качестве государственной идеологии (I век до н. э.) и единой системы письма (II век до н. э.).\n" + +"Содержание\n" + +"[убрать]\n" + +"\n" + +" * 1 Древний Китай\n" + +" * 2 Государство Шан-Инь\n" + +" * 3 Государство Чжоу (XI—III вв. до н. э.)\n" + +" * 4 Империя Цинь\n" + +" * 5 Империя Хань\n" + +" * 6 Государство Цзинь и период Нань-бэй чао (IV—VI вв.)\n" + +" * 7 Государство Суй (581—618)\n" + +" * 8 Государство Тан\n" + +" * 9 Государство Сун\n" + +" * 10 Монголы и государство Юань (1280—1368)\n" + +" * 11 Государство Мин (1368—1644)\n" + +" * 12 Государство Цин\n" + +" o 12.1 Внешняя экспансия Цин\n" + +" o 12.2 Цинский Китай и Россия\n" + +" o 12.3 Опиумные войны\n" + +" o 12.4 Японо-китайская война 1894—1895 годов\n" + +" o 12.5 Тройственная интервенция\n" + +" o 12.6 Успехи русской политики в Китае\n" + +" o 12.7 Захват Цзяочжоу Германией\n" + +" o 12.8 Сто дней реформ\n" + +" * 13 XX век\n" + +" o 13.1 Боксерское восстание\n" + +" o 13.2 Русско-японская война\n" + +" o 13.3 Смерть Цыси\n" + +" o 13.4 Аннексия Кореи\n" + +" o 13.5 Революция 1911 года и создание Китайской Республики\n" + +" o 13.6 Первая мировая война\n" + +" o 13.7 Эра милитаристов\n" + +" o 13.8 Победа Гоминьдана\n" + +" o 13.9 Японская оккупация и Вторая мировая война\n" + +" o 13.10 Создание Китайской Народной Республики\n" + +" o 13.11 Культурная революция\n" + +" o 13.12 Экономическая либерализация\n" + +" * 14 См. также\n" + +" * 15 Литература\n" + +"\n" + +"[править] Древний Китай\n" + +"\n" + +"Китайская цивилизация (предков государствообразующего этноса хань) — группа культур (Баньпо 1, Шицзя, Баньпо 2, Мяодигоу, Чжуншаньчжай 2, Хоуган 1 и др.) среднего неолита (ок. 4500-2500 до н.э.) в бассейне реки Хуанхэ, которые традиционно объединяются общим названием Яншао. Представители этих культур выращивали зерновые (чумиза и др.) и занимались разведением скота (свиньи). Позднее в этом районе появились ближневосточные виды злаков (пшеница и ячмень) и породы домашнего скота (коровы, овцы, козы).\n" + +"\n" + +"[править] Государство Шан-Инь\n" + +"\n" + +"Первым известным государством бронзового века на территории Китая было государство Шан-Инь, сформировавшееся в XIV веке до н. э. в среднем течении реки Хуанхэ, в районе Аньяна.\n" + +"\n" + +"В результате войн с соседними племенами его территория расширилась и к XI веку до н. э. охватывала территории современных провинций Хэнань и Шаньси, а также часть территории провинций Шэньси и Хэбэй. Уже тогда появились зачатки лунного календаря и возникла письменность — прообраз современного иероглифического китайского письма. Иньцы значительно превосходили окружающие их племена и с военной точки зрения — у них было профессиональное войско, использовавшее бронзовое оружие, луки, копья и боевые колесницы. Иньцы практиковали человеческие жертвоприношения — чаще всего в жертву приносились пленные.\n" + +"\n" + +"В XI веке до н. э. государство Инь было завоёвано немногочисленным западным племенем Чжоу, которое до этого находилось в вассальных отношениях с иньцами, но постепенно укрепилось и создало коалицию племён.\n" + +"\n" + +"[править] Государство Чжоу (XI—III вв. до н. э.)\n" + +"Китайская медная монета в виде мотыги. Провинция Лоян, V-III в. до н.э.\n" + +"Китайская медная монета в виде мотыги. Провинция Лоян, V-III в. до н.э.\n" + +"\n" + +"Обширная территория государства Чжоу, охватывавшая практически весь бассейн Хуанхэ, со временем распалась на множество соперничающих между собой самостоятельных государственных образований — изначально, наследственных уделов на территориях, заселённых различными племенами и расположенных на удалении от столиц — Цзунчжоу (западной - около г. Сиань) и Чэнчжоу (восточной - Лои, Лоян). Эти уделы предоставлялись во владение родственникам и приближённым верховного правителя — обычно чжоусцам. В междоусобной борьбе число первоначальных уделов постепенно сокращалось, а сами уделы укреплялись и становились более самостоятельными.\n" + +"\n" + +"Население Чжоу было разнородным, причём наиболее крупную и развитую его часть составляли иньцы. В государстве Чжоу значительная часть иньцев была расселена на новых землях на востоке, где была построена новая столица — Чэнчжоу (современная провинция Хэнань).\n" + +"\n" + +"Для периода Чжоу в целом характерно активное освоение новых земель, расселение и этническое смешивание выходцев из различных районов, уделов (впоследствии — царств), что способствовало созданию фундамента будущей китайской общности.\n" + +"\n" + +"Период Чжоу (XI—III вв. до н. э.) делится на так называемые Западное и Восточное Чжоу, что связано с переездом правителя Чжоу в 770 до н. э. под угрозой нашествия варварских племён из Цзунчжоу — первоначальной столицы государства — в Чэнчжоу. Земли в районе старой столицы были отданы одному из союзников правителя государства, который создал здесь новый удел Цинь. Впоследствии именно этот удел станет центром единой китайской империи.\n" + +"\n" + +"Период Восточное Чжоу, в свою очередь, разделяется на два периода:\n" + +"\n" + +" * Чуньцю ( «Период Весны и Осени» VIII—V вв. до н. э.);\n" + +" * Чжаньго («Период Сражающихся царств», V—III вв. до н. э.).\n" + +"\n" + +"В период Восточного Чжоу власть центрального правителя — вана, сына Неба (тянь-цзы), правящего Поднебесной по Мандату Неба (тянь-мин), — постепенно ослабла, а ведущую политическую роль стали играть сильные уделы, превращавшиеся в крупные царства. Большинство из них (за исключением окраинных) именовали себя «срединными государствами» (чжун-го), ведущими своё происхождение от раннечжоуских уделов.\n" + +"\n" + +"В период Восточного Чжоу формируются основные философские школы древнего Китая — конфуцианство (VI—V вв. до н. э.), моизм (V в. до н. э.), даосизм (IV в. до н. э.), легизм.\n" + +"\n" + +"В V—III вв. до н.э. (период Чжаньго) Китай вступает в железный век. Расширяются сельскохозяйственные площади, увеличиваются ирригационные системы, развиваются ремёсла, революционные изменения происходят в военном деле.\n" + +"\n" + +"В период Чжаньго на территории Китая сосуществовало семь крупнейших царств — Вэй, Чжао и Хань (ранее все три входили в царство Цзинь), Цинь, Ци, Янь и Чу. Постепенно в результате ожесточённого соперничества верх стало одерживать самое западное — Цинь. Присоединив одно за другим соседние царства, в 221 до н. э. правитель Цинь — будущий император Цинь Ши Хуан — объединил весь Китай под своей властью.\n" + +"\n" + +"Так в середине III века до н. э. завершился период Восточного Чжоу.\n" + +"\n" + +"[править] Империя Цинь\n" + +"\n" + +"Объединив древнекитайские царства, император Цинь Ши Хуан конфисковал всё оружие у населения, переселил десятки тысяч семей наследственной знати из различных царств в новую столицу — Сяньян и разделил огромную страну на 36 новых областей, которые возглавили назначаемые губернаторы.\n" + +"\n" + +"При Цинь Шихуанди были соединены оборонительные стены (валы) северных чжоуских царств и создана Великая китайская стена. Было сооружено несколько стратегических дорог из столицы на окраины империи. В результате успешных войн на севере гунны (сюнну) были оттеснены за Великую стену. На юге к империи были присоединены значительные территории племён юэ, в том числе северная часть современного Вьетнама.\n" + +"Строительство Великой китайской стены, протянувшейся на более чем 6700 км, было начато в III веке до н. э. для защиты северных районов Китая от набегов кочевников.\n" + +"Строительство Великой китайской стены, протянувшейся на более чем 6700 км, было начато в III веке до н. э. для защиты северных районов Китая от набегов кочевников.\n" + +"\n" + +"Цинь Шихуанди, строивший все свои реформы на основах легизма с казарменной дисциплиной и жестокими наказаниями провинившихся, преследовал конфуцианцев, предавая их казни (погребение заживо) и сжигая их сочинения — за то, что они смели выступать против установившегося в стране жесточайшего гнёта.\n" + +"\n" + +"Империя Цинь прекратила существование вскоре после смерти Цинь Шихуанди.\n" + +"\n" + +"[править] Империя Хань\n" + +"\n" + +"Вторую в истории Китая империю, получившую название Хань (206 до н. э.—220 н. э.) основал выходец из среднего чиновничества Лю Бан (Гао-цзу), один из военачальников возрожденного царства Чу, воевавших против Цинь после смерти императора Цинь Шихуана в 210 г. до н.э.\n" + +"\n" + +"Китай в это время переживал экономический и социальный кризис, вызванный потерей управляемости и войнами военачальников циньских армий с элитами уничтоженных раннее царств, пытавшихся восстановить свою государственность. Из-за переселений и войн значительно сократилась численность сельского населения в основных аграрных районах.\n" + +"\n" + +"Важная особенность смены династий в Китае состояла в том, что каждая новая династия приходила на смену предыдущей в обстановке социально-экономического кризиса, ослабления центральной власти и войн между военачальниками. Основателем нового государства становился тот из них, кто мог захватить столицу и насильственно отстранить правившего императора от власти.\n" + +"\n" + +"С правления Гао-цзу (206–195 до н.э.) начинается новый период китайской истории, который получил название Западная Хань.\n" + +"\n" + +"При императоре У-ди (140—87 до н. э.) была взята на вооружение иная философия — восстановленное и реформированное конфуцианство, которое стало господствующей официальной идеологией вместо дискредитировавшего себя легизма с его жёсткими нормами и бесчеловечной практикой. Именно с этого времени берёт своё начало китайская конфуцианская империя.\n" + +"\n" + +"При нем территория ханьской империи значительно расширяется. Были уничтожены вьетское государство Намвьет (территория современной провинции Гуандун, Гуанси-Чжуанского автономного района и север Индокитайского полуострова), вьетские государства в южных частях современных провинций Чжэцзян и Фуцзянь, корейское государство Чосон, присоеденены земли на юго-западе, сюнну оттеснены далее на севере.\n" + +"\n" + +"Китайский путешественник Чжан Цянь проникает далеко на запад и описывает многие страны Средней Азии (Фергана, Бактрия, Парфия и др.). Вдоль пройденного им маршрута прокладывается торговый путь через Джунгарию и Восточный Туркестан в страны Средней Азии и Ближнего Востока — так называемый «Великий шёлковый путь». Империя на некоторое время подчиняет себе оазисы-протогосударства вдоль Шёлкового пути и распространяет своё влияние до Памира.\n" + +"\n" + +"В I в. н. э. в Китай из Индии начинает проникать буддизм.\n" + +"\n" + +"В период с 8 по 23 гг. н. э. власть захватывает Ван Ман, провозглашающий себя императором и основателем государства Синь. Начинается ряд преобразований, который прерывается экологической катастрофой - река Хуанхэ изменила русло. Из-за трехлетнего голода центральная власть ослабла. В этих условиях началось движение представителей рода Лю за возвращение престола. Ван Ман был убит, столица взята, власть возвратилась династии Лю.\n" + +"\n" + +"Новый период получил название Восточная Хань, он продлился до 220 г. н. э.\n" + +"\n" + +"[править] Государство Цзинь и период Нань-бэй чао (IV—VI вв.)\n" + +"\n" + +"Восточную Хань сменил период Троецарствия (Вэй, Шу и У). В ходе борьбы за власть между военачальниками было основано новое государство Цзинь (265—420).\n" + +"\n" + +"В начале IV века Китай подвергается нашествию кочевников — сюнну (гуннов), сяньбийцев, цянов, цзе и др. Весь Северный Китай был захвачен кочевниками, которые создали здесь свои царства, так называемые 16 варварских государств Китая. Значительная часть китайской знати бежала на юг и юго-восток, основанное там государство получило название Восточная Цзинь.\n" + +"\n" + +"Кочевники приходят волнами, одна за другой, и после каждой из этих волн в Северном Китае возникают новые царства и правящие династии, которые, однако, принимают классические китайские названия (Чжао, Янь, Лян, Цинь, Вэй и др.).\n" + +"\n" + +"В это время, с одной стороны, происходит варваризация образа жизни оседлых китайцев — разгул жестокости, произвола, массовых убийств, нестабильности, казней и бесконечных переворотов. А с другой стороны, пришельцы-кочевники активно стремятся использовыть китайский опыт управления и китайскую культуру для стабилизации и упрочения своей власти — мощь китайской конфуцианской цивилизации в конечном счёте гасит волны нашествий варварских племён, которые подвергаются китаизации. К концу VI века потомки кочевников практически полностью ассимилируются с китайцами.\n" + +"\n" + +"На севере Китая верх в столетней борьбе между некитайскими царствами берёт сяньбийское государство Тоба Вэй (Северная Вэй), объединившее под своей властью весь Северный Китай (бассейн Хуанхэ) и к концу V века в борьбе против южнокитайского государства Сун распространившее своё влияние до берегов Янцзы. При этом уже в VI веке, как было сказано, захватчики-сяньбийцы ассимилировались с подавляющим большинством местного населения.\n" + +"\n" + +"С началом варварских вторжений на север Китая, сопровождавшихся массовым уничтожением и порабощением местного населения, до миллиона местных жителей — в первую очередь знатных, богатых и образованных, включая императорский двор, — перебрались на юг, в районы, сравнительно недавно присоединённые к империи. Пришельцы с севера, заселив речные долины, активно занялись выращиванием риса и постепенно превратили Южный Китай в основной земледельческий район империи. Уже в V веке здесь стали собирать по два урожая риса в год. Резко ускорилась китаизация и ассимиляция местного населения, колонизация новых земель, строительство новых городов и развитие старых. На юге сосредоточился центр китайской культуры.\n" + +"\n" + +"Одновременно здесь укрепляет свои позиции буддизм — на севере и юге построено уже несколько десятков тысяч монастырей с более чем 2 млн. монахов. В немалой степени распространению буддизма способствует ослабление официальной религии — конфуцианства — в связи с варварскими вторжениями и междоусобицами. Первыми китайскими буддистами, способствовавшими популяризации новой религии, были приверженцы даосизма — именно с их помощью переводились с санскрита на китайский древние буддийские тексты. Буддизм постепенно стал процветающей религией.\n" + +"\n" + +"[править] Государство Суй (581—618)\n" + +"\n" + +"Процесс китаизации варваризованного севера и колонизованного юга создаёт предпосылки для нового объединения страны. В 581 севернокитайский полководец Чжоу Ян Цзянь объединяет под своей властью весь Северный Китай и провозглашает новую династию Суй (581—618), а после уничтожения южнокитайского государства Чэнь возглавляет объединённый Китай. В начале VII века его сын Ян Ди ведёт войны против корейского государства Когурё (611 - 614) и вьетнамского государства Вансуан, строит Великий канал между Хуанхэ и Янцзы для транспортировки риса с юга в столицу, создаёт роскошные дворцы в столице Лоян, восстанавливает и строит новые участки Великой китайской стены, пришедшей в упадок за тысячу лет.\n" + +"\n" + +"Подданные не выдерживают тягот и лишений и восстают. Ян Ди убивают, а династию Суй сменяет династия Тан (618—907), основатель — шансийский феодал Ли Юань.\n" + +"\n" + +"[править] Государство Тан\n" + +"\n" + +"Правители из династии Лю покончили с выступлениями знати и провели ряд успешных преобразований. Происходит разделение страны на 10 провинций, была восстановлена \"надельная система\", усовершенствовано административное законодательство, укреплена вертикаль власти, оживились торговля и городская жизнь. Значительно увеличились размеры многих городов и численность городского населения.\n" + +"\n" + +"К концу VII века усилившееся военное могущество Танской империи приводит к расширению территории Китая за счёт Восточно-Тюркского и Западно-Тюркского каганатов. Государства, расположенные в Джунгарии и Восточном Туркестане, на некоторое время становятся данниками Китая. Корейское государство Когурё покорено и становится Аньдунским наместничеством Китая. Вновь открыт Великий шёлковый путь.\n" + +"\n" + +"В VIII—X вв. в Китае получают распространение новые сельскохозяйственные культуры — в частности, чай, хлопок.\n" + +"\n" + +"Развивается морская торговля, главным образом через Гуанчжоу (Кантон), с Индией и Ираном, Арабским Халифатом, корейским государством Силла и Японией.\n" + +"\n" + +"В VIII веке империю Тан ослабляют конфликты между центральной властью и военными наместниками на периферии. Окончательно господство династии Лю подрывает война Хуан Чао за престол 874—901.\n" + +"\n" + +"В течение долгого времени (907—960) в стране не удаётся восстановить единую государственную власть, что связано с междоусобными войнами, особенно на севере страны.\n" + +"\n" + +"[править] Государство Сун\n" + +"\n" + +"В 960 военачальник Чжао Куан-инь основывает династию Сун (960—1279). Все три столетия Сун прошли под знаком успешного давления на Китай со стороны северных степных народов.\n" + +"\n" + +"Ещё в начале X века усилилось развитие и консолидация протомонгольской этнической общности киданей, соседствовавшей с Китаем на северо-востоке. Государство киданей, основанное в 916 и существовавшее по 1125, получило название Ляо. Активно укрепляясь на северных рубежах, кидани отторгли часть китайских территорий (часть современных провинций Хэбэй и Шаньси). Основы управления в государстве Ляо были созданы китайцами и корейцами, на основе китайских иероглифов и из китайских элементов письма была создана письменность, развивались города, ремёсла, торговля. Не сумев справиться с соседями и вернуть утраченные территории, Сунская империя была вынуждена пойти на подписание в 1004 мирного договора и согласиться на выплату дани. В 1042 дань была увеличена, а в 1075 Китай отдал киданям ещё часть своей территории.\n" + +"\n" + +"В то же время на северо-западных окраинах Сунской империи, к западу от киданей, на рубеже X—XI вв. складывается сильное государство тангутов — Западное Ся. Тангуты отторгли от Китая часть современной провинции Шэньси, целиком территорию современной провинции Ганьсу и Нинся-Хуэйского автономного района. С 1047 Сунской империи пришлось и тангутам платить дань серебром и шёлком.\n" + +"\n" + +"Несмотря на вынужденные территориальные уступки соседям период Сун считается эпохой экономического и культурного расцвета Китая. Растёт число городов, продолжается рост численности городского населения, китайские ремесленники достигают высот в изготовлении изделий из фарфора, шёлка, лака, дерева, слоновой кости и др. Изобретены порох и компас, распространяется книгопечатание, выводятся новые высокоурожайные сорта зерновых, увеличиваются посевы хлопка. Одной из наиболее впечатляющих и эффективных из данных инноваций было вполне сознательное, систематическое и хорошо организованное внедрение и распространение новых сортов скороспелого риса из Южного Вьетнама (Чампы).\n" + +"Чжан Цзэдуань. «По реке в День поминовения усопших» (XII век).\n" + +"Чжан Цзэдуань. «По реке в День поминовения усопших» (XII век).\n" + +"\n" + +"В XII веке Китаю приходится отдать ещё большую территорию новым захватчикам — южноманьчжурским чжурчжэням, создавшим (на базе уничтоженной ими в 1125 империи киданей Ляо) государство (впоследствии — империю) Цзинь (1115—1234), границы которой проходили по р. Хуайхэ. При этом часть разбитых киданей ушла на запад, где в районе рек Талас и Чу сложилось небольшое государство кара-китаев — Западное Ляо (1124—1211).\n" + +"\n" + +"В 1127 чжурчжэни захватывают столицу империи Сун — Кайфын и берут в плен императорскую семью. Один из сыновей императора бежит на юг, в Ханчжоу, который впоследствии становится столицей новой — южносунской империи (1127—1280). Продвижение армии чжурчжэней на юг сдерживает лишь река Янцзы. Граница между Цзинь и южносунской империей устанавливается по междуречью Хуанхэ и Янцзы. Северный Китай вновь на длительное время оказывается под господством иноземных завоевателей.\n" + +"\n" + +"В 1141 подписан мирный договор, согласно которому Сунская империя признаёт себя вассалом империи Цзинь и обязуется платить ей дань.\n" + +"\n" + +"[править] Монголы и государство Юань (1280—1368)\n" + +"\n" + +"В начале XIII века в Китай вторгаются монголы. До XIII века монголы являлись частью большой степной общности, которую китайцы называли \"татарами\". Их предшественники — протомонгольские и раннемонгольские группы и народы, одним из которых были кидани, представляли собой степных кочевников, разводивших лошадей и рогатый скот, кочевавших от пастбища к пастбищу и организованных в небольшие родоплеменные коллективы, связанные общностью происхождения, языка, культуры и т. п.\n" + +"\n" + +"Соседство развитой китайской цивилизации способствовало ускорению процесса создания племён, а затем и мощных племенных союзов во главе с влиятельными вождями. В 1206 на всемонгольском курултае вождём всех монголов был провозглашён победивший в жестокой междоусобной борьбе Темучин, принявший имя и титул Чингисхана.\n" + +"\n" + +"Чингисхан создал организованную и боеспособную армию, которая и стала решающим фактором в последующих успехах сравнительно немногочисленного монгольского этноса.\n" + +"\n" + +"Покорив соседние народы Южной Сибири, Чингисхан в 1210 пошёл войной на чжурчжэней и в 1215 взял Пекин.\n" + +"\n" + +"В 1219—1221 была разорена Средняя Азия и разбито государство Хорезмшахов. В 1223 — разбиты русские князья, в 1226—1227 — уничтожено государство тангутов. В 1231 основные силы монголов вернулись в Северный Китай и к 1234 завершили разгром чжурчжэньского государства Цзинь.\n" + +"\n" + +"Завоевания в Южном Китае были продолжены уже в 1250-х, после походов в Европу и на Ближний и Средний Восток. Вначале монголы захватили страны, окружавшие Южно-Сунскую империю — государство Дали (1252—1253), Тибет (1253). В 1258 монгольские войска под предводительством хана Хубилая с разных сторон вторглись в Южный Китай, но осуществлению их планов помешала неожиданная смерть Великого хана Мункэ (1259). Хан Хубилай, захватив ханский престол, в 1260 перенёс столицу из Каракорума на территорию Китая (сначала в Кайпин, а в 1264 в Чжунду — современный Пекин). Столицу южносунского государства Ханчжоу монголам удалось взять лишь в 1276. К 1280 весь Китай был завоёван, а Сунская империя — уничтожена.\n" + +"\n" + +"После покорения Китая хан Хубилай основывает новую династию Юань (1271—1368), на службу новой власти привлекаются кидани, чжурчжэни, тюрки и даже европейцы — в частности, в это время Китай посещает венецианский купец Марко Поло.\n" + +"\n" + +"Тяжёлый экономический, политический и национальный гнёт, установленный монгольскими феодалами, сдерживает развитие страны. Множество китайцев было обращено в рабство. Земледелие и торговля были подорваны. Не выполнялись необходимые работы по поддержанию ирригационных сооружений (дамб и каналов), что привело в 1334 к чудовищному наводнению и гибели нескольких сот тысяч человек. Великтий Китайский канал был построен во время монгольского господства.\n" + +"\n" + +"Народное недовольство новыми правителями вылилось в мощное патриотическое движение и восстания, которые возглавили руководители тайного общества «Белый лотос» (Байляньцзяо).\n" + +"\n" + +"[править] Государство Мин (1368—1644)\n" + +"\n" + +"В результате длительной борьбы в середине XIV века монголы были изгнаны. К власти пришёл один из руководителей восстания — сын крестьянина Чжу Юаньчжан, основавший государствоМин (1368—1644).\n" + +"\n" + +"Монголы, оттеснённые на север, приступают к активному освоению степей современной Монголии. Империя Мин подчиняет себе часть чжурчжэньских племён, государство Наньчжао (современные провинции Юньнань и Гуйчжоу), часть современных провинций Цинхай и Сычуань.\n" + +"\n" + +"Китайский флот под командой Чжэн Хэ, состоящий из нескольких десятков многопалубных фрегатов, за период с 1405 по 1433 совершает несколько морских экспедиций в Юго-Восточную Азию, Индию и к восточному побережью Африки. Не принеся Китаю никакой экономической выгоды, экспедиции были прекращены, а корабли — разобраны.\n" + +"\n" + +"В XVI веке происходит первая попытка усилившейся Японии вторгнуться в Китай и Корею. В это же время в Китай проникают европейцы — португальцы, испанцы, голландцы. В 1557 Португалия овладела на правах «аренды» китайской территорией Аомынь (Макао). В Китае появляются и христианские миссионеры — иезуиты. Они привезли в Китай новые инструменты и механизмы — часы, астрономические приборы, наладили здесь производство огнестрельного оружия. В то же время они занимаются доскональным изучением Китая.\n" + +"\n" + +"[править] Государство Цин\n" + +"\n" + +"К концу XVI века северные соседи империи Мин — потомки чжурчжэньских племён, разбитых в своё время Чингисханом, — объединяются вокруг владения Маньчжоу под предводительством вождя Нурхаци (1559—1626). В 1609 Нурхаци прекращает платить дань Китаю, а затем провозглашает собственную династию Цзинь. С 1618 маньчжуры усиливают вооружённое давление на Китай. За восемь лет они выходят практически к Великой китайской стене (на крайнем востоке).\n" + +"\n" + +"Преемник Нурхаци Абахай провозглашает себя императором и меняет название династии на Цин. В начале XVII века маньчжуры завоевали Южную (Внутреннюю) Монголию. На всей территории Южной Маньчжурии и захваченных ханств Южной Монголии устанавливается централизованная администрация.\n" + +"\n" + +"Маньчжурская конница, поддержанная внутренними монголами, начинает совершать регулярные набеги на Китай, грабя и обращая в рабство сотни тысяч китайцев. Императору Мин приходится направить на северные рубежи свою лучшую армию под командованием У Саньгуя. Тем временем в Китае разгорается очередное крестьянское восстание. В 1644 крестьянские отряды под предводительством Ли Цзычэна, разгромив все остальные армии, занимают Пекин, а сам Ли Цзычэн провозглашает себя императором. У Саньгуй пропускает маньчжурскую конницу на Пекин. 6 июня 1644 маньчжуры захватывают столицу. Ли Цзычэн вскоре гибнет, а маньчжуры объявляют своего малолетнего императора Шуньчжи правителем всего Китая. У Саньгуй вместе со всей армией переходит на службу к завоевателям.\n" + +"\n" + +"Борьба против маньчжурских захватчиков продолжается ещё долго, но ослабленный Китай не в силах противостоять хорошо вооружённому и организованному войску. Последний оплот сопротивления — Тайвань захвачен маньчжурами в 1683.\n" + +"\n" + +"Маньчжурская династия в государстве Цин правила с 1644 по 1911 год. В руках маньчжурской знати находились высшие органы власти и руководство армией. Смешанные браки были запрещены, и тем не менее маньчжуры быстро китаизировались, тем более что, в отличие от монголов, они не противопоставляли себя китайской культуре.\n" + +"\n" + +"Начиная с Канси (годы правления 1662—1723), маньчжурские императоры были ревностными конфуцианцами, управляя страной по древним законам. Китай под властью династии Цин в XVII—XVIII вв. развивался достаточно интенсивно. К началу XIX века в Китае насчитывалось уже около 300 млн. человек — примерно в пять раз больше, чем в среднем на протяжении предыдущих двух тысяч лет. Демографическое давление привело к необходимости интенсификации сельского хозяйственного производства при активном участии государства. Маньчжуры обеспечили покорность китайского населения, но при этом заботились о процветании экономики страны и благосостоянии народа.\n" + +"\n" + +"[править] Внешняя экспансия Цин\n" + +"\n" + +"Правители государства Цин проводили политику изоляции Китая от внешнего мира. Европейская колонизация почти не затронула Китай. Католические миссионеры играли заметную роль при императорском дворе до конца XVII века, после чего христианские церкви были постепенно закрыты, а миссионеры — высланы из страны. В середине XVIII века была ликвидирована торговля с европейцами, за исключением одного порта в Кантоне (Гуанчжоу). Опорным пунктом иностранной торговли оставался остров Макао, находившийся под контролем португальцев.\n" + +"\n" + +"В первые два столетия цинской династии Китай, закрытый от повседневных контактов с внешним миром, проявлял себя как сильное независимое государство, осуществляющее экспансию во всех направлениях.\n" + +"\n" + +"Вассалом Китая была Корея. В середине XVIII века в империю вошла Северная (Внешняя) Монголия. В 1757 было уничтожено Джунгарское ханство, и территория его вместе с покорённым к 1760 Восточным Туркестаном была включена в состав Цинской империи под названием Синьцзян («Новая граница»). После ряда походов маньчжуро-китайской армии против Тибета этот район был в конце XVIII века присоединён к Цинской империи. Войны Цинской империи против Бирмы (1765—1769) и Вьетнама (1788—1789) оказались неудачными и закончились поражением цинских войск.\n" + +"\n" + +"Одновременно осуществлялась экспансия на север и северо-восток, что неминуемо привело к конфликту с Россией в Приамурье. В течение двух веков территория Китая увеличилась практически вдвое. Цинская империя обзавелась своего рода буферными зонами — Маньчжурией, Монголией, Тибетом, Синьцзяном — которые охраняли китайские земли.\n" + +"\n" + +"В цинском Китае любые официальные представители иностранных государств рассматривались исключительно как представители вассальных государств — реальных или потенциальных.\n" + +"\n" + +"[править] Цинский Китай и Россия\n" + +"\n" + +" Основная статья: Российско-китайские отношения\n" + +"\n" + +"Первые шаги по установлению русско-китайских отношений были предприняты Россией в конце периода Мин (миссия И. Петлина в 1618—1619), но основные миссии (Фёдора Байкова в 1654—1657, Николая Спафария в 1675—1678 и др.) последовали уже в цинский период. Параллельно с миссиями шло продвижение на восток русских казаков — походы первопроходцев Василия Пояркова (1643—1646) и Ерофея Хабарова (1649—1653) положили начало освоению русскими людьми Приамурья и привели к присоединению его к России, в то время как маньчжуры считали эти районы своей вотчиной.\n" + +"\n" + +"В середине XVII века на обоих берегах Амура уже существовали русские крепости-остроги (Албазинский, Кумарский и др.), крестьянские слободы и пашни. В 1656 было образовано Даурское (позднее — Албазинское) воеводство, в которое входила долина Верхнего и Среднего Амура по обоим берегам.\n" + +"\n" + +"Хотя граница империи Цин тогда проходила чуть севернее Ляодунского полуострова («Ивовый палисад»), в 1650-е годы и позднее Цинская империя попыталась военной силой захватить русские владения в бассейне Амура и предотвратить принятие местными племенами российского подданства. Маньчжурское войско на какое-то время вытеснило казаков из крепости Албазин. Вслед за миссиями Фёдора Байкова и Николая Спафария Россия направила в 1686 к пограничным властям на Амуре полномочное посольство Фёдора Головина для мирного урегулирования конфликта.\n" + +"\n" + +"Переговоры велись в окружении многотысячной маньчжурской армии. С китайской стороны в переговорах участвовали миссионеры-иезуиты, противившиеся соглашению Китая с Россией, что ещё более осложняло обстановку. Китай отказался определить русско-китайскую границу по Амуру, потребовав себе всё Албазинское воеводство, всё Забайкалье, а впоследствии — вообще все земли к востоку от Лены.\n" + +"\n" + +"Угрожая захватить Нерчинск штурмом, цинские представители вынудили Головина согласиться на уход русских с Верхнего и Среднего Амура. По Нерчинскому договору Россия была вынуждена уступить Цинской империи свои владения по правому берегу р. Аргунь и на части левого и правого берегов Амура. Казаки были обязаны разрушить и оставить Албазин. Вследствие разночтений в текстах договора, составленных каждой из сторон, однако, большая территория оказалась неразграниченной и фактически превратилась в буферную зону между двумя государствами. Разграничение между Россией и Китаем в пределах этой зоны завершилось в XIX веке. Окончательно граница России с Китаем на Дальнем Востоке была определена Айгуньским (1858) и Пекинским (1860) договорами; она прошла по рекам Амур и Уссури через озеро Ханка и горные хребты до р. Туманьцзян; русско-китайское территориальное разграничение в Центральной Азии было завершено к середине 1890-х.\n" + +"\n" + +"[править] Опиумные войны\n" + +"Территория собственно Китая в 1875\n" + +"Территория собственно Китая в 1875\n" + +"\n" + +"К концу XVIII века торговля Китая с внешним миром вновь начала расширяться. Китайский шёлк, фарфор, чай и другие товары пользовались большим спросом в Европе, но китайцы отказывались что-либо покупать у европейцев, так что тем приходилось платить серебром за китайские товары. Тогда англичане начали ввозить в Китай опиум — в основном контрабандой из Индии — и вскоре приобщили к курению опиума местное население, особенно в приморских районах. Ввоз опиума постоянно возрастал и стал подлинным бедствием для страны, что привело к серии Опиумных войн в середине XIX века. Поражение в этих войнах привело к постепенному превращению Китая в фактическую полуколонию европейских держав.\n" + +"\n" + +"[править] Японо-китайская война 1894—1895 годов\n" + +"\n" + +"В 1874 году Япония захватила Формозу, однако вынуждена была покинуть её по требованию Англии. Тогда Япония обратила свои усилия на Корею, находившуюся в вассальной зависимости от Китая и Манчжурию. В июне 1894 по просьбе корейского правительства Китай направил войска в Корею для подавления крестьянского восстания. Воспользовавшись этим предлогом, Япония также направила сюда свои войска, после чего потребовала от корейского короля проведения «реформ», означавших фактически установление в Корее японского контроля.\n" + +"\n" + +"В ночь на 23 июля при поддержке японских войск в Сеуле был организован правительственный переворот. Новое правительство 27 июля обратилось к Японии с «просьбой» об изгнании китайских войск из Кореи. Однако ещё 25 июля японский флот уже без объявления войны начал военные действия против Китая; официальное объявление войны последовало только 1 августа 1894. Началась Японо-китайская война\n" + +"\n" + +"В ходе войны превосходство японской армии и флота привело к крупным поражениям Китая на суше и на море (под Асаном, июль 1894; под Пхеньяном, сентябрь 1894; при Цзюляне, октябрь 1894).\n" + +"\n" + +"С 24 октября 1894 военные действия перешли на территорию Северо-Восточного Китая. К марту 1895 японские войска захватили Ляодунский полуостров, Вэйхайвэй, Инкоу, под угрозой находился Мукден.\n" + +"\n" + +"17 апреля 1895 в Симоносеки представители Японии и Китая подписали унизительный для Китая Симоносекский договор.\n" + +"\n" + +"[править] Тройственная интервенция\n" + +"\n" + +"Условия, навязанные Японией Китаю, привели к так называемой \"тройственной интервенции\" России, Германии и Франции - держав, которые к этому времени уже поддерживали обширные контакты с Китаем и поэтому восприняли подписанный договор как наносящий ущерб их интересам. 23 апреля 1895 Россия, Германия и Франция одновременно, но по отдельности обратились к японскому правительству с требованием отказа от аннексии Ляодунского полуострова, которая могла бы привести к установлению японского контроля над Порт-Артуром, в то время как Николай II, поддерживаемый западными союзниками, имел собственные виды на Порт-Артур как незамерзающий порт для России. Германская нота была наиболее жесткой, даже оскорбительной для Японии.\n" + +"\n" + +"Японии пришлось уступить. 10 мая 1895 года японское правительство заявило о возвращении Китаю Ляодунского полуострова, правда, добившись увеличения суммы китайской контрибуции на 30 миллионов таэлей.\n" + +"\n" + +"[править] Успехи русской политики в Китае\n" + +"\n" + +"В 1895 году Россия предоставила Китаю заём в 150 миллионов рублей под 4% годовых. Договор содержал обязательство Китая не соглашаться на иностранный контроль над своими финансами, если в нём не будет участвовать Россия. В конце 1895 года по инициативе Витте был основан Русско-Китайский банк. 3 июня 1896 года в Москве был подписан русско-китайский договор об оборонительном союзе против Японии. 8 сентября 1896 года между китайским правительством и Русско-Китайским банком был подписан концессионный договор о сроительстве Китайской Восточной железной дороги. Общество КВЖД получало полосу земли вдоль дороги, которая переходила под его юрисдикцию. В марте 1898 года был подписан русско-китайский договор об аренде Россией Порт-Артура и Ляодунского полуострова.\n" + +"\n" + +"[править] Захват Цзяочжоу Германией\n" + +"\n" + +"В августе 1897 года Вильгельм II посетил Николая II в Петергофе и добился согласия на устройство немецкой военно-морской базы в Цзяочжоу (в тогдашнем варианте транскрипции - \"Киао-Чао\"), на южном побережье Шаньдуна. В начале ноября в Шаньдуне китайцами были убиты германские миссионеры. 14 ноября 1897 года немцы высадили десант на побережье Цзяочжоу и захватили его. 6 марта 1898 года было подписано германо-китайское соглашение, по которому Китай арендовал Германии Цзяочжоу сроком на 99 лет. Одновременно китайское правительство предоставило Германии концессию на постройку двух железных дорог в Шаньдуне и ряд горных концессий в этой провинции.\n" + +"\n" + +"[править] Сто дней реформ\n" + +"\n" + +"Непродолжительный период реформ начался 11 июня 1898 с издания маньчжурским императором Цзай Тянем (название годов правления — Гуансюй) указа «Об установлении основной линии государственной политики». Цзай Тянь привлек группу молодых реформаторов — учеников и единомышленников Кан Ювэя для разработки серии указов о реформах. В общей сложности было издано свыше 60 указов, которые касались системы образования, строительства железных дорог, заводов и фабрик, модернизации сельского хозяйства, развития внутренней и внешней торговли, реорганизации вооружённых сил, чистки государственного аппарата и т.д. Период радикальных реформ окончился 21 сентября того же года, когда вдовствующая Императрица Цыси произвела дворцовый переворот и отменила реформы.\n" + +"\n" + +"[править] XX век\n" + +"\n" + +"[править] Боксерское восстание\n" + +"\n" + +"В мае 1900 года в Китае началось большое восстание, получившее название боксерского или Ихэтуаньского восстания. 20 июня в Пекине был убит германский посланник Кеттелер. Вслед за этим восставшими были осаждены дипломатические миссии, находившиеся в особом квартале Пекина. Было осаждено также здание католического кафедрального собора Петанг (Бейтанг). Начались массовые убийства \"ихэтуанями\" китайцев-христиан, в том числе было убито 222 православных китайца. 21 июня 1900 года Императрица Цыси объявила войну Великобритании, Германии, Австро-Венгрии, Франции, Италии, Японии, США и России. Великие державы согласились о совместных действиях против восставших. Главнокомандующим экспедиционными силами был назначен германский генерал Вальдерзее. Однако, когда он прибыл в Китай, Пекин был уже освобожден небольшим передовым отрядом под командованием русского генерала Линевича. Русская армия заняла Манчжурию.\n" + +"\n" + +"[править] Русско-японская война\n" + +"\n" + +"8 февраля 1904 года началась Русско-японская война за контроль над Манчжурией и Кореей. Война, шедшая на территории Китая была для России неудачной, по её результатам, Россия была вынуждена уступить Японии Порт-Артур и Ляодунский полуостров с частью построенной к тому времени КВЖД.\n" + +"\n" + +"[править] Смерть Цыси\n" + +"\n" + +"14 декабря 1908 года в один день умерли Императрица Цыси и Император Гуансюй, которого Цыси ранее отстранила от власти. Возможно, Гуансюй был отравлен, так как Цыси не хотела, чтобы он её пережил. На престол взошёл Император Пу И, которому было два года. Регентом назначен его отец князь Чунь, однако вскоре власть перешла к его брату.\n" + +"\n" + +"[править] Аннексия Кореи\n" + +"\n" + +"В 1910 году Япония аннексировала Корею, хотя японские войска там находились с начала Русско-японской войны.\n" + +"\n" + +"[править] Революция 1911 года и создание Китайской Республики\n" + +"\n" + +"В 1911 году в Китае началось Учанское восстание. Оно стало началом Синьхайской революции (1911—1913) в Китае, в результате которой было свергнута маньчжурская династия Цин и провозглашено создание Китайской республики.\n" + +"\n" + +"После падения монархии правитель Монголии отказался повиноваться республике и отделился от Китая. 3 ноября им было заключено соглашение с Россией. Англия воспользовалась внутренней борьбой в Китае для превращения Тибета в свою зону влияния. Тибет поднялся на борьбу и заставил китайский гарнизон покинуть страну. Все последующие попытки китайцев восстановить там свою власть пресекались Британией. Россия согласилась считать Тибет английской сферой влияния, а Англия признала русские интересы в независимой (внешней) Монголии.\n" + +"\n" + +"12 февраля 1912 года Император Пу И отрекся от престола. К власти пришел генерал Юань Шикай премьер-министр и главнокомандующий армией. Вскоре он был провозглашен президентом Китая.\n" + +"\n" + +"В 1913 году произошла \"Вторая революция\". Юань Шикай подавил разрозненные выступления в центральных и южных провинциях. В стране устанавливается военная диктатура Юань Шикая, основателя группировки бэйянских (северных) милитаристов. Сунь Ятсен вынужден эмигрировать за границу.\n" + +"\n" + +"[править] Первая мировая война\n" + +"\n" + +"После начала первой мировой войны китайское правительство объявляет о своем нейтралитете и просит воюющие державы не переносить военные действия на территорию Китая, в том числе и на \"арендованные\" державами китайские земли. Однако 22 августа 1914 года Япония объявила о своем состоянии войны с Германией и высадила 30-тысячную армию севернее Циндао - центра немецкой колонии в провинции Шаньдун. После двухмесячной военной кампании Япония захватила германские владения в Шаньдуне, а также распространила свой контроль на всю территорию провинции.\n" + +"\n" + +"В 1915 году китайские принцы голосуют за установленче в Китае монархии с Юанем Шикаем на императорском троне. Распускается парламент. Объявляется монархия. Это вызывает ряд восстаний в провинциях Китая. Независимость от Пекина объявляют провинции Юньнань, Гуйчжоу и Гуанси. Потом отделяются Гуандун, Чжэцзян, Сычуань и Хунань.\n" + +"\n" + +"22 марта 1916 года умирает Юань Шикай.\n" + +"\n" + +"[править] Эра милитаристов\n" + +"\n" + +"После смерти Юань Шикая в Китае начали оформляться многочисленные военно-феодальные вотчины различных милитаристских группировок. Наиболее крупной была бэйянская (северная), делившаяся на фэнтяньскую (маньчжурскую) во главе с бывшим главарем шайки хунхузов Чжан Цзолинем, чжилийскую во главе с генералом Фэн Гочжаном, и аньхойскую во главе с генералом Дуань Цижуем. В провинции Шаньси господствовал милитарист Янь Сишань, заигрывавший с бэйянской группировкой, а в провинции Шэньси - генерал Чэнь Шуфань. Лагерь юго-западных милитаристов состоял из двух крупных группировок: юньнаньской во главе с генералом Тан Цзияо, и гуансийской во главе с генералом Лу Жунтином.\n" + +"\n" + +"Под контролем фэнтяньской группировки находились провинции Хэйлунцзян, Гирин и Фэнтянь, под контролем чжилийской - Шаньдун, Цзянсу, Чжэцзян, Фуцзянь, Цзянси, Хунань, Хубэй и часть Чжили. Фэнтяньская и аньхойская клики финансировались Японией, чжилийская - Англией и США. Ли Юаньхун был ставленником юго-западных милитаристов. Вице-президент генерал Фэн Гочжан ориентировался на Англию и США, а премьер-министр генерал Дуань Цижуй держался прояпонского направления. В 1917 году Япония начала предоставлять Дуань Цижую крупные займы, получая за них все новые и новые уступки, в том числе концессии в Маньчжурии.\n" + +"\n" + +"[править] Победа Гоминьдана\n" + +"\n" + +"Партия Гоминьдан была создана в 1912 году в провинции Гуанчжоу. Примерно в тоже время, в 1921 г., была создана и Китайская коммунистическая партия, малочисленная и не пользовавшаяся в тот период особой популярностью. 8 сентября 1923 в Китай по просьбе Сунь Ятсена, который просил прислать ему человека с которым он мог бы говорить по-английски без переводчика, прибыл агент коминтерна М.М.Бородин, ставший политическим советником ЦИК Гоминьдана и советником Сунь Ятсена. Он организовал сотрудничество между Гоминьданом и КПК. 20 января 1924 г. проходит I Всекитайский съезд Гоминьдана в Гуанчжоу. На съезде был принят курс на союз с китайскими коммунистами и СССР. 16 июня учреждена Военная академия Вампу под руководством Чан Кайши. В первый набор было зачислено 400, во второй - 500, в третий - 800 и четвертый - около 2600 слушателей; при школе было создано два учебных полка. В академию Вампу прибыла большая группа советских военных советников. В октябре 1924 г. в Гуанчжоу на должность главного военного советника прибыл Василий Константинович Блюхер.\n" + +"В марте 1926 Чан Кайши осуществил в Кантоне военный переворот, изгнал из города коммунистов, а спустя три месяца был избран председателем Гоминьдана и главнокомандующим вооруженными войсками. Добившись высокой власти, Чан Кайши пригласил немецких советников во главе бывшим генералом рейхсвера фон Сектом.\n" + +"В качестве советников у Чан Кайши действовали офицеры Германии:\n" + +"\n" + +" * полковник В.Бауэр (друг Гитлера и ученик Людендорфа)\n" + +" * нацист подполковник Крибель\n" + +" * генерал-лейтенант Ветцель\n" + +" * генерал Фалькенхаузен\n" + +"\n" + +"Гоминьдановцы старательно перенимали опыт нацистов по наведению порядка в стране. Китайские офицеры в организованном порядке направлялись на обучение в Германию.\n" + +"В 1926 Национально-революционная армия Китая Чан Кайши предприняла так называемый Великий Северный поход. В течение шести месяцев непрерывных боев от власти местных военных правителей были освобождены центральные районы Китая.\n" + +"В начале 1927 Чан Кайши пошел на открытый развал единого фронта ГМД и КПК: его войска начали разоружение шанхайских рабочих отрядов и дружин, начались массовые аресты и казни профсоюзных деятелей и коммунистов. В ответ на это коммунисты организовали 1 августа в городе Наньчан восстание части гоминьдановских войск, вошедшее в историю Китая как \"Наньчанское восстание\".\n" + +"В декабре 1927 было поднято коммунистическое восстание в Кантоне, которое гоминьдановцы жесточайшим образом подавили после четырех дней кровопролитных боев.\n" + +"После нескольких военных операций к 1927 году войска Гоминьдана контролировали большую часть территории Китая.\n" + +"\n" + +"[править] Японская оккупация и Вторая мировая война\n" + +"\n" + +"Осенью 1931 Япония напала на Китай. 18 сентября после серии провокаций японцы перешли в наступление, за короткое оккупировав всю Манчжурию. В марте 1932 здесь было провозглашено прояпонское марионеточное государство Маньчжоу-Го, которое возглавил Пу И – последний отпрыск маньчжурской династии Цин, свергнутой в годы Синьхайской революции.\n" + +"\n" + +"В этих сложных условиях Чан Кайши был вынужден бороться одновременно с тремя врагами: внешней японской агрессией, спорадическими бунтами отдельных милитаристов на местах, и вооружёнными силами КПК, претендовавшими на захват власти в стране. Он выбрал политику компромисса с японцами, с милитаристами вёл дела в зависимости от конкретных обстоятельств, с коммунистами же никакой компромисс был невозможен. В 1934 году основные силы КПК были блокированы в провинции Цзянси. В этих сложных условиях руководство КПК сумело организовать прорыв, и после многомесячного марша привело войска на Северо-Запад страны в т.н. \"особый район\" с центром в городе Яньань; эти события вошли в историю КПК как \"Великий поход\". Чан Кайши планировал продолжать борьбу с коммунистами и там, но тут взбунтовался ряд его генералов, считавших более приоритетной задачей примирение с коммунистами и совместную борьбу с японской агрессией. В результате \"Сианьского инцидента\" было подписано соглашение о создании единого фронта между КПК и Гоминьданом.\n" + +"\n" + +"7 июля 1937 конфликтом у моста Лугоуцяо недалеко от Пекина началась «большая» война. С этого момента, по мнению китайских историков, начинается Вторая мировая война.\n" + +"\n" + +"\n" + +" Этот раздел не завершён. Вы можете помочь проекту, исправив и дополнив его.\n" + +"Японская оккупация (1940)\n" + +"Японская оккупация (1940)\n" + +"\n" + +"[править] Создание Китайской Народной Республики\n" + +"\n" + +"Разгром милитаристской Японии в августе-сентябре 1945 завершил Вторую мировую войну, освободив от порабощения страны Азиатско-Тихоокеанского региона. В Китае шла ожесточенная гражданская война.\n" + +"Советская Красная Армия полностью оккупировала Манчжурию, приняв капитуляцию фактически у всей японской Квантунской армии. К тому времени на территории Манчжурии действовали лишь разрозненные партизанские отряды и разведгруппы китайских партизан.\n" + +"В сентябре 1945 начала осуществляться массовая переброска вооруженных сил КПК из северного и Восточного Китая на северо-восток страны. К ноябрю туда перешли около 100 тысяч бойцов 8-ой и 4-ой армий. Из этих частей, партизанских формирований и местных жителей была сформирована Объединенная демократическая армия (ОДА) Северо-Востока, которая стала костяком Народно-освободительной армии Китая.\n" + +"Советская армия находилась в Манчжурии вплоть до мая 1946. За это время советская сторона помогла китайским коммунистам организовать, обучить и вооружить новые китайские войска. В результате, когда гоминьдановские войска начали в апреле 1946 входить в Манчжурию, они, к своему удивлению, обнаружили там не разрозненные партизанские отряды, а современную дисциплинированную армию коммунистов, вовсе не намеревавшуюся самораспускаться.\n" + +"Ситуация в Манчжурии стала шоком и для Белого дома. Первый отряд вооруженных сил США в составе двух дивизий морской пехоты высадился в Китае в районе Тяньцзиня еще 30 сентября 1945. К осени в Китае находилось уже свыше 100 тысяч американских военнослужащих.\n" + +"Американские экспедиционные войска, главным образом части морской пехоты, старались не вмешиваться в отношения между КПК и ГМД. Однако они активно взаимодействовали с вооруженными силами легитимного китайского правительства - войсками Гоминьдана, прежде всего в приеме капитуляции японских войск в Северном и Центральном Китае, а также в поддержании порядка и охране различных важных объектов в китайских городах.\n" + +"С самого начала командование войск ГМД допустило стратегическую ошибку: несмотря на успехи первых столкновений с ОДА в Манчжурии, военные действия в Северо-Восточном Китае не были доведены до конца, ГМД направил свои усилия не на борьбу с регулярными войсками КПК, а на уничтожение партизанского движения и партизанских баз в Центральном, Восточном и Северном Китае.\n" + +"Укрепившись с помощью советской стороны, при поддержке местного населения, войска Мао Цзэдуна к осени 1948 достигли численности в 600 тысяч человек. С 1 ноября ОДА стала именоваться 4-й Полевой армией. возглавили ее Линь Бяо.\n" + +"В ноябре 1948 4-я полевая армия перешла к решительным боевым действиям против гоминьдановцев. За короткие сроки было разбито 52 дивизии Чан Кайши, еще 26 дивизий, обученных военными инструкторами США, перешли на сторону КПК. В начале 1949 армия вошла в Северный Китай, где объединилась с войсками 8-й армии КПК. 15 января был взят Тяньцзинь, 22 января - Пекин.\n" + +"К весне 1949 вооруженные силы КПК освободили от гоминьдановцев весь Китай севернее реки Янцзы и восточнее провинции Ганьсу. К концу гражданской войны Народно-освободительная армия представляла собой мощную 4-миллионую армию, крупнейшую в Азии.\n" + +"24 апреля 1949 войска КПК под командованием маршала Лю Бочэна вступили в столицу гоминьдановского Китая - город Нанкин. Само гоминьдановское правительство еще в феврале переехало на юг страны, в Кантон, а затем вместе с остатками верных ему войск - бежало на остров Тайвань.\n" + +"В конце года Народно-освободительная армия Китая уничтожила все основные группировки Гоминьдана на континенте, победоносно завершив тем самым третью гражданскую войну в Китае.\n" + +"1 октября 1949 г. в Пекине была провозглашена Китайская Народная Республика.\n" + +"На следующий же день Советский Союз первым признал КНР и заключил с ней Договор о дружбе, союзе и взаимной помощи. Таким образом, в конце 1949 года родился советско-китайский «монолит» - тот самый, который на многие годы стал кошмаром для Запада.\n" + +"\n" + +"[править] Культурная революция\n" + +"\n" + +"В 1966 году председателем КПК Мао Цзэдуном была начата культурная революция для утверждения маоизма в качестве единственной государственной идеологии и уничтожения политической оппозиции. Было организовано массовое ополчение молодёжи, называвшееся «красногвардейцы». Красногвардейцы занялись преследованием «контререволюционеров» из числа аппарата КПК, интеллигенции и вообще всех, кто мог им не понравиться.\n" + +"\n" + +"[править] Экономическая либерализация\n" + +"\n" + +"После падения \"банды четырех\" власть в стране взяли реформаторы Дэн Сяопин и Ху Яобан, которые в конце 1978 года провозгласили на 3-м пленуме ЦК КПК 11-го созыва политику \"реформ и открытости\". Реальный старт \"Экономической реформе\" был дан на XII съезде КПК (1982 г.). На XIII съезде КПК (1987 г.) было дано подробное толкование теории начального этапа социализма, согласно которой социалистический строй и социалистическая экономическая система - разные вещи, т.е. социалистический политический режим не подразумевает безусловной плановой централизации всей экономики, а позволяет использовать и рыночные механизмы, особенно в паре \"государство-предприятие\". На XIV съезде КПК (1992 г.) был провозглашен курс на построение социалистической рыночной экономической системы с китайской спецификой. Данное изменение идеологии хорошо иллюстрирует высказываение Д.Сяопина: \"Неважно какого цвета кошка - главное, чтобы ловила мышей\".\n" + +"\n" + +"Фактически введение \"Экономической реформы\" означало настоящую \"революцию сверху\", заключавшуюся в постепенном и частичном сворачивании тоталитарной сталинско-маоистской модели жестко централизованной экономики и переводе части отраслей народного хозяйства на рыночные рельсы, но при полностью неизменной политической надстройке в лице монопольно управляющей страной КПК. К концу 70-х исторически слабая экономика Китая \"лежала\" из-за негативных последствий авантюристических кампаний Мао Цзедуна - \"большого скачка\" и \"культурной революции\". От систематического голода в Китае ежегодно страдали практически все 800 млн. крестьян (из миллиардного населения), страна занимала последние места в мире по уровню производства товаров и продовольствия на душу населения. Для решения проблемы голода необходимо было обеспечить стабильный валовый сбор зерна в объеме не менее 400 млн. т в год. Аграрные преобразования были связаны с отменой народной коммуны и заменой ее семейным подрядом и единой коллективной собственностью. Практически все 800 млн. крестьян получили право на свободное сельскохозяйственное производство. В основном была отменена система госзаготовок, освобождены цены на большинство видов сельскохозяйственной продукции. Результатом этих мер стал выход аграрного сектора из застоя, вступление крестьянских хозяйств на путь специализации и повышения товарности. Организованные в деревне по инициативе крестьян волостно-поселковые предприятия позволили обеспечить рост занятости (120 млн. чел.) и повысить жизненный уровень крестьян.Задача обеспечения страны зерном была в основном решена в 80-х. Постепенно в деревне сформировалась двухслойная хозяйственная система на основе сочетания коллективной собственности и семейного подряда.\n" + +"\n" + +"В области промышленной политики правительство Китая, начиная с 1984 года сделало упор концепцию плановой товарной экономики. На практике это означало перевод части отдельных городских предприятий на самоокупаемость. Позже правительство разрешило и подразделениям армии Китая (НОАК) перейти на самообеспечение и заниматься свободным предпринимательством. В соответствии с принципом \"Чжуа Да Фан Сяо\" (\"держать в руках большие предприятия, отпустить маленькие\") многие мелкие госпредприятия получили право изменить не только механизм хозяйствования, но и форму собственности. Это позволило государству сосредоточить силы на улучшении положения крупных предприятий. Четыре города - Шэньчжэнь, Чжухай, Сямынь, Шаньтоу - были объявлены специальными экономическими зонами. Вслед за ними 14 приморских городов, четыре региона в устьях рек Янцзы и Чжуцзян, юго-восточная часть провинции Фуцзянь и регион в районе Бахайского залива стали открытыми экономическими зонами. На острове Хайнань была создана одноименная новая провинция, а сам он стал специальной экономической зоной. Все эти города и районы получили различные инвестиционные и налоговые льготы для привлечения иностранного капитала и технологий, заимствования у иностранных партнеров эффективных методов управления. Быстрое развитие их экономики способствовало эффективному росту в масштабе страны. Характерно, что значительную долю ввозимого капитала на начальном этапе обеспечила китайская диаспора (хуацяо), проживающая преимущественно в странах тихоокеанского бассейна (основные зоны компактного проживания: Гонконг, Макао, Сингапур, Малайзия, США). Успешное проведение политики либерализации в сочетании с жестко проводимой политикой ограничения рождаемости (снижение рождаемости за 20 лет составило не менее 200 млн. человек) позволило создать многоукладную экономику, в которой госпредприятия дают 48% промышленной продукции, коллективные - 38%, частные, в том числе с иностранным участием, - 13,5%. На долю государственной торговли приходится свыше 41% общего розничного оборота, коллективной - почти 28% и частной - 31%. Доля рыночных цен по потребительским товарам достигла 90%, средствам производства - 80%, по сельскохозяйственным продуктам - 85%. Доля видов промышленной продукции, производство которых регулируется государственными директивными планами, снизилась с 95% в 1978 г. до 5% в настоящее время. Удельный вес товаров, ценами которых непосредственно управляет государство, в розничном товарообороте упал с 95 до 6%. Помимо рынка товаров начали создаваться рынки капиталов, машин и оборудования, рабочей силы, других необходимых для производства элементов. ВВП Китая рос в течение 20 лет, начиная с 1985 года в среднем на 9,5% ежегодно. Страна вышла на 1-е место в мире по производству цемента, цветных металлов, хлопчатобумажных тканей, велосипедов (свыше 80 млн.), мотоциклов (21,3 млн.), телевизоров (35 млн.), угля, зерна, хлопка, рапсовых семян, мяса, яиц, на 2-е - химических удобрений, 3-е - сахара, автомобилей (7,3 млн., вкл. 4,6 млн. легковых), 4-е - электроэнергии, 5-е - сырой нефти. По объему ВВП Китай находится на 4-м месте в мире (при расчете по паритетному покупательскому курсу - на 2-м). На его долю приходится 5,4% мирового валового продукта (2006 г.). Золотовалютные резервы страны превысили в 2006 г. триллион долларов США. Положительное сальдо торгового баланса составляет 180 млрд. долларов. Правда, несмотря на такой рекордно длительный и масштабный экономический рост, среднедушевые показатели ВВП Китая остаются еще на относительно низком уровне, ВВП на душу населения в 2005 году составил 7600 долларов (109-110 место в мире рядом с Украиной). В тоже время средний доход горожанина в открытых городах на конец 2006 г. превысил 10000 юаней в месяц. В китайской деревне от 100 до 150 млн. человек не могут найти работу, еще несколько сотен миллионов заняты частично. Официальный уровень безработицы в городах 4,2% (2005 г.).\n" + +"\n" + +"В начале 21-го века Китай превратился в \"мировую фабрику\" куда переводится ряд производств из развитых стран Европы, Северной Америки и Японии. Бурный экономический рост во многом связан с дешевизной рабочей силы, слабым уровнем техники безопасности и низким контролем за экологией. В результате Китай уже стал вторым загрязнителем мировой атмосферы и гидросферы, после гораздо более мощной экономики США, а также вышел в \"лидеры\" по эррозии почвы (особенно в северных областях). Возросший из-за роста авто- и мотопарка уровень импорта Китаем нефти (3,2 млн. баррелей/сут. в 2005-м, 2-е место в мире) приводит в последние годы к росту ее среднемировой цены.\n" + +"\n" + +"В тоже время экономическое и политическое влияние страны в мире в последние годы постоянно возрастает. Так Китаю в 1997-м и 1999-и годах были возращены \"арендованные\" еще у Поднебесной империи территории Гонконг (Сянган) и Макао (Аомынь). Постоянно возрастает уровень обороноспособности страны и техническое оснащение НОАК, чему в немалой степени способствует и РФ, поставляющая в Китай самые современные виды вооружения.\n" + +"\n" + +"Либерализация экономики КНР пока не сопровождается смягчением политического режима. В стране продолжаются политические репрессии против оппозиции, особенно масштабно реализованные во время \"событий на площади Тяньаньмэнь\" в мае 1989-го, жестко контролируются СМИ, включая Интернет. В тоже время в последние годы предпринят ряд важных изменений устава КПК, например, в партию разрешено вступать представителям предпринимательских кругов, введена ротация высших кадров руководства Партии. Во внутренней политике сняты все ограничения на рост личных состояний и разрешено владение личными автомобилями. В тоже время страна лидирует в мире по количеству смертных казней (более 7000 в год). Несмотря на такую суровую практику, уровень преступности и коррупции постоянно возрастает.\n" + +"\n" + +"Политика либерализации дала сенсационно высокие результаты, перевела экономику Китая на иной качественный уровень. При этом развитие экономики идет неравномерно по регионам, накапливаются социальные диспропорции, а экологическим аспектам уделяется недостаточное внимание, что уже затрагивает не только территорию Китая, но и интересы сопредельных с ним стран.\n" + +"\n" + +"[править] См. также\n" + +"\n" + +" * Китай (цивилизация)\n" + +" * События на площади Тяньаньмэнь 1989 года\n" + +"\n" + +"[править] Литература\n" + +"\n" + +" * Васильев Л.С. Древний Китай: в 3 т. Т. 3. Период Чжаньго (V–III вв. до н.э.). М.: Восточная литература, 2006. ISBN 502018103X\n" + +" * Непомнин О.Е. История Китая: Эпоха Цин. XVII – начало XX века. М.: Восточная литература, 2005. ISBN 5020184004\n"; + +var devanagari = +"भारत\n" + +"विकिपीडिया, एक मुक्त ज्ञानकोष से\n" + +"Jump to: navigation, search\n" + +" यह लेख एक निर्वाचित लेख उम्मीदवार है। अधिक जानकारी के लिए और इस लेख को निर्वाचित लेख बनने के लिए क्या आवश्यकताएँ हैं यह जानने के लिए कृपया यहाँ देखें।\n" + +"भारत गणराज्य\n" + +"Flag of भारत Coat of arms of भारत\n" + +"ध्वज कुलचिह्न\n" + +"राष्ट्रवाक्य: \"सत्यमेव जयते\" (संस्कृत)\n" + +"\n" + +"सत्य ही विजयी होता है\n" + +"राष्ट्रगान: जन गण मन\n" + +"भारत की स्थिति\n" + +"राजधानी नई दिल्ली\n" + +"८७, ५९०) 28°34′ N 77°12′ E\n" + +"सबसे बड़ा शहर मुम्बई\n" + +"राजभाषा(एँ) हिन्दी, अंग्रेज़ी तथा अन्य भारतीय भाषाएं\n" + +"सरकार\n" + +"राष्ट्रपति\n" + +"प्रधानमंत्री\n" + +" गणराज्य\n" + +"प्रतिभा पाटिल\n" + +"डॉ मनमोहन सिंह\n" + +"ब्रिटिश राज से स्वतंत्रता\n" + +" १५ अगस्त, १९४७\n" + +"क्षेत्रफल\n" + +" - कुल\n" + +" \n" + +" - जलीय (%) \n" + +"३२, ८७, ५९० km² (सातवां)\n" + +"१२,२२,५५९ sq mi \n" + +"९.५६\n" + +"जनसंख्या\n" + +" - २००५ अनुमान\n" + +" - २००१ जनगणना\n" + +" - जनसंख्या का घनत्व \n" + +"१,१०,३३,७१,००० (द्वितीय)\n" + +"१,०२,७०,१५,२४८\n" + +"३२९/km² (३१ वीं)\n" + +"८५२/sq mi \n" + +"सकल घरेलू उत्पाद (जीडीपी) (पीपीपी)\n" + +" - कुल\n" + +" - प्रतिव्यत्ति २००५ estimate\n" + +"$३.६३३ महासंख (चौथी GDP_PPP_per_capita = $३,३२०)\n" + +"{{{GDP_PPP_per_capita}}} (१२२ वीं)\n" + +"मानव विकास संकेतांक (एइचडीआइ) ०.६११ (१२६ वीं) – medium\n" + +"मुद्रा भारतीय रुपया (आइएनआर)\n" + +"समय मण्डल\n" + +" - ग्रीष्म ऋतु (डेलाइट सेविंग टाइम) आइएसटी (UTC+५:३०)\n" + +"अब्सर्व्ड नहीं है (UTC+५:३०)\n" + +"इंटरनेट टॉप लेवेल डोमेन .आइएन\n" + +"दूरभाष कोड +९१\n" + +"\n" + +"भारत गणराज्य, पौराणिक जम्बुद्वीप, दक्षिण एशिया में स्थित एक देश है। यह भारतीय उपमहाद्वीप का सबसे बड़ा देश है। भारत का भौगोलिक फैलाव 8० 4' से 37० 6' उत्तरी अक्षांश तक तथा 68० 7' से 97० 25'पूर्वी देशान्तर तक है । भारत का क्षेत्रफल ३२,८७,२६३ वर्ग कि. मी. हैं | भारत का विस्तार उत्तर से दक्षिण तक ३,२१४ कि. मी. और पूर्व से पश्चिम तक २,९३३ कि. मी. हैं । भारत की समुद्र तट रेखा ७५१६.६ किलोमीटर लम्बी है। भारत, भौगोलिक दृष्टि से विश्व का सातवाँ सबसे बड़ा और जनसँख्या के दृष्टिकोण से दूसरा बड़ा देश है | भारत के पश्चिम में पाकिस्तान , उत्तर-पूर्व मे चीन, नेपाल, और भूटान और पूर्व में बांग्लादेश और म्यांमार देश स्थित हैं। हिन्द महासागर में इसके दक्षिण पश्चिम में मालदीव, दक्षिण में श्रीलंका और दक्षिण-पूर्व में इंडोनेशिया है। भारत उत्तर-पश्चिम में अफ़्ग़ानिस्तान के साथ सीमा का दावा करता है। इसके उत्तर में हिमालय पर्वत है। दक्षिण में हिन्द महासागर है। पूर्व में बंगाल की खाड़ी है। पश्चिम में अरब सागर है। भारत में कई बड़ी नदियाँ है। गंगा नदी भारतीय सभ्यता मै बहुत पवित्र मानी जाती है। अन्य बड़ी नदियाँ ब्रह्मपुत्र, यमुना, गोदावरी, कावेरी, कृष्णा, चम्बल, सतलज, बियास हैं ।\n" + +"\n" + +"भारत की १०० करोड़ (१ अरब) से अधिक जनसंख्या, चीन के बाद विश्व में सबसे अधिक है। यह विश्व का सबसे बड़ा लोकतंत्र है। यहाँ ३०० से अधिक भाषाएँ बोली जाती है (साइटेसन चाहिए)। यह एक बहुत प्राचीन सभ्यता की भूमि है।\n" + +"\n" + +"भारत विश्व की दसवीं सबसे बड़ी अर्थव्यवस्था है, किन्तु हाल में भारत ने काफी प्रगति की है, और ताज़ा स्थिति में भारत विश्व में तीसरे, चौथे स्थान पर होने का दावा करता है (साइटेसन चाहिए)। भारत भौगोलिक क्षेत्रफल के आधार पर विश्व का सातवाँ सबसे बड़ा राष्ट्र है। यह विश्व की कुछ प्राचीनतम सभ्यताओं का पालना रहा है जैसे - सिन्धु घाटी सभ्यता , और महत्वपूर्ण ऐतिहासिक व्यापार पथों का अभिन्न अंग है। विश्व के चार प्रमुख धर्म : हिन्दू , बौध , जैन तथा सिख भारत में प्रतिपादित हुए | १९४७ में स्वतंत्रता प्राप्ति से पूर्व ब्रिटिश भारत के रूप में ब्रिटिश साम्राज्य के प्रमुख अंग भारत ने विगत २० वर्ष में सार्थक प्रगति की है, विशेष रूप से आर्थिक और सैन्य | भारतीय सेना एक क्षेत्रिय शक्ति और विश्वव्यापक शक्ति है।\n" + +"\n" + +"भारत की राजधानी नई दिल्ली है। भारत के अन्य बड़े महानगर मुम्बई (बम्बई), कोलकाता (कलकत्ता) और चेन्नई (मद्रास) हैं।\n" + +"\n" + +"\n" + +"अनुक्रम\n" + +"[छुपाएं]\n" + +"\n" + +" * १ नाम\n" + +" * २ इतिहास\n" + +" * ३ सरकार\n" + +" * ४ राजनीति\n" + +" * ५ राज्य और केन्द्रशासित प्रदेश\n" + +" * ६ भूगोल और मौसम\n" + +" * ७ अर्थव्यवस्था\n" + +" * ८ जनवृत्त\n" + +" * ९ संस्कृति\n" + +" * १० यह भी देखें\n" + +" * ११ बाहरी कड़ियाँ\n" + +"\n" + +"[संपादित करें] नाम\n" + +"मुख्य लेख: भारत नाम की उत्पत्ति\n" + +"\n" + +"भारत के दो आधिकारिक नाम है हिन्दी में भारत और अंग्रेज़ी में इन्डिया (India)। इन्डिया नाम की उत्पत्ति सिन्धु नदी के फारसी नाम से हुई। भारत नाम एक प्राचीन हिन्दू राजा भरत, जिनकी कथा महाभारत में है, के नाम से लिया गया है। एक तीसरा नाम हिन्दुस्तान (उत्पत्ति फारसी) या हिन्दुओं की भूमि मुगल काल से प्रयोग होता है यद्यपि इसका समकालीन उपयोग कम है।\n" + +"\n" + +"[संपादित करें] इतिहास\n" + +"मुख्य लेख: भारतीय इतिहास\n" + +"\n" + +"पाषाण युग भीमबेटका मध्य प्रदेश की गुफाएं भारत में मानव जीवन का प्राचीनतम प्रमाण है। प्रथम स्थाई बस्तियों ने ९००० वर्ष पूर्व स्वरुप लिया। यही आगे चल कर सिन्धु घाटी सभ्यता में विकसित हुई , जो २६०० ईसवी और १९०० ईसवी के मध्य अपने चरम पर थी। लगभग १६०० ईसापूर्व आर्य भारत आए और उत्तर भारतीय क्षेत्रों में वैदिक सभ्यता का सूत्रपात किया । इस सभ्यता के स्रोत वेद और पुराण हैं। यह परम्परा कई सहस्र वर्ष पुरानी है। इसी समय दक्षिण बारत में द्रविड़ सभ्यता का विकास होता रहा। दोनो जातियों ने एक दूसरे की खूबियों को अपनाते हुए भारत में एक मिश्रित संस्कृति का निर्माण किया।\n" + +"\n" + +"५०० ईसवी पूर्व कॆ बाद, कई स्वतंत्र राज्य बन गए। उत्तर में मौर्य राजवंश, जिसमें बौद्ध महाराजा अशोक सम्मिलित थे, ने भारत के सांस्कृतिक पटल पर उल्लेखनीय छाप छोड़ी। १८० ईसवी के आरम्भ से, मध्य एशिया से कई आक्रमण हुए, जिनके परिणामस्वरूप उत्तरी भारतीय उपमहाद्वीप में यूनानी, शक, पार्थी और अंततः कुषाण राजवंश स्थापित हुए | तीसरी शताब्दी के आगे का समय जब भारत पर गुप्त वंश का शासन था, भारत का \"स्वर्णिम काल\" कहलाया।\n" + +"तीसरी शताब्दी में सम्राट अशोक द्वारा बनाया गया मध्य प्रदेश में साँची का स्तूप\n" + +"तीसरी शताब्दी में सम्राट अशोक द्वारा बनाया गया मध्य प्रदेश में साँची का स्तूप\n" + +"\n" + +"दक्षिण भारत में भिन्न-भिन्न समयकाल में कई राजवंश चालुक्य, चेर, चोल, पल्लव तथा पांड्य चले | विज्ञान, कला, साहित्य, गणित, खगोल शास्त्र, प्राचीन प्रौद्योगिकी, धर्म, तथा दर्शन इन्हीं राजाओं के शासनकाल में फ़ले-फ़ूले |\n" + +"\n" + +"१२वीं शताब्दी के प्रारंभ में, भारत पर इस्लामी आक्रमणों के पश्चात, उत्तरी व केन्द्रीय भारत का अधिकांश भाग दिल्ली सल्तनत के शासनाधीन हो गया; और बाद में, अधिकांश उपमहाद्वीप मुगल वंश के अधीन । दक्षिण भारत में विजयनगर साम्राज्य शक्तिशाली निकला। हालांकि, विशेषतः तुलनात्मक रूप से, संरक्षित दक्षिण में अनेक राज्य शेष रहे अथवा अस्तित्व में आये।\n" + +"\n" + +"१७वीं शताब्दी के मध्यकाल में पुर्तगाल, डच, फ्रांस, ब्रिटेन सहित अनेकों यूरोपीय देशों, जो भारत से व्यापार करने के इच्छुक थे, उन्होनें देश की शासकीय अराजकता का लाभ प्राप्त किया। अंग्रेज दूसरे देशों से व्यापार के इच्छुक लोगों को रोकने में सफल रहे और १८४० तक लगभग संपूर्ण देश पर शासन करने में सफल हुए। १८५७ में ब्रिटिश इस्ट इंडिया कम्पनी के विरुद्ध असफल विद्रोह, जो कि भारतीय स्वतन्त्रता के प्रथम संग्राम से जाना जाता है, के बाद भारत का अधिकांश भाग सीधे अंग्रेजी शासन के प्रशासनिक नियंत्रण में आ गया।\n" + +"कोणार्क चक्र - १३वीं शताब्दी में बने उड़ीसा के सूर्य मन्दिर में स्थित, यह दुनिया के सब से प्रसिद्घ ऐतिहासिक स्थानों में से एक है।\n" + +"कोणार्क चक्र - १३वीं शताब्दी में बने उड़ीसा के सूर्य मन्दिर में स्थित, यह दुनिया के सब से प्रसिद्घ ऐतिहासिक स्थानों में से एक है।\n" + +"\n" + +"बीसवीं शताब्दी के प्रारंभ में एक लम्बे समय तक स्वतंत्रता प्राप्ति के लिये विशाल अहिंसावादी संघर्ष चला, जिसका नेतृत्व महात्मा गांधी, जो कि आधिकारिक रुप से आधुनिक भारत के राष्ट्रपिता से संबोधित किये जाते हैं, ने किया। ईसके साथ - साथ चंद्रशेखर आजाद, सरदार भगत सिंह, सुख देव, राजगुरू, नेताजी सुभाष चन्द्र बोस आदि के नेतृत्व मे चले क्रांतिकारी संघर्ष के फलस्वरुप 15 अगस्त, 1947 भारत ने अंग्रेजी शासन से पूर्णतः स्वतंत्रता प्राप्त की। तदुपरान्त 26 जनवरी, 1950 को भारत एक गणराज्य बना।\n" + +"\n" + +"एक बहुजातीय तथा बहुधर्मिक राष्ट्र होने के कारण भारत को समय-समय पर साम्प्रदायिक तथा जातीय विद्वेष का शिकार होना पङा है। क्षेत्रीय असंतोष तथा विद्रोह भी हालाँकि देश के अलग-अलग हिस्सों में होते रहे हैं, पर इसकी धर्मनिरपेक्षता तथा जनतांत्रिकता, केवल १९७५-७७ को छोड़, जब तत्कालीन प्रधानमंत्री इंदिरा गांधी ने आपातकाल की घोषणा कर दी थी, अक्षुण्य रही है।\n" + +"\n" + +"भारत के पड़ोसी राष्ट्रों के साथ अनसुलझे सीमा विवाद हैं। इसके कारण इसे छोटे पैमानों पर युद्ध का भी सामना करना पड़ा है। १९६२ में चीन के साथ, तथा १९४७, १९६५, १९७१ एवम् १९९९ में पाकिस्तान के साथ लड़ाइयाँ हो चुकी हैं।\n" + +"\n" + +"भारत गुटनिरपेक्ष आन्दोलन तथा संयुक्त राष्ट्र संघ के संस्थापक सदस्य देशों में से एक है।\n" + +"\n" + +"१९७४ में भारत ने अपना पहला परमाणु परीक्षण किया था जिसके बाद १९९८ में 5 और परीक्षण किये गये। १९९० के दशक में किये गये आर्थिक सुधारीकरण की बदौलत आज देश सबसे तेजी से विकासशील राष्ट्रों की सूची में आ गया है।\n" + +"\n" + +"[संपादित करें] सरकार\n" + +"मुख्य लेख: भारत सरकार\n" + +"\n" + +"भारत का संविधान भारत को एक सार्वभौमिक, समाजवादी, धर्मनिरपेक्ष, लोकतान्त्रिक गणराज्य की उपाधि देता है। भारत एक लोकतांत्रिक गणराज्य है, जिसका द्विसदनात्मक संसद वेस्टमिन्स्टर शैली के संसदीय प्रणाली द्वारा संचालित है। इसके शासन में तीन मुख्य अंग हैं: न्यायपालिका, कार्यपालिका और व्यवस्थापिका।\n" + +"\n" + +"राष्ट्रपति,जो कि राष्ट्र का प्रमुख है, has a largely ceremonial role. उसके कार्यों में संविधान का अभिव्यक्तिकरण, प्रस्तावित कानूनों (विधेयक) पर अपनी सहमति देना, और अध्यादेश जारी करना। वह भारतीय सेनाओं का मुख्य सेनापति भी है। राष्ट्रपति और उपराष्ट्रपति को एक अप्रत्यक्ष मतदान विधि द्वारा ५ वर्षों के लिये चुना जाता है। प्रधानमन्त्री सरकार का प्रमुख है और कार्यपालिका की सारी शक्तियाँ उसी के पास होती हैं। इसका चुनाव राजनैतिक पार्टियों या गठबन्धन के द्वारा प्रत्यक्ष विधि से संसद में बहुमत प्राप्त करने पर होता है। बहुमत बने रहने की स्थिति में इसका कार्यकाल ५ वर्षों का होता है। संविधान में किसी उप-प्रधानमंत्री का प्रावधान नहीं है पर समय-समय पर इसमें फेरबदल होता रहा है।\n" + +"\n" + +"व्यवस्थापिका संसद को कहते हैं जिसके दो सदन हैं - उच्चसदन राज्यसभा, or Council of States,और निम्नसदन लोकसभा. राज्यसभा में २४५ सदस्य होते हैं जबकि लोकसभा में ५५२। राज्यसभा के सदस्यों का चुनाव, अप्रत्यक्ष विधि से ६ वर्षों के लिये होता है, जबकि लोकसभा के सदस्यों का चुनाव प्रत्यक्ष विधि से, ५ वर्षों की अवधि के लिये। १८ वर्ष से अधिक उम्र के सभी भारतीय नागरिक मतदान कर सकते हैं।\n" + +"\n" + +"कार्यपालिका के तीन अंग हैं - राष्ट्रपति, उपराष्ट्रपति और मंत्रीमंडल। मंत्रीमंडल का प्रमुख प्रधानमंत्री होता है। मंत्रीमंडल के प्रत्येक मंत्री को संसद का सदस्य होना अनिवार्य है। कार्यपालिका, व्यवस्थापिका से नीचे होता है।\n" + +"\n" + +"भारत की स्वतंत्र न्यायपालिका का शीर्ष सर्वोच्च न्यायालय है, जिसका प्रधान प्रधान न्यायाधीश होता है। सर्वोच्च न्यायालय को अपने नये मामलों तथा उच्च न्यायालयों के विवादों, दोनो को देखने का अधिकार है। भारत में 21 उच्च न्यायालय हैं, जिनके अधिकार और उत्तरदायित्व सर्वोच्च न्यायालय की अपेक्षा सीमित हैं। न्यायपालिका और व्यवस्थापिका के परस्पर मतभेद या विवाद का सुलह राष्ट्रपति करता है।\n" + +"\n" + +"[संपादित करें] राजनीति\n" + +"मुख्य लेख: भारत की राजनीति\n" + +"भारत का मानचित्र\n" + +"भारत का मानचित्र\n" + +"\n" + +"स्वतंत्र भारत के इतिहास में उसकी सरकार मुख्य रूप से भारतीय राष्ट्रीय कान्ग्रेस पार्टी के हाथ में रही है। स्वतन्त्रतापूर्व भारत में सबसे बडे़ राजनीतिक संगठन होने के कारण काँग्रेस की, जिसका नेता मूल रूप से नेहरू - गाँधी परिवार का कोई न कोई सदस्य होता है, चालीस वर्षों तक राष्ट्रीय राजनीति में प्रमुख भूमिका रही। १९७७ में, पूर्व काँग्रेस शासन की इंदिरा गाँधी के आपातकाल लगाने के बाद एक संगठित विपक्ष जनता पार्टी ने चुनाव जीता और उसने अत्यधिक छोटी अवधि के लिये एक गैर-काँग्रेसी सरकार बनाई।\n" + +"\n" + +"१९९६ में, भारतीय जनता पार्टी (भाजपा), सबसे बड़े राजनीतिक संगठन के रूप में उभरी और उसने काँग्रेस के आगे इतिहास में पहली बार एक ठोस विपक्ष प्रस्तुत किया। परन्तु आगे चलकर सत्ता वास्तविक रूप से दो गठबन्धन सरकारों के हाथ में रही जिन्हें काँग्रेस का सम्पूर्ण समर्थन था। १९९९ में, भाजपा ने छोटे दलों को साथ लेकर राष्ट्रीय जनतान्त्रिक गठबन्धन (राजग) बनाया और ५ वर्षों तक कार्यकाल पूरा करने वाली वह पहली गैर-काँग्रेसी सरकार बनी। १९९९ से पूर्व का दशक अल्पावधि सरकारों का था, इन वर्षों में सात भिन्न सरकारें बनी। परन्तु १९९१ मे बनी काँग्रेस सरकार ने अपना ५ वर्ष का कार्यकाल पूरा किया और कई आर्थिक सुधार लाई।\n" + +"\n" + +"भारतीय आम चुनाव २००४ के फ़लस्वरूप काँग्रेस दल ने सर्वाधिक सीटें जीतीं और वह बड़े ही कम बहुमत से सत्ता में वापिस आई। काँग्रेस ने गठजोड़ द्वारा भारतीय कम्युनिस्ट पार्टी (मार्क्सवादी) और बहुत सी राज्य स्तरीय पार्टियों को साथ लेकर यूनाईटेड प्रोग्रेसिव अलायन्स (यूपीए) नामक सरकार बनाई। आज बीजेपी और उसके सहयोगी विपक्ष में मुख्य भूमिका निभाते हैं। राष्ट्रीय स्तर पर किसी विशेष पार्टी का दबदबा न होने और राज्य स्तर की कई पार्टियों के राष्ट्रीय स्तर पर उभरने के कारण १९९६ से बनी सभी सरकारों को राजनीतिक गठबन्धनों की आवश्यक्ता पड़ी है।\n" + +"\n" + +"[संपादित करें] राज्य और केन्द्रशासित प्रदेश\n" + +"मुख्य लेख: भारत के राज्य\n" + +"\n" + +"वर्तमान में भारत २८ राज्यों, ६ केन्द्रशासित प्रदेशों और राजधानी दिल्ली मे बँटा हुआ है। राज्यों की चुनी हुई स्वतंत्र सरकारें हैं जबकि केन्द्रशासित प्रदेशों पर केन्द्र द्वारा नियुक्त प्रबंधन शासन करता है, हालाँकि कुछ की लोकतांत्रिक सरकार भी है।\n" + +"\n" + +"अन्टार्कटिका और दक्षिण गंगोत्री और मैत्री पर भी भारत के वैज्ञानिक स्थल हैं यद्यपि अभी तक कोई वास्तविक आधिपत्य स्थापित नहीं किया गया है।\n" + +"\n" + +"[संपादित करें] भूगोल और मौसम\n" + +"मुख्य लेख: भारत का भूगोल\n" + +"हिमालय उत्तर में जम्मू और काश्मीर से लेकर पूर्व में अरुणाचल प्रदेश तक भारत की अधिकतर पूर्वी सीमा बनाता है\n" + +"हिमालय उत्तर में जम्मू और काश्मीर से लेकर पूर्व में अरुणाचल प्रदेश तक भारत की अधिकतर पूर्वी सीमा बनाता है\n" + +"\n" + +"भारत के अधिकतर उत्तरी और उत्तरपश्चिमीय प्रांत हिमालय की पहाङियों में स्थित हैं। शेष का उत्तरी, मध्य और पूर्वी भारत गंगा के उपजाऊ मैदानों से बना है। उत्तरी-पूर्वी पाकिस्तान से सटा हुआ, भारत के पश्चिम में थार का मरुस्थल है। दक्षिण भारत लगभग संपूर्ण ही दक्खन के पठार से निर्मित है। यह पठार पूर्वी और पश्चिमी घाटों के बीच स्थित है।\n" + +"\n" + +"कई महत्वपूर्ण और बड़ी नदियाँ जैसे गंगा, ब्रह्मपुत्र, यमुना, गोदावरी और कृष्णा भारत से होकर बहती हैं। इन नदियों के कारण उत्तर भारत की भूमि कृषि के लिए उपजाऊ है।\n" + +"\n" + +"भारत के विस्तार के साथ ही इसके मौसम में भी बहुत भिन्नता है। दक्षिण में जहाँ तटीय और गर्म वातावरण रहता है वहीं उत्तर में कड़ी सर्दी, पूर्व में जहाँ अधिक बरसात है वहीं पश्चिम में रेगिस्तान की शुष्कता। भारत में वर्षा मुख्यतया मानसून हवाओं से होती है।\n" + +"\n" + +"भारत के मुख्य शहर है - दिल्ली, मुम्बई, कोलकाता, चेन्नई, बंगलोर ( बेंगलुरु ) | ये भी देंखे - भारत के शहर\n" + +"\n" + +"[संपादित करें] अर्थव्यवस्था\n" + +"मुख्य लेख: भारत की अर्थव्यवस्था\n" + +"सूचना प्रोद्योगिकी (आईटी) भारत के सबसे अधिक विकासशील उद्योगों में से एक है, वार्षिक आय $२८५० करोड़ डालर, इन्फ़ोसिस, भारत की सबसे बडी आईटी कम्पनियों में से एक\n" + +"सूचना प्रोद्योगिकी (आईटी) भारत के सबसे अधिक विकासशील उद्योगों में से एक है, वार्षिक आय $२८५० करोड़ डालर, इन्फ़ोसिस, भारत की सबसे बडी आईटी कम्पनियों में से एक\n" + +"\n" + +"मुद्रा स्थानांतरण की दर से भारत की अर्थव्यवस्था विश्व में दसवें और क्रयशक्ति के अनुसार चौथे स्थान पर है। वर्ष २००३ में भारत में लगभग ८% की दर से आर्थिक वृद्धि हुई है जो कि विश्व की सबसे तीव्र बढती हुई अर्थव्यवस्थओं में से एक है। परंतु भारत की अत्यधिक जनसंख्या के कारण प्रतिव्यक्ति आय क्रयशक्ति की दर से मात्र ३२६२ अमेरिकन डॉलर है जो कि विश्व बैंक के अनुसार १२५वें स्थान पर है। भारत का विदेशी मुद्रा भंडार १४३ अरब अमेरिकन डॉलर है। मुम्बई भारत की आर्थिक राजधानी है और भारतीय रिजर्व बैंक और बॉम्बे स्टॉक एक्सचेंज का मुख्यालय भी। यद्यपि एक चौथाई भारतीय अभी भी निर्धनता रेखा से नीचे हैं, तीव्रता से बढ़ती हुई सूचना प्रोद्योगिकी कंपनियों के कारण मध्यमवर्गीय लोगों में वृद्धि हुई है। १९९१ के बाद भारत मे आर्थिक सुधार की नीति ने भारत के सर्वंगीण विकास मे बडी भूमिका निभाआयी।\n" + +"\n" + +"१९९१ के बाद भारत मे हुए [आर्थिक सुधार। आर्थिक सुधारोँ]] ने भारत के सर्वांगीण विकास मे बड़ी भूमिका निभाई। भारतीय अर्थव्यवस्था ने कृषि पर अपनी ऐतिहासिक निर्भरता कम की है और कृषि अब भारतीय सकल घरेलू उत्पाद (जीडीपी) का केवल २५% है। दूसरे प्रमुख उद्योग हैं उत्खनन, पेट्रोलियम, बहुमूल्य रत्न, चलचित्र, टेक्स्टाईल, सूचना प्रोद्योगिकी सेवाएं, तथा सजावटी वस्तुऐं। भारत के अधिकतर औद्योगिक क्षेत्र उसके प्रमुख महानगरों के आसपास स्थित हैं। हाल ही के वर्षों में $१७२० करोड़ अमरीकी डालर वार्षिक आय २००४-२००५ के साथ भारत सॉफ़्टवेयर और बीपीओ सेवाओं का सबसे बडा केन्द्र बनकर उभरा है। इसके साथ ही कई लघु स्तर के उद्योग भी हैं जोकि छोटे भारतीय गाँव और भारतीय नगरों के कई नागरिकों को जीविका प्रदान करते हैं। पिछले वषों मंे भारत में वित्तीय संस्थानो ने विकास में बड़ी भूमिका निभाई है।\n" + +"\n" + +"केवल तीस लाख विदेशी पर्यटकों के प्रतिवर्ष आने के बाद भी भार्तीय पर्यटन राष्ट्रीय आय का एक अति आवश्यक परन्तु कम विकसित स्त्रोत है। पर्यटन उद्योग भारत के जीडीपी का कुल ५.३% है। पर्यटन १०% भारतीय कामगारों को आजीविका देता है। वास्तविक संख्या ४.२ करोड है। आर्थिक रूप से देखा जाए तो पर्यटन भारतीय अर्थव्यवस्था को लगभग $४०० करोड डालर प्रदान करता है। भारत के प्रमुख व्यापार सहयोगी हैं अमरीका, जापान, चीन और संयुक्त अरब अमीरात।\n" + +"\n" + +"भारत के निर्यातों में कृषि उत्पाद, चाय, कपड़ा, बहुमूल्य रत्न व ज्वैलरी, साफ़्टवेयर सेवायें, इंजीनियरिंग सामान, रसायन तथा चमड़ा उत्पाद प्रमुख हैं जबकि उसके आयातों में कच्चा तेल, मशीनरी, बहुमूल्य रत्न, फ़र्टिलाइज़र तथा रसायन प्रमुख हैं। वर्ष २००४ के लिये भारत के कुल निर्यात $६९१८ करोड़ डालर के थे जबकि उसके आयात $८९३३ करोड डालर के थे।\n" + +"\n" + +"[संपादित करें] जनवृत्त\n" + +"मुख्य लेख: भारत के लोग\n" + +"\n" + +"भारत चीन के बाद विश्व का दूसरा सबसे बड़ी जनसंख्या वाला देश है। भारत की विभिन्नताओं से भरी जनता में भाषा, जाति और धर्म, सामाजिक और राजनीतिक संगठन के मुख्य शत्रु हैं।\n" + +"हिन्दुत्व भारत का सबसे बङा धर्म है - इस चित्र मे गोआ का एक मंदिर दर्शाया गया है\n" + +"हिन्दुत्व भारत का सबसे बङा धर्म है - इस चित्र मे गोआ का एक मंदिर दर्शाया गया है\n" + +"\n" + +"भारत में ६४.८ प्रतिशत साक्षरता है जिसमे से ७५.३ % पुरुष और ५३.७% स्त्रियाँ साक्षर है। लिंग अनुपात की दृष्टि से भारत में प्रत्येक १००० पुरुषों के पीछे मात्र ९३३ महिलायें हैं। कार्य भागीदारी दर (कुल जनसंख्या मे कार्य करने वालों का भाग) ३९.१% है। पुरुषों के लिये यह दर ५१.७% और स्त्रियों के लिये २५.६% है। भारत की १००० जनसंख्या में २२.३२ जन्मों के साथ बढती जनसंख्या के आधे लोग २२.६६ वर्ष से कम आयु के हैं।\n" + +"\n" + +"यद्यपि भारत की ८०.५ प्रतिशत जनसंख्या हिन्दू है, १३.४ प्रतिशत जनसंख्या के साथ भारत विश्व में मुसलमानों की संख्या में भी इंडोनेशिया के बाद दूसरे स्थान पर है। अन्य धर्मावलम्बियों में ईसाई (२.३३ %), सिख (१.८४ %), बौद्ध (०.७६ %), जैन (०.४० %), अय्यावलि (०.१२ %), यहूदी, पारसी, अहमदी और बहाई आदि सम्मिलित हैं।\n" + +"\n" + +"भारत दो मुख्य भाषा सूत्रों, आर्यन् और द्रविङियन्, का भी स्त्रोत है (साइटेसन चाहिए)। भारत का संविधान कुल २३ भाषाओं को मान्यता देता है। हिन्दी और अंग्रेजी केन्द्रीय सरकार द्वारा सरकारी कामकाज के लिये उपयोग की जाती है। संस्कृत और तमिल जैसी अति प्राचीन भाषाएं भारत में ही जन्मी हैं। कुल मिलाकर भारत में १६५२ से भी अधिक भाषाएं एवं बोलियाँ बोली जातीं हैं।\n" + +"\n" + +"[संपादित करें] संस्कृति\n" + +"मुख्य लेख: भारतीय संस्कृति\n" + +"ताजमहल विश्व के सबसे प्रसिद्ध पर्यटक स्थलों में गिना जाता है।\n" + +"ताजमहल विश्व के सबसे प्रसिद्ध पर्यटक स्थलों में गिना जाता है।\n" + +"\n" + +"भारत की सांस्कृतिक धरोहर बहुत संपन्न है। यहां की संस्कृति अनोखी है, और वर्षों से इसके कई अवयव अबतक अक्षुण्य हैं। आक्रमणकारियों तथा प्रवासियों से विभिन्न चीजों को समेटकर यह एक मिश्रित संस्कृति बन गई है। आधुनिक भारत का समाज, भाषाएं, रीति-रिवाज इत्यादि इसका प्रमाण हैं। ताजमहल और अन्य उदाहरण, इस्लाम प्रभावित स्थापत्य कला के अतिसुन्दर नमूने हैं।\n" + +"गुम्पा नृत्य एक तिब्बती बौद्ध समाज का सिक्किम में छिपा नृत्य है। यह बौद्ध नव बर्ष में है।\n" + +"गुम्पा नृत्य एक तिब्बती बौद्ध समाज का सिक्किम में छिपा नृत्य है। यह बौद्ध नव बर्ष में है।\n" + +"\n" + +"भारतीय समाज बहुधर्मिक, बहुभाषी तथा मिश्र-सांस्कृतिक है। पारंपरिक भारतीय पारिवारिक मूल्यों को काफी आदर की दृष्टि से देखा जाता है।\n" + +"\n" + +"विभिन्न धर्मों के इस भूभाग पर कई मनभावन पर्व त्यौहार मनाए जाते हैं - दिवाली, होली, दशहरा. पोंगल तथा ओणम . ईद-उल-फितर, मुहर्रम, क्रिसमस, ईस्टर आदि भी काफ़ी लोकप्रिय हैं।\n" + +"\n" + +"हालाँकि हॉकी देश का राष्ट्रीय खेल है, क्रिकेट सबसे अधिक लोकप्रिय है। वर्तमान में फुटबॉल, हॉकी तथा टेनिस में भी बहुत भारतीयों की अभिरुचि है। देश की राष्ट्रीय क्रिकेट टीम में 1983 में एक बार विश्व कप भी जीता है। इसके अतिरिक्त वर्ष 2003 में वह विश्व कप के फाइनल तक पहुँचा था। 1930 तथा 40 के दशक में हाकी में भारत अपने चरम पर था। मेजर ध्यानचंद ने हॉकी में भारत को बहुत प्रसिद्धि दिलाई और एक समय भारत ने अमरीका को 24-0 से हराया था जो अब तर विश्व कीर्तिमान है। शतरंज के जनक देश भारत के खिलाड़ी शतरंज में भी अच्छा प्रदर्शन करते आए हैं।\n" + +"\n" + +"भारतीय खानपान बहुत ही समृद्ध है। शाकाहारी तथा मांसाहारी दोनो तरह का खाना पसन्द किया जाता है। भारतीय व्यंजन विदेशों में भी बहुत पसन्द किए जाते है।\n" + +"\n" + +"भारत में संगीत तथा नृत्य की अपनी शैलियां भी विकसित हुईं जो बहुत ही लोकप्रिय हैं। भरतनाट्यम, ओडिसी, कत्थक प्रसिद्ध भारतीय नृत्य शैली है। हिन्दुस्तानी संगीत तथा कर्नाटक संगीत भारतीय परंपरागत संगीत की दो मुख्य धाराएं हैं।\n" + +"\n" + +"वैश्वीकरण के इस युग में शेष विश्व की तरह भारतीय समाज पर भी अंग्रेजी तथा यूरोपीय प्रभाव पड़ रहा है। बाहरी लोगों की खूबियों को अपनाने की भारतीय परंपरा का नया दौर कई भारतीयों की दृष्टि में अनुचित है। एक खुले समाज के जीवन का यत्न कर रहे लोगों को मध्यमवर्गीय तथा वरिष्ठ नागरिकों की उपेक्षा का शिकार होना पड़ता है। कुछ लोग इसे भारतीय पारंपरिक मूल्यों का हनन मानते हैं। विज्ञान तथा साहित्य में अधिक प्रगति ना कर पाने की वजह से भारतीय समाज यूरोपीय लोगों पर निर्भर होता जा रहा है। ऐसे समय में लोग विदेशी अविष्कारों का भारत में प्रयोग अनुचित भी समझते हैं। हालाँकि ऐसे कई लोग है जो ऐसा विचार नहीं रखते।\n" + +"\n" + +"[संपादित करें] यह भी देखें\n" + +"\n" + +" * दक्षिण भारत\n" + +" * उत्तर पूर्वी भारत\n" + +" * भारत की भाषाएँ\n" + +"\n" + +"\n" + +"[संपादित करें] बाहरी कड़ियाँ\n" + +"\n" + +"सरकार (हिन्दी)\n" + +"\n" + +" * भारत का राष्ट्रीय पोर्टल\n" + +"\n" + +"सरकार (अंग्रेज़ी)\n" + +"\n" + +" * भारतीय सरकार का सरकारी वैबसाइट\n" + +" * भारतीय सरकार का वेबसाइट का सरकारी निर्देशिका\n" + +"\n" + +"सेनापति निर्देश (अंग्रेज़ी)\n" + +"\n" + +" * सीआईए में भारत निबन्ध\n" + +" * एन्साक्लोपीडिया ब्रिटैनिका का भारत निबन्ध\n" + +" * बीबीसी का भारत निबन्ध\n" + +"\n" + +"भारत का देश नक्शा\n" + +"\n" + +"सैटेलाइट चित्र (अंग्रेज़ी)\n" + +"\n" + +" * गूगल मानचित्र से भारत का सैटेलाइट चित्र\n" + +"\n" + +"अन्य (अंग्रेज़ी)\n" + +"\n" + +" * विकिभ्रमण का भारत निबन्ध\n" + +" * भारत ओपेन डायरैक्टरी प्रॉजेक्ट में\n" + +" * भारत यात्रा - सामूहिक यात्रा ब्लॉग\n"; + +var english = +"English language\n" + +"From Wikipedia, the free encyclopedia\n" + +"• Learn more about citing Wikipedia •\n" + +"Jump to: navigation, search\n" + +" Editing of this article by unregistered or newly registered users is currently disabled.\n" + +"If you cannot edit this article and you wish to make a change, you can discuss changes on the talk page, request unprotection, log in, or create an account.\n" + +"English \n" + +"Pronunciation: /ˈɪŋɡlɪʃ/[37]\n" + +"Spoken in: Listed in the article\n" + +"Total speakers: First language: 309[38] – 380 million[3]\n" + +"Second language: 199[39] – 600 million[40]\n" + +"Overall: 1.8 billion[41] \n" + +"Ranking: 3 (native speakers)[9][10]\n" + +"Total: 1 or 2 [11]\n" + +"Language family: Indo-European\n" + +" Germanic\n" + +" West Germanic\n" + +" Anglo–Frisian\n" + +" Anglic\n" + +" English \n" + +"Writing system: Latin (English variant) \n" + +"Official status\n" + +"Official language of: 53 countries\n" + +"Flag of the United Nations United Nations\n" + +"Regulated by: no official regulation\n" + +"Language codes\n" + +"ISO 639-1: en\n" + +"ISO 639-2: eng\n" + +"ISO 639-3: eng \n" + +"World countries, states, and provinces where English is a primary language are dark blue; countries, states and provinces where it is an official but not a primary language are light blue. English is also one of the official languages of the European Union.\n" + +"Note: This page may contain IPA phonetic symbols in Unicode. See IPA chart for English for an English-based pronunciation key.\n" + +"\n" + +"English is a West Germanic language originating in England, and the first language for most people in Australia, Canada, the Commonwealth Caribbean, Ireland, New Zealand, the United Kingdom and the United States of America (also commonly known as the Anglosphere). It is used extensively as a second language and as an official language throughout the world, especially in Commonwealth countries such as India, Sri Lanka, Pakistan and South Africa, and in many international organisations.\n" + +"\n" + +"Modern English is sometimes described as the global lingua franca.[1][2] English is the dominant international language in communications, science, business, aviation, entertainment, radio and diplomacy.[3] The influence of the British Empire is the primary reason for the initial spread of the language far beyond the British Isles.[4] Following World War II, the growing economic and cultural influence of the United States has significantly accelerated the spread of the language.\n" + +"\n" + +"A working knowledge of English is required in certain fields, professions, and occupations. As a result over a billion people speak English at least at a basic level (see English language learning and teaching). English is one of six official languages of the United Nations.\n" + +"Contents\n" + +"[hide]\n" + +"\n" + +" * 1 History\n" + +" * 2 Classification and related languages\n" + +" * 3 Geographical distribution\n" + +" o 3.1 English as a global language\n" + +" o 3.2 Dialects and regional varieties\n" + +" o 3.3 Constructed varieties of English\n" + +" * 4 Phonology\n" + +" o 4.1 Vowels\n" + +" + 4.1.1 See also\n" + +" o 4.2 Consonants\n" + +" + 4.2.1 Voicing and aspiration\n" + +" o 4.3 Supra-segmental features\n" + +" + 4.3.1 Tone groups\n" + +" + 4.3.2 Characteristics of intonation\n" + +" * 5 Grammar\n" + +" * 6 Vocabulary\n" + +" o 6.1 Number of words in English\n" + +" o 6.2 Word origins\n" + +" + 6.2.1 Dutch origins\n" + +" + 6.2.2 French origins\n" + +" * 7 Writing system\n" + +" o 7.1 Basic sound-letter correspondence\n" + +" o 7.2 Written accents\n" + +" * 8 Formal written English\n" + +" * 9 Basic and simplified versions\n" + +" * 10 Notes\n" + +" * 11 References\n" + +" * 12 See also\n" + +" * 13 External links\n" + +" o 13.1 Dictionaries\n" + +"\n" + +"History\n" + +"\n" + +" Main article: History of the English language\n" + +"\n" + +"English is an Anglo-Frisian language. Germanic-speaking peoples from northwest Germany (Saxons and Angles) and Jutland (Jutes) invaded what is now known as Eastern England around the fifth century AD. It is a matter of debate whether the Old English language spread by displacement of the original population, or the native Celts gradually adopted the language and culture of a new ruling class, or a combination of both of these processes (see Sub-Roman Britain).\n" + +"\n" + +"Whatever their origin, these Germanic dialects eventually coalesced to a degree (there remained geographical variation) and formed what is today called Old English. Old English loosely resembles some coastal dialects in what are now northwest Germany and the Netherlands (i.e., Frisia). Throughout the history of written Old English, it retained a synthetic structure closer to that of Proto-Indo-European, largely adopting West Saxon scribal conventions, while spoken Old English became increasingly analytic in nature, losing the more complex noun case system, relying more heavily on prepositions and fixed word order to convey meaning. This is evident in the Middle English period, when literature was to an increasing extent recorded with spoken dialectal variation intact, after written Old English lost its status as the literary language of the nobility. It is postulated that the early development of the language was influenced by a Celtic substratum.[5][6] Later, it was influenced by the related North Germanic language Old Norse, spoken by the Vikings who settled mainly in the north and the east coast down to London, the area known as the Danelaw.\n" + +"\n" + +"The Norman Conquest of England in 1066 profoundly influenced the evolution of the language. For about 300 years after this, the Normans used Anglo-Norman, which was close to Old French, as the language of the court, law and administration. By the fourteenth century, Anglo-Norman borrowings had contributed roughly 10,000 words to English, of which 75% remain in use. These include many words pertaining to the legal and administrative fields, but also include common words for food, such as mutton[7] and beef[8]. The Norman influence gave rise to what is now referred to as Middle English. Later, during the English Renaissance, many words were borrowed directly from Latin (giving rise to a number of doublets) and Greek, leaving a parallel vocabulary that persists into modern times. By the seventeenth century there was a reaction in some circles against so-called inkhorn terms.\n" + +"\n" + +"During the fifteenth century, Middle English was transformed by the Great Vowel Shift, the spread of a prestigious South Eastern-based dialect in the court, administration and academic life, and the standardising effect of printing. Early Modern English can be traced back to around the Elizabethan period.\n" + +"\n" + +"Classification and related languages\n" + +"\n" + +"The English language belongs to the western sub-branch of the Germanic branch of the Indo-European family of languages.\n" + +"\n" + +"The question as to which is the nearest living relative of English is a matter of discussion. Apart from such English-lexified creole languages such as Tok Pisin, Scots (spoken primarily in Scotland and parts of Northern Ireland) is not a Gaelic language, but is part of the English family of languages: both Scots and modern English are descended from Old English, also known as Anglo-Saxon. The closest relative to English after Scots is Frisian, which is spoken in the Northern Netherlands and Northwest Germany. Other less closely related living West Germanic languages include German, Low Saxon, Dutch, and Afrikaans. The North Germanic languages of Scandinavia are less closely related to English than the West Germanic languages.\n" + +"\n" + +"Many French words are also intelligible to an English speaker (though pronunciations are often quite different) because English absorbed a large vocabulary from Norman and French, via Anglo-Norman after the Norman Conquest and directly from French in subsequent centuries. As a result, a large portion of English vocabulary is derived from French, with some minor spelling differences (word endings, use of old French spellings, etc.), as well as occasional divergences in meaning, in so-called \"faux amis\", or false friends.\n" + +"\n" + +"Geographical distribution\n" + +"\n" + +" See also: List of countries by English-speaking population\n" + +"\n" + +"Over 380 million people speak English as their first language. English today is probably the third largest language by number of native speakers, after Mandarin Chinese and Spanish.[9][10] However, when combining native and non-native speakers it is probably the most commonly spoken language in the world, though possibly second to a combination of the Chinese Languages, depending on whether or not distinctions in the latter are classified as \"languages\" or \"dialects.\"[11][12] Estimates that include second language speakers vary greatly from 470 million to over a billion depending on how literacy or mastery is defined.[13][14] There are some who claim that non-native speakers now outnumber native speakers by a ratio of 3 to 1.[15]\n" + +"\n" + +"The countries with the highest populations of native English speakers are, in descending order: United States (215 million),[16] United Kingdom (58 million),[17] Canada (17.7 million),[18] Australia (15 million),[19] Ireland (3.8 million),[17] South Africa (3.7 million),[20] and New Zealand (3.0-3.7 million).[21] Countries such as Jamaica and Nigeria also have millions of native speakers of dialect continuums ranging from an English-based creole to a more standard version of English. Of those nations where English is spoken as a second language, India has the most such speakers ('Indian English') and linguistics professor David Crystal claims that, combining native and non-native speakers, India now has more people who speak or understand English than any other country in the world.[22] Following India is the People's Republic of China.[23]\n" + +"Distribution of native English speakers by country (Crystal 1997)\n" + +"Distribution of native English speakers by country (Crystal 1997)\n" + +" Country Native speakers\n" + +"1 USA 214,809,000[16]\n" + +"2 UK 58,200,000[17]\n" + +"3 Canada 17,694,830[18]\n" + +"4 Australia 15,013,965[19]\n" + +"5 Ireland 4,200,000+ (Approx)[17]\n" + +"6 South Africa 3,673,203[20]\n" + +"7 New Zealand 3,500,000+ (Approx)[21]\n" + +"8 Singapore 665,087[24]\n" + +"\n" + +"English is the primary language in Anguilla, Antigua and Barbuda, Australia (Australian English), the Bahamas, Barbados, Bermuda, Belize, the British Indian Ocean Territory, the British Virgin Islands, Canada (Canadian English), the Cayman Islands, Dominica, the Falkland Islands, Gibraltar, Grenada, Guernsey (Guernsey English), Guyana, Ireland (Hiberno-English), Isle of Man (Manx English), Jamaica (Jamaican English), Jersey, Montserrat, Nauru, New Zealand (New Zealand English), Pitcairn Islands, Saint Helena, Saint Lucia, Saint Kitts and Nevis, Saint Vincent and the Grenadines, Singapore, South Georgia and the South Sandwich Islands, Trinidad and Tobago, the Turks and Caicos Islands, the United Kingdom, the U.S. Virgin Islands, and the United States (various forms of American English).\n" + +"\n" + +"In many other countries, where English is not the most spoken language, it is an official language; these countries include Botswana, Cameroon, Fiji, the Federated States of Micronesia, Ghana, Gambia, Hong Kong, India, Kiribati, Lesotho, Liberia, Kenya, Madagascar, Malta, the Marshall Islands, Namibia, Nigeria, Pakistan, Papua New Guinea, the Philippines, Puerto Rico, Rwanda, the Solomon Islands, Samoa, Sierra Leone, Singapore, Sri Lanka, Swaziland, Tanzania, Uganda, Zambia, and Zimbabwe. It is also one of the 11 official languages that are given equal status in South Africa (\"South African English\"). English is also an important language in several former colonies or current dependent territories of the United Kingdom and the United States, such as in Hong Kong and Mauritius.\n" + +"\n" + +"English is not an official language in either the United States or the United Kingdom.[25][26] Although the United States federal government has no official languages, English has been given official status by 30 of the 50 state governments.[27]\n" + +"\n" + +"English as a global language\n" + +"\n" + +" See also: English on the Internet and global language\n" + +"\n" + +"Because English is so widely spoken, it has often been referred to as a \"global language\", the lingua franca of the modern era.[2] While English is not an official language in many countries, it is currently the language most often taught as a second language around the world. Some linguists believe that it is no longer the exclusive cultural sign of \"native English speakers\", but is rather a language that is absorbing aspects of cultures worldwide as it continues to grow. It is, by international treaty, the official language for aerial and maritime communications, as well as one of the official languages of the European Union, the United Nations, and most international athletic organisations, including the International Olympic Committee.\n" + +"\n" + +"English is the language most often studied as a foreign language in the European Union (by 89% of schoolchildren), followed by French (32%), German (18%), and Spanish (8%).[28] In the EU, a large fraction of the population reports being able to converse to some extent in English. Among non-English speaking countries, a large percentage of the population claimed to be able to converse in English in the Netherlands (87%), Sweden (85%), Denmark (83%), Luxembourg (66%), Finland (60%), Slovenia (56%), Austria (53%), Belgium (52%), and Germany (51%). [29] Norway and Iceland also have a large majority of competent English-speakers.\n" + +"\n" + +"Books, magazines, and newspapers written in English are available in many countries around the world. English is also the most commonly used language in the sciences.[2] In 1997, the Science Citation Index reported that 95% of its articles were written in English, even though only half of them came from authors in English-speaking countries.\n" + +"\n" + +"Dialects and regional varieties\n" + +"\n" + +" Main article: List of dialects of the English language\n" + +"\n" + +"The expansion of the British Empire and—since WWII—the primacy of the United States have spread English throughout the globe.[2] Because of that global spread, English has developed a host of English dialects and English-based creole languages and pidgins.\n" + +"\n" + +"The major varieties of English include, in most cases, several subvarieties, such as Cockney slang within British English; Newfoundland English within Canadian English; and African American Vernacular English (\"Ebonics\") and Southern American English within American English. English is a pluricentric language, without a central language authority like France's Académie française; and, although no variety is clearly considered the only standard, there are a number of accents considered to be more prestigious, such as Received Pronunciation in Britain.\n" + +"\n" + +"Scots developed — largely independently — from the same origins, but following the Acts of Union 1707 a process of language attrition began, whereby successive generations adopted more and more features from English causing dialectalisation. Whether it is now a separate language or a dialect of English better described as Scottish English is in dispute. The pronunciation, grammar and lexis of the traditional forms differ, sometimes substantially, from other varieties of English.\n" + +"\n" + +"Because of the wide use of English as a second language, English speakers have many different accents, which often signal the speaker's native dialect or language. For the more distinctive characteristics of regional accents, see Regional accents of English speakers, and for the more distinctive characteristics of regional dialects, see List of dialects of the English language.\n" + +"\n" + +"Just as English itself has borrowed words from many different languages over its history, English loanwords now appear in a great many languages around the world, indicative of the technological and cultural influence of its speakers. Several pidgins and creole languages have formed using an English base, such as Jamaican Creole, Nigerian Pidgin, and Tok Pisin. There are many words in English coined to describe forms of particular non-English languages that contain a very high proportion of English words. Franglais, for example, is used to describe French with a very high English word content; it is found on the Channel Islands. Another variant, spoken in the border bilingual regions of Québec in Canada, is called FrEnglish.\n" + +"\n" + +"Constructed varieties of English\n" + +"\n" + +" * Basic English is simplified for easy international use. It is used by manufacturers and other international businesses to write manuals and communicate. Some English schools in Asia teach it as a practical subset of English for use by beginners.\n" + +" * Special English is a simplified version of English used by the Voice of America. It uses a vocabulary of only 1500 words.\n" + +" * English reform is an attempt to improve collectively upon the English language.\n" + +" * Seaspeak and the related Airspeak and Policespeak, all based on restricted vocabularies, were designed by Edward Johnson in the 1980s to aid international cooperation and communication in specific areas. There is also a tunnelspeak for use in the Channel Tunnel.\n" + +" * English as a lingua franca for Europe and Euro-English are concepts of standardising English for use as a second language in continental Europe.\n" + +" * Manually Coded English — a variety of systems have been developed to represent the English language with hand signals, designed primarily for use in deaf education. These should not be confused with true sign languages such as British Sign Language and American Sign Language used in Anglophone countries, which are independent and not based on English.\n" + +" * E-Prime excludes forms of the verb to be.\n" + +"\n" + +"Euro-English (also EuroEnglish or Euro-English) terms are English translations of European concepts that are not native to English-speaking countries. Due to the United Kingdom's (and even the Republic of Ireland's) involvement in the European Union, the usage focuses on non-British concepts. This kind of Euro-English was parodied when English was \"made\" one of the constituent languages of Europanto.\n" + +"\n" + +"Phonology\n" + +"\n" + +" Main article: English phonology\n" + +"\n" + +"Vowels\n" + +"IPA Description word\n" + +"monophthongs\n" + +"i/iː Close front unrounded vowel bead\n" + +"ɪ Near-close near-front unrounded vowel bid\n" + +"ɛ Open-mid front unrounded vowel bed\n" + +"æ Near-open front unrounded vowel bad\n" + +"ɒ Open back rounded vowel bod 1\n" + +"ɔ Open-mid back rounded vowel pawed 2\n" + +"ɑ/ɑː Open back unrounded vowel bra\n" + +"ʊ Near-close near-back rounded vowel good\n" + +"u/uː Close back rounded vowel booed\n" + +"ʌ/ɐ Open-mid back unrounded vowel, Near-open central vowel bud\n" + +"ɝ/ɜː Open-mid central unrounded vowel bird 3\n" + +"ə Schwa Rosa's 4\n" + +"ɨ Close central unrounded vowel roses 5\n" + +"diphthongs\n" + +"e(ɪ)/eɪ Close-mid front unrounded vowel\n" + +"Close front unrounded vowel bayed 6\n" + +"o(ʊ)/əʊ Close-mid back rounded vowel\n" + +"Near-close near-back rounded vowel bode 6\n" + +"aɪ Open front unrounded vowel\n" + +"Near-close near-front unrounded vowel cry\n" + +"aʊ Open front unrounded vowel\n" + +"Near-close near-back rounded vowel bough\n" + +"ɔɪ Open-mid back rounded vowel\n" + +"Close front unrounded vowel boy\n" + +"ʊɝ/ʊə Near-close near-back rounded vowel\n" + +"Schwa boor 9\n" + +"ɛɝ/ɛə Open-mid front unrounded vowel\n" + +"Schwa fair 10\n" + +"\n" + +"Notes:\n" + +"\n" + +"It is the vowels that differ most from region to region.\n" + +"\n" + +"Where symbols appear in pairs, the first corresponds to American English, General American accent; the second corresponds to British English, Received Pronunciation.\n" + +"\n" + +" 1. American English lacks this sound; words with this sound are pronounced with /ɑ/ or /ɔ/.\n" + +" 2. Many dialects of North American English do not have this vowel. See Cot-caught merger.\n" + +" 3. The North American variation of this sound is a rhotic vowel.\n" + +" 4. Many speakers of North American English do not distinguish between these two unstressed vowels. For them, roses and Rosa's are pronounced the same, and the symbol usually used is schwa /ə/.\n" + +" 5. This sound is often transcribed with /i/ or with /ɪ/.\n" + +" 6. The diphthongs /eɪ/ and /oʊ/ are monophthongal for many General American speakers, as /eː/ and /oː/.\n" + +" 7. The letter <U> can represent either /u/ or the iotated vowel /ju/. In BRP, if this iotated vowel /ju/ occurs after /t/, /d/, /s/ or /z/, it often triggers palatalization of the preceding consonant, turning it to /ʨ/, /ʥ/, /ɕ/ and /ʑ/ respectively, as in tune, during, sugar, and azure. In American English, palatalization does not generally happen unless the /ju/ is followed by r, with the result that /(t, d,s, z)jur/ turn to /tʃɚ/, /dʒɚ/, /ʃɚ/ and /ʒɚ/ respectively, as in nature, verdure, sure, and treasure.\n" + +" 8. Vowel length plays a phonetic role in the majority of English dialects, and is said to be phonemic in a few dialects, such as Australian English and New Zealand English. In certain dialects of the modern English language, for instance General American, there is allophonic vowel length: vowel phonemes are realized as long vowel allophones before voiced consonant phonemes in the coda of a syllable. Before the Great Vowel Shift, vowel length was phonemically contrastive.\n" + +" 9. This sound only occurs in non-rhotic accents. In some accents, this sound may be, instead of /ʊə/, /ɔ:/. See pour-poor merger.\n" + +" 10. This sound only occurs in non-rhotic accents. In some accents, the schwa offglide of /ɛə/ may be dropped, monophthising and lengthening the sound to /ɛ:/.\n" + +"\n" + +"See also\n" + +"\n" + +" * International Phonetic Alphabet for English for more vowel charts.\n" + +"\n" + +"Consonants\n" + +"\n" + +"This is the English Consonantal System using symbols from the International Phonetic Alphabet (IPA).\n" + +" bilabial labio-\n" + +"dental dental alveolar post-\n" + +"alveolar palatal velar glottal\n" + +"plosive p b t d k ɡ \n" + +"nasal m n ŋ 1 \n" + +"flap ɾ 2 \n" + +"fricative f v θ ð 3 s z ʃ ʒ 4 ç 5 x 6 h\n" + +"affricate tʃ dʒ 4 \n" + +"approximant ɹ 4 j \n" + +"lateral approximant l \n" + +" labial-velar\n" + +"approximant ʍ w 7\n" + +"\n" + +" 1. The velar nasal [ŋ] is a non-phonemic allophone of /n/ in some northerly British accents, appearing only before /k/ and /g/. In all other dialects it is a separate phoneme, although it only occurs in syllable codas.\n" + +" 2. The alveolar flap [ɾ] is an allophone of /t/ and /d/ in unstressed syllables in North American English and Australian English.[30] This is the sound of tt or dd in the words latter and ladder, which are homophones for many speakers of North American English. In some accents such as Scottish English and Indian English it replaces /ɹ/. This is the same sound represented by single r in most varieties of Spanish.\n" + +" 3. In some dialects, such as Cockney, the interdentals /θ/ and /ð/ are usually merged with /f/ and /v/, and in others, like African American Vernacular English, /ð/ is merged with dental /d/. In some Irish varieties, /θ/ and /ð/ become the corresponding dental plosives, which then contrast with the usual alveolar plosives.\n" + +" 4. The sounds /ʃ/, /ʒ/, and /ɹ/ are labialised in some dialects. Labialisation is never contrastive in initial position and therefore is sometimes not transcribed. Most speakers of General American realize <r> (always rhoticized) as the retroflex approximant /ɻ/, whereas the same is realized in Scottish English, etc. as the alveolar trill.\n" + +" 5. The voiceless palatal fricative /ç/ is in most accents just an allophone of /h/ before /j/; for instance human /çjuːmən/. However, in some accents (see this), the /j/ is dropped, but the initial consonant is the same.\n" + +" 6. The voiceless velar fricative /x/ is used only by Scottish or Welsh speakers of English for Scots/Gaelic words such as loch /lɒx/ or by some speakers for loanwords from German and Hebrew like Bach /bax/ or Chanukah /xanuka/. In some dialects such as Scouse (Liverpool) either [x] or the affricate [kx] may be used as an allophone of /k/ in words such as docker [dɒkxə]. Most native speakers have a great deal of trouble pronouncing it correctly when learning a foreign language. Most speakers use the sounds [k] and [h] instead.\n" + +" 7. Voiceless w [ʍ] is found in Scottish and Irish English, as well as in some varieties of American, New Zealand, and English English. In most other dialects it is merged with /w/, in some dialects of Scots it is merged with /f/.\n" + +"\n" + +"Voicing and aspiration\n" + +"\n" + +"Voicing and aspiration of stop consonants in English depend on dialect and context, but a few general rules can be given:\n" + +"\n" + +" * Voiceless plosives and affricates (/ p/, / t/, / k/, and / tʃ/) are aspirated when they are word-initial or begin a stressed syllable — compare pin [pʰɪn] and spin [spɪn], crap [kʰɹ̥æp] and scrap [skɹæp].\n" + +" o In some dialects, aspiration extends to unstressed syllables as well.\n" + +" o In other dialects, such as Indo-Pakistani English, all voiceless stops remain unaspirated.\n" + +" * Word-initial voiced plosives may be devoiced in some dialects.\n" + +" * Word-terminal voiceless plosives may be unreleased or accompanied by a glottal stop in some dialects (e.g. many varieties of American English) — examples: tap [tʰæp̚], sack [sæk̚].\n" + +" * Word-terminal voiced plosives may be devoiced in some dialects (e.g. some varieties of American English) — examples: sad [sæd̥], bag [bæɡ̊]. In other dialects they are fully voiced in final position, but only partially voiced in initial position.\n" + +"\n" + +"Supra-segmental features\n" + +"\n" + +"Tone groups\n" + +"\n" + +"English is an intonation language. This means that the pitch of the voice is used syntactically, for example, to convey surprise and irony, or to change a statement into a question.\n" + +"\n" + +"In English, intonation patterns are on groups of words, which are called tone groups, tone units, intonation groups or sense groups. Tone groups are said on a single breath and, as a consequence, are of limited length, more often being on average five words long or lasting roughly two seconds. For example:\n" + +"\n" + +" - /duː juː niːd ˈɛnɪˌθɪŋ/ Do you need anything?\n" + +" - /aɪ dəʊnt | nəʊ/ I don't, no\n" + +" - /aɪ dəʊnt nəʊ/ I don't know (contracted to, for example, - /aɪ dəʊnəʊ/ or /aɪ dənəʊ/ I dunno in fast or colloquial speech that de-emphasises the pause between don't and know even further)\n" + +"\n" + +"Characteristics of intonation\n" + +"\n" + +"English is a strongly stressed language, in that certain syllables, both within words and within phrases, get a relative prominence/loudness during pronunciation while the others do not. The former kind of syllables are said to be accentuated/stressed and the latter are unaccentuated/unstressed. All good dictionaries of English mark the accentuated syllable(s) by either placing an apostrophe-like ( ˈ ) sign either before (as in IPA, Oxford English Dictionary, or Merriam-Webster dictionaries) or after (as in many other dictionaries) the syllable where the stress accent falls. In general, for a two-syllable word in English, it can be broadly said that if it is a noun or an adjective, the first syllable is accentuated; but if it is a verb, the second syllable is accentuated.\n" + +"\n" + +"Hence in a sentence, each tone group can be subdivided into syllables, which can either be stressed (strong) or unstressed (weak). The stressed syllable is called the nuclear syllable. For example:\n" + +"\n" + +" That | was | the | best | thing | you | could | have | done!\n" + +"\n" + +"Here, all syllables are unstressed, except the syllables/words best and done, which are stressed. Best is stressed harder and, therefore, is the nuclear syllable.\n" + +"\n" + +"The nuclear syllable carries the main point the speaker wishes to make. For example:\n" + +"\n" + +" John hadn't stolen that money. (... Someone else had.)\n" + +" John hadn't stolen that money. (... You said he had. or ... Not at that time, but later he did.)\n" + +" John hadn't stolen that money. (... He acquired the money by some other means.)\n" + +" John hadn't stolen that money. (... He had stolen some other money.)\n" + +" John hadn't stolen that money. (... He stole something else.)\n" + +"\n" + +"Also\n" + +"\n" + +" I didn't tell her that. (... Someone else told her.)\n" + +" I didn't tell her that. (... You said I did. or ... But now I will!)\n" + +" I didn't tell her that. (... I didn't say it; she could have inferred it, etc.)\n" + +" I didn't tell her that. (... I told someone else.)\n" + +" I didn't tell her that. (... I told her something else.)\n" + +"\n" + +"This can also be used to express emotion:\n" + +"\n" + +" Oh really? (...I didn't know that)\n" + +" Oh really? (...I disbelieve you)\n" + +"\n" + +"The nuclear syllable is spoken more loudly than the others and has a characteristic change of pitch. The changes of pitch most commonly encountered in English are the rising pitch and the falling pitch, although the fall-rising pitch and/or the rise-falling pitch are sometimes used. In this opposition between falling and rising pitch, which plays a larger role in English than in most other languages, falling pitch conveys certainty and rising pitch uncertainty. This can have a crucial impact on meaning, specifically in relation to polarity, the positive–negative opposition; thus, falling pitch means \"polarity known\", while rising pitch means \"polarity unknown\". This underlies the rising pitch of yes/no questions. For example:\n" + +"\n" + +" When do you want to be paid?\n" + +" Now? (Rising pitch. In this case, it denotes a question: \"Can I be paid now?\" or \"Do you desire to be paid now?\")\n" + +" Now. (Falling pitch. In this case, it denotes a statement: \"I choose to be paid now.\")\n" + +"\n" + +"Grammar\n" + +"\n" + +" Main article: English grammar\n" + +"\n" + +"English grammar has minimal inflection compared with most other Indo-European languages. For example, Modern English, unlike Modern German or Dutch and the Romance languages, lacks grammatical gender and adjectival agreement. Case marking has almost disappeared from the language and mainly survives in pronouns. The patterning of strong (e.g. speak/spoke/spoken) versus weak verbs inherited from its Germanic origins has declined in importance in modern English, and the remnants of inflection (such as plural marking) have become more regular.\n" + +"\n" + +"At the same time, the language has become more analytic, and has developed features such as modal verbs and word order as rich resources for conveying meaning. Auxiliary verbs mark constructions such as questions, negative polarity, the passive voice and progressive tenses.\n" + +"\n" + +"Vocabulary\n" + +"\n" + +"The English vocabulary has changed considerably over the centuries.[31]\n" + +"\n" + +"Germanic words (generally words of Old English or to a lesser extent Norse origin) which include all the basics such as pronouns (I, my, you, it) and conjunctions (and, or, but) tend to be shorter than the Latinate words of English, and more common in ordinary speech. The longer Latinate words are often regarded as more elegant or educated. However, the excessive or superfluous use of Latinate words is considered at times to be either pretentious (as in the stereotypical policeman's talk of \"apprehending the suspect\") or an attempt to obfuscate an issue. George Orwell's essay \"Politics and the English Language\" is critical of this, as well as other perceived abuses of the language.\n" + +"\n" + +"An English speaker is in many cases able to choose between Germanic and Latinate synonyms: come or arrive; sight or vision; freedom or liberty. In some cases there is a choice between a Germanic derived word (oversee), a Latin derived word (supervise), and a French word derived from the same Latin word (survey). The richness of the language arises from the variety of different meanings and nuances such synonyms harbour, enabling the speaker to express fine variations or shades of thought. Familiarity with the etymology of groups of synonyms can give English speakers greater control over their linguistic register. See: List of Germanic and Latinate equivalents.\n" + +"\n" + +"An exception to this and a peculiarity perhaps unique to English is that the nouns for meats are commonly different from, and unrelated to, those for the animals from which they are produced, the animal commonly having a Germanic name and the meat having a French-derived one. Examples include: deer and venison; cow and beef; swine/pig and pork, or sheep and mutton. This is assumed to be a result of the aftermath of the Norman invasion, where a French-speaking elite were the consumers of the meat, produced by English-speaking lower classes.\n" + +"\n" + +"In everyday speech, the majority of words will normally be Germanic. If a speaker wishes to make a forceful point in an argument in a very blunt way, Germanic words will usually be chosen. A majority of Latinate words (or at least a majority of content words) will normally be used in more formal speech and writing, such as a courtroom or an encyclopedia article. However, there are other Latinate words that are used normally in everyday speech and do not sound formal; these are mainly words for concepts that no longer have Germanic words, and are generally assimilated better and in many cases do not appear Latinate. For instance, the words mountain, valley, river, aunt, uncle, move, use, push and stay are all Latinate.\n" + +"\n" + +"English is noted for the vast size of its active vocabulary and its fluidity.[citation needed][weasel words] English easily accepts technical terms into common usage and imports new words and phrases that often come into common usage. Examples of this phenomenon include: cookie, Internet and URL (technical terms), as well as genre, über, lingua franca and amigo (imported words/phrases from French, German, modern Latin, and Spanish, respectively). In addition, slang often provides new meanings for old words and phrases. In fact, this fluidity is so pronounced that a distinction often needs to be made between formal forms of English and contemporary usage. See also: sociolinguistics.\n" + +"\n" + +"Number of words in English\n" + +"\n" + +"English has an extraordinarily rich vocabulary and willingness to absorb new words. As the General Explanations at the beginning of the Oxford English Dictionary states:\n" + +"\n" + +" The Vocabulary of a widely diffused and highly cultivated living language is not a fixed quantity circumscribed by definite limits... there is absolutely no defining line in any direction: the circle of the English language has a well-defined centre but no discernible circumference.\n" + +"\n" + +"The vocabulary of English is undoubtedly vast, but assigning a specific number to its size is more a matter of definition than of calculation. Unlike other languages, there is no Academy to define officially accepted words. Neologisms are coined regularly in medicine, science and technology and other fields, and new slang is constantly developed. Some of these new words enter wide usage; others remain restricted to small circles. Foreign words used in immigrant communities often make their way into wider English usage. Archaic, dialectal, and regional words might or might not be widely considered as \"English\".\n" + +"\n" + +"The Oxford English Dictionary, 2nd edition (OED2) includes over 600,000 definitions, following a rather inclusive policy:\n" + +"\n" + +" It embraces not only the standard language of literature and conversation, whether current at the moment, or obsolete, or archaic, but also the main technical vocabulary, and a large measure of dialectal usage and slang (Supplement to the OED, 1933).[32]\n" + +"\n" + +"The editors of Webster's Third New International Dictionary, Unabridged (475,000 main headwords) in their preface, estimate the number to be much higher. It is estimated that about 25,000 words are added to the language each year.[33]\n" + +"\n" + +"Word origins\n" + +"Influences in English vocabulary\n" + +"Influences in English vocabulary\n" + +"\n" + +" Main article: Lists of English words of international origin\n" + +"\n" + +"One of the consequences of the French influence is that the vocabulary of English is, to a certain extent, divided between those words which are Germanic (mostly Old English) and those which are \"Latinate\" (Latin-derived, either directly from Norman French or other Romance languages).\n" + +"\n" + +"Numerous sets of statistics have been proposed to demonstrate the various origins of English vocabulary. None, as yet, are considered definitive by a majority of linguists.\n" + +"\n" + +"A computerised survey of about 80,000 words in the old Shorter Oxford Dictionary (3rd ed.) was published in Ordered Profusion by Thomas Finkenstaedt and Dieter Wolff (1973)[34] that estimated the origin of English words as follows:\n" + +"\n" + +" * Langue d'oïl, including French and Old Norman: 28.3%\n" + +" * Latin, including modern scientific and technical Latin: 28.24%\n" + +" * Other Germanic languages (including words directly inherited from Old English): 25%\n" + +" * Greek: 5.32%\n" + +" * No etymology given: 4.03%\n" + +" * Derived from proper names: 3.28%\n" + +" * All other languages contributed less than 1% (e.g. Arabic-English loanwords)\n" + +"\n" + +"A survey by Joseph M. Williams in Origins of the English Language of 10,000 words taken from several thousand business letters[35] gave this set of statistics:\n" + +"\n" + +" * French (langue d'oïl), 41%\n" + +" * \"Native\" English, 33%\n" + +" * Latin, 15%\n" + +" * Danish, 2%\n" + +" * Dutch, 1%\n" + +" * Other, 10%\n" + +"\n" + +"However, 83% of the 1,000 most-common English words are Anglo-Saxon in origin. [36]\n" + +"\n" + +"Dutch origins\n" + +"\n" + +" Main article: List of English words of Dutch origin\n" + +"\n" + +"Words describing the navy, types of ships, and other objects or activities on the water are often from Dutch origin. Yacht (Jacht) and cruiser (kruiser) are examples.\n" + +"\n" + +"French origins\n" + +"\n" + +" Main article: List of French phrases used by English speakers\n" + +"\n" + +"There are many words of French origin in English, such as competition, art, table, publicity, police, role, routine, machine, force, and many others that have been and are being anglicised; they are now pronounced according to English rules of phonology, rather than French. A large portion of English vocabulary is of French or Oïl language origin, most derived from, or transmitted via, the Anglo-Norman spoken by the upper classes in England for several hundred years after the Norman Conquest.\n"; + + +var greek = +"Ελλάδα\n" + +"Από τη Βικιπαίδεια, την ελεύθερη εγκυκλοπαίδεια\n" + +"Ελληνική Δημοκρατία\n" + +" \n" + +"Σημαία Εθνόσημο\n" + +"Εθνικό σύνθημα: Ελευθερία ή Θάνατος\n" + +"Εθνικός ύμνος: Ὕμνος εἰς τὴν Ἐλευθερίαν\n" + +"\n" + +"Πρωτεύουσα Αθήνα \n" + +"38.01.36N 23.44.00E\n" + +"\n" + +"Μεγαλύτερη πόλη Αθήνα\n" + +"Επίσημες γλώσσες Ελληνική\n" + +"Πολίτευμα\n" + +"\n" + +"Πρόεδρος της Δημοκρατίας\n" + +"Πρωθυπουργός Προεδρευόμενη\n" + +"Κοινοβουλευτική Δημοκρατία\n" + +"Κάρολος Παπούλιας\n" + +"Κωνσταντίνος Καραμανλής\n" + +"Ανεξαρτησία\n" + +"- Κηρύχθηκε\n" + +"- Αναγνωρίστηκε\n" + +"\n" + +"25 Μαρτίου, 1821\n" + +"1828\n" + +"Έκταση\n" + +" - Σύνολο\n" + +" - Νερό (%) \n" + +"131.940 km² (94ηη)\n" + +"%0.86\n" + +"Πληθυσμός\n" + +" - Εκτίμηση 2006\n" + +" - Απογραφή 2001\n" + +" - Πυκνότητα \n" + +"11.120.000 [1] (72ηη)\n" + +"10.964.020\n" + +"83.1 κάτ./km² (87ηη)\n" + +"Α.Ε.Π.\n" + +" - Ολικό\n" + +" - Κατά κεφαλή Εκτίμηση 2007\n" + +"$305,595 δισ. (37η)\n" + +"$27,360 (27η)\n" + +"Νόμισμα Ευρώ\n" + +"(€)\n" + +"Ζώνη ώρας\n" + +" - Θερινή ώρα (UTC+2)\n" + +"(UTC+3)\n" + +"Internet TLD .gr\n" + +"Κωδικός κλήσης +30\n" + +"Η Ελλάδα (αρχαΐζουσα: Ἑλλάς, επίσημα: Ελληνική Δημοκρατία), είναι χώρα στην νοτιοανατολική Ευρώπη, στο νοτιότερο άκρο της Βαλκανικής χερσονήσου, στην Ανατολική Μεσόγειο. Συνορεύει στην ξηρά, βόρεια με την Πρώην Γιουγκοσλαβική Δημοκρατία της Μακεδονίας και την Βουλγαρία, στα βορειοδυτικά με την Αλβανία και στα βορειοανατολικά με την Τουρκία. Βρέχεται ανατολικά από το Αιγαίο Πέλαγος, στα δυτικά και νότια από το Ιόνιο και από την Μεσόγειο Θάλασσα. Είναι το λίκνο του Δυτικού πολιτισμού. Η Ελλάδα έχει μια μακρά και πλούσια ιστορία κατά την οποία άσκησε μεγάλη πολιτισμική επίδραση σε τρεις ηπείρους.\n" + +"Πίνακας περιεχομένων [Απόκρυψη]\n" + +"1 Ιστορία\n" + +"2 Πολιτικά\n" + +"2.1 Κόμματα\n" + +"2.2 Κυβέρνηση\n" + +"3 Περιφέρειες\n" + +"3.1 Βουνά της Ελλάδας\n" + +"3.2 Λίμνες της Ελλάδας\n" + +"3.3 Ποτάμια της Ελλάδας\n" + +"3.4 Κλίμα\n" + +"4 Οικονομία\n" + +"5 Δημογραφία\n" + +"6 Ένοπλες δυνάμεις και Σώματα ασφαλείας\n" + +"6.1 Υποχρεωτική στράτευση\n" + +"7 Πολιτισμός\n" + +"7.1 Αργίες\n" + +"8 Σημειώσεις\n" + +"9 Δείτε επίσης\n" + +"10 Εξωτερικές συνδέσεις\n" + +"[Επεξεργασία]\n" + +"Ιστορία\n" + +"\n" + +"Κύριο άρθρο: Ελληνική ιστορία\n" + +"Στις ακτές του Αιγαίου Πελάγους εμφανίστηκαν οι πρώτοι πολιτισμοί της Ευρώπης, ο Μινωικός και ο Μυκηναϊκός. Την εποχή των πολιτισμών αυτών, ακολούθησε μία σκοτεινή περίοδος περίπου μέχρι το 800 π.Χ., οπότε εμφανίζεται ένας καινούριος Ελληνικός πολιτισμός, βασισμένος στο μοντέλο της πόλης-κράτους. Είναι ο πολιτισμός που θα διαδοθεί με τον αποικισμό των ακτών της Μεσογείου, θα αντισταθεί στην Περσική εισβολή με τους δύο επιφανέστερους εκπροσώπους του, την κοσμοπολίτικη και δημοκρατική Αθήνα και την μιλιταριστική και ολιγαρχική Σπάρτη, θα αποτελέσει τη βάση του Ελληνιστικού πολιτισμού που δημιούργησαν οι κατακτήσεις του Μεγάλου Αλεξάνδρου, θα επηρεάσει ως ένα βαθμό την πολιτισμική φυσιογνωμία της Βυζαντινής Αυτοκρατορίας και αργότερα θα πυροδοτήσει την Αναγέννηση στην Ευρώπη.\n" + +"Στρατιωτικά έχανε δύναμη σε σύγκριση με τη Ρωμαϊκή αυτοκρατορία μέχρι που κατακτήθηκε τελικά από τους Ρωμαίους το 146 π.Χ., αν και ο Ελληνικός πολιτισμός τελικά κατέκτησε το Ρωμαϊκό τρόπο ζωής. Οι Ρωμαίοι αναγνώρισαν και θαύμασαν τον πλούτο του Ελληνικού πολιτισμού, τον μελέτησαν βαθιά και έγιναv συνειδητά συνεχιστές του. Διέσωσαν επίσης και μεγάλο μέρος της αρχαιοελληνικής γραμματείας. Αν και ήταν μόνο ένα μέρος της Ρωμαϊκής αυτοκρατορίας, ο ελληνικός πολιτισμός θα συνέχιζε να δεσπόζει στην Ανατολική Μεσόγειο, και όταν τελικά η Αυτοκρατορία χωρίστηκε στα δύο, η ανατολική ή Βυζαντινή Αυτοκρατορία με πρωτεύουσα την Κωνσταντινούπολη, θα είχε κυρίως λόγω γλώσσας έντονο τον ελληνικό χαρακτήρα. Από τον 4ο μέχρι τον 15ο αιώνα, η Ανατολική Ρωμαϊκή Αυτοκρατορία επέζησε επιθέσεις 11 αιώνων από δυτικά και ανατολικά, μέχρι που η Κωνσταντινούπολη έπεσε στις 29 Μαΐου του 1453 στα χέρια της Οθωμανικής Αυτοκρατορίας. Σταδιακά το Βυζάντιο κατακτήθηκε ολόκληρο μέσα στον 15ο αιώνα.\n" + +"Η Οθωμανική κυριαρχία συνεχίστηκε μέχρι το 1821 που οι Έλληνες κήρυξαν την ανεξαρτησία τους. Η Ελληνική Επανάσταση του 1821 έληξε το 1828. Το 1830 αναγνωρίζεται η ανεξαρτησία του νέου ελληνικού κράτους. Εγκαθιδρύθηκε μοναρχία το 1833. Μέσα στον 19ο και τον πρώιμο 20ό αιώνα, η Ελλάδα προσπάθησε να προσαρτήσει στα εδάφη της όλες τις περιοχές που ακόμη ανήκαν στην Οθωμανική Αυτοκρατορία και είχαν Ελληνόφωνο πληθυσμό, πράγμα που κατάφερε εν μέρει, επεκτείνοντας σταδιακά την έκτασή της, μέχρι να φτάσει το σημερινό της μέγεθος το 1947.\n" + +"Μετά τον Δεύτερο Παγκόσμιο Πόλεμο στην Ελλάδα ξέσπασε εμφύλιος πόλεμος μέχρι το 1949. Αργότερα, το 1952, η Ελλάδα έγινε μέλος του ΝΑΤΟ. Στις 21 Απριλίου του 1967 ο στρατός, υποβοηθούμενος από την κυβέρνηση των ΗΠΑ, πήρε την εξουσία με πραξικόπημα. Οι δικτατορες στη συνεχεια διαχωριστηκαν και απο τον βασιλια, τον εκδίωξαν απο την χώρα και κατήργησαν τη μοναρχία. Η στρατιωτική Χούντα υπήρξε η αιτία δημιουργίας, μετά από λανθασμένους χειρισμούς που εκμεταλλεύτηκε η Τουρκική πλευρά, του Κυπριακού ζητήματος, το οποίο οδήγησε στην κατάρρευσή της το 1974. Έπειτα από δημοψήφισμα για την κατάργηση της μοναρχίας στις 8 Δεκεμβρίου 1974 το πολίτευμα της Ελλάδας μετατράπηκε ξανά σε αβασίλευτη Δημοκρατία και συντάχθηκε νέο σύνταγμα από την πέμπτη Αναθεωρητική Βουλή που τέθηκε σε ισχύ στις 11 Ιουνίου 1975, το οποίο ισχύει σήμερα όπως αναθεωρήθηκε το 1986 και το 2001. Η Ελλάδα έγινε μέλος της Ευρωπαϊκής Ένωσης το 1981 και μέλος της Ευρωπαϊκής Οικονομικής και Νομισματικής Ένωσης (ΟΝΕ) γνωστής και ως ζώνης ευρώ, το 2001.\n" + +"Ελληνική ιστορία \n" + +"Κυκλαδικός πολιτισμός (3η χιλιετία π.Χ.)\n" + +"Μινωικός πολιτισμός (3000-1450 π.Χ.)\n" + +"Μυκηναϊκός πολιτισμός (1600-1100 π.Χ.)\n" + +"Γεωμετρική εποχή (1100-800 π.Χ.)\n" + +"Αρχαϊκή εποχή (800-500 π.Χ.)\n" + +"Κλασική εποχή (500 π.Χ.- 323 π.Χ.)\n" + +"Ελληνιστική εποχή (323-146 π.Χ.)\n" + +"Ρωμαϊκή περίοδος (146 π.Χ.-330 μ.Χ.)\n" + +"Βυζαντινή περίοδος (330-1453)\n" + +"Οθωμανική περίοδος (1453-1821)\n" + +"Νεότερη Ελλάδα (1821 έως σήμερα)\n" + +"Σχετικά\n" + +"Αρχαία ελληνική γραμματεία\n" + +"Ελληνική γλώσσα\n" + +"Ονομασίες Ελλήνων\n" + +"\n" + +"[Επεξεργασία]\n" + +"Πολιτικά\n" + +"\n" + +"Το Σύνταγμα του 1975 περιέχει εκτενείς εγγυήσεις των ελευθεριών και των δικαιωμάτων του πολίτη, ελευθερίες και δικαιώματα που ενισχύθηκαν περαιτέρω με την αναθεώρηση του 2001. Είναι χαρακτηριστικό ότι κατά την αναθεώρηση αυτή κατοχυρώθηκαν, για πρώτη φορά συνταγματικά, πέντε ανεξάρτητες αρχές, οι τρεις εκ των οποίων (Συνήγορος του Πολίτη, Αρχή Διασφάλισης Ατομικών Δικαιωμάτων και Αρχή Προστασίας Προσωπικών Δεδομένων) είναι ταγμένες στην προστασία και διασφάλιση των ατομικών δικαιωμάτων. Η Ελλάδα είναι επίσης μέλος της Ευρωπαϊκής Σύμβασης για τα Δικαιώματα του Ανθρώπου.\n" + +"Σε πολιτειακό και οργανωτικό επίπεδο, το Σύνταγμα διακρίνει τρεις εξουσίες: τη νομοθετική, την εκτελεστική και τη δικαστική. Στη νομοθετική μετέχουν ο Πρόεδρος της Δημοκρατίας και η Βουλή· στην εκτελεστική ο Πρόεδρος της Δημοκρατίας και η Κυβέρνηση, ενώ η δικαστική εξουσία ασκείται από τα δικαστήρια στο όνομα του ελληνικού λαού.\n" + +"Ο Πρόεδρος της Δημοκρατίας, ιεραρχικά, βρίσκεται στην κορυφή της εκτελεστικής εξουσίας, μετέχει στη νομοθετική με τη δημοσίευση των νόμων και τη δυνατότητα αναπομπής ψηφισμένου νομοσχεδίου, ενώ ορίζεται από το Σύνταγμα ως ρυθμιστής του πολιτεύματος [2] . Εκλέγεται έμμεσα από τη Βουλή με διαδοχικές ψηφοφορίες των μελών της, στις οποίες επιδιώκεται η εξασφάλιση πλειοψηφίας 2/3, σε πρώτη φάση, και 3/5, σε δεύτερη, του συνόλου των μελών της. Σε περίπτωση αποτυχίας συγκέντρωσης των ανωτέρω πλειοψηφιών, διαλύεται η Βουλή, προκηρύσσονται εκλογές και η νέα Βουλή εκλέγει τον Πρόεδρο της Δημοκρατίας με την απόλυτη πλειοψηφία των μελών της, ή και με σχετική αν δεν συγκεντρωθεί η απόλυτη πλειοψηφία. Οι εξουσίες του Προέδρου είναι περιορισμένες καθώς ασκεί, κυρίως, τελετουργικά καθήκοντα. Όλες, σχεδόν, οι πράξεις του, χρήζουν προσυπογραφής από τον Πρωθυπουργό ή άλλο μέλος της Κυβέρνησης (υπουργό), όπως, π.χ., τα προεδρικά διατάγματα. Από την υποχρέωση προσυπογραφής εξαιρούνται ρητά ελάχιστες πράξεις του Προέδρου που προβλέπονται από το Σύνταγμα, όπως ο διορισμός των υπαλλήλων της Προεδρίας της Δημοκρατίας. Η θητεία του είναι πενταετής με δικαίωμα επανεκλογής για μία ακόμη φορά.\n" + +"Η νομοθετική εξουσία ασκείται από τη Βουλή, τα μέλη της οποίας εκλέγονται με καθολική μυστική ψηφοφορία για τετραετή θητεία. Εκλογές μπορεί να κηρυχθούν νωρίτερα για έκτακτους λόγους, όπως αυτοί ορίζονται στο Σύνταγμα. Μετά, πάντως, το 1975 η προκήρυξη πρόωρων εκλογών αποτελεί τον κανόνα, με την επίκληση, συνήθως, από τις απερχόμενες κυβερνήσεις ιδιαζούσης σημασίας εθνικού θέματος. Η Ελληνική Δημοκρατία χρησιμοποιεί για την ανάδειξη των βουλευτών ένα σύνθετο ενδυναμωμένο εκλογικό σύστημα αναλογικής εκπροσώπησης (ενισχυμένη αναλογική), που αποθαρρύνει τη δημιουργία πολυκομματικών Κυβερνήσεων συνεργασίας και επιτρέπει ισχυρή κυβέρνηση πλειοψηφίας, ακόμα και αν το πρώτο κόμμα υστερεί της πλειοψηφίας των ψήφων. Για να μπορεί να καταλάβει μία από τις 300 βουλευτικές έδρες ένα κόμμα, πρέπει να έχει λάβει τουλάχιστον το 3% του συνόλου των ψήφων, ενώ με τον εκλογικό νόμο, που θα εφαρμοστεί, για πρώτη φορά, στις μετά το 2004 βουλευτικές εκλογές, το πρώτο κόμμα εξασφαλίζει απόλυτη πλειοψηφία στη Βουλή με ποσοστό 41%.\n" + +"Η εκτελεστική εξουσία ασκείται από την Κυβέρνηση, κεφαλή της οποίας είναι ο Πρωθυπουργός, το ισχυρότερο πρόσωπο του ελληνικού πολιτικού συστήματος. Η Κυβέρνηση καθορίζει και κατευθύνει τη γενική πολιτική της Χώρας [3], εφαρμόζει την πολιτική, που εγκρίνει μέσω των νομοθετικών πράξεων η Βουλή, αλλά ταυτόχρονα μετέχει στη νομοπαρασκευαστική διαδικασία, μέσω της σύνταξης και της προώθησης προς ψήφιση των νομοσχεδίων. Η Κυβέρνηση με βάση την αρχή της δεδηλωμένης οφείλει να απολαύει της εμπιστοσύνης της Βουλής, να έχει λάβει δηλαδή ψήφο εμπιστοσύνης από την πλειοψηφία των Βουλευτών. Στα πλαίσια δε της σύγχρονης κομματικής δημοκρατίας, η Κυβέρνηση κυριαρχεί και στη νομοθετική λειτουργία, καθώς προέρχεται από το Κόμμα που ελέγχει την πλειοψηφία του Κοινοβουλίου, καθιστώντας, έτσι, την ψήφιση των νόμων μια τυπική, κατά κανόνα, διαδικασία. Λόγω δε της συχνής έως καταχρηστικής επίκλησης της κομματικής πειθαρχίας, η δυνατότητα διαφωνίας κυβερνητικού βουλευτή με την Κυβέρνηση που στηρίζει θεωρείται σπάνιο φαινόμενο. Σε έκτακτες περιπτώσεις μπορεί η Κυβέρνηση να εκδίδει Πράξεις Νομοθετικού Περιεχομένου. Οι Π.Ν.Π. έχουν ισχύ νόμου και οφείλουν να εγκριθούν εντός 40 ημερών από τη Βουλή.\n" + +"Ο Πρωθυπουργός αποτελεί την κεφαλή της κυβέρνησης και, με βάση το Σύνταγμα, είναι, συνήθως (αν και όχι απαραίτητα), ο αρχηγός του έχοντος την απόλυτη πλειοψηφία στη Βουλή κυβερνώντος κόμματος. Βάσει του άρθρου 82 του Συντάγματος, \"ο Πρωθυπουργός εξασφαλίζει την ενότητα της Κυβέρνησης και κατευθύνει τις ενέργειές της, καθώς και των δημοσίων γενικά υπηρεσιών για την εφαρμογή της κυβερνητικής πολιτικής μέσα στο πλαίσιο των νόμων\" [3]. Οι βασικότερες εξουσίες του είναι οι εξής:\n" + +"Προεδρεύει του Υπουργικού Συμβουλίου, στο οποίο μετέχει μαζί με τους Υπουργούς.\n" + +"Με δέσμια πρόταση του διορίζονται και παύονται από τον Πρόεδρο της Δημοκρατίας οι υπουργοί και οι υφυπουργοί της Κυβέρνησης.\n" + +"Καθορίζει με τον οικείο Υπουργό τις αρμοδιότητες των υφυπουργών.\n" + +"Προΐσταται τεσσάρων αυτοτελών υπηρεσιών και γραμματειών: του Πολιτικού Γραφείου του Πρωθυπουργού, της Γραμματείας της Κυβερνήσεως, της Κεντρικής Νομοπαρασκευαστικής Επιτροπής και της Γενικής Γραμματείας Τύπου.\n" + +"Δίνει άδεια για τη δημοσίευση στην Εφημερίδα της Κυβερνήσεως οποιουδήποτε κειμένου πρέπει, κατά το νόμο, να καταχωρισθεί σε αυτήν.\n" + +"[Επεξεργασία]\n" + +"Κόμματα\n" + +"Περισσότερα: Κατάλογος ελληνικών πολιτικών κομμάτων\n" + +"Μετά την αποκατάσταση της Δημοκρατίας το 1974 (μεταπολίτευση) το πολιτικό σύστημα κυριαρχείται από το φιλελεύθερο κόμμα της Νέας Δημοκρατίας και το σοσιαλιστικό ΠΑΣΟΚ (Πανελλλήνιο Σοσιαλιστικό Κίνημα). Άλλα κόμματα είναι το Κομμουνιστικό Κόμμα Ελλάδας, ο Συνασπισμός της Αριστεράς και ο ΛΑ.Ο.Σ..\n" + +"[Επεξεργασία]\n" + +"Κυβέρνηση\n" + +"Περισσότερα: Κυβέρνηση της Ελλάδας\n" + +"Στις εκλογές της 7 Μαρτίου 2004, πρωθυπουργός εκλέχθηκε ο Κωνσταντίνος Α. Καραμανλής, πρόεδρος της Νέας Δημοκρατίας. Ήταν η πρώτη εκλογική νίκη του κόμματος μετά από 11 χρόνια. Ο Καραμανλής αντικατέστησε τον Κωνσταντίνο Σημίτη και σχημάτισε δική του κυβέρνηση. Οι επόμενες βουλευτικές εκλογές προβλέπονταν από το Σύνταγμα για το 2008, όμως διεξήχθησαν πρόωρα στις 16 Σεπτεμβρίου 2007. Τις εκλογές της 16ης κέρδισε ξανά η ΝΔ. Η Νέα βουλή είναι η πρώτη πεντακομματική Βουλή τα τελευταία χρόνια και σε αυτή συμμετέχουν η ΝΔ το ΠΑΣΟΚ, το ΚΚΕ, ο ΣΥ.ΡΙ.ΖΑ και το ΛΑ.Ο.Σ. Συγκεκριμένα η ΝΔ εξασφάλισε το 41.83% και 152 από τις 300 Έδρες. Το ΠΑΣΟΚ εξασφάλισε το 38.10 % και 102 Έδρες. Το Κ.Κ.Ε εξασφάλισε το 8.15% και 22 έδρες. Ο ΣΥ.ΡΙ.ΖΑ εξασφάλισε το 5.04% και 14 έδρες και τέλος το ΛΑ.Ο.Σ εξασφάλισε το 3.80% κερδίζοντας 10 έδρες.\n" + +"[Επεξεργασία]\n" + +"Περιφέρειες\n" + +"\n" + +"Κύριο άρθρο: Περιφέρειες της Ελλάδας\n" + +"Η Ελλάδα χωρίζεται σε 13 διοικητικές περιοχές γνωστές σαν Περιφέρειες, που διαχωρίζονται περαιτέρω σε 51 Νομούς:\n" + +"Αττική\n" + +"Αττική\n" + +"Στερεά Ελλάδα\n" + +"Εύβοια\n" + +"Ευρυτανία\n" + +"Φωκίδα\n" + +"Φθιώτιδα\n" + +"Βοιωτία\n" + +"Κεντρική Μακεδονία\n" + +"Χαλκιδική\n" + +"Ημαθία\n" + +"Κιλκίς\n" + +"Πέλλα\n" + +"Πιερία\n" + +"Σέρρες\n" + +"Θεσσαλονίκη\n" + +"Κρήτη\n" + +"Χανιά\n" + +"Ηράκλειο\n" + +"Λασίθι\n" + +"Ρέθυμνο\n" + +"Ανατολική Μακεδονία και Θράκη\n" + +"Καβάλα\n" + +"Δράμα\n" + +"Ξάνθη\n" + +"Ροδόπη\n" + +"Έβρος\n" + +"Ήπειρος\n" + +"Άρτα\n" + +"Ιωάννινα\n" + +"Πρέβεζα\n" + +"Θεσπρωτία\n" + +"Ιόνια νησιά\n" + +"Κέρκυρα\n" + +"Κεφαλονιά\n" + +"Λευκάδα\n" + +"Ζάκυνθος\n" + +"Βόρειο Αιγαίο\n" + +"Χίος\n" + +"Λέσβος\n" + +"Σάμος - Ικαρία\n" + +"Πελοπόννησος\n" + +"Αρκαδία\n" + +"Αργολίδα\n" + +"Κορινθία\n" + +"Λακωνία\n" + +"Μεσσηνία\n" + +"Νότιο Αιγαίο\n" + +"Κυκλάδες\n" + +"Δωδεκάνησα\n" + +"Θεσσαλία\n" + +"Καρδίτσα\n" + +"Λάρισα\n" + +"Μαγνησία\n" + +"Τρίκαλα\n" + +"Δυτική Ελλάδα\n" + +"Αχαΐα\n" + +"Αιτωλοακαρνανία\n" + +"Ηλεία\n" + +"Δυτική Μακεδονία\n" + +"Φλώρινα\n" + +"Γρεβενά\n" + +"Καστοριά\n" + +"Κοζάνη\n" + +"Επιπλέον, στη Μακεδονία υπάρχει μία αυτόνομη περιοχή, το Άγιο Όρος, μία μοναστική πολιτεία υπό Ελληνική κυριαρχία. Οι νομοί χωρίζονται σε 147 επαρχίες, που διαιρούνται σε 900 δήμους και 133 κοινότητες. Πριν το 1999, υπήρχαν 5.775 οργανισμοί τοπικής αυτοδιοίκησης: 361 δήμοι και 5.560 κοινότητες, υποδιαιρούμενες σε 12.817 οικισμούς\n" + +"\n" + +"\n" + +"\n" + +"Αλβανία\n" + +"\n" + +"П.Γ.Δ.Μ.\n" + +"\n" + +"Βουλγαρία\n" + +"'\n" + +"\n" + +"Τουρκία\n" + +"\n" + +"EΛΛAΣ\n" + +"AΘHNA\n" + +"Θεσσαλονίκη\n" + +"Καβάλα\n" + +"Αλεξανδρούπολη\n" + +"Κέρκυρα\n" + +"Ηγουμενίτσα\n" + +"Λάρισα\n" + +"Βόλος\n" + +"Ιωάννινα\n" + +"Χαλκίδα\n" + +"Πάτρα\n" + +"Πειραιάς\n" + +"Ελευσίνα\n" + +"Λαύριο\n" + +"Ηράκλειο\n" + +"Μ α κ ε δ ο ν ί α\n" + +"Θράκη\n" + +"Ήπειρος\n" + +"Θεσσαλία\n" + +"Στερεά Ελλάδα\n" + +"Πελοπόννησος\n" + +"Όλυμπος (2917m)\n" + +"Λευκάδα\n" + +"Κεφαλονιά\n" + +"Λήμνος\n" + +"Λέσβος\n" + +"Χίος\n" + +"Σάμος\n" + +"Τήνος\n" + +"Ικαρία\n" + +"Νάξος\n" + +"Σαντορίνη\n" + +"Κως\n" + +"Ρόδος\n" + +"Κάρπαθος\n" + +"Κύθηρα\n" + +"Γαύδος\n" + +"Αιγαίον\n" + +"Πέλαγος\n" + +"Μυρτώον\n" + +"Πέλαγος\n" + +"Κρητικόν Πέλαγος\n" + +"Ιόνιον\n" + +"Πέλαγος\n" + +"Μεσόγειος\n" + +"Θάλασσα\n" + +"Κρήτη\n" + +"[Επεξεργασία]\n" + +"Βουνά της Ελλάδας\n" + +"Κύριο άρθρο: Κατάλογος βουνών της Ελλάδας\n" + +"Περίπου το 80% του εδάφους της χώρας είναι ορεινό ή λοφώδες. Μεγάλο μέρος του είναι ξηρό και βραχώδες, μόνο 28% του εδάφους είναι καλλιεργήσιμο.\n" + +"Όλυμπος 2917 μ. Θεσσαλία, Κεντρική Μακεδονία (Λάρισα, Πιερία)\n" + +"Σμόλικας 2637 μ. Βόρεια Πίνδος (Ιωάννινα)\n" + +"Βόρας 2524 μ. Κεντρική Μακεδονία (Πέλλα, Φλώρινα, Π.Γ.Δ.Μ.)\n" + +"Γράμος 2520 μ. Δυτική Μακεδονία (Καστοριά, Ιωάννινα, Αλβανία)\n" + +"Γκιώνα 2510 μ. Στερεά (Φωκίδα)\n" + +"Τύμφη 2497 μ. Βόρεια Πίνδος (Ιωάννινα)\n" + +"Βαρδούσια 2495 μ. Στερεά (Φωκίδα)\n" + +"Αθαμανικά όρη 2469 μ. Νότια Πίνδος (Άρτα)\n" + +"Παρνασσός 2457 μ. Στερεά (Φωκίδα, Φθιώτιδα)\n" + +"Ψηλορείτης 2456 μ. Κρήτη (Ηράκλειο)\n" + +"\n" + +"\n" + +"\n" + +"\n" + +"Η χώρα αποτελείται από ένα μεγάλο ηπειρωτικό τμήμα, το νότιο άκρο των Βαλκανίων, ενωμένο με την πρώην ηπειρωτική Πελοπόννησο, από τον Ισθμό της Κορίνθου, και το Ιόνιο και Αιγαίο πέλαγος. Η Πελοπόννησος πλέον μετά την κατασκευή της διώρυγας της Κορίνθου είναι στην πραγματικότητα νησί. Το Αιγαίο περιέχει πολυάριθμα νησιά, ανάμεσά τους τη Ρόδο, την Εύβοια, τη Λέσβο και τα συμπλέγματα των Κυκλάδων και Δωδεκανήσων. 180 χιλιόμετρα νότια των ακτών δεσπόζει η Κρήτη, το πέμπτο μεγαλύτερο νησί της Μεσογείου. Η Ελλάδα έχει μήκος ακτών 15.021 χιλιόμετρα, που θεωρείται εξαιρετικά μεγάλο, και οφείλεται στον πλούσιο οριζόντιο εδαφικό διαμελισμό, καθώς και στο πλήθος των αναρίθμητων νησιών, τα οποία είναι πάνω από 1500. Έχει μήκος συνόρων που πλησιάζει τα 1.181 χιλιόμετρα.\n" + +"\n" + +"\n" + +"Δορυφορική εικόνα της Ελλάδας\n" + +"Κύριο άρθρο: Γεωγραφία της Ελλάδας\n" + +"[Επεξεργασία]\n" + +"Λίμνες της Ελλάδας\n" + +"Κύριο άρθρο: Κατάλογος λιμνών της Ελλάδας\n" + +"Η Ελλάδα έχει αρκετές λίμνες, οι περισσότερες των οποίων βρίσκονται στο ηπειρωτικό της τμήμα. Οι μεγαλύτερες λίμνες στην ελληνική επικράτεια είναι:\n" + +"Τριχωνίδα 96.513 τ.χλμ.\n" + +"Βόλβη 75.600 τ.χλμ\n" + +"Λίμνη Βεγορίτιδα 72.488 τ.χλμ\n" + +"Λίμνη Βιστονίδα 45.625 τ.χλμ\n" + +"Λίμνη Κορώνεια 42.823 τ.χλμ\n" + +"Μικρή Πρέσπα (ελληνικό τμήμα) 43.122 τ.χλμ\n" + +"Μεγάλη Πρέσπα (ελληνικό τμήμα) 38.325 τ.χλμ\n" + +"Κερκίνη 37.688 τ.χλμ\n" + +"Υπάρχουν επίσης και αρκετές τεχνητές λίμνες κυρίως για παραγωγή ηλεκτρικού ρεύματος, όπως η Λίμνη Κρεμαστών (68.531 τ.χλμ) και η Λίμνη Πολυφύτου (56.793 τ.χλμ).\n" + +"\n" + +"[Επεξεργασία]\n" + +"Ποτάμια της Ελλάδας\n" + +"Αρκετά ποτάμια διαρρέουν την Ελλάδα, από τα οποίο κανένα δεν είναι πλεύσιμο. Μερικά από τα μεγαλύτερα, τα Δέλτα που σχηματίζουν στην εκροή τους προς την θάλασσα αποτελούν σημαντικούς υγροβιότοπους, όπως αυτοί του Αλιάκμονα και του Έβρου. Ποταμοί όπως ο Πηνειός στην Θεσσαλία, υδροδοτούν μεγάλες γεωργικές εκτάσεις με την βοήθεια καναλιών, ενώ σε άλλα έχουν δημιουργηθεί τεχνητές λίμνες για την λειτουργία υδροηλεκτρικών εργοστασίων. Ένα αμφιλεγόμενο για οικολογικούς λόγους σχέδιο των τελευταίων δεκαετιών, είναι η εκτροπή του Αχελώου από τη νότια Πίνδο για την αντιμετώπιση του υδατικού προβλήματος της Θεσσαλίας.\n" + +"Ακολουθεί κατάλογος των μεγαλύτερων σε μήκος ποταμών της Ελλάδας. Το μήκος που αναγράφεται είναι αυτό που διατρέχει την ελληνική επικράτεια.\n" + +"Αλιάκμονας 297 χλμ.\n" + +"Αχελώος 220 χλμ.\n" + +"Πηνειός (Θεσσαλίας) 205 χλμ.\n" + +"Έβρος [4] 204 χλμ.\n" + +"Νέστος [4] 130 χλμ.\n" + +"Στρυμόνας [4] 118 χλμ.\n" + +"Θύαμις (Καλαμάς) 115 χλμ.\n" + +"Αλφειός 110 χλμ.\n" + +"Άραχθος 110 χλμ.\n" + +"[Επεξεργασία]\n" + +"Κλίμα\n" + +"Η Ελλάδα χαρακτηρίζεται από τον μεσογειακό τύπο του εύκρατου κλίματος και έχει ήπιους υγρούς χειμώνες και ζεστά ξηρά καλοκαίρια. Το κλίμα της χώρας μπορεί να διαιρεθεί σε τέσσερις βασικές κατηγορίες:\n" + +"- υγρό μεσογειακό (δυτική Ελλάδα, δυτική Πελοπόννησος, πεδινά και ημιορεινά της Ηπείρου) - ξηρό μεσογειακό (Κυκλάδες, παραλιακή Κρήτη, Δωδεκάνησα, ανατολική Πελοπόννησος, Αττική, πεδινές περιοχές Ανατολικής Στερεάς) - ηπειρωτικό (δυτική Μακεδονία, εσωτερικά υψίπεδα ηπειρωτικής Ελλάδας, βόρειος Έβρος) - ορεινό (ορεινές περιοχές με υψόμετρο περίπου >1500μ στη βόρεια Ελλάδα, >1800μ στην κεντρική Ελλάδα και >2000μ στην Κρήτη).\n" + +"Οι θερμοκρασίες είναι σπάνια υπερβολικές στις παραθαλάσσιες περιοχές. Στις κλειστές εσωτερικές πεδιάδες και στα υψίπεδα της χώρας παρατηρούνται τα μεγαλύτερα θερμοκρασιακά εύρη -τόσο ετήσια όσο και ημερήσια. Οι χιονοπτώσεις είναι κοινές στα ορεινά από τα τέλη Σεπτεμβρίου (στη βόρεια Ελλάδα, τέλη Οκτωβρίου κατά μέσο όρο στην υπόλοιπη χώρα), ενώ στις πεδινές περιοχές χιονίζει κυρίως από τον Δεκέμβριο μέχρι τα μέσα Μαρτίου. Έχει χιονίσει, πάντως, ακόμα και κατά μήνα Μάιο στη Φλώρινα. Στις παραθαλάσσιες περιοχές των νησιωτικών περιοχών, οι χιονοπτώσεις συμβαίνουν σπανιότερα και δεν αποτελούν βασικό χαρακτηριστικό του κλίματος. Η πόλη της Ρόδου έχει μέσο όρο 0,0 μέρες χιονόπτωσης το χρόνο. Οι καύσωνες επηρεάζουν κυρίως τις πεδινές περιοχές και είναι κοινότεροι τον Ιούλιο και τον Αύγουστο. Σπάνια, πάντως, διαρκούν περισσότερες από 3 μέρες.\n" + +"Η Ελλάδα βρίσκεται μεταξύ των παραλλήλων 34ου και 42oυ του βορείου ημισφαιρίου και έχει μεγάλη ηλιοφάνεια όλο σχεδόν το χρόνο. Λεπτομερέστερα στις διάφορες περιοχές της Ελλάδας παρουσιάζεται μια μεγάλη ποικιλία κλιματικών τύπων, πάντα βέβαια μέσα στα πλαίσια του μεσογειακού κλίματος. Αυτό οφείλεται στην τοπογραφική διαμόρφωση της χώρας που έχει μεγάλες διαφορές υψομέτρου (υπάρχουν μεγάλες οροσειρές κατά μήκος της κεντρικής χώρας και άλλοι ορεινοί όγκοι) και εναλλαγή ξηράς και θάλασσας. Έτσι από το ξηρό κλίμα της Αττικής και γενικά της ανατολικής Ελλάδας μεταπίπτουμε στο υγρό της βόρειας και δυτικής Ελλάδας. Τέτοιες κλιματικές διαφορές συναντώνται ακόμη και σε τόπους που βρίσκονται σε μικρή απόσταση μεταξύ τους, πράγμα που παρουσιάζεται σε λίγες μόνο χώρες σε όλο τον κόσμο.\n" + +"Από κλιματολογικής πλευράς το έτος μπορεί να χωριστεί κυρίως σε δύο εποχές: Την ψυχρή και βροχερή χειμερινή περίοδο που διαρκεί από τα μέσα του Οκτωβρίου και μέχρι το τέλος Μαρτίου και τη θερμή και άνομβρη εποχή που διαρκεί από τον Απρίλιο έως τον Οκτώβριο.\n" + +"Κατά την πρώτη περίοδο οι ψυχρότεροι μήνες είναι ο Ιανουάριος και ο Φεβρουάριος, όπου κατά μέσον όρο η μέση ελάχιστη θερμοκρασία κυμαίνεται από 5-10 °C στις παραθαλάσσιες περιοχές, από 0-5 °C στις ηπειρωτικές περιοχές και σε χαμηλότερες τιμές κάτω από το μηδέν στις βόρειες περιοχές.\n" + +"Οι βροχές ακόμη και τη χειμερινή περίοδο δεν διαρκούν για πολλές ημέρες και ο ουρανός της Ελλάδας δεν μένει συννεφιασμένος για αρκετές συνεχόμενες ημέρες, όπως συμβαίνει σε άλλες περιοχές της γης. Οι χειμερινές κακοκαιρίες διακόπτονται συχνά κατά τον Ιανουάριο και το πρώτο δεκαπενθήμερο του Φεβρουαρίου από ηλιόλουστες ημέρες, τις γνωστές από την αρχαιότητα Αλκυονίδες ημέρες.\n" + +"Η χειμερινή εποχή είναι γλυκύτερη στα νησιά του Αιγαίου και του Ιονίου από ό,τι στη Βόρεια και Ανατολική ηπειρωτική Ελλάδα. Κατά τη θερμή και άνομβρη εποχή ο καιρός είναι σταθερός, ο ουρανός σχεδόν αίθριος, ο ήλιος λαμπερός και δεν βρέχει εκτός από σπάνια διαστήματα με ραγδαίες βροχές ή καταιγίδες μικρής γενικά διάρκειας.\n" + +"Η θερμότερη περίοδος είναι το τελευταίο δεκαήμερο του Ιουλίου και το πρώτο του Αυγούστου οπότε η μέση μεγίστη θερμοκρασία κυμαίνεται από 29 °C μέχρι 35 °C. Κατά τη θερμή εποχή οι υψηλές θερμοκρασίες μετριάζονται από τη δροσερή θαλάσσια αύρα στις παράκτιες περιοχές της χώρας και από τους βόρειους ανέμους (ετησίες) που φυσούν κυρίως στο Αιγαίο.\n" + +"Η άνοιξη έχει μικρή διάρκεια, διότι ο μεν χειμώνας είναι όψιμος, το δε καλοκαίρι αρχίζει πρώιμα. Το φθινόπωρο είναι μακρύ και θερμό και πολλές φορές παρατείνεται στη νότια Ελλάδα μέχρι τα μισά του Δεκεμβρίου.\n" + +"[Επεξεργασία]\n" + +"Οικονομία\n" + +"\n" + +"Κύριο άρθρο: Οικονομία της Ελλάδας\n" + +"Η Ελλάδα έχει μικτή καπιταλιστική οικονομία, με τον δημόσιο τομέα να συνεισφέρει περίπου στο μισό του Α.Ε.Π.. Ο Τουρισμός αποτελεί μία πολύ σημαντική βιομηχανία, που συνεισφέρει κι αυτή σε μεγάλο ποσοστό του Α.Ε.Π., και επίσης αποτελεί πηγή συναλλάγματος. Το 2004 η μεγαλύτερη βιομηχανία στην Ελλάδα με έσοδα γύρω στα 12 δισ. ευρώ ήταν η συνήθως σχετικά αφανής ναυτιλία.\n" + +"Η οικονομία βελτιώνεται σταθερά τα τελευταία χρόνια, καθώς η κυβέρνηση εφάρμοσε αποτελεσματική οικονομική πολιτική, στην προσπάθεια της ένταξης της Ελλάδας στην ζώνη του ευρώ, την 1 Ιανουαρίου 2001. Παράγων που σίγουρα βοήθησε σε αυτήν την πορεία είναι ότι η Ελλάδα είναι αποδέκτης οικονομικής βοήθειας από την Ευρωπαϊκή Ένωση, ίσης περίπου με το 3,3% του Α.Ε.Π. Η συνέχιση τόσο γενναιόδωρων ενισχύσεων από την Ε.Ε. όμως είναι υπό αμφισβήτηση. Η διεύρυνση της Ευρωπαϊκής Ένωσης με την είσοδο χωρών πολύ φτωχότερων από την Ελλάδα σε συνδυασμό με την ανοδική πορεία της ελληνικής οικονομίας θα βγάλει πιθανότατα πολλές περιοχές από τον λεγόμενο Στόχο 1 του Κοινοτικού Πλαισίου Στήριξης στον οποίο κατευθύνονται και οι περισσότερες επιδοτήσεις και στον οποίο ανήκουν περιοχές με Α.Ε.Π. κατά κεφαλήν μικρότερο του 75% του ευρωπαϊκού μέσου όρου. Με τα στοιχεία του 2003 από τον Στόχο 1 έχουν βγει οι εξής περιοχές: Αττική, Νότιο Αιγαίο, Στερεά Ελλάδα, Κεντρική Μακεδονία, Βόρειο Αιγαίο και οριακά η Πελοπόννησος.\n" + +"Μεγάλες προκλήσεις παραμένουν, η μείωση της ανεργίας και η περαιτέρω ανοικοδόμηση της οικονομίας μέσω και της ιδιωτικοποίησης διαφόρων μεγάλων κρατικών εταιρειών, η αναμόρφωση της κοινωνικής ασφάλισης, διόρθωση του φορολογικού συστήματος, και η ελαχιστοποίηση των γραφειοκρατικών αδυναμιών. Η ανάπτυξη υπολογίζεται σε 3,9% για το 2004.\n" + +"Η εθνική κεντρική τράπεζα του κράτους της Ελλάδας είναι η Τράπεζα της Ελλάδος (ΤτΕ), η οποία όμως έχει παραχωρήσει τις περισσότερες αρμοδιότητές της στην Ευρωπαϊκή Κεντρική Τράπεζα (Ε.Κ.Τ.), μετά την είσοδό της στην ζώνη του ευρώ το 2001.\n" + +"[Επεξεργασία]\n" + +"Δημογραφία\n" + +"\n" + +"Κύριο άρθρο: Δημογραφία της Ελλάδας\n" + +"Άρθρο βασικών αποτελεσμάτων απογραφής: Απογραφή 2001\n" + +"Σύμφωνα με την τελευταία απογραφή (2001)[5] ο μόνιμος πληθυσμός της χώρας είναι 10.934.097 κ. Την ημέρα της απογραφής, στη χώρα βρέθηκαν και απογράφηκαν (πραγματικός πληθυσμός) 10.964.020 κ.\n" + +"Η Διεθνής Έκθεση για τις Θρησκευτικές Ελευθερίες που συντάσσει κάθε έτος το Υπουργείο Εξωτερικών των Ηνωμένων Πολιτειών, αναφέρει το 2005: «Περίπου 97% των πολιτών αυτοπροσδιορίζονται, τουλάχιστον κατ’ όνομα, ως Ελληνoρθόδοξοι. Υπάρχουν περίπου 500.000-800.000 παλαιοημερολογίτες σε ολόκληρη τη χώρα – υπερ-συντηρητικοί Ορθόδοξοι, οι οποίοι χρησιμοποιούν το Ιουλιανό ημερολόγιο και είναι αφοσιωμένοι στις παραδοσιακές Ελληνορθόδοξες πρακτικές. Η κυβέρνηση δεν τηρεί στατιστικά στοιχεία για τις θρησκευτικές ομάδες. Κατά τη διάρκεια των απογραφών πληθυσμού, οι κάτοικοι δεν ερωτώνται για το θρησκευτικό τους πιστεύω. Οι αρχές υπολογίζουν ότι η Τουρκόφωνη Μουσουλμανική κοινότητα αριθμεί 98.000 άτομα, αλλά, άλλοι υπολογίζουν ότι ο αριθμός αυτός ανέρχεται σε 140.000 άτομα. Τα περισσότερα χριστιανικά μη Ορθόδοξα δόγματα συναπαρτίζονται κατά κύριο λόγο από γηγενείς Έλληνες. Οι Μάρτυρες του Ιεχωβά αναφέρουν ότι έχουν 30.000 περίπου ενεργά μέλη και 50.000 άτομα που έχουν προσχωρήσει στην πίστη. Οι Καθολικοί υπολογίζονται σε 50.000. Οι Προτεστάντες, συμπεριλαμβανόμενων των Ευαγγελιστών, είναι 30.000, και οι οπαδοί της Εκκλησίας του Ιησού Χριστού των Αγίων των Τελευταίων Ημερών (Μορμόνοι) 300. Οι Σαϊεντολόγοι ισχυρίζονται ότι έχουν 500 ενεργά εγγεγραμμένα μέλη. Η από αιώνων υπάρχουσα Εβραϊκή κοινότητα αριθμεί περίπου 5.000 πιστούς, από τους οποίους 2.000 υπολογίζεται ότι διαμένουν στη Θεσσαλονίκη. Περίπου 250 μέλη της κοινότητας των Μπαχάι είναι διασκορπισμένα στην χώρα, τα περισσότερα των οποίων δεν είναι πολίτες ελληνικής καταγωγής. Η αρχαία Ελληνική Θρησκεία του Δωδεκαθέου έχει περίπου 2.000 μέλη. Υπάρχουν ακόμα μικρές ομάδες Αγγλικανών, Βαπτιστών, καθώς και άλλοι Χριστιανοί που δεν ανήκουν σε κάποιο συγκεκριμένο δόγμα. Δεν υπάρχει επίσημη ή ανεπίσημη εκτίμηση ως προς τον αριθμό των αθέων. Η πλειοψηφία των κατοίκων μη ελληνικής υπηκοότητας δεν είναι Ορθόδοξοι. Η μεγαλύτερη από αυτές τις ομάδες είναι Αλβανοί[5], συμπεριλαμβανόμενων των νομίμων και παρανόμων μεταναστών. Αν και οι περισσότεροι Αλβανοί δεν ανήκουν σε κάποια θρησκεία, παραδοσιακά συνδέονται με τη Μουσουλμανική, την Ορθόδοξη, ή τη Ρωμαιοκαθολική πίστη. Εκτός της εντόπιας Μουσουλμανικής μειονότητας στη Θράκη, οι Μουσουλμάνοι μετανάστες που βρίσκονται στην υπόλοιπη χώρα υπολογίζεται ότι ανέρχονται σε 200.000-300.000.» [6]\n" + +"Τις τελευταίες δεκαετίες η Ελλάδα έχει δεχτεί ένα μεγάλο κύμα μετανάστευσης. Ο συνολικός αριθμός των μεταναστών υπολογίζεται περίπου στο 10% του συνολικού πληθυσμού ή στις 950.000 ανθρώπους. Νόμιμοι κάτοικοι της χώρας είναι περίπου οι μισοί αν και οι αριθμοί έχουν μεγάλη διακύμανση λόγω της έλλειψης επίσημης μεταναστευτικής πολιτικής και της αστάθειας στις γειτονικές χώρες πηγές μεταναστών. Οι μεγαλύτερες πληθυσμιακές ομάδες σύμφωνα με την απογραφή του 2001 φαίνεται να είναι οι προερχόμενοι από Αλβανία, Ρουμανία, Βουλγαρία, Πακιστάν, Ουκρανία, Πολωνία, Αίγυπτο.\n" + +"Πέρα από τους αλλοδαπούς μετανάστες έχουν έρθει μετά την πτώση του Τείχους και αρκετοί ομογενείς από περιοχές της πρώην Ε.Σ.Σ.Δ. και από τα Βαλκάνια. Οι μεγαλύτερες ομάδες παλιννοστούντων είναι από την Αλβανία, την Ρωσία και την Γεωργία.\n" + +"[Επεξεργασία]\n" + +"Ένοπλες δυνάμεις και Σώματα ασφαλείας\n" + +"\n" + +"Ελληνικές Ένοπλες Δυνάμεις:\n" + +"Ελληνικός Στρατός\n" + +"Ελληνικό Πολεμικό Ναυτικό\n" + +"Ελληνική Πολεμική Αεροπορία\n" + +"Σώματα ασφαλείας:\n" + +"Ελληνική Αστυνομία\n" + +"Πυροσβεστικό Σώμα\n" + +"Λιμενικό Σώμα\n" + +"[Επεξεργασία]\n" + +"Υποχρεωτική στράτευση\n" + +"Κύριο άρθρο: Η θητεία στην Ελλάδα\n" + +"Μέχρι το 2004, η Ελλάδα είχε νομοθετήσει υποχρεωτική θητεία 12 μηνών, για όλους τους άνδρες άνω των 18 ετών. Ωστόσο, κινείται προς την ανάπτυξη ενός πλήρως επαγγελματικού στρατού, με στόχο την πλήρη κατάργηση της θητείας. Το Υπουργείο Εθνικής Άμυνας έχει αναγγείλει τη σταδιακή μείωση στους 6 μήνες το 2008 και πιθανολογείται ότι μπορεί και να καταργηθεί τελείως. Παρότι γίνονται δεκτές αιτήσεις γυναικών που θέλουν να υπηρετήσουν, δεν είναι υποχρεωτικό. Η κίνηση αυτή δημιουργεί αντιρρήσεις από τους κύκλους που αντιτίθενται στην υποχρεωτική στράτευση, γιατί ενώ το Άρθρο 2 του Ελληνικού Συντάγματος θέτει υπόχρεους όλους τους Έλληνες πολίτες να υπερασπιστούν την Ελλάδα, ο φόρτος έγκειται ολοκληρωτικά στον ανδρικό πληθυσμό.\n" + +"Οι κληρωτοί δεν λαμβάνουν ιατρική ασφάλιση κατά τη διάρκεια της θητείας τους, ούτε ο χρόνος της θητείας συνυπολογίζεται στα χρόνια εργασίας τους που θεμελιώνουν το συνταξιοδοτικό δικαίωμα. Λαμβάνουν, όμως, πλήρη ιατρική και νοσοκομειακή περίθαλψη από τα κατά τόπους στρατιωτικά νοσοκομεία, εφ' όσον αυτά υπάρχουν στον τόπο που υπηρετούν, αλλιώς αναγκάζονται να μεταφερθούν στην Αθήνα. Ο μισθός του κληρωτού είναι συμβολικός (9 ευρώ το μήνα για τους οπλίτες, σμηνίτες, κληρωτούς, 11 ευρώ για τους στρατεύσιμους δεκανείς, υποσμηνίες, υποκελευστές και τους στρατεύσιμους λοχίες, σμηνίες, κελευστές και 600 ευρώ για τους δόκιμους και των τριών σωμάτων). Οι δόκιμοι υπηρετούν 5 μήνες παραπάνω από τους υπόλοιπους συναδέλφους τους. Ο μισθός δεν αρκεί για να καλύψει τα έξοδα των κληρωτών, ιδιαίτερα όταν ένας κληρωτός υπηρετεί μακριά από τον τόπο διαμονής του, με αποτέλεσμα πρακτικά οι κληρωτοί να ζούνε από την οικονομική στήριξη των γονέων τους κατά την διάρκεια της θητείας τους.\n" + +"[Επεξεργασία]\n" + +"Πολιτισμός\n" + +"\n" + +"Κατάλογος διάσημων Ελλήνων\n" + +"Ελληνική μυθολογία\n" + +"Αρχαία ελληνική λογοτεχνία\n" + +"Ελληνική Αρχιτεκτονική\n" + +"Ελληνική κουζίνα\n" + +"Ελληνική Γλώσσα\n" + +"Ελληνική Μουσική\n" + +"Ελληνικά Μουσεία\n" + +"Μέσα Ενημέρωσης\n" + +"[Επεξεργασία]\n" + +"Αργίες\n" + +"Ημερομηνία Ονομασία Σχόλια\n" + +"1 Ιανουαρίου Πρωτοχρονιά \n" + +"6 Ιανουαρίου Θεοφάνεια \n" + +"κινητή Καθαρά Δευτέρα έναρξη της Μεγάλης Τεσσαρακοστής\n" + +"25η Μαρτίου Ευαγγελισμός της Θεοτόκου και Εθνική Εορτή Εθνική Εορτή για την Επανάσταση του 1821\n" + +"κινητή Μεγάλη Παρασκευή \n" + +"κινητή Πάσχα Ανάσταση του Χριστού\n" + +"κινητή Δευτέρα Διακαινησίμου (Δευτέρα του Πάσχα) Δευτέρα μετά την Ανάσταση\n" + +"1 Μαΐου Πρωτομαγιά \n" + +"κινητή Αγίου Πνεύματος \n" + +"15 Αυγούστου Κοίμηση της Θεοτόκου \n" + +"28η Οκτωβρίου Επέτειος του Όχι Εθνική Εορτή (1940)\n" + +"25 Δεκεμβρίου Χριστούγεννα \n" + +"26 Δεκεμβρίου Σύναξις Θεοτόκου \n" + +"[Επεξεργασία]\n" + +"Σημειώσεις\n" + +"\n" + +"↑ www.destatis.de εκτίμηση πληθυσμού χώρας, 2006\n" + +"↑ Σύνταγμα της Ελλάδας, άρθρο 30\n" + +"↑ 3,0 3,1 Σύνταγμα της Ελλάδας, άρθρο 82\n" + +"↑ 4,0 4,1 4,2 Πηγάζει στη Βουλγαρία\n" + +"↑ 5,0 5,1 απογραφή 2001\n" + +"↑ Πηγή: Διεθνής Έκθεση Θρησκευτικής Ελευθερίας του 2005 στην ελληνική και στην αγγλική, Υπουργείο Εξωτερικών των Η.Π.Α.\n" + +"[Επεξεργασία]\n" + +"Δείτε επίσης\n" + +"\n" + +"Σημαία της Ελλάδας\n" + +"Κατάλογος γλωσσών της Ελλάδας\n" + +"Τράπεζα της Ελλάδος\n" + +"Ονομασίες της Ελλάδας σε διάφορες γλώσσες\n" + +"Άτλας της Ελλάδας: συλλογή διαφόρων χαρτών της Ελλάδας στα Κοινά (Commons).\n" + +"Κατάλογος νοσοκομείων της Ελλάδας\n" + +"[Επεξεργασία]\n" + +"Εξωτερικές συνδέσεις\n" + +"\n" + +"Πρωθυπουργός της Ελλάδας (Γραφείο Πρωθυπουργού)\n" + +"Βουλή των Ελλήνων\n" + +"Παράθυρο στην Ελλάδα (χρήσιμες πληροφορίες και σύνδεσμοι για την Ελλάδα)\n" + +"Παράθυρο στην Ελλάδα (παλαιότερη «έκδοση»)\n" + +"Ελληνικός Οργανισμός Τουρισμού\n" + +"Υπουργείο Εξωτερικών\n"; + + +var hebrew = +"היסטוריה של סין\n" + +"מתוך ויקיפדיה, האנציקלופדיה החופשית\n" + +"קפיצה אל: ניווט, חפש\n" + +"\n" + +" ערך זה עוסק בההיסטוריה של הישות התרבותית והגאוגרפית במזרח אסיה. אם התכוונתם לההיסטוריה של מדינה המוכרת היום בשם \"סין\", ראו היסטוריה של הרפובליקה העממית של סין.\n" + +"\n" + +"בערך זה מופיע גופן מזרח אסייתי\n" + +"\n" + +"כדי שתוכלו לראות את הכתוב בערך זה בצורה תקינה, תצטרכו להתקין גופן מזרח אסייתי במחשבכם. אם אינכם יודעים כיצד לעשות זאת, לחצו כאן לקבלת עזרה\n" + +"\n" + +"סין הנה התרבות המפותחת והרציפה העתיקה ביותר בעולם, תיעודים כתובים של התרבות נמצאים כבר מלפני 3,500 שנים והסינים עצמם נוקבים במספר 5,000 כמספר שנות קיומה של תרבותם. שושלות השלטון בסין פיתחו לאורך השנים שיטות בירוקרטיה שלטונית שהעניקו לסינים יתרון משמעותי על העמים השבטיים שחיו מסביבם. פיתוח אידאולוגיה למדינה, המבוססת על משנתו הפילוסופית של קונפוציוס (המאה ה-1 לפנה\"ס), יחד עם פיתוח מערכת כתב זמינה לכל (המאה ה-2 לפנה\"ס) חיזקו עוד יותר את התרבות הסינית. מבחינה פוליטית, סין נעה בתנועה מתמדת בין איחוד ופירוד ולעתים גם נכבשה על ידי כוחות זרים אשר מרביתם התמזגו לתוך תרבותה והפכו לחלק בלתי נפרד ממנה. השפעות תרבותיות ופוליטיות אלו שהגיעו מכל קצוות אסיה כמו גם גלי הגירה אל ומחוץ למדינה יצרו יחד את דמותם של התרבות והעם הסיני כפי שהם מוכרים לנו היום.\n" + +"היסטוריה של סין\n" + +"\n" + +" * התקופה הקדומה\n" + +"\n" + +" שלושת המלכים וחמשת הקיסרים\n" + +" שושלת שיה\n" + +" שושלת שאנג\n" + +" שושלת ג'ואו\n" + +" תקופת האביב והסתיו\n" + +" תקופת המדינות הלוחמות\n" + +"\n" + +" * סין הקיסרית\n" + +"\n" + +" שושלת צ'ין\n" + +" שושלת האן המערבית\n" + +" שושלת שין\n" + +" שושלת האן המזרחית\n" + +" שלושת הממלכות\n" + +" שושלת ג'ין\n" + +" השושלת הצפונית והדרומית\n" + +" שושלת סוי\n" + +" שושלת טאנג\n" + +" שושלת סונג\n" + +" שושלת יו'אן\n" + +" שושלת מינג\n" + +" שושלת צ'ינג\n" + +"\n" + +" * התפוררות הקיסרות\n" + +"\n" + +" מלחמת האופיום הראשונה\n" + +" מרד טאיפינג\n" + +" מלחמת האופיום השנייה\n" + +" מלחמת סין-צרפת\n" + +" מלחמת סין-יפן הראשונה\n" + +" רפורמת מאה הימים\n" + +" מרד הבוקסרים\n" + +"\n" + +" * סין המודרנית\n" + +"\n" + +" מהפכת שינהאי\n" + +" הקמתה של המפלגה הקומניסטית של סין\n" + +" המצעד הארוך\n" + +" תקרית שיאן\n" + +" מלחמת סין-יפן השנייה\n" + +" מלחמת האזרחים הסינית\n" + +"\n" + +" * העת החדשה\n" + +"\n" + +" הקמת הרפובליקה העממית של סין\n" + +" מערכת מאה הפרחים\n" + +" הזינוק הגדול קדימה\n" + +" הפיצול הסיני-סובייטי\n" + +" מלחמת הודו-סין\n" + +" מהפכת התרבות בסין\n" + +" תקרית טיאנאנמן\n" + +"\n" + +"ראו גם\n" + +"\n" + +" * הרפובליקה הסינית\n" + +" * לוח זמנים של ההיסטוריה של סין\n" + +"\n" + +"פורטל סין\n" + +"קטגוריה ראשית\n" + +"\n" + +"\n" + +"תוכן עניינים\n" + +"[הסתר]\n" + +"\n" + +" * 1 פרה-היסטוריה\n" + +" o 1.1 שלושת המלכים וחמשת הקיסרים\n" + +" * 2 היסטוריה קדומה\n" + +" o 2.1 שושלת שְׂיָה\n" + +" o 2.2 שושלת שָׁאנְג\n" + +" o 2.3 שושלת ג'וֹאוּ\n" + +" o 2.4 תקופת האביב והסתיו\n" + +" o 2.5 תקופת המדינות הלוחמות\n" + +" * 3 שושלת צ'ין: האימפריה הסינית הראשונה\n" + +" * 4 שושלת האן: תקופה של שגשוג\n" + +" * 5 ג'ין, שש עשרה הממלכות והשושלות הדרומית והצפונית: התקופה האפלה של סין\n" + +" * 6 שושלת טאנג: חזרה לשיגשוג\n" + +" * 7 שושלת סונג ושכנותיה הצפוניות, ליאו וג'ין\n" + +" * 8 המונגולים\n" + +" * 9 תחייתה מחדש של התרבות הסינית\n" + +" * 10 תקופת מינג: מהתפתחות לבידוד\n" + +" * 11 שושלת צ'ינג\n" + +" * 12 הרפובליקה הסינית\n" + +" * 13 הרפובליקה העממית של סין\n" + +" * 14 ראו גם\n" + +" * 15 לקריאה נוספת\n" + +" * 16 קישורים חיצוניים\n" + +" * 17 הערות שוליים\n" + +"\n" + +"[עריכה] פרה-היסטוריה\n" + +"\n" + +"העדויות הארכאולוגיות הקדומות ביותר לנוכחות אנושית בסין של ימינו הן של הומו ארקטוס. מחקרים חדשים מגלים כי עמודי האבן שנמצאו באתר שיאוצ'אנגליאנג מתאורכים מבחינה סטרטיגרפית מלפני 1.36 מיליוני שנים. באתר הארכאולוגי שִׂיהוֹאוּדוּ שבמחוז שאנסי נמצאות העדויות הראשונות בעולם לשימוש באש על ידי ההומו ארקטוס, ומתאורכות ללפני 1.27 מיליוני שנים. עם זאת תושביו הנוכחיים של האזור אינם צאצאי אותו הומו ארקטוס, אלא צאצאי הומו סאפיינס שהגיע לאזור מאזור אפריקה רק לפני 65,000 שנים.\n" + +"\n" + +"עדויות מוקדמות לחקלאות סינית טיפוסית – גידולי אורז בברכות – מתוארכות לשנת 6,000 לפנה\"ס. בדומה לתרבויות קדומות בכל העולם, הביאה החקלאות לגידול מהיר באוכלוסייה, כיוון שהתבססות על גידולים חקלאיים הבטיחה יכולת שימור המזון ואגירתו לזמן ממושך יותר, וזו הביאה בהדרגה לגידול האוכלוסייה, להתפתחותה התרבותית ולריבוד חברתי.\n" + +"\n" + +"בשלהי התקופה הניאוליטית החל עמק הנהר הצהוב בסין לפתח את מעמדו כמרכז תרבותי, כאשר ראשוני הכפרים באזור הופיעו שם. מרבית העדויות למרכז חשוב זה נמצאות באזור העיר שי-אן בסין.\n" + +"\n" + +"[עריכה] שלושת המלכים וחמשת הקיסרים\n" + +"\n" + +" ערך מורחב – שלושת המלכים וחמשת הקיסרים\n" + +"\n" + +"ספרי ההיסטוריה הקדומים, רשומות ההיסטוריון, שנכתבו על ידי ההיסטורוגרף הסיני סְה-מָה צְ'ייֵן במאה השנייה לפנה\"ס, וספר תולדות החיזרן, שנכתבו במאה הרביעית לפנה\"ס מתארכים את תחילת ההיסטוריה הסינית לתקופת שלושת המלכים וחמשת הקיסרים - 2800 לפנה\"ס. לתקופה זו מאפיינים מיתולוגיים מובהקים. למלכים ולקיסרים תכונות מיסטיות והם מתוארים כשליטים נבונים ובעלי מוסר למופת. אחד מהם, הקיסר הצהוב נחשב לאבי בני ההאן.\n" + +"\n" + +"סה-מה צ'יאן כותב כי תחילת ביסוס מערכת ממשלתית נעשה בימי שושלת שיה, וסגנון המערכת הונצח על ידי שושלות שאנג וג'ואו. בתקופת שלושת השושלות האלו, החלה סין לפצוע על שחר ההיסטוריה. מכאן ואילך, עד למאה העשרים, מתוארות תולדות סין לפי השושלות שמשלו בה.\n" + +"\n" + +"[עריכה] היסטוריה קדומה\n" + +"\n" + +"[עריכה] שושלת שְׂיָה\n" + +"\n" + +" ערך מורחב – שושלת שיה\n" + +"\n" + +"שושלת שְׂיָה (סינית: 夏, פיניין: Xià), היא השושלת הראשונה בתולדות סין. שושלת זו התקיימה לפני המצאת הכתב בסין, כך שהעדויות לקיומה מסתמכות על מסמכים מאוחרים יותר ועל ארכאולוגיה. סְה-מָה צְ'ייֵן וספר תולדות החיזרן מתארכים את ימי השושלת לכלפני 4,200 שנה, אולם אין בידינו לאמת את הדברים. 17 מלכים ו-14 דורות מנתה השושלת, שהתחילה בימיו של יוּ' הגדול והסתיימה בימיו של גְ'יֵה איש שְׂיָה, כך על-פי סְה-מָה צְ'ייֵן ומקורות אחרים מתקופת שושלת צ'ין.\n" + +"\n" + +"שושלות שאנג וג'ואו התקיימו במקביל לשושלת שיה כבר מתחילתה, אך היו כפופות לה. אורך ימיה של השושלת לא ברור, אך 431 או 471 שנים הן שתי החלופות הסבירות ביותר.\n" + +"\n" + +"ארכאולוגים רבים מזהים את שושלת שְׂיָה עם אתר אָרלִיטוֹאוּ שבמרכז מחוז הנאן[1]. באתר זה נתגלה כור היתוך מברונזה משנת 2000 לפנה\"ס לערך. נטען גם כי סימונים על-גבי חרס וקונכיות מתקופה זו הן גילגול קדום של הכתב הסיני[2]. בהיעדר עדויות כתובות בכתב המוכר מעצמות הניחוש של שושלת שאנג ומכלי הברונזה של שושלת ג'ואו, נותר טיבה של שושלת שיה לוט בערפל.\n" + +"\n" + +"[עריכה] שושלת שָׁאנְג\n" + +"\n" + +" ערך מורחב – שושלת שאנג\n" + +"\n" + +"הרישומים הכתובים העתיקים ביותר בסין נחרטו לצורך הגדת עתידות על עצמות או קונכיות. כתבים אלה, המכונים עצמות ניחוש, מתוארכים למאה ה-13 לפנה\"ס לערך, תקופת שושלת שָׁאנְג (סינית: 商, פיניין: Shāng). ממצאים ארכאולוגיים, המעידים על קיומה של השושלת בשנים 1600-1046 לפנה\"ס בקירוב, מחולקים לשתי קבוצות. הקבוצה המוקדמת, עד ל-1300 בקירוב, מגיעה מאתרים שונים במחוז הנאן. הקבוצה המאוחרת, מתקופת יִין (殷), מורכבת מאסופה רחבה של עצמות ניחוש, גם הן ממחוז הנאן. אָנְיָאנְג שבמחוז הנאן הייתה הבירה התשיעית והאחרונה של שושלת שאנג. לשושלת היו 31 מלכים, והיא הייתה הארוכה שבשושלות סין.\n" + +"\n" + +"על פי רשומות ההיסטוריון העבירה שושלת שאנג את בירתה שש פעמים, כשהמעבר השישי והאחרון לעיר יִין ב-1350 לפנה\"ס סימן את תחילת תור הזהב של השושלת. ההיסטוריה התמטית של סין מתארת בדרך-כלל קיום של שושלת אחת אחרי השנייה, אך המצב לאשורו באותה עת היה מורכב יותר. חוקרים טוענים כי ייתכן ושושלות שיה ושאנג התקיימו במקביל, כשם ששושלת ג'ואו (שֶׁירשה את שושלת שאנג), התקיימה אף היא בזמן שושלת שאנג. עדויות כתובות מאתר אניאנג מאששים אמנם את קיומה של שושלת שאנג, אך חוקרים מערביים אינם נוטים לזהות יישובים בני אותה תקופה עם שושלת שאנג דווקא. כך למשל, ממצאים ארכאולוגיים מאותה עת באתר סָאנְשִׂינְגְדְווֵי מצביעים על חברה מתקדמת, השונה בתרבותה מזו שנתגלתה בְּאָנְיָאנְג. אין עדויות מכריעות במוגע לתחום שליטתה של שושלת שאנג. ההנחה המקובלת היא כי שושלת שאנג שבהיסטוריה הרשמית אכן שלטה בעיר אניאנג, תוך שהיא מקיימת קשרי מסחר עם יישובים שונים בסביבתה, שהיו שונים זה מזה מבחינה תרבותית.\n" + +"\n" + +"[עריכה] שושלת ג'וֹאוּ\n" + +"\n" + +" ערך מורחב – שושלת ג'ואו\n" + +"\n" + +"שושלת ג'וֹאוּ (סינית: 周, פיניין: Zhōu), הייתה השושלת ששלטה את הזמן הארוך ביותר בסין, מ-1122 לפנה\"ס ועד 256 לפנה\"ס - 866 שנה. השושלת התחילה להתגלות בנהר הצהוב והתפשטה אל תוך גבולותיה של השאנג. השושלת התחילה את שליטתה כפיאודליזם. הג'ואו חיו מערבית לשאנג, ושליטם היה מכונה בפיהם של שאנג כ\"מגן המערבי\". שליט ג'ואו המלך ווּ, בעזרת דודו הדוכס של ג'ואו, הצליחו להכניע את אחרון קיסרי שאנג בקרב שקבל את השם הקרב של מויה. היה זה מלכה של ג'ואו באותו הזמן, שטבע את מושג מנדט השמים, רעיון לפיו השמים הם המחליטים מי יהיה הקעסר הבא, ודרכם להביע את זה היא הצלחתו של הקיסר בניהול מלכותו, כך שמרד נתפס כלגיטימי, כל עוד זכה להצלחה. הקיסר העביר את בירתו אל עבר מערב האזור, סמוך למקום המכונה כיום שיאן, לגדות הנהר הצהוב, אולם שליטתם התפרסה אל כל עבר מושבות נהר היאנגטסה. זו הייתה ההגירה הראשונה בגודל כזה מצפון סין לדרומה.\n" + +"\n" + +"[עריכה] תקופת האביב והסתיו\n" + +"\n" + +" ערך מורחב – תקופת האביב והסתיו\n" + +"\n" + +"תקופת האביב והסתיו (בסינית: 春秋時代) הוא כינויה של תקופה בין השנים 722 לפנה\"ס ל 481 לפנה\"ס. שמה של התקופה לקוח משם הספר רשומות האביב והסתיו, תיעוד היסטורי של אותה תקופה אשר נכתב בידי קונפוציוס.\n" + +"\n" + +"במהלך התקופה נערכו מלחמות רבות בין המדינות שהרכיבו באותה תקופה את סין מה שהביא לביזור של הכח השלטוני בסין העתיקה. בעקבות המלחמות הודחו שליטים רבים מכסאם, ושכבת האצולה בסין התפוררה למעשה. עם התפשטותם של האצילים ברחבי הארץ נפוצה איתם גם ידיעת הקרוא וכתוב אשר הייתה נחלתם הכמעט בלעדית של האצילים עד לאותה תקופה. התפשטות הקריאה והכתיבה עודדה את חופש המחשבה וההתפתחות הטכנולוגית. לאחר תקופת האביב והסתיו החלה בסין תקופת מלחמת המדינות.\n" + +"\n" + +"[עריכה] תקופת המדינות הלוחמות\n" + +"\n" + +" ערך מורחב – תקופת המדינות הלוחמות\n" + +"\n" + +"תקופת המדינות הלוחמות (סינית: 戰國, פיניין: Zhàn Guó) החלה במאה החמישית לפנה\"ס והסתיימה בשנת 221 לפנה\"ס באיחודה של סין על ידי שושלת צ'ין. רשמית, בתקופת המדינות הלוחמות, כמו גם בתקופה שקדמה לה, תקופת האביב והסתיו, הייתה סין תחת שלטונה של שושלת ג'וֹאוּ המזרחית, אך שליטה זו הייתה רק להלכה, ולשושלת לא הייתה השפעה ממשית, ולמעשה חדלה להתקיים 35 שנה לפני סיומה הרשמי של התקופה. את שמה קיבלה התקופה מ\"רשומות המדינות הלוחמות\", תיעוד היסטורי של התקופה, שנכתב בתקופת שושלת האן.\n" + +"\n" + +"תקופת המדינות הלוחמות, שלא כמו תקופת האביב והסתיו, הייתה תקופה בה שרי צבא ואריסטוקרטים מקומיים סיפחו לאחוזותיהם כפרים, ערים ומדינות זעירות סמוכות והשליטו עליהם את שלטונם. במאה השלישית לפנה\"ס הביא מצב זה ליצירת שבע מדינות עיקריות בסין: מדינות צִ'י (齊), צ'וּ (楚), יֵן (燕), הַאן (韓), גָ'או (趙), ווֶי (魏) וצִ'ין (秦). סימן נוסף לשינוי במעמדם של הגנרלים היה שינוי תארם הרשמי מגונג (公 - המקבילה הסינית לדוכס), הכפופים כביכול למלך של ג'ואו, לוואנג (王) - מלכים, השווים במעמדם למלך של ג'ואו.\n" + +"\n" + +"תקופת המדינות הלוחמות היא גם תחילתו של השימוש בברזל במקום ארד בסין כמתכת עיקרית בכל תחומי החיים האזרחיים והצבאיים. במהלך תקופה זו החלו להבנות החומות, שיגנו על הממלכות מפני פלישה של שבטים ברבריים מהצפון חומות, שהיוו את היסוד לחומה הסינית המאוחרת יותר. מאפיין תרבותי נוסף של התקופה היה הפיכתן של פילוסופיות שונות כגון קונפוציזם, דאואיזם, לגאליזם, ומוהיזם למעמד של דתות במדינות השונות.\n" + +"\n" + +"בתום התקופה, לאחר שממלכת צ'ין הצליחה להביס ולכבוש את שאר הממלכות, הפך המלך צ'ין לקיסר הראשון של סין המאוחדת.\n" + +"\n" + +"[עריכה] שושלת צ'ין: האימפריה הסינית הראשונה\n" + +"\n" + +" ערך מורחב – שושלת צ'ין\n" + +"\n" + +"סין אוחדה לראשונה בשנת 212 לפנה\"ס בידי צִ'ין שְׁה-חְוָאנג, מייסד שושלת צ'ין. קדמה לאיחוד תקופת מלחמת המדינות ותקופת האביב והסתיו, שהתאפיינו שתיהן במספר ממלכות שהתקיימו במקביל ולחמו זו בזו. בשנת 212 לפנה\"ס עלה בידו של צ'ין להשתלט סופית על כל הממלכות בסין העתיקה ולשים קץ למלחמות הפנימיות.\n" + +"\n" + +"למרות שהאימפריה המאוחדת של הקיסר צ'ין התקיימה רק 12 שנים, הצליח הקיסר בזמן מועט זה למסד את רוב שטחה של המדינה כפי שאנו מכירים אותה כיום ולהשליט בה משטר ריכוזי המבוסס על לגאליזם אשר מושבו היה בשיאניאנג, שיאן של ימינו. שושלת צ'ין מפורסמת גם בשל תחילת בנייתה של החומה הסינית הגדולה (החומה הוגדלה בתקופת שושלת מינג). בניו של הקיסר לא היו מוצלחים כמוהו, ועם מותו של הקיסר תמה תקופת שלטונה של שושלתו.\n" + +"\n" + +"מקור המילה סין בשפה העברית וכן בשפה האנגלית (China), מגיע ככל הנראה מהמילה צ'ין (秦), שמה של השושלת הראשונה.\n" + +"\n" + +"[עריכה] שושלת האן: תקופה של שגשוג\n" + +"\n" + +" ערך מורחב – שושלת האן\n" + +"\n" + +"שושלת האן הופיעה בסין בשנת 202 לפנה\"ס. בתקופת שלטונה הפכה הקונפוציוניזם לדת המדינה ולפילוסופיה המנחה אותה ואשר המשיכה להנחות את המשטר הסיני עד לסוף התקופה הקיסרית בתחילת המאה ה-20. תחת שלטון ההאן עשתה התרבות הסינית התקדמות אדירה בתחומי ההיסטוריוגפיה, האומנות והמדע. הקיסר וו חיזק והרחיב את הממלכה בהודפו את ה\"שׂיוֹנג-נוּ\" (שבטים שלעתים מזוהים עם ההונים) אל תוך מונגוליה של ימינו, תוך שהוא מספח לממלכתו את השטחים בהם ישבו שבטים אלו. שטחים חדשים אלו אפשרו לסין לראשונה לפתוח קשר מסחר עם המערב: דרך המשי.\n" + +"\n" + +"אולם, השתלטותן של משפחות אצולה על אדמות המדינה, עירערה את בסיס המיסוי של הממלכה, גורמות בכך חוסר יציבות שלטוני. חוסר היציבות הזה נוצל על ידי וואנג מנג, שהקים את שושלת שין שהחזיקה מעמד זמן קצר מאוד. וואנג החל לבצע רפורמות ענפות בהחזקת האדמות ובכלכלה. תומכיה העיקריים של הרפורמה היו האיכרים ובני המעמדות הנמוכים, אך משפחות האצולה שהחזיקו באדמות, התנגדות להן בכל תוקף. עקב כך נוצא מצב של כאוס והתקוממויות רבות במדינה. צאצאה של שושלת האן, הקיסר גואנגוו, ייסד מחדש את שושלת האן בתמיכתם של משפחות האצילים והסוחרים בלוו-יאנג, מזרחית לשיאן, מכאן קיבל העידן החדש שהחל אז את שמו: שושלת האן המזרחית. אולם ייסודה מחדש של השושלת לא הביא את השקט הרצוי לממלכה. עימותים עם בעלי הקרקעות, יחד עם פלישות מבחוץ ומאבקים פנימיים במיעוטים החלישו שוב את השלטון. מרד הטורבן הצהוב שפרץ בשנת 184, סימן את תחילתו של עידן בו שליטים צבאיים מובילים מלחמות בתוך המדינה ומחלקים את המדינה למספר מדינות קטנות. תקופה זו ידועה כתקופת שלוש הממלכות.\n" + +"\n" + +"[עריכה] ג'ין, שש עשרה הממלכות והשושלות הדרומית והצפונית: התקופה האפלה של סין\n" + +"\n" + +" ערך מורחב – שושלת ג'ין\n" + +"\n" + +"שלוש הממלכות התאחדו בשנת 280 תחת שלטונה של שושלת ג'ין. אולם איחוד זה נמשך זמן קצר מאוד. בתחילת המאה ה-4 החלו המיעוטים בסין (כיום מכונים סינים לא בני האן ) להתמרד ולבתר את המדינה, גורמים בכך להגירה עצומה של סינים בני האן אל מדרום לנהר היאנגטסה. בשנת 303 החלו אנשי מיעוט הדאי במרד שבסופו הם כבשו את צ'נגדו שבסצ'ואן. השׂיוֹנְג-נוּ, שנהדפו מסין בתחילת שלטונה של שושלת האן, חזרו להלחם בסין, כבשו חלקים ממנה והוציאו להורג את שני קיסריה האחרונים של שושלת ג'ין. יותר משש-עשרה מדינות הוקמו על ידי המיעוטים האתניים בצפונה של סין. הצפון הכאוטי אוחד לזמן קצר על ידי פו ג'יאן, אך הוא הובס בנסיון פלישתו לדרום סין וממלכתו התפוררה. נסיון נוסף לאיחוד הצפון בוצע על ידי הקיסר טאיוון, שהקים את השושלות הצפוניות, סדרה של משטרים מקומיים ששלטו בסין שמצפון לנהר היאנג צה.\n" + +"\n" + +"עם הפליטים שנסו לדרומה של המדינה, היה גם הקיסר יואן, נצר לשושלת ג'ין, שחידש את שלטון השושלת בדרום המדינה . שושלת זו הייתה הראשונה מבין השושלות הדרומיות שכללו את שושלות סונג, צי, ליאנג וצ'ן. בירתן של השושלות הדרומיות הייתה ג'יאנקאנג, ליד ננג'ינג של ימינו. התקופה בה התקיימו במקביל שתי מדינות הנשלטות על ידי שושלות שונות בצפונה ובדרומה של הארץ נקראה תקופת השושלות הצפונית והדרומית. שושלת סוי קצרת המועד, הצליחה לאחד את המדינה ב589 לאחר כמעט 300 שנות פירוד.\n" + +"\n" + +"[עריכה] שושלת טאנג: חזרה לשיגשוג\n" + +"\n" + +" ערך מורחב – שושלת טאנג\n" + +"\n" + +"בשנת 618 נוסדה שושלת טאנג, פותחת עידן חדש של שיגשוג וחידושים בתחומי האמנות והטכנולוגיה. בתקופה זו פעלו משוררים נודעים כלי באי ודו פו. הבודהיזם, שהחל חודר לסין כבר במאה ה-1, הוכרז כדת הרשמית של המדינה ואומץ על ידי המשפחה הקיסרית. צ'אנג-אן (שיאן של ימינו), בירת השושלת הייתה באותה תקופה העיר הגדולה ביותר בעולם. תקופות טאנג והאן נחשבות לרוב כתקופות השגשוג הממושכות ביותר בהיסטוריה של סין. אולם, על אף השגשוג, כוחה של שושלת טאנג החל להחלש והמדינה החלה נקרעת בשנית בידי שליטים מקומיים. תקופה נוספת של כאוס הגיעה למדינה: תקופת חמש השושלות ועשר הממלכות.\n" + +"\n" + +"[עריכה] שושלת סונג ושכנותיה הצפוניות, ליאו וג'ין\n" + +"\n" + +" ערך מורחב – שושלת סונג\n" + +"\n" + +"בשנת 960 הצליחה שושלת סונג לאסוף מספיק כח כדי לאחד את סין תחת שלטונה. תחת שלטון סונג, שבירתו הייתה קאיפנג, החלה תקופת צמיחה חדשה בסין. אולם שושלת סונג לא הייתה הכח הפוליטי הגדול היחיד באזור. במנצ'וריה ובמזרח מונגוליה התהוותה ממלכתה של שושלת ליאו החיטאנית וב1115 עלתה לשלטון במנצ'וריה שושלת ג'ין הג'ורצ'נית (הג'ורצ'נים היו אבותיהם של המנצ'ורים) שתוך 10 שנים בלעה את שושלת ליאו לתוכה. שושלת ג'ין השתלטה גם על שטחים בצפון סין, בתוכם הבירה הסינית קאיפנג, מה שאילץ את שושלת סונג הסינית להעביר את בירתה לחאנגג'ואו. שושלת סונג גם אולצה על ידי שושלת ג'ין להכריז על הכרתה בשושלת ג'ין כשליטה העליונה שלה. בתקופה שלאחר מכן הוקמו שלוש ממלכות גדולות בשטחה של סין (ממלכת סונג, ממלכת ג'ין וממלכה שלישית של מיעוטים שנקראה ממלכת שיה המערבית). בתקופה זו נעשו פיתוחים משמעותיים בטכנולוגיה, ככל הנראה עקב הלחץ הצבאי שהופעל על ממלכת סונג מצד שכנותיה הצפוניות.\n" + +"\n" + +"[עריכה] המונגולים\n" + +"\n" + +"ממלכת ג'ין הייתה הראשונה מבין הממלכות בסין שהובסה על ידי המונגולים, שהמשיכו וכבשו גם את ממלכת סונג במלחמה ארוכה ועקובה מדם שהייתה המלחמה הראשונה בהיסטוריה בה נעשה שימוש מכריע בנשק חם. לאחר תום המלחמה החל עידן של שלום כמעט בכל אסיה (שהייתה נתונה לשלטון המונגולים), עידן שנקרא \"השלום המונגולי\" (Pax Mongolica). שלום זה איפשר לנוסעים מהמערב, דוגמת מרקו פולו, להגיע לסין ולחשוף לראשונה את אוצרתיה למערב. בסין, נחלקו המונגולים בין אלו שרצו להחיל בסין את מנהגי המונגולים ובין אלו שרצו לאמץ את המנהגים הסינים לעצמם. קובלאי חאן, שנמנה עם הקבוצה השנייה, הקים בסין את שושלת יואן (מילולית: \"השושלת הראשונה\") זו הייתה הממלכה הראשונה שהשתרעה על כל שטחה של סין ושבירתה הייתה בייג'ינג (בייג'ינג הייתה בירתה של שושלת גי'ן אך השושלת לא שלטה על סין כולה).\n" + +"\n" + +"[עריכה] תחייתה מחדש של התרבות הסינית\n" + +"\n" + +"בקרב העם בסין, הייתה התמרמרות רבה ביחס לשלטון ה\"זרים\" החדש, התמרמרות שלבסוף הובילה להתקוממויות איכרים במדינה שהתפתחו למאבק בשלטון שנדחף למעשה אל מחוץ לגבולותיה של סין. את השלטון המונגולי החליף שלטונה של שושלת מינג בשנת 1368. שושלת זו פתחה תקופה של פריחה והתחדשות תרבותית: האומנות, ובעיקר תעשיית הפורצלן, נסקה לגבהים שלא נודעו קודם לכן, סחורות סיניות נעו ברחבי האוקיינוס ההודי, מגיעות עד לחופיה המזרחיים של אפריקה במסעותיו של צ'נג חה. סין בנתה צי ספינות שהגדולות מבניהן שינעו 1,500 טונות של סחורות וחיילים מהצבא בן מיליון החיילים שהיה ברשותה באותה העת. יותר מ100,000 טונות ברזל יוצרו כל שנה וספרים רבים נדפסו. יש הטוענים כי שהאומה הסינית בתקופת מינג הייתה האומה המתקדמת ביותר בעולם.\n" + +"\n" + +"הקיסר חונג-וו, מייסד השושלת, הניח את היסודות לנטייתה של המדינה למעט במסחר ותעשייה ולהתמקד בעיקר בהגדלת הרווחים מהמגזר החקלאי, כנראה בשל מוצאו החקלאי של הקיסר. חברות פאודליות זעירות שהתפתחו במהלך שנות שלטונם של שושלת סונג ושל המונגולים פורקו ואדמותיהם הולאמו, חולקו והושכרו לאיכרים מחדש. כמו כן, הוטל חוק האוסר החזקת עבדים במדינה. החוקים נגד מסחר נשארו בממלכה עוד מתקופת שושלת סונג, אך כעת הם חלו גם על סוחרים זרים מה שהביא במהרה לגוויעת סחר החוץ בין סין לשאר העולם.\n" + +"\n" + +"ככל שחלף הזמן, שלטון הקיסר נעשה חזק יותר ויותר על אף שהחצר הקיסרית עשתה שימוש נרחב בפקידים ממשלתיים שהיו אחראיים לתפקודה השוטף של המדינה.\n" + +"\n" + +"במהלך שלטון המונגולים פחתה האוכלוסייה בכ-40% לכ-60 מיליון נפש. שתי מאות מאוחר יותר המספר הוכפל. הערים החלו להתפתח בקצב מואץ ובעקבות כך החלה להופיע גם תעשייה זעירה. כתוצאה מהתערבות שלטונית, נמנעה בסין התפתחותו של מרכז אורבני מצומצם ובמקום זאת צמחו מספר רב של ערים שהיוו מרכזים מקומיים לאזורים המקיפים אותן.\n" + +"\n" + +"[עריכה] תקופת מינג: מהתפתחות לבידוד\n" + +"\n" + +" ערך מורחב – שושלת מינג\n" + +"\n" + +"למרות הסלידה ממסחר עם מדינות אחרות, וההתרכזות הפנימית בענייני המדינה, סין תחת שלטונה של שושלת מינג לא הייתה מבודדת. הסחר עם מדינות אחרות, ובעיקר עם יפן, המשיך להתקיים והקיסר יונגלה השתדל ככל יכולתו למסד קשרים דיפלומטיים עם המדינות הסובבות את סין. צבאה של סין כבש את אנאם והצי הימי שלה הפליג במסעותיו עד לחופי אפריקה. הסינים גם הצליחו לייצר השפעה מסוימת בטורקסטן.\n" + +"\n" + +"אחת הדרכים המרשימות ביותר בהן התבטאה מדיניות החוץ הסינית של אותה תקופה הייתה מסעותיו הימיים של צ'אנג חֶה, סריס מוסלמי ונצר למשפחה מונגולית, אשר הוביל שבעה מסעות ימיים מפוארים בין 1405 ל1433 שעברו בכל האוקיינוס ההודי והאיים שבו והגיעו עד לכף התקווה הטובה. מסעו הראשון של הה, כלל 62 ספינות שנשאו 28,000 מלחים – ללא ספק המסע הימי הגדול ביותר בהיסטוריה האנושית.\n" + +"\n" + +"אולם, לקראת סופה של המאה ה-15, הוטל איסור על אזרחי המדינה לבנות ספינות בעלות כושר הפלגה באוקיינוס וכן נאסר על כלל האזרחים לעזוב את המדינה. כיום קיימת הסכמה על כך שצעד זה ננקט כדי להגן על הקיסרות מפני התקפות של שודדי ים. הגבלות אלו בוטלו לבסוף באמצע המאה ה-17.\n" + +"\n" + +"[עריכה] שושלת צ'ינג\n" + +"\n" + +" ערך מורחב – שושלת צ'ינג\n" + +"\n" + +"השושלת הקיסרית האחרונה בסין, נוסדה ב1644 כאשר המנצ'ורים כבשו את המדינה, הדיחו מהשלטון את שושלת מינג המקומית והקימו את שושלת צ'ינג שבירתה בייג'ינג. במשך חצי מאה נלחמו המנצ'ורים מלחמות עקובות מדם שבמהלכן השתלטו על האזורים שהיו בשליטת שושלת מינג ובכללם מחוז יונאן המרוחקת, טיבט ומונגוליה. את ההצלחה לה זכו המנצ'ורים בתחילת תקופת שלטונם יש לזקוף לזכות כוחם הצבאי האדיר והמיומן ששולב עם מיומנויות בירוקרטיות סיניות.\n" + +"\n" + +"חלק מההיסטוריונים רואים בתקופה של תחילת שלטון צ'ינג המשך רציף להתדרדרות התרבותית שחלה בסוף תקופת מינג. אך יש כאלה הרואים בתחילת שלטון צ'ינג תקופה של שיגשוג יותר מאשר נסיגה. בהוראת הקיסר קנגשי נכתב המילון המקיף והמפורט ביותר לשפה הסינית שנכתב עד אז ותחת שלטונו של הקיסר קיאנלונג חובר הקטלוג המלא של כל העבודות החשובות של התרבות הסינית. שושלת צ'ינג גם המשיכה בהרחבת אוצר הספרות העממית ובפיתוח החקלאות תוך יבוא גידולים חדשים מהעולם החדש דוגמת התירס. גם צמיחת האוכלוסייה המשיכה להאיץ בתקופת צ'ינג ואוכלוסיית המדינה, שבשנת 1700 מנתה 100 מיליון נפש, הגיעה לכדי 220 מליון בשנת 1800.\n" + +"\n" + +"\n" + +"בקריקטורה צרפתית מפורסמת זו, נראית חלוקתה של סין בין בריטניה, גרמניה, רוסיה, צרפת ויפן\n" + +"בקריקטורה צרפתית מפורסמת זו, נראית חלוקתה של סין בין בריטניה, גרמניה, רוסיה, צרפת ויפן\n" + +"\n" + +"במהלך המאה ה-19, נחלשה שליטתה של שושלת צ'ינג במדינה והשגשוג שהיה בה התפוגג. סין סבלה מרעב קשה, התפוצצות אוכלוסין וחדירה בלתי פוסקת של מדינות המערב בנסיון להשיג לעצמן השפעה במדינה. שאיפתה של בריטניה להמשיך בסחר הבלתי חוקי באופיום, נתקל בהתנגדות עזה של המשטר הקיסרי, מה שהביא לפריצתה של מלחמת האופיום הראשונה ב1840. סין, שהפסידה במלחמה, אולצה לבצע ויתורים כואבים ולפתוח את נמליה לסחר חפשי עם מדינות המערב. ויתוריה הטריטוריאלים של סין כללו את העברת הונג קונג לידיה של בריטניה ב1842 כחלק מחוזה נאנג'ינג. בנוסף מרד טאי פינג (1864-1851) ומרד ניאן (1868-1853), יחד עם תנועות לאומיות מוסלמיות ששאפו לעצמאות וחוזקו על ידי רוסיה ייבשו את קופת המדינה וכמעט שהביאו לנפילת השלטון בה.\n" + +"\n" + +"המרידות בשלטון דוכאו בעיקר על ידי כוחות המערב שבאותו הזמן עשו במדינה כבשלהם וניצלו את שווקיה ואת מערכתה הכלכלית.\n" + +"\n" + +"לאחר שוך המהומות בשנות השישים של המאה ה-19, החלה שושלת צ'ינג לטפל בבעיות המודרניזציה במדינה על ידי ביצוע רפורמות בכל תחומי שליטתה. אבל, הקיסרית האלמנה צישי, יחד עם גורמים שמרניים במדינה, ביצעה מעין הפיכה והדיחה את הקיסר הצעיר מהשלטון, מורידה בכך לטמיון את הרפורמות שאך החלו להתבצע. הרפורמות הצבאיות, שהושארו על כנן, היו חסרות ערך עקב השחיתות האיומה שהתפשטה בצמרת השלטון. חלק מספינות הקרב החדישות של הצבא כלל לא יכלו לבצע ירי, וזאת עקב מעילות גדולות בתקציבי בנייתן שלא השאירו די כסף לרכישת אבק שריפה. כתוצאה מכך כוחות \"הצבא הסיני החדש\" נחלו תבוסות משפילות הן במלחמת סין-צרפת (1885-1883) והן במלחמת סין-יפן הראשונה (1895-1894)\n" + +"\n" + +"עם תחילתה של המאה ה-20, הייתה החצר הקיסרית בסין הרוסה, שחיתות הייתה בכל והאוכלוסייה גדלה בקצב בלתי ניתן לעצירה. המדינה נשלטה על ידי הקיסרית צישי, דמות שמרנית ביותר שהתנגדה לכל סוג של רפורמה. מותו של הקיסר גוואנגשו יום אחד לפני מותה של הקיסרית (יש הטוענים שהוא הורעל על ידה) הרס את הסיכוי האחרון לביסוס הנהגה אפקטיבית במדינה.\n" + +"\n" + +"[עריכה] הרפובליקה הסינית\n" + +"\n" + +" ערך מורחב – היסטוריה של הרפובליקה הסינית\n" + +"\n" + +"ביאושם מאוזלת ידו של השלטון, החלו פקידי ממשל צעירים, קציני צבא וסטודנטים, שהושפעו מרעיונותיו המהפכניים של סון יאט-סן להתארגן לקראת הפיכה במדינה שתסלק את שושלת צ'ינג מהשלטון ותהפוך את המדינה לרפובליקה. התקוממות ווצ'אנג, התקוממות מהפכנית צבאית, החלה ב10 באוקטובר 1911. כחצי שנה מאוחר יותר, ב12 בפברואר 1912 הוקמה הממשלה הזמנית של הרפובליקה הסינית בנאנג'ינג כשבראשה עומד סון יאט-סן כנשיאה הזמני. אך סון נאלץ לוותר על תפקידו לטובת יואן שיקאי אשר פיקד באותו הזמן על \"הצבא החדש\" והיה ראש הממשלה תחת שלטון צ'ינג, כחלק מהסכם שנחתם להדחת הקיסר האחרון – הילד הנרי פו-יי. בשנים שלאחר הכתרתו כנשיא, ניסה יואן שיקאי לעקוף את סמכויותיהן של הוועדות הפרובינציאליות של הרפובליקה ואף הכריז על עצמו קיסר ב1915. שאיפותיו הקיסריות של יואן נתקלו בהתנגדות עזה של המהפכנים שראו כיצד מהפכתם הולכת לכינונה מחדש של קיסרות במדינה ולא של רפובליקה, והם החלו מתמרדים נגד יואן עד למותו ב1916 שהשאיר ריק שלטוני בסין. סין שלאחר מותו של יואן נחלקה בין הממשל הרפובליקני החדש, ובין מצביאים מקומיים ששלטו באזוריהם עוד מתקופת צ'ינג.\n" + +"\n" + +"לאירוע חסר החשיבות (בעיני המעצמות מחוץ לסין) שהתרחש ב1919 הייתה השלכה מכריעה על המשך ההיסטוריה הסינית במאה ה-20, אירוע זה הוא תנועת הארבעה במאי. התנועה, שהוציאה שם רע לפילוסופיות המערביות המקובלות והאימוץ של קוי מחשבה קיצוניים יותר שבאו לאחר מכן זרעו את הזרעים לקונפליקט בלתי ניתן לגישור בין הימין והשמאל בסין, קונפליקט שהמשיך עד לסופה של המאה.\n" + +"\n" + +"ב1920, הקים סון יאט-סן בסיס לתנועתו המהפכנית בדרום סין, אשר ממנו הוא יצא לאיחוד האומה השסועה. בעזרתם של הסובייטים, הוא הקים ברית עם המפלגה הקומוניסטית הסינית, ברית שלחמה בשאריות המשטר הקיסרי שהיו מפוזרות בצפון המדינה. לאחר מותו של סון ב1925 השתלט יורשו צ'יאנג קאי שק על המפלגה הלאומנית (הקוומינטנג) והצליח לאחד תחת שלטונו את מרבית דרום המדינה ומרכזה במערכה צבאית שנקראה המשלחת הצפונית. לאחר שהצליח להביס גם את תומכי הקיסר בצפון, פנה צ'יאנג למלחמה באנשי המפלגה הקומוניסטית, שעד לאותה תקופה נלחמו יחד איתו. הקומוניסטים פרשו מהקוומינטנג ב1927 וברחו להרים שבדרום סין. ב1934 יצאו הקומוניסטים מההרים שבשליטתם (שם הקימו את הרפובליקה הסינית-סובייטית) למצעד הארוך, מסע צבאי מפרך באזורים הטרשיים ביותר במדינה אל עבר צפון מערבה של המדינה לפרובינציית שאאנסי שם הקימו לעצמם בסיסי לוחמת גרילה.\n" + +"\n" + +"במהלך המצעד הארוך, הכירו הקומוניסטים במנהיגם החדש מאו צה דונג. המאבק בין הקוומינטנג והמפלגה הקומוניסטית הסינית נמשך לעתים בגלוי ולעתים בחשאי תוך כדי מלחמת סין-יפן השנייה (1945-1931) על אף שהכוחות יצרו לכאורה חזית מאוחדת כנגד פלישת היפנים ב1937 כחלק ממלחמת העולם השנייה. הלחימה בין שתי המפלגות המשיכה לאחר תבוסתם של היפנים ב-1945, וב-1949 שלטו הקומוניסטים ברוב שטחה של המדינה.\n" + +"\n" + +"[עריכה] הרפובליקה העממית של סין\n" + +"\n" + +" ערך מורחב – היסטוריה של הרפובליקה העממית של סין\n" + +"\n" + +"פרק זה לוקה בחסר. אתם מוזמנים לתרום לוויקיפדיה ולהשלים אותו. ראו פירוט בדף השיחה.\n" + +"\n" + +"צ'יאנג קאי שק נמלט עם שאריות ממשלתו וצבאו לטיוואן שם הוא הכריז על טייפה כבירה הזמנית של הרפובליקה עד להשלמת הכיבוש מחדש של סין היבשתית על ידי כוחותיו. הרפובליקה הסינית ממשיכה להתקיים עד ימינו (סוף 2004) בטיוואן אך היא טרם הכריזה עצמאות והיא אינה מוכרת רשמית כמדינה על ידי שאר העולם.\n" + +"\n" + +"עם ההכרזה על הקמתה של הרפובליקה העממית של סין ב1 באוקטובר 1949, חולקה סין שוב לרפובליקה העממית של סין בסין היבשתית ולרפובליקה הסינית שישבה בטיוואן ובמספר איים קטנים בסביבה, כאשר לכל רפובליקה יש ממשלה הרואה בעצמה את הממשלה הסינית האמיתית והמתייחסת אל הממשלה האחרת בבוז ובביטול. מצב זה נמשך עד לשנות התשעים של המאה ה-20, כאשר שינויים פוליטים ברפובליקה הסינית הביאו אותה להפסקת הטענה הפומבית להיותה ממשלת סין היחידה.\n" + +"\n" + +"[עריכה] ראו גם\n" + +"\n" + +" * לוח זמנים של ההיסטוריה של סין – טבלה המתארת את האירועים והאישים החשובים בתולדותיה של סין.\n" + +"\n" + +"[עריכה] לקריאה נוספת\n" + +"\n" + +" * עמנואל צ' י' שו, צמיחתה של סין המודרנית, הוצאת שוקן, 2005.\n" + +"\n" + +"[עריכה] קישורים חיצוניים\n" + +"\n" + +" * ירדן ניר-בוכבינדר, סין אימנו, קונפוציוס אבינו, באתר \"האייל הקורא\"\n" + +"\n" + +"\n" + +"[עריכה] הערות שוליים\n" + +"\n" + +" 1. ^ סין של תקופת הברונזה בגלריה הלאומית לאמנות של ארצות-הברית\n" + +" 2. ^ כתב על חרסים מאתר ארליטואו (כתוב בסינית מפושטת)\n"; + + +var japanese = +"中国の歴史\n" + +"出典: フリー百科事典『ウィキペディア(Wikipedia)』\n" + +"移動: ナビゲーション, 検索\n" + +"中国歴史\n" + +"中国の歴史\n" + +"元謀・藍田・北京原人\n" + +"神話伝説(三皇五帝)\n" + +"黄河・長江文明\n" + +"夏\n" + +"殷\n" + +"周 西周\n" + +"東周 春秋\n" + +"戦国\n" + +"秦\n" + +"漢 前漢\n" + +"新\n" + +"後漢\n" + +"三国 魏 呉 蜀\n" + +"晋 西晋\n" + +"東晋 十六国\n" + +"南北朝 宋 北魏\n" + +"斉\n" + +"梁 西魏 東魏\n" + +"陳 北周 北斉\n" + +"隋\n" + +"唐\n" + +"五代十国\n" + +"宋 北宋 遼 西夏\n" + +"南宋 金\n" + +"元\n" + +"明 北元\n" + +"後金 南明 大順\n" + +"清\n" + +"中華民国\n" + +"中華人民共和国 (参考:\n" + +"台湾問題)\n" + +"\n" + +"中国の歴史(ちゅうごくのれきし)、或いは中国史(ちゅうごくし)\n" + +"\n" + +"中国の黄河文明は古代の四大文明の一つに数えられ、また黄河文明よりも更に遡る長江文明が存在した。\n" + +"目次\n" + +"[非表示]\n" + +"\n" + +" * 1 王朝、政権の変遷\n" + +" * 2 概略\n" + +" o 2.1 先史人類史\n" + +" o 2.2 文明の萌芽\n" + +" + 2.2.1 黄河文明\n" + +" + 2.2.2 長江文明\n" + +" + 2.2.3 その他\n" + +" o 2.3 先秦時代\n" + +" + 2.3.1 三代\n" + +" + 2.3.2 春秋戦国\n" + +" o 2.4 秦漢帝国\n" + +" o 2.5 魏晋南北朝時代\n" + +" o 2.6 隋唐帝国\n" + +" o 2.7 五代十国・宋\n" + +" o 2.8 モンゴル帝国\n" + +" o 2.9 明清帝国\n" + +" o 2.10 中国の半植民地化\n" + +" o 2.11 中華民国\n" + +" + 2.11.1 革命後の中国の政局\n" + +" + 2.11.2 袁世凱の台頭と帝制運動(1913年~1916年)\n" + +" + 2.11.3 袁世凱死後の政局(1916年~1920年)\n" + +" + 2.11.4 国民革命(1920年~1928年)\n" + +" + 2.11.5 国民政府(1928年~1931年)\n" + +" + 2.11.6 抗日戦争(1931年~1937年)\n" + +" + 2.11.7 日中戦争(1937年~1945年)\n" + +" + 2.11.8 漢民族以外の民族の動向\n" + +" # 2.11.8.1 モンゴルとチベットでの動き\n" + +" # 2.11.8.2 東トルキスタン(新疆)での動き\n" + +" o 2.12 中華人民共和国\n" + +" + 2.12.1 社会主義国化と粛清(1949年~1957年)\n" + +" + 2.12.2 中国共産党の対ソ自立化(1958年~1965年)\n" + +" + 2.12.3 文化大革命前期(1966年~1969年)\n" + +" + 2.12.4 文化大革命後期(1969~1976年)\n" + +" + 2.12.5 改革開放以後の現在(1976年~)\n" + +" # 2.12.5.1 一党独裁\n" + +" # 2.12.5.2 少数民族問題\n" + +" * 3 人口の変遷\n" + +" * 4 地方行政制度\n" + +" o 4.1 封建制度(前1600年頃~前221年)\n" + +" o 4.2 郡県制度(前221年~249年)\n" + +" o 4.3 軍府による広域行政(249年~583年)\n" + +" o 4.4 州県制(583年~1276年)\n" + +" * 5 祭祀制度\n" + +" * 6 外交\n" + +" o 6.1 漢帝国\n" + +" o 6.2 魏晋南北朝時代\n" + +" o 6.3 隋唐帝国\n" + +" * 7 関連項目\n" + +" * 8 脚注\n" + +"\n" + +"[編集] 王朝、政権の変遷\n" + +"現在の中国、すなわち中華人民共和国の領域\n" + +"現在の中国、すなわち中華人民共和国の領域\n" + +"\n" + +" * 長江文明\n" + +" * 黄河文明\n" + +" * 夏(紀元前2070年頃 - 紀元前1600年頃\n" + +" * 殷(紀元前1600年頃 - 紀元前12世紀・紀元前11世紀ごろ)\n" + +"\n" + +" * 周(紀元前12世紀・紀元前11世紀ごろ - 紀元前256年)…殷を倒し、西周建国。克殷の年代については諸説あり、はっきりしない。\n" + +" o 春秋時代(紀元前770年 - 紀元前403年)…紀元前453年晋が韓魏趙に分割された時点、または紀元前403年韓魏趙が諸侯に列した時点をもって春秋時代の終わり、戦国時代の始まりとする。\n" + +" o 戦国時代(紀元前403年 - 紀元前221年)…晋が韓・趙・魏に分裂し、戦国時代突入。\n" + +" * 秦(紀元前221年 - 紀元前207年)…秦王・政が6国を滅ぼし中華統一。\n" + +" * 漢\n" + +" o 前漢(紀元前206年 - 8年)…秦滅亡後、楚の項羽との楚漢戦争に勝ち、劉邦が建国。\n" + +" o 新(8年 - 23年)…外戚の王莽が前漢皇帝から帝位を簒奪し建国。\n" + +" o 後漢(25年 - 220年)…前漢の景帝の子孫の劉秀(光武帝)が王莽軍を破り、漢を再興。\n" + +" * 三国時代(220年 - 280年)\n" + +" o 魏、蜀(蜀漢・漢)、呉…曹操の子曹丕が献帝から禅譲を受け即位すると、蜀の劉備も漢皇帝を名乗り即位、さらに呉の孫権も大帝として即位し、三国時代に入る。\n" + +" * 晋(265年 - 420年)\n" + +" o 西晋(265年 - 316年)…晋王司馬炎が魏の元帝より禅譲を受け即位し建国。だが、異民族五胡の侵入により衰退。異民族の漢に滅ぼされた。\n" + +" o 東晋(317年 - 420年)…皇族でただ一人生き残った琅邪王・司馬睿は江南に逃れ、建康で即位(元帝)。これを中原の晋と区別して東晋という。\n" + +" o 五胡十六国時代(304年 - 439年)\n" + +" * 南北朝時代(439年 - 589年)\n" + +" o 北魏、東魏、西魏、北斉、北周\n" + +" o 宋、斉、梁、陳\n" + +" * 隋(581年 - 619年)\n" + +" * 唐(618年 - 907年)\n" + +" o 武周\n" + +" * 五代十国時代\n" + +" o 後梁、後唐、後晋、後漢、後周……五代(中原を中心とする国)\n" + +" o 呉、南唐・閩・呉越・荊南・楚・南漢・前蜀・後蜀・北漢……十国(中華東西南北に拠る勢力)\n" + +" * 宋\n" + +" o 北宋(960年 - 1127年)\n" + +" o 南宋(1127年 - 1279年)\n" + +" o 遼、西夏、金\n" + +" * 元(1271年 - 1368年)\n" + +" * 明(1368年 - 1644年)\n" + +" o 南明\n" + +" * 清(1616年 - 1912年)(1616年 - 1636年は後金、それ以前はマンジュ国)\n" + +" o 太平天国、満州国\n" + +" * 中華民国(台湾)(1912年 - 現在)\n" + +" * 中華人民共和国(1949年 - 現在)\n" + +"\n" + +"[編集] 概略\n" + +"\n" + +"[編集] 先史人類史\n" + +"\n" + +"中国に現れた最初期の人類としては、元謀原人や藍田原人、そして北京原人が知られている。\n" + +"\n" + +"[編集] 文明の萌芽\n" + +"\n" + +"中国大陸では、古くから文明が発達した。中国文明と呼ばれるものは、大きく分けて黄河文明と長江文明の2つがある。黄河文明は、畑作が中心、長江文明は稲作が中心であった。黄河文明が、歴史時代の殷(商)や周などにつながっていき、中国大陸の歴史の中軸となった。長江文明は次第に、中央集権国家を創出した黄河文明に同化吸収されていった。\n" + +"\n" + +"[編集] 黄河文明\n" + +"龍山文化時代の高杯。1976年山東省出土\n" + +"龍山文化時代の高杯。1976年山東省出土\n" + +"\n" + +"黄河文明は、その後の中国の歴史の主軸となる。\n" + +"\n" + +" * 裴李崗文化…紀元前7000?~紀元前5000?。一般的な「新石器時代」のはじまり。定住し、農業も行われていた。河南省(黄河中流)。土器は赤褐色\n" + +" * 老官台文化…紀元前6000?~紀元前5000?。土器作りや粟作りが行われていた。陝西省(黄河上流)。土器は赤色。\n" + +" * 北辛文化…紀元前6000?~紀元前5000?。土器は黄褐色。山東省(黄河下流)\n" + +" * 磁山文化…紀元前6000?~紀元前5000?。土器は赤褐色。河北省(黄河下流)\n" + +" * 仰韶文化…紀元前4800?~紀元前2500?。前期黄河文明における最大の文化。陝西省から河南省にかけて存在。このころは母系社会で、農村の階層化も始まった。文化後期になると、社会の階層化、分業化が進み、マルクス経済学でいうところの原始共産制は仰韶文化のころに終焉したと見られる。土器は赤色。\n" + +" * 後岡文化…紀元前5000?~紀元前4000?。北辛文化が発展。河南省。\n" + +" * 大汶口文化…紀元前4300?~紀元前2400?。土器は前期は赤色(彩陶)、後期は黒色(黒陶)。なお、この区分は黄河文明全体に見られる。山東省。\n" + +" * 龍山文化…紀元前2500?~紀元前2000?。大汶口文化から発展。後期黄河文明最大の文化。土器は黒色。山東省。\n" + +" * 二里頭文化…紀元前2000?~紀元前1600?。遺跡の中心部には二つの宮殿がある。河南省。\n" + +"\n" + +"[編集] 長江文明\n" + +"母なる長江\n" + +"母なる長江\n" + +"\n" + +"長江文明は黄河文明が萌芽する遥か前より栄えていた。夏王朝の始祖とされる禹が南方出身であるとされるため、この長江流域に夏王朝が存在したのではないかという説[1]がある。\n" + +"\n" + +" * 玉蟾岩遺跡…湖南省(長江中流)。紀元前14000年?~紀元前12000年?の稲モミが見つかっているが、栽培したものかは確定できない。\n" + +" * 仙人洞・呂桶環遺跡…江西省(長江中流)。紀元前12000年ごろ?の栽培した稲が見つかっており、それまで他から伝播してきたと考えられていた中国の農耕が中国独自でかつ最も古いものの一つだと確かめられた。\n" + +" * 彭頭山文化…湖南省(長江中流)。紀元前7000年?~紀元前5000年?。散播農法が行われており、中国における最古の水稲とされる。\n" + +" * 大渓文化…四川省(長江上流)。紀元前4500年?~紀元前3300年?。彩文紅陶(紋様を付けた紅い土器)が特徴で、後期には黒陶・灰陶が登場。灌漑農法が確立され、住居地が水の補給のための水辺から大規模に農耕を行う事の出来る平野部へ移動した。\n" + +" * 屈家嶺文化…湖北省。紀元前3000年?~紀元前2500年?大渓文化を引き継いで、ろくろを使用した黒陶が特徴。河南地方の黄河文明にも影響を与えたと考えられる。\n" + +" * 石家河文化…屈家嶺文化から発展し、湖北省天門県石家河に大規模な都城を作った紀元前2500年頃を境として屈家嶺と区別する。この都城は南北1.3Km、東西1.1Kmという大きさで、上述の黄河流域の部族と抗争したのはこの頃と考えられる。\n" + +" * 河姆渡文化 …紀元前5000年?~紀元前4000年?下流域では最古の稲作。狩猟や漁労も合わせて行われ、ブタの家畜化なども行われた。\n" + +" * 良渚文化… 浙江省(銭塘江流域)。紀元前5260年?~紀元前4200年?(以前は文化形態から大汶口文化中期ごろにはじまったとされていたが、1977年出土木材の年輪分析で改められた)青銅器以前の文明。多数の玉器の他に、絹が出土している。分業や階層化も行われたと見られ、殉死者を伴う墓が発見されている。黄河文明の山東竜山文化とは相互に関係があったと見られ、同時期に衰退したことは何らかの共通の原因があると見られている。\n" + +" * 三星堆遺跡… 紀元前2600年?~紀元前850年?。大量の青銅器が出土し、前述の他に目が飛び出た仮面・縦目の仮面・黄金の杖などがあり、また子安貝や象牙なども集められており、権力の階層があったことがうかがい知れる。青銅器については原始的な部分が無いままに高度な青銅器を作っているため他の地域、おそらくは黄河流域からの技術の流入と考えられる。長江文明と同じく文字は発見されていないが、「巴蜀文字」と呼ばれる文字らしきものがあり、一部にこれをインダス文字と結びつける説もある。\n" + +"\n" + +"[編集] その他\n" + +"\n" + +" * 新楽遺跡…遼寧省(遼河流域)。紀元前5200年?ごろの定住集落。母系社会が定着し、農業も行われていた。\n" + +"\n" + +"[編集] 先秦時代\n" + +"\n" + +"[編集] 三代\n" + +"\n" + +"史記では伝説と目される三皇五帝時代に続いて夏[2]王朝について記述されている。夏については実在が確かでなくまた定説もない。\n" + +"\n" + +"殷[3](商)が実在の確認されている最古の王朝である。殷では、王が占いによって政治を行っていた(神権政治)。殷は以前は山東で興ったとされたが、近年は河北付近に興ったとする見方が有力で、黄河文明で生まれた村のうち強大になり発展した都市国家の盟主であった[4]と考えられる。\n" + +"\n" + +"紀元前11世紀頃に殷を滅ぼした周は、各地の有力者や王族を諸侯として封建制をおこなった。しかし、周王朝は徐々に弱体化し、異民族に攻められ、紀元前770年には成周へ遷都した。その後、史記周本紀によれば犬戎の侵入により西周が滅び、洛陽に東周が再興されたされるが、同じく平勢隆郎の検討によれば幽王が殺害されたあと短期間携王が西、平王が東に並立し、紀元前759年平王が携王を滅ぼしたと考えられる。平王のもとで周は洛陽にあり、西周の故地には秦が入る。これ以降を春秋時代と呼ぶ。春秋時代には、周王朝の権威はまだ残っていたが、紀元前403年から始まるとされる戦国時代には、周王朝の権威は無視されるようになる。\n" + +"\n" + +"[編集] 春秋戦国\n" + +"諸子百家の一、孔子\n" + +"諸子百家の一、孔子\n" + +"\n" + +"春秋戦国時代は、諸侯が争う戦乱の時代であった。\n" + +"\n" + +"春秋時代は都市国家の盟主どうしの戦いだった。しかし春秋末期最強の都市国家晋が三分割されたころから様子が変わる。その当時の晋の有力な家臣六家が相争い、最初力が抜きん出ていた智氏が弱小な趙氏を攻めたものの、趙氏がよく農村を経済的ではなく封建的に支配し、それによって集めた食糧が多かったために城を守りきり、疲弊した智氏を魏氏、韓氏が攻め滅ぼしたために最終的に趙、魏、韓の三国が出来た。このこともあってそれまで人口多くてもせいぜい5万人程度だった都市国家が富国強兵に努め、商工業が発達し、貨幣も使用し始めやがて領土国家に変貌しその国都となった旧都市国家は30万人規模の都市に変貌する。また鉄器が普及したこともあいまって、農業生産も増大した。晋の分裂以後を一般に戦国時代という。\n" + +"\n" + +"また、このような戦乱の世をどのように過ごすべきかという思想がさまざまな人たちによって作られた。このような思想を説いた人たちを諸子百家(陰陽家、儒家、墨家、法家、名家、道家、兵家等が代表的)という。\n" + +"\n" + +"[編集] 秦漢帝国\n" + +"始皇帝\n" + +"\n" + +"現在の陝西省あたりにあった秦は、戦国時代に着々と勢力を伸ばした。勢力を伸ばした背景には、厳格な法律で人々を統治しようとする法家の思想を採用して、富国強兵に努めたことにあった。秦王政は、他の6つの列強を次々と滅ぼし、紀元前221年には史上はじめての中国統一を成し遂げた。秦王政は、自らの偉業をたたえ、王を超える称号として皇帝を用い、自ら始皇帝と名乗った。\n" + +"兵馬俑\n" + +"\n" + +"始皇帝は、法家の李斯を登用し、中央集権化を推し進めた。このとき、中央から派遣した役人が全国の各地方を支配する郡県制が施行された。また、文字・貨幣・度量衡の統一も行われた。さらに、当時モンゴル高原に勢力をもっていた遊牧民族の匈奴を防ぐために万里の長城を建設させた。さらに、軍隊を派遣して、匈奴の南下を抑えた。また、嶺南地方(現在の広東省)にも軍を派遣し、この地にいた百越諸族を制圧した。しかし、このような中央集権化や土木事業・軍事作戦は人々に多大な負担を与えた。そのため、紀元前210年に始皇帝が死ぬと、翌年には陳勝・呉広の乱という農民反乱がおきた。これに刺激され各地で反乱がおき、ついに秦は紀元前206年に滅びた。\n" + +"漢の偉大な発明、紙\n" + +"漢の偉大な発明、紙\n" + +"\n" + +"秦が滅びたあと、劉邦と項羽が覇権をめぐって争った(楚漢戦争)が、紀元前202年には、劉邦が項羽を破り、漢の皇帝となった。劉邦は、始皇帝が急速な中央集権化を推し進めて失敗したことから、一部の地域には親戚や臣下を王として治めさせ、ほかの地域を中央が直接管理できるようにした。これを郡国制という。しかし、紀元前154年には、各地の王が中央に対して呉楚七国の乱と呼ばれる反乱を起こした。この反乱は鎮圧され、結果として、中央集権化が進んだ。紀元前141年に即位した武帝は、国内の安定もあり、対外発展を推し進めた。武帝は匈奴を撃退し、シルクロードを通じた西方との貿易を直接行えるようにした。また、朝鮮半島北部、ベトナム北中部にも侵攻した。これらの地域はその後も強く中国文化の影響を受けることとなった。また、武帝は董仲舒の意見を聞いて、儒教を統治の基本とした。これ以降、中国の王朝は基本的に儒教を統治の基本としていく。一方で文帝の頃より貨幣経済が広汎に浸透しており、度重なる軍事行動と相まって、農民の生活を苦しめた。漢の宮廷では貨幣の浸透が農民に不利益であることがしばしば論じられており、農民の救済策が検討され、富商を中心に増税をおこなうなど大土地所有を抑制しようと努力した。また儒教の国教化に関連して儒教の教義論争がしばしば宮廷の重大問題とされるようになった。\n" + +"\n" + +"8年には、王莽が皇帝の位を奪って、一旦漢を滅ぼした。王莽は当初儒教主義的な徳治政治をおこなったが、相次ぐ貨幣の改鋳や頻繁な地名、官名の変更など理想主義的で恣意的な政策をおこなったため徐々に民心を失い、辺境異民族が頻繁に侵入し、赤眉の乱など漢の復興を求める反乱が起き、内乱状態に陥った。結局、漢の皇族の血を引く劉秀によって漢王朝が復興された。この劉秀が建てた漢を後漢という。王朝初期には雲南に進出し、また班超によって西域経営がおこなわれ、シルクロードをおさえた。初期の後漢王朝は豪族連合的な政権であったが、章帝の時代までは中央集権化につとめ安定した政治が行われた。しかし安帝時代以後外戚や宦官の権力の増大と官僚の党派対立に悩まされるようになった。\n" + +"\n" + +"[編集] 魏晋南北朝時代\n" + +"三国決戦の地、赤壁\n" + +"三国決戦の地、赤壁\n" + +"\n" + +"後漢末期の184年には、黄巾の乱と呼ばれる農民反乱がおきた。これ以降、隋が589年に中国を再統一するまで、一時期を除いて中国は分裂を続けた。この隋の再統一までの分裂の時代を魏晋南北朝時代という。また、この時期には日本や朝鮮など中国周辺の諸民族が独自の国家を形成し始めた時期でもある。\n" + +"\n" + +"さて、黄巾の乱が鎮圧されたあと、豪族が各地に独自政権を立てた。中でも有力であったのが、漢王朝の皇帝を擁していた曹操である。しかし、中国統一を目指していた曹操は、208年に赤壁の戦いで、江南の豪族孫権に敗れた。結局、曹操の死後、220年に曹操の子の曹丕が後漢の皇帝から皇帝の位を譲られ、魏を建国した。これに対して、221年には、現在の四川省に割拠していた劉備が皇帝となり、蜀を建国した。さらに、江南の孫権も229年に皇帝と称して、呉を建国した。この魏・呉・蜀の三国が並立した時代を三国時代という。\n" + +"\n" + +"三国の中で、もっとも有力であったのは魏であった。魏は後漢の半分以上の領土を継承したが、戦乱で荒廃した地域に積極的な屯田をおこない、支配地域の国力の回復につとめた。魏では官吏登用法として、九品官人法[5]がおこなわれた。\n" + +"\n" + +"三国は基本的に魏と呉・蜀同盟との争いを軸としてしばしば交戦したが、蜀がまず263年に魏に滅ぼされ、その魏も有力な臣下であった司馬炎に265年に皇帝の位を譲るという形で滅亡した。司馬炎は皇帝となって国号を晋と命名し、さらに280年に呉を滅ぼし、中国を統一した。しかし、300年から帝位をめぐって各地の皇族が戦争を起こした(八王の乱)。このとき、五胡と呼ばれる異民族を軍隊として用いたため、これらの五胡が非常に強い力を持つようになった。316年には、五胡の1つである匈奴が晋をいったん滅ぼした。これ以降、中国の北方は、五胡の建てた国々が支配し、南方は江南に避難した晋王朝(南に移ったあとの晋を東晋という)が支配した。この時期は、戦乱を憎み、宗教に頼る向きがあった。代表的な宗教が仏教と道教であり、この2つの宗教は時には激しく対立することがあった。\n" + +"\n" + +"さて、江南を中心とする中国の南方では、異民族を恐れて、中国の北方から人々が多く移住してきた。これらの人々によって、江南の開発が進んだ。それに伴い、貴族が大土地所有を行うということが一般的になり、貴族が国の政治を左右した。一部の貴族の権力は、しばしば皇帝権力よりも強かった。これらの貴族階層の者により散文、書画等の六朝文化と呼ばれる文化が発展した。東晋滅亡後、宋・斉・梁・陳という4つの王朝が江南地方を支配したが、貴族が強い力を握ることは変わらなかった。梁の武帝は仏教の保護に努めた。\n" + +"\n" + +"北方では、鮮卑族の王朝である北魏が台頭し、439年には、華北を統一した。471年に即位した孝文帝は漢化政策を推し進めた。また、土地を国家が民衆に割り振る均田制を始め、律令制の基礎付けをした。しかし、このような漢化政策に反対するものがいたこともあり、北魏は、西魏と東魏に分裂した。西魏は北周へと、東魏は北斉へと王朝が交代した。577年には北周が北斉を滅ぼしたが、581年に隋が北周にとって代わった。589年に隋は南方の陳を滅ぼし、中国を統一した。\n" + +"\n" + +"魏晋南北朝表も参照。\n" + +"\n" + +"[編集] 隋唐帝国\n" + +"現在でも使用される世界最大の大運河\n" + +"現在でも使用される世界最大の大運河\n" + +"\n" + +"中国を統一した隋の文帝は、均田制・租庸調制・府兵制などを進め、中央集権化を目指した。また同時に九品中正法を廃止し、試験によって実力を測る科挙を採用した。しかし、文帝の後を継いだ煬帝は、江南・華北を結ぶ大運河を建設したり、度重なる遠征を行ったために、民衆の負担が増大した。このため農民反乱が起き、618年に隋は滅亡した。\n" + +"\n" + +"隋に代わって、中国を支配したのが、唐である。唐は基本的に隋の支配システムを受け継いだ。626年に即位した太宗は、租庸調制を整備し、律令制を完成させた。唐の都の長安は、当時世界最大級の都市であり、各国の商人などが集まった。長安は、西方にはシルクロードによってイスラム帝国や東ローマ帝国などと結ばれ、ゾロアスター教・景教・マニ教をはじめとする各地の宗教が流入した。また、文化史上も唐時代の詩は最高のものとされる。\n" + +"当時世界最大の都市だった長安のシンボルタワー・大雁塔\n" + +"当時世界最大の都市だった長安のシンボルタワー・大雁塔\n" + +"\n" + +"太宗の死後着々と力を付けた太宗とその子の高宗の皇后武則天はついに690年皇帝に即位した。前にも後にも中国にはこれのほかに女帝はいない。\n" + +"\n" + +"712年に即位した玄宗は国内の安定を目指したが、すでに律令制は制度疲労を起こしていた。また、周辺諸民族の統治に失敗したため、辺境に強大な軍事力が置かれた。これを節度使という。節度使は、後に軍権以外にも、民政権・財政権をももつようになり、力を強めていく。763年には、節度使の安禄山たちが安史の乱と呼ばれる反乱を起こした。この反乱は郭子儀や僕固懐恩、ウイグル帝国の太子葉護らの活躍で何とか鎮圧されたが、反乱軍の投降者の勢力を無視できず、投降者を節度使に任じたことなどから各地で土地の私有(荘園)が進み、土地の国有を前提とする均田制が行えなくなっていった。結局、政府は土地の私有を認めざるを得なくなった。結果として、律令制度は崩壊した。875年から884年には黄巣の乱と呼ばれる農民反乱がおき、唐王朝の権威は失墜した。このような中、各地の節度使はますます権力を強めた。907年には、節度使の1人である朱全忠が唐を滅ぼした。\n" + +"\n" + +"[編集] 五代十国・宋\n" + +"画像:Compass in a wooden frame.jpg\n" + +"中国航海術の偉大な発明、羅針盤\n" + +"\n" + +"唐の滅亡後、各地で節度使があい争った。この時代を五代十国時代という。この戦乱を静めたのが、960年に皇帝となって宋を建国した趙匡胤である。ただし、完全に中国を宋が統一したのは趙匡胤の死後の976年である。\n" + +"\n" + +"趙匡胤は、節度使が強い権力をもっていたことで戦乱が起きていたことを考え、軍隊は文官が率いるという文治主義をとった。また、これらの文官は、科挙によって登用された。宋からは、科挙の最終試験は皇帝自らが行うものとされ、科挙で登用された官吏と皇帝の結びつきは深まった。また、多くの国家機関を皇帝直属のものとし、中央集権・皇帝権力強化を進めた。科挙を受験した人々は大体が、地主層であった。これらの地主層を士大夫と呼び、のちの清時代まで、この層が皇帝権力を支え、官吏を輩出し続けた。\n" + +"杭州\n" + +"杭州\n" + +"\n" + +"唐は、その強大な力によって、周辺諸民族を影響下においていたが、唐の衰退によってこれらの諸民族は自立し、独自文化を発達させた。また、宋は文治主義を採用していたたため、戦いに不慣れな文官が軍隊を統制したので、軍事力が弱く、周辺諸民族との戦いにも負け続けた。なかでも、契丹族の遼・タングート族の西夏・女真族の金は、中国本土にも侵入し、宋を圧迫した。これらの民族は、魏晋南北朝時代の五胡と違い、中国文化を唯一絶対なものとせず、独自文化を保持し続けた。このような王朝を征服王朝という。後代の元や清も征服王朝であり、以降、中国文化はこれらの周辺諸民族の影響を強く受けるようになった。\n" + +"\n" + +"1127年には、金の圧迫を受け、宋は、江南に移った。これ以前の宋を北宋、以降を南宋という。南宋時代には、江南の経済が急速に発展した。また、すでに唐代の終わりから、陸上の東西交易は衰退していたが、この時期には、ムスリム商人を中心とした海上の東西交易が発達した。当時の宋の特産品であった陶磁器から、この交易路は陶磁の道と呼ばれる。南宋の首都にして海上貿易の中心港だった杭州は経済都市として栄え、元時代に中国を訪れたマルコ・ポーロは杭州を「世界一繁栄し、世界一豊かな都市」と評している。\n" + +"\n" + +"文化的には、経済発展に伴って庶民文化が発達した。また、士大夫の中では新しい学問をもとめる動きが出て、儒教の一派として朱子学が生まれた。\n" + +"\n" + +"[編集] モンゴル帝国\n" + +"\n" + +"13世紀初頭にモンゴル高原で、チンギス・ハーンが、モンゴルの諸部族を統一し、ユーラシア大陸各地へと、征服運動を開始した。モンゴル人たちは、東ヨーロッパ、ロシア、小アジア、メソポタミア、ペルシャ、アフガニスタン、チベットに至る広大な領域を支配し、この帝国はモンゴル帝国と呼ばれる。中国もまた征服活動の例外ではなかった。当時、黄河が南流し、山東半島の南に流れていたため、漢民族は北方民族の攻勢を防げなかった。華北は満州系の女真族による金が、南部を南宋が支配していたが、金は1234年、南宋は1279年にモンゴルに滅ぼされた。\n" + +"\n" + +"モンゴル帝国は各地に王族や漢人有力者を分封した。モンゴル帝国の5代目の君主(ハーン)にクビライが即位すると、これに反発する者たちが、反乱を起こした。結局、モンゴル帝国西部に対する大ハーン直轄支配は消滅し、大ハーンの政権は中国に軸足を置くようになった。もっとも、西方が離反しても、帝国としての緩やかな連合は保たれ、ユーラシアには平和が訪れていた。1271年にクビライは元を国号として中国支配をすすめた。\n" + +"宋代に発明された火薬は元寇の時使用され、日本の武士を驚かせた\n" + +"宋代に発明された火薬は元寇の時使用され、日本の武士を驚かせた\n" + +"\n" + +"モンゴル帝国(元)は未だ征服していなかった南宋への牽制のためにも日本に対して通交を求めたが、日本側は断った。このため二度に渡り日本に侵攻したが、成功しなかった(元寇)。元は三度目の日本侵攻を計画したが、実現には至らなかった。\n" + +"\n" + +"中国南部を支配していた南宋を1279年に元が滅ぼしたのはすでに見たとおりである。\n" + +"\n" + +"元の中国支配は、伝統的な中国王朝とは大きく異なっていた。元は中国の伝統的な統治機構を採用せず、遊牧民の政治の仕組みを中国に移入したからである。元の支配階級の人々は、すでに西方の優れた文化に触れていたため、中国文化を無批判に取り入れることはなかった。それは政治においても同様だったのである。それに伴い、伝統的な統治機構を担ってきた、儒教的な教養を身に付けた士大夫層は冷遇され、政権から遠ざけられた。そのため、彼らは曲や小説などの娯楽性の強い文学作品の執筆に携わった。この時代の曲は元曲と呼ばれ、中国文学史上最高のものとされる。また、モンゴル帝国がユーラシア大陸を広く支配したために、この時期は東西交易が前代に増して盛んになった。\n" + +"\n" + +"元は、宮廷費用などを浪費しており、そのため塩の専売策や紙幣の濫発で収入を増やそうとした。しかし、これは経済を混乱させるだけであった。そして、庶民の生活は困窮した。こうした中、各地で反乱が発生した。中でも最大規模のものは1351年に勃発した紅巾党の乱であった。紅巾党の中から頭角をあらわした朱元璋は、1368年に南京で皇帝に即位して明を建国した。同年、朱元璋は元の都の大都を陥落させ、元の政府はモンゴル高原へと撤退した。撤退後の元のことを北元といい、明と北元はしばしば争った。明側は1388年に北元は滅んだと称しているが、実質的にはその後も両者の争いは続いた。\n" + +"\n" + +"[編集] 明清帝国\n" + +"鄭和の南海大遠征の時の巨艦・「宝船」\n" + +"鄭和の南海大遠征の時の巨艦・「宝船」\n" + +"\n" + +"洪武帝の死後、孫の建文帝が即位したが、洪武帝の四男である朱棣が反乱(靖難の変)を起こし、朱棣が永楽帝として皇帝になった。永楽帝は、モンゴルを攻撃するなど、積極的に対外進出を進めた。また、鄭和を南洋に派遣して、諸国に朝貢を求めた。この時の船が近年の研究によって長さ170m余、幅50m余という巨艦で、その約70年後の大航海時代の船の5倍から10倍近い船であったことが分かっている。\n" + +"\n" + +"また、永楽帝によって現在に至るまで世界最大の宮殿である紫禁城が北京に築かれた。\n" + +"\n" + +"永楽帝の死後、財政事情もあって、明は海禁政策をとり、貿易を著しく制限することとなる。このとき永楽帝を引き継いで、鄭和のようにずっと積極的に海外へ進出していれば、ヨーロッパのアジア・アフリカ支配も実現しなかっただろうと多くの歴史家は推測する。その後、モンゴルが再び勢力を強めはじめ、1449年には皇帝がモンゴルの捕虜になるという事件(土木の変)まで起きた。同じ頃、中国南部沿岸には、倭寇と呼ばれる海上の無法者たちが襲撃を重ねていた。これは、海禁政策で貿易が自由にできなくなっていたためである。倭寇とモンゴルを併称して北虜南倭というが、北虜南倭は明を強く苦しめた。\n" + +"紫禁城の中心、太和殿\n" + +"紫禁城の中心、太和殿\n" + +"\n" + +"また、皇帝による贅沢や多額の軍事費用の負担は民衆に重税となって圧し掛かってきた。これに対し、各地で反乱がおき、その中で頭角をあらわした李自成が1644年に明を滅ぼした。\n" + +"\n" + +"17世紀初頭には、現在の中国東北地方でヌルハチが女真族を統一した。その子のホンタイジは中国東北地方と内モンゴルを征服し、1636年にはモンゴル人から元の玉璽を譲られ、清を建国した。李自成が明を滅ぼすと清の軍隊は万里の長城を越えて、李自成の軍隊を打ち破り、中国全土を支配下に置いた。17世紀後半から18世紀にかけて、康熙帝・雍正帝・乾隆帝という3人の賢い皇帝の下で、清の支配領域は中国本土と中国東北地方・モンゴルのほかに、台湾・東トルキスタン・チベットにまで及んだ。\n" + +"\n" + +"この清の支配領域が大幅に広がった時期は、『四庫全書』の編纂など文化事業も盛んになった。しかし、これは学者をこのような事業に動員して、異民族支配に反抗する暇をなくそうとした面もあった。\n" + +"\n" + +"明代の後期には、メキシコや日本から大量の銀が中国に流入し、貨幣として基本的に銀が使われるようになった。そのため、政府も一条鞭法と呼ばれる税を銀で払わせる税法を始めた。また、清代に入ると、人頭税を廃止し土地課税のみとする地丁銀制が始まった。また明清両代ともに商品経済が盛んになり、農業生産も向上した。\n" + +"\n" + +"[編集] 中国の半植民地化\n" + +"フランス人が描いた中国半植民地化の風刺画。イギリス、ドイツ、ロシア、フランス、日本が中国を分割している。\n" + +"フランス人が描いた中国半植民地化の風刺画。イギリス、ドイツ、ロシア、フランス、日本が中国を分割している。\n" + +"\n" + +"18世紀が終わるまでには、清とヨーロッパとの貿易はイギリスがほぼ独占していた。しかし、当時イギリスの物産で中国に売れるものはほとんどなく、逆に中国の安いお茶はイギリスの労働者階級を中心に大きな需要があったこともあり、イギリスは貿易赤字に苦しんだ。そこで、イギリスは麻薬であるアヘンを中国に輸出し始めた。結果、イギリスは大幅な貿易黒字に転じた。しかし、中国にはアヘン中毒者が蔓延し、この事態を重く見た清朝政府は、1839年に林則徐に命じてアヘン貿易を取り締まらせた。しかし、これに反発したイギリス政府は清に対して翌1840年宣戦布告した。アヘン戦争と呼ばれるこの戦争では、工業化をとげ、近代兵器を持っていたイギリス軍が勝利した。これ以降、イギリスをはじめとするヨーロッパの列強は中国に対し、不平等条約(治外法権の承認、関税自主権の喪失、片務的最恵国待遇の承認、開港、租借といった)を締結させ、中国の半植民地化が進んだ。\n" + +"\n" + +"国内的には、太平天国の乱などの反乱もしばしば起きた。これに対し、同治帝(在位1861年 - 1875年)の治世の下で、ヨーロッパの技術の取り入れ(洋務運動)が行われた。\n" + +"\n" + +"1894年から翌1895年にかけて清と日本との間で行われた日清戦争にも清は敗退した。これは洋務運動の失敗を意味するものであった。この戦争の結果、日本と清との間で結んだ下関条約により、李氏朝鮮の独立が認められ、中国の王朝が長年続けてきた冊封体制が崩壊した。\n" + +"\n" + +"その後、清朝政府は改革を進めようとしたものの、沿岸地域を租借地とされるなどのイギリス・フランス・ロシア・ドイツ・アメリカ合衆国・日本による半植民地化の動きは止まらなかった。結局、1911年の武昌での軍隊蜂起をきっかけに辛亥革命が起こり、各地の省が清からの独立を宣言した。翌1912年1月1日、革命派の首領の孫文によって南京で中華民国の樹立が宣言された。北京にいた清の皇帝溥儀(宣統帝)は、清朝政府内部の実力者である袁世凱により2月12日に退位させられ、清は完全に滅亡した。\n" + +"\n" + +"[編集] 中華民国\n" + +"\n" + +"[編集] 革命後の中国の政局\n" + +"\n" + +"中華民国は成立したものの、清朝を打倒した時点で革命に参加した勢力どうしで利害をめぐって対立するようになり、政局は混乱した。各地の軍閥も民国政府の税金を横領したり勝手に新税を導入して独自の財源を持つようになり、自立化した。\n" + +"\n" + +"[編集] 袁世凱の台頭と帝制運動(1913年~1916年)\n" + +"袁世凱\n" + +"袁世凱\n" + +"\n" + +"臨時大総統であった袁世凱は大総統の権力強化を図って議会主義的な国民党の勢力削減を企てた。国民党の急進派はこれに反発、第二革命を起こしたが鎮圧された。1913年10月袁は正式な大総統となり、さらに11月には国民党を非合法化し、解散を命じた。1914年1月には国会を廃止、5月1日には立法府の権限を弱め大総統の権力を大幅に強化した中華民国約法を公布した。\n" + +"\n" + +"袁は列強から多額の借款を借り受けて積極的な軍備強化・経済政策に着手した。当初列強の袁政権に対する期待は高かった。しかしこのような外国依存の財政は、のちに列強による中国の半植民地化をますます進めることにもなった。第一次世界大戦が始まると、新規借款の望みがなくなったため、袁は財政的に行き詰まった。また日本が中国での権益拡大に積極的に動いた。\n" + +"\n" + +"1915年5月9日に、袁が大隈重信内閣の21ヶ条要求を受けたことは大きな外交的失敗と見られ、同日は国恥記念日とされ袁の外交姿勢は激しく非難された。袁は独裁を強化することでこの危機を乗り越えようとし、立憲君主制的な皇帝制度へ移行し、自身が皇帝となることを望んだ。日本も立憲君主制には当初賛成していたようだが、中国国内で帝制反対運動が激化すると反対に転じ外交圧力をかけた。1916年袁は失意のうちに没した。\n" + +"\n" + +"[編集] 袁世凱死後の政局(1916年~1920年)\n" + +"\n" + +"袁の死後、北京政府の実権を掌握したのは国務総理となった段祺瑞であった。段は当初国会[6]の国民党議員などと提携し、調整的な政策をとっていた。しかし、第一次世界戦に対独参戦しようとしたため徐々に国会と対立した。段は日本の援助の下に強硬な政策を断行した。1917年8月14日第一次世界大戦に対独参戦。軍備を拡張して国内の統一を進めた。また鉄道や通信などの業界を背景とする利権集団が段を支えた。1918年には国会議員改定選挙を強行した。国民党はこれに激しく対立し、南方の地方軍とともに孫文を首班とする広東軍政府をつくった。5月には日本と日中軍事協定[7]を結んだ。寺内正毅内閣失脚後に日本の外交方針が転回すると、段は急速に没落した。段の安徽派と対立関係にあった直隷派の馮国璋は徐世昌を大総統に推薦し、段もこれを受け入れた。親日的な安徽派は徐々に影響力を失っていった。1919年5月4日、山東半島での主権回復と反日を訴えるデモ行進が始まった。これを五・四運動という。なお山東半島は1922年に返還された。1920年7月の安直戦争で直隷派に敗れたことで段は失脚した。\n" + +"\n" + +"[編集] 国民革命(1920年~1928年)\n" + +"革命家・孫文\n" + +"革命家・孫文\n" + +"\n" + +"袁世凱により国民党が非合法化されたのち、孫文は1914年7月に中国革命党を東京で結成した。1919年には拠点を上海に移し、中国国民党と改称した。1921年には上海で中国共産党が成立した。これらの政党は1918年のロシア革命の影響を受けており、議会政党というよりも明確な計画性と組織性を備えた革命政党を目指した。1924年国民党は第一回全国大会をおこない、党の組織を改編するとともに共産党との合同(第一次国共合作)を打ち出した。孫文はこのころ全く機能していなかった国会に代わって国内の団体代表による国民会議を提唱し、これに呼応した馮国璋により北京に迎えられた。1925年には国民会議促成会が開かれたが、この会期中に孫文は没した。7月には広東軍政府で機構再編が進み、中華民国国民政府の成立が宣言された。一方で1924年6月には蒋介石を校長として黄埔軍官学校が設立された。1925年4月に国民革命軍が正式に発足され、国民党は蒋介石を指導者として軍事的な革命路線を推し進めることとなった。1926年に広州から北伐を開始した。1927年1月には武漢に政府を移し、武漢国民政府と呼ばれるようになった。この武漢国民政府では当初国民党左派と共産党が優位にあったが、蒋介石は同年4月12日上海クーデターを起こしてこれらを弾圧し、4月18日には反共を前面に打ち出した南京国民政府を成立させた。南京国民政府は主に上海系の資本家に支えられ、北京・武漢・南京に3つの政権が鼎立することになったが、9月ごろから武漢政府も反共に転じ、南京政府に吸収された。1928年6月南京政府の国民革命軍は北京の中華民国政府を打倒し、12月に張学良もこれを承認したことから、国民政府によって中国は再び統一された。\n" + +"\n" + +"[編集] 国民政府(1928年~1931年)\n" + +"蒋介石\n" + +"蒋介石\n" + +"\n" + +"国民政府においては基本的に国民党の一党独裁の立場が貫かれた。しかし一般党員の数は50万人以下であったとされており、4億をこえると考えられた中国国民のなかではかなり少数であった(国民の多くが「国民」として登録されておらず、しかも文盲のものも多かった)。そのため支配基盤は完全とは言えず、土地税を中心として地方政権の財源を確保する国地画分政策がおこなって、割拠的傾向がいまだに強い地方勢力に配慮したりした。1930年代前半には国民政府に叛旗を翻す形で地方政権が樹立される例が多くなり、軍事衝突なども起きた。1930年に閻錫山と汪兆銘が中心となった北平政府や1931年に孫科らがたてた広州政府などである。\n" + +"\n" + +"しかしこのような軍事的緊張は国民政府の中央軍を掌握していた蒋介石の立場を強めることにもなった。蒋介石は経済政策[8]でも手腕を発揮し影響力を増した。\n" + +"\n" + +"[編集] 抗日戦争(1931年~1937年)\n" + +"満州国皇帝愛新覚羅溥儀\n" + +"満州国皇帝愛新覚羅溥儀\n" + +"\n" + +"張作霖が関東軍に爆殺されたあとをついだ張学良は国民革命を支持しており、自身の支配していた中国東北地方を国民政府へ合流させた。このために反日運動が中国東北地方にも広がったが、日本は中国東北地方の権益を確保しようとしていたためにこれに大きく反発した。1931年9月、満州事変がおこり、関東軍によって日本政府の意向を無視して大規模な武力行動がおこなわれた。しかし列強はこれを傍観する姿勢をとったので、日本政府はこの行動を追認した。\n" + +"\n" + +"東北地方をほぼ制圧した日本軍は、1932年に上海事変を起こし、列強がそれに注目している間に傀儡政権として満州国を東北地方に樹立した。同年10月、リットン調査団が国際連盟によって派遣され、満州国を中国の主権の下に列強の共同管理による自治政府とするべきという妥協案を示したが、日本は採択に反対した。1933年5月日中間で停戦協定(塘沽協定)が結ばれた。1934年には満州国は帝制に移行し、満州帝国となった。\n" + +"\n" + +"1931年に瑞金に政権を樹立していた中国共産党は満州国建国時に日本に宣戦布告していたが、国民党との抗争に忙しく、中国国民で一致して日本の侵略に立ち向かうことはできなかった。1934年には瑞金は国民党により陥落し、打撃を受けた中国共産党は長征と称して西部に移動し、組織の再編をはかった。長征の結果中国共産党は延安に拠点を移した。\n" + +"\n" + +"[編集] 日中戦争(1937年~1945年)\n" + +"\n" + +"1937年には、盧溝橋事件を契機に、日本軍が中国本土に進出し、中華民国と全面戦争に入った(日中戦争)。これに対し、蒋介石は当初日本との戦いよりも中国共産党との戦いを優先していたが、西安事件により、二つの党が協力して日本と戦うことになった(第二次国共合作)。\n" + +"カイロ会談に出席した蒋介石とアメリカのフランクリン・D・ルーズベルト大統領、イギリスのウィンストン・チャーチル首相\n" + +"カイロ会談に出席した蒋介石とアメリカのフランクリン・D・ルーズベルト大統領、イギリスのウィンストン・チャーチル首相\n" + +"\n" + +"しかし日中戦争は当初日本軍優位に進み、日本軍は多くの都市を占領したが、各拠点支配はできても広大な中国において面での支配はできず、これを利用した国民党軍・共産党軍ともに各地でゲリラ戦を行い日本軍を苦しめ、戦線を膠着させた。日本は汪兆銘ら国民党左派を懐柔、南京国民政府を樹立させたが、国内外ともに支持は得られなかった。加えて1941年12月、日本はアメリカやイギリス(連合国)とも戦端を開いたが(太平洋戦争)、一方で中国で多くの戦力を釘付けにされるなど、苦しい状況に落ち込まされた。国民党政府は連合国側に所属し、アメリカやイギリスなどから豊富な援助を受けることとなった。\n" + +"\n" + +"結局、中国大陸戦線では終始日本側が優勢であったものの、1945年8月ポツダム宣言の受諾とともに日本が無条件降伏することで終結した。国民党政府は連合国の1国として大きな地位を占めていたこともあり、戦勝国として有利な立場を有することとなり、日本だけでなくヨーロッパ諸国も租界を返還するなど、中国の半植民地化は一応の終わりを見せた。\n" + +"\n" + +"しかしまもなく国民党と共産党との対立が激化して国共内戦が勃発し、結果として左派が力を持ったアメリカからの支援が減った国民党に対して、ソビエト連邦からの支援を受けていた中国共産党が勝利し、1949年10月1日に毛沢東が中華人民共和国の成立を宣言した。内戦に敗れた中国国民党率いる中華民国政府は台湾島に撤退し、現在に至るまで中国共産党率いる中華人民共和国と「中国を代表する正統な政府」の地位を争っている。\n" + +"\n" + +"[編集] 漢民族以外の民族の動向\n" + +"\n" + +"[編集] モンゴルとチベットでの動き\n" + +"\n" + +"辛亥革命により清国が消滅すると、その旧領をめぐって中国、モンゴル、チベットは、それぞれに自領域を主張した。\n" + +"\n" + +"中国は清領全域を主張した。これに対して、モンゴルとチベットは、自分たちは清朝の皇帝に服属していたのであって中国という国家に帰属するものではなく、服属先の清帝退位後は中国と対等の国家であると主張し独立を目指す動きが強まった。\n" + +"ポタラ宮、当時のチベットの中心地\n" + +"ポタラ宮、当時のチベットの中心地\n" + +"\n" + +"1913年、モンゴルではボグド・ハーンによって、チベットではダライ・ラマ13世よって中国からの独立が宣言され、両者はモンゴル・チベット相互承認条約を締結するなど国際的承認をもとめ、これを認めない中華民国とは戦火を交えた。 この状況は、モンゴル域への勢力浸透をはかるロシア、チベット域への進出をねらうイギリスの介入をゆるし、モンゴル・ロシア・中華民国はキャフタ協定に調印批准、チベット・イギリス・中華民国はシムラ協定(民国政府のみ調印、批准されなかった)が模索されたものの問題の解決には至らなかった。\n" + +"\n" + +"ダライ・ラマを補佐していたパンチェン・ラマは親中国的であったために、イギリスに接近するダライ・ラマに反発し、1925年に中国に亡命した。1933年、ダライ・ラマ13世が死去、中国の統治下にあったチベット東北部のアムド地方(青海省)で生まれたダライ・ラマ14世の即位式典に列席した国民政府の使節団は、式典が終了したのちも、蒙蔵委員会駐蔵弁事處を自称してラサにとどまった。1936年には長征中の中国共産党の労農紅軍が、カム地方東部(四川省西部、当時西康省)に滞留中、同地のチベット人に「チベット人人民共和国」(博巴人民共和国)[9]を組織させたが、紅軍の退出とともに、ほどなく消滅した。\n" + +"\n" + +"この問題は、モンゴルについては、1947年、外蒙古部分のみの独立を中華民国政府が承認することによって、チベットについては、1950年、十七ヶ条協定によってチベットの独立が否定され中華人民共和国の一地方となったことによって、一応の決着をみた。\n" + +"\n" + +"[編集] 東トルキスタン(新疆)での動き\n" + +"\n" + +"東トルキスタン(新疆)では、19世紀中に統治機構の中国化が達成されていた。すなわち、旗人の3将軍による軍政と、地元ムスリムによるベク官人制にかわり、省を頂点に府、州、県に行政区画された各地方に漢人科挙官僚が派遣されて統治する体制である。そのため、辛亥革命時、東トルキスタンでは、地元ムスリムがチベットやモンゴルと歩調をあわせて自身の独立国家を形成しようとする動きはみられず、新疆省の当局者たちは、すみやかに新共和国へ合流する姿勢を示した。この地では、楊増新が自立的な政権を維持し、またソ連と独自に難民や貿易の問題について交渉した。楊増新の暗殺後は金樹仁が実権が握ったが、彼は重税を課して腐敗した政治をおこなったため、1931年には大規模な内乱状態に陥った。その後金樹仁の部下であった盛世才が実権を握るようになり、彼はソ連にならった政策を打ち出して徐々に権力を強化した。一方で1933年には南部で東トルキスタン共和国の独立が宣言されたが、わずか6ヶ月で倒れた。\n" + +"\n" + +"[編集] 中華人民共和国\n" + +"\n" + +"[編集] 社会主義国化と粛清(1949年~1957年)\n" + +"「建国宣言」を行なう毛沢東\n" + +"「建国宣言」を行なう毛沢東\n" + +"\n" + +"1950年中ソ友好同盟相互援助条約が結ばれた。これは日本およびその同盟国との戦争を想定して締結されたものである。この条約でソ連が租借していた大連、旅順が返還され、ソ連の経済援助の下で復興を目指すこととなった。1953年より社会主義化が進み、人民政治協商会議に代わって全国人民代表大会が成立、農業生産合作社が組織された。\n" + +"\n" + +"1956年にソ連でフルシチョフによって「スターリン批判」がおこなわれると、東欧の社会主義国に動揺がはしった。中国共産党政府も共産圏にある国としてこの問題への対処を迫られ、この年初めて開催された党全国代表大会では、「毛沢東思想」という文言が党規約から消えた。そして全く一時的に(わずか2ヶ月)「百花斉放、百家争鳴」と称して民主党などの「ブルジョワ政党」の政治参加が試みられた。しかしブルジョワ政党が中国共産党政府による一党独裁に対して激しい批判を噴出させたため、逆に共産党による反右派闘争を惹起し、一党支配体制は強められた。一方で中ソ協定が結ばれ、軍事上の対ソ依存は強くなった。この時代の中華人民共和国をソ連のアメリカに対する緩衝国家あるいは衛星国家とみなすことも可能である。しかし徐々にデタント政策へと転回し始めていたソ連の対外政策は、中国共産党政府の中華民国に対する強硬政策と明らかに矛盾していた。\n" + +"\n" + +"[編集] 中国共産党の対ソ自立化(1958年~1965年)\n" + +"\n" + +"1958年に、毛沢東は大躍進政策を開始し、人民公社化を推進した。当初はかなりの効果をあげたかに見えた人民公社であったが、党幹部を意識した誇大報告の存在、極端な労働平均化などの問題が開始3ヶ月にしてすでに報告されていた。毛沢東はこのような報告を右派的な日和見主義であり、過渡的な問題に過ぎないと見ていたため、反対意見を封殺したが、あまりに急速な人民公社化は都市人口の異様な増大など深刻な問題を引き起こしていた。\n" + +"\n" + +"一方でこの年、中国共産党政府は台湾海峡で中華民国に対して大規模な軍事行動を起こし、アメリカ軍の介入を招いた。フルシチョフは中国共産党政府の強硬な姿勢を非難し、また自国がアメリカとの全面戦争に引きずり込まれないように努力した。ソ連はワルシャワ条約機構の東アジア版ともいうべき中ソの共同防衛体制を提案したが、中国共産党政府はソ連の対外政策への不信からこれを断った。その後1959年6月ソ連は中ソ協定を一方的に破棄した。1960年には経済技術援助条約も打ち切られ、この年の中国のGNPは1%も下落した。\n" + +"\n" + +"1959年と1960年に大規模な飢饉が中国を襲い、1500万人程度(2000万から5000万人以上とも)と言われる餓死者を出して大躍進政策も失敗に終わった。1960年代初頭には人民公社の縮小がおこなわれ、毛沢東自身が自己批判をおこなうなど、一見調整的な時期に入ったように思われた。劉少奇が第2次5ヶ年計画の失敗を人民公社による分権的傾向にあると指摘し、中央集権を目指した政治改革、個人経営を一部認めるなど官僚主義的な経済調整をおこなった。\n" + +"\n" + +"しかし党組織の中央集権化と個人経営に懐疑的であった毛沢東はこれを修正主義に陥るものであると見ていた。1963年に毛沢東は「社会主義教育運動」を提唱し、下部構造である「農村の基層組織の3分の1」は地主やブルジョワ分子によって簒奪されていると述べた。これは劉少奇ら「実権派」を暗に批判するものであった。またこのころ毛沢東は「文芸整風」運動と称して学術界、芸術界の刷新をはかっていたことも、のちの文化大革命の伏線となった。1964年中国は核実験に成功し、軍事的な自立化に大きな一歩を踏み出した。一方で1965年にアメリカによる北爆が始まりベトナム戦争が本格化すると、軍事的緊張も高まった。\n" + +"\n" + +"チベットでは独立運動が高まったが、政府はこれを運動家に対する拷問など暴力によって弾圧した。このため多数の難民がインドへ流入した。\n" + +"\n" + +"[編集] 文化大革命前期(1966年~1969年)\n" + +"天安門広場は中華人民共和国時代にも多くの歴史の舞台となった\n" + +"天安門広場は中華人民共和国時代にも多くの歴史の舞台となった\n" + +"\n" + +"1966年に毛沢東は文化大革命を提唱した。毛沢東の指示によって中央文化革命小組が設置され、北京の青少年によって革命に賛同する組織である紅衛兵が結成された。毛沢東は「造反有理」(反動派に対する謀反には道理がある)という言葉でこの運動を支持したので、紅衛兵は各地で組織されるようになった。\n" + +"\n" + +"毛沢東は文革の目的をブルジョワ的反動主義者と「実権派」であるとし、劉少奇とその支持者を攻撃対象とした。毛沢東は林彪の掌握する軍を背景として劉少奇を失脚させた。しかし文化大革命は政治だけにとどまることがなく、広く社会や文化一般にも批判の矛先が向けられ、反革命派とされた文化人をつるし上げたり、反動的とされた文物が破壊されたりした。\n" + +"\n" + +"1966年の末ごろから武力的な闘争が本格化し、地方では党組織と紅衛兵との間で武力を伴った激しい権力闘争がおこなわれた。毛沢東は秩序維持の目的から軍を介入させたが、軍は毛沢東の意向を汲んで紅衛兵などの中国共産党左派に加担した。中央では周恩来らと文革小組の間で権力闘争がおこなわれた。1967年の後半になると、毛沢東は内乱状態になった国内を鎮めるために軍を紅衛兵運動の基盤であった学校や工場に駐屯させた。\n" + +"\n" + +"この時期軍の影響力は極端に増大し、それに伴って林彪が急速に台頭した。1969年には中ソ国境の珍宝島で両国の軍事衝突があり(中ソ国境紛争)、軍事的緊張が高まったこともこれを推進した。同年採択された党規約で林彪は毛沢東の後継者であると定められた。\n" + +"\n" + +"[編集] 文化大革命後期(1969~1976年)\n" + +"\n" + +"文化大革命は後期になると国内の権力闘争や内乱状態を引き起こしたが、最終的に文化大革命は1976年の毛沢東死去で終結した。 文化大革命では各地で文化財破壊や大量の殺戮が行われ、その犠牲者の合計数は数百万人とも数千万人とも言われている。また学生たちが下放され農村で働くなど、生産現場や教育現場は混乱し、特に産業育成や高等教育などで長いブランクをもたらした。\n" + +"\n" + +"一方この時期、ソ連に敵対する中国共産党政府は、同じくソ連と敵対する日本やアメリカなどからの外交的承認を受け、この結果国連の常任理事国の議席も台湾島に遷都した中華民国政府(国民党政権)に変わって手にするなど、国際政治での存在感を高めつつあった。\n" + +"\n" + +"[編集] 改革開放以後の現在(1976年~)\n" + +"返還された香港は中国経済の牽引都市になっている\n" + +"返還された香港は中国経済の牽引都市になっている\n" + +"\n" + +"その後は一旦華国鋒が後を継いだが、1978年12月第11期三中全会で鄧小平が政権を握った。鄧小平は、政治体制は共産党一党独裁を堅持しつつ、資本主義経済導入などの改革開放政策を取り、近代化を進めた(社会主義市場経済、鄧小平理論)。この結果、香港ほか日米欧などの外資の流入が開始され、中国経済は離陸を始めた。\n" + +"\n" + +"[編集] 一党独裁\n" + +"\n" + +"冷戦崩壊後に、複数政党による選挙や言論の自由などの民主主義化を達成した中華民国と違い、いまだに中国共産党政府による一党独裁から脱却できない中華人民共和国には多数の問題が山積している。\n" + +"\n" + +"1989年には北京で、1980年代の改革開放政策を進めながら失脚していた胡耀邦の死を悼み、民主化を求める学生や市民の百万人規模のデモ(天安門事件)が起きたが、これは政府により武力鎮圧された。その一連の民主化運動の犠牲者数は中国共産党政府の報告と諸外国の調査との意見の違いがあるが、数百人から数万人に上るといわれている。しかし中国共産党政府はこの事件に関しては国内での正確な報道を許さず、事件後の国外からの非難についても虐殺の正当化に終始している。\n" + +"\n" + +"この事件以降も、中国共産党政府は情報や政策の透明化、民主化や法整備の充実などの国際市場が要求する近代化と、暴動や国家分裂につながる事態を避けるため、内外の報道機関やインターネットに統制を加え、反政府活動家に対する弾圧を加えるなどの前近代的な動きとの間で揺れている。この様な中、2003年には国内でSARSの大発生があったが、このときも政府は虚偽の発表を行なうなど問題の隠蔽を繰り返した。\n" + +"\n" + +"天安門事件で外資流入に急ブレーキがかかったが、1990年代には、江沢民政権のもとで、鄧小平路線に従い、経済の改革開放が進み、特に安い人件費を生かした工場誘致で「世界の工場」と呼ばれるほど経済は急成長した。なお、1997年にイギリスから香港が、1999年にポルトガルからマカオが、それぞれ中華人民共和国に返還され、植民地時代に整備された経済的、法的インフラを引き継ぎ、中華人民共和国の経済の大きな推進役となっている。また、敵対している中華民国との間にも経済的な交流が進み、両国の首都の間に直行便が就航するまでになっている。\n" + +"\n" + +"人口、面積ともに世界的な規模をもつことから、アメリカの証券会社であるゴールドマンサックスは、「中華人民共和国は2050年に世界最大の経済大国になる」と予想するなど、現在、中国経済の動向は良くも悪くも注目されているが、低賃金による大量生産を売り物にしてきた経済成長は賃金上昇・東南アジアやインドの追い上げなどで限界に達しており、産業の高度化や高付加価値化などの難題に迫られている。また、各種経済統計も中国共産党政府発表のそれは信憑性が乏しいと諸外国から指摘されている。各省など地方も独自の産業振興策に走り、中国共産党中央政府に対して経済統計の水増し発表や災害などの情報隠蔽を行うなど、統計や発表の信憑性不足に拍車をかけている。\n" + +"\n" + +"これらのことより、中国共産党の一党独裁による言論統制や貧富格差、地域格差など国内のひずみを放置し続ければ、いずれ内部崩壊を起こして再度混乱状態に陥り、ソ連同様に中華人民共和国という国家体制そのものが解体、消滅するという意見も多い。\n" + +"\n" + +"[編集] 少数民族問題\n" + +"\n" + +"なお、少数民族が住む新疆ウイグル自治区(東トルキスタン)では現在漢化政策の進展によって、漢民族が同地域へ大量に流入する、都市を中心として就職などに有利な中国語教育の充実によりウイグル語が廃れるなどの民族的なマイノリティ問題が発生している。またタクラマカン砂漠の石油資源利用や新疆南北の経済格差が広がっているなど、中国共産党政府の経済政策に対する批判も根強い。\n" + +"\n" + +"1997年には新疆ウイグル自治区で大規模な暴動が起きた。海外で東トルキスタン独立運動がおこなわれている一方国内でもウイグル人活動家の処刑などが行われているが、民族自治における権限拡大という現実主義的な主張もあらわれている。たとえば中国語教育を受けたウイグル人が中国共産党組織に参加する、新疆での中国共産党政府の経済政策に積極的に参加するといった事例も見られる。\n" + +"\n" + +"チベット自治区では歴史的なチベットの主権を主張するダライ・ラマの亡命政権が海外に存在し、中国共産党政府が不法な領土占拠をしていると訴えるとともに独立運動が継続されている。中国共産党政府はこれを武力で弾圧し続け、独立運動家への拷問などを行なったために、多数の難民が隣国のインドに流入した。\n" + +"\n" + +"[編集] 人口の変遷\n" + +"\n" + +"以下のデータは主に楊学通「計画生育是我国人口史発展的必然」(1980年)による。\n" + +"時代 年代 戸数 人口 資料出所\n" + +"(夏) 禹(前2205年とされる) 13,553,923 『帝王世紀』\n" + +"秦 20,000,000? \n" + +"前漢 平帝元始2年(2年) 12,233,062 59,594,978 『漢書』地理志\n" + +"新 20,000,000? \n" + +"後漢 順帝建康元年(144年) 9,946,919 49,730,550 『冊府元亀』\n" + +"晋 武帝泰康元年(280年) 2,459,804 16,163,863 『晋書』食貨志\n" + +"隋 煬帝大業2年(606年) 8,907,536 46,019,056 『隋書』地理志・食貨志\n" + +"唐 玄宗天宝14年(755年) 8,914,709 52,919,309 『通志』\n" + +"宋 神宗元豊3年(1080年) 14,852,684 33,303,889 『宋史』地理志\n" + +"金 章宗明昌6年(1195年) 7,223,400 48,490,400 『金史』食貨志\n" + +"元 世祖至元27年(1290年) 13,196,206 58,834,711 『元史』地理志\n" + +"明 神宗万暦6年(1570年) 10,621,436 60,692,850 『続文献通考』\n" + +"清 清初(1644年) 45,000,000 \n" + +"聖祖康熙50年(1711年) 100,000,000以上 \n" + +"高宗乾隆27年(1762年) 200,000,000以上 \n" + +"高宗乾隆55年(1790年) 300,000,000以上 \n" + +"仁宗嘉慶17年(1812年) 333,700,560 『東華録』\n" + +"宣宗道光14年(1834年) 400,000,000以上 \n" + +"中華民国 民国36年(1947年) 455,590,000 『統計提要』\n" + +"中華人民共和国 1995年 1,211,210,000 『中国統計年鑑』\n" + +"\n" + +"[編集] 地方行政制度\n" + +"\n" + +"[編集] 封建制度(前1600年頃~前221年)\n" + +"\n" + +"殷・周の時代は封建制度[10]によって一定の直轄地以外は間接的に統治された。\n" + +"\n" + +"[編集] 郡県制度(前221年~249年)\n" + +"\n" + +"中国最初の統一王朝である秦は全国を郡とその下級単位である県に分ける郡県制度によって征服地を統治した。前漢初期においては、郡以上に広域な自治を認められた行政単位である国が一部の功臣や皇族のために設置された。しかし徐々に国の行政権限が回収されるとともに、推恩政策によって国の細分化が進められ、国は郡県と等しいものとなり、後漢時代には実質郡県制度そのままとなっていた。\n" + +"\n" + +"前漢時代に広域な監察制度としての刺史制度が始められると全国を13州[11]に分けた。これはいまだ行政的なものではない[12]と考えられている。後漢の後の魏王朝では官僚登用制度としての九品官人法が249年に司馬懿によって州単位でおこなわれるように適用されたので、行政単位として郡以上に広域な州が現実的な行政単位として確立したと考えられている。が、軍政面と官吏登用面のほかにどれほど地方行政に貢献したか[13]はあまり明確ではない。\n" + +"\n" + +"[編集] 軍府による広域行政(249年~583年)\n" + +"\n" + +"魏晋時代から都督府などの軍府の重要性が高まった。五胡十六国および南北朝時代になると、中国内部で複数の王朝が割拠し軍事的な緊張が高まったことから、とくに南朝において重要性が増した。これは本来特定の行政機関を持たなかったと思われる刺史に対して、軍事的に重要な地域の刺史に例外的に複数の州を統括できる行政権を与えたものであった。長官である府主(府の長官は一般的にさまざまな将軍号を帯び、呼称は一定ではないため便宜的に府主とする)は属僚の選定に対して大幅な裁量権が与えられており、そのため地方で自治的な支配を及ぼすことが出来た。また南朝では西晋末期から官吏登用において州は形骸化しており、吏部尚書によって官制における中央集権化が進行している。したがって中正官も単なる地方官吏に過ぎなくなり、広域行政単位としての州は官吏登用の面からは重要性が低下したが、地方行政単位としてはより実際性を帯びた。この時代州は一般に細分化傾向にあり、南北朝前期には中国全土で5,60州、南北朝末期に至ると中国全土で300州以上になり、ひとつの州がわずか2郡、ひとつの郡はわずか2,3県しか含まないという有様であった。\n" + +"\n" + +"[編集] 州県制(583年~1276年)\n" + +"\n" + +"南朝では都督制度が発達していたころ、北魏では州鎮制度が発達した。北魏では征服地にまず軍事的性格の強い鎮を置き、鎮は一般の平民と区別され軍籍に登録された鎮民を隷属させて支配した。鎮は徐々に州に改められたようであるが、北部辺境などでは鎮がずっと維持された。583年に隋の文帝が郡を廃止し、州県二級の行政制度を開始した。この際従来の軍府制度[14]にあった漢代地方制度的な旧州刺史系統の地方官は廃止され、軍府系統の地方官に統一されたと考えられている。595年には形骸化していた中正官も最終的に廃止されたという指摘もされている。またこれにより府主の属官任命権が著しく制限され、中央集権化がはかられた。唐では辺境を中心に広域な州鎮的軍府である総管府が置かれたが徐々に廃止され、刺史制度に基づいた地方軍的軍府、それに中央軍に対する吏部の人事権が強化・一元化され、軍事制度の中央集権化が完成された。特定の州に折衝府が置かれ、自営農民を中心として府兵が組織され常備地方軍[15]とされた。唐では州の上に10の道も設置されたが、これは監察区域で行政単位ではないと考えられている。\n" + +"\n" + +"[編集] 祭祀制度\n" + +"\n" + +"中国でおこなわれた国家祭祀については皇帝祭祀を参照。\n" + +"\n" + +"[編集] 外交\n" + +"\n" + +"中国大陸の諸王朝は前近代まで基本的に東アジアでの優越的な地位を主張し、外交的には大国として近隣諸国を従属的に扱う冊封体制が主流であった。\n" + +"\n" + +"[編集] 漢帝国\n" + +"\n" + +"漢代には南越、閩越、衛氏朝鮮などが漢の宗主権下にあったと考えられ、これらの国々は漢の冊封体制下にあったと考えられている。前漢武帝の時にこれらの諸国は征服され郡県に編入された。このことは漢の冊封が必ずしも永続的な冊封秩序を形成することを意図したものではなく、機会さえあれば実効支配を及ぼそうとしていたことを示す。また匈奴は基本的には冊封体制に組み込まれず、匈奴の単于と中国王朝の皇帝は原則的には対等であった。大秦(ローマ帝国のことを指すとされる)や大月氏などとの外交関係は冊封を前提とされていない。\n" + +"\n" + +"[編集] 魏晋南北朝時代\n" + +"\n" + +"魏晋南北朝時代には、中国王朝が分立する事態になったので、冊封体制は変質し実効支配を意図しない名目的な傾向が強くなったと考えられている。朝鮮半島では高句麗をはじめとして中小国家が分立する状態があらわれ、日本列島の古代国家[16] も半島の紛争に介入するようになったために、半島の紛争での外交的優位を得るため、これらの国々は積極的に中国王朝の冊封を求めた。しかし高句麗が北朝の実効支配には頑強に抵抗しているように、あくまで名目的関係にとどめようという努力がなされており、南越と閩越の紛争においておこなわれたような中国王朝の主導による紛争解決などは期待されていないという見方が主流である。\n" + +"\n" + +"[編集] 隋唐帝国\n" + +"\n" + +"再び中国大陸を統一した隋・唐の王朝の時代は東アジアの冊封体制がもっとも典型的となったという見方が主流である。隋は高句麗がみだりに突厥と通交し、辺境を侵したことからこれを討伐しようとしたが、遠征に失敗した。唐は、新羅と連合し、高句麗・百済を滅亡させ、朝鮮半島を州県支配しようとしたが、新羅に敗北し、願いは、叶わなかった。したがって隋・唐の冊封は実効支配とは無関係に形成されるようになった。唐の冊封体制の下では、律令的な政治体制・仏教的な文化が共有された。\n" + +"\n" + +"一方、突厥や西域諸国が服属すると、それらの地域に対する支配は直接支配としての州県、外交支配としての冊封とは異なった羈縻政策[17]がおこなわれた。\n" + +"\n" + +"[編集] 関連項目\n" + +"\n" + +" * 中華人民共和国\n" + +" * 中華民国\n" + +" * 中国帝王一覧\n" + +" * 中国の首都\n" + +" * 中国史時代区分表\n" + +" o 夏商周年表\n" + +" o 魏晋南北朝表\n" + +" * 元号一覧\n" + +" * 二十四史(清によって公認された正史)\n" + +" * 中国史関係記事一覧\n" + +" * マカオの歴史\n" + +" * 香港の歴史\n" + +" * 台湾の歴史\n" + +" * 中国の通貨制度史\n" + +" * 中国の仏教\n" + +" * 中国法制史\n" + +" * 中国化\n" + +"\n" + +"Wikibooks\n" + +"ウィキブックスに中国史関連の教科書や解説書があります。\n" + +"[編集] 脚注\n" + +"\n" + +" 1. ^ 浙江省紹興市郊外にある陵墓が禹のものであるとされ、戦国時代同地を支配していた越王勾践が禹の子孫を標榜していること、夏の桀王が『史記』鄭玄注などで淮河と長江の中間にある南巣で死んだとしていることなどによる。\n" + +" 2. ^ 河南省にある偃師二里頭遺跡が夏のものではないかとされているが、文書などが発見されていないため確定はされていない。また偃師二里頭遺跡での発掘結果から殷との連続性が確認されたが、細かい分析においては殷との非連続性も確認されているため、偃師二里頭遺跡が夏王朝のものであっても、夏が黄河流域起源の王朝であったかどうかは論争中である。\n" + +" 3. ^ 代表的な遺跡殷墟が有名であるため日本では一般に殷と呼ばれるが、商の地が殷王朝の故郷とされており、商が自称であるという説もあるため、中国では商と呼ぶほうが一般的である。\n" + +" 4. ^ ただし殷を北西から侵入してきた遊牧民族による征服王朝だとする説もある。これは偃師二里頭遺跡では青銅器が現地生産されているのに対し、殷時代の青銅器は主に蜀方面で生産されていたことが確認されていることによる。\n" + +" 5. ^ 当初は漢魏革命の際に漢の官僚を魏宮廷に回収する目的で制定されたものであったが、優れたものであったために一般的な官吏登用に使用されるようになった。これは中正官を通して地方の世論を反映した人事政策をおこなうもので、地方で名望のあったものをその程度に応じて品位に分け官僚として登用するものであった。官僚は自身の品位と官職の官品に従って一定の官職を歴任した。地方の世論に基づくとはいえ、一般的に家柄が重視される傾向にあり、「上品に寒門なく、下品に勢族なし」といわれた。南北朝時代になると官職内で名誉的な清流官職と濁流官職が貴族意識によって明確に分けられ、また家柄によって官職が固定される傾向が顕著となった。このような傾向は専制支配を貫徹しようとする皇帝の意向と対立するものであったため、官品の整理をおこなって清濁の区別をなくす努力が続けられた。しかし皇帝も貴族社会の解体そのものを望んでおらず、貴族社会の上位に皇帝権力を位置づけることでヒエラルキーを維持しようとしていたから、官職制度の根幹的な改変には至らず、官職の家柄による独占傾向を抑えることは出来なかった。\n" + +" 6. ^ 1916年8月に復活された。\n" + +" 7. ^ これはロシア革命に対するシベリア出兵において日中両軍が協力するという秘密条約である。\n" + +" 8. ^ 1928年~30年に各国と交渉して関税自主権を回復し、関税を引き上げ、塩税と統一消費税をさだめて財源を確保した。アメリカとイギリスの銀行資本に「法幣」という紙幣を使用させ、秤量貨幣であった銀両を廃止した。さらにアメリカ政府に銀を売ってドルを外為資金として貯蓄した。これにより国際的な銀価格の中国の国内経済に対する影響が大幅に緩和された。このような経済政策を積極的に推進したのは国民政府財政部長の宋子文で、彼は孫文の妻宋慶齢の弟で、妹はのちに蒋介石と結婚した宋美齢であった。\n" + +" 9. ^ 博巴あるいは波巴とはチベット人の自称。日本語に訳せばチベット人の人民政府という意味である。博巴と波巴はともに「ぽぱ」と読む。\n" + +" 10. ^ 封建制度は殷代からおこなわれているが、殷代封建制についてはあまり明確なことはわからない。殷では封建がおこなわれている地域と方国と呼ばれる、外様あるいは異民族の国家の存在が知られ、殷を方国の連盟の盟主であり、封建された国々は殷の同族国家であるとする説もあるが詳しいことはわからない。周では一定の城市を基準とした邑に基づいた封建制が広汎におこなわれたと考えられているが、この邑制国家の実態も不明である。邑をポリス的な都市国家とみる見方から、邑と周辺農地である鄙が一緒になって(これを邑土という)、貴族による大土地所有であるとする見方もある。明らかであるのは邑を支配した貴族が長子相続を根幹とした血族共同体をもっていたということで、このような共同体に基づいた支配形態を宗法制度という。宗法制度については殷代にさかのぼる見方もあるが、広汎におこなわれたのは春秋あるいは戦国時代であったとする説もある。周の封建制を宗法制度の延長にあるものと捉え、封建儀礼を宗族への加盟儀礼の延長として捉える見方もある。\n" + +" 11. ^ 中国古来より中国世界を9つの地方に分ける考え方が漠然と存在した。中国王朝の支配領域を「九州」といい、それがすなわち「天下」であった。ただし九州の概念は後漢時代にいたるまでははっきりしたものではなく一様でない。\n" + +" 12. ^ 前漢成帝のときに州の監察権が御史中丞へ移行され、刺史が行政官となったという見方もあるが、後漢末期に刺史に軍事権が認められると、広域行政単位としての州はにわかに現実化したとみる見方もある。\n" + +" 13. ^ このころの州を行政単位ではなく、軍管区のような概念上の管理単位であるとする見方も強い。\n" + +" 14. ^ 北周の宇文護が創始した二十四軍制をもっていわゆる府兵制の成立と見做す見方があるがこれについては詳しいことはわからない。\n" + +" 15. ^ 折衝府の置かれた州と非設置州では当然差異があったのであるが、唐代はほかに募兵に基づく行軍制度もおこなわれており、大規模な対外戦争の際にはおもに折衝府非設置州を中心として兵が集められた。唐後期にはこの募兵制が常態化することで節度使制度がおこなわれるようになった。\n" + +" 16. ^ なお、史書からうかがえる外交記録と日本国内での銅鏡など出土品に記載された年号の問題などから、日本の古代王朝は特に南朝との外交関係を重視していたという見方が主流であるが、北朝との通交事実を明らかにしようという研究は続けられている。\n" + +" 17. ^ これは都護府を通じて服属民族を部族別に自治権を与えて間接支配するもので、羈縻政策がおこなわれた地域では現地民の国家は否定された。このことは羈縻州の住民が自発的に中国王朝の文化を受け入れることを阻害したと考えられており、羈縻政策のおこなわれた地域では冊封のおこなわれた地域とは異なり、漢字や律令などの文化の共有はおこなわれず、唐の支配が後退すると、唐の文化もこの地域では衰退することになった。冊封された国々で唐の支配が後退したあとも漢字文化が存続したことと対照的である。\n"; + + +var korean = +"한국의 역사\n" + +"위키백과 ― 우리 모두의 백과사전.\n" + +" 이 문서는 남, 북으로 분단된 1945년 이전의 한국에 대한 역사를 주로 기술하고 있다.\n" + +"\n" + +"한국의 역사 (연표)\n" + +"한국의 선사 시대 (유적)\n" + +"환인 · 환웅 (신시)\n" + +" 고조선 - 단군\n" + +"진국\n" + +"원\n" + +"삼\n" + +"국\n" + +"|\n" + +"삼\n" + +"국\n" + +"|\n" + +"남\n" + +"북\n" + +"국\n" + +"|\n" + +"후\n" + +"삼\n" + +"국 삼한 옥\n" + +"저 동\n" + +"예 부\n" + +"여\n" + +"진\n" + +"한 변\n" + +"한 마\n" + +"한\n" + +" 가\n" + +"야 \n" + +" \n" + +"백\n" + +"제\n" + +" \n" + +" 고\n" + +"구\n" + +"려 \n" + +"신\n" + +"라 \n" + +" \n" + +"후\n" + +"백\n" + +"제 태\n" + +"봉 발\n" + +"해\n" + +" \n" + +"고려\n" + +" \n" + +" \n" + +"조선\n" + +" \n" + +"대한제국\n" + +"대한민국임시정부\n" + +"일제 강점기 (조선총독부)\n" + +"군정기\n" + +"대한민국 조선민주주의\n" + +"인민공화국\n" + +"한국의 인물\n" + +"한국의 역사는 구석기 시대 이후의 주로 한반도와 만주, 넓게는 동아시아 지역을 배경으로 발전되어 온 한국인의 역사이다.\n" + +"목차 [숨기기]\n" + +"1 선사 시대\n" + +"1.1 유적에 의한 구분\n" + +"1.2 문헌에 의한 구분\n" + +"2 상고 시대 (B.C. 2333년 ~ A.D. 1세기)\n" + +"2.1 고조선 시대\n" + +"2.2 고조선 멸망 이후 여러나라의 성장\n" + +"3 고대 시대 (A.D. 1세기~A.D. 900)\n" + +"3.1 삼국시대\n" + +"3.1.1 삼국시대 경제\n" + +"3.1.2 삼국시대 정치\n" + +"3.2 남북국시대\n" + +"4 중세시대 (A.D. 918년 ~ A.D. 1392년)\n" + +"4.1 고려의 정치\n" + +"4.2 고려의 경제\n" + +"4.3 고려의 사회\n" + +"4.4 고려의 문화\n" + +"5 근세시대 (A.D. 1392년 ~ A.D. 1506년)\n" + +"5.1 초기 조선의 정치\n" + +"5.2 초기 조선의 경제\n" + +"5.3 초기 조선의 사회\n" + +"5.4 초기 조선의 문화\n" + +"6 근대 태동기 (A.D. 1506년 ~ A.D. 1907년)\n" + +"6.1 후기 조선의 정치\n" + +"6.2 후기 조선의 경제\n" + +"6.3 후기 조선의 사회\n" + +"6.4 후기 조선의 문화\n" + +"7 근현대시대 (A.D. 1907년 ~ )\n" + +"7.1 개괄\n" + +"7.2 근대시대\n" + +"7.3 현대시대\n" + +"8 주석\n" + +"9 같이 보기\n" + +"10 참고문헌 및 링크\n" + +"10.1 역사 일반\n" + +"10.2 재단, 기타, 정부 기관\n" + +"[편집]\n" + +"선사 시대\n" + +"\n" + +"[편집]\n" + +"유적에 의한 구분\n" + +"한국의 구석기 시대(20만 년 이전 ~ 약 1만 년 전)\n" + +"한국의 신석기 시대(약 1만 년 전 ~ 약 4천 년 전)\n" + +"참고>> 웅기 부포리와 평양 만달리 유적, 통영 상노대도의 조개더미 최하층, 거창 임불리, 홍천 화화계리 유적 등을 중석기 유적지로 보는 사학자도 있다.\n" + +"[편집]\n" + +"문헌에 의한 구분\n" + +"환국시대 [1](비공식)\n" + +"신시[2] 또는 배달국 시대 [3](비공식)\n" + +"[편집]\n" + +"상고 시대 (B.C. 2333년 ~ A.D. 1세기)\n" + +"\n" + +"농경의 발달로 잉여 생산물이 생기고 청동기가 사용되면서 사유 재산 제도와 계급이 발생하였고, 그 결과, 부와 권력을 가진 족장(군장)이 출현하였다고 추측된다. 이 시기의 대표적인 유적으로 고인돌, 비파형 동검, 미송리식 토기 등이 있다. 부족장은 세력을 키워 주변 지역을 아우르고, 마침내 국가를 이룩하였다. 이 시기에 성립된 한국 최초의 국가가 고조선이다. 기원전 4세기경 철기가 보급되었고, 이후, 고조선은 철기 문화를 수용하면서 중국과 대립할 정도로 크게 발전하였으며, 만주와 한반도 각지에는 부여, 고구려, 옥저, 동예, 삼한 등 여러 나라가 성립될 수 있는 터전이 마련되었다.\n" + +"[편집]\n" + +"고조선 시대\n" + +"단군조선\n" + +"위만조선\n" + +"조선 시대 이전에는 은나라에서 건너온 기자가 세운 기자조선이 정식 역사로서 인정되었으나, 일제강점기를 전후로 점차 부인되어 현재에는 대한민국과 조선민주주의인민공화국의 역사학계 모두 이를 공식적으로 인정하지 않고 있으며, 사학자들도 대체적으로 이 설을 부정한다.\n" + +"[편집]\n" + +"고조선 멸망 이후 여러나라의 성장\n" + +"철기문명을 받아들인 각 나라들은 철기를 이용하여 농업을 발전시키면서도 독특한 사회 풍습을 유지하였다. 많은 소국들이 경쟁하는 가운데 일부는 다른 나라를 병합되었고, 다시 연맹 왕국으로 발전하여 중앙 집권 국가를 형성할 수 있는 기반을 마련하게 되었다.\n" + +"부여: 북부여, 동부여, 졸본부여\n" + +"옥저\n" + +"동예\n" + +"삼한:\n" + +"마한\n" + +"변한\n" + +"진한\n" + +"[편집]\n" + +"고대 시대 (A.D. 1세기~A.D. 900)\n" + +"\n" + +"[편집]\n" + +"삼국시대\n" + +"고구려\n" + +"백제\n" + +"신라\n" + +"삼국시대 초반은 고구려와 백제가 주도했으나 진흥왕 이후 국력이 막강해진 신라가 삼국시대 후기를 주도 했다.\n" + +"[편집]\n" + +"삼국시대 경제\n" + +"삼국의 경제는 기본적으로 물물교환 경제를 못 벗어난 체제였다고 한다.[출처 필요]\n" + +"삼국사기에는 신라가 수도에 시전을 세웠다는 기록이 있다.\n" + +"[편집]\n" + +"삼국시대 정치\n" + +"삼국의 정치는 기본적으로 중앙집권체제를 토대로 한 전제왕권 또는 귀족정치였다.\n" + +"[편집]\n" + +"남북국시대\n" + +"신라\n" + +"발해\n" + +"[편집]\n" + +"중세시대 (A.D. 918년 ~ A.D. 1392년)\n" + +"\n" + +"한국사에서는 고려시대를 중세시대로 보고 있다.\n" + +"[편집]\n" + +"고려의 정치\n" + +"고려는 새로운 통일 왕조로서 커다란 역사적 의의를 지닌다. 고려의 성립은 고대 사회에서 중세 사회로 이행하는 우리 역사의 내재적 발전을 의미한다. 신라말의 득난(6두품 세력) 출신 지식인과 호족 출신을 중심으로 성립한 고려는 골품 위주의 신라 사회보다 개방적이었고, 통치 체제도 과거제를 실시하는 등 효율성과 합리성이 강화되는 방향으로 정비되었다. 특히, 사상적으로 유교 정치 이념을 수용하여 고대적 성격을 벗어날 수 있었다.\n" + +"고려 시대는 외적의 침입이 유달리 많았던 시기였다. 그러나 고려는 줄기찬 항쟁으로 이를 극복할 수 있었다. 12세기 후반에 무신들이 일으킨 무신정변은 종전의 문신 귀족 중심의 사회를 변화 시키는 계기가 되어 신분이 낮은 사람도 정치적으로 진출할 수 있었다.\n" + +"이후, 무신 집권기와 원나라 간섭기를 지나 고려 후기에 이르러서는 새롭게 성장한 신진 사대부를 중심으로 성리학이 수용되어 합리적이고 민본적인 정치 이념이 성립되었고, 이에 따른 사회 개혁이 진전되었다.\n" + +"[편집]\n" + +"고려의 경제\n" + +"고려는 후삼국 시기의 혼란을 극복하고 전시과 제도를 만드는 등 토지 제도를 정비하여 통치 체제의 토대를 확립하였다. 또, 수취 체제를 정비하면서 토지와 인구를 파악하기 위하여 양전 사업을 실시하고 호적을 작성하였다. 아울러 국가가 주도하여 산업을 재편하면서 경작지를 확대시키고, 상업과 수공업의 체제를 확립하여 안정된 경제 기반을 확보하였다.\n" + +"농업에서는 기술의 발달로 농업 생산력이 증대되었고, 상업은 시전을 중심으로 도시 상업이 발달하면서 점차 지방에서도 상업 활동이 증가하였다. 수공업도 관청 수공업 중심에서 점차 사원이나 농민을 중심으로한 민간 수공업을 중심으로 발전해 갔다.\n" + +"[편집]\n" + +"고려의 사회\n" + +"고려의 사회 신분은 귀족, 중류층, 양민, 천민으로 구성되었다. 고려 지배층의 핵심은 귀족이었다. 신분은 세습되는 것이 원칙이었고, 각 신분에는 그에 따른 역이 부과되었다. 그러나 그렇지 않은 경우도 있었는데, 향리로부터 문반직에 오르는 경우와 군인이 군공을 쌓아 무반으로 출세하는 경우를 들 수 있다.\n" + +"백성의 대부분을 이루는 양민은 군현에 거주하는 농민으로, 조세, 공납, 역을 부담하였다. 향, 부곡, 소 같은 특수 행정 구역에 거주하는 백성은 조세 부담에 있어서 군현민보다 차별받았으나, 고려 후기 이후 특수 행정 구역은 일반 군현으로 바뀌어 갔다. 흉년이나 재해 등으로 어려움을 겪는 백성들의 생활을 안정시키기 위하여 국가는 의창과 상평창을 설치하고, 여러 가지 사회 복지 시책을 실시 하였다.\n" + +"[편집]\n" + +"고려의 문화\n" + +"고려 시대에 해당하는 중세 문화는 고대 문화의 기반 위에서 조상들의 노력과 슬기가 보태져 새로운 양상을 보였다.\n" + +"유교가 정치 이념으로 채택, 적용됨으로써 유교에 대한 인식이 확대 되었으며, 후기에는 성리학도 전래 되었다. 불교는 그 저변이 확대되어 생활 전반에 영향을 끼쳤다. 이런 가운데 불교 사상이 심화되고, 교종과 선종의 통합운동이 꾸준히 추진되었다.\n" + +"중세의 예술은 귀족 중심의 우아하고 세련된 특징을 드러내고 있다. 건축과 조각에서는 고대의 성격을 벗어나 중세적 양식을 창출하였으며, 청자와 인쇄술은 세계적인 수준을 자랑하고 있다. 그림과 문학에서도 중세의 품격 높은 멋을 찾아 볼 수 있다.\n" + +"[편집]\n" + +"근세시대 (A.D. 1392년 ~ A.D. 1506년)\n" + +"\n" + +"한국사에서는 초기 조선 시대를 근세시대로 보고 있다.\n" + +"[편집]\n" + +"초기 조선의 정치\n" + +"조선은 왕과 양반 관료들에 의하여 통치되었다. 왕은 최고 명령권자로서 통치 체제의 중심이었다. 조선 초기에는 고려 말에 성리학을 정치 이념으로 하면서 지방에서 성장한 신진 사대부들이 지배층이 되어 정국을 이끌어 나갔다. 그러나 15세기 말부터 새롭게 성장한 사림이 16세기 후반 이후 정국을 주도해 나가면서 학파를 중심으로 사림이 분열하여 붕당을 이루었다. 이후 여러 붕당 사이에 서로 비판하며 견제하는 붕당 정치를 전개하였다.\n" + +"정치 구조는 권력의 집중을 방지하면서 행정의 효율성을 높이는 방향으로 정비되었다. 관리 등용에 혈연이나 지연보다 능력을 중시하였고, 언로를 개방하여 독점적인 권력 행사를 견제하였다. 아울러 육조를 중심으로 행정을 분담하여 효율성을 높이면서 정책의 협의나 집행 과정에서 유기적인 연결이 가능하도록 하였다. 조선은 고려에 비하여 한 단계 발전된 모습을 보여 주면서 중세 사회에서 벗어나 근세 사회로 나아갔다.\n" + +"[편집]\n" + +"초기 조선의 경제\n" + +"조선은 고려 말기의 파탄된 국가 재정과 민생 문제를 해결하고 재정 확충과 민생 안정을 위한 방안으로 농본주의 경제 정책을 내세웠다. 특히 애민사상을 주장하는 왕도 정치 사상에서 민생 안정은 가장 먼저 해결해야 할 과제였다.\n" + +"조선 건국을 주도하였던 신진 사대부들은 중농 정책을 표방하면서 농경지를 확대하고 농업 생산력을 증가시키며, 농민의 조세 부담을 줄여 농민들의 생활을 안정시키려 하였다. 그리하여 건국 초부터 토지 개간을 장려하고 양전 사업을 실시한 결과 고려 말 50여만 결이었던 경지 면적이 15세기 중엽에는 160여만 결로 증가하였다. 또한 농업 생산력을 향상시키기 위하여 새로운 농업 기술과 농기구를 개발하여 민간에 널리 보급하였다.\n" + +"반면 상공업자가 허가 없이 마음대로 영업 활동을 벌이는 것을 규제하였는데, 이는 당시 검약한 생활을 강조하는 유교적인 경제관을 가진 사대부들이 물화의 수량과 종류를 정부가 통제하지 않고 자유 활동에 맡겨 두면 사치와 낭비가 조장되며 농업이 피폐하여 빈부의 격차가 커지게 된다고 생각하였기 때문이다. 더욱이 당시 사회에서는 직업적인 차별이 있어 상공업자들이 제대로 대우받지 못하였다.\n" + +"[편집]\n" + +"초기 조선의 사회\n" + +"조선은 사회 신분을 양인과 천민으로 구분하는 양천 제도를 법제화하였다. 양인은 과거에 응시하고 벼슬길에 오를 수 있는 자유민으로서 조세, 국역 등의 의무를 지녔다. 천민은 비(非)자유민으로서 개인이나 국가에 소속되어 천역을 담당하였다.\n" + +"양천 제도는 갑오개혁 이전까지 조선 사회를 지탱해 온 기본적인 신분 제도였다. 그러나 실제로는 양천 제도의 원칙에만 입각하여 운영되지는 않았다. 세월이 흐를수록 관직을 가진 사람을 의미하던 양반은 하나의 신분으로 굳어져 갔고, 양반 관료들을 보좌하던 중인도 신분층으로 정착되어 갔다. 그리하여 지배층인 양반과 피지배층인 상민 간의 차별을 두는 반상 제도가 일반화되고 양반, 중인, 상민, 천민의 신분 제도가 점차 정착되었다.\n" + +"조선 시대는 엄격한 신분제 사회였으나 신분 이동이 가능하였다. 법적으로 양인 이상이면 누구나 과거에 응시하여 관직에 오를 수 있었고, 양반도 죄를 지으면 노비가 되거나 경제적으로 몰락하여 중인이나 상민이 되기도 하였다.\n" + +"[편집]\n" + +"초기 조선의 문화\n" + +"조선 초기에는 괄목할 만한 민족적이면서 실용적인 성격의 학문이 발달하여 다른 시기보다 민족 문화의 발전이 크게 이루어졌다. 당시의 집권층은 민생 안정과 부국강병을 위하여 과학 기술과 실용적 학문을 중시하여, 한글이 창제되고 역사책을 비롯한 각 분야의 서적들이 출반되는 등 민족 문화 발전의 기반이 형성되었다.\n" + +"성리학이 정착, 발달하여 전 사회에 큰 영향을 끼쳤고, 여러 갈래의 학파가 나타났다. 15세기 문화를 주도한 관학파 계열의 관료들과 학자들은 성리학을 지도 이념으로 내세웠으나 성리학 이외의 학문과 사상이라도 좋은 점이 있으면 받아들이는 융통성을 보였다. 불교는 정부에 의하여 정비되면서 위축되었으나 민간에서는 여전히 신앙의 대상으로 자리 잡고 있었다.\n" + +"천문학, 의학 등 과학 기술에 있어서도 큰 발전을 이룩하여 생활에 응용되었고, 농업 기술은 크게 향상되어 농업 생산력을 증대시켰다.\n" + +"예술 분야에서도 민족적 특색이 돋보이는 발전을 나타내었고, 사대부들의 검소하고 소박한 생활이 반영된 그림과 필체 및 자기 공예가 두드러졌다.\n" + +"[편집]\n" + +"근대 태동기 (A.D. 1506년 ~ A.D. 1907년)\n" + +"\n" + +"한국사에서는 후기 조선 시대를 근대 태동기로 보고 있다.\n" + +"[편집]\n" + +"후기 조선의 정치\n" + +"숙종 때에 이르러 붕당 정치가 변질되고 그 폐단이 심화되면서 특정 붕당이 정권을 독점하는 일당 전제화의 추세가 대두되었다. 붕당 정치가 변질되자 정치 집단 간의 세력 균형이 무너지고 왕권 자체도 불안하게 되었다. 이에 영조와 정조는 특정 붕당의 권력 장악을 견제하기 위하여 탕평 정치를 추진하였다. 탕평 정치는 특정 권력 집단을 억제하고 왕권을 강화하려는 방향으로 진행되어 어느 정도 성과를 거두었지만, 붕당 정치의 폐단을 일소하지는 못하였다.\n" + +"탕평 정치로 강화된 왕권을 순조 이후의 왕들이 제대로 행사하지 못하면서 왕실의 외척을 중심으로 한 소수 가문에 권력이 집중되고 정치 기강이 문란해지는 세도 정치가 전개되었다. 이로써 부정부패가 만연해지고 정부의 백성들에 대한 수탈이 심해졌다.\n" + +"[편집]\n" + +"후기 조선의 경제\n" + +"임진왜란과 병자호란을 거치면서 농촌 사회는 심각하게 파괴되었다. 수많은 농민들이 전란 중에 죽거나 피난을 가고 경작지는 황폐화되었다. 이에 정부는 수취 체제를 개편하여 농촌 사회를 안정시키고 재정 기반을 확대하려 하였다. 그것은 전세 제도, 공납 제도, 군역 제도의 개편으로 나타났다.\n" + +"서민들은 생산력을 높이기 위하여 농기구와 시비법을 개량하는 등 새로운 영농 방법을 추구하였고, 상품 작물을 재배하여 소득을 늘리려 하였다. 상인들도 상업 활동에 적극적으로 참여하여 대자본을 가진 상인들도 출현하였다. 수공업 생산도 활발해져 민간에서 생산 활동을 주도하여 갔다. 이러한 과정에서 자본 축적이 이루어지고, 지방의 상공업 활동이 활기를 띠었으며, 상업 도시가 출현하기에 이르렀다.\n" + +"[편집]\n" + +"후기 조선의 사회\n" + +"조선 후기 사회는 사회 경제적 변화로 인하여 신분 변동이 활발해져 양반 중심의 신분 체제가 크게 흔들렸다. 붕당 정치가 날이 갈수록 변질되어 가면서 양반 상호 간에 일어난 정치적 갈등은 양반층의 분화을 불러왔다. 이러한 현상은 일당 전제화가 전개되면서 더욱 두드러지고 권력을 장악한 소수의 양반을 제외한 다수의 양반들이 몰락하는 계기가 되었다. 이렇게 양반 계층의 도태 현상이 날로 심화되어 가면서도 양반의 수는 늘어나고 상민과 노비의 숫자는 줄어드는 경향을 보였다. 이는 부를 축적한 농민들이나 해방된 노비들이 자신들의 지위를 높이기 위하여 또는 역의 부담을 모면하기 위하여 양반 신분을 사는 경우가 많았기 때문이다.\n" + +"이러한 급격한 사회 변화에 대한 집권층의 자세는 극히 보수적이고 임기응변적이었다. 이에 계층 간의 갈등은 더욱 심화되어 갔으며, 19세기에 들어와 평등 사상과 내세 신앙을 주장한 로마 가톨릭이 유포되면서 백성들의 의식이 점차 높아져서[출처 필요] 크고 작은 봉기가 전국적으로 일어나게 되었다. 정부는 로마 가톨릭이 점차 교세가 확장되자 양반 중심의 신분 질서 부정과 왕권에 대한 도전으로 받아들여[출처 필요] 사교로 규정하고 탄압을 가하기에 이르렀다.\n" + +"[편집]\n" + +"후기 조선의 문화\n" + +"임진왜란과 병자호란 이후 사회 각 분야의 변화와 함께 문화에서는 새로운 기운이 나타났다. 양반층 뿐만 아니라 중인층과 서민층도 문화의 한 주역으로 등장하면서 문화의 질적 변화와 함께 문화의 폭이 확대되었다.\n" + +"학문에서는 성리학의 교조화와 형식화를 비판하며 실천성을 강조한 양명학을 받아들였으며 민생 안정과 부국강병을 목표로 하여 비판적이면서 실증적인 논리로 사회 개혁론을 제시한 실학이 대두되어 개혁 추진을 주장하기도 하였다.\n" + +"천문학의 의학 등 각 분야의 기술적 성과들이 농업과 상업 등 산업 발전을 촉진하였다. 서양 문물의 유입도 이러한 발전을 가속화하는 데 이바지하였다.\n" + +"예술 분야에서는 판소리, 탈품, 서민 음악 등 서민 문화가 크게 유행하였고, 백자 등 공예도 생활 공예가 중심이 되었다. 자연 경치와 삶을 소재로 하는 문예 풍토가 진작되어 문학과 서화에 큰 영향을 끼쳤다.\n" + +"[편집]\n" + +"근현대시대 (A.D. 1907년 ~ )\n" + +"\n" + +"[편집]\n" + +"개괄\n" + +"조선 사회는 안에서 성장하고 있던 근대적인 요소를 충분히 발전시키지 못한 채 19C 후반 제국주의 열강에 문호를 개방하였다. 이후 정부와 각계(各界), 각당(各堂), 각단체(各單體), 각층(各層), 각파(各派)에서는 근대화하려는 노력을 하였으나, 성공하지 못하였다.\n" + +"개항 이후 조선은 서구 문물을 수용하고 새로운 경제 정책을 펼치면서 자주적인 근대화를 모색하였다. 그러나 일본과 청을 비롯한 외세의 경제 침략이 본격화 되면서, 이러한 노력은 큰 성과를 거두지 못했다.\n" + +"개항 이후, 사회 개혁이 진행되면서 신분 제도가 폐지되고 평등 의식도 점차 성장하였다. 또, 외국과의 교류를 통해 외래 문물과 제도 등이 수용됨에 따라 전통적인 생활 모습에도 많은 변화가 생겨났다.\n" + +"개항 이후 서양 과학 기술에 대한 관심이 높아지자, 전기, 철도, 같은 근대 기술과 서양 의술 등 각종 근대 문물이 들어왔다. 근대 시설은 일상생활을 편리하게 해 주었으나, 열강의 침략 목적에 이용되기도 하였다.\n" + +"일제는 강압적인 식민 통치를 통하여 우리 민족을 지배하였다. 이에 맞서 우리 민족은 국내외에서 무장 독립 투쟁, 민족 실력 양성 운동, 독립 외교 활동 등을 벌여 일제에 줄기차게 저항하였다. 이러한 우리 민족의 투쟁과 연합군의 승리로 1945년 8월에 광복을 맞이하였다.\n" + +"일제 강점기에는 일제의 경제적 침략으로 경제 발전이 왜곡되어, 우리 민족은 고통을 겪게 되었다. 광복 이후 일제의 식민 지배를 벗어나면서부터는 새로운 경제 발전의 계기를 마련할 수 있었다. 그러나 분단과 전쟁으로 인한 경제적 어려움도 대단히 컸다.\n" + +"일제 강점기에는 국권을 되찾으려는 독립 운동이 줄기차게 일어났고, 다른 한편에서는 근대화를 위한 각계(各界), 각당(各堂), 각단체(各單體), 각층(各層), 각파(各派)에서는 근대화하려는 노력이 펼쳐졌다. 이러한 가운데 근대 자본주의 문명이 본격적으로 유입되어 전통 사회는 점차 근대 사회로 변모해 갔는데, 식민지 현실 아래에서 근대화는 왜곡될 수밖에 없었다.\n" + +"일제는 국권을 탈취한 후에 동화와 차별의 이중 정책을 바탕으로 황국 신민화를 강력하게 추진하였다. 특히, 우리 민족의 독립 의지를 꺾으려고 우리의 역사와 문화를 왜곡하였다. 이에 맞서 우리의 전통과 문화를 지키려는 움직임이 일어났다.\n" + +"그런데, 미∙소의 한반도 분할 정책과 좌∙우익 세력의 갈등으로 남북이 분단되어 통일 국가를 세우지 못하였다. 특히, 6∙25 전쟁을 겪으면서 분단은 더욱 고착화되고 남북 사이의 상호 불신이 깊어 갔다.\n" + +"대한민국 정부 수립 이후, 민주주의가 정착되는 과정에서 많은 시련을 겪었다. 그러나 4∙19혁명과 5∙18민주화 운동, 6월 민주 항쟁 등으로 민주주의가 점차 발전하였다. 이와 함께, 냉전 체제가 해체되면서 민족 통일을 위한 노력도 계속 되고 있다.\n" + +"1960년대 이후 한국 경제는 비약적인 성장을 일구어 냈다. 한국은 이제 가난한 농업 국가가 아닌, 세계적인 경제 대국으로 변모하고 있다.\n" + +"광복 후에 한국은 많은 어려움 속에서도 경제 발전을 이룩하였는데, 이는 커다란 사회 변화를 가져왔다. 농업 사회에서 산업 사회로, 다시 정보화 사회로 발전하면서 사람들의 생활양식과 가치관도 많이 변하였다.1980년대에 진행된 민주화 운동으로 권위주의적 정치 문화가 점차 극복되고, 사회의 민주화도 꾸준히 이루어 졌다.\n" + +"광복 이후에는 학문 활동이 활발해지고 교육의 기회가 크게 확대되었다. 그러나 미국을 비롯한 서구 문화가 급속하게 유입되면서 가치관의 혼란과 전통문화의 위축 현상을 가져오기도 하였다.\n" + +"민주화와 더불어 문화의 다양화가 촉진되고, 반도체 등 몇몇 과학 기술 분야는 세계적인 수준까지 도달하였다. 한편, 현대 사회의 윤리와 생명 과학 기술의 발달 사이에서 빚어지는 갈등을 해소하려는 노력도 펼쳐지고 있다.\n" + +"[편집]\n" + +"근대시대\n" + +"대한 제국\n" + +"일제강점기 : 일본의 제국주의 세력이 한반도를 강제적으로 식민지로 삼은 시기로서, 무단 통치 시기, 문화 통치 시기, 전시 체계 시기로 나뉜다.\n" + +"무단 통치 시기 : 조선을 영구히 통치하기 위해 조선 총독부를 설치하고, 군대를 파견하여 의병 활동을 억누르고 국내의 저항 세력을 무단으로 통치한 시기이다. 언론, 집회, 출판, 결사의 자유같은 기본권을 박탈하고, 독립운동을 무자비하게 탄압하였다. 또, 헌병 경찰과 헌병 보조원을 전국에 배치하고 즉결 처분권을 부여하여 한국인을 태형에 처하기도 했다. 토지조사령을 공포하여 식민지 수탈을 시작하였고, 회사령을 공포하여 국내의 자본 세력을 억압하고 일본 자본 세력의 편의를 봐주었다. 이 시기의 한국인 노동자는 극악한 환경과 저임금, 민족적 차별까지 받으며 혹사 하였다.\n" + +"문화 통치 시기 : 3·1 운동이 발발하자 일제는 무단통치로는 조선을 효과적으로 지배할 수 없다는 판단하에, 친일파를 육성하는 문화정책을 펼친다. 이 문화정치는 가혹한 식민 통치를 은폐하려는 술책에 불과 했다. 헌병 경찰제를 보통 경찰제로 전환하였지만, 경찰력은 오히려 증강되었다. 이 들은 교육의 기회를 늘리고 자본 운용의 기회와 참정권의 기회등을 제공하겠다고 선전 하였으나 소수의 친일 분자를 육성하고, 민족 운동가들을 회유하여 민족을 기만하고 분열을 획책하였다.\n" + +"전시 체계 시기 : 1930년대 일제는 대륙침략을 본격적으로 시작하면서 한반도를 대륙 침략의 병참기지로 삼았다. 또한, 1941년 일제가 미국의 진주만을 불법적으로 기습하자 태평양 전쟁이 발발하였다. 조선에서는 일제의 강제 징용으로 한국인 노동력이 착취 되었고, 학도 지원병 제도, 징병 제도 등을 실시하여 수많은 젊은이를 전쟁에 동원하였다. 또, 젊은 여성을 정신대라는 이름으로 강제 동원하여 군수 공장 등에서 혹사시켰으며, 그 중 일부는 전선으로 끌고 가 일본군 위안부로 삼는 만행을 저질렀다.\n" + +"[편집]\n" + +"현대시대\n" + +"군정기 : 미국과 소련의 군대가 진주하여 한반도에 정부가 세워지기 이전까지의 시기\n" + +"대한민국\n" + +"제1공화국\n" + +"한국전쟁\n" + +"제2공화국\n" + +"제3공화국\n" + +"제4공화국 - 유신헌법시기. 종신 대통령제 채택\n" + +"제5공화국\n" + +"1. 정치 : 전두환 정부(군사 쿠데타에 의한 정부 - 12.12 사태) 시기. 대통령 간접선거제도 채택. 이 시기에는 민주화에 대한 무자비한 탄압이 자행되었으나, 광범위한 대중들의 1987년 6월 혁명으로 6월29선언(대통령 직접선거제도 공약)을 이끌어 내기도 하였다.\n" + +"2. 경제 : 1960~70년대에 닦아온 중공업, 경공업 기반을 첨단공업 수준으로 이끌어 올린 시기이다. 이 시기의 한국 경제는 세계에서 유래 없을 정도로 빠르게 성장했으며, 국내 물가가 가장 안정된 시기였다.\n" + +"3. 문화 : 1986년 서울 아시안 게임을 개최하였고, 1988년 서울 올림픽 게임을 유치하는 데 성공했다.\n" + +"제6공화국\n" + +"노태우 정권\n" + +"문민정부\n" + +"국민의 정부\n" + +"참여정부\n" + +"조선민주주의인민공화국\n" + +"조선민주주의인민공화국의 역사\n" + +"[편집]\n" + +"주석\n" + +"\n" + +"↑ 삼국유사 - 동경제국대학 1904년 판본, 환단고기 - 1979년 복원본\n" + +"↑ 동사 - 허목 숙종조, 규원사화 - 북애자 숙종원년\n" + +"↑ 환단고기 - 1979년 복원본\n" + +"[편집]\n" + +"같이 보기\n" + +"\n" + +"중국의 역사\n" + +"일본의 역사\n" + +"민족사관\n" + +"식민사관\n" + +"[편집]\n" + +"참고문헌 및 링크\n" + +"\n" + +"[편집]\n" + +"역사 일반\n" + +"국사 편찬 위원회 : 한국사에 관한 정보를 수집, 정리, 편찬하는 국가 연구 기관, 소장 자료, 논문, 저서 검색, 한국사 관련 연구 기관. 소장 자료, 논문, 저서 검색, 한국사 관련 안내\n" + +"국사 전자 교과서 : 현직 교사들이 연구.감수하고, 국사편찬위원회가 지원하였다. 2007년 개정된 국사교과서의 내용이 아직 반영되지 않았다.\n" + +"한국 역사 정보 시스템 : 한국사 연표, 한국사 기초 사전 및 신문 자료, 문헌 자료, 문집 등을 제공\n" + +"한국학 중앙 연구원 : 한국 문화 및 한국학 여러 분햐에 관한 연구와 교육을 수행하는 연구 기관. 디지털 한국학 개발, 정보 광장, 전자 도서관, 전통 문화 등 수록\n" + +"역사 문제 연구소 : 순수 민간 연구 단체(역사적 중립성이 의심됨), 근현대사 자료실, 간행물 자료, 한국사 학습 자료 등 수록\n" + +"[편집]\n" + +"재단, 기타, 정부 기관\n" + +"고구려 연구재단 : 고구려사를 비롯한 중국의 역사 왜곡에 학술적으로 대응하기 위하여 2004年 설립된 법인. 고구려, 발해를 비롯한 동아시아 역사 관련 자료의 조사, 수집, 정리, 정보화 자료 제공. 동북아역사재단으로 편입되어 더이상 유용하지 않다.\n" + +"국가 기록 영상관 : 대한 뉴스, 문화 기록 영화, 대통령 기록 영상 등 멀티미디어 역사 자료 제공\n" + +"국가 문화 유산 종합 정보 서비스 : 국보, 보물, 사적, 명승, 천연 기념물 지정 종목별, 시대별, 지역별, 유형별, 유물 정보, 검색 서비스 제공\n" + +"국가 지식 정보 통합 검색 시스템 : 정보 통신부 제공, 과학 기술, 정보 통신, 교육, 학술, 문화, 역사 등의 포괄적이고 연동적인 학술 데이터 검색\n" + +"국가기록유산 : 국가적 기록유산의 원본과 원문 열람 서비스 제공\n"; + + +var persian = +"تاریخ ایران پیش از اسلام\n" + +"از ویکیپدیا، دانشنامهٔ آزاد.\n" + +"تمدنهای باستانی آسیای غربی\n" + +"بینالنهرین، سومر، اکد، آشور، بابل\n" + +"هیتیها، لیدیه\n" + +"ایلام، اورارتو، ماننا، ماد، هخامنشی\n" + +"امپراتوریها / شهرها\n" + +"سومر: اوروک – اور – اریدو\n" + +"کیش – لاگاش – نیپور – اکد\n" + +"بابل – ایسین – کلدانی\n" + +"آشور: آسور، نینوا، نوزی، نمرود\n" + +"ایلامیان – اموریها – شوش\n" + +"هوریها – میتانی\n" + +"کاسیها – اورارتو\n" + +"گاهشماری\n" + +"شاهان سومر\n" + +"شاهان ایلام\n" + +"شاهان آشور\n" + +"شاهان بابل\n" + +"شاهان ماد\n" + +"شاهان هخامنشی\n" + +"زبان\n" + +"خط میخی\n" + +"سومری – اکدی\n" + +"ایلامی – هوری\n" + +"اساطیر بینالنهرین\n" + +"انوما الیش\n" + +"گیل گمش – مردوخ\n" + +"نیبیرو\n" + +"اگر بخواهیم تاریخ ایران پیش از اسلام را بررسی کنیم باید از مردمانی که در دوران نوسنگی در فلات ایران زندگی میکردند نام ببریم. پیش از مهاجرت آریائیان به فلات ایران، اقوامی با تمدنهای متفاوت در ایران میزیستند که آثار زیادی از آنها در نقاط مختلف فلات ایران مانند تمدن جیرفت (در کرمانِ کنونی) و شهر سوخته در سیستان، و تمدن ساکنان تمدن تپه سیلک (در کاشان)، تمدن اورارتو و ماننا (در آذربایجان)، تپه گیان نهاوند و تمدن کاسیها (در لرستان امروز) بجای مانده است. اما تمدن این اقوام کم کم با ورود آریائیان، در فرهنگ و تمدن آنها حل شد.\n" + +"برای بررسی تاریخ ایران پیش از اسلام باید از دیگر تمدنهای باستانی آسیای غربی نیز نام ببریم. شناخت اوضاع و رابطه این مناطق ایران در رابطه با تمدنهای دیگر نظیر سومر - اکد، کلده - بابل - آشور، و غیره نیز مهم است.\n" + +"فهرست مندرجات [مخفی شود]\n" + +"۱ ایلامیان\n" + +"۲ مهاجرت آریائیان به ایران\n" + +"۳ مادها\n" + +"۴ هخامنشیان\n" + +"۵ سلوکیان\n" + +"۶ اشکانیان\n" + +"۷ ساسانیان\n" + +"۸ منابع\n" + +"۹ جستارهای وابسته\n" + +"۱۰ پیوند به بیرون\n" + +"[ویرایش]\n" + +"ایلامیان\n" + +"\n" + +"ایلامیان یا عیلامیها اقوامی بودند که از هزاره سوم پ. م. تا هزاره نخست پ. م. ، بر بخش بزرگی از مناطق جنوب و غرب ایران فرمانروایی داشتند. بر حسب تقسیمات جغرافیای سیاسی امروز، ایلام باستان سرزمینهای خوزستان، فارس، ایلام و بخشهایی از استانهای بوشهر، کرمان، لرستان و کردستان را شامل میشد.\n" + +"آثار كشف شده تمدن ایلامیان، در شوش نمایانگر تمدن شهری قابل توجهی است. تمدن ایلامیان از راه شهر سوخته در سیستان، با تمدن پیرامون رود سند هند و از راه شوش با تمدن سومر مربوط میشده است. ایلامیان نخستین مخترعان خط در ایران هستند.\n" + +"به قدرت رسیدن حكومت ایلامیان و قدرت یافتن سلسله عیلامی پادشاهی اوان در شمال دشت خوزستان مهم ترین رویداد سیاسی ایران در هزاره سوم پ. م. است. پادشاهی اَوان یکی از دودمانهای ایلامی باستان در جنوب غربی ایران بود. پادشاهی آوان پس از شکوه و قدرت کوتیک ـ این شوشینک همچون امپراتوری اکد، ناگهان فرو پاشید؛ این فروپاشی و هرج و مرج در منطقه در پی تاخت و تاز گوتیان زاگرس نشین رخ داد. تا پیش از ورود مادها و پارسها حدود یك هزار سال تاریخ سرزمین ایران منحصر به تاریخ عیلام است.\n" + +"سرزمین اصلی عیلام در شمال دشت خوزستان بوده. فرهنگ و تمدن عیلامی از شرق رودخانه دجله تا شهر سوخته زابل و از ارتفاعات زاگرس مركزی تا بوشهر اثر گذار بوده است. عیلامیان نه سامی نژادند و نه آریایی آنان ساكنان اوليه دشت خوزستان هستند.\n" + +"[ویرایش]\n" + +"مهاجرت آریائیان به ایران\n" + +"\n" + +"آریائیان، مردمانی از نژاد هند و اروپایی بودند که در شمال فلات ایران میزیستند. دلیل اصلی مهاجرت آنها مشخص نیست اما به نظر میرسد دشوار شدن شرایط آب و هوایی و کمبود چراگاه ها، از دلایل آن باشد. مهاجرت آریائیان به فلات ایران یک مهاجرت تدریجی بوده است که در پایان دوران نوسنگی (7000 سال پیش از میلاد) آغاز شد و تا 4000 پیش از میلاد ادامه داشته است.\n" + +"نخستین آریاییهایی که به ایران آمدند شامل کاسیها (کانتوها ـ کاشیها)، لولوبیان و گوتیان بودند. کاسیها تمدنی را پایه گذاری کردند که امروزه ما آن را بنام تمدن تپه سیلک میشناسیم. لولوبیان و گوتیان نیز در زاگرس مرکزی اقامت گزیدند که بعدها با آمدن مادها بخشی از آنها شدند. در حدود 5000 سال پیش از میلاد، مهاجرت بزرگ آریائیان به ایران آغاز شد و سه گروه بزرگ آریایی به ایران آمدند و هر یک در قسمتی از ایران سکنی گزیدند: مادها در شمال غربی ایران، پارسها در قسمت جنوبی و پارتها در حدود خراسان امروزی.\n" + +"شاخههای قومِ ایرانی در نیمههای هزارهی اول قبل از مسیح عبارت بودهاند از: باختریان در باختریه (تاجیکستان و شمالشرق افغانستانِ کنونی)، سکاهای هومکار در سگائیه (شرقِ ازبکستانِ کنونی)، سُغدیان در سغدیه (جنوب ازبکستان کنونی)، خوارزمیان در خوارزمیه (شمال ازبکستان و شمالشرق ترکمنستانِ کنونی)، مرغزیان در مرغوه یا مرو (جنوبغرب ازبکستان و شرق ترکمستان کنونی)، داهه در مرکز ترکمستان کنونی، هَرَیویان در هَرَیوَه یا هرات (غرب افغانستان کنونی)، دِرَنگِیان در درنگیانه یا سیستان (غرب افغانستان کنونی و شرق ایران کنونی)، مکائیان در مکائیه یا مَککُران (بلوچستانِ ایران و پاکستان کنونی)، هیرکانیان در هیرکانیا یا گرگان (جنوبغربِ ترکمنستان کنونی و شمال ایرانِ کنونی)، پَرتُوَهئیان در پارتیه (شمالشرق ایران کنونی)، تپوریان در تپوریه یا تپورستان (گیلان و مازندران کنونی)، آریازَنتا در اسپدانه در مرکزِ ایرانِ کنونی، سکاهای تیزخود در الانیه یا اران (آذربایجان مستقل کنونی)، آترپاتیگان در آذربایجان ایرانِ کنونی، مادایَه در ماد (غرب ایرانِ کنونی)، کُردوخ در کردستانِ (چهارپارهشدهی) کنونی، پارسَی در پارس و کرمانِ کنونی، انشان در لرستان و شمال خوزستان کنونی. قبایلی که در تاریخ با نامهای مانناها، لولوبیانها، گوتیانها، و کاسیها شناسانده شدهاند و در مناطق غربی ایران ساکن بودهاند تیرههائی از شاخههای قوم ایرانی بودهاند که زمانی برای خودشان اتحادیههای قبایلی و امیرنشین داشتهاند، و سپس در پادشاهی ماد ادغام شدهاند.\n" + +"مادها در ایران نزدیک 150 سال (708- 550 ق.م) هخامنشیها کمی بیش از دویست سال (550-330 ق.م) اسکندر و سلوکیها در حدود صد سال (330 -250 ق.م) اشکانیان قریب پانصد سال (250 ق.م – 226 م) و ساسانیان قریب چهار صد و سی سال (226-651 م) فرمانروایی داشتند.\n" + +"[ویرایش]\n" + +"مادها\n" + +"\n" + +"\n" + +"\n" + +"ماد در 675 پیش از میلاد\n" + +"\n" + +"\n" + +"ماد در 600 پیش از میلاد\n" + +"مادها قومی ایرانی بودند از تبار آریایی که در بخش غربی فلات ایران ساکن شدند. سرزمین مادها دربرگیرنده بخش غربی فلات ایران بود. سرزمین آذربایجان در شمال غربی فلات ایران را با نام ماد کوچک و بقیهٔ ناحیه زاگرس را با نام ماد بزرگ میشناختند. پایتخت ماد هگمتانه است آنها توانستند در اوایل قرن هفتم قبل از میلاد اولین دولت ایرانی را تأسیس کنند\n" + +"پس از حملات شدید و خونین آشوریان به مناطق مادنشین، گروهی از بزرگان ماد گرد رهبری به نام دیاکو جمع شدند.\n" + +"از پادشاهان بزرگ این دودمان هووخشتره بود که با دولت بابل متحد شد و سرانجام امپراتوری آشور را منقرض کرد و پایههای نخستین شاهنشاهی آریاییتباران در ایران را بنیاد نهاد.\n" + +"دولت ماد در ۵۵۰ پیش از میلاد به دست کوروش منقرض شد و سلطنت ایران به پارسیها منتقل گشت. در زمان داریوش بزرگ، امپراتوری هخامنشی به منتهای بزرگی خود رسید: از هند تا دریای آدریاتیک و از دریای عمان تا کوههای قفقاز.\n" + +"[ویرایش]\n" + +"هخامنشیان\n" + +"\n" + +"\n" + +"\n" + +"شاهنشاهی بزرگ هخامنشی در 330 ق.م.\n" + +"هخامنشیان نخست پادشاهان بومی پارس و سپس انشان بودند ولی با شکستی که کوروش بزرگ بزرگ بر ایشتوویگو واپسین پادشاه ماد وارد ساخت و سپس فتح لیدیه و بابل پادشاهی هخامنشیان تبدیل به شاهنشاهی بزرگی شد. از این رو کوروش بزرگ را بنیادگذار شاهنشاهی هخامنشی میدانند.\n" + +"در ۵۲۹ پ.م کوروش بزرگ پایه گذار دولت هخامنشی در جنگهای شمال شرقی ایران با سکاها، کشته شد. لشکرکشی کمبوجیه جانشین او به مصر آخرین رمق کشاورزان و مردم مغلوب را کشید و زمینه را برای شورشی همگانی فراهم کرد. داریوش بزرگ در کتیبهً بیستون میگوید: \" بعد از رفتن او (کمبوجیه) به مصر مردم از او برگشتند...\"\n" + +"شورشها بزرگ شد و حتی پارس زادگاه شاهان هخامنشی را نیز در برگرفت. داریوش در کتیبه بیستون شمهای از این قیامها را در بند دوم چنین نقل میکند: \" زمانی که من در بابل بودم این ایالات از من برگشتند: پارس، خوزستان، ماد، آشور، مصر، پارت خراسان (مرو، گوش) افغانستان (مکائیه).\" داریوش از 9 مهر ماه 522 تا 19 اسفند 520 ق.م به سرکوبی این جنبشها مشغول بود.\n" + +"جنگهای ایران و یونان در زمان داریوش آغاز شد. دولت هخامنشی سر انجام در 330 ق. م به دست اسکندر مقدونی منقرض گشت و ایران به دست سپاهیان او افتاد.\n" + +"اسکندر سلسله هخامنشیان را نابود کرد، دارا را کشت ولی در حرکت خود به شرق همه جا به مقاومتهای سخت برخورد، از جمله سغد و باکتریا یکی از سرداران جنگی او بنام سپتامان 327- 329 ق. م در راس جنبش همگانی مردم بیش از دو سال علیه مهاجم خارجی مبارزه دلاورانه کرد. در این ناحیه مکرر مردم علیه ساتراپهای اسکندر قیام کردند. گرچه سرانجام نیروهای مجهز و ورزیده اسکندر این جنبشها را سرکوب کردند ولی از این تاریخ اسکندر ناچار روش خشونت آمیز خود را به نرمش و خوشخویی بدل کرد.\n" + +"\n" + +"ایران\n" + +"تاریخ ایران\n" + +"ایران پیش از آریاییها \n" + +"تاریخ ایران پیش از اسلام \n" + +" | دودمانها و حکومتها\n" + +"ایلامیان\n" + +"ماد\n" + +"هخامنشیان\n" + +"سلوکیان\n" + +"اشکانیان\n" + +"ساسانیان\n" + +"تاریخ ایران پس از اسلام \n" + +" | دودمانها و حکومتها\n" + +"خلفای راشدین\n" + +"امویان\n" + +"عباسیان\n" + +"ایران در دوران حکومتهای محلی \n" + +" | دودمانها و حکومتها\n" + +"طاهریان\n" + +"صفاریان\n" + +"سامانیان\n" + +"آل زیار\n" + +"آل بویه\n" + +"غزنویان\n" + +"سلجوقیان\n" + +"خوارزمشاهیان\n" + +"ایران در دوره مغول \n" + +" | دودمانها و حکومتها\n" + +"ایلخانیان\n" + +"ایران در دوران ملوکالطوایفی \n" + +" | دودمانها و حکومتها\n" + +"سربداران\n" + +"تیموریان\n" + +"مرعشیان\n" + +"کیائیان\n" + +"قراقویونلو\n" + +"آققویونلو\n" + +"ایران در دوران حکومتهای ملی \n" + +" | دودمانها و حکومتها\n" + +"صفوی\n" + +"افشاریان\n" + +"زند\n" + +"قاجار\n" + +"پهلوی\n" + +"جمهوری اسلامی\n" + +"موضوعی\n" + +"تاریخ معاصر ایران\n" + +"تاریخ مذاهب ایران\n" + +"مهرپرستی\n" + +"زرتشتی\n" + +"تسنن\n" + +"تصوف\n" + +"تشیع\n" + +"تاریخ اسلام\n" + +"تاریخ زبان و ادبیات ایران\n" + +"جغرافیای ایران\n" + +"استانهای تاریخی ایران\n" + +"اقتصاد ایران\n" + +"گاهشمار تاریخ ایران\n" + +"پروژه ایران\n" + +"[ویرایش]\n" + +"سلوکیان\n" + +"\n" + +"\n" + +"ایران در زمان سلوکیان (330 - 150 ق.م.)\n" + +"پس از مرگ اسکندر (323 ق. م) فتوحاتش بین سردارانش تقسیم شد و بیشتر متصرفات آسیائی او که ایران هسته آن بود به سلوکوس اول رسید. به این ترتیب ایران تحت حکومت سلوکیان (330 - 150 ق.م.) در آمد. پس از مدتی پارتها نفوذ خود را گسترش دادند و سرانجام توانستند سلوکیان را نابود و امپراتوری اشکانی را ایجاد کنند.\n" + +"[ویرایش]\n" + +"اشکانیان\n" + +"\n" + +"\n" + +"\n" + +"امپراتوری اشکانی 250 ق.م. 224 م.\n" + +"اشکانیان (250 ق. م 224 م) که از تیره ایرانی پرنی و شاخهای از طوایف وابسته به اتحادیه داهه از عشایر سکاهای حدود باختر بودند، از ایالت پارت که مشتمل بر خراسان فعلی بود برخاستند. نام سرزمین پارت در کتیبههای داریوش پرثوه آمده است که به زبان پارتی پهلوه میشود. چون پارتیان از اهل ایالت پهله بودند، از این جهت در نسبت به آن سرزمین ایشان را پهلوی نیز میتوان خواند. ایالت پارتیها از مغرب به دامغان و سواحل جنوب شرقی دریای خزر و از شمال به ترکستان و از مشرق به رود تجن و از جنوب به کویر نمک و سیستان محدود میشد. قبایل پارتی در آغاز با قوم داهه که در مشرق دریای خزر میزیستند در یک جا سکونت داشتند و سپس از آنان جدا شده در ناحیه خراسان مسکن گزیدند.\n" + +"این امپراتوری در دوره اقتدارش از رود فرات تا هندوکش و از کوههای قفقاز تا خلیج فارس توسعه یافت. در عهد اشکانی جنگهای ایران و روم آغاز شد. سلسله اشکانی در اثر اختلافات داخلی و جنگهای خارجی به تدریج ضعیف شد تا سر انجام به دست اردشیر اول ساسانی منقرض گردید.\n" + +"[ویرایش]\n" + +"ساسانیان\n" + +"\n" + +"\n" + +"\n" + +"شاهنشاهی ساسانی در سالهای ۲۲۴ تا ۶۵۱ م.\n" + +"ساسانیان خاندان شاهنشاهی ایرانی در سالهای ۲۲۴ تا ۶۵۱ میلادی بودند. شاهنشاهان ساسانی که اصلیتشان از استان پارس بود بر بخش بزرگی از غرب قارهٔ آسیا چیرگی یافتند. پایتخت ساسانیان شهر تیسفون در نزدیکی بغداد در عراق امروزی بود.\n" + +"سلسله اشکانی به دست اردشیر اول ساسانی منقرض گردید. وی سلسله ساسانیان را بنا نهاد که تا 652 میلادی در ایران ادامه یافت. دولت ساسانی حکومتی ملی و متکی به دین و تمدن ایرانی بود و قدرت بسیار زیادی کسب کرد. در این دوره نیز جنگهای ایران و روم ادامه یافت.\n" + +"\n" + +"در همين دوران مانی[1] (216 - 276 میلادی) به تبلیغ مذهب خود پرداخت. مانی پس از مسافرت به هند و آشنائی با مذهب بودائی سیستم جهان مذهبی مانوی خود را که التقاطی از مذهب زردشتی، بودائی و مسیحی و اسطوره بود با دقت تنظیم کرد و در کتاب \"شاهپورگان\" اصول آنها را بیان و هنگام تاجگذاری شاپوراول به شاه هدیه کرد. مانی اصول اخلاقی خود را بر پایه فلسفی مثنویت: روشنائی و تاریکی که ازلی و ابدی هستند استوار نمود. در واقع این اصول) خودداری از قتل نفس حتی در مورد حیوانات، نخوردن می، دوری از زن و جمع نکردن مال (واکنش در مقابل زندگی پر تجمل و پر از لذت طبقات حاکم و عکس العمل منفی در برابر بحران اجتماعی پایان حکومت اشکانی و آغاز حکومت ساسانی است. شاپور و هرمزد، نشر چنین مذهبی را تجویز کردند، زیرا با وجود مخالفت آن با شهوت پرستی و غارتگری و سود جوئی طبقات حاکم، از جانبی مردم را به راه \"معنویت\" و \"آشتیخواهی\" سوق میداد و از جانب دیگر از قدرت مذهب زردشت میکاست.\n" + +"جنبش معنوی مانی به سرعت در جهان آن روز گسترش یافت و تبدیل به نیروئی شد که با وجود جنبه منفی آن با هدفهای شاهان و نجبا و پیشرفت جامعه آن روزی وفق نمیداد. پیشوایان زردتشتی و عیسوی که با هم دائما در نبرد بودند، متحد شدند و در دوران شاهی بهرام اول که شاهی تن آسا و شهوت پرست بود در جریان محاکمه او را محکوم و مقتول نمودند ( 276 میلادی). از آن پس مانی کشی آغاز شد و مغان مردم بسیاری را به نام زندک(زندیق) کشتند. مانویان درد و جانب شرق و غرب، در آسیای میانه تا سرحد چین و در غرب تا روم پراکنده شدند.\n" + +"\n" + +"امپراتوری پهناور ساسانی که از رود سند تا دریای سرخ وسعت داشت، در اثر مشکلات خارجی و داخلی ضعیف شد. آخرین پادشاه این سلسله یزدگرد سوم بود. در دوره او مسلمانان عرب به ایران حمله کردند و ایرانیان را در جنگهای قادسیه، مدائن، جلولاء و نهاوند شکست دادند و بدین ترتیب دولت ساسانی از میان رفت.\n" + +"در پایان سده پنجم و آغاز قرن ششم میلادی جنبش بزرگی جامعه ایران را تکان داد که به صورت قیامی واقعی سی سال ( 24-494 م.) دوام آورد و تأثیر شگرفی در تکامل جامعه آن روزایران بخشید.\n" + +"در چنین اوضاعی مزدک[2] پسر بامدادان به تبلیغ مذهب خود که گویند موسسش زردشت خورک بابوندس بوده، پرداخت. عقاید مزدک بر دو گانگی مانوی استوار است:\n" + +"روشنائی دانا و تاریکی نادان، به عبارت دیگر نیکی با عقل و بدی جاهل، این دو نیرو با هم در نبردند و چون روشنائی داناست سرانجام پیروز خواهد شد.\n" + +"اساس تعلیمات اجتماعی مزدک دو چیز است: یکی برابری و دیگری دادگری.\n" + +"مردم بسیاری به سرعت پیرو مذهب مزدک شدند. جنبش مزدکی با قتل او و پیروانش به طرز وحشیانهای سرکوب شد، اما افکار او اثر خود را حتی در قیامها و جنبشهای مردم ایران در دوران اسلام، باقی گذاشت.\n" + +"[ویرایش]\n" + +"منابع\n" + +"\n" + +"تاریخ ایران - دکتر خنجی\n" + +"تاریخ اجتماعی ایران. مرتضی راوندی. ( جلد ۱ ) 1354\n" + +"تاریخ ماد. ایگور میخائیلوویچ دیاکونوف. ترجمه کریم کشاورز، تهران: نشر امیرکبیر.\n" + +"تاريخ ايران باستان. دياكونوف، ميخائيل ميخائيلوويچ. روحی ارباب. انتشارات علمی و فرهنگی، چاپ دوم 1380\n" + +"سهم ایرانیان در پیدایش و آفرینش خط در جهان ،دکتر رکن الدین همایونفرخ، انتشارات اساطیر.\n" + +"کمرون، جرج. ایران در سپیده دم تاریخ. ترجمه حسن انوشه. تهران، مرکز نشر دانشگاهی، 1379\n" + +"تاریخ ایران از زمان باستان تا امروز، ا. آ. گرانتوسكی - م. آ. داندامایو، مترجم، كیخسرو كشاورزی، ناشر: مرواريد 1385\n" + +"تاریخ ایران از عهد باستان تا قرن 18، پیگولووسکایا، ترجمه کریم کشاورز، تهران، 1353.\n" + +"[ویرایش]\n" + +"جستارهای وابسته\n" + +"\n" + +"ماد\n" + +"کاسی\n" + +"ایلامیان\n" + +"تپه هگمتانه\n" + +"تاریخ ایران\n" + +"ایران پیش از آریاییها\n" + +"تمدنهای باستانی آسیای غربی\n" + +"[ویرایش]\n" + +"پیوند به بیرون\n" + +"\n" + +"ایران قبل از آریاها\n" + +"ايران پيش از آرياییها\n" + +"تمدنهای قبل از آریایی ایران\n" + +"ایران ازدیدگاه باستانشناسی\n" + +"سنگنبشتهی داریوش بزرگ در بیستون\n" + +"شیوه آسیائی تولید در ایران\n" + +"نیای اساطیری ایرانیان\n" + +"قیامهای ایرانیان در طول تاریخ\n" + +"خلاصهٔ تاریخ ایران\n" + +"شهر، شهرسازی و شهرنشينی در ايران پيش از اسلام\n" + +"\n" + +"[3]\n" + +"[4]\n" + +"[5]\n" + +"[6]\n" + +"[7]\n" + +"\n" + +"\n" + +"\n" + +" این نوشتار خُرد است. با گسترش آن به ویکیپدیا کمک کنید.\n" + +"\n" + +"این مقاله نیازمند ویکیسازی است. لطفاً با توجه به راهنمای ویرایش و شیوهنامه آن را تغییر دهید. در پایان، پس از ویکیسازی این الگوی پیامی را بردارید.\n"; + + +var source = +("/*\n" + +" This is a version (aka dlmalloc) of malloc/free/realloc written by\n" + +" Doug Lea and released to the public domain. Use, modify, and\n" + +" redistribute this code without permission or acknowledgement in any\n" + +" way you wish. Send questions, comments, complaints, performance\n" + +" data, etc to dl@cs.oswego.edu\n" + +"\n" + +"* VERSION 2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee)\n" + +"\n" + +" Note: There may be an updated version of this malloc obtainable at\n" + +" ftp://gee.cs.oswego.edu/pub/misc/malloc.c\n" + +" Check before installing!\n" + +"\n" + +"* Quickstart\n" + +"\n" + +" This library is all in one file to simplify the most common usage:\n" + +" ftp it, compile it (-O), and link it into another program. All\n" + +" of the compile-time options default to reasonable values for use on\n" + +" most unix platforms. Compile -DWIN32 for reasonable defaults on windows.\n" + +" You might later want to step through various compile-time and dynamic\n" + +" tuning options.\n" + +"\n" + +" For convenience, an include file for code using this malloc is at:\n" + +" ftp://gee.cs.oswego.edu/pub/misc/malloc-2.7.1.h\n" + +" You don't really need this .h file unless you call functions not\n" + +" defined in your system include files. The .h file contains only the\n" + +" excerpts from this file needed for using this malloc on ANSI C/C++\n" + +" systems, so long as you haven't changed compile-time options about\n" + +" naming and tuning parameters. If you do, then you can create your\n" + +" own malloc.h that does include all settings by cutting at the point\n" + +" indicated below.\n" + +"\n" + +"* Why use this malloc?\n" + +"\n" + +" This is not the fastest, most space-conserving, most portable, or\n" + +" most tunable malloc ever written. However it is among the fastest\n" + +" while also being among the most space-conserving, portable and tunable.\n" + +" Consistent balance across these factors results in a good general-purpose\n" + +" allocator for malloc-intensive programs.\n" + +"\n" + +" The main properties of the algorithms are:\n" + +" * For large (>= 512 bytes) requests, it is a pure best-fit allocator,\n" + +" with ties normally decided via FIFO (i.e. least recently used).\n" + +" * For small (<= 64 bytes by default) requests, it is a caching\n" + +" allocator, that maintains pools of quickly recycled chunks.\n" + +" * In between, and for combinations of large and small requests, it does\n" + +" the best it can trying to meet both goals at once.\n" + +" * For very large requests (>= 128KB by default), it relies on system\n" + +" memory mapping facilities, if supported.\n" + +"\n" + +" For a longer but slightly out of date high-level description, see\n" + +" http://gee.cs.oswego.edu/dl/html/malloc.html\n" + +"\n" + +" You may already by default be using a C library containing a malloc\n" + +" that is based on some version of this malloc (for example in\n" + +" linux). You might still want to use the one in this file in order to\n" + +" customize settings or to avoid overheads associated with library\n" + +" versions.\n" + +"\n" + +"* Contents, described in more detail in \"description of public routines\" below.\n" + +"\n" + +" Standard (ANSI/SVID/...) functions:\n" + +" malloc(size_t n);\n" + +" calloc(size_t n_elements, size_t element_size);\n" + +" free(Void_t* p);\n" + +" realloc(Void_t* p, size_t n);\n" + +" memalign(size_t alignment, size_t n);\n" + +" valloc(size_t n);\n" + +" mallinfo()\n" + +" mallopt(int parameter_number, int parameter_value)\n" + +"\n" + +" Additional functions:\n" + +" independent_calloc(size_t n_elements, size_t size, Void_t* chunks[]);\n" + +" independent_comalloc(size_t n_elements, size_t sizes[], Void_t* chunks[]);\n" + +" pvalloc(size_t n);\n" + +" cfree(Void_t* p);\n" + +" malloc_trim(size_t pad);\n" + +" malloc_usable_size(Void_t* p);\n" + +" malloc_stats();\n" + +"\n" + +"* Vital statistics:\n" + +"\n" + +" Supported pointer representation: 4 or 8 bytes\n" + +" Supported size_t representation: 4 or 8 bytes\n" + +" Note that size_t is allowed to be 4 bytes even if pointers are 8.\n" + +" You can adjust this by defining INTERNAL_SIZE_T\n" + +"\n" + +" Alignment: 2 * sizeof(size_t) (default)\n" + +" (i.e., 8 byte alignment with 4byte size_t). This suffices for\n" + +" nearly all current machines and C compilers. However, you can\n" + +" define MALLOC_ALIGNMENT to be wider than this if necessary.\n" + +"\n" + +" Minimum overhead per allocated chunk: 4 or 8 bytes\n" + +" Each malloced chunk has a hidden word of overhead holding size\n" + +" and status information.\n" + +"\n" + +" Minimum allocated size: 4-byte ptrs: 16 bytes (including 4 overhead)\n" + +" 8-byte ptrs: 24/32 bytes (including, 4/8 overhead)\n" + +"\n" + +" When a chunk is freed, 12 (for 4byte ptrs) or 20 (for 8 byte\n" + +" ptrs but 4 byte size) or 24 (for 8/8) additional bytes are\n" + +" needed; 4 (8) for a trailing size field and 8 (16) bytes for\n" + +" free list pointers. Thus, the minimum allocatable size is\n" + +" 16/24/32 bytes.\n" + +"\n" + +" Even a request for zero bytes (i.e., malloc(0)) returns a\n" + +" pointer to something of the minimum allocatable size.\n" + +"\n" + +" The maximum overhead wastage (i.e., number of extra bytes\n" + +" allocated than were requested in malloc) is less than or equal\n" + +" to the minimum size, except for requests >= mmap_threshold that\n" + +" are serviced via mmap(), where the worst case wastage is 2 *\n" + +" sizeof(size_t) bytes plus the remainder from a system page (the\n" + +" minimal mmap unit); typically 4096 or 8192 bytes.\n" + +"\n" + +" Maximum allocated size: 4-byte size_t: 2^32 minus about two pages\n" + +" 8-byte size_t: 2^64 minus about two pages\n" + +"\n" + +" It is assumed that (possibly signed) size_t values suffice to\n" + +" represent chunk sizes. `Possibly signed' is due to the fact\n" + +" that `size_t' may be defined on a system as either a signed or\n" + +" an unsigned type. The ISO C standard says that it must be\n" + +" unsigned, but a few systems are known not to adhere to this.\n" + +" Additionally, even when size_t is unsigned, sbrk (which is by\n" + +" default used to obtain memory from system) accepts signed\n" + +" arguments, and may not be able to handle size_t-wide arguments\n" + +" with negative sign bit. Generally, values that would\n" + +" appear as negative after accounting for overhead and alignment\n" + +" are supported only via mmap(), which does not have this\n" + +" limitation.\n" + +"\n" + +" Requests for sizes outside the allowed range will perform an optional\n" + +" failure action and then return null. (Requests may also\n" + +" also fail because a system is out of memory.)\n" + +"\n" + +" Thread-safety: NOT thread-safe unless USE_MALLOC_LOCK defined\n" + +"\n" + +" When USE_MALLOC_LOCK is defined, wrappers are created to\n" + +" surround every public call with either a pthread mutex or\n" + +" a win32 spinlock (depending on WIN32). This is not\n" + +" especially fast, and can be a major bottleneck.\n" + +" It is designed only to provide minimal protection\n" + +" in concurrent environments, and to provide a basis for\n" + +" extensions. If you are using malloc in a concurrent program,\n" + +" you would be far better off obtaining ptmalloc, which is\n" + +" derived from a version of this malloc, and is well-tuned for\n" + +" concurrent programs. (See http://www.malloc.de) Note that\n" + +" even when USE_MALLOC_LOCK is defined, you can can guarantee\n" + +" full thread-safety only if no threads acquire memory through\n" + +" direct calls to MORECORE or other system-level allocators.\n" + +"\n" + +" Compliance: I believe it is compliant with the 1997 Single Unix Specification\n" + +" (See http://www.opennc.org). Also SVID/XPG, ANSI C, and probably\n" + +" others as well.\n" + +"\n" + +"* Synopsis of compile-time options:\n" + +"\n" + +" People have reported using previous versions of this malloc on all\n" + +" versions of Unix, sometimes by tweaking some of the defines\n" + +" below. It has been tested most extensively on Solaris and\n" + +" Linux. It is also reported to work on WIN32 platforms.\n" + +" People also report using it in stand-alone embedded systems.\n" + +"\n" + +" The implementation is in straight, hand-tuned ANSI C. It is not\n" + +" at all modular. (Sorry!) It uses a lot of macros. To be at all\n" + +" usable, this code should be compiled using an optimizing compiler\n" + +" (for example gcc -O3) that can simplify expressions and control\n" + +" paths. (FAQ: some macros import variables as arguments rather than\n" + +" declare locals because people reported that some debuggers\n" + +" otherwise get confused.)\n" + +"\n" + +" OPTION DEFAULT VALUE\n" + +"\n" + +" Compilation Environment options:\n" + +"\n" + +" __STD_C derived from C compiler defines\n" + +" WIN32 NOT defined\n" + +" HAVE_MEMCPY defined\n" + +" USE_MEMCPY 1 if HAVE_MEMCPY is defined\n" + +" HAVE_MMAP defined as 1\n" + +" MMAP_CLEARS 1\n" + +" HAVE_MREMAP 0 unless linux defined\n" + +" malloc_getpagesize derived from system #includes, or 4096 if not\n" + +" HAVE_USR_INCLUDE_MALLOC_H NOT defined\n" + +" LACKS_UNISTD_H NOT defined unless WIN32\n" + +" LACKS_SYS_PARAM_H NOT defined unless WIN32\n" + +" LACKS_SYS_MMAN_H NOT defined unless WIN32\n" + +" LACKS_FCNTL_H NOT defined\n" + +"\n" + +" Changing default word sizes:\n" + +"\n" + +" INTERNAL_SIZE_T size_t\n" + +" MALLOC_ALIGNMENT 2 * sizeof(INTERNAL_SIZE_T)\n" + +" PTR_UINT unsigned long\n" + +" CHUNK_SIZE_T unsigned long\n" + +"\n" + +" Configuration and functionality options:\n" + +"\n" + +" USE_DL_PREFIX NOT defined\n" + +" USE_PUBLIC_MALLOC_WRAPPERS NOT defined\n" + +" USE_MALLOC_LOCK NOT defined\n" + +" DEBUG NOT defined\n" + +" REALLOC_ZERO_BYTES_FREES NOT defined\n" + +" MALLOC_FAILURE_ACTION errno = ENOMEM, if __STD_C defined, else no-op\n" + +" TRIM_FASTBINS 0\n" + +" FIRST_SORTED_BIN_SIZE 512\n" + +"\n" + +" Options for customizing MORECORE:\n" + +"\n" + +" MORECORE sbrk\n" + +" MORECORE_CONTIGUOUS 1\n" + +" MORECORE_CANNOT_TRIM NOT defined\n" + +" MMAP_AS_MORECORE_SIZE (1024 * 1024)\n" + +"\n" + +" Tuning options that are also dynamically changeable via mallopt:\n" + +"\n" + +" DEFAULT_MXFAST 64\n" + +" DEFAULT_TRIM_THRESHOLD 256 * 1024\n" + +" DEFAULT_TOP_PAD 0\n" + +" DEFAULT_MMAP_THRESHOLD 256 * 1024\n" + +" DEFAULT_MMAP_MAX 65536\n" + +"\n" + +" There are several other #defined constants and macros that you\n" + +" probably don't want to touch unless you are extending or adapting malloc.\n" + +"*/\n" + +"\n" + +"#define MORECORE_CONTIGUOUS 0\n" + +"#define MORECORE_CANNOT_TRIM 1\n" + +"#define MALLOC_FAILURE_ACTION abort()\n" + +"\n" + +"\n" + +"namespace khtml {\n" + +"\n" + +"#ifndef NDEBUG\n" + +"\n" + +"// In debugging builds, use the system malloc for its debugging features.\n" + +"\n" + +"void *main_thread_malloc(size_t n)\n" + +"{\n" + +" assert(pthread_main_np());\n" + +" return malloc(n);\n" + +"}\n" + +"\n" + +"void *main_thread_calloc(size_t n_elements, size_t element_size)\n" + +"{\n" + +" assert(pthread_main_np());\n" + +" return calloc(n_elements, element_size);\n" + +"}\n" + +"\n" + +"void main_thread_free(void* p)\n" + +"{\n" + +" // it's ok to main_thread_free on a non-main thread - the actual\n" + +" // free will be scheduled on the main thread in that case.\n" + +" free(p);\n" + +"}\n" + +"\n" + +"void *main_thread_realloc(void* p, size_t n)\n" + +"{\n" + +" assert(pthread_main_np());\n" + +" return realloc(p, n);\n" + +"}\n" + +"\n" + +"#else\n" + +"\n" + +"/*\n" + +" WIN32 sets up defaults for MS environment and compilers.\n" + +" Otherwise defaults are for unix.\n" + +"*/\n" + +"\n" + +"/* #define WIN32 */\n" + +"\n" + +"#ifdef WIN32\n" + +"\n" + +"#define WIN32_LEAN_AND_MEAN\n" + +"#include <windows.h>\n" + +"\n" + +"/* Win32 doesn't supply or need the following headers */\n" + +"#define LACKS_UNISTD_H\n" + +"#define LACKS_SYS_PARAM_H\n" + +"#define LACKS_SYS_MMAN_H\n" + +"\n" + +"/* Use the supplied emulation of sbrk */\n" + +"#define MORECORE sbrk\n" + +"#define MORECORE_CONTIGUOUS 1\n" + +"#define MORECORE_FAILURE ((void*)(-1))\n" + +"\n" + +"/* Use the supplied emulation of mmap and munmap */\n" + +"#define HAVE_MMAP 1\n" + +"#define MUNMAP_FAILURE (-1)\n" + +"#define MMAP_CLEARS 1\n" + +"\n" + +"/* These values don't really matter in windows mmap emulation */\n" + +"#define MAP_PRIVATE 1\n" + +"#define MAP_ANONYMOUS 2\n" + +"#define PROT_READ 1\n" + +"#define PROT_WRITE 2\n" + +"\n" + +"/* Emulation functions defined at the end of this file */\n" + +"\n" + +"/* If USE_MALLOC_LOCK, use supplied critical-section-based lock functions */\n" + +"#ifdef USE_MALLOC_LOCK\n") + +("static int slwait(int *sl);\n" + +"static int slrelease(int *sl);\n" + +"#endif\n" + +"\n" + +"static long getpagesize(void);\n" + +"static long getregionsize(void);\n" + +"static void *sbrk(long size);\n" + +"static void *mmap(void *ptr, long size, long prot, long type, long handle, long arg);\n" + +"static long munmap(void *ptr, long size);\n" + +"\n" + +"static void vminfo (unsigned long*free, unsigned long*reserved, unsigned long*committed);\n" + +"static int cpuinfo (int whole, unsigned long*kernel, unsigned long*user);\n" + +"\n" + +"#endif\n" + +"\n" + +"/*\n" + +" __STD_C should be nonzero if using ANSI-standard C compiler, a C++\n" + +" compiler, or a C compiler sufficiently close to ANSI to get away\n" + +" with it.\n" + +"*/\n" + +"\n" + +"#ifndef __STD_C\n" + +"#if defined(__STDC__) || defined(_cplusplus)\n" + +"#define __STD_C 1\n" + +"#else\n" + +"#define __STD_C 0\n" + +"#endif\n" + +"#endif /*__STD_C*/\n" + +"\n" + +"\n" + +"/*\n" + +" Void_t* is the pointer type that malloc should say it returns\n" + +"*/\n" + +"\n" + +"#ifndef Void_t\n" + +"#if (__STD_C || defined(WIN32))\n" + +"#define Void_t void\n" + +"#else\n" + +"#define Void_t char\n" + +"#endif\n" + +"#endif /*Void_t*/\n" + +"\n" + +"#if __STD_C\n" + +"#include <stddef.h> /* for size_t */\n" + +"#else\n" + +"#include <sys/types.h>\n" + +"#endif\n" + +"\n" + +"/* define LACKS_UNISTD_H if your system does not have a <unistd.h>. */\n" + +"\n" + +"/* #define LACKS_UNISTD_H */\n" + +"\n" + +"#ifndef LACKS_UNISTD_H\n" + +"#include <unistd.h>\n" + +"#endif\n" + +"\n" + +"/* define LACKS_SYS_PARAM_H if your system does not have a <sys/param.h>. */\n" + +"\n" + +"/* #define LACKS_SYS_PARAM_H */\n" + +"\n" + +"\n" + +"#include <stdio.h> /* needed for malloc_stats */\n" + +"#include <errno.h> /* needed for optional MALLOC_FAILURE_ACTION */\n" + +"\n" + +"\n" + +"/*\n" + +" Debugging:\n" + +"\n" + +" Because freed chunks may be overwritten with bookkeeping fields, this\n" + +" malloc will often die when freed memory is overwritten by user\n" + +" programs. This can be very effective (albeit in an annoying way)\n" + +" in helping track down dangling pointers.\n" + +"\n" + +" If you compile with -DDEBUG, a number of assertion checks are\n" + +" enabled that will catch more memory errors. You probably won't be\n" + +" able to make much sense of the actual assertion errors, but they\n" + +" should help you locate incorrectly overwritten memory. The\n" + +" checking is fairly extensive, and will slow down execution\n" + +" noticeably. Calling malloc_stats or mallinfo with DEBUG set will\n" + +" attempt to check every non-mmapped allocated and free chunk in the\n" + +" course of computing the summmaries. (By nature, mmapped regions\n" + +" cannot be checked very much automatically.)\n" + +"\n" + +" Setting DEBUG may also be helpful if you are trying to modify\n" + +" this code. The assertions in the check routines spell out in more\n" + +" detail the assumptions and invariants underlying the algorithms.\n" + +"\n" + +" Setting DEBUG does NOT provide an automated mechanism for checking\n" + +" that all accesses to malloced memory stay within their\n" + +" bounds. However, there are several add-ons and adaptations of this\n" + +" or other mallocs available that do this.\n" + +"*/\n" + +"\n" + +"/*\n" + +" The unsigned integer type used for comparing any two chunk sizes.\n" + +" This should be at least as wide as size_t, but should not be signed.\n" + +"*/\n" + +"\n" + +"#ifndef CHUNK_SIZE_T\n" + +"#define CHUNK_SIZE_T unsigned long\n" + +"#endif\n" + +"\n" + +"/*\n" + +" The unsigned integer type used to hold addresses when they are are\n" + +" manipulated as integers. Except that it is not defined on all\n" + +" systems, intptr_t would suffice.\n" + +"*/\n" + +"#ifndef PTR_UINT\n" + +"#define PTR_UINT unsigned long\n" + +"#endif\n" + +"\n" + +"\n" + +"/*\n" + +" INTERNAL_SIZE_T is the word-size used for internal bookkeeping\n" + +" of chunk sizes.\n" + +"\n" + +" The default version is the same as size_t.\n" + +"\n" + +" While not strictly necessary, it is best to define this as an\n" + +" unsigned type, even if size_t is a signed type. This may avoid some\n" + +" artificial size limitations on some systems.\n" + +"\n" + +" On a 64-bit machine, you may be able to reduce malloc overhead by\n" + +" defining INTERNAL_SIZE_T to be a 32 bit `unsigned int' at the\n" + +" expense of not being able to handle more than 2^32 of malloced\n" + +" space. If this limitation is acceptable, you are encouraged to set\n" + +" this unless you are on a platform requiring 16byte alignments. In\n" + +" this case the alignment requirements turn out to negate any\n" + +" potential advantages of decreasing size_t word size.\n" + +"\n" + +" Implementors: Beware of the possible combinations of:\n" + +" - INTERNAL_SIZE_T might be signed or unsigned, might be 32 or 64 bits,\n" + +" and might be the same width as int or as long\n" + +" - size_t might have different width and signedness as INTERNAL_SIZE_T\n" + +" - int and long might be 32 or 64 bits, and might be the same width\n" + +" To deal with this, most comparisons and difference computations\n" + +" among INTERNAL_SIZE_Ts should cast them to CHUNK_SIZE_T, being\n" + +" aware of the fact that casting an unsigned int to a wider long does\n" + +" not sign-extend. (This also makes checking for negative numbers\n" + +" awkward.) Some of these casts result in harmless compiler warnings\n" + +" on some systems.\n" + +"*/\n" + +"\n" + +"#ifndef INTERNAL_SIZE_T\n" + +"#define INTERNAL_SIZE_T size_t\n" + +"#endif\n" + +"\n" + +"/* The corresponding word size */\n" + +"#define SIZE_SZ (sizeof(INTERNAL_SIZE_T))\n" + +"\n" + +"\n") + +("\n" + +"/*\n" + +" MALLOC_ALIGNMENT is the minimum alignment for malloc'ed chunks.\n" + +" It must be a power of two at least 2 * SIZE_SZ, even on machines\n" + +" for which smaller alignments would suffice. It may be defined as\n" + +" larger than this though. Note however that code and data structures\n" + +" are optimized for the case of 8-byte alignment.\n" + +"*/\n" + +"\n" + +"\n" + +"#ifndef MALLOC_ALIGNMENT\n" + +"#define MALLOC_ALIGNMENT (2 * SIZE_SZ)\n" + +"#endif\n" + +"\n" + +"/* The corresponding bit mask value */\n" + +"#define MALLOC_ALIGN_MASK (MALLOC_ALIGNMENT - 1)\n" + +"\n" + +"\n" + +"\n" + +"/*\n" + +" REALLOC_ZERO_BYTES_FREES should be set if a call to\n" + +" realloc with zero bytes should be the same as a call to free.\n" + +" Some people think it should. Otherwise, since this malloc\n" + +" returns a unique pointer for malloc(0), so does realloc(p, 0).\n" + +"*/\n" + +"\n" + +"/* #define REALLOC_ZERO_BYTES_FREES */\n" + +"\n" + +"/*\n" + +" TRIM_FASTBINS controls whether free() of a very small chunk can\n" + +" immediately lead to trimming. Setting to true (1) can reduce memory\n" + +" footprint, but will almost always slow down programs that use a lot\n" + +" of small chunks.\n" + +"\n" + +" Define this only if you are willing to give up some speed to more\n" + +" aggressively reduce system-level memory footprint when releasing\n" + +" memory in programs that use many small chunks. You can get\n" + +" essentially the same effect by setting MXFAST to 0, but this can\n" + +" lead to even greater slowdowns in programs using many small chunks.\n" + +" TRIM_FASTBINS is an in-between compile-time option, that disables\n" + +" only those chunks bordering topmost memory from being placed in\n" + +" fastbins.\n" + +"*/\n" + +"\n" + +"#ifndef TRIM_FASTBINS\n" + +"#define TRIM_FASTBINS 0\n" + +"#endif\n" + +"\n" + +"\n" + +"/*\n" + +" USE_DL_PREFIX will prefix all public routines with the string 'dl'.\n" + +" This is necessary when you only want to use this malloc in one part\n" + +" of a program, using your regular system malloc elsewhere.\n" + +"*/\n" + +"\n" + +"#define USE_DL_PREFIX\n" + +"\n" + +"\n" + +"/*\n" + +" USE_MALLOC_LOCK causes wrapper functions to surround each\n" + +" callable routine with pthread mutex lock/unlock.\n" + +"\n" + +" USE_MALLOC_LOCK forces USE_PUBLIC_MALLOC_WRAPPERS to be defined\n" + +"*/\n" + +"\n" + +"\n" + +"/* #define USE_MALLOC_LOCK */\n" + +"\n" + +"\n" + +"/*\n" + +" If USE_PUBLIC_MALLOC_WRAPPERS is defined, every public routine is\n" + +" actually a wrapper function that first calls MALLOC_PREACTION, then\n" + +" calls the internal routine, and follows it with\n" + +" MALLOC_POSTACTION. This is needed for locking, but you can also use\n" + +" this, without USE_MALLOC_LOCK, for purposes of interception,\n" + +" instrumentation, etc. It is a sad fact that using wrappers often\n" + +" noticeably degrades performance of malloc-intensive programs.\n" + +"*/\n" + +"\n" + +"#ifdef USE_MALLOC_LOCK\n" + +"#define USE_PUBLIC_MALLOC_WRAPPERS\n" + +"#else\n" + +"/* #define USE_PUBLIC_MALLOC_WRAPPERS */\n" + +"#endif\n" + +"\n" + +"\n" + +"/*\n" + +" Two-phase name translation.\n" + +" All of the actual routines are given mangled names.\n" + +" When wrappers are used, they become the public callable versions.\n" + +" When DL_PREFIX is used, the callable names are prefixed.\n" + +"*/\n" + +"\n" + +"#ifndef USE_PUBLIC_MALLOC_WRAPPERS\n" + +"#define cALLOc public_cALLOc\n" + +"#define fREe public_fREe\n" + +"#define cFREe public_cFREe\n" + +"#define mALLOc public_mALLOc\n" + +"#define mEMALIGn public_mEMALIGn\n" + +"#define rEALLOc public_rEALLOc\n" + +"#define vALLOc public_vALLOc\n" + +"#define pVALLOc public_pVALLOc\n" + +"#define mALLINFo public_mALLINFo\n" + +"#define mALLOPt public_mALLOPt\n" + +"#define mTRIm public_mTRIm\n" + +"#define mSTATs public_mSTATs\n" + +"#define mUSABLe public_mUSABLe\n" + +"#define iCALLOc public_iCALLOc\n" + +"#define iCOMALLOc public_iCOMALLOc\n" + +"#endif\n" + +"\n" + +"#ifdef USE_DL_PREFIX\n" + +"#define public_cALLOc main_thread_calloc\n" + +"#define public_fREe main_thread_free\n" + +"#define public_cFREe main_thread_cfree\n" + +"#define public_mALLOc main_thread_malloc\n" + +"#define public_mEMALIGn main_thread_memalign\n" + +"#define public_rEALLOc main_thread_realloc\n" + +"#define public_vALLOc main_thread_valloc\n" + +"#define public_pVALLOc main_thread_pvalloc\n" + +"#define public_mALLINFo main_thread_mallinfo\n" + +"#define public_mALLOPt main_thread_mallopt\n" + +"#define public_mTRIm main_thread_malloc_trim\n" + +"#define public_mSTATs main_thread_malloc_stats\n" + +"#define public_mUSABLe main_thread_malloc_usable_size\n" + +"#define public_iCALLOc main_thread_independent_calloc\n" + +"#define public_iCOMALLOc main_thread_independent_comalloc\n" + +"#else /* USE_DL_PREFIX */\n" + +"#define public_cALLOc calloc\n" + +"#define public_fREe free\n" + +"#define public_cFREe cfree\n" + +"#define public_mALLOc malloc\n" + +"#define public_mEMALIGn memalign\n" + +"#define public_rEALLOc realloc\n" + +"#define public_vALLOc valloc\n" + +"#define public_pVALLOc pvalloc\n" + +"#define public_mALLINFo mallinfo\n" + +"#define public_mALLOPt mallopt\n" + +"#define public_mTRIm malloc_trim\n" + +"#define public_mSTATs malloc_stats\n" + +"#define public_mUSABLe malloc_usable_size\n" + +"#define public_iCALLOc independent_calloc\n" + +"#define public_iCOMALLOc independent_comalloc\n" + +"#endif /* USE_DL_PREFIX */\n" + +"\n" + +"\n" + +"/*\n" + +" HAVE_MEMCPY should be defined if you are not otherwise using\n" + +" ANSI STD C, but still have memcpy and memset in your C library\n" + +" and want to use them in calloc and realloc. Otherwise simple\n" + +" macro versions are defined below.\n" + +"\n") + +(" USE_MEMCPY should be defined as 1 if you actually want to\n" + +" have memset and memcpy called. People report that the macro\n" + +" versions are faster than libc versions on some systems.\n" + +"\n" + +" Even if USE_MEMCPY is set to 1, loops to copy/clear small chunks\n" + +" (of <= 36 bytes) are manually unrolled in realloc and calloc.\n" + +"*/\n" + +"\n" + +"#define HAVE_MEMCPY\n" + +"\n" + +"#ifndef USE_MEMCPY\n" + +"#ifdef HAVE_MEMCPY\n" + +"#define USE_MEMCPY 1\n" + +"#else\n" + +"#define USE_MEMCPY 0\n" + +"#endif\n" + +"#endif\n" + +"\n" + +"\n" + +"#if (__STD_C || defined(HAVE_MEMCPY))\n" + +"\n" + +"#ifdef WIN32\n" + +"/* On Win32 memset and memcpy are already declared in windows.h */\n" + +"#else\n" + +"#if __STD_C\n" + +"extern \"C\" {\n" + +"void* memset(void*, int, size_t);\n" + +"void* memcpy(void*, const void*, size_t);\n" + +"}\n" + +"#else\n" + +"extern \"C\" {\n" + +"Void_t* memset();\n" + +"Void_t* memcpy();\n" + +"}\n" + +"#endif\n" + +"#endif\n" + +"#endif\n" + +"\n" + +"/*\n" + +" MALLOC_FAILURE_ACTION is the action to take before \"return 0\" when\n" + +" malloc fails to be able to return memory, either because memory is\n" + +" exhausted or because of illegal arguments.\n" + +"\n" + +" By default, sets errno if running on STD_C platform, else does nothing.\n" + +"*/\n" + +"\n" + +"#ifndef MALLOC_FAILURE_ACTION\n" + +"#if __STD_C\n" + +"#define MALLOC_FAILURE_ACTION \\n" + +" errno = ENOMEM;\n" + +"\n" + +"#else\n" + +"#define MALLOC_FAILURE_ACTION\n" + +"#endif\n" + +"#endif\n" + +"\n" + +"/*\n" + +" MORECORE-related declarations. By default, rely on sbrk\n" + +"*/\n" + +"\n" + +"\n" + +"#ifdef LACKS_UNISTD_H\n" + +"#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__)\n" + +"#if __STD_C\n" + +"extern Void_t* sbrk(ptrdiff_t);\n" + +"#else\n" + +"extern Void_t* sbrk();\n" + +"#endif\n" + +"#endif\n" + +"#endif\n" + +"\n" + +"/*\n" + +" MORECORE is the name of the routine to call to obtain more memory\n" + +" from the system. See below for general guidance on writing\n" + +" alternative MORECORE functions, as well as a version for WIN32 and a\n" + +" sample version for pre-OSX macos.\n" + +"*/\n" + +"\n" + +"#ifndef MORECORE\n" + +"#define MORECORE sbrk\n" + +"#endif\n" + +"\n" + +"/*\n" + +" MORECORE_FAILURE is the value returned upon failure of MORECORE\n" + +" as well as mmap. Since it cannot be an otherwise valid memory address,\n" + +" and must reflect values of standard sys calls, you probably ought not\n" + +" try to redefine it.\n" + +"*/\n" + +"\n" + +"#ifndef MORECORE_FAILURE\n" + +"#define MORECORE_FAILURE (-1)\n" + +"#endif\n" + +"\n" + +"/*\n" + +" If MORECORE_CONTIGUOUS is true, take advantage of fact that\n" + +" consecutive calls to MORECORE with positive arguments always return\n" + +" contiguous increasing addresses. This is true of unix sbrk. Even\n" + +" if not defined, when regions happen to be contiguous, malloc will\n" + +" permit allocations spanning regions obtained from different\n" + +" calls. But defining this when applicable enables some stronger\n" + +" consistency checks and space efficiencies.\n" + +"*/\n" + +"\n" + +"#ifndef MORECORE_CONTIGUOUS\n" + +"#define MORECORE_CONTIGUOUS 1\n" + +"#endif\n" + +"\n" + +"/*\n" + +" Define MORECORE_CANNOT_TRIM if your version of MORECORE\n" + +" cannot release space back to the system when given negative\n" + +" arguments. This is generally necessary only if you are using\n" + +" a hand-crafted MORECORE function that cannot handle negative arguments.\n" + +"*/\n" + +"\n" + +"/* #define MORECORE_CANNOT_TRIM */\n" + +"\n" + +"\n" + +"/*\n" + +" Define HAVE_MMAP as true to optionally make malloc() use mmap() to\n" + +" allocate very large blocks. These will be returned to the\n" + +" operating system immediately after a free(). Also, if mmap\n" + +" is available, it is used as a backup strategy in cases where\n" + +" MORECORE fails to provide space from system.\n" + +"\n" + +" This malloc is best tuned to work with mmap for large requests.\n" + +" If you do not have mmap, operations involving very large chunks (1MB\n" + +" or so) may be slower than you'd like.\n" + +"*/\n" + +"\n" + +"#ifndef HAVE_MMAP\n" + +"#define HAVE_MMAP 1\n" + +"#endif\n" + +"\n" + +"#if HAVE_MMAP\n" + +"/*\n" + +" Standard unix mmap using /dev/zero clears memory so calloc doesn't\n" + +" need to.\n" + +"*/\n" + +"\n" + +"#ifndef MMAP_CLEARS\n" + +"#define MMAP_CLEARS 1\n" + +"#endif\n" + +"\n" + +"#else /* no mmap */\n" + +"#ifndef MMAP_CLEARS\n" + +"#define MMAP_CLEARS 0\n" + +"#endif\n" + +"#endif\n" + +"\n" + +"\n" + +"/*\n") + +(" MMAP_AS_MORECORE_SIZE is the minimum mmap size argument to use if\n" + +" sbrk fails, and mmap is used as a backup (which is done only if\n" + +" HAVE_MMAP). The value must be a multiple of page size. This\n" + +" backup strategy generally applies only when systems have \"holes\" in\n" + +" address space, so sbrk cannot perform contiguous expansion, but\n" + +" there is still space available on system. On systems for which\n" + +" this is known to be useful (i.e. most linux kernels), this occurs\n" + +" only when programs allocate huge amounts of memory. Between this,\n" + +" and the fact that mmap regions tend to be limited, the size should\n" + +" be large, to avoid too many mmap calls and thus avoid running out\n" + +" of kernel resources.\n" + +"*/\n" + +"\n" + +"#ifndef MMAP_AS_MORECORE_SIZE\n" + +"#define MMAP_AS_MORECORE_SIZE (1024 * 1024)\n" + +"#endif\n" + +"\n" + +"/*\n" + +" Define HAVE_MREMAP to make realloc() use mremap() to re-allocate\n" + +" large blocks. This is currently only possible on Linux with\n" + +" kernel versions newer than 1.3.77.\n" + +"*/\n" + +"\n" + +"#ifndef HAVE_MREMAP\n" + +"#ifdef linux\n" + +"#define HAVE_MREMAP 1\n" + +"#else\n" + +"#define HAVE_MREMAP 0\n" + +"#endif\n" + +"\n" + +"#endif /* HAVE_MMAP */\n" + +"\n" + +"\n" + +"/*\n" + +" The system page size. To the extent possible, this malloc manages\n" + +" memory from the system in page-size units. Note that this value is\n" + +" cached during initialization into a field of malloc_state. So even\n" + +" if malloc_getpagesize is a function, it is only called once.\n" + +"\n" + +" The following mechanics for getpagesize were adapted from bsd/gnu\n" + +" getpagesize.h. If none of the system-probes here apply, a value of\n" + +" 4096 is used, which should be OK: If they don't apply, then using\n" + +" the actual value probably doesn't impact performance.\n" + +"*/\n" + +"\n" + +"\n" + +"#ifndef malloc_getpagesize\n" + +"\n" + +"#ifndef LACKS_UNISTD_H\n" + +"# include <unistd.h>\n" + +"#endif\n" + +"\n" + +"# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */\n" + +"# ifndef _SC_PAGE_SIZE\n" + +"# define _SC_PAGE_SIZE _SC_PAGESIZE\n" + +"# endif\n" + +"# endif\n" + +"\n" + +"# ifdef _SC_PAGE_SIZE\n" + +"# define malloc_getpagesize sysconf(_SC_PAGE_SIZE)\n" + +"# else\n" + +"# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE)\n" + +" extern size_t getpagesize();\n" + +"# define malloc_getpagesize getpagesize()\n" + +"# else\n" + +"# ifdef WIN32 /* use supplied emulation of getpagesize */\n" + +"# define malloc_getpagesize getpagesize()\n" + +"# else\n" + +"# ifndef LACKS_SYS_PARAM_H\n" + +"# include <sys/param.h>\n" + +"# endif\n" + +"# ifdef EXEC_PAGESIZE\n" + +"# define malloc_getpagesize EXEC_PAGESIZE\n" + +"# else\n" + +"# ifdef NBPG\n" + +"# ifndef CLSIZE\n" + +"# define malloc_getpagesize NBPG\n" + +"# else\n" + +"# define malloc_getpagesize (NBPG * CLSIZE)\n" + +"# endif\n" + +"# else\n" + +"# ifdef NBPC\n" + +"# define malloc_getpagesize NBPC\n" + +"# else\n" + +"# ifdef PAGESIZE\n" + +"# define malloc_getpagesize PAGESIZE\n" + +"# else /* just guess */\n" + +"# define malloc_getpagesize (4096)\n" + +"# endif\n" + +"# endif\n" + +"# endif\n" + +"# endif\n" + +"# endif\n" + +"# endif\n" + +"# endif\n" + +"#endif\n" + +"\n" + +"/*\n" + +" This version of malloc supports the standard SVID/XPG mallinfo\n" + +" routine that returns a struct containing usage properties and\n" + +" statistics. It should work on any SVID/XPG compliant system that has\n" + +" a /usr/include/malloc.h defining struct mallinfo. (If you'd like to\n" + +" install such a thing yourself, cut out the preliminary declarations\n" + +" as described above and below and save them in a malloc.h file. But\n" + +" there's no compelling reason to bother to do this.)\n" + +"\n" + +" The main declaration needed is the mallinfo struct that is returned\n" + +" (by-copy) by mallinfo(). The SVID/XPG malloinfo struct contains a\n" + +" bunch of fields that are not even meaningful in this version of\n" + +" malloc. These fields are are instead filled by mallinfo() with\n" + +" other numbers that might be of interest.\n" + +"\n" + +" HAVE_USR_INCLUDE_MALLOC_H should be set if you have a\n" + +" /usr/include/malloc.h file that includes a declaration of struct\n" + +" mallinfo. If so, it is included; else an SVID2/XPG2 compliant\n" + +" version is declared below. These must be precisely the same for\n" + +" mallinfo() to work. The original SVID version of this struct,\n" + +" defined on most systems with mallinfo, declares all fields as\n" + +" ints. But some others define as unsigned long. If your system\n" + +" defines the fields using a type of different width than listed here,\n" + +" you must #include your system version and #define\n" + +" HAVE_USR_INCLUDE_MALLOC_H.\n" + +"*/\n" + +"\n" + +"/* #define HAVE_USR_INCLUDE_MALLOC_H */\n" + +"\n" + +"#ifdef HAVE_USR_INCLUDE_MALLOC_H\n" + +"#include \"/usr/include/malloc.h\"\n" + +"#else\n" + +"\n" + +"/* SVID2/XPG mallinfo structure */\n" + +"\n" + +"struct mallinfo {\n" + +" int arena; /* non-mmapped space allocated from system */\n" + +" int ordblks; /* number of free chunks */\n" + +" int smblks; /* number of fastbin blocks */\n" + +" int hblks; /* number of mmapped regions */\n" + +" int hblkhd; /* space in mmapped regions */\n" + +" int usmblks; /* maximum total allocated space */\n" + +" int fsmblks; /* space available in freed fastbin blocks */\n" + +" int uordblks; /* total allocated space */\n" + +" int fordblks; /* total free space */\n" + +" int keepcost; /* top-most, releasable (via malloc_trim) space */\n" + +"};\n" + +"\n" + +"/*\n" + +" SVID/XPG defines four standard parameter numbers for mallopt,\n" + +" normally defined in malloc.h. Only one of these (M_MXFAST) is used\n" + +" in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply,\n" + +" so setting them has no effect. But this malloc also supports other\n" + +" options in mallopt described below.\n" + +"*/\n") + +("#endif\n" + +"\n" + +"\n" + +"/* ---------- description of public routines ------------ */\n" + +"\n" + +"/*\n" + +" malloc(size_t n)\n" + +" Returns a pointer to a newly allocated chunk of at least n bytes, or null\n" + +" if no space is available. Additionally, on failure, errno is\n" + +" set to ENOMEM on ANSI C systems.\n" + +"\n" + +" If n is zero, malloc returns a minumum-sized chunk. (The minimum\n" + +" size is 16 bytes on most 32bit systems, and 24 or 32 bytes on 64bit\n" + +" systems.) On most systems, size_t is an unsigned type, so calls\n" + +" with negative arguments are interpreted as requests for huge amounts\n" + +" of space, which will often fail. The maximum supported value of n\n" + +" differs across systems, but is in all cases less than the maximum\n" + +" representable value of a size_t.\n" + +"*/\n" + +"#if __STD_C\n" + +"Void_t* public_mALLOc(size_t);\n" + +"#else\n" + +"Void_t* public_mALLOc();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" free(Void_t* p)\n" + +" Releases the chunk of memory pointed to by p, that had been previously\n" + +" allocated using malloc or a related routine such as realloc.\n" + +" It has no effect if p is null. It can have arbitrary (i.e., bad!)\n" + +" effects if p has already been freed.\n" + +"\n" + +" Unless disabled (using mallopt), freeing very large spaces will\n" + +" when possible, automatically trigger operations that give\n" + +" back unused memory to the system, thus reducing program footprint.\n" + +"*/\n" + +"#if __STD_C\n" + +"void public_fREe(Void_t*);\n" + +"#else\n" + +"void public_fREe();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" calloc(size_t n_elements, size_t element_size);\n" + +" Returns a pointer to n_elements * element_size bytes, with all locations\n" + +" set to zero.\n" + +"*/\n" + +"#if __STD_C\n" + +"Void_t* public_cALLOc(size_t, size_t);\n" + +"#else\n" + +"Void_t* public_cALLOc();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" realloc(Void_t* p, size_t n)\n" + +" Returns a pointer to a chunk of size n that contains the same data\n" + +" as does chunk p up to the minimum of (n, p's size) bytes, or null\n" + +" if no space is available.\n" + +"\n" + +" The returned pointer may or may not be the same as p. The algorithm\n" + +" prefers extending p when possible, otherwise it employs the\n" + +" equivalent of a malloc-copy-free sequence.\n" + +"\n" + +" If p is null, realloc is equivalent to malloc.\n" + +"\n" + +" If space is not available, realloc returns null, errno is set (if on\n" + +" ANSI) and p is NOT freed.\n" + +"\n" + +" if n is for fewer bytes than already held by p, the newly unused\n" + +" space is lopped off and freed if possible. Unless the #define\n" + +" REALLOC_ZERO_BYTES_FREES is set, realloc with a size argument of\n" + +" zero (re)allocates a minimum-sized chunk.\n" + +"\n" + +" Large chunks that were internally obtained via mmap will always\n" + +" be reallocated using malloc-copy-free sequences unless\n" + +" the system supports MREMAP (currently only linux).\n" + +"\n" + +" The old unix realloc convention of allowing the last-free'd chunk\n" + +" to be used as an argument to realloc is not supported.\n" + +"*/\n" + +"#if __STD_C\n" + +"Void_t* public_rEALLOc(Void_t*, size_t);\n" + +"#else\n" + +"Void_t* public_rEALLOc();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" memalign(size_t alignment, size_t n);\n" + +" Returns a pointer to a newly allocated chunk of n bytes, aligned\n" + +" in accord with the alignment argument.\n" + +"\n" + +" The alignment argument should be a power of two. If the argument is\n" + +" not a power of two, the nearest greater power is used.\n" + +" 8-byte alignment is guaranteed by normal malloc calls, so don't\n" + +" bother calling memalign with an argument of 8 or less.\n" + +"\n" + +" Overreliance on memalign is a sure way to fragment space.\n" + +"*/\n" + +"#if __STD_C\n" + +"Void_t* public_mEMALIGn(size_t, size_t);\n" + +"#else\n" + +"Void_t* public_mEMALIGn();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" valloc(size_t n);\n" + +" Equivalent to memalign(pagesize, n), where pagesize is the page\n" + +" size of the system. If the pagesize is unknown, 4096 is used.\n" + +"*/\n" + +"#if __STD_C\n" + +"Void_t* public_vALLOc(size_t);\n" + +"#else\n" + +"Void_t* public_vALLOc();\n" + +"#endif\n" + +"\n" + +"\n" + +"\n" + +"/*\n" + +" mallopt(int parameter_number, int parameter_value)\n" + +" Sets tunable parameters The format is to provide a\n" + +" (parameter-number, parameter-value) pair. mallopt then sets the\n" + +" corresponding parameter to the argument value if it can (i.e., so\n" + +" long as the value is meaningful), and returns 1 if successful else\n" + +" 0. SVID/XPG/ANSI defines four standard param numbers for mallopt,\n" + +" normally defined in malloc.h. Only one of these (M_MXFAST) is used\n" + +" in this malloc. The others (M_NLBLKS, M_GRAIN, M_KEEP) don't apply,\n" + +" so setting them has no effect. But this malloc also supports four\n" + +" other options in mallopt. See below for details. Briefly, supported\n" + +" parameters are as follows (listed defaults are for \"typical\"\n" + +" configurations).\n" + +"\n" + +" Symbol param # default allowed param values\n" + +" M_MXFAST 1 64 0-80 (0 disables fastbins)\n" + +" M_TRIM_THRESHOLD -1 256*1024 any (-1U disables trimming)\n" + +" M_TOP_PAD -2 0 any\n" + +" M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support)\n" + +" M_MMAP_MAX -4 65536 any (0 disables use of mmap)\n" + +"*/\n" + +"#if __STD_C\n" + +"int public_mALLOPt(int, int);\n" + +"#else\n" + +"int public_mALLOPt();\n" + +"#endif\n" + +"\n" + +"\n" + +"/*\n" + +" mallinfo()\n" + +" Returns (by copy) a struct containing various summary statistics:\n" + +"\n") + +(" arena: current total non-mmapped bytes allocated from system\n" + +" ordblks: the number of free chunks\n" + +" smblks: the number of fastbin blocks (i.e., small chunks that\n" + +" have been freed but not use resused or consolidated)\n" + +" hblks: current number of mmapped regions\n" + +" hblkhd: total bytes held in mmapped regions\n" + +" usmblks: the maximum total allocated space. This will be greater\n" + +" than current total if trimming has occurred.\n" + +" fsmblks: total bytes held in fastbin blocks\n" + +" uordblks: current total allocated space (normal or mmapped)\n" + +" fordblks: total free space\n" + +" keepcost: the maximum number of bytes that could ideally be released\n" + +" back to system via malloc_trim. (\"ideally\" means that\n" + +" it ignores page restrictions etc.)\n" + +"\n" + +" Because these fields are ints, but internal bookkeeping may\n" + +" be kept as longs, the reported values may wrap around zero and\n" + +" thus be inaccurate.\n" + +"*/\n" + +"#if __STD_C\n" + +"struct mallinfo public_mALLINFo(void);\n" + +"#else\n" + +"struct mallinfo public_mALLINFo();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" independent_calloc(size_t n_elements, size_t element_size, Void_t* chunks[]);\n" + +"\n" + +" independent_calloc is similar to calloc, but instead of returning a\n" + +" single cleared space, it returns an array of pointers to n_elements\n" + +" independent elements that can hold contents of size elem_size, each\n" + +" of which starts out cleared, and can be independently freed,\n" + +" realloc'ed etc. The elements are guaranteed to be adjacently\n" + +" allocated (this is not guaranteed to occur with multiple callocs or\n" + +" mallocs), which may also improve cache locality in some\n" + +" applications.\n" + +"\n" + +" The \"chunks\" argument is optional (i.e., may be null, which is\n" + +" probably the most typical usage). If it is null, the returned array\n" + +" is itself dynamically allocated and should also be freed when it is\n" + +" no longer needed. Otherwise, the chunks array must be of at least\n" + +" n_elements in length. It is filled in with the pointers to the\n" + +" chunks.\n" + +"\n" + +" In either case, independent_calloc returns this pointer array, or\n" + +" null if the allocation failed. If n_elements is zero and \"chunks\"\n" + +" is null, it returns a chunk representing an array with zero elements\n" + +" (which should be freed if not wanted).\n" + +"\n" + +" Each element must be individually freed when it is no longer\n" + +" needed. If you'd like to instead be able to free all at once, you\n" + +" should instead use regular calloc and assign pointers into this\n" + +" space to represent elements. (In this case though, you cannot\n" + +" independently free elements.)\n" + +"\n" + +" independent_calloc simplifies and speeds up implementations of many\n" + +" kinds of pools. It may also be useful when constructing large data\n" + +" structures that initially have a fixed number of fixed-sized nodes,\n" + +" but the number is not known at compile time, and some of the nodes\n" + +" may later need to be freed. For example:\n" + +"\n" + +" struct Node { int item; struct Node* next; };\n" + +"\n" + +" struct Node* build_list() {\n" + +" struct Node** pool;\n" + +" int n = read_number_of_nodes_needed();\n" + +" if (n <= 0) return 0;\n" + +" pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0);\n" + +" if (pool == 0) die();\n" + +" // organize into a linked list...\n" + +" struct Node* first = pool[0];\n" + +" for (i = 0; i < n-1; ++i)\n" + +" pool[i]->next = pool[i+1];\n" + +" free(pool); // Can now free the array (or not, if it is needed later)\n" + +" return first;\n" + +" }\n" + +"*/\n" + +"#if __STD_C\n" + +"Void_t** public_iCALLOc(size_t, size_t, Void_t**);\n" + +"#else\n" + +"Void_t** public_iCALLOc();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" independent_comalloc(size_t n_elements, size_t sizes[], Void_t* chunks[]);\n" + +"\n" + +" independent_comalloc allocates, all at once, a set of n_elements\n" + +" chunks with sizes indicated in the \"sizes\" array. It returns\n" + +" an array of pointers to these elements, each of which can be\n" + +" independently freed, realloc'ed etc. The elements are guaranteed to\n" + +" be adjacently allocated (this is not guaranteed to occur with\n" + +" multiple callocs or mallocs), which may also improve cache locality\n" + +" in some applications.\n" + +"\n" + +" The \"chunks\" argument is optional (i.e., may be null). If it is null\n" + +" the returned array is itself dynamically allocated and should also\n" + +" be freed when it is no longer needed. Otherwise, the chunks array\n" + +" must be of at least n_elements in length. It is filled in with the\n" + +" pointers to the chunks.\n" + +"\n" + +" In either case, independent_comalloc returns this pointer array, or\n" + +" null if the allocation failed. If n_elements is zero and chunks is\n" + +" null, it returns a chunk representing an array with zero elements\n" + +" (which should be freed if not wanted).\n" + +"\n" + +" Each element must be individually freed when it is no longer\n" + +" needed. If you'd like to instead be able to free all at once, you\n" + +" should instead use a single regular malloc, and assign pointers at\n" + +" particular offsets in the aggregate space. (In this case though, you\n" + +" cannot independently free elements.)\n" + +"\n" + +" independent_comallac differs from independent_calloc in that each\n" + +" element may have a different size, and also that it does not\n" + +" automatically clear elements.\n" + +"\n" + +" independent_comalloc can be used to speed up allocation in cases\n" + +" where several structs or objects must always be allocated at the\n" + +" same time. For example:\n" + +"\n" + +" struct Head { ... }\n" + +" struct Foot { ... }\n" + +"\n" + +" void send_message(char* msg) {\n" + +" int msglen = strlen(msg);\n" + +" size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) };\n" + +" void* chunks[3];\n" + +" if (independent_comalloc(3, sizes, chunks) == 0)\n" + +" die();\n" + +" struct Head* head = (struct Head*)(chunks[0]);\n" + +" char* body = (char*)(chunks[1]);\n" + +" struct Foot* foot = (struct Foot*)(chunks[2]);\n" + +" // ...\n" + +" }\n" + +"\n" + +" In general though, independent_comalloc is worth using only for\n" + +" larger values of n_elements. For small values, you probably won't\n" + +" detect enough difference from series of malloc calls to bother.\n" + +"\n" + +" Overuse of independent_comalloc can increase overall memory usage,\n" + +" since it cannot reuse existing noncontiguous small chunks that\n" + +" might be available for some of the elements.\n" + +"*/\n" + +"#if __STD_C\n" + +"Void_t** public_iCOMALLOc(size_t, size_t*, Void_t**);\n" + +"#else\n" + +"Void_t** public_iCOMALLOc();\n" + +"#endif\n" + +"\n" + +"\n" + +"/*\n") + +(" pvalloc(size_t n);\n" + +" Equivalent to valloc(minimum-page-that-holds(n)), that is,\n" + +" round up n to nearest pagesize.\n" + +" */\n" + +"#if __STD_C\n" + +"Void_t* public_pVALLOc(size_t);\n" + +"#else\n" + +"Void_t* public_pVALLOc();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" cfree(Void_t* p);\n" + +" Equivalent to free(p).\n" + +"\n" + +" cfree is needed/defined on some systems that pair it with calloc,\n" + +" for odd historical reasons (such as: cfree is used in example\n" + +" code in the first edition of K&R).\n" + +"*/\n" + +"#if __STD_C\n" + +"void public_cFREe(Void_t*);\n" + +"#else\n" + +"void public_cFREe();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" malloc_trim(size_t pad);\n" + +"\n" + +" If possible, gives memory back to the system (via negative\n" + +" arguments to sbrk) if there is unused memory at the `high' end of\n" + +" the malloc pool. You can call this after freeing large blocks of\n" + +" memory to potentially reduce the system-level memory requirements\n" + +" of a program. However, it cannot guarantee to reduce memory. Under\n" + +" some allocation patterns, some large free blocks of memory will be\n" + +" locked between two used chunks, so they cannot be given back to\n" + +" the system.\n" + +"\n" + +" The `pad' argument to malloc_trim represents the amount of free\n" + +" trailing space to leave untrimmed. If this argument is zero,\n" + +" only the minimum amount of memory to maintain internal data\n" + +" structures will be left (one page or less). Non-zero arguments\n" + +" can be supplied to maintain enough trailing space to service\n" + +" future expected allocations without having to re-obtain memory\n" + +" from the system.\n" + +"\n" + +" Malloc_trim returns 1 if it actually released any memory, else 0.\n" + +" On systems that do not support \"negative sbrks\", it will always\n" + +" rreturn 0.\n" + +"*/\n" + +"#if __STD_C\n" + +"int public_mTRIm(size_t);\n" + +"#else\n" + +"int public_mTRIm();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" malloc_usable_size(Void_t* p);\n" + +"\n" + +" Returns the number of bytes you can actually use in\n" + +" an allocated chunk, which may be more than you requested (although\n" + +" often not) due to alignment and minimum size constraints.\n" + +" You can use this many bytes without worrying about\n" + +" overwriting other allocated objects. This is not a particularly great\n" + +" programming practice. malloc_usable_size can be more useful in\n" + +" debugging and assertions, for example:\n" + +"\n" + +" p = malloc(n);\n" + +" assert(malloc_usable_size(p) >= 256);\n" + +"\n" + +"*/\n" + +"#if __STD_C\n" + +"size_t public_mUSABLe(Void_t*);\n" + +"#else\n" + +"size_t public_mUSABLe();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" malloc_stats();\n" + +" Prints on stderr the amount of space obtained from the system (both\n" + +" via sbrk and mmap), the maximum amount (which may be more than\n" + +" current if malloc_trim and/or munmap got called), and the current\n" + +" number of bytes allocated via malloc (or realloc, etc) but not yet\n" + +" freed. Note that this is the number of bytes allocated, not the\n" + +" number requested. It will be larger than the number requested\n" + +" because of alignment and bookkeeping overhead. Because it includes\n" + +" alignment wastage as being in use, this figure may be greater than\n" + +" zero even when no user-level chunks are allocated.\n" + +"\n" + +" The reported current and maximum system memory can be inaccurate if\n" + +" a program makes other calls to system memory allocation functions\n" + +" (normally sbrk) outside of malloc.\n" + +"\n" + +" malloc_stats prints only the most commonly interesting statistics.\n" + +" More information can be obtained by calling mallinfo.\n" + +"\n" + +"*/\n" + +"#if __STD_C\n" + +"void public_mSTATs();\n" + +"#else\n" + +"void public_mSTATs();\n" + +"#endif\n" + +"\n" + +"/* mallopt tuning options */\n" + +"\n" + +"/*\n" + +" M_MXFAST is the maximum request size used for \"fastbins\", special bins\n" + +" that hold returned chunks without consolidating their spaces. This\n" + +" enables future requests for chunks of the same size to be handled\n" + +" very quickly, but can increase fragmentation, and thus increase the\n" + +" overall memory footprint of a program.\n" + +"\n" + +" This malloc manages fastbins very conservatively yet still\n" + +" efficiently, so fragmentation is rarely a problem for values less\n" + +" than or equal to the default. The maximum supported value of MXFAST\n" + +" is 80. You wouldn't want it any higher than this anyway. Fastbins\n" + +" are designed especially for use with many small structs, objects or\n" + +" strings -- the default handles structs/objects/arrays with sizes up\n" + +" to 16 4byte fields, or small strings representing words, tokens,\n" + +" etc. Using fastbins for larger objects normally worsens\n" + +" fragmentation without improving speed.\n" + +"\n" + +" M_MXFAST is set in REQUEST size units. It is internally used in\n" + +" chunksize units, which adds padding and alignment. You can reduce\n" + +" M_MXFAST to 0 to disable all use of fastbins. This causes the malloc\n" + +" algorithm to be a closer approximation of fifo-best-fit in all cases,\n" + +" not just for larger requests, but will generally cause it to be\n" + +" slower.\n" + +"*/\n" + +"\n" + +"\n" + +"/* M_MXFAST is a standard SVID/XPG tuning option, usually listed in malloc.h */\n" + +"#ifndef M_MXFAST\n" + +"#define M_MXFAST 1\n" + +"#endif\n" + +"\n" + +"#ifndef DEFAULT_MXFAST\n" + +"#define DEFAULT_MXFAST 64\n" + +"#endif\n" + +"\n" + +"\n" + +"/*\n" + +" M_TRIM_THRESHOLD is the maximum amount of unused top-most memory\n" + +" to keep before releasing via malloc_trim in free().\n" + +"\n" + +" Automatic trimming is mainly useful in long-lived programs.\n" + +" Because trimming via sbrk can be slow on some systems, and can\n" + +" sometimes be wasteful (in cases where programs immediately\n" + +" afterward allocate more large chunks) the value should be high\n" + +" enough so that your overall system performance would improve by\n" + +" releasing this much memory.\n" + +"\n") + +(" The trim threshold and the mmap control parameters (see below)\n" + +" can be traded off with one another. Trimming and mmapping are\n" + +" two different ways of releasing unused memory back to the\n" + +" system. Between these two, it is often possible to keep\n" + +" system-level demands of a long-lived program down to a bare\n" + +" minimum. For example, in one test suite of sessions measuring\n" + +" the XF86 X server on Linux, using a trim threshold of 128K and a\n" + +" mmap threshold of 192K led to near-minimal long term resource\n" + +" consumption.\n" + +"\n" + +" If you are using this malloc in a long-lived program, it should\n" + +" pay to experiment with these values. As a rough guide, you\n" + +" might set to a value close to the average size of a process\n" + +" (program) running on your system. Releasing this much memory\n" + +" would allow such a process to run in memory. Generally, it's\n" + +" worth it to tune for trimming rather tham memory mapping when a\n" + +" program undergoes phases where several large chunks are\n" + +" allocated and released in ways that can reuse each other's\n" + +" storage, perhaps mixed with phases where there are no such\n" + +" chunks at all. And in well-behaved long-lived programs,\n" + +" controlling release of large blocks via trimming versus mapping\n" + +" is usually faster.\n" + +"\n" + +" However, in most programs, these parameters serve mainly as\n" + +" protection against the system-level effects of carrying around\n" + +" massive amounts of unneeded memory. Since frequent calls to\n" + +" sbrk, mmap, and munmap otherwise degrade performance, the default\n" + +" parameters are set to relatively high values that serve only as\n" + +" safeguards.\n" + +"\n" + +" The trim value must be greater than page size to have any useful\n" + +" effect. To disable trimming completely, you can set to\n" + +" (unsigned long)(-1)\n" + +"\n" + +" Trim settings interact with fastbin (MXFAST) settings: Unless\n" + +" TRIM_FASTBINS is defined, automatic trimming never takes place upon\n" + +" freeing a chunk with size less than or equal to MXFAST. Trimming is\n" + +" instead delayed until subsequent freeing of larger chunks. However,\n" + +" you can still force an attempted trim by calling malloc_trim.\n" + +"\n" + +" Also, trimming is not generally possible in cases where\n" + +" the main arena is obtained via mmap.\n" + +"\n" + +" Note that the trick some people use of mallocing a huge space and\n" + +" then freeing it at program startup, in an attempt to reserve system\n" + +" memory, doesn't have the intended effect under automatic trimming,\n" + +" since that memory will immediately be returned to the system.\n" + +"*/\n" + +"\n" + +"#define M_TRIM_THRESHOLD -1\n" + +"\n" + +"#ifndef DEFAULT_TRIM_THRESHOLD\n" + +"#define DEFAULT_TRIM_THRESHOLD (256 * 1024)\n" + +"#endif\n" + +"\n" + +"/*\n" + +" M_TOP_PAD is the amount of extra `padding' space to allocate or\n" + +" retain whenever sbrk is called. It is used in two ways internally:\n" + +"\n" + +" * When sbrk is called to extend the top of the arena to satisfy\n" + +" a new malloc request, this much padding is added to the sbrk\n" + +" request.\n" + +"\n" + +" * When malloc_trim is called automatically from free(),\n" + +" it is used as the `pad' argument.\n" + +"\n" + +" In both cases, the actual amount of padding is rounded\n" + +" so that the end of the arena is always a system page boundary.\n" + +"\n" + +" The main reason for using padding is to avoid calling sbrk so\n" + +" often. Having even a small pad greatly reduces the likelihood\n" + +" that nearly every malloc request during program start-up (or\n" + +" after trimming) will invoke sbrk, which needlessly wastes\n" + +" time.\n" + +"\n" + +" Automatic rounding-up to page-size units is normally sufficient\n" + +" to avoid measurable overhead, so the default is 0. However, in\n" + +" systems where sbrk is relatively slow, it can pay to increase\n" + +" this value, at the expense of carrying around more memory than\n" + +" the program needs.\n" + +"*/\n" + +"\n" + +"#define M_TOP_PAD -2\n" + +"\n" + +"#ifndef DEFAULT_TOP_PAD\n" + +"#define DEFAULT_TOP_PAD (0)\n" + +"#endif\n" + +"\n" + +"/*\n" + +" M_MMAP_THRESHOLD is the request size threshold for using mmap()\n" + +" to service a request. Requests of at least this size that cannot\n" + +" be allocated using already-existing space will be serviced via mmap.\n" + +" (If enough normal freed space already exists it is used instead.)\n" + +"\n" + +" Using mmap segregates relatively large chunks of memory so that\n" + +" they can be individually obtained and released from the host\n" + +" system. A request serviced through mmap is never reused by any\n" + +" other request (at least not directly; the system may just so\n" + +" happen to remap successive requests to the same locations).\n" + +"\n" + +" Segregating space in this way has the benefits that:\n" + +"\n" + +" 1. Mmapped space can ALWAYS be individually released back\n" + +" to the system, which helps keep the system level memory\n" + +" demands of a long-lived program low.\n" + +" 2. Mapped memory can never become `locked' between\n" + +" other chunks, as can happen with normally allocated chunks, which\n" + +" means that even trimming via malloc_trim would not release them.\n" + +" 3. On some systems with \"holes\" in address spaces, mmap can obtain\n" + +" memory that sbrk cannot.\n" + +"\n" + +" However, it has the disadvantages that:\n" + +"\n" + +" 1. The space cannot be reclaimed, consolidated, and then\n" + +" used to service later requests, as happens with normal chunks.\n" + +" 2. It can lead to more wastage because of mmap page alignment\n" + +" requirements\n" + +" 3. It causes malloc performance to be more dependent on host\n" + +" system memory management support routines which may vary in\n" + +" implementation quality and may impose arbitrary\n" + +" limitations. Generally, servicing a request via normal\n" + +" malloc steps is faster than going through a system's mmap.\n" + +"\n" + +" The advantages of mmap nearly always outweigh disadvantages for\n" + +" \"large\" chunks, but the value of \"large\" varies across systems. The\n" + +" default is an empirically derived value that works well in most\n" + +" systems.\n" + +"*/\n" + +"\n" + +"#define M_MMAP_THRESHOLD -3\n" + +"\n" + +"#ifndef DEFAULT_MMAP_THRESHOLD\n" + +"#define DEFAULT_MMAP_THRESHOLD (256 * 1024)\n" + +"#endif\n" + +"\n" + +"/*\n" + +" M_MMAP_MAX is the maximum number of requests to simultaneously\n" + +" service using mmap. This parameter exists because\n" + +". Some systems have a limited number of internal tables for\n" + +" use by mmap, and using more than a few of them may degrade\n" + +" performance.\n" + +"\n" + +" The default is set to a value that serves only as a safeguard.\n" + +" Setting to 0 disables use of mmap for servicing large requests. If\n" + +" HAVE_MMAP is not set, the default value is 0, and attempts to set it\n" + +" to non-zero values in mallopt will fail.\n" + +"*/\n" + +"\n" + +"#define M_MMAP_MAX -4\n" + +"\n") + +("#ifndef DEFAULT_MMAP_MAX\n" + +"#if HAVE_MMAP\n" + +"#define DEFAULT_MMAP_MAX (65536)\n" + +"#else\n" + +"#define DEFAULT_MMAP_MAX (0)\n" + +"#endif\n" + +"#endif\n" + +"\n" + +"/*\n" + +" ========================================================================\n" + +" To make a fully customizable malloc.h header file, cut everything\n" + +" above this line, put into file malloc.h, edit to suit, and #include it\n" + +" on the next line, as well as in programs that use this malloc.\n" + +" ========================================================================\n" + +"*/\n" + +"\n" + +"/* #include \"malloc.h\" */\n" + +"\n" + +"/* --------------------- public wrappers ---------------------- */\n" + +"\n" + +"#ifdef USE_PUBLIC_MALLOC_WRAPPERS\n" + +"\n" + +"/* Declare all routines as internal */\n" + +"#if __STD_C\n" + +"static Void_t* mALLOc(size_t);\n" + +"static void fREe(Void_t*);\n" + +"static Void_t* rEALLOc(Void_t*, size_t);\n" + +"static Void_t* mEMALIGn(size_t, size_t);\n" + +"static Void_t* vALLOc(size_t);\n" + +"static Void_t* pVALLOc(size_t);\n" + +"static Void_t* cALLOc(size_t, size_t);\n" + +"static Void_t** iCALLOc(size_t, size_t, Void_t**);\n" + +"static Void_t** iCOMALLOc(size_t, size_t*, Void_t**);\n" + +"static void cFREe(Void_t*);\n" + +"static int mTRIm(size_t);\n" + +"static size_t mUSABLe(Void_t*);\n" + +"static void mSTATs();\n" + +"static int mALLOPt(int, int);\n" + +"static struct mallinfo mALLINFo(void);\n" + +"#else\n" + +"static Void_t* mALLOc();\n" + +"static void fREe();\n" + +"static Void_t* rEALLOc();\n" + +"static Void_t* mEMALIGn();\n" + +"static Void_t* vALLOc();\n" + +"static Void_t* pVALLOc();\n" + +"static Void_t* cALLOc();\n" + +"static Void_t** iCALLOc();\n" + +"static Void_t** iCOMALLOc();\n" + +"static void cFREe();\n" + +"static int mTRIm();\n" + +"static size_t mUSABLe();\n" + +"static void mSTATs();\n" + +"static int mALLOPt();\n" + +"static struct mallinfo mALLINFo();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" MALLOC_PREACTION and MALLOC_POSTACTION should be\n" + +" defined to return 0 on success, and nonzero on failure.\n" + +" The return value of MALLOC_POSTACTION is currently ignored\n" + +" in wrapper functions since there is no reasonable default\n" + +" action to take on failure.\n" + +"*/\n" + +"\n" + +"\n" + +"#ifdef USE_MALLOC_LOCK\n" + +"\n" + +"#ifdef WIN32\n" + +"\n" + +"static int mALLOC_MUTEx;\n" + +"#define MALLOC_PREACTION slwait(&mALLOC_MUTEx)\n" + +"#define MALLOC_POSTACTION slrelease(&mALLOC_MUTEx)\n" + +"\n" + +"#else\n" + +"\n" + +"#include <pthread.h>\n" + +"\n" + +"static pthread_mutex_t mALLOC_MUTEx = PTHREAD_MUTEX_INITIALIZER;\n" + +"\n" + +"#define MALLOC_PREACTION pthread_mutex_lock(&mALLOC_MUTEx)\n" + +"#define MALLOC_POSTACTION pthread_mutex_unlock(&mALLOC_MUTEx)\n" + +"\n" + +"#endif /* USE_MALLOC_LOCK */\n" + +"\n" + +"#else\n" + +"\n" + +"/* Substitute anything you like for these */\n" + +"\n" + +"#define MALLOC_PREACTION (0)\n" + +"#define MALLOC_POSTACTION (0)\n" + +"\n" + +"#endif\n" + +"\n" + +"Void_t* public_mALLOc(size_t bytes) {\n" + +" Void_t* m;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" m = mALLOc(bytes);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"\n" + +"static pthread_once_t free_mutex_once = PTHREAD_ONCE_INIT;\n" + +"static pthread_mutex_t free_mutex;\n" + +"static int scheduled_free_size;\n" + +"static int scheduled_free_capacity;\n" + +"static int scheduled_free_list;\n" + +"bool free_is_scheduled;\n" + +"\n" + +"static void initialize_scheduled_free_list()\n" + +"{\n" + +" pthread_mutex_init(&free_mutex, NULL);\n" + +"}\n" + +"\n" + +"static void drain_scheduled_free_list()\n" + +"{\n" + +" pthread_mutex_lock(&free_mutex);\n" + +" if (free_is_scheduled) {\n" + +" for(int i = 0; i < scheduled_free_size; i++) {\n" + +" main_thread_free(scheduled_free_list[i]);\n" + +" }\n" + +" free(scheduled_free_list);\n" + +" scheduled_free_list = NULL;\n" + +" scheduled_free_size = 0;\n" + +" scheduled_free_capacity = 0;\n" + +" free_is_scheduled = false;\n" + +" }\n" + +" pthread_mutex_unlock(&free_mutex);\n" + +"}\n" + +"\n" + +"static void schedule_free_on_main_thread(Void_t* m)\n" + +"{\n" + +" pthread_once(&free_mutex_once, initialize_scheduled_free_list);\n" + +"\n" + +" pthread_mutex_lock(&free_mutex);\n" + +" if (scheduled_free_size == scheduled_free_capacity) {\n" + +" scheduled_free_capacity = scheduled_free_capacity == 0 ? 16 : scheduled_free_capacity * 1.2;\n" + +" scheduled_free_list = (Void_t**)realloc(scheduled_free_list, sizeof(Void_t*) * scheduled_free_capacity);\n" + +" }\n" + +" scheduled_free_list[scheduled_free_size++] = m;\n" + +" if (!free_is_scheduled) {\n" + +" QTimer::immediateSingleShotOnMainThread(0, drain_scheduled_free_list);\n" + +" free_is_scheduled = true;\n" + +" }\n" + +" pthread_mutex_unlock(&free_mutex);\n" + +"}\n") + +("\n" + +"void public_fREe(Void_t* m) {\n" + +" if (!pthread_main_np()) {\n" + +" schedule_free_on_main_thread(m);\n" + +" return;\n" + +" }\n" + +"\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return;\n" + +" }\n" + +" fREe(m);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +"}\n" + +"\n" + +"Void_t* public_rEALLOc(Void_t* m, size_t bytes) {\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" m = rEALLOc(m, bytes);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"Void_t* public_mEMALIGn(size_t alignment, size_t bytes) {\n" + +" Void_t* m;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" m = mEMALIGn(alignment, bytes);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"Void_t* public_vALLOc(size_t bytes) {\n" + +" Void_t* m;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" m = vALLOc(bytes);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"Void_t* public_pVALLOc(size_t bytes) {\n" + +" Void_t* m;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" m = pVALLOc(bytes);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"Void_t* public_cALLOc(size_t n, size_t elem_size) {\n" + +" Void_t* m;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" m = cALLOc(n, elem_size);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"\n" + +"Void_t** public_iCALLOc(size_t n, size_t elem_size, Void_t** chunks) {\n" + +" Void_t** m;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" m = iCALLOc(n, elem_size, chunks);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"Void_t** public_iCOMALLOc(size_t n, size_t sizes[], Void_t** chunks) {\n" + +" Void_t** m;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" m = iCOMALLOc(n, sizes, chunks);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"void public_cFREe(Void_t* m) {\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return;\n" + +" }\n" + +" cFREe(m);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +"}\n" + +"\n" + +"int public_mTRIm(size_t s) {\n" + +" int result;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" result = mTRIm(s);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return result;\n" + +"}\n" + +"\n" + +"size_t public_mUSABLe(Void_t* m) {\n" + +" size_t result;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" result = mUSABLe(m);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return result;\n" + +"}\n" + +"\n" + +"void public_mSTATs() {\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return;\n" + +" }\n" + +" mSTATs();\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +"}\n" + +"\n" + +"struct mallinfo public_mALLINFo() {\n" + +" struct mallinfo m;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };\n" + +" return nm;\n" + +" }\n" + +" m = mALLINFo();\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return m;\n" + +"}\n" + +"\n" + +"int public_mALLOPt(int p, int v) {\n" + +" int result;\n" + +" if (MALLOC_PREACTION != 0) {\n" + +" return 0;\n" + +" }\n" + +" result = mALLOPt(p, v);\n" + +" if (MALLOC_POSTACTION != 0) {\n" + +" }\n" + +" return result;\n" + +"}\n" + +"\n") + +("#endif\n" + +"\n" + +"\n" + +"\n" + +"/* ------------- Optional versions of memcopy ---------------- */\n" + +"\n" + +"\n" + +"#if USE_MEMCPY\n" + +"\n" + +"/*\n" + +" Note: memcpy is ONLY invoked with non-overlapping regions,\n" + +" so the (usually slower) memmove is not needed.\n" + +"*/\n" + +"\n" + +"#define MALLOC_COPY(dest, src, nbytes) memcpy(dest, src, nbytes)\n" + +"#define MALLOC_ZERO(dest, nbytes) memset(dest, 0, nbytes)\n" + +"\n" + +"#else /* !USE_MEMCPY */\n" + +"\n" + +"/* Use Duff's device for good zeroing/copying performance. */\n" + +"\n" + +"#define MALLOC_ZERO(charp, nbytes) \\n" + +"do { \\n" + +" INTERNAL_SIZE_T* mzp = (INTERNAL_SIZE_T*)(charp); \\n" + +" CHUNK_SIZE_T mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T); \\n" + +" long mcn; \\n" + +" if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \\n" + +" switch (mctmp) { \\n" + +" case 0: for(;;) { *mzp++ = 0; \\n" + +" case 7: *mzp++ = 0; \\n" + +" case 6: *mzp++ = 0; \\n" + +" case 5: *mzp++ = 0; \\n" + +" case 4: *mzp++ = 0; \\n" + +" case 3: *mzp++ = 0; \\n" + +" case 2: *mzp++ = 0; \\n" + +" case 1: *mzp++ = 0; if(mcn <= 0) break; mcn--; } \\n" + +" } \\n" + +"} while(0)\n" + +"\n" + +"#define MALLOC_COPY(dest,src,nbytes) \\n" + +"do { \\n" + +" INTERNAL_SIZE_T* mcsrc = (INTERNAL_SIZE_T*) src; \\n" + +" INTERNAL_SIZE_T* mcdst = (INTERNAL_SIZE_T*) dest; \\n" + +" CHUNK_SIZE_T mctmp = (nbytes)/sizeof(INTERNAL_SIZE_T); \\n" + +" long mcn; \\n" + +" if (mctmp < 8) mcn = 0; else { mcn = (mctmp-1)/8; mctmp %= 8; } \\n" + +" switch (mctmp) { \\n" + +" case 0: for(;;) { *mcdst++ = *mcsrc++; \\n" + +" case 7: *mcdst++ = *mcsrc++; \\n" + +" case 6: *mcdst++ = *mcsrc++; \\n" + +" case 5: *mcdst++ = *mcsrc++; \\n" + +" case 4: *mcdst++ = *mcsrc++; \\n" + +" case 3: *mcdst++ = *mcsrc++; \\n" + +" case 2: *mcdst++ = *mcsrc++; \\n" + +" case 1: *mcdst++ = *mcsrc++; if(mcn <= 0) break; mcn--; } \\n" + +" } \\n" + +"} while(0)\n" + +"\n" + +"#endif\n" + +"\n" + +"/* ------------------ MMAP support ------------------ */\n" + +"\n" + +"\n" + +"#if HAVE_MMAP\n" + +"\n" + +"#ifndef LACKS_FCNTL_H\n" + +"#include <fcntl.h>\n" + +"#endif\n" + +"\n" + +"#ifndef LACKS_SYS_MMAN_H\n" + +"#include <sys/mman.h>\n" + +"#endif\n" + +"\n" + +"#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON)\n" + +"#define MAP_ANONYMOUS MAP_ANON\n" + +"#endif\n" + +"\n" + +"/*\n" + +" Nearly all versions of mmap support MAP_ANONYMOUS,\n" + +" so the following is unlikely to be needed, but is\n" + +" supplied just in case.\n" + +"*/\n" + +"\n" + +"#ifndef MAP_ANONYMOUS\n" + +"\n" + +"static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */\n" + +"\n" + +"#define MMAP(addr, size, prot, flags) ((dev_zero_fd < 0) ? \\n" + +" (dev_zero_fd = open(\"/dev/zero\", O_RDWR), \\n" + +" mmap((addr), (size), (prot), (flags), dev_zero_fd, 0)) : \\n" + +" mmap((addr), (size), (prot), (flags), dev_zero_fd, 0))\n" + +"\n" + +"#else\n" + +"\n" + +"#define MMAP(addr, size, prot, flags) \\n" + +" (mmap((addr), (size), (prot), (flags)|MAP_ANONYMOUS, -1, 0))\n" + +"\n" + +"#endif\n" + +"\n" + +"\n" + +"#endif /* HAVE_MMAP */\n" + +"\n" + +"\n" + +"/*\n" + +" ----------------------- Chunk representations -----------------------\n" + +"*/\n" + +"\n" + +"\n" + +"/*\n" + +" This struct declaration is misleading (but accurate and necessary).\n" + +" It declares a \"view\" into memory allowing access to necessary\n" + +" fields at known offsets from a given base. See explanation below.\n" + +"*/\n" + +"\n" + +"struct malloc_chunk {\n" + +"\n" + +" INTERNAL_SIZE_T prev_size; /* Size of previous chunk (if free). */\n" + +" INTERNAL_SIZE_T size; /* Size in bytes, including overhead. */\n" + +"\n" + +" struct malloc_chunk* fd; /* double links -- used only if free. */\n" + +" struct malloc_chunk* bk;\n" + +"};\n" + +"\n" + +"\n" + +"typedef struct malloc_chunk* mchunkptr;\n" + +"\n" + +"/*\n" + +" malloc_chunk details:\n" + +"\n" + +" (The following includes lightly edited explanations by Colin Plumb.)\n" + +"\n" + +" Chunks of memory are maintained using a `boundary tag' method as\n" + +" described in e.g., Knuth or Standish. (See the paper by Paul\n" + +" Wilson ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a\n" + +" survey of such techniques.) Sizes of free chunks are stored both\n" + +" in the front of each chunk and at the end. This makes\n" + +" consolidating fragmented chunks into bigger chunks very fast. The\n" + +" size fields also hold bits representing whether chunks are free or\n" + +" in use.\n" + +"\n" + +" An allocated chunk looks like this:\n" + +"\n" + +"\n" + +" chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" | Size of previous chunk, if allocated | |\n" + +" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" | Size of chunk, in bytes |P|\n" + +" mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" | User data starts here... .\n" + +" . .\n" + +" . (malloc_usable_space() bytes) .\n" + +" . |\n" + +"nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" | Size of chunk |\n" + +" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +"\n") + +("\n" + +" Where \"chunk\" is the front of the chunk for the purpose of most of\n" + +" the malloc code, but \"mem\" is the pointer that is returned to the\n" + +" user. \"Nextchunk\" is the beginning of the next contiguous chunk.\n" + +"\n" + +" Chunks always begin on even word boundries, so the mem portion\n" + +" (which is returned to the user) is also on an even word boundary, and\n" + +" thus at least double-word aligned.\n" + +"\n" + +" Free chunks are stored in circular doubly-linked lists, and look like this:\n" + +"\n" + +" chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" | Size of previous chunk |\n" + +" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" `head:' | Size of chunk, in bytes |P|\n" + +" mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" | Forward pointer to next chunk in list |\n" + +" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" | Back pointer to previous chunk in list |\n" + +" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" | Unused space (may be 0 bytes long) .\n" + +" . .\n" + +" . |\n" + +"nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +" `foot:' | Size of chunk, in bytes |\n" + +" +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+\n" + +"\n" + +" The P (PREV_INUSE) bit, stored in the unused low-order bit of the\n" + +" chunk size (which is always a multiple of two words), is an in-use\n" + +" bit for the *previous* chunk. If that bit is *clear*, then the\n" + +" word before the current chunk size contains the previous chunk\n" + +" size, and can be used to find the front of the previous chunk.\n" + +" The very first chunk allocated always has this bit set,\n" + +" preventing access to non-existent (or non-owned) memory. If\n" + +" prev_inuse is set for any given chunk, then you CANNOT determine\n" + +" the size of the previous chunk, and might even get a memory\n" + +" addressing fault when trying to do so.\n" + +"\n" + +" Note that the `foot' of the current chunk is actually represented\n" + +" as the prev_size of the NEXT chunk. This makes it easier to\n" + +" deal with alignments etc but can be very confusing when trying\n" + +" to extend or adapt this code.\n" + +"\n" + +" The two exceptions to all this are\n" + +"\n" + +" 1. The special chunk `top' doesn't bother using the\n" + +" trailing size field since there is no next contiguous chunk\n" + +" that would have to index off it. After initialization, `top'\n" + +" is forced to always exist. If it would become less than\n" + +" MINSIZE bytes long, it is replenished.\n" + +"\n" + +" 2. Chunks allocated via mmap, which have the second-lowest-order\n" + +" bit (IS_MMAPPED) set in their size fields. Because they are\n" + +" allocated one-by-one, each must contain its own trailing size field.\n" + +"\n" + +"*/\n" + +"\n" + +"/*\n" + +" ---------- Size and alignment checks and conversions ----------\n" + +"*/\n" + +"\n" + +"/* conversion from malloc headers to user pointers, and back */\n" + +"\n" + +"#define chunk2mem(p) ((Void_t*)((char*)(p) + 2*SIZE_SZ))\n" + +"#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - 2*SIZE_SZ))\n" + +"\n" + +"/* The smallest possible chunk */\n" + +"#define MIN_CHUNK_SIZE (sizeof(struct malloc_chunk))\n" + +"\n" + +"/* The smallest size we can malloc is an aligned minimal chunk */\n" + +"\n" + +"#define MINSIZE \\n" + +" (CHUNK_SIZE_T)(((MIN_CHUNK_SIZE+MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK))\n" + +"\n" + +"/* Check if m has acceptable alignment */\n" + +"\n" + +"#define aligned_OK(m) (((PTR_UINT)((m)) & (MALLOC_ALIGN_MASK)) == 0)\n" + +"\n" + +"\n" + +"/*\n" + +" Check if a request is so large that it would wrap around zero when\n" + +" padded and aligned. To simplify some other code, the bound is made\n" + +" low enough so that adding MINSIZE will also not wrap around sero.\n" + +"*/\n" + +"\n" + +"#define REQUEST_OUT_OF_RANGE(req) \\n" + +" ((CHUNK_SIZE_T)(req) >= \\n" + +" (CHUNK_SIZE_T)(INTERNAL_SIZE_T)(-2 * MINSIZE))\n" + +"\n" + +"/* pad request bytes into a usable size -- internal version */\n" + +"\n" + +"#define request2size(req) \\n" + +" (((req) + SIZE_SZ + MALLOC_ALIGN_MASK < MINSIZE) ? \\n" + +" MINSIZE : \\n" + +" ((req) + SIZE_SZ + MALLOC_ALIGN_MASK) & ~MALLOC_ALIGN_MASK)\n" + +"\n" + +"/* Same, except also perform argument check */\n" + +"\n" + +"#define checked_request2size(req, sz) \\n" + +" if (REQUEST_OUT_OF_RANGE(req)) { \\n" + +" MALLOC_FAILURE_ACTION; \\n" + +" return 0; \\n" + +" } \\n" + +" (sz) = request2size(req);\n" + +"\n" + +"/*\n" + +" --------------- Physical chunk operations ---------------\n" + +"*/\n" + +"\n" + +"\n" + +"/* size field is or'ed with PREV_INUSE when previous adjacent chunk in use */\n" + +"#define PREV_INUSE 0x1\n" + +"\n" + +"/* extract inuse bit of previous chunk */\n" + +"#define prev_inuse(p) ((p)->size & PREV_INUSE)\n" + +"\n" + +"\n" + +"/* size field is or'ed with IS_MMAPPED if the chunk was obtained with mmap() */\n" + +"#define IS_MMAPPED 0x2\n" + +"\n" + +"/* check for mmap()'ed chunk */\n" + +"#define chunk_is_mmapped(p) ((p)->size & IS_MMAPPED)\n" + +"\n" + +"/*\n" + +" Bits to mask off when extracting size\n" + +"\n" + +" Note: IS_MMAPPED is intentionally not masked off from size field in\n" + +" macros for which mmapped chunks should never be seen. This should\n" + +" cause helpful core dumps to occur if it is tried by accident by\n" + +" people extending or adapting this malloc.\n" + +"*/\n" + +"#define SIZE_BITS (PREV_INUSE|IS_MMAPPED)\n" + +"\n" + +"/* Get size, ignoring use bits */\n" + +"#define chunksize(p) ((p)->size & ~(SIZE_BITS))\n" + +"\n" + +"\n" + +"/* Ptr to next physical malloc_chunk. */\n" + +"#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->size & ~PREV_INUSE) ))\n" + +"\n" + +"/* Ptr to previous physical malloc_chunk */\n" + +"#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_size) ))\n" + +"\n" + +"/* Treat space at ptr + offset as a chunk */\n" + +"#define chunk_at_offset(p, s) ((mchunkptr)(((char*)(p)) + (s)))\n" + +"\n" + +"/* extract p's inuse bit */\n" + +"#define inuse(p)\\n" + +"((((mchunkptr)(((char*)(p))+((p)->size & ~PREV_INUSE)))->size) & PREV_INUSE)\n" + +"\n" + +"/* set/clear chunk as being inuse without otherwise disturbing */\n" + +"#define set_inuse(p)\\n" + +"((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size |= PREV_INUSE\n" + +"\n") + +("#define clear_inuse(p)\\n" + +"((mchunkptr)(((char*)(p)) + ((p)->size & ~PREV_INUSE)))->size &= ~(PREV_INUSE)\n" + +"\n" + +"\n" + +"/* check/set/clear inuse bits in known places */\n" + +"#define inuse_bit_at_offset(p, s)\\n" + +" (((mchunkptr)(((char*)(p)) + (s)))->size & PREV_INUSE)\n" + +"\n" + +"#define set_inuse_bit_at_offset(p, s)\\n" + +" (((mchunkptr)(((char*)(p)) + (s)))->size |= PREV_INUSE)\n" + +"\n" + +"#define clear_inuse_bit_at_offset(p, s)\\n" + +" (((mchunkptr)(((char*)(p)) + (s)))->size &= ~(PREV_INUSE))\n" + +"\n" + +"\n" + +"/* Set size at head, without disturbing its use bit */\n" + +"#define set_head_size(p, s) ((p)->size = (((p)->size & PREV_INUSE) | (s)))\n" + +"\n" + +"/* Set size/use field */\n" + +"#define set_head(p, s) ((p)->size = (s))\n" + +"\n" + +"/* Set size at footer (only when chunk is not in use) */\n" + +"#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_size = (s))\n" + +"\n" + +"\n" + +"/*\n" + +" -------------------- Internal data structures --------------------\n" + +"\n" + +" All internal state is held in an instance of malloc_state defined\n" + +" below. There are no other static variables, except in two optional\n" + +" cases:\n" + +" * If USE_MALLOC_LOCK is defined, the mALLOC_MUTEx declared above.\n" + +" * If HAVE_MMAP is true, but mmap doesn't support\n" + +" MAP_ANONYMOUS, a dummy file descriptor for mmap.\n" + +"\n" + +" Beware of lots of tricks that minimize the total bookkeeping space\n" + +" requirements. The result is a little over 1K bytes (for 4byte\n" + +" pointers and size_t.)\n" + +"*/\n" + +"\n" + +"/*\n" + +" Bins\n" + +"\n" + +" An array of bin headers for free chunks. Each bin is doubly\n" + +" linked. The bins are approximately proportionally (log) spaced.\n" + +" There are a lot of these bins (128). This may look excessive, but\n" + +" works very well in practice. Most bins hold sizes that are\n" + +" unusual as malloc request sizes, but are more usual for fragments\n" + +" and consolidated sets of chunks, which is what these bins hold, so\n" + +" they can be found quickly. All procedures maintain the invariant\n" + +" that no consolidated chunk physically borders another one, so each\n" + +" chunk in a list is known to be preceeded and followed by either\n" + +" inuse chunks or the ends of memory.\n" + +"\n" + +" Chunks in bins are kept in size order, with ties going to the\n" + +" approximately least recently used chunk. Ordering isn't needed\n" + +" for the small bins, which all contain the same-sized chunks, but\n" + +" facilitates best-fit allocation for larger chunks. These lists\n" + +" are just sequential. Keeping them in order almost never requires\n" + +" enough traversal to warrant using fancier ordered data\n" + +" structures.\n" + +"\n" + +" Chunks of the same size are linked with the most\n" + +" recently freed at the front, and allocations are taken from the\n" + +" back. This results in LRU (FIFO) allocation order, which tends\n" + +" to give each chunk an equal opportunity to be consolidated with\n" + +" adjacent freed chunks, resulting in larger free chunks and less\n" + +" fragmentation.\n" + +"\n" + +" To simplify use in double-linked lists, each bin header acts\n" + +" as a malloc_chunk. This avoids special-casing for headers.\n" + +" But to conserve space and improve locality, we allocate\n" + +" only the fd/bk pointers of bins, and then use repositioning tricks\n" + +" to treat these as the fields of a malloc_chunk*.\n" + +"*/\n" + +"\n" + +"typedef struct malloc_chunk* mbinptr;\n" + +"\n" + +"/* addressing -- note that bin_at(0) does not exist */\n" + +"#define bin_at(m, i) ((mbinptr)((char*)&((m)->bins[(i)<<1]) - (SIZE_SZ<<1)))\n" + +"\n" + +"/* analog of ++bin */\n" + +"#define next_bin(b) ((mbinptr)((char*)(b) + (sizeof(mchunkptr)<<1)))\n" + +"\n" + +"/* Reminders about list directionality within bins */\n" + +"#define first(b) ((b)->fd)\n" + +"#define last(b) ((b)->bk)\n" + +"\n" + +"/* Take a chunk off a bin list */\n" + +"#define unlink(P, BK, FD) { \\n" + +" FD = P->fd; \\n" + +" BK = P->bk; \\n" + +" FD->bk = BK; \\n" + +" BK->fd = FD; \\n" + +"}\n" + +"\n" + +"/*\n" + +" Indexing\n" + +"\n" + +" Bins for sizes < 512 bytes contain chunks of all the same size, spaced\n" + +" 8 bytes apart. Larger bins are approximately logarithmically spaced:\n" + +"\n" + +" 64 bins of size 8\n" + +" 32 bins of size 64\n" + +" 16 bins of size 512\n" + +" 8 bins of size 4096\n" + +" 4 bins of size 32768\n" + +" 2 bins of size 262144\n" + +" 1 bin of size what's left\n" + +"\n" + +" The bins top out around 1MB because we expect to service large\n" + +" requests via mmap.\n" + +"*/\n" + +"\n" + +"#define NBINS 96\n" + +"#define NSMALLBINS 32\n" + +"#define SMALLBIN_WIDTH 8\n" + +"#define MIN_LARGE_SIZE 256\n" + +"\n" + +"#define in_smallbin_range(sz) \\n" + +" ((CHUNK_SIZE_T)(sz) < (CHUNK_SIZE_T)MIN_LARGE_SIZE)\n" + +"\n" + +"#define smallbin_index(sz) (((unsigned)(sz)) >> 3)\n" + +"\n" + +"/*\n" + +" Compute index for size. We expect this to be inlined when\n" + +" compiled with optimization, else not, which works out well.\n" + +"*/\n" + +"static int largebin_index(unsigned int sz) {\n" + +" unsigned int x = sz >> SMALLBIN_WIDTH;\n" + +" unsigned int m; /* bit position of highest set bit of m */\n" + +"\n" + +" if (x >= 0x10000) return NBINS-1;\n" + +"\n" + +" /* On intel, use BSRL instruction to find highest bit */\n" + +"#if defined(__GNUC__) && defined(i386)\n" + +"\n" + +" __asm__(\"bsrl %1,%0\\n\\t\"\n" + +" : \"=r\" (m)\n" + +" : \"g\" (x));\n" + +"\n" + +"#else\n" + +" {\n" + +" /*\n" + +" Based on branch-free nlz algorithm in chapter 5 of Henry\n" + +" S. Warren Jr's book \"Hacker's Delight\".\n" + +" */\n" + +"\n" + +" unsigned int n = ((x - 0x100) >> 16) & 8;\n" + +" x <<= n;\n" + +" m = ((x - 0x1000) >> 16) & 4;\n" + +" n += m;\n" + +" x <<= m;\n" + +" m = ((x - 0x4000) >> 16) & 2;\n" + +" n += m;\n" + +" x = (x << m) >> 14;\n" + +" m = 13 - n + (x & ~(x>>1));\n" + +" }\n" + +"#endif\n" + +"\n") + +( +" /* Use next 2 bits to create finer-granularity bins */\n" + +" return NSMALLBINS + (m << 2) + ((sz >> (m + 6)) & 3);\n" + +"}\n" + +"\n" + +"#define bin_index(sz) \\n" + +" ((in_smallbin_range(sz)) ? smallbin_index(sz) : largebin_index(sz))\n" + +"\n" + +"/*\n" + +" FIRST_SORTED_BIN_SIZE is the chunk size corresponding to the\n" + +" first bin that is maintained in sorted order. This must\n" + +" be the smallest size corresponding to a given bin.\n" + +"\n" + +" Normally, this should be MIN_LARGE_SIZE. But you can weaken\n" + +" best fit guarantees to sometimes speed up malloc by increasing value.\n" + +" Doing this means that malloc may choose a chunk that is\n" + +" non-best-fitting by up to the width of the bin.\n" + +"\n" + +" Some useful cutoff values:\n" + +" 512 - all bins sorted\n" + +" 2560 - leaves bins <= 64 bytes wide unsorted\n" + +" 12288 - leaves bins <= 512 bytes wide unsorted\n" + +" 65536 - leaves bins <= 4096 bytes wide unsorted\n" + +" 262144 - leaves bins <= 32768 bytes wide unsorted\n" + +" -1 - no bins sorted (not recommended!)\n" + +"*/\n" + +"\n" + +"#define FIRST_SORTED_BIN_SIZE MIN_LARGE_SIZE\n" + +"/* #define FIRST_SORTED_BIN_SIZE 65536 */\n" + +"\n" + +"/*\n" + +" Unsorted chunks\n" + +"\n" + +" All remainders from chunk splits, as well as all returned chunks,\n" + +" are first placed in the \"unsorted\" bin. They are then placed\n" + +" in regular bins after malloc gives them ONE chance to be used before\n" + +" binning. So, basically, the unsorted_chunks list acts as a queue,\n" + +" with chunks being placed on it in free (and malloc_consolidate),\n" + +" and taken off (to be either used or placed in bins) in malloc.\n" + +"*/\n" + +"\n" + +"/* The otherwise unindexable 1-bin is used to hold unsorted chunks. */\n" + +"#define unsorted_chunks(M) (bin_at(M, 1))\n" + +"\n" + +"/*\n" + +" Top\n" + +"\n" + +" The top-most available chunk (i.e., the one bordering the end of\n" + +" available memory) is treated specially. It is never included in\n" + +" any bin, is used only if no other chunk is available, and is\n" + +" released back to the system if it is very large (see\n" + +" M_TRIM_THRESHOLD). Because top initially\n" + +" points to its own bin with initial zero size, thus forcing\n" + +" extension on the first malloc request, we avoid having any special\n" + +" code in malloc to check whether it even exists yet. But we still\n" + +" need to do so when getting memory from system, so we make\n" + +" initial_top treat the bin as a legal but unusable chunk during the\n" + +" interval between initialization and the first call to\n" + +" sYSMALLOc. (This is somewhat delicate, since it relies on\n" + +" the 2 preceding words to be zero during this interval as well.)\n" + +"*/\n" + +"\n" + +"/* Conveniently, the unsorted bin can be used as dummy top on first call */\n" + +"#define initial_top(M) (unsorted_chunks(M))\n" + +"\n" + +"/*\n" + +" Binmap\n" + +"\n" + +" To help compensate for the large number of bins, a one-level index\n" + +" structure is used for bin-by-bin searching. `binmap' is a\n" + +" bitvector recording whether bins are definitely empty so they can\n" + +" be skipped over during during traversals. The bits are NOT always\n" + +" cleared as soon as bins are empty, but instead only\n" + +" when they are noticed to be empty during traversal in malloc.\n" + +"*/\n" + +"\n" + +"/* Conservatively use 32 bits per map word, even if on 64bit system */\n" + +"#define BINMAPSHIFT 5\n" + +"#define BITSPERMAP (1U << BINMAPSHIFT)\n" + +"#define BINMAPSIZE (NBINS / BITSPERMAP)\n" + +"\n" + +"#define idx2block(i) ((i) >> BINMAPSHIFT)\n" + +"#define idx2bit(i) ((1U << ((i) & ((1U << BINMAPSHIFT)-1))))\n" + +"\n" + +"#define mark_bin(m,i) ((m)->binmap[idx2block(i)] |= idx2bit(i))\n" + +"#define unmark_bin(m,i) ((m)->binmap[idx2block(i)] &= ~(idx2bit(i)))\n" + +"#define get_binmap(m,i) ((m)->binmap[idx2block(i)] & idx2bit(i))\n" + +"\n" + +"/*\n" + +" Fastbins\n" + +"\n" + +" An array of lists holding recently freed small chunks. Fastbins\n" + +" are not doubly linked. It is faster to single-link them, and\n" + +" since chunks are never removed from the middles of these lists,\n" + +" double linking is not necessary. Also, unlike regular bins, they\n" + +" are not even processed in FIFO order (they use faster LIFO) since\n" + +" ordering doesn't much matter in the transient contexts in which\n" + +" fastbins are normally used.\n" + +"\n" + +" Chunks in fastbins keep their inuse bit set, so they cannot\n" + +" be consolidated with other free chunks. malloc_consolidate\n" + +" releases all chunks in fastbins and consolidates them with\n" + +" other free chunks.\n" + +"*/\n" + +"\n" + +"typedef struct malloc_chunk* mfastbinptr;\n" + +"\n" + +"/* offset 2 to use otherwise unindexable first 2 bins */\n" + +"#define fastbin_index(sz) ((((unsigned int)(sz)) >> 3) - 2)\n" + +"\n" + +"/* The maximum fastbin request size we support */\n" + +"#define MAX_FAST_SIZE 80\n" + +"\n" + +"#define NFASTBINS (fastbin_index(request2size(MAX_FAST_SIZE))+1)\n" + +"\n" + +"/*\n" + +" FASTBIN_CONSOLIDATION_THRESHOLD is the size of a chunk in free()\n" + +" that triggers automatic consolidation of possibly-surrounding\n" + +" fastbin chunks. This is a heuristic, so the exact value should not\n" + +" matter too much. It is defined at half the default trim threshold as a\n" + +" compromise heuristic to only attempt consolidation if it is likely\n" + +" to lead to trimming. However, it is not dynamically tunable, since\n" + +" consolidation reduces fragmentation surrounding loarge chunks even\n" + +" if trimming is not used.\n" + +"*/\n" + +"\n" + +"#define FASTBIN_CONSOLIDATION_THRESHOLD \\n" + +" ((unsigned long)(DEFAULT_TRIM_THRESHOLD) >> 1)\n" + +"\n" + +"/*\n" + +" Since the lowest 2 bits in max_fast don't matter in size comparisons,\n" + +" they are used as flags.\n" + +"*/\n" + +"\n" + +"/*\n" + +" ANYCHUNKS_BIT held in max_fast indicates that there may be any\n" + +" freed chunks at all. It is set true when entering a chunk into any\n" + +" bin.\n" + +"*/\n" + +"\n" + +"#define ANYCHUNKS_BIT (1U)\n" + +"\n" + +"#define have_anychunks(M) (((M)->max_fast & ANYCHUNKS_BIT))\n" + +"#define set_anychunks(M) ((M)->max_fast |= ANYCHUNKS_BIT)\n" + +"#define clear_anychunks(M) ((M)->max_fast &= ~ANYCHUNKS_BIT)\n" + +"\n" + +"/*\n" + +" FASTCHUNKS_BIT held in max_fast indicates that there are probably\n" + +" some fastbin chunks. It is set true on entering a chunk into any\n" + +" fastbin, and cleared only in malloc_consolidate.\n" + +"*/\n" + +"\n") + +( +"#define FASTCHUNKS_BIT (2U)\n" + +"\n" + +"#define have_fastchunks(M) (((M)->max_fast & FASTCHUNKS_BIT))\n" + +"#define set_fastchunks(M) ((M)->max_fast |= (FASTCHUNKS_BIT|ANYCHUNKS_BIT))\n" + +"#define clear_fastchunks(M) ((M)->max_fast &= ~(FASTCHUNKS_BIT))\n" + +"\n" + +"/*\n" + +" Set value of max_fast.\n" + +" Use impossibly small value if 0.\n" + +"*/\n" + +"\n" + +"#define set_max_fast(M, s) \\n" + +" (M)->max_fast = (((s) == 0)? SMALLBIN_WIDTH: request2size(s)) | \\n" + +" ((M)->max_fast & (FASTCHUNKS_BIT|ANYCHUNKS_BIT))\n" + +"\n" + +"#define get_max_fast(M) \\n" + +" ((M)->max_fast & ~(FASTCHUNKS_BIT | ANYCHUNKS_BIT))\n" + +"\n" + +"\n" + +"/*\n" + +" morecore_properties is a status word holding dynamically discovered\n" + +" or controlled properties of the morecore function\n" + +"*/\n" + +"\n" + +"#define MORECORE_CONTIGUOUS_BIT (1U)\n" + +"\n" + +"#define contiguous(M) \\n" + +" (((M)->morecore_properties & MORECORE_CONTIGUOUS_BIT))\n" + +"#define noncontiguous(M) \\n" + +" (((M)->morecore_properties & MORECORE_CONTIGUOUS_BIT) == 0)\n" + +"#define set_contiguous(M) \\n" + +" ((M)->morecore_properties |= MORECORE_CONTIGUOUS_BIT)\n" + +"#define set_noncontiguous(M) \\n" + +" ((M)->morecore_properties &= ~MORECORE_CONTIGUOUS_BIT)\n" + +"\n" + +"\n" + +"/*\n" + +" ----------- Internal state representation and initialization -----------\n" + +"*/\n" + +"\n" + +"struct malloc_state {\n" + +"\n" + +" /* The maximum chunk size to be eligible for fastbin */\n" + +" INTERNAL_SIZE_T max_fast; /* low 2 bits used as flags */\n" + +"\n" + +" /* Fastbins */\n" + +" mfastbinptr fastbins[NFASTBINS];\n" + +"\n" + +" /* Base of the topmost chunk -- not otherwise kept in a bin */\n" + +" mchunkptr top;\n" + +"\n" + +" /* The remainder from the most recent split of a small request */\n" + +" mchunkptr last_remainder;\n" + +"\n" + +" /* Normal bins packed as described above */\n" + +" mchunkptr bins[NBINS * 2];\n" + +"\n" + +" /* Bitmap of bins. Trailing zero map handles cases of largest binned size */\n" + +" unsigned int binmap[BINMAPSIZE+1];\n" + +"\n" + +" /* Tunable parameters */\n" + +" CHUNK_SIZE_T trim_threshold;\n" + +" INTERNAL_SIZE_T top_pad;\n" + +" INTERNAL_SIZE_T mmap_threshold;\n" + +"\n" + +" /* Memory map support */\n" + +" int n_mmaps;\n" + +" int n_mmaps_max;\n" + +" int max_n_mmaps;\n" + +"\n" + +" /* Cache malloc_getpagesize */\n" + +" unsigned int pagesize;\n" + +"\n" + +" /* Track properties of MORECORE */\n" + +" unsigned int morecore_properties;\n" + +"\n" + +" /* Statistics */\n" + +" INTERNAL_SIZE_T mmapped_mem;\n" + +" INTERNAL_SIZE_T sbrked_mem;\n" + +" INTERNAL_SIZE_T max_sbrked_mem;\n" + +" INTERNAL_SIZE_T max_mmapped_mem;\n" + +" INTERNAL_SIZE_T max_total_mem;\n" + +"};\n" + +"\n" + +"typedef struct malloc_state *mstate;\n" + +"\n" + +"/*\n" + +" There is exactly one instance of this struct in this malloc.\n" + +" If you are adapting this malloc in a way that does NOT use a static\n" + +" malloc_state, you MUST explicitly zero-fill it before using. This\n" + +" malloc relies on the property that malloc_state is initialized to\n" + +" all zeroes (as is true of C statics).\n" + +"*/\n" + +"\n" + +"static struct malloc_state av_; /* never directly referenced */\n" + +"\n" + +"/*\n" + +" All uses of av_ are via get_malloc_state().\n" + +" At most one \"call\" to get_malloc_state is made per invocation of\n" + +" the public versions of malloc and free, but other routines\n" + +" that in turn invoke malloc and/or free may call more then once.\n" + +" Also, it is called in check* routines if DEBUG is set.\n" + +"*/\n" + +"\n" + +"#define get_malloc_state() (&(av_))\n" + +"\n" + +"/*\n" + +" Initialize a malloc_state struct.\n" + +"\n" + +" This is called only from within malloc_consolidate, which needs\n" + +" be called in the same contexts anyway. It is never called directly\n" + +" outside of malloc_consolidate because some optimizing compilers try\n" + +" to inline it at all call points, which turns out not to be an\n" + +" optimization at all. (Inlining it in malloc_consolidate is fine though.)\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"static void malloc_init_state(mstate av)\n" + +"#else\n" + +"static void malloc_init_state(av) mstate av;\n" + +"#endif\n" + +"{\n" + +" int i;\n" + +" mbinptr bin;\n" + +"\n" + +" /* Establish circular links for normal bins */\n" + +" for (i = 1; i < NBINS; ++i) {\n" + +" bin = bin_at(av,i);\n" + +" bin->fd = bin->bk = bin;\n" + +" }\n" + +"\n" + +" av->top_pad = DEFAULT_TOP_PAD;\n" + +" av->n_mmaps_max = DEFAULT_MMAP_MAX;\n" + +" av->mmap_threshold = DEFAULT_MMAP_THRESHOLD;\n" + +" av->trim_threshold = DEFAULT_TRIM_THRESHOLD;\n" + +"\n" + +"#if MORECORE_CONTIGUOUS\n" + +" set_contiguous(av);\n" + +"#else\n" + +" set_noncontiguous(av);\n" + +"#endif\n" + +"\n" + +"\n" + +" set_max_fast(av, DEFAULT_MXFAST);\n" + +"\n" + +" av->top = initial_top(av);\n" + +" av->pagesize = malloc_getpagesize;\n" + +"}\n" + +"\n" + +"/*\n" + +" Other internal utilities operating on mstates\n" + +"*/\n" + +"\n") + +( +"#if __STD_C\n" + +"static Void_t* sYSMALLOc(INTERNAL_SIZE_T, mstate);\n" + +"#ifndef MORECORE_CANNOT_TRIM\n" + +"static int sYSTRIm(size_t, mstate);\n" + +"#endif\n" + +"static void malloc_consolidate(mstate);\n" + +"static Void_t** iALLOc(size_t, size_t*, int, Void_t**);\n" + +"#else\n" + +"static Void_t* sYSMALLOc();\n" + +"static int sYSTRIm();\n" + +"static void malloc_consolidate();\n" + +"static Void_t** iALLOc();\n" + +"#endif\n" + +"\n" + +"/*\n" + +" Debugging support\n" + +"\n" + +" These routines make a number of assertions about the states\n" + +" of data structures that should be true at all times. If any\n" + +" are not true, it's very likely that a user program has somehow\n" + +" trashed memory. (It's also possible that there is a coding error\n" + +" in malloc. In which case, please report it!)\n" + +"*/\n" + +"\n" + +"#if ! DEBUG\n" + +"\n" + +"#define check_chunk(P)\n" + +"#define check_free_chunk(P)\n" + +"#define check_inuse_chunk(P)\n" + +"#define check_remalloced_chunk(P,N)\n" + +"#define check_malloced_chunk(P,N)\n" + +"#define check_malloc_state()\n" + +"\n" + +"#else\n" + +"#define check_chunk(P) do_check_chunk(P)\n" + +"#define check_free_chunk(P) do_check_free_chunk(P)\n" + +"#define check_inuse_chunk(P) do_check_inuse_chunk(P)\n" + +"#define check_remalloced_chunk(P,N) do_check_remalloced_chunk(P,N)\n" + +"#define check_malloced_chunk(P,N) do_check_malloced_chunk(P,N)\n" + +"#define check_malloc_state() do_check_malloc_state()\n" + +"\n" + +"/*\n" + +" Properties of all chunks\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"static void do_check_chunk(mchunkptr p)\n" + +"#else\n" + +"static void do_check_chunk(p) mchunkptr p;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +" CHUNK_SIZE_T sz = chunksize(p);\n" + +" /* min and max possible addresses assuming contiguous allocation */\n" + +" char* max_address = (char*)(av->top) + chunksize(av->top);\n" + +" char* min_address = max_address - av->sbrked_mem;\n" + +"\n" + +" if (!chunk_is_mmapped(p)) {\n" + +"\n" + +" /* Has legal address ... */\n" + +" if (p != av->top) {\n" + +" if (contiguous(av)) {\n" + +" assert(((char*)p) >= min_address);\n" + +" assert(((char*)p + sz) <= ((char*)(av->top)));\n" + +" }\n" + +" }\n" + +" else {\n" + +" /* top size is always at least MINSIZE */\n" + +" assert((CHUNK_SIZE_T)(sz) >= MINSIZE);\n" + +" /* top predecessor always marked inuse */\n" + +" assert(prev_inuse(p));\n" + +" }\n" + +"\n" + +" }\n" + +" else {\n" + +"#if HAVE_MMAP\n" + +" /* address is outside main heap */\n" + +" if (contiguous(av) && av->top != initial_top(av)) {\n" + +" assert(((char*)p) < min_address || ((char*)p) > max_address);\n" + +" }\n" + +" /* chunk is page-aligned */\n" + +" assert(((p->prev_size + sz) & (av->pagesize-1)) == 0);\n" + +" /* mem is aligned */\n" + +" assert(aligned_OK(chunk2mem(p)));\n" + +"#else\n" + +" /* force an appropriate assert violation if debug set */\n" + +" assert(!chunk_is_mmapped(p));\n" + +"#endif\n" + +" }\n" + +"}\n" + +"\n" + +"/*\n" + +" Properties of free chunks\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"static void do_check_free_chunk(mchunkptr p)\n" + +"#else\n" + +"static void do_check_free_chunk(p) mchunkptr p;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +"\n" + +" INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE;\n" + +" mchunkptr next = chunk_at_offset(p, sz);\n" + +"\n" + +" do_check_chunk(p);\n" + +"\n" + +" /* Chunk must claim to be free ... */\n" + +" assert(!inuse(p));\n" + +" assert (!chunk_is_mmapped(p));\n" + +"\n" + +" /* Unless a special marker, must have OK fields */\n" + +" if ((CHUNK_SIZE_T)(sz) >= MINSIZE)\n" + +" {\n" + +" assert((sz & MALLOC_ALIGN_MASK) == 0);\n" + +" assert(aligned_OK(chunk2mem(p)));\n" + +" /* ... matching footer field */\n" + +" assert(next->prev_size == sz);\n" + +" /* ... and is fully consolidated */\n" + +" assert(prev_inuse(p));\n" + +" assert (next == av->top || inuse(next));\n" + +"\n" + +" /* ... and has minimally sane links */\n" + +" assert(p->fd->bk == p);\n" + +" assert(p->bk->fd == p);\n" + +" }\n" + +" else /* markers are always of size SIZE_SZ */\n" + +" assert(sz == SIZE_SZ);\n" + +"}\n" + +"\n" + +"/*\n" + +" Properties of inuse chunks\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"static void do_check_inuse_chunk(mchunkptr p)\n" + +"#else\n" + +"static void do_check_inuse_chunk(p) mchunkptr p;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +" mchunkptr next;\n" + +" do_check_chunk(p);\n" + +"\n" + +" if (chunk_is_mmapped(p))\n" + +" return; /* mmapped chunks have no next/prev */\n" + +"\n" + +" /* Check whether it claims to be in use ... */\n" + +" assert(inuse(p));\n" + +"\n") + +( +" next = next_chunk(p);\n" + +"\n" + +" /* ... and is surrounded by OK chunks.\n" + +" Since more things can be checked with free chunks than inuse ones,\n" + +" if an inuse chunk borders them and debug is on, it's worth doing them.\n" + +" */\n" + +" if (!prev_inuse(p)) {\n" + +" /* Note that we cannot even look at prev unless it is not inuse */\n" + +" mchunkptr prv = prev_chunk(p);\n" + +" assert(next_chunk(prv) == p);\n" + +" do_check_free_chunk(prv);\n" + +" }\n" + +"\n" + +" if (next == av->top) {\n" + +" assert(prev_inuse(next));\n" + +" assert(chunksize(next) >= MINSIZE);\n" + +" }\n" + +" else if (!inuse(next))\n" + +" do_check_free_chunk(next);\n" + +"}\n" + +"\n" + +"/*\n" + +" Properties of chunks recycled from fastbins\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"static void do_check_remalloced_chunk(mchunkptr p, INTERNAL_SIZE_T s)\n" + +"#else\n" + +"static void do_check_remalloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s;\n" + +"#endif\n" + +"{\n" + +" INTERNAL_SIZE_T sz = p->size & ~PREV_INUSE;\n" + +"\n" + +" do_check_inuse_chunk(p);\n" + +"\n" + +" /* Legal size ... */\n" + +" assert((sz & MALLOC_ALIGN_MASK) == 0);\n" + +" assert((CHUNK_SIZE_T)(sz) >= MINSIZE);\n" + +" /* ... and alignment */\n" + +" assert(aligned_OK(chunk2mem(p)));\n" + +" /* chunk is less than MINSIZE more than request */\n" + +" assert((long)(sz) - (long)(s) >= 0);\n" + +" assert((long)(sz) - (long)(s + MINSIZE) < 0);\n" + +"}\n" + +"\n" + +"/*\n" + +" Properties of nonrecycled chunks at the point they are malloced\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"static void do_check_malloced_chunk(mchunkptr p, INTERNAL_SIZE_T s)\n" + +"#else\n" + +"static void do_check_malloced_chunk(p, s) mchunkptr p; INTERNAL_SIZE_T s;\n" + +"#endif\n" + +"{\n" + +" /* same as recycled case ... */\n" + +" do_check_remalloced_chunk(p, s);\n" + +"\n" + +" /*\n" + +" ... plus, must obey implementation invariant that prev_inuse is\n" + +" always true of any allocated chunk; i.e., that each allocated\n" + +" chunk borders either a previously allocated and still in-use\n" + +" chunk, or the base of its memory arena. This is ensured\n" + +" by making all allocations from the the `lowest' part of any found\n" + +" chunk. This does not necessarily hold however for chunks\n" + +" recycled via fastbins.\n" + +" */\n" + +"\n" + +" assert(prev_inuse(p));\n" + +"}\n" + +"\n" + +"\n" + +"/*\n" + +" Properties of malloc_state.\n" + +"\n" + +" This may be useful for debugging malloc, as well as detecting user\n" + +" programmer errors that somehow write into malloc_state.\n" + +"\n" + +" If you are extending or experimenting with this malloc, you can\n" + +" probably figure out how to hack this routine to print out or\n" + +" display chunk addresses, sizes, bins, and other instrumentation.\n" + +"*/\n" + +"\n" + +"static void do_check_malloc_state()\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +" unsigned int i;\n" + +" mchunkptr p;\n" + +" mchunkptr q;\n" + +" mbinptr b;\n" + +" unsigned int binbit;\n" + +" int empty;\n" + +" unsigned int idx;\n" + +" INTERNAL_SIZE_T size;\n" + +" CHUNK_SIZE_T total = 0;\n" + +" int max_fast_bin;\n" + +"\n" + +" /* internal size_t must be no wider than pointer type */\n" + +" assert(sizeof(INTERNAL_SIZE_T) <= sizeof(char*));\n" + +"\n" + +" /* alignment is a power of 2 */\n" + +" assert((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-1)) == 0);\n" + +"\n" + +" /* cannot run remaining checks until fully initialized */\n" + +" if (av->top == 0 || av->top == initial_top(av))\n" + +" return;\n" + +"\n" + +" /* pagesize is a power of 2 */\n" + +" assert((av->pagesize & (av->pagesize-1)) == 0);\n" + +"\n" + +" /* properties of fastbins */\n" + +"\n" + +" /* max_fast is in allowed range */\n" + +" assert(get_max_fast(av) <= request2size(MAX_FAST_SIZE));\n" + +"\n" + +" max_fast_bin = fastbin_index(av->max_fast);\n" + +"\n" + +" for (i = 0; i < NFASTBINS; ++i) {\n" + +" p = av->fastbins[i];\n" + +"\n" + +" /* all bins past max_fast are empty */\n" + +" if (i > max_fast_bin)\n" + +" assert(p == 0);\n" + +"\n" + +" while (p != 0) {\n" + +" /* each chunk claims to be inuse */\n" + +" do_check_inuse_chunk(p);\n" + +" total += chunksize(p);\n" + +" /* chunk belongs in this bin */\n" + +" assert(fastbin_index(chunksize(p)) == i);\n" + +" p = p->fd;\n" + +" }\n" + +" }\n" + +"\n" + +" if (total != 0)\n" + +" assert(have_fastchunks(av));\n" + +" else if (!have_fastchunks(av))\n" + +" assert(total == 0);\n" + +"\n" + +" /* check normal bins */\n" + +" for (i = 1; i < NBINS; ++i) {\n" + +" b = bin_at(av,i);\n" + +"\n" + +" /* binmap is accurate (except for bin 1 == unsorted_chunks) */\n" + +" if (i >= 2) {\n" + +" binbit = get_binmap(av,i);\n" + +" empty = last(b) == b;\n" + +" if (!binbit)\n" + +" assert(empty);\n" + +" else if (!empty)\n" + +" assert(binbit);\n" + +" }\n" + +"\n") + +( +" for (p = last(b); p != b; p = p->bk) {\n" + +" /* each chunk claims to be free */\n" + +" do_check_free_chunk(p);\n" + +" size = chunksize(p);\n" + +" total += size;\n" + +" if (i >= 2) {\n" + +" /* chunk belongs in bin */\n" + +" idx = bin_index(size);\n" + +" assert(idx == i);\n" + +" /* lists are sorted */\n" + +" if ((CHUNK_SIZE_T) size >= (CHUNK_SIZE_T)(FIRST_SORTED_BIN_SIZE)) {\n" + +" assert(p->bk == b ||\n" + +" (CHUNK_SIZE_T)chunksize(p->bk) >=\n" + +" (CHUNK_SIZE_T)chunksize(p));\n" + +" }\n" + +" }\n" + +" /* chunk is followed by a legal chain of inuse chunks */\n" + +" for (q = next_chunk(p);\n" + +" (q != av->top && inuse(q) &&\n" + +" (CHUNK_SIZE_T)(chunksize(q)) >= MINSIZE);\n" + +" q = next_chunk(q))\n" + +" do_check_inuse_chunk(q);\n" + +" }\n" + +" }\n" + +"\n" + +" /* top chunk is OK */\n" + +" check_chunk(av->top);\n" + +"\n" + +" /* sanity checks for statistics */\n" + +"\n" + +" assert(total <= (CHUNK_SIZE_T)(av->max_total_mem));\n" + +" assert(av->n_mmaps >= 0);\n" + +" assert(av->n_mmaps <= av->max_n_mmaps);\n" + +"\n" + +" assert((CHUNK_SIZE_T)(av->sbrked_mem) <=\n" + +" (CHUNK_SIZE_T)(av->max_sbrked_mem));\n" + +"\n" + +" assert((CHUNK_SIZE_T)(av->mmapped_mem) <=\n" + +" (CHUNK_SIZE_T)(av->max_mmapped_mem));\n" + +"\n" + +" assert((CHUNK_SIZE_T)(av->max_total_mem) >=\n" + +" (CHUNK_SIZE_T)(av->mmapped_mem) + (CHUNK_SIZE_T)(av->sbrked_mem));\n" + +"}\n" + +"#endif\n" + +"\n" + +"\n" + +"/* ----------- Routines dealing with system allocation -------------- */\n" + +"\n" + +"/*\n" + +" sysmalloc handles malloc cases requiring more memory from the system.\n" + +" On entry, it is assumed that av->top does not have enough\n" + +" space to service request for nb bytes, thus requiring that av->top\n" + +" be extended or replaced.\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"static Void_t* sYSMALLOc(INTERNAL_SIZE_T nb, mstate av)\n" + +"#else\n" + +"static Void_t* sYSMALLOc(nb, av) INTERNAL_SIZE_T nb; mstate av;\n" + +"#endif\n" + +"{\n" + +" mchunkptr old_top; /* incoming value of av->top */\n" + +" INTERNAL_SIZE_T old_size; /* its size */\n" + +" char* old_end; /* its end address */\n" + +"\n" + +" long size; /* arg to first MORECORE or mmap call */\n" + +" char* brk; /* return value from MORECORE */\n" + +"\n" + +" long correction; /* arg to 2nd MORECORE call */\n" + +" char* snd_brk; /* 2nd return val */\n" + +"\n" + +" INTERNAL_SIZE_T front_misalign; /* unusable bytes at front of new space */\n" + +" INTERNAL_SIZE_T end_misalign; /* partial page left at end of new space */\n" + +" char* aligned_brk; /* aligned offset into brk */\n" + +"\n" + +" mchunkptr p; /* the allocated/returned chunk */\n" + +" mchunkptr remainder; /* remainder from allocation */\n" + +" CHUNK_SIZE_T remainder_size; /* its size */\n" + +"\n" + +" CHUNK_SIZE_T sum; /* for updating stats */\n" + +"\n" + +" size_t pagemask = av->pagesize - 1;\n" + +"\n" + +" /*\n" + +" If there is space available in fastbins, consolidate and retry\n" + +" malloc from scratch rather than getting memory from system. This\n" + +" can occur only if nb is in smallbin range so we didn't consolidate\n" + +" upon entry to malloc. It is much easier to handle this case here\n" + +" than in malloc proper.\n" + +" */\n" + +"\n" + +" if (have_fastchunks(av)) {\n" + +" assert(in_smallbin_range(nb));\n" + +" malloc_consolidate(av);\n" + +" return mALLOc(nb - MALLOC_ALIGN_MASK);\n" + +" }\n" + +"\n" + +"\n" + +"#if HAVE_MMAP\n" + +"\n" + +" /*\n" + +" If have mmap, and the request size meets the mmap threshold, and\n" + +" the system supports mmap, and there are few enough currently\n" + +" allocated mmapped regions, try to directly map this request\n" + +" rather than expanding top.\n" + +" */\n" + +"\n" + +" if ((CHUNK_SIZE_T)(nb) >= (CHUNK_SIZE_T)(av->mmap_threshold) &&\n" + +" (av->n_mmaps < av->n_mmaps_max)) {\n" + +"\n" + +" char* mm; /* return value from mmap call*/\n" + +"\n" + +" /*\n" + +" Round up size to nearest page. For mmapped chunks, the overhead\n" + +" is one SIZE_SZ unit larger than for normal chunks, because there\n" + +" is no following chunk whose prev_size field could be used.\n" + +" */\n" + +" size = (nb + SIZE_SZ + MALLOC_ALIGN_MASK + pagemask) & ~pagemask;\n" + +"\n" + +" /* Don't try if size wraps around 0 */\n" + +" if ((CHUNK_SIZE_T)(size) > (CHUNK_SIZE_T)(nb)) {\n" + +"\n" + +" mm = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));\n" + +"\n" + +" if (mm != (char*)(MORECORE_FAILURE)) {\n" + +"\n" + +" /*\n" + +" The offset to the start of the mmapped region is stored\n" + +" in the prev_size field of the chunk. This allows us to adjust\n" + +" returned start address to meet alignment requirements here\n" + +" and in memalign(), and still be able to compute proper\n" + +" address argument for later munmap in free() and realloc().\n" + +" */\n" + +"\n" + +" front_misalign = (INTERNAL_SIZE_T)chunk2mem(mm) & MALLOC_ALIGN_MASK;\n" + +" if (front_misalign > 0) {\n" + +" correction = MALLOC_ALIGNMENT - front_misalign;\n" + +" p = (mchunkptr)(mm + correction);\n" + +" p->prev_size = correction;\n" + +" set_head(p, (size - correction) |IS_MMAPPED);\n" + +" }\n" + +" else {\n" + +" p = (mchunkptr)mm;\n" + +" p->prev_size = 0;\n" + +" set_head(p, size|IS_MMAPPED);\n" + +" }\n" + +"\n" + +" /* update statistics */\n" + +"\n" + +" if (++av->n_mmaps > av->max_n_mmaps)\n" + +" av->max_n_mmaps = av->n_mmaps;\n" + +"\n") + +( +" sum = av->mmapped_mem += size;\n" + +" if (sum > (CHUNK_SIZE_T)(av->max_mmapped_mem))\n" + +" av->max_mmapped_mem = sum;\n" + +" sum += av->sbrked_mem;\n" + +" if (sum > (CHUNK_SIZE_T)(av->max_total_mem))\n" + +" av->max_total_mem = sum;\n" + +"\n" + +" check_chunk(p);\n" + +"\n" + +" return chunk2mem(p);\n" + +" }\n" + +" }\n" + +" }\n" + +"#endif\n" + +"\n" + +" /* Record incoming configuration of top */\n" + +"\n" + +" old_top = av->top;\n" + +" old_size = chunksize(old_top);\n" + +" old_end = (char*)(chunk_at_offset(old_top, old_size));\n" + +"\n" + +" brk = snd_brk = (char*)(MORECORE_FAILURE);\n" + +"\n" + +" /*\n" + +" If not the first time through, we require old_size to be\n" + +" at least MINSIZE and to have prev_inuse set.\n" + +" */\n" + +"\n" + +" assert((old_top == initial_top(av) && old_size == 0) ||\n" + +" ((CHUNK_SIZE_T) (old_size) >= MINSIZE &&\n" + +" prev_inuse(old_top)));\n" + +"\n" + +" /* Precondition: not enough current space to satisfy nb request */\n" + +" assert((CHUNK_SIZE_T)(old_size) < (CHUNK_SIZE_T)(nb + MINSIZE));\n" + +"\n" + +" /* Precondition: all fastbins are consolidated */\n" + +" assert(!have_fastchunks(av));\n" + +"\n" + +"\n" + +" /* Request enough space for nb + pad + overhead */\n" + +"\n" + +" size = nb + av->top_pad + MINSIZE;\n" + +"\n" + +" /*\n" + +" If contiguous, we can subtract out existing space that we hope to\n" + +" combine with new space. We add it back later only if\n" + +" we don't actually get contiguous space.\n" + +" */\n" + +"\n" + +" if (contiguous(av))\n" + +" size -= old_size;\n" + +"\n" + +" /*\n" + +" Round to a multiple of page size.\n" + +" If MORECORE is not contiguous, this ensures that we only call it\n" + +" with whole-page arguments. And if MORECORE is contiguous and\n" + +" this is not first time through, this preserves page-alignment of\n" + +" previous calls. Otherwise, we correct to page-align below.\n" + +" */\n" + +"\n" + +" size = (size + pagemask) & ~pagemask;\n" + +"\n" + +" /*\n" + +" Don't try to call MORECORE if argument is so big as to appear\n" + +" negative. Note that since mmap takes size_t arg, it may succeed\n" + +" below even if we cannot call MORECORE.\n" + +" */\n" + +"\n" + +" if (size > 0)\n" + +" brk = (char*)(MORECORE(size));\n" + +"\n" + +" /*\n" + +" If have mmap, try using it as a backup when MORECORE fails or\n" + +" cannot be used. This is worth doing on systems that have \"holes\" in\n" + +" address space, so sbrk cannot extend to give contiguous space, but\n" + +" space is available elsewhere. Note that we ignore mmap max count\n" + +" and threshold limits, since the space will not be used as a\n" + +" segregated mmap region.\n" + +" */\n" + +"\n" + +"#if HAVE_MMAP\n" + +" if (brk == (char*)(MORECORE_FAILURE)) {\n" + +"\n" + +" /* Cannot merge with old top, so add its size back in */\n" + +" if (contiguous(av))\n" + +" size = (size + old_size + pagemask) & ~pagemask;\n" + +"\n" + +" /* If we are relying on mmap as backup, then use larger units */\n" + +" if ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(MMAP_AS_MORECORE_SIZE))\n" + +" size = MMAP_AS_MORECORE_SIZE;\n" + +"\n" + +" /* Don't try if size wraps around 0 */\n" + +" if ((CHUNK_SIZE_T)(size) > (CHUNK_SIZE_T)(nb)) {\n" + +"\n" + +" brk = (char*)(MMAP(0, size, PROT_READ|PROT_WRITE, MAP_PRIVATE));\n" + +"\n" + +" if (brk != (char*)(MORECORE_FAILURE)) {\n" + +"\n" + +" /* We do not need, and cannot use, another sbrk call to find end */\n" + +" snd_brk = brk + size;\n" + +"\n" + +" /*\n" + +" Record that we no longer have a contiguous sbrk region.\n" + +" After the first time mmap is used as backup, we do not\n" + +" ever rely on contiguous space since this could incorrectly\n" + +" bridge regions.\n" + +" */\n" + +" set_noncontiguous(av);\n" + +" }\n" + +" }\n" + +" }\n" + +"#endif\n" + +"\n" + +" if (brk != (char*)(MORECORE_FAILURE)) {\n" + +" av->sbrked_mem += size;\n" + +"\n" + +" /*\n" + +" If MORECORE extends previous space, we can likewise extend top size.\n" + +" */\n" + +"\n" + +" if (brk == old_end && snd_brk == (char*)(MORECORE_FAILURE)) {\n" + +" set_head(old_top, (size + old_size) | PREV_INUSE);\n" + +" }\n" + +"\n" + +" /*\n" + +" Otherwise, make adjustments:\n" + +"\n" + +" * If the first time through or noncontiguous, we need to call sbrk\n" + +" just to find out where the end of memory lies.\n" + +"\n" + +" * We need to ensure that all returned chunks from malloc will meet\n" + +" MALLOC_ALIGNMENT\n" + +"\n" + +" * If there was an intervening foreign sbrk, we need to adjust sbrk\n" + +" request size to account for fact that we will not be able to\n" + +" combine new space with existing space in old_top.\n" + +"\n" + +" * Almost all systems internally allocate whole pages at a time, in\n" + +" which case we might as well use the whole last page of request.\n" + +" So we allocate enough more memory to hit a page boundary now,\n" + +" which in turn causes future contiguous calls to page-align.\n" + +" */\n" + +"\n" + +" else {\n" + +" front_misalign = 0;\n" + +" end_misalign = 0;\n" + +" correction = 0;\n" + +" aligned_brk = brk;\n" + +"\n") + +( +" /*\n" + +" If MORECORE returns an address lower than we have seen before,\n" + +" we know it isn't really contiguous. This and some subsequent\n" + +" checks help cope with non-conforming MORECORE functions and\n" + +" the presence of \"foreign\" calls to MORECORE from outside of\n" + +" malloc or by other threads. We cannot guarantee to detect\n" + +" these in all cases, but cope with the ones we do detect.\n" + +" */\n" + +" if (contiguous(av) && old_size != 0 && brk < old_end) {\n" + +" set_noncontiguous(av);\n" + +" }\n" + +"\n" + +" /* handle contiguous cases */\n" + +" if (contiguous(av)) {\n" + +"\n" + +" /*\n" + +" We can tolerate forward non-contiguities here (usually due\n" + +" to foreign calls) but treat them as part of our space for\n" + +" stats reporting.\n" + +" */\n" + +" if (old_size != 0)\n" + +" av->sbrked_mem += brk - old_end;\n" + +"\n" + +" /* Guarantee alignment of first new chunk made from this space */\n" + +"\n" + +" front_misalign = (INTERNAL_SIZE_T)chunk2mem(brk) & MALLOC_ALIGN_MASK;\n" + +" if (front_misalign > 0) {\n" + +"\n" + +" /*\n" + +" Skip over some bytes to arrive at an aligned position.\n" + +" We don't need to specially mark these wasted front bytes.\n" + +" They will never be accessed anyway because\n" + +" prev_inuse of av->top (and any chunk created from its start)\n" + +" is always true after initialization.\n" + +" */\n" + +"\n" + +" correction = MALLOC_ALIGNMENT - front_misalign;\n" + +" aligned_brk += correction;\n" + +" }\n" + +"\n" + +" /*\n" + +" If this isn't adjacent to existing space, then we will not\n" + +" be able to merge with old_top space, so must add to 2nd request.\n" + +" */\n" + +"\n" + +" correction += old_size;\n" + +"\n" + +" /* Extend the end address to hit a page boundary */\n" + +" end_misalign = (INTERNAL_SIZE_T)(brk + size + correction);\n" + +" correction += ((end_misalign + pagemask) & ~pagemask) - end_misalign;\n" + +"\n" + +" assert(correction >= 0);\n" + +" snd_brk = (char*)(MORECORE(correction));\n" + +"\n" + +" if (snd_brk == (char*)(MORECORE_FAILURE)) {\n" + +" /*\n" + +" If can't allocate correction, try to at least find out current\n" + +" brk. It might be enough to proceed without failing.\n" + +" */\n" + +" correction = 0;\n" + +" snd_brk = (char*)(MORECORE(0));\n" + +" }\n" + +" else if (snd_brk < brk) {\n" + +" /*\n" + +" If the second call gives noncontiguous space even though\n" + +" it says it won't, the only course of action is to ignore\n" + +" results of second call, and conservatively estimate where\n" + +" the first call left us. Also set noncontiguous, so this\n" + +" won't happen again, leaving at most one hole.\n" + +"\n" + +" Note that this check is intrinsically incomplete. Because\n" + +" MORECORE is allowed to give more space than we ask for,\n" + +" there is no reliable way to detect a noncontiguity\n" + +" producing a forward gap for the second call.\n" + +" */\n" + +" snd_brk = brk + size;\n" + +" correction = 0;\n" + +" set_noncontiguous(av);\n" + +" }\n" + +"\n" + +" }\n" + +"\n" + +" /* handle non-contiguous cases */\n" + +" else {\n" + +" /* MORECORE/mmap must correctly align */\n" + +" assert(aligned_OK(chunk2mem(brk)));\n" + +"\n" + +" /* Find out current end of memory */\n" + +" if (snd_brk == (char*)(MORECORE_FAILURE)) {\n" + +" snd_brk = (char*)(MORECORE(0));\n" + +" av->sbrked_mem += snd_brk - brk - size;\n" + +" }\n" + +" }\n" + +"\n" + +" /* Adjust top based on results of second sbrk */\n" + +" if (snd_brk != (char*)(MORECORE_FAILURE)) {\n" + +" av->top = (mchunkptr)aligned_brk;\n" + +" set_head(av->top, (snd_brk - aligned_brk + correction) | PREV_INUSE);\n" + +" av->sbrked_mem += correction;\n" + +"\n" + +" /*\n" + +" If not the first time through, we either have a\n" + +" gap due to foreign sbrk or a non-contiguous region. Insert a\n" + +" double fencepost at old_top to prevent consolidation with space\n" + +" we don't own. These fenceposts are artificial chunks that are\n" + +" marked as inuse and are in any case too small to use. We need\n" + +" two to make sizes and alignments work out.\n" + +" */\n" + +"\n" + +" if (old_size != 0) {\n" + +" /*\n" + +" Shrink old_top to insert fenceposts, keeping size a\n" + +" multiple of MALLOC_ALIGNMENT. We know there is at least\n" + +" enough space in old_top to do this.\n" + +" */\n" + +" old_size = (old_size - 3*SIZE_SZ) & ~MALLOC_ALIGN_MASK;\n" + +" set_head(old_top, old_size | PREV_INUSE);\n" + +"\n" + +" /*\n" + +" Note that the following assignments completely overwrite\n" + +" old_top when old_size was previously MINSIZE. This is\n" + +" intentional. We need the fencepost, even if old_top otherwise gets\n" + +" lost.\n" + +" */\n" + +" chunk_at_offset(old_top, old_size )->size =\n" + +" SIZE_SZ|PREV_INUSE;\n" + +"\n" + +" chunk_at_offset(old_top, old_size + SIZE_SZ)->size =\n" + +" SIZE_SZ|PREV_INUSE;\n" + +"\n" + +" /*\n" + +" If possible, release the rest, suppressing trimming.\n" + +" */\n" + +" if (old_size >= MINSIZE) {\n" + +" INTERNAL_SIZE_T tt = av->trim_threshold;\n" + +" av->trim_threshold = (INTERNAL_SIZE_T)(-1);\n" + +" fREe(chunk2mem(old_top));\n" + +" av->trim_threshold = tt;\n" + +" }\n" + +" }\n" + +" }\n" + +" }\n" + +"\n" + +" /* Update statistics */\n" + +" sum = av->sbrked_mem;\n" + +" if (sum > (CHUNK_SIZE_T)(av->max_sbrked_mem))\n" + +" av->max_sbrked_mem = sum;\n" + +"\n") + +( +" sum += av->mmapped_mem;\n" + +" if (sum > (CHUNK_SIZE_T)(av->max_total_mem))\n" + +" av->max_total_mem = sum;\n" + +"\n" + +" check_malloc_state();\n" + +"\n" + +" /* finally, do the allocation */\n" + +"\n" + +" p = av->top;\n" + +" size = chunksize(p);\n" + +"\n" + +" /* check that one of the above allocation paths succeeded */\n" + +" if ((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb + MINSIZE)) {\n" + +" remainder_size = size - nb;\n" + +" remainder = chunk_at_offset(p, nb);\n" + +" av->top = remainder;\n" + +" set_head(p, nb | PREV_INUSE);\n" + +" set_head(remainder, remainder_size | PREV_INUSE);\n" + +" check_malloced_chunk(p, nb);\n" + +" return chunk2mem(p);\n" + +" }\n" + +"\n" + +" }\n" + +"\n" + +" /* catch all failure paths */\n" + +" MALLOC_FAILURE_ACTION;\n" + +" return 0;\n" + +"}\n" + +"\n" + +"\n" + +"\n" + +"\n" + +"/*\n" + +" sYSTRIm is an inverse of sorts to sYSMALLOc. It gives memory back\n" + +" to the system (via negative arguments to sbrk) if there is unused\n" + +" memory at the `high' end of the malloc pool. It is called\n" + +" automatically by free() when top space exceeds the trim\n" + +" threshold. It is also called by the public malloc_trim routine. It\n" + +" returns 1 if it actually released any memory, else 0.\n" + +"*/\n" + +"\n" + +"#ifndef MORECORE_CANNOT_TRIM\n" + +"\n" + +"#if __STD_C\n" + +"static int sYSTRIm(size_t pad, mstate av)\n" + +"#else\n" + +"static int sYSTRIm(pad, av) size_t pad; mstate av;\n" + +"#endif\n" + +"{\n" + +" long top_size; /* Amount of top-most memory */\n" + +" long extra; /* Amount to release */\n" + +" long released; /* Amount actually released */\n" + +" char* current_brk; /* address returned by pre-check sbrk call */\n" + +" char* new_brk; /* address returned by post-check sbrk call */\n" + +" size_t pagesz;\n" + +"\n" + +" pagesz = av->pagesize;\n" + +" top_size = chunksize(av->top);\n" + +"\n" + +" /* Release in pagesize units, keeping at least one page */\n" + +" extra = ((top_size - pad - MINSIZE + (pagesz-1)) / pagesz - 1) * pagesz;\n" + +"\n" + +" if (extra > 0) {\n" + +"\n" + +" /*\n" + +" Only proceed if end of memory is where we last set it.\n" + +" This avoids problems if there were foreign sbrk calls.\n" + +" */\n" + +" current_brk = (char*)(MORECORE(0));\n" + +" if (current_brk == (char*)(av->top) + top_size) {\n" + +"\n" + +" /*\n" + +" Attempt to release memory. We ignore MORECORE return value,\n" + +" and instead call again to find out where new end of memory is.\n" + +" This avoids problems if first call releases less than we asked,\n" + +" of if failure somehow altered brk value. (We could still\n" + +" encounter problems if it altered brk in some very bad way,\n" + +" but the only thing we can do is adjust anyway, which will cause\n" + +" some downstream failure.)\n" + +" */\n" + +"\n" + +" MORECORE(-extra);\n" + +" new_brk = (char*)(MORECORE(0));\n" + +"\n" + +" if (new_brk != (char*)MORECORE_FAILURE) {\n" + +" released = (long)(current_brk - new_brk);\n" + +"\n" + +" if (released != 0) {\n" + +" /* Success. Adjust top. */\n" + +" av->sbrked_mem -= released;\n" + +" set_head(av->top, (top_size - released) | PREV_INUSE);\n" + +" check_malloc_state();\n" + +" return 1;\n" + +" }\n" + +" }\n" + +" }\n" + +" }\n" + +" return 0;\n" + +"}\n" + +"\n" + +"#endif\n" + +"\n" + +"/*\n" + +" ------------------------------ malloc ------------------------------\n" + +"*/\n" + +"\n" + +"\n" + +"#if __STD_C\n" + +"Void_t* mALLOc(size_t bytes)\n" + +"#else\n" + +" Void_t* mALLOc(bytes) size_t bytes;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +"\n" + +" INTERNAL_SIZE_T nb; /* normalized request size */\n" + +" unsigned int idx; /* associated bin index */\n" + +" mbinptr bin; /* associated bin */\n" + +" mfastbinptr* fb; /* associated fastbin */\n" + +"\n" + +" mchunkptr victim; /* inspected/selected chunk */\n" + +" INTERNAL_SIZE_T size; /* its size */\n" + +" int victim_index; /* its bin index */\n" + +"\n" + +" mchunkptr remainder; /* remainder from a split */\n" + +" CHUNK_SIZE_T remainder_size; /* its size */\n" + +"\n" + +" unsigned int block; /* bit map traverser */\n" + +" unsigned int bit; /* bit map traverser */\n" + +" unsigned int map; /* current word of binmap */\n" + +"\n" + +" mchunkptr fwd; /* misc temp for linking */\n" + +" mchunkptr bck; /* misc temp for linking */\n" + +"\n" + +" /*\n" + +" Convert request size to internal form by adding SIZE_SZ bytes\n" + +" overhead plus possibly more to obtain necessary alignment and/or\n" + +" to obtain a size of at least MINSIZE, the smallest allocatable\n" + +" size. Also, checked_request2size traps (returning 0) request sizes\n" + +" that are so large that they wrap around zero when padded and\n" + +" aligned.\n" + +" */\n" + +"\n" + +" checked_request2size(bytes, nb);\n" + +"\n" + +" /*\n" + +" Bypass search if no frees yet\n" + +" */\n" + +" if (!have_anychunks(av)) {\n" + +" if (av->max_fast == 0) /* initialization check */\n" + +" malloc_consolidate(av);\n" + +" goto use_top;\n" + +" }\n" + +"\n") + +( +" /*\n" + +" If the size qualifies as a fastbin, first check corresponding bin.\n" + +" */\n" + +"\n" + +" if ((CHUNK_SIZE_T)(nb) <= (CHUNK_SIZE_T)(av->max_fast)) {\n" + +" fb = &(av->fastbins[(fastbin_index(nb))]);\n" + +" if ( (victim = *fb) != 0) {\n" + +" *fb = victim->fd;\n" + +" check_remalloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +" }\n" + +"\n" + +" /*\n" + +" If a small request, check regular bin. Since these \"smallbins\"\n" + +" hold one size each, no searching within bins is necessary.\n" + +" (For a large request, we need to wait until unsorted chunks are\n" + +" processed to find best fit. But for small ones, fits are exact\n" + +" anyway, so we can check now, which is faster.)\n" + +" */\n" + +"\n" + +" if (in_smallbin_range(nb)) {\n" + +" idx = smallbin_index(nb);\n" + +" bin = bin_at(av,idx);\n" + +"\n" + +" if ( (victim = last(bin)) != bin) {\n" + +" bck = victim->bk;\n" + +" set_inuse_bit_at_offset(victim, nb);\n" + +" bin->bk = bck;\n" + +" bck->fd = bin;\n" + +"\n" + +" check_malloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +" }\n" + +"\n" + +" /*\n" + +" If this is a large request, consolidate fastbins before continuing.\n" + +" While it might look excessive to kill all fastbins before\n" + +" even seeing if there is space available, this avoids\n" + +" fragmentation problems normally associated with fastbins.\n" + +" Also, in practice, programs tend to have runs of either small or\n" + +" large requests, but less often mixtures, so consolidation is not\n" + +" invoked all that often in most programs. And the programs that\n" + +" it is called frequently in otherwise tend to fragment.\n" + +" */\n" + +"\n" + +" else {\n" + +" idx = largebin_index(nb);\n" + +" if (have_fastchunks(av))\n" + +" malloc_consolidate(av);\n" + +" }\n" + +"\n" + +" /*\n" + +" Process recently freed or remaindered chunks, taking one only if\n" + +" it is exact fit, or, if this a small request, the chunk is remainder from\n" + +" the most recent non-exact fit. Place other traversed chunks in\n" + +" bins. Note that this step is the only place in any routine where\n" + +" chunks are placed in bins.\n" + +" */\n" + +"\n" + +" while ( (victim = unsorted_chunks(av)->bk) != unsorted_chunks(av)) {\n" + +" bck = victim->bk;\n" + +" size = chunksize(victim);\n" + +"\n" + +" /*\n" + +" If a small request, try to use last remainder if it is the\n" + +" only chunk in unsorted bin. This helps promote locality for\n" + +" runs of consecutive small requests. This is the only\n" + +" exception to best-fit, and applies only when there is\n" + +" no exact fit for a small chunk.\n" + +" */\n" + +"\n" + +" if (in_smallbin_range(nb) &&\n" + +" bck == unsorted_chunks(av) &&\n" + +" victim == av->last_remainder &&\n" + +" (CHUNK_SIZE_T)(size) > (CHUNK_SIZE_T)(nb + MINSIZE)) {\n" + +"\n" + +" /* split and reattach remainder */\n" + +" remainder_size = size - nb;\n" + +" remainder = chunk_at_offset(victim, nb);\n" + +" unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;\n" + +" av->last_remainder = remainder;\n" + +" remainder->bk = remainder->fd = unsorted_chunks(av);\n" + +"\n" + +" set_head(victim, nb | PREV_INUSE);\n" + +" set_head(remainder, remainder_size | PREV_INUSE);\n" + +" set_foot(remainder, remainder_size);\n" + +"\n" + +" check_malloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +"\n" + +" /* remove from unsorted list */\n" + +" unsorted_chunks(av)->bk = bck;\n" + +" bck->fd = unsorted_chunks(av);\n" + +"\n" + +" /* Take now instead of binning if exact fit */\n" + +"\n" + +" if (size == nb) {\n" + +" set_inuse_bit_at_offset(victim, size);\n" + +" check_malloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +"\n" + +" /* place chunk in bin */\n" + +"\n" + +" if (in_smallbin_range(size)) {\n" + +" victim_index = smallbin_index(size);\n" + +" bck = bin_at(av, victim_index);\n" + +" fwd = bck->fd;\n" + +" }\n" + +" else {\n" + +" victim_index = largebin_index(size);\n" + +" bck = bin_at(av, victim_index);\n" + +" fwd = bck->fd;\n" + +"\n" + +" if (fwd != bck) {\n" + +" /* if smaller than smallest, place first */\n" + +" if ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(bck->bk->size)) {\n" + +" fwd = bck;\n" + +" bck = bck->bk;\n" + +" }\n" + +" else if ((CHUNK_SIZE_T)(size) >=\n" + +" (CHUNK_SIZE_T)(FIRST_SORTED_BIN_SIZE)) {\n" + +"\n" + +" /* maintain large bins in sorted order */\n" + +" size |= PREV_INUSE; /* Or with inuse bit to speed comparisons */\n" + +" while ((CHUNK_SIZE_T)(size) < (CHUNK_SIZE_T)(fwd->size))\n" + +" fwd = fwd->fd;\n" + +" bck = fwd->bk;\n" + +" }\n" + +" }\n" + +" }\n" + +"\n" + +" mark_bin(av, victim_index);\n" + +" victim->bk = bck;\n" + +" victim->fd = fwd;\n" + +" fwd->bk = victim;\n" + +" bck->fd = victim;\n" + +" }\n" + +"\n" + +" /*\n" + +" If a large request, scan through the chunks of current bin to\n" + +" find one that fits. (This will be the smallest that fits unless\n" + +" FIRST_SORTED_BIN_SIZE has been changed from default.) This is\n" + +" the only step where an unbounded number of chunks might be\n" + +" scanned without doing anything useful with them. However the\n" + +" lists tend to be short.\n" + +" */\n" + +"\n") + +( +" if (!in_smallbin_range(nb)) {\n" + +" bin = bin_at(av, idx);\n" + +"\n" + +" for (victim = last(bin); victim != bin; victim = victim->bk) {\n" + +" size = chunksize(victim);\n" + +"\n" + +" if ((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb)) {\n" + +" remainder_size = size - nb;\n" + +" unlink(victim, bck, fwd);\n" + +"\n" + +" /* Exhaust */\n" + +" if (remainder_size < MINSIZE) {\n" + +" set_inuse_bit_at_offset(victim, size);\n" + +" check_malloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +" /* Split */\n" + +" else {\n" + +" remainder = chunk_at_offset(victim, nb);\n" + +" unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;\n" + +" remainder->bk = remainder->fd = unsorted_chunks(av);\n" + +" set_head(victim, nb | PREV_INUSE);\n" + +" set_head(remainder, remainder_size | PREV_INUSE);\n" + +" set_foot(remainder, remainder_size);\n" + +" check_malloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +" }\n" + +" }\n" + +" }\n" + +"\n" + +" /*\n" + +" Search for a chunk by scanning bins, starting with next largest\n" + +" bin. This search is strictly by best-fit; i.e., the smallest\n" + +" (with ties going to approximately the least recently used) chunk\n" + +" that fits is selected.\n" + +"\n" + +" The bitmap avoids needing to check that most blocks are nonempty.\n" + +" */\n" + +"\n" + +" ++idx;\n" + +" bin = bin_at(av,idx);\n" + +" block = idx2block(idx);\n" + +" map = av->binmap[block];\n" + +" bit = idx2bit(idx);\n" + +"\n" + +" for (;;) {\n" + +"\n" + +" /* Skip rest of block if there are no more set bits in this block. */\n" + +" if (bit > map || bit == 0) {\n" + +" do {\n" + +" if (++block >= BINMAPSIZE) /* out of bins */\n" + +" goto use_top;\n" + +" } while ( (map = av->binmap[block]) == 0);\n" + +"\n" + +" bin = bin_at(av, (block << BINMAPSHIFT));\n" + +" bit = 1;\n" + +" }\n" + +"\n" + +" /* Advance to bin with set bit. There must be one. */\n" + +" while ((bit & map) == 0) {\n" + +" bin = next_bin(bin);\n" + +" bit <<= 1;\n" + +" assert(bit != 0);\n" + +" }\n" + +"\n" + +" /* Inspect the bin. It is likely to be non-empty */\n" + +" victim = last(bin);\n" + +"\n" + +" /* If a false alarm (empty bin), clear the bit. */\n" + +" if (victim == bin) {\n" + +" av->binmap[block] = map &= ~bit; /* Write through */\n" + +" bin = next_bin(bin);\n" + +" bit <<= 1;\n" + +" }\n" + +"\n" + +" else {\n" + +" size = chunksize(victim);\n" + +"\n" + +" /* We know the first chunk in this bin is big enough to use. */\n" + +" assert((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb));\n" + +"\n" + +" remainder_size = size - nb;\n" + +"\n" + +" /* unlink */\n" + +" bck = victim->bk;\n" + +" bin->bk = bck;\n" + +" bck->fd = bin;\n" + +"\n" + +" /* Exhaust */\n" + +" if (remainder_size < MINSIZE) {\n" + +" set_inuse_bit_at_offset(victim, size);\n" + +" check_malloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +"\n" + +" /* Split */\n" + +" else {\n" + +" remainder = chunk_at_offset(victim, nb);\n" + +"\n" + +" unsorted_chunks(av)->bk = unsorted_chunks(av)->fd = remainder;\n" + +" remainder->bk = remainder->fd = unsorted_chunks(av);\n" + +" /* advertise as last remainder */\n" + +" if (in_smallbin_range(nb))\n" + +" av->last_remainder = remainder;\n" + +"\n" + +" set_head(victim, nb | PREV_INUSE);\n" + +" set_head(remainder, remainder_size | PREV_INUSE);\n" + +" set_foot(remainder, remainder_size);\n" + +" check_malloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +" }\n" + +" }\n" + +"\n" + +" use_top:\n" + +" /*\n" + +" If large enough, split off the chunk bordering the end of memory\n" + +" (held in av->top). Note that this is in accord with the best-fit\n" + +" search rule. In effect, av->top is treated as larger (and thus\n" + +" less well fitting) than any other available chunk since it can\n" + +" be extended to be as large as necessary (up to system\n" + +" limitations).\n" + +"\n" + +" We require that av->top always exists (i.e., has size >=\n" + +" MINSIZE) after initialization, so if it would otherwise be\n" + +" exhuasted by current request, it is replenished. (The main\n" + +" reason for ensuring it exists is that we may need MINSIZE space\n" + +" to put in fenceposts in sysmalloc.)\n" + +" */\n" + +"\n" + +" victim = av->top;\n" + +" size = chunksize(victim);\n" + +"\n" + +" if ((CHUNK_SIZE_T)(size) >= (CHUNK_SIZE_T)(nb + MINSIZE)) {\n" + +" remainder_size = size - nb;\n" + +" remainder = chunk_at_offset(victim, nb);\n" + +" av->top = remainder;\n" + +" set_head(victim, nb | PREV_INUSE);\n" + +" set_head(remainder, remainder_size | PREV_INUSE);\n" + +"\n" + +" check_malloced_chunk(victim, nb);\n" + +" return chunk2mem(victim);\n" + +" }\n" + +"\n" + +" /*\n" + +" If no space in top, relay to handle system-dependent cases\n" + +" */\n" + +" return sYSMALLOc(nb, av);\n" + +"}\n" + +"\n") + +( +"/*\n" + +" ------------------------------ free ------------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"void fREe(Void_t* mem)\n" + +"#else\n" + +"void fREe(mem) Void_t* mem;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +"\n" + +" mchunkptr p; /* chunk corresponding to mem */\n" + +" INTERNAL_SIZE_T size; /* its size */\n" + +" mfastbinptr* fb; /* associated fastbin */\n" + +" mchunkptr nextchunk; /* next contiguous chunk */\n" + +" INTERNAL_SIZE_T nextsize; /* its size */\n" + +" int nextinuse; /* true if nextchunk is used */\n" + +" INTERNAL_SIZE_T prevsize; /* size of previous contiguous chunk */\n" + +" mchunkptr bck; /* misc temp for linking */\n" + +" mchunkptr fwd; /* misc temp for linking */\n" + +"\n" + +" /* free(0) has no effect */\n" + +" if (mem != 0) {\n" + +" p = mem2chunk(mem);\n" + +" size = chunksize(p);\n" + +"\n" + +" check_inuse_chunk(p);\n" + +"\n" + +" /*\n" + +" If eligible, place chunk on a fastbin so it can be found\n" + +" and used quickly in malloc.\n" + +" */\n" + +"\n" + +" if ((CHUNK_SIZE_T)(size) <= (CHUNK_SIZE_T)(av->max_fast)\n" + +"\n" + +"#if TRIM_FASTBINS\n" + +" /*\n" + +" If TRIM_FASTBINS set, don't place chunks\n" + +" bordering top into fastbins\n" + +" */\n" + +" && (chunk_at_offset(p, size) != av->top)\n" + +"#endif\n" + +" ) {\n" + +"\n" + +" set_fastchunks(av);\n" + +" fb = &(av->fastbins[fastbin_index(size)]);\n" + +" p->fd = *fb;\n" + +" *fb = p;\n" + +" }\n" + +"\n" + +" /*\n" + +" Consolidate other non-mmapped chunks as they arrive.\n" + +" */\n" + +"\n" + +" else if (!chunk_is_mmapped(p)) {\n" + +" set_anychunks(av);\n" + +"\n" + +" nextchunk = chunk_at_offset(p, size);\n" + +" nextsize = chunksize(nextchunk);\n" + +"\n" + +" /* consolidate backward */\n" + +" if (!prev_inuse(p)) {\n" + +" prevsize = p->prev_size;\n" + +" size += prevsize;\n" + +" p = chunk_at_offset(p, -((long) prevsize));\n" + +" unlink(p, bck, fwd);\n" + +" }\n" + +"\n" + +" if (nextchunk != av->top) {\n" + +" /* get and clear inuse bit */\n" + +" nextinuse = inuse_bit_at_offset(nextchunk, nextsize);\n" + +" set_head(nextchunk, nextsize);\n" + +"\n" + +" /* consolidate forward */\n" + +" if (!nextinuse) {\n" + +" unlink(nextchunk, bck, fwd);\n" + +" size += nextsize;\n" + +" }\n" + +"\n" + +" /*\n" + +" Place the chunk in unsorted chunk list. Chunks are\n" + +" not placed into regular bins until after they have\n" + +" been given one chance to be used in malloc.\n" + +" */\n" + +"\n" + +" bck = unsorted_chunks(av);\n" + +" fwd = bck->fd;\n" + +" p->bk = bck;\n" + +" p->fd = fwd;\n" + +" bck->fd = p;\n" + +" fwd->bk = p;\n" + +"\n" + +" set_head(p, size | PREV_INUSE);\n" + +" set_foot(p, size);\n" + +"\n" + +" check_free_chunk(p);\n" + +" }\n" + +"\n" + +" /*\n" + +" If the chunk borders the current high end of memory,\n" + +" consolidate into top\n" + +" */\n" + +"\n" + +" else {\n" + +" size += nextsize;\n" + +" set_head(p, size | PREV_INUSE);\n" + +" av->top = p;\n" + +" check_chunk(p);\n" + +" }\n" + +"\n" + +" /*\n" + +" If freeing a large space, consolidate possibly-surrounding\n" + +" chunks. Then, if the total unused topmost memory exceeds trim\n" + +" threshold, ask malloc_trim to reduce top.\n" + +"\n" + +" Unless max_fast is 0, we don't know if there are fastbins\n" + +" bordering top, so we cannot tell for sure whether threshold\n" + +" has been reached unless fastbins are consolidated. But we\n" + +" don't want to consolidate on each free. As a compromise,\n" + +" consolidation is performed if FASTBIN_CONSOLIDATION_THRESHOLD\n" + +" is reached.\n" + +" */\n" + +"\n" + +" if ((CHUNK_SIZE_T)(size) >= FASTBIN_CONSOLIDATION_THRESHOLD) {\n" + +" if (have_fastchunks(av))\n" + +" malloc_consolidate(av);\n" + +"\n" + +"#ifndef MORECORE_CANNOT_TRIM\n" + +" if ((CHUNK_SIZE_T)(chunksize(av->top)) >=\n" + +" (CHUNK_SIZE_T)(av->trim_threshold))\n" + +" sYSTRIm(av->top_pad, av);\n" + +"#endif\n" + +" }\n" + +"\n" + +" }\n" + +" /*\n" + +" If the chunk was allocated via mmap, release via munmap()\n" + +" Note that if HAVE_MMAP is false but chunk_is_mmapped is\n" + +" true, then user must have overwritten memory. There's nothing\n" + +" we can do to catch this error unless DEBUG is set, in which case\n" + +" check_inuse_chunk (above) will have triggered error.\n" + +" */\n" + +"\n" + +" else {\n" + +"#if HAVE_MMAP\n" + +" int ret;\n" + +" INTERNAL_SIZE_T offset = p->prev_size;\n" + +" av->n_mmaps--;\n" + +" av->mmapped_mem -= (size + offset);\n" + +" ret = munmap((char*)p - offset, size + offset);\n" + +" /* munmap returns non-zero on failure */\n" + +" assert(ret == 0);\n" + +"#endif\n" + +" }\n" + +" }\n" + +"}\n" + +"\n") + +( +"/*\n" + +" ------------------------- malloc_consolidate -------------------------\n" + +"\n" + +" malloc_consolidate is a specialized version of free() that tears\n" + +" down chunks held in fastbins. Free itself cannot be used for this\n" + +" purpose since, among other things, it might place chunks back onto\n" + +" fastbins. So, instead, we need to use a minor variant of the same\n" + +" code.\n" + +"\n" + +" Also, because this routine needs to be called the first time through\n" + +" malloc anyway, it turns out to be the perfect place to trigger\n" + +" initialization code.\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"static void malloc_consolidate(mstate av)\n" + +"#else\n" + +"static void malloc_consolidate(av) mstate av;\n" + +"#endif\n" + +"{\n" + +" mfastbinptr* fb; /* current fastbin being consolidated */\n" + +" mfastbinptr* maxfb; /* last fastbin (for loop control) */\n" + +" mchunkptr p; /* current chunk being consolidated */\n" + +" mchunkptr nextp; /* next chunk to consolidate */\n" + +" mchunkptr unsorted_bin; /* bin header */\n" + +" mchunkptr first_unsorted; /* chunk to link to */\n" + +"\n" + +" /* These have same use as in free() */\n" + +" mchunkptr nextchunk;\n" + +" INTERNAL_SIZE_T size;\n" + +" INTERNAL_SIZE_T nextsize;\n" + +" INTERNAL_SIZE_T prevsize;\n" + +" int nextinuse;\n" + +" mchunkptr bck;\n" + +" mchunkptr fwd;\n" + +"\n" + +" /*\n" + +" If max_fast is 0, we know that av hasn't\n" + +" yet been initialized, in which case do so below\n" + +" */\n" + +"\n" + +" if (av->max_fast != 0) {\n" + +" clear_fastchunks(av);\n" + +"\n" + +" unsorted_bin = unsorted_chunks(av);\n" + +"\n" + +" /*\n" + +" Remove each chunk from fast bin and consolidate it, placing it\n" + +" then in unsorted bin. Among other reasons for doing this,\n" + +" placing in unsorted bin avoids needing to calculate actual bins\n" + +" until malloc is sure that chunks aren't immediately going to be\n" + +" reused anyway.\n" + +" */\n" + +"\n" + +" maxfb = &(av->fastbins[fastbin_index(av->max_fast)]);\n" + +" fb = &(av->fastbins[0]);\n" + +" do {\n" + +" if ( (p = *fb) != 0) {\n" + +" *fb = 0;\n" + +"\n" + +" do {\n" + +" check_inuse_chunk(p);\n" + +" nextp = p->fd;\n" + +"\n" + +" /* Slightly streamlined version of consolidation code in free() */\n" + +" size = p->size & ~PREV_INUSE;\n" + +" nextchunk = chunk_at_offset(p, size);\n" + +" nextsize = chunksize(nextchunk);\n" + +"\n" + +" if (!prev_inuse(p)) {\n" + +" prevsize = p->prev_size;\n" + +" size += prevsize;\n" + +" p = chunk_at_offset(p, -((long) prevsize));\n" + +" unlink(p, bck, fwd);\n" + +" }\n" + +"\n" + +" if (nextchunk != av->top) {\n" + +" nextinuse = inuse_bit_at_offset(nextchunk, nextsize);\n" + +" set_head(nextchunk, nextsize);\n" + +"\n" + +" if (!nextinuse) {\n" + +" size += nextsize;\n" + +" unlink(nextchunk, bck, fwd);\n" + +" }\n" + +"\n" + +" first_unsorted = unsorted_bin->fd;\n" + +" unsorted_bin->fd = p;\n" + +" first_unsorted->bk = p;\n" + +"\n" + +" set_head(p, size | PREV_INUSE);\n" + +" p->bk = unsorted_bin;\n" + +" p->fd = first_unsorted;\n" + +" set_foot(p, size);\n" + +" }\n" + +"\n" + +" else {\n" + +" size += nextsize;\n" + +" set_head(p, size | PREV_INUSE);\n" + +" av->top = p;\n" + +" }\n" + +"\n" + +" } while ( (p = nextp) != 0);\n" + +"\n" + +" }\n" + +" } while (fb++ != maxfb);\n" + +" }\n" + +" else {\n" + +" malloc_init_state(av);\n" + +" check_malloc_state();\n" + +" }\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------------ realloc ------------------------------\n" + +"*/\n" + +"\n" + +"\n" + +"#if __STD_C\n" + +"Void_t* rEALLOc(Void_t* oldmem, size_t bytes)\n" + +"#else\n" + +"Void_t* rEALLOc(oldmem, bytes) Void_t* oldmem; size_t bytes;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +"\n" + +" INTERNAL_SIZE_T nb; /* padded request size */\n" + +"\n" + +" mchunkptr oldp; /* chunk corresponding to oldmem */\n" + +" INTERNAL_SIZE_T oldsize; /* its size */\n" + +"\n" + +" mchunkptr newp; /* chunk to return */\n" + +" INTERNAL_SIZE_T newsize; /* its size */\n" + +" Void_t* newmem; /* corresponding user mem */\n" + +"\n" + +" mchunkptr next; /* next contiguous chunk after oldp */\n" + +"\n" + +" mchunkptr remainder; /* extra space at end of newp */\n" + +" CHUNK_SIZE_T remainder_size; /* its size */\n" + +"\n" + +" mchunkptr bck; /* misc temp for linking */\n" + +" mchunkptr fwd; /* misc temp for linking */\n" + +"\n" + +" CHUNK_SIZE_T copysize; /* bytes to copy */\n" + +" unsigned int ncopies; /* INTERNAL_SIZE_T words to copy */\n" + +" INTERNAL_SIZE_T* s; /* copy source */\n" + +" INTERNAL_SIZE_T* d; /* copy destination */\n" + +"\n" + +"\n" + +"#ifdef REALLOC_ZERO_BYTES_FREES\n" + +" if (bytes == 0) {\n" + +" fREe(oldmem);\n" + +" return 0;\n" + +" }\n" + +"#endif\n" + +"\n") + +( +" /* realloc of null is supposed to be same as malloc */\n" + +" if (oldmem == 0) return mALLOc(bytes);\n" + +"\n" + +" checked_request2size(bytes, nb);\n" + +"\n" + +" oldp = mem2chunk(oldmem);\n" + +" oldsize = chunksize(oldp);\n" + +"\n" + +" check_inuse_chunk(oldp);\n" + +"\n" + +" if (!chunk_is_mmapped(oldp)) {\n" + +"\n" + +" if ((CHUNK_SIZE_T)(oldsize) >= (CHUNK_SIZE_T)(nb)) {\n" + +" /* already big enough; split below */\n" + +" newp = oldp;\n" + +" newsize = oldsize;\n" + +" }\n" + +"\n" + +" else {\n" + +" next = chunk_at_offset(oldp, oldsize);\n" + +"\n" + +" /* Try to expand forward into top */\n" + +" if (next == av->top &&\n" + +" (CHUNK_SIZE_T)(newsize = oldsize + chunksize(next)) >=\n" + +" (CHUNK_SIZE_T)(nb + MINSIZE)) {\n" + +" set_head_size(oldp, nb);\n" + +" av->top = chunk_at_offset(oldp, nb);\n" + +" set_head(av->top, (newsize - nb) | PREV_INUSE);\n" + +" return chunk2mem(oldp);\n" + +" }\n" + +"\n" + +" /* Try to expand forward into next chunk; split off remainder below */\n" + +" else if (next != av->top &&\n" + +" !inuse(next) &&\n" + +" (CHUNK_SIZE_T)(newsize = oldsize + chunksize(next)) >=\n" + +" (CHUNK_SIZE_T)(nb)) {\n" + +" newp = oldp;\n" + +" unlink(next, bck, fwd);\n" + +" }\n" + +"\n" + +" /* allocate, copy, free */\n" + +" else {\n" + +" newmem = mALLOc(nb - MALLOC_ALIGN_MASK);\n" + +" if (newmem == 0)\n" + +" return 0; /* propagate failure */\n" + +"\n" + +" newp = mem2chunk(newmem);\n" + +" newsize = chunksize(newp);\n" + +"\n" + +" /*\n" + +" Avoid copy if newp is next chunk after oldp.\n" + +" */\n" + +" if (newp == next) {\n" + +" newsize += oldsize;\n" + +" newp = oldp;\n" + +" }\n" + +" else {\n" + +" /*\n" + +" Unroll copy of <= 36 bytes (72 if 8byte sizes)\n" + +" We know that contents have an odd number of\n" + +" INTERNAL_SIZE_T-sized words; minimally 3.\n" + +" */\n" + +"\n" + +" copysize = oldsize - SIZE_SZ;\n" + +" s = (INTERNAL_SIZE_T*)(oldmem);\n" + +" d = (INTERNAL_SIZE_T*)(newmem);\n" + +" ncopies = copysize / sizeof(INTERNAL_SIZE_T);\n" + +" assert(ncopies >= 3);\n" + +"\n" + +" if (ncopies > 9)\n" + +" MALLOC_COPY(d, s, copysize);\n" + +"\n" + +" else {\n" + +" *(d+0) = *(s+0);\n" + +" *(d+1) = *(s+1);\n" + +" *(d+2) = *(s+2);\n" + +" if (ncopies > 4) {\n" + +" *(d+3) = *(s+3);\n" + +" *(d+4) = *(s+4);\n" + +" if (ncopies > 6) {\n" + +" *(d+5) = *(s+5);\n" + +" *(d+6) = *(s+6);\n" + +" if (ncopies > 8) {\n" + +" *(d+7) = *(s+7);\n" + +" *(d+8) = *(s+8);\n" + +" }\n" + +" }\n" + +" }\n" + +" }\n" + +"\n" + +" fREe(oldmem);\n" + +" check_inuse_chunk(newp);\n" + +" return chunk2mem(newp);\n" + +" }\n" + +" }\n" + +" }\n" + +"\n" + +" /* If possible, free extra space in old or extended chunk */\n" + +"\n" + +" assert((CHUNK_SIZE_T)(newsize) >= (CHUNK_SIZE_T)(nb));\n" + +"\n" + +" remainder_size = newsize - nb;\n" + +"\n" + +" if (remainder_size < MINSIZE) { /* not enough extra to split off */\n" + +" set_head_size(newp, newsize);\n" + +" set_inuse_bit_at_offset(newp, newsize);\n" + +" }\n" + +" else { /* split remainder */\n" + +" remainder = chunk_at_offset(newp, nb);\n" + +" set_head_size(newp, nb);\n" + +" set_head(remainder, remainder_size | PREV_INUSE);\n" + +" /* Mark remainder as inuse so free() won't complain */\n" + +" set_inuse_bit_at_offset(remainder, remainder_size);\n" + +" fREe(chunk2mem(remainder));\n" + +" }\n" + +"\n" + +" check_inuse_chunk(newp);\n" + +" return chunk2mem(newp);\n" + +" }\n" + +"\n" + +" /*\n" + +" Handle mmap cases\n" + +" */\n" + +"\n" + +" else {\n" + +"#if HAVE_MMAP\n" + +"\n" + +"#if HAVE_MREMAP\n" + +" INTERNAL_SIZE_T offset = oldp->prev_size;\n" + +" size_t pagemask = av->pagesize - 1;\n" + +" char *cp;\n" + +" CHUNK_SIZE_T sum;\n" + +"\n" + +" /* Note the extra SIZE_SZ overhead */\n" + +" newsize = (nb + offset + SIZE_SZ + pagemask) & ~pagemask;\n" + +"\n" + +" /* don't need to remap if still within same page */\n" + +" if (oldsize == newsize - offset)\n" + +" return oldmem;\n" + +"\n" + +" cp = (char*)mremap((char*)oldp - offset, oldsize + offset, newsize, 1);\n" + +"\n" + +" if (cp != (char*)MORECORE_FAILURE) {\n" + +"\n" + +" newp = (mchunkptr)(cp + offset);\n" + +" set_head(newp, (newsize - offset)|IS_MMAPPED);\n" + +"\n" + +" assert(aligned_OK(chunk2mem(newp)));\n" + +" assert((newp->prev_size == offset));\n" + +"\n") + +( +" /* update statistics */\n" + +" sum = av->mmapped_mem += newsize - oldsize;\n" + +" if (sum > (CHUNK_SIZE_T)(av->max_mmapped_mem))\n" + +" av->max_mmapped_mem = sum;\n" + +" sum += av->sbrked_mem;\n" + +" if (sum > (CHUNK_SIZE_T)(av->max_total_mem))\n" + +" av->max_total_mem = sum;\n" + +"\n" + +" return chunk2mem(newp);\n" + +" }\n" + +"#endif\n" + +"\n" + +" /* Note the extra SIZE_SZ overhead. */\n" + +" if ((CHUNK_SIZE_T)(oldsize) >= (CHUNK_SIZE_T)(nb + SIZE_SZ))\n" + +" newmem = oldmem; /* do nothing */\n" + +" else {\n" + +" /* Must alloc, copy, free. */\n" + +" newmem = mALLOc(nb - MALLOC_ALIGN_MASK);\n" + +" if (newmem != 0) {\n" + +" MALLOC_COPY(newmem, oldmem, oldsize - 2*SIZE_SZ);\n" + +" fREe(oldmem);\n" + +" }\n" + +" }\n" + +" return newmem;\n" + +"\n" + +"#else\n" + +" /* If !HAVE_MMAP, but chunk_is_mmapped, user must have overwritten mem */\n" + +" check_malloc_state();\n" + +" MALLOC_FAILURE_ACTION;\n" + +" return 0;\n" + +"#endif\n" + +" }\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------------ memalign ------------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"Void_t* mEMALIGn(size_t alignment, size_t bytes)\n" + +"#else\n" + +"Void_t* mEMALIGn(alignment, bytes) size_t alignment; size_t bytes;\n" + +"#endif\n" + +"{\n" + +" INTERNAL_SIZE_T nb; /* padded request size */\n" + +" char* m; /* memory returned by malloc call */\n" + +" mchunkptr p; /* corresponding chunk */\n" + +" char* brk; /* alignment point within p */\n" + +" mchunkptr newp; /* chunk to return */\n" + +" INTERNAL_SIZE_T newsize; /* its size */\n" + +" INTERNAL_SIZE_T leadsize; /* leading space before alignment point */\n" + +" mchunkptr remainder; /* spare room at end to split off */\n" + +" CHUNK_SIZE_T remainder_size; /* its size */\n" + +" INTERNAL_SIZE_T size;\n" + +"\n" + +" /* If need less alignment than we give anyway, just relay to malloc */\n" + +"\n" + +" if (alignment <= MALLOC_ALIGNMENT) return mALLOc(bytes);\n" + +"\n" + +" /* Otherwise, ensure that it is at least a minimum chunk size */\n" + +"\n" + +" if (alignment < MINSIZE) alignment = MINSIZE;\n" + +"\n" + +" /* Make sure alignment is power of 2 (in case MINSIZE is not). */\n" + +" if ((alignment & (alignment - 1)) != 0) {\n" + +" size_t a = MALLOC_ALIGNMENT * 2;\n" + +" while ((CHUNK_SIZE_T)a < (CHUNK_SIZE_T)alignment) a <<= 1;\n" + +" alignment = a;\n" + +" }\n" + +"\n" + +" checked_request2size(bytes, nb);\n" + +"\n" + +" /*\n" + +" Strategy: find a spot within that chunk that meets the alignment\n" + +" request, and then possibly free the leading and trailing space.\n" + +" */\n" + +"\n" + +"\n" + +" /* Call malloc with worst case padding to hit alignment. */\n" + +"\n" + +" m = (char*)(mALLOc(nb + alignment + MINSIZE));\n" + +"\n" + +" if (m == 0) return 0; /* propagate failure */\n" + +"\n" + +" p = mem2chunk(m);\n" + +"\n" + +" if ((((PTR_UINT)(m)) % alignment) != 0) { /* misaligned */\n" + +"\n" + +" /*\n" + +" Find an aligned spot inside chunk. Since we need to give back\n" + +" leading space in a chunk of at least MINSIZE, if the first\n" + +" calculation places us at a spot with less than MINSIZE leader,\n" + +" we can move to the next aligned spot -- we've allocated enough\n" + +" total room so that this is always possible.\n" + +" */\n" + +"\n" + +" brk = (char*)mem2chunk((PTR_UINT)(((PTR_UINT)(m + alignment - 1)) &\n" + +" -((signed long) alignment)));\n" + +" if ((CHUNK_SIZE_T)(brk - (char*)(p)) < MINSIZE)\n" + +" brk += alignment;\n" + +"\n" + +" newp = (mchunkptr)brk;\n" + +" leadsize = brk - (char*)(p);\n" + +" newsize = chunksize(p) - leadsize;\n" + +"\n" + +" /* For mmapped chunks, just adjust offset */\n" + +" if (chunk_is_mmapped(p)) {\n" + +" newp->prev_size = p->prev_size + leadsize;\n" + +" set_head(newp, newsize|IS_MMAPPED);\n" + +" return chunk2mem(newp);\n" + +" }\n" + +"\n" + +" /* Otherwise, give back leader, use the rest */\n" + +" set_head(newp, newsize | PREV_INUSE);\n" + +" set_inuse_bit_at_offset(newp, newsize);\n" + +" set_head_size(p, leadsize);\n" + +" fREe(chunk2mem(p));\n" + +" p = newp;\n" + +"\n" + +" assert (newsize >= nb &&\n" + +" (((PTR_UINT)(chunk2mem(p))) % alignment) == 0);\n" + +" }\n" + +"\n" + +" /* Also give back spare room at the end */\n" + +" if (!chunk_is_mmapped(p)) {\n" + +" size = chunksize(p);\n" + +" if ((CHUNK_SIZE_T)(size) > (CHUNK_SIZE_T)(nb + MINSIZE)) {\n" + +" remainder_size = size - nb;\n" + +" remainder = chunk_at_offset(p, nb);\n" + +" set_head(remainder, remainder_size | PREV_INUSE);\n" + +" set_head_size(p, nb);\n" + +" fREe(chunk2mem(remainder));\n" + +" }\n" + +" }\n" + +"\n" + +" check_inuse_chunk(p);\n" + +" return chunk2mem(p);\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------------ calloc ------------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"Void_t* cALLOc(size_t n_elements, size_t elem_size)\n" + +"#else\n" + +"Void_t* cALLOc(n_elements, elem_size) size_t n_elements; size_t elem_size;\n" + +"#endif\n" + +"{\n" + +" mchunkptr p;\n" + +" CHUNK_SIZE_T clearsize;\n" + +" CHUNK_SIZE_T nclears;\n" + +" INTERNAL_SIZE_T* d;\n" + +"\n") + +( +" Void_t* mem = mALLOc(n_elements * elem_size);\n" + +"\n" + +" if (mem != 0) {\n" + +" p = mem2chunk(mem);\n" + +"\n" + +" if (!chunk_is_mmapped(p))\n" + +" {\n" + +" /*\n" + +" Unroll clear of <= 36 bytes (72 if 8byte sizes)\n" + +" We know that contents have an odd number of\n" + +" INTERNAL_SIZE_T-sized words; minimally 3.\n" + +" */\n" + +"\n" + +" d = (INTERNAL_SIZE_T*)mem;\n" + +" clearsize = chunksize(p) - SIZE_SZ;\n" + +" nclears = clearsize / sizeof(INTERNAL_SIZE_T);\n" + +" assert(nclears >= 3);\n" + +"\n" + +" if (nclears > 9)\n" + +" MALLOC_ZERO(d, clearsize);\n" + +"\n" + +" else {\n" + +" *(d+0) = 0;\n" + +" *(d+1) = 0;\n" + +" *(d+2) = 0;\n" + +" if (nclears > 4) {\n" + +" *(d+3) = 0;\n" + +" *(d+4) = 0;\n" + +" if (nclears > 6) {\n" + +" *(d+5) = 0;\n" + +" *(d+6) = 0;\n" + +" if (nclears > 8) {\n" + +" *(d+7) = 0;\n" + +" *(d+8) = 0;\n" + +" }\n" + +" }\n" + +" }\n" + +" }\n" + +" }\n" + +"#if ! MMAP_CLEARS\n" + +" else\n" + +" {\n" + +" d = (INTERNAL_SIZE_T*)mem;\n" + +" /*\n" + +" Note the additional SIZE_SZ\n" + +" */\n" + +" clearsize = chunksize(p) - 2*SIZE_SZ;\n" + +" MALLOC_ZERO(d, clearsize);\n" + +" }\n" + +"#endif\n" + +" }\n" + +" return mem;\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------------ cfree ------------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"void cFREe(Void_t *mem)\n" + +"#else\n" + +"void cFREe(mem) Void_t *mem;\n" + +"#endif\n" + +"{\n" + +" fREe(mem);\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------- independent_calloc -------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"Void_t** iCALLOc(size_t n_elements, size_t elem_size, Void_t* chunks[])\n" + +"#else\n" + +"Void_t** iCALLOc(n_elements, elem_size, chunks) size_t n_elements; size_t elem_size; Void_t* chunks[];\n" + +"#endif\n" + +"{\n" + +" size_t sz = elem_size; /* serves as 1-element array */\n" + +" /* opts arg of 3 means all elements are same size, and should be cleared */\n" + +" return iALLOc(n_elements, &sz, 3, chunks);\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------- independent_comalloc -------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"Void_t** iCOMALLOc(size_t n_elements, size_t sizes[], Void_t* chunks[])\n" + +"#else\n" + +"Void_t** iCOMALLOc(n_elements, sizes, chunks) size_t n_elements; size_t sizes[]; Void_t* chunks[];\n" + +"#endif\n" + +"{\n" + +" return iALLOc(n_elements, sizes, 0, chunks);\n" + +"}\n" + +"\n" + +"\n" + +"/*\n" + +" ------------------------------ ialloc ------------------------------\n" + +" ialloc provides common support for independent_X routines, handling all of\n" + +" the combinations that can result.\n" + +"\n" + +" The opts arg has:\n" + +" bit 0 set if all elements are same size (using sizes[0])\n" + +" bit 1 set if elements should be zeroed\n" + +"*/\n" + +"\n" + +"\n" + +"#if __STD_C\n" + +"static Void_t** iALLOc(size_t n_elements,\n" + +" size_t* sizes,\n" + +" int opts,\n" + +" Void_t* chunks[])\n" + +"#else\n" + +"static Void_t** iALLOc(n_elements, sizes, opts, chunks) size_t n_elements; size_t* sizes; int opts; Void_t* chunks[];\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +" INTERNAL_SIZE_T element_size; /* chunksize of each element, if all same */\n" + +" INTERNAL_SIZE_T contents_size; /* total size of elements */\n" + +" INTERNAL_SIZE_T array_size; /* request size of pointer array */\n" + +" Void_t* mem; /* malloced aggregate space */\n" + +" mchunkptr p; /* corresponding chunk */\n" + +" INTERNAL_SIZE_T remainder_size; /* remaining bytes while splitting */\n" + +" Void_t** marray; /* either \"chunks\" or malloced ptr array */\n" + +" mchunkptr array_chunk; /* chunk for malloced ptr array */\n" + +" int mmx; /* to disable mmap */\n" + +" INTERNAL_SIZE_T size;\n" + +" size_t i;\n" + +"\n" + +" /* Ensure initialization */\n" + +" if (av->max_fast == 0) malloc_consolidate(av);\n" + +"\n" + +" /* compute array length, if needed */\n" + +" if (chunks != 0) {\n" + +" if (n_elements == 0)\n" + +" return chunks; /* nothing to do */\n" + +" marray = chunks;\n" + +" array_size = 0;\n" + +" }\n" + +" else {\n" + +" /* if empty req, must still return chunk representing empty array */\n" + +" if (n_elements == 0)\n" + +" return (Void_t**) mALLOc(0);\n" + +" marray = 0;\n" + +" array_size = request2size(n_elements * (sizeof(Void_t*)));\n" + +" }\n" + +"\n" + +" /* compute total element size */\n" + +" if (opts & 0x1) { /* all-same-size */\n" + +" element_size = request2size(*sizes);\n" + +" contents_size = n_elements * element_size;\n" + +" }\n" + +" else { /* add up all the sizes */\n" + +" element_size = 0;\n" + +" contents_size = 0;\n" + +" for (i = 0; i != n_elements; ++i)\n" + +" contents_size += request2size(sizes[i]);\n" + +" }\n" + +"\n") + +( +" /* subtract out alignment bytes from total to minimize overallocation */\n" + +" size = contents_size + array_size - MALLOC_ALIGN_MASK;\n" + +"\n" + +" /*\n" + +" Allocate the aggregate chunk.\n" + +" But first disable mmap so malloc won't use it, since\n" + +" we would not be able to later free/realloc space internal\n" + +" to a segregated mmap region.\n" + +" */\n" + +" mmx = av->n_mmaps_max; /* disable mmap */\n" + +" av->n_mmaps_max = 0;\n" + +" mem = mALLOc(size);\n" + +" av->n_mmaps_max = mmx; /* reset mmap */\n" + +" if (mem == 0)\n" + +" return 0;\n" + +"\n" + +" p = mem2chunk(mem);\n" + +" assert(!chunk_is_mmapped(p));\n" + +" remainder_size = chunksize(p);\n" + +"\n" + +" if (opts & 0x2) { /* optionally clear the elements */\n" + +" MALLOC_ZERO(mem, remainder_size - SIZE_SZ - array_size);\n" + +" }\n" + +"\n" + +" /* If not provided, allocate the pointer array as final part of chunk */\n" + +" if (marray == 0) {\n" + +" array_chunk = chunk_at_offset(p, contents_size);\n" + +" marray = (Void_t**) (chunk2mem(array_chunk));\n" + +" set_head(array_chunk, (remainder_size - contents_size) | PREV_INUSE);\n" + +" remainder_size = contents_size;\n" + +" }\n" + +"\n" + +" /* split out elements */\n" + +" for (i = 0; ; ++i) {\n" + +" marray[i] = chunk2mem(p);\n" + +" if (i != n_elements-1) {\n" + +" if (element_size != 0)\n" + +" size = element_size;\n" + +" else\n" + +" size = request2size(sizes[i]);\n" + +" remainder_size -= size;\n" + +" set_head(p, size | PREV_INUSE);\n" + +" p = chunk_at_offset(p, size);\n" + +" }\n" + +" else { /* the final element absorbs any overallocation slop */\n" + +" set_head(p, remainder_size | PREV_INUSE);\n" + +" break;\n" + +" }\n" + +" }\n" + +"\n" + +"#if DEBUG\n" + +" if (marray != chunks) {\n" + +" /* final element must have exactly exhausted chunk */\n" + +" if (element_size != 0)\n" + +" assert(remainder_size == element_size);\n" + +" else\n" + +" assert(remainder_size == request2size(sizes[i]));\n" + +" check_inuse_chunk(mem2chunk(marray));\n" + +" }\n" + +"\n" + +" for (i = 0; i != n_elements; ++i)\n" + +" check_inuse_chunk(mem2chunk(marray[i]));\n" + +"#endif\n" + +"\n" + +" return marray;\n" + +"}\n" + +"\n" + +"\n" + +"/*\n" + +" ------------------------------ valloc ------------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"Void_t* vALLOc(size_t bytes)\n" + +"#else\n" + +"Void_t* vALLOc(bytes) size_t bytes;\n" + +"#endif\n" + +"{\n" + +" /* Ensure initialization */\n" + +" mstate av = get_malloc_state();\n" + +" if (av->max_fast == 0) malloc_consolidate(av);\n" + +" return mEMALIGn(av->pagesize, bytes);\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------------ pvalloc ------------------------------\n" + +"*/\n" + +"\n" + +"\n" + +"#if __STD_C\n" + +"Void_t* pVALLOc(size_t bytes)\n" + +"#else\n" + +"Void_t* pVALLOc(bytes) size_t bytes;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +" size_t pagesz;\n" + +"\n" + +" /* Ensure initialization */\n" + +" if (av->max_fast == 0) malloc_consolidate(av);\n" + +" pagesz = av->pagesize;\n" + +" return mEMALIGn(pagesz, (bytes + pagesz - 1) & ~(pagesz - 1));\n" + +"}\n" + +"\n" + +"\n" + +"/*\n" + +" ------------------------------ malloc_trim ------------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"int mTRIm(size_t pad)\n" + +"#else\n" + +"int mTRIm(pad) size_t pad;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +" /* Ensure initialization/consolidation */\n" + +" malloc_consolidate(av);\n" + +"\n" + +"#ifndef MORECORE_CANNOT_TRIM\n" + +" return sYSTRIm(pad, av);\n" + +"#else\n" + +" return 0;\n" + +"#endif\n" + +"}\n" + +"\n" + +"\n" + +"/*\n" + +" ------------------------- malloc_usable_size -------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"size_t mUSABLe(Void_t* mem)\n" + +"#else\n" + +"size_t mUSABLe(mem) Void_t* mem;\n" + +"#endif\n" + +"{\n" + +" mchunkptr p;\n" + +" if (mem != 0) {\n" + +" p = mem2chunk(mem);\n" + +" if (chunk_is_mmapped(p))\n" + +" return chunksize(p) - 2*SIZE_SZ;\n" + +" else if (inuse(p))\n" + +" return chunksize(p) - SIZE_SZ;\n" + +" }\n" + +" return 0;\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------------ mallinfo ------------------------------\n" + +"*/\n" + +"\n") + +( +"struct mallinfo mALLINFo()\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +" struct mallinfo mi;\n" + +" unsigned int i;\n" + +" mbinptr b;\n" + +" mchunkptr p;\n" + +" INTERNAL_SIZE_T avail;\n" + +" INTERNAL_SIZE_T fastavail;\n" + +" int nblocks;\n" + +" int nfastblocks;\n" + +"\n" + +" /* Ensure initialization */\n" + +" if (av->top == 0) malloc_consolidate(av);\n" + +"\n" + +" check_malloc_state();\n" + +"\n" + +" /* Account for top */\n" + +" avail = chunksize(av->top);\n" + +" nblocks = 1; /* top always exists */\n" + +"\n" + +" /* traverse fastbins */\n" + +" nfastblocks = 0;\n" + +" fastavail = 0;\n" + +"\n" + +" for (i = 0; i < NFASTBINS; ++i) {\n" + +" for (p = av->fastbins[i]; p != 0; p = p->fd) {\n" + +" ++nfastblocks;\n" + +" fastavail += chunksize(p);\n" + +" }\n" + +" }\n" + +"\n" + +" avail += fastavail;\n" + +"\n" + +" /* traverse regular bins */\n" + +" for (i = 1; i < NBINS; ++i) {\n" + +" b = bin_at(av, i);\n" + +" for (p = last(b); p != b; p = p->bk) {\n" + +" ++nblocks;\n" + +" avail += chunksize(p);\n" + +" }\n" + +" }\n" + +"\n" + +" mi.smblks = nfastblocks;\n" + +" mi.ordblks = nblocks;\n" + +" mi.fordblks = avail;\n" + +" mi.uordblks = av->sbrked_mem - avail;\n" + +" mi.arena = av->sbrked_mem;\n" + +" mi.hblks = av->n_mmaps;\n" + +" mi.hblkhd = av->mmapped_mem;\n" + +" mi.fsmblks = fastavail;\n" + +" mi.keepcost = chunksize(av->top);\n" + +" mi.usmblks = av->max_total_mem;\n" + +" return mi;\n" + +"}\n" + +"\n" + +"/*\n" + +" ------------------------------ malloc_stats ------------------------------\n" + +"*/\n" + +"\n" + +"void mSTATs()\n" + +"{\n" + +" struct mallinfo mi = mALLINFo();\n" + +"\n" + +"#ifdef WIN32\n" + +" {\n" + +" CHUNK_SIZE_T free, reserved, committed;\n" + +" vminfo (&free, &reserved, &committed);\n" + +" fprintf(stderr, \"free bytes = %10lu\\n\",\n" + +" free);\n" + +" fprintf(stderr, \"reserved bytes = %10lu\\n\",\n" + +" reserved);\n" + +" fprintf(stderr, \"committed bytes = %10lu\\n\",\n" + +" committed);\n" + +" }\n" + +"#endif\n" + +"\n" + +"\n" + +" fprintf(stderr, \"max system bytes = %10lu\\n\",\n" + +" (CHUNK_SIZE_T)(mi.usmblks));\n" + +" fprintf(stderr, \"system bytes = %10lu\\n\",\n" + +" (CHUNK_SIZE_T)(mi.arena + mi.hblkhd));\n" + +" fprintf(stderr, \"in use bytes = %10lu\\n\",\n" + +" (CHUNK_SIZE_T)(mi.uordblks + mi.hblkhd));\n" + +"\n" + +"#ifdef WIN32\n" + +" {\n" + +" CHUNK_SIZE_T kernel, user;\n" + +" if (cpuinfo (TRUE, &kernel, &user)) {\n" + +" fprintf(stderr, \"kernel ms = %10lu\\n\",\n" + +" kernel);\n" + +" fprintf(stderr, \"user ms = %10lu\\n\",\n" + +" user);\n" + +" }\n" + +" }\n" + +"#endif\n" + +"}\n" + +"\n" + +"\n" + +"/*\n" + +" ------------------------------ mallopt ------------------------------\n" + +"*/\n" + +"\n" + +"#if __STD_C\n" + +"int mALLOPt(int param_number, int value)\n" + +"#else\n" + +"int mALLOPt(param_number, value) int param_number; int value;\n" + +"#endif\n" + +"{\n" + +" mstate av = get_malloc_state();\n" + +" /* Ensure initialization/consolidation */\n" + +" malloc_consolidate(av);\n" + +"\n" + +" switch(param_number) {\n" + +" case M_MXFAST:\n" + +" if (value >= 0 && value <= MAX_FAST_SIZE) {\n" + +" set_max_fast(av, value);\n" + +" return 1;\n" + +" }\n" + +" else\n" + +" return 0;\n" + +"\n" + +" case M_TRIM_THRESHOLD:\n" + +" av->trim_threshold = value;\n" + +" return 1;\n" + +"\n" + +" case M_TOP_PAD:\n" + +" av->top_pad = value;\n" + +" return 1;\n" + +"\n" + +" case M_MMAP_THRESHOLD:\n" + +" av->mmap_threshold = value;\n" + +" return 1;\n" + +"\n" + +" case M_MMAP_MAX:\n" + +"#if !HAVE_MMAP\n" + +" if (value != 0)\n" + +" return 0;\n" + +"#endif\n" + +" av->n_mmaps_max = value;\n" + +" return 1;\n" + +"\n" + +" default:\n" + +" return 0;\n" + +" }\n" + +"}\n" + +"\n" + +"\n" + +"/*\n" + +" -------------------- Alternative MORECORE functions --------------------\n" + +"*/\n" + +"\n") + +( +"\n" + +"/*\n" + +" General Requirements for MORECORE.\n" + +"\n" + +" The MORECORE function must have the following properties:\n" + +"\n" + +" If MORECORE_CONTIGUOUS is false:\n" + +"\n" + +" * MORECORE must allocate in multiples of pagesize. It will\n" + +" only be called with arguments that are multiples of pagesize.\n" + +"\n" + +" * MORECORE(0) must return an address that is at least\n" + +" MALLOC_ALIGNMENT aligned. (Page-aligning always suffices.)\n" + +"\n" + +" else (i.e. If MORECORE_CONTIGUOUS is true):\n" + +"\n" + +" * Consecutive calls to MORECORE with positive arguments\n" + +" return increasing addresses, indicating that space has been\n" + +" contiguously extended.\n" + +"\n" + +" * MORECORE need not allocate in multiples of pagesize.\n" + +" Calls to MORECORE need not have args of multiples of pagesize.\n" + +"\n" + +" * MORECORE need not page-align.\n" + +"\n" + +" In either case:\n" + +"\n" + +" * MORECORE may allocate more memory than requested. (Or even less,\n" + +" but this will generally result in a malloc failure.)\n" + +"\n" + +" * MORECORE must not allocate memory when given argument zero, but\n" + +" instead return one past the end address of memory from previous\n" + +" nonzero call. This malloc does NOT call MORECORE(0)\n" + +" until at least one call with positive arguments is made, so\n" + +" the initial value returned is not important.\n" + +"\n" + +" * Even though consecutive calls to MORECORE need not return contiguous\n" + +" addresses, it must be OK for malloc'ed chunks to span multiple\n" + +" regions in those cases where they do happen to be contiguous.\n" + +"\n" + +" * MORECORE need not handle negative arguments -- it may instead\n" + +" just return MORECORE_FAILURE when given negative arguments.\n" + +" Negative arguments are always multiples of pagesize. MORECORE\n" + +" must not misinterpret negative args as large positive unsigned\n" + +" args. You can suppress all such calls from even occurring by defining\n" + +" MORECORE_CANNOT_TRIM,\n" + +"\n" + +" There is some variation across systems about the type of the\n" + +" argument to sbrk/MORECORE. If size_t is unsigned, then it cannot\n" + +" actually be size_t, because sbrk supports negative args, so it is\n" + +" normally the signed type of the same width as size_t (sometimes\n" + +" declared as \"intptr_t\", and sometimes \"ptrdiff_t\"). It doesn't much\n" + +" matter though. Internally, we use \"long\" as arguments, which should\n" + +" work across all reasonable possibilities.\n" + +"\n" + +" Additionally, if MORECORE ever returns failure for a positive\n" + +" request, and HAVE_MMAP is true, then mmap is used as a noncontiguous\n" + +" system allocator. This is a useful backup strategy for systems with\n" + +" holes in address spaces -- in this case sbrk cannot contiguously\n" + +" expand the heap, but mmap may be able to map noncontiguous space.\n" + +"\n" + +" If you'd like mmap to ALWAYS be used, you can define MORECORE to be\n" + +" a function that always returns MORECORE_FAILURE.\n" + +"\n" + +" Malloc only has limited ability to detect failures of MORECORE\n" + +" to supply contiguous space when it says it can. In particular,\n" + +" multithreaded programs that do not use locks may result in\n" + +" rece conditions across calls to MORECORE that result in gaps\n" + +" that cannot be detected as such, and subsequent corruption.\n" + +"\n" + +" If you are using this malloc with something other than sbrk (or its\n" + +" emulation) to supply memory regions, you probably want to set\n" + +" MORECORE_CONTIGUOUS as false. As an example, here is a custom\n" + +" allocator kindly contributed for pre-OSX macOS. It uses virtually\n" + +" but not necessarily physically contiguous non-paged memory (locked\n" + +" in, present and won't get swapped out). You can use it by\n" + +" uncommenting this section, adding some #includes, and setting up the\n" + +" appropriate defines above:\n" + +"\n" + +" #define MORECORE osMoreCore\n" + +" #define MORECORE_CONTIGUOUS 0\n" + +"\n" + +" There is also a shutdown routine that should somehow be called for\n" + +" cleanup upon program exit.\n" + +"\n" + +" #define MAX_POOL_ENTRIES 100\n" + +" #define MINIMUM_MORECORE_SIZE (64 * 1024)\n" + +" static int next_os_pool;\n" + +" void *our_os_pools[MAX_POOL_ENTRIES];\n" + +"\n" + +" void *osMoreCore(int size)\n" + +" {\n" + +" void *ptr = 0;\n" + +" static void *sbrk_top = 0;\n" + +"\n" + +" if (size > 0)\n" + +" {\n" + +" if (size < MINIMUM_MORECORE_SIZE)\n" + +" size = MINIMUM_MORECORE_SIZE;\n" + +" if (CurrentExecutionLevel() == kTaskLevel)\n" + +" ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0);\n" + +" if (ptr == 0)\n" + +" {\n" + +" return (void *) MORECORE_FAILURE;\n" + +" }\n" + +" // save ptrs so they can be freed during cleanup\n" + +" our_os_pools[next_os_pool] = ptr;\n" + +" next_os_pool++;\n" + +" ptr = (void *) ((((CHUNK_SIZE_T) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK);\n" + +" sbrk_top = (char *) ptr + size;\n" + +" return ptr;\n" + +" }\n" + +" else if (size < 0)\n" + +" {\n" + +" // we don't currently support shrink behavior\n" + +" return (void *) MORECORE_FAILURE;\n" + +" }\n" + +" else\n" + +" {\n" + +" return sbrk_top;\n" + +" }\n" + +" }\n" + +"\n" + +" // cleanup any allocated memory pools\n" + +" // called as last thing before shutting down driver\n" + +"\n" + +" void osCleanupMem(void)\n" + +" {\n" + +" void **ptr;\n" + +"\n" + +" for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++)\n" + +" if (*ptr)\n" + +" {\n" + +" PoolDeallocate(*ptr);\n" + +" *ptr = 0;\n" + +" }\n" + +" }\n" + +"\n" + +"*/\n" + +"\n" + +"\n" + +"/*\n" + +" --------------------------------------------------------------\n" + +"\n" + +" Emulation of sbrk for win32.\n" + +" Donated by J. Walter <Walter@GeNeSys-e.de>.\n" + +" For additional information about this code, and malloc on Win32, see\n" + +" http://www.genesys-e.de/jwalter/\n" + +"*/\n" + +"\n" + +"\n") + +( +"#ifdef WIN32\n" + +"\n" + +"#ifdef _DEBUG\n" + +"/* #define TRACE */\n" + +"#endif\n" + +"\n" + +"/* Support for USE_MALLOC_LOCK */\n" + +"#ifdef USE_MALLOC_LOCK\n" + +"\n" + +"/* Wait for spin lock */\n" + +"static int slwait (int *sl) {\n" + +" while (InterlockedCompareExchange ((void **) sl, (void *) 1, (void *) 0) != 0)\n" + +" Sleep (0);\n" + +" return 0;\n" + +"}\n" + +"\n" + +"/* Release spin lock */\n" + +"static int slrelease (int *sl) {\n" + +" InterlockedExchange (sl, 0);\n" + +" return 0;\n" + +"}\n" + +"\n" + +"#ifdef NEEDED\n" + +"/* Spin lock for emulation code */\n" + +"static int g_sl;\n" + +"#endif\n" + +"\n" + +"#endif /* USE_MALLOC_LOCK */\n" + +"\n" + +"/* getpagesize for windows */\n" + +"static long getpagesize (void) {\n" + +" static long g_pagesize = 0;\n" + +" if (! g_pagesize) {\n" + +" SYSTEM_INFO system_info;\n" + +" GetSystemInfo (&system_info);\n" + +" g_pagesize = system_info.dwPageSize;\n" + +" }\n" + +" return g_pagesize;\n" + +"}\n" + +"static long getregionsize (void) {\n" + +" static long g_regionsize = 0;\n" + +" if (! g_regionsize) {\n" + +" SYSTEM_INFO system_info;\n" + +" GetSystemInfo (&system_info);\n" + +" g_regionsize = system_info.dwAllocationGranularity;\n" + +" }\n" + +" return g_regionsize;\n" + +"}\n" + +"\n" + +"/* A region list entry */\n" + +"typedef struct _region_list_entry {\n" + +" void *top_allocated;\n" + +" void *top_committed;\n" + +" void *top_reserved;\n" + +" long reserve_size;\n" + +" struct _region_list_entry *previous;\n" + +"} region_list_entry;\n" + +"\n" + +"/* Allocate and link a region entry in the region list */\n" + +"static int region_list_append (region_list_entry **last, void *base_reserved, long reserve_size) {\n" + +" region_list_entry *next = HeapAlloc (GetProcessHeap (), 0, sizeof (region_list_entry));\n" + +" if (! next)\n" + +" return FALSE;\n" + +" next->top_allocated = (char *) base_reserved;\n" + +" next->top_committed = (char *) base_reserved;\n" + +" next->top_reserved = (char *) base_reserved + reserve_size;\n" + +" next->reserve_size = reserve_size;\n" + +" next->previous = *last;\n" + +" *last = next;\n" + +" return TRUE;\n" + +"}\n" + +"/* Free and unlink the last region entry from the region list */\n" + +"static int region_list_remove (region_list_entry **last) {\n" + +" region_list_entry *previous = (*last)->previous;\n" + +" if (! HeapFree (GetProcessHeap (), sizeof (region_list_entry), *last))\n" + +" return FALSE;\n" + +" *last = previous;\n" + +" return TRUE;\n" + +"}\n" + +"\n" + +"#define CEIL(size,to) (((size)+(to)-1)&~((to)-1))\n" + +"#define FLOOR(size,to) ((size)&~((to)-1))\n" + +"\n" + +"#define SBRK_SCALE 0\n" + +"/* #define SBRK_SCALE 1 */\n" + +"/* #define SBRK_SCALE 2 */\n" + +"/* #define SBRK_SCALE 4 */\n" + +"\n" + +"/* sbrk for windows */\n" + +"static void *sbrk (long size) {\n" + +" static long g_pagesize, g_my_pagesize;\n" + +" static long g_regionsize, g_my_regionsize;\n" + +" static region_list_entry *g_last;\n" + +" void *result = (void *) MORECORE_FAILURE;\n" + +"#ifdef TRACE\n" + +" printf (\"sbrk %d\\n\", size);\n" + +"#endif\n" + +"#if defined (USE_MALLOC_LOCK) && defined (NEEDED)\n" + +" /* Wait for spin lock */\n" + +" slwait (&g_sl);\n" + +"#endif\n" + +" /* First time initialization */\n" + +" if (! g_pagesize) {\n" + +" g_pagesize = getpagesize ();\n" + +" g_my_pagesize = g_pagesize << SBRK_SCALE;\n" + +" }\n" + +" if (! g_regionsize) {\n" + +" g_regionsize = getregionsize ();\n" + +" g_my_regionsize = g_regionsize << SBRK_SCALE;\n" + +" }\n" + +" if (! g_last) {\n" + +" if (! region_list_append (&g_last, 0, 0))\n" + +" goto sbrk_exit;\n" + +" }\n" + +" /* Assert invariants */\n" + +" assert (g_last);\n" + +" assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_allocated &&\n" + +" g_last->top_allocated <= g_last->top_committed);\n" + +" assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_committed &&\n" + +" g_last->top_committed <= g_last->top_reserved &&\n" + +" (unsigned) g_last->top_committed % g_pagesize == 0);\n" + +" assert ((unsigned) g_last->top_reserved % g_regionsize == 0);\n" + +" assert ((unsigned) g_last->reserve_size % g_regionsize == 0);\n" + +" /* Allocation requested? */\n" + +" if (size >= 0) {\n" + +" /* Allocation size is the requested size */\n" + +" long allocate_size = size;\n" + +" /* Compute the size to commit */\n" + +" long to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;\n" + +" /* Do we reach the commit limit? */\n" + +" if (to_commit > 0) {\n" + +" /* Round size to commit */\n" + +" long commit_size = CEIL (to_commit, g_my_pagesize);\n" + +" /* Compute the size to reserve */\n" + +" long to_reserve = (char *) g_last->top_committed + commit_size - (char *) g_last->top_reserved;\n" + +" /* Do we reach the reserve limit? */\n" + +" if (to_reserve > 0) {\n" + +" /* Compute the remaining size to commit in the current region */\n" + +" long remaining_commit_size = (char *) g_last->top_reserved - (char *) g_last->top_committed;\n" + +" if (remaining_commit_size > 0) {\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) g_last->top_committed % g_pagesize == 0);\n" + +" assert (0 < remaining_commit_size && remaining_commit_size % g_pagesize == 0); {\n" + +" /* Commit this */\n" + +" void *base_committed = VirtualAlloc (g_last->top_committed, remaining_commit_size,\n" + +" MEM_COMMIT, PAGE_READWRITE);\n" + +" /* Check returned pointer for consistency */\n" + +" if (base_committed != g_last->top_committed)\n" + +" goto sbrk_exit;\n") + +( +" /* Assert postconditions */\n" + +" assert ((unsigned) base_committed % g_pagesize == 0);\n" + +"#ifdef TRACE\n" + +" printf (\"Commit %p %d\\n\", base_committed, remaining_commit_size);\n" + +"#endif\n" + +" /* Adjust the regions commit top */\n" + +" g_last->top_committed = (char *) base_committed + remaining_commit_size;\n" + +" }\n" + +" } {\n" + +" /* Now we are going to search and reserve. */\n" + +" int contiguous = -1;\n" + +" int found = FALSE;\n" + +" MEMORY_BASIC_INFORMATION memory_info;\n" + +" void *base_reserved;\n" + +" long reserve_size;\n" + +" do {\n" + +" /* Assume contiguous memory */\n" + +" contiguous = TRUE;\n" + +" /* Round size to reserve */\n" + +" reserve_size = CEIL (to_reserve, g_my_regionsize);\n" + +" /* Start with the current region's top */\n" + +" memory_info.BaseAddress = g_last->top_reserved;\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);\n" + +" assert (0 < reserve_size && reserve_size % g_regionsize == 0);\n" + +" while (VirtualQuery (memory_info.BaseAddress, &memory_info, sizeof (memory_info))) {\n" + +" /* Assert postconditions */\n" + +" assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);\n" + +"#ifdef TRACE\n" + +" printf (\"Query %p %d %s\\n\", memory_info.BaseAddress, memory_info.RegionSize,\n" + +" memory_info.State == MEM_FREE ? \"FREE\":\n" + +" (memory_info.State == MEM_RESERVE ? \"RESERVED\":\n" + +" (memory_info.State == MEM_COMMIT ? \"COMMITTED\": \"?\")));\n" + +"#endif\n" + +" /* Region is free, well aligned and big enough: we are done */\n" + +" if (memory_info.State == MEM_FREE &&\n" + +" (unsigned) memory_info.BaseAddress % g_regionsize == 0 &&\n" + +" memory_info.RegionSize >= (unsigned) reserve_size) {\n" + +" found = TRUE;\n" + +" break;\n" + +" }\n" + +" /* From now on we can't get contiguous memory! */\n" + +" contiguous = FALSE;\n" + +" /* Recompute size to reserve */\n" + +" reserve_size = CEIL (allocate_size, g_my_regionsize);\n" + +" memory_info.BaseAddress = (char *) memory_info.BaseAddress + memory_info.RegionSize;\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) memory_info.BaseAddress % g_pagesize == 0);\n" + +" assert (0 < reserve_size && reserve_size % g_regionsize == 0);\n" + +" }\n" + +" /* Search failed? */\n" + +" if (! found)\n" + +" goto sbrk_exit;\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) memory_info.BaseAddress % g_regionsize == 0);\n" + +" assert (0 < reserve_size && reserve_size % g_regionsize == 0);\n" + +" /* Try to reserve this */\n" + +" base_reserved = VirtualAlloc (memory_info.BaseAddress, reserve_size,\n" + +" MEM_RESERVE, PAGE_NOACCESS);\n" + +" if (! base_reserved) {\n" + +" int rc = GetLastError ();\n" + +" if (rc != ERROR_INVALID_ADDRESS)\n" + +" goto sbrk_exit;\n" + +" }\n" + +" /* A null pointer signals (hopefully) a race condition with another thread. */\n" + +" /* In this case, we try again. */\n" + +" } while (! base_reserved);\n" + +" /* Check returned pointer for consistency */\n" + +" if (memory_info.BaseAddress && base_reserved != memory_info.BaseAddress)\n" + +" goto sbrk_exit;\n" + +" /* Assert postconditions */\n" + +" assert ((unsigned) base_reserved % g_regionsize == 0);\n" + +"#ifdef TRACE\n" + +" printf (\"Reserve %p %d\\n\", base_reserved, reserve_size);\n" + +"#endif\n" + +" /* Did we get contiguous memory? */\n" + +" if (contiguous) {\n" + +" long start_size = (char *) g_last->top_committed - (char *) g_last->top_allocated;\n" + +" /* Adjust allocation size */\n" + +" allocate_size -= start_size;\n" + +" /* Adjust the regions allocation top */\n" + +" g_last->top_allocated = g_last->top_committed;\n" + +" /* Recompute the size to commit */\n" + +" to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;\n" + +" /* Round size to commit */\n" + +" commit_size = CEIL (to_commit, g_my_pagesize);\n" + +" }\n" + +" /* Append the new region to the list */\n" + +" if (! region_list_append (&g_last, base_reserved, reserve_size))\n" + +" goto sbrk_exit;\n" + +" /* Didn't we get contiguous memory? */\n" + +" if (! contiguous) {\n" + +" /* Recompute the size to commit */\n" + +" to_commit = (char *) g_last->top_allocated + allocate_size - (char *) g_last->top_committed;\n" + +" /* Round size to commit */\n" + +" commit_size = CEIL (to_commit, g_my_pagesize);\n" + +" }\n" + +" }\n" + +" }\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) g_last->top_committed % g_pagesize == 0);\n" + +" assert (0 < commit_size && commit_size % g_pagesize == 0); {\n" + +" /* Commit this */\n" + +" void *base_committed = VirtualAlloc (g_last->top_committed, commit_size,\n" + +" MEM_COMMIT, PAGE_READWRITE);\n" + +" /* Check returned pointer for consistency */\n" + +" if (base_committed != g_last->top_committed)\n" + +" goto sbrk_exit;\n" + +" /* Assert postconditions */\n" + +" assert ((unsigned) base_committed % g_pagesize == 0);\n" + +"#ifdef TRACE\n" + +" printf (\"Commit %p %d\\n\", base_committed, commit_size);\n" + +"#endif\n" + +" /* Adjust the regions commit top */\n" + +" g_last->top_committed = (char *) base_committed + commit_size;\n" + +" }\n" + +" }\n" + +" /* Adjust the regions allocation top */\n" + +" g_last->top_allocated = (char *) g_last->top_allocated + allocate_size;\n" + +" result = (char *) g_last->top_allocated - size;\n" + +" /* Deallocation requested? */\n" + +" } else if (size < 0) {\n" + +" long deallocate_size = - size;\n" + +" /* As long as we have a region to release */\n" + +" while ((char *) g_last->top_allocated - deallocate_size < (char *) g_last->top_reserved - g_last->reserve_size) {\n" + +" /* Get the size to release */\n" + +" long release_size = g_last->reserve_size;\n" + +" /* Get the base address */\n" + +" void *base_reserved = (char *) g_last->top_reserved - release_size;\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) base_reserved % g_regionsize == 0);\n" + +" assert (0 < release_size && release_size % g_regionsize == 0); {\n" + +" /* Release this */\n" + +" int rc = VirtualFree (base_reserved, 0,\n" + +" MEM_RELEASE);\n" + +" /* Check returned code for consistency */\n" + +" if (! rc)\n" + +" goto sbrk_exit;\n" + +"#ifdef TRACE\n" + +" printf (\"Release %p %d\\n\", base_reserved, release_size);\n" + +"#endif\n" + +" }\n" + +" /* Adjust deallocation size */\n" + +" deallocate_size -= (char *) g_last->top_allocated - (char *) base_reserved;\n" + +" /* Remove the old region from the list */\n" + +" if (! region_list_remove (&g_last))\n" + +" goto sbrk_exit;\n" + +" } {\n") + +( +" /* Compute the size to decommit */\n" + +" long to_decommit = (char *) g_last->top_committed - ((char *) g_last->top_allocated - deallocate_size);\n" + +" if (to_decommit >= g_my_pagesize) {\n" + +" /* Compute the size to decommit */\n" + +" long decommit_size = FLOOR (to_decommit, g_my_pagesize);\n" + +" /* Compute the base address */\n" + +" void *base_committed = (char *) g_last->top_committed - decommit_size;\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) base_committed % g_pagesize == 0);\n" + +" assert (0 < decommit_size && decommit_size % g_pagesize == 0); {\n" + +" /* Decommit this */\n" + +" int rc = VirtualFree ((char *) base_committed, decommit_size,\n" + +" MEM_DECOMMIT);\n" + +" /* Check returned code for consistency */\n" + +" if (! rc)\n" + +" goto sbrk_exit;\n" + +"#ifdef TRACE\n" + +" printf (\"Decommit %p %d\\n\", base_committed, decommit_size);\n" + +"#endif\n" + +" }\n" + +" /* Adjust deallocation size and regions commit and allocate top */\n" + +" deallocate_size -= (char *) g_last->top_allocated - (char *) base_committed;\n" + +" g_last->top_committed = base_committed;\n" + +" g_last->top_allocated = base_committed;\n" + +" }\n" + +" }\n" + +" /* Adjust regions allocate top */\n" + +" g_last->top_allocated = (char *) g_last->top_allocated - deallocate_size;\n" + +" /* Check for underflow */\n" + +" if ((char *) g_last->top_reserved - g_last->reserve_size > (char *) g_last->top_allocated ||\n" + +" g_last->top_allocated > g_last->top_committed) {\n" + +" /* Adjust regions allocate top */\n" + +" g_last->top_allocated = (char *) g_last->top_reserved - g_last->reserve_size;\n" + +" goto sbrk_exit;\n" + +" }\n" + +" result = g_last->top_allocated;\n" + +" }\n" + +" /* Assert invariants */\n" + +" assert (g_last);\n" + +" assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_allocated &&\n" + +" g_last->top_allocated <= g_last->top_committed);\n" + +" assert ((char *) g_last->top_reserved - g_last->reserve_size <= (char *) g_last->top_committed &&\n" + +" g_last->top_committed <= g_last->top_reserved &&\n" + +" (unsigned) g_last->top_committed % g_pagesize == 0);\n" + +" assert ((unsigned) g_last->top_reserved % g_regionsize == 0);\n" + +" assert ((unsigned) g_last->reserve_size % g_regionsize == 0);\n" + +"\n" + +"sbrk_exit:\n" + +"#if defined (USE_MALLOC_LOCK) && defined (NEEDED)\n" + +" /* Release spin lock */\n" + +" slrelease (&g_sl);\n" + +"#endif\n" + +" return result;\n" + +"}\n" + +"\n" + +"/* mmap for windows */\n" + +"static void *mmap (void *ptr, long size, long prot, long type, long handle, long arg) {\n" + +" static long g_pagesize;\n" + +" static long g_regionsize;\n" + +"#ifdef TRACE\n" + +" printf (\"mmap %d\\n\", size);\n" + +"#endif\n" + +"#if defined (USE_MALLOC_LOCK) && defined (NEEDED)\n" + +" /* Wait for spin lock */\n" + +" slwait (&g_sl);\n" + +"#endif\n" + +" /* First time initialization */\n" + +" if (! g_pagesize)\n" + +" g_pagesize = getpagesize ();\n" + +" if (! g_regionsize)\n" + +" g_regionsize = getregionsize ();\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) ptr % g_regionsize == 0);\n" + +" assert (size % g_pagesize == 0);\n" + +" /* Allocate this */\n" + +" ptr = VirtualAlloc (ptr, size,\n" + +" MEM_RESERVE | MEM_COMMIT | MEM_TOP_DOWN, PAGE_READWRITE);\n" + +" if (! ptr) {\n" + +" ptr = (void *) MORECORE_FAILURE;\n" + +" goto mmap_exit;\n" + +" }\n" + +" /* Assert postconditions */\n" + +" assert ((unsigned) ptr % g_regionsize == 0);\n" + +"#ifdef TRACE\n" + +" printf (\"Commit %p %d\\n\", ptr, size);\n" + +"#endif\n" + +"mmap_exit:\n" + +"#if defined (USE_MALLOC_LOCK) && defined (NEEDED)\n" + +" /* Release spin lock */\n" + +" slrelease (&g_sl);\n" + +"#endif\n" + +" return ptr;\n" + +"}\n" + +"\n" + +"/* munmap for windows */\n" + +"static long munmap (void *ptr, long size) {\n" + +" static long g_pagesize;\n" + +" static long g_regionsize;\n" + +" int rc = MUNMAP_FAILURE;\n" + +"#ifdef TRACE\n" + +" printf (\"munmap %p %d\\n\", ptr, size);\n" + +"#endif\n" + +"#if defined (USE_MALLOC_LOCK) && defined (NEEDED)\n" + +" /* Wait for spin lock */\n" + +" slwait (&g_sl);\n" + +"#endif\n" + +" /* First time initialization */\n" + +" if (! g_pagesize)\n" + +" g_pagesize = getpagesize ();\n" + +" if (! g_regionsize)\n" + +" g_regionsize = getregionsize ();\n" + +" /* Assert preconditions */\n" + +" assert ((unsigned) ptr % g_regionsize == 0);\n" + +" assert (size % g_pagesize == 0);\n" + +" /* Free this */\n" + +" if (! VirtualFree (ptr, 0,\n" + +" MEM_RELEASE))\n" + +" goto munmap_exit;\n" + +" rc = 0;\n" + +"#ifdef TRACE\n" + +" printf (\"Release %p %d\\n\", ptr, size);\n" + +"#endif\n" + +"munmap_exit:\n" + +"#if defined (USE_MALLOC_LOCK) && defined (NEEDED)\n" + +" /* Release spin lock */\n" + +" slrelease (&g_sl);\n" + +"#endif\n" + +" return rc;\n" + +"}\n" + +"\n" + +"static void vminfo (CHUNK_SIZE_T *free, CHUNK_SIZE_T *reserved, CHUNK_SIZE_T *committed) {\n" + +" MEMORY_BASIC_INFORMATION memory_info;\n" + +" memory_info.BaseAddress = 0;\n" + +" *free = *reserved = *committed = 0;\n" + +" while (VirtualQuery (memory_info.BaseAddress, &memory_info, sizeof (memory_info))) {\n" + +" switch (memory_info.State) {\n" + +" case MEM_FREE:\n" + +" *free += memory_info.RegionSize;\n" + +" break;\n" + +" case MEM_RESERVE:\n" + +" *reserved += memory_info.RegionSize;\n" + +" break;\n" + +" case MEM_COMMIT:\n" + +" *committed += memory_info.RegionSize;\n" + +" break;\n" + +" }\n" + +" memory_info.BaseAddress = (char *) memory_info.BaseAddress + memory_info.RegionSize;\n" + +" }\n" + +"}\n" + +"\n") + +( +"static int cpuinfo (int whole, CHUNK_SIZE_T *kernel, CHUNK_SIZE_T *user) {\n" + +" if (whole) {\n" + +" __int64 creation64, exit64, kernel64, user64;\n" + +" int rc = GetProcessTimes (GetCurrentProcess (),\n" + +" (FILETIME *) &creation64,\n" + +" (FILETIME *) &exit64,\n" + +" (FILETIME *) &kernel64,\n" + +" (FILETIME *) &user64);\n" + +" if (! rc) {\n" + +" *kernel = 0;\n" + +" *user = 0;\n" + +" return FALSE;\n" + +" }\n" + +" *kernel = (CHUNK_SIZE_T) (kernel64 / 10000);\n" + +" *user = (CHUNK_SIZE_T) (user64 / 10000);\n" + +" return TRUE;\n" + +" } else {\n" + +" __int64 creation64, exit64, kernel64, user64;\n" + +" int rc = GetThreadTimes (GetCurrentThread (),\n" + +" (FILETIME *) &creation64,\n" + +" (FILETIME *) &exit64,\n" + +" (FILETIME *) &kernel64,\n" + +" (FILETIME *) &user64);\n" + +" if (! rc) {\n" + +" *kernel = 0;\n" + +" *user = 0;\n" + +" return FALSE;\n" + +" }\n" + +" *kernel = (CHUNK_SIZE_T) (kernel64 / 10000);\n" + +" *user = (CHUNK_SIZE_T) (user64 / 10000);\n" + +" return TRUE;\n" + +" }\n" + +"}\n" + +"\n" + +"#endif /* WIN32 */\n" + +"\n" + +"#endif // NDEBUG\n" + +"\n" + +"}; /* end of namespace KJS */\n"); + + +var thai = +"ประเทศไทย\n" + +"จากวิกิพีเดีย สารานุกรมเสรี\n" + +"ไปที่: ป้ายบอกทาง, ค้นหา\n" + +" \n" + +"\n" + +"เนื่องจากบทความนี้ถูกล็อกเนื่องจาก ถูกก่อกวนหลายครั้งติดต่อกัน การแก้ไขจากผู้ที่ไม่ได้ลงทะเบียน หรือผู้ใช้ใหม่ไม่สามารถทำได้ขณะนี้\n" + +"คุณสามารถแสดงความเห็น เสนอข้อความ หรือขอให้ยกเลิกการป้องกันได้ในหน้าอภิปราย หรือลงทะเบียนโดยสร้างชื่อผู้ใช้\n" + +" \n" + +"วิกิพีเดีย:บทความคัดสรร\n" + +"\n" + +" \"ไทย\" เปลี่ยนทางมาที่นี่ สำหรับความหมายอื่น ดูที่ ไทย (แก้ความกำกวม)\n" + +"\n" + +"ราชอาณาจักรไทย\n" + +"ธงชาติไทย ตราแผ่นดินของไทย\n" + +"ธงชาติ ตราแผ่นดิน\n" + +"คำขวัญ: ชาติ ศาสนา พระมหากษัตริย์\n" + +"เพลงชาติ: เพลงชาติไทย\n" + +"แผนที่แสดงที่ตั้งของประเทศไทย\n" + +"เมืองหลวง กรุงเทพมหานคร\n" + +"13°44′N 100°30′E\n" + +"เมืองใหญ่สุด กรุงเทพมหานคร\n" + +"ภาษาราชการ ภาษาไทย\n" + +"รัฐบาล เผด็จการทหาร\n" + +" - ประมุขแห่งรัฐ พระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช\n" + +" - นายกรัฐมนตรี พลเอกสุรยุทธ์ จุลานนท์\n" + +" - ประธานคณะมนตรีความมั่นคงแห่งชาติ พลอากาศเอก ชลิต พุกผาสุข (รักษาการ)\n" + +"สถาปนาเป็น\n" + +"• สุโขทัย\n" + +"• กรุงศรีอยุธยา\n" + +"• กรุงธนบุรี\n" + +"• กรุงรัตนโกสินทร์ \n" + +"พ.ศ. 1781–1911\n" + +"1893–2310\n" + +"2310–6 เมษายน 2325\n" + +"6 เมษายน 2325–ปัจจุบัน\n" + +"เนื้อที่\n" + +" - ทั้งหมด\n" + +" \n" + +" - พื้นน้ำ (%) \n" + +"514,000 กม.² (อันดับที่ 49)\n" + +"198,457 ไมล์² \n" + +"0.4%\n" + +"ประชากร\n" + +" - 2548 ประมาณ\n" + +" - 2543\n" + +" - ความหนาแน่น \n" + +"62,418,054 (อันดับที่ 19)\n" + +"60,916,441\n" + +"122/กม² (อันดับที่ 59)\n" + +"{{{population_densitymi²}}}/ไมล์² \n" + +"GDP (PPP)\n" + +" - รวม\n" + +" - ต่อประชากร 2548 ค่าประมาณ\n" + +"$559.5 billion (อันดับที่ 21)\n" + +"$8,542 (อันดับที่ 72)\n" + +"HDI (2546) 0.778 (อันดับที่ 73) – ปานกลาง\n" + +"สกุลเงิน บาท (฿) (THB)\n" + +"เขตเวลา (UTC+7)\n" + +"รหัสอินเทอร์เน็ต .th\n" + +"รหัสโทรศัพท์ +66\n" + +"\n" + +"ประเทศไทย หรือ ราชอาณาจักรไทย ตั้งอยู่ในเอเชียตะวันออกเฉียงใต้ มีพรมแดนทางทิศตะวันออกติดลาวและกัมพูชา ทิศใต้ติดอ่าวไทยและมาเลเซีย ทิศตะวันตกติดทะเลอันดามันและพม่า และทิศเหนือติดพม่าและลาว โดยมีแม่น้ำโขงกั้นเป็นบางช่วง\n" + +"\n" + +"ประเทศไทยเป็นสมาชิกของสหประชาชาติ เอเปค และ อาเซียน มีศูนย์รวมการปกครองอยู่ที่ กรุงเทพมหานคร ซึ่งเป็นเมืองหลวงของประเทศ\n" + +"\n" + +"พระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช ทรงเป็นพระมหากษัตริย์ที่ครองราชย์ ในฐานะประมุขแห่งรัฐ ยาวนานที่สุดในโลกถึง 60 ปี\n" + +"\n" + +"\n" + +"เนื้อหา\n" + +"[ซ่อน]\n" + +"\n" + +" * 1 ประวัติศาสตร์\n" + +" o 1.1 ชื่อประเทศไทย\n" + +" * 2 การเมืองการปกครอง\n" + +" o 2.1 เขตการปกครอง\n" + +" o 2.2 เมืองใหญ่ / จังหวัดใหญ่\n" + +" * 3 ภูมิอากาศและภูมิประเทศ\n" + +" o 3.1 ภูมิประเทศ\n" + +" o 3.2 ภูมิอากาศ\n" + +" * 4 เศรษฐกิจ\n" + +" o 4.1 เศรษฐกิจหลักของประเทศ\n" + +" o 4.2 การคมนาคม\n" + +" o 4.3 การสื่อสาร\n" + +" * 5 สังคม\n" + +" o 5.1 ชนชาติ\n" + +" o 5.2 ศาสนา\n" + +" o 5.3 การศึกษา\n" + +" o 5.4 ภาษา\n" + +" o 5.5 ศิลปะและวัฒนธรรม\n" + +" o 5.6 กีฬา\n" + +" o 5.7 วันสำคัญ\n" + +" * 6 ลำดับที่สำคัญ\n" + +" * 7 อ้างอิง\n" + +" * 8 แหล่งข้อมูลอื่น\n" + +"\n" + +"ประวัติศาสตร์\n" + +"\n" + +" ดูบทความหลักที่ ประวัติศาสตร์ไทย\n" + +"\n" + +"ประเทศไทยมีประวัติศาสตร์ยาวนานมากนับเริ่มแต่การล่มสลายของราชอาณาจักรขอม-จักรวรรดินครวัต นครธม เมื่อต้นๆ คริสต์ศตวรรษที่ 13 [1]โดยมีความสืบเนื่องและคาบเกี่ยวระหว่างอาณาจักรโบราณหลายแห่ง เช่น อาณาจักรทวารวดี ศรีวิชัย ละโว้ เขมร ฯลฯ โดยเริ่มมีความชัดเจนในอาณาจักรสุโขทัยตั้งแต่ปี พ.ศ. 1781 อาณาจักรล้านนาทางภาคเหนือ กระทั่งเสื่อมอำนาจลงในช่วงต้นพุทธศตวรรษที่ 19 แล้วความรุ่งเรืองได้ปรากฏขึ้นในอาณาจักรทางใต้ ณ กรุงศรีอยุธยา โดยยังมีอาณาเขตที่ไม่แน่ชัด ครั้นเมื่อเสียกรุงศรีอยุธยาเป็นครั้งที่สองในปี พ.ศ. 2310 พระเจ้าตากสินจึงได้ย้ายราชธานีมาอยู่ที่กรุงธนบุรี\n" + +"\n" + +"ภายหลังสิ้นสุดอำนาจและมีการสถาปนากรุงรัตนโกสินทร์เมื่อ พ.ศ. 2325 อาณาจักรสยามเริ่มมีความเป็นปึกแผ่น มีการผนวกดินแดนบางส่วนของอาณาจักรล้านช้าง ครั้นในรัชกาลที่ 5 ได้ผนวกดินแดนของเมืองเชียงใหม่ หรืออาณาจักรล้านนาส่วนล่าง (ส่วนบนอยู่บริเวณเชียงตุง) เป็นการรวบรวมดินแดนครั้งใหญ่ครั้งสุดท้าย วันที่ 24 มิถุนายน พ.ศ. 2475 ได้เปลี่ยนแปลงการปกครองมาเป็นระบอบประชาธิปไตยแต่ก็ต้องรออีกถึง 41 ปี กว่าจะได้นายกรัฐมนตรีที่มาจากการเลือกตั้งครั้งแรกเมื่อ พ.ศ. 2516 หลังจากเหตุการณ์ 14 ตุลา หลังจากนั้นมีเหตุการณ์เรียกร้องประชาธิปไตยอีกสองครั้งคือ เหตุการณ์ 6 ตุลา และ เหตุการณ์พฤษภาทมิฬ ล่าสุดได้เกิดรัฐประหารขึ้นอีกครั้งในเดือนกันยายน พ.ศ. 2549 ซึ่งเป็นการยึดอำนาจจากรัฐบาลรักษาการ หลังจากได้มีการยุบสภาผู้แทนราษฎรเมื่อเดือนกุมภาพันธ์ 2549\n" + +"\n" + +"ชื่อประเทศไทย\n" + +"\n" + +"คำว่า ไทย มีความหมายในภาษาไทยว่า อิสรภาพ เสรีภาพ หรืออีกความหมายคือ ใหญ่ ยิ่งใหญ่ เพราะการจะเป็นอิสระได้จะต้องมีกำลังที่มากกว่า แข็งแกร่งกว่า เพื่อป้องกันการรุกรานจากข้าศึก เดิมประเทศไทยใช้ชื่อ สยาม (Siam) แต่ได้เปลี่ยนมาเป็นชื่อปัจจุบัน เมื่อปี พ.ศ. 2482 ตามประกาศรัฐนิยม ฉบับที่ 1 ของรัฐบาลจอมพล ป. พิบูลสงคราม ให้ใช้ชื่อ ประเทศ ประชาชน และสัญชาติว่า \"ไทย\" โดยในช่วงต่อมาได้เปลี่ยนกลับเป็นสยามเมื่อปี พ.ศ. 2488 ในช่วงเปลี่ยนนายกรัฐมนตรี แต่ในที่สุดได้เปลี่ยนกลับมาชื่อไทยอีกครั้งในปี พ.ศ. 2491 ซึ่งเป็นช่วงที่จอมพล ป. พิบูลสงครามเป็นนายกรัฐมนตรีในสมัยต่อมา ช่วงแรกเปลี่ยนเฉพาะชื่อภาษาไทยเท่านั้น ชื่อภาษาฝรั่งเศส[2]และอังกฤษคงยังเป็น \"Siam\" อยู่จนกระทั่งเดือนเมษายน พ.ศ. 2491 จึงได้เปลี่ยนชื่อภาษาฝรั่งเศสเป็น \"Thaïlande\" และภาษาอังกฤษเป็น \"Thailand\" อย่างในปัจจุบัน อย่างไรก็ตาม ชื่อ สยาม ยังเป็นที่รู้จักแพร่หลายทั้งในและต่างประเทศ.\n" + +"\n" + +"การเมืองการปกครอง\n" + +"\n" + +"เดิมประเทศไทยมีการปกครองระบอบสมบูรณาญาสิทธิราชย์ จนกระทั่งวันที่ 24 มิถุนายน พ.ศ. 2475 คณะราษฎรได้ทำการเปลี่ยนแปลงการปกครองเป็นราชาธิปไตยภายใต้รัฐธรรมนูญ โดยแบ่งอำนาจเป็นสามฝ่าย ได้แก่ ฝ่ายบริหาร ฝ่ายนิติบัญญัติและฝ่ายตุลาการ โดยฝ่ายบริหารจะมีนายกรัฐมนตรีเป็นหัวหน้ารัฐบาลซึ่งมากจากการแต่งตั้ง ฝ่ายนิติบัญญัติ ได้แก่ สภานิติบัญญัติแห่งชาติ และฝ่ายตุลาการ คือ ศาลยุติธรรม ศาลรัฐธรรมนูญ และศาลปกครอง\n" + +"\n" + +"ปัจจุบัน ประเทศไทยอยู่ภายใต้การปกครองระบอบเผด็จการทหาร โดยมีรัฐบาลชั่วคราวซึ่งแต่งตั้งโดยคณะมนตรีความมั่นคงแห่งชาติ หลังเกิดเหตุการณ์รัฐประหารเมื่อคืนวันที่ 19 กันยายน พ.ศ. 2549\n" + +"\n" + +"เขตการปกครอง\n" + +"\n" + +"ประเทศไทยแบ่งเขตการบริหารออกเป็น การบริหารราชการส่วนภูมิภาค ได้แก่จังหวัด 75 จังหวัด นอกจากนั้นยังมีการปกครองส่วนท้องถิ่น ได้แก่ กรุงเทพมหานคร เมืองพัทยา องค์การบริหารส่วนจังหวัด เทศบาล และองค์การบริหารส่วนตำบล ส่วน'สุขาภิบาล'นั้นถูกยกฐานะไปเป็นเทศบาลทั้งหมดในปี พ.ศ. 2542\n" + +"\n" + +" รายชื่อจังหวัดทั้งหมดดูเพิ่มเติมที่ จังหวัดในประเทศไทย\n" + +"\n" + +"เมืองใหญ่ / จังหวัดใหญ่\n" + +"ประเทศไทย จังหวัดในประเทศไทย\n" + +"ประเทศไทย จังหวัดในประเทศไทย\n" + +"กรุงเทพมหานครริมแม่น้ำเจ้าพระยา\n" + +"กรุงเทพมหานครริมแม่น้ำเจ้าพระยา\n" + +"\n" + +"นอกจากกรุงเทพมหานครแล้ว มีหลายเมืองที่มีประชากรอยู่เป็นจำนวนมาก (ข้อมูลเดือนตุลาคม พ.ศ. 2549 ของ กรมการปกครอง กระทรวงมหาดไทย ) โดยเรียงลำดับตามตารางด้านล่าง โดยดูจากจำนวนประชากรในเขตเทศบาลและกรุงเทพมหานคร ซึ่งจะแสดงประชากรในเขตเมืองได้อย่างแท้จริง\n" + +"อันดับ เมือง / เทศบาล จำนวนประชากร จังหวัด\n" + +"1 กรุงเทพมหานคร 6,121,672 กรุงเทพมหานคร\n" + +"2 นนทบุรี 266,941 นนทบุรี\n" + +"3 ปากเกร็ด 167,138 นนทบุรี\n" + +"4 หาดใหญ่ 157,678 สงขลา\n" + +"5 เชียงใหม่ 150,805 เชียงใหม่\n" + +"6 นครราชสีมา 149,938 นครราชสีมา\n" + +"7 อุดรธานี 142,670 อุดรธานี\n" + +"8 สุราษฎร์ธานี 124,665 สุราษฎร์ธานี\n" + +"9 ขอนแก่น 121,283 ขอนแก่น\n" + +"10 นครศรีธรรมราช 106,293 นครศรีธรรมราช\n" + +"\n" + +"นอกจากนี้ยังมีการเรียงลำดับประชากรตามจังหวัดได้ดังต่อไปนี้\n" + +"อันดับ จังหวัด จำนวนประชากร ภาค\n" + +"1 กรุงเทพมหานคร 6,121,672 ภาคกลาง\n" + +"2 นครราชสีมา 2,546,763 ภาคตะวันออกเฉียงเหนือ\n" + +"3 อุบลราชธานี 1,774,808 ภาคตะวันออกเฉียงเหนือ\n" + +"4 ขอนแก่น 1,747,542 ภาคตะวันออกเฉียงเหนือ\n" + +"5 เชียงใหม่ 1,650,009 ภาคเหนือ\n" + +"6 บุรีรัมย์ 1,531,430 ภาคตะวันออกเฉียงเหนือ\n" + +"7 อุดรธานี 1,523,802 ภาคตะวันออกเฉียงเหนือ\n" + +"8 นครศรีธรรมราช 1,504,420 ภาคใต้\n" + +"9 ศรีสะเกษ 1,443,975 ภาคตะวันออกเฉียงเหนือ\n" + +"10 สุรินทร์ 1,374,700 ภาคตะวันออกเฉียงเหนือ\n" + +"\n" + +" ดูข้อมูลทั้งหมดที่ เมืองใหญ่ของประเทศไทยเรียงตามจำนวนประชากร และ จังหวัดในประเทศไทยเรียงตามจำนวนประชากร\n" + +"\n" + +"ภูมิอากาศและภูมิประเทศ\n" + +"\n" + +"ภูมิประเทศ\n" + +"ประเทศไทย สภาพทางภูมิศาสตร์\n" + +"ประเทศไทย สภาพทางภูมิศาสตร์\n" + +"\n" + +"ประเทศไทยมีสภาพทางภูมิศาสตร์ที่หลากหลาย ภาคเหนือประกอบด้วยเทือกเขาจำนวนมาก จุดที่สูงที่สุด คือ ดอยอินทนนท์ (2,576 เมตร) ในจังหวัดเชียงใหม่ ภาคตะวันออกเฉียงเหนือเป็นที่ราบสูงโคราชติดกับแม่น้ำโขงทางด้านตะวันออก ภาคกลางเป็นที่ราบลุ่มแม่น้ำเจ้าพระยา ซึ่งสายน้ำไหลลงสู่อ่าวไทย ภาคใต้มีจุดที่แคบลง ณ คอคอดกระแล้วขยายใหญ่เป็นคาบสมุทรมลายู\n" + +"\n" + +" * เมื่อเปรียบเทียบพื้นที่ของประเทศไทย กับ ประเทศอื่น จะได้ดังนี้\n" + +" o ประเทศพม่า ใหญ่กว่าประเทศไทยประมาณ 1.3 เท่า\n" + +" o ประเทศอินโดนีเซีย ใหญ่กว่าประมาณ 3.7 เท่า\n" + +" o ประเทศอินเดีย ใหญ่กว่าประมาณ 6.4 เท่า\n" + +" o ประเทศจีน และ สหรัฐอเมริกา ใหญ่กว่าประมาณ 19 เท่า\n" + +" o ประเทศรัสเซีย ใหญ่กว่าประมาณ 33 เท่า\n" + +" o ขนาดใกล้เคียงกับ ประเทศฝรั่งเศส ประเทศสวีเดน และ ประเทศสเปน\n" + +"\n" + +"วันที่ 26 ธันวาคม พ.ศ. 2547 ได้มีเหตุการณ์คลื่นสึนามิเกิดขึ้นก่อความเสียหายในเขตภาคใต้ของประเทศไทย\n" + +"\n" + +"ภูมิอากาศ\n" + +"\n" + +"ภูมิอากาศของไทยเป็นแบบเขตร้อน อากาศร้อนที่สุดในเดือนเมษายน-พฤษภาคม โดยจะมีฝนตกและเมฆมากจากลมมรสุมตะวันตกเฉียงใต้ในช่วงกลางเดือนพฤษภาคม-เดือนตุลาคม ส่วนในเดือนพฤศจิกายนถึงกลางเดือนมีนาคม อากาศแห้ง และหนาวเย็นจากลมมรสุมตะวันออกเฉียงเหนือ ยกเว้นภาคใต้ที่มีอากาศร้อนชื้นตลอดทั้งปี\n" + +"\n" + +"เศรษฐกิจ\n" + +"\n" + +"เศรษฐกิจหลักของประเทศ\n" + +"\n" + +"เกษตรกรรม อุตสาหกรรม การท่องเที่ยว การบริการ และ ทรัพยากรธรรมชาติ ถือเป็นเศรษฐกิจหลักที่ทำรายได้ให้กับคนในประเทศ โดยภาพรวมทางเศรษฐกิจอ้างอิงเมื่อ พ.ศ. 2546 มี GDP 5,930.4 พันล้านบาท ส่งออกมูลค่า 78.1 พันล้านเหรียญสหรัฐ ในขณะที่นำเข้า 74.3 พันล้านเหรียญสหรัฐ[3]\n" + +"ภาพพันธุ์ข้าวจากกรมวิชาการเกษตร\n" + +"ภาพพันธุ์ข้าวจากกรมวิชาการเกษตร\n" + +"ภาพยางพาราจากกรมวิชาการเกษตร\n" + +"ภาพยางพาราจากกรมวิชาการเกษตร\n" + +"\n" + +"ในด้านเกษตรกรรม ข้าว ถือเป็นผลผลิตที่สำคัญที่สุด เป็นผู้ผลิตและส่งออกข้าว เป็นอันดับหนึ่งของโลก ด้วยสัดส่วนการส่งออก ร้อยละ 36 รองลงมาคือ เวียดนาม ร้อยละ 20 อินเดีย ร้อยละ 18 สหรัฐอเมริกา ร้อยละ14 ปากีสถาน ร้อยละ 12 ตามลำดับ [4] พืชผลทางการเกษตรอื่นๆ ได้แก่ ยางพารา ผักและผลไม้ต่างๆ มีการเพาะเลี้ยงปศุสัตว์เช่น วัว สุกร เป็ด ไก่ สัตว์น้ำทั้งปลาน้ำจืด ปลาน้ำเค็มในกระชัง นากุ้ง เลี้ยงหอย รวมถึงการประมงทางทะเล ปี 2549 ไทยมีการส่งออกกุ้งไปสหรัฐฯ 177,717.29 ตัน มูลค่า 45,434.57 ล้านบาท [5]\n" + +"\n" + +"อุตสาหกรรมที่สำคัญ ได้แก่ อุตสาหกรรมแปรรูปทางการเกษตร สิ่งทอ อิเล็กทรอนิกส์ รถยนต์ ส่วนทรัพยากรธรรมชาติที่สำคัญเช่น ดีบุก ก๊าซธรรมชาติ จากข้อมูลปี พ.ศ. 2547 มีการผลิตสิ่งทอมูลค่า 211.4 พันล้านบาท แผงวงจรรวม 196.4 พันล้านบาท อาหารทะเลกระป๋อง 36.5 พันล้านบาท สับปะรดกระป๋อง 11.1 พันล้านบาท รถยนต์ส่วนบุคคล 2.99 แสนคัน รถบรรทุก รถกระบะ และอื่นๆ รวม 6.28 แสนคัน จักรยานยนต์ 2.28 ล้านคัน ดีบุก 694 ตัน ก๊าซธรรมชาติ 789 พันล้านลูกบาศก์ฟุต น้ำมันดิบ]] 31.1 ล้านบาร์เรล [6]\n" + +"เกาะพีพี สถานท่องเที่ยวที่สำคัญแห่งหนึ่งของประเทศ\n" + +"เกาะพีพี สถานท่องเที่ยวที่สำคัญแห่งหนึ่งของประเทศ\n" + +"\n" + +"ส่วนด้านการท่องเที่ยว การบริการและโรงแรม ในปี พ.ศ. 2547 มีนักท่องเที่ยวรวม 11.65 ล้านคน 56.52% มาจากเอเชียตะวันออกและอาเซียน (โดยเฉพาะมาเลเซียคิดเป็น 11.97% ญี่ปุ่น 10.33%) ยุโรป 24.29% ทวีปอเมริกาเหนือและใต้รวมกัน 7.02% [7] สถานที่ท่องเที่ยวที่สำคัญได้แก่ กรุงเทพมหานคร พัทยา ภาคใต้ฝั่งทะเลอันดามัน จังหวัดเชียงใหม่\n" + +"\n" + +"การคมนาคม\n" + +"\n" + +"ดูบทความหลัก การคมนาคมในประเทศไทย\n" + +"\n" + +"การคมนาคมในประเทศไทย ส่วนใหญ่ประกอบด้วย การเดินทางโดยรถยนต์ และ จักรยานยนต์ ทางหลวงสายหลักในประเทศไทย ได้แก่ ถนนพหลโยธิน (ทางหลวงหมายเลข 1) ถนนมิตรภาพ (ทางหลวงหมายเลข 2) ถนนสุขุมวิท (ทางหลวงหมายเลข 3) และถนนเพชรเกษม (ทางหลวงหมายเลข 4) และยังมีทางหลวงพิเศษระหว่างเมือง (มอเตอร์เวย์) ใน 2 เส้นทางคือ มอเตอร์เวย์กรุงเทพฯ-ชลบุรี (ทางหลวงหมายเลข 7) และถนนกาญจนาภิเษก (วงแหวนรอบนอกกรุงเทพมหานคร - ทางหลวงหมายเลข 9) นอกจากนี้ระบบขนส่งมวลชนจะมีการบริการตามเมืองใหญ่ต่างๆ ได้แก่ระบบรถเมล์ และรถไฟ รวมถึงระบบที่เริ่มมีการใช้งาน รถไฟลอยฟ้า และรถไฟใต้ดิน และในหลายพื้นที่จะมีการบริการรถสองแถว รวมถึงรถรับจ้างต่างๆ ได้แก่ แท็กซี่ เมลเครื่อง มอเตอร์ไซค์รับจ้าง และ รถตุ๊กตุ๊ก ในบางพื้นที่ ที่อยู่ริมน้ำจะมีเรือรับจ้าง และแพข้ามฟาก บริการ\n" + +"รถไฟฟ้าบีทีเอส สถานีอโศก\n" + +"รถไฟฟ้าบีทีเอส สถานีอโศก\n" + +"\n" + +"สำหรับการคมนาคมทางอากาศนั้น ปัจจุบันประเทศไทยได้เปิดใช้ท่าอากาศยานสุวรรณภูมิ ซึ่งเป็นท่าอากาศยานที่มีขนาดตัวอาคารที่ใหญ่ที่สุดในโลก และมีหอบังคับการบินที่สูงที่สุดในโลก ด้วยความสูง 132.2 เมตร ซึ่งรองรับผู้โดยสารได้ 45 ล้านคนต่อปี โดยเปิดอย่างเป็นทางการตั้งแต่วันที่ 29 กันยายน พ.ศ. 2549 ทดแทนท่าอากาศยานนานาชาติกรุงเทพ (ดอนเมือง) ที่เปิดใช้งานมานานถึง 92 ปี\n" + +"\n" + +"ส่วนการคมนาคมทางน้ำ ประเทศไทยมีท่าเรือหลักๆ คือ ท่าเรือกรุงเทพ(คลองเตย) และท่าเรือแหลมฉบัง\n" + +"\n" + +"การสื่อสาร\n" + +"\n" + +" * ระบบโทรศัพท์ในประเทศไทยมีโทรศัพท์พื้นฐาน 7.035 ล้านหมายเลข (2548) และโทรศัพท์มือถือ 27.4 ล้านหมายเลข (2548) [8]\n" + +" * สถานีวิทยุ: คลื่นเอฟเอ็ม 334 สถานี , คลื่นเอเอ็ม 204 สถานี และ คลื่นสั้น 6 สถานี (2542) โดยมีจำนวนผู้ใช้วิทยุ 13.96 ล้านคน (2540) [8]\n" + +" * สถานีโทรทัศน์ มี 6 ช่องสถานี (โดยทุกช่องสถานีแม่ข่ายอยู่ในกรุงเทพ) มีสถานีเครือข่ายทั้งหมด 111 สถานี และจำนวนผู้ใช้โทรทัศน์ 15.19 ล้านคน (2540) [8]\n" + +" * รหัสโดเมนอินเทอร์เน็ตใช้รหัส th\n" + +"\n" + +"สังคม\n" + +"วัดพระศรีรัตนศาสดาราม กรุงเทพมหานคร\n" + +"วัดพระศรีรัตนศาสดาราม กรุงเทพมหานคร\n" + +"\n" + +"ชนชาติ\n" + +"\n" + +"ในประเทศไทย ถือได้ว่า มีความหลากหลายทางเชื้อชาติ มีทั้ง ชาวไทย ชาวไทยเชื้อสายลาว ชาวไทยเชื้อสายมอญ ชาวไทยเชื้อสายเขมร รวมไปถึงกลุ่มชาวไทยเชื้อสายจีน ชาวไทยเชื้อสายมลายู ชาวชวา(แขกแพ) ชาวจาม(แขกจาม) ชาวเวียด ไปจนถึงชาวพม่า และชาวไทยภูเขาเผ่าต่างๆ เช่น ชาวกะเหรี่ยง ชาวลีซอ ชาวอ่าข่า ชาวอีก้อ ชาวม้ง ชาวเย้า รวมไปจนถึงชาวส่วย ชาวกูบ ชาวกวย ชาวจะราย ชาวระแดว์ ชาวข่า ชาวขมุ ซึ่งมีในปัจจุบันก็มีความสำคัญมาก ต่อวิถีชีวิต และวัฒนธรรมไทยในปัจจุบัน\n" + +"\n" + +"ประชากรชาวไทย 75% ชาวไทยเชื้อสายจีน 14% และอื่นๆ 11% [8]\n" + +"\n" + +" ดูเพิ่มที่ ชาวไทย\n" + +"\n" + +"ศาสนา\n" + +"พระพุทธชินราช วัดพระศรีรัตนมหาธาตุวรมหาวิหาร จังหวัดพิษณุโลก\n" + +"พระพุทธชินราช วัดพระศรีรัตนมหาธาตุวรมหาวิหาร จังหวัดพิษณุโลก\n" + +"\n" + +"ประมาณร้อยละ 95 ของประชากรไทยนับถือศาสนาพุทธซึ่งเป็นศาสนาประจำชาติ(โดยพฤตินัย) นิกายเถรวาท ศาสนาอิสลามประมาณร้อยละ 4 (ส่วนใหญ่เป็นชาวไทยทางภาคใต้ตอนล่าง) ศาสนาคริสต์และศาสนาอื่นประมาณร้อยละ 1\n" + +"\n" + +" ดูเพิ่มที่ พระพุทธศาสนาในประเทศไทย\n" + +"\n" + +"การศึกษา\n" + +"\n" + +"ในทางกฎหมาย รัฐบาลจะต้องจัดการศึกษาให้ขั้นพื้นฐานสิบสองปี แต่การศึกษาขั้นบังคับของประเทศไทยในปัจจุบันคือเก้าปี บุคคลทั่วไปจะเริ่มจากระดับชั้นอนุบาล เป็นการเตรียมความพร้อมก่อนการเรียนตามหลักสูตรพื้นฐาน ต่อเนื่องด้วยระดับประถมศึกษาและมัธยมศึกษาตอนต้น หลังจากจบการศึกษาระดับมัธยมต้น สามารถเลือกได้ระหว่างศึกษาต่อสายสามัญ ระดับมัธยมศึกษาตอนปลายเพื่อศึกษาต่อในระดับมหาวิทยาลัย หรือเลือกศึกษาต่อสายวิชาชีพ ในวิทยาลัยเทคนิค หรือพาณิชยการ หรือเลือกศึกษาต่อในสถาบันทางทหารหรือตำรวจ\n" + +"\n" + +"โรงเรียนและมหาวิทยาลัยในประเทศไทย แบ่งออกเป็น 2 ประเภทหลักได้แก่ โรงเรียนรัฐบาล และโรงเรียนเอกชน และ มหาวิทยาลัยรัฐบาล และมหาวิทยาลัยเอกชน โดยโรงเรียนรัฐบาลและมหาวิทยาลัยรัฐบาล จะเสียค่าเล่าเรียนน้อยกว่า โรงเรียนเอกชนและมหาวิทยาลัยเอกชน\n" + +"\n" + +" ดูเพิ่มที่ รายชื่อสถาบันอุดมศึกษาในประเทศไทย\n" + +"\n" + +"ภาษา\n" + +"\n" + +" ดูบทความหลักที่ ภาษาในประเทศไทย\n" + +"\n" + +"ภาษาไทย ประเทศไทยมีภาษาไทยเป็นภาษาราชการ ภาษาพูดของคนไทยมีมาแต่เมื่อไรยังไม่เป็นที่ทราบแน่ชัด แต่จากการสันนิฐานน่าจะมีมากว่า 4,000 ปีแล้ว ส่วนตัวอักษรนั้นเพิ่งมีการประดิษฐ์ขึ้นอย่างเป็นทางการในสมัยสุโขทัยโดย พ่อขุนรามคำแหงมหาราช ส่วนภาษาอื่นที่มีการใช้อยู่บ้าง เช่น ภาษาอังกฤษ ภาษาจีน เป็นต้น\n" + +"\n" + +"ศิลปะและวัฒนธรรม\n" + +"พระที่นั่งไอศวรรย์ทิพย์อาสน์ พระราชวังบางปะอิน จังหวัดพระนครศรีอยุธยา\n" + +"พระที่นั่งไอศวรรย์ทิพย์อาสน์ พระราชวังบางปะอิน จังหวัดพระนครศรีอยุธยา\n" + +"\n" + +"ศิลปะไทยมีลักษณะเฉพาะตัวค่อนข้างสูง โดยมีความกลมกลืนและคล้ายคลึงกับศิลปวัฒนธรรมเพื่อนบ้านอยู่บ้าง แต่ด้วยการสืบทอดและการสร้างสรรค์ใหม่ ทำให้ศิลปะไทยมีเอกลักษณ์สูง\n" + +"\n" + +" * จิตรกรรม งานจิตรกรรมไทยนับว่าเป็นงานศิลปะชั้นสูง ได้รับการสืบทอดมาช้านาน มักปรากฏในงานจิตรกรรมฝาผนัง ตามวัดวาอาราม รวมทั้งในสมุดข่อยโบราณ งานจิตรกรรมไทยยังเกี่ยวข้องกับงานศิลปะแขนงอื่นๆ เช่น งานลงรักปิดทอง ภาพวาดพระบฏ เป็นต้น\n" + +" * ประติมากรรม เดิมนั้นช่างไทยทำงานประติมากรรมเฉพาะสิ่งศักดิ์สิทธิ์ เช่น พระพุทธรูป เทวรูป โดยมีสกุลช่างต่างๆ นับตั้งแต่ก่อนสมัยสุโขทัย เรียกว่า สกุลช่างเชียงแสน สกุลช่างสุโขทัย อยุธยา และกระทั่งรัตนโกสินทร์ โดยใช้ทองสำริดเป็นวัสดุหลักในงานประติมากรรม เนื่องจากสามารถแกะแบบด้วยขี้ผึ้งและตกแต่งได้ แล้วจึงนำไปหล่อโลหะ เมื่อเทียบกับประติมากรรมศิลาในยุคก่อนนั้น งานสำริดนับว่าอ่อนช้อยงดงามกว่ามาก\n" + +" * สถาปัตยกรรม สถาปัตยกรรมไทยมีปรากฏให้เห็นในชั้นหลัง เนื่องจากงานสถาปัตยกรรมส่วนใหญ่ชำรุดทรุดโทรมได้ง่าย โดยเฉพาะงานไม้ ไม่ปรากฏร่องรอยสมัยโบราณเลย สถาปัตยกรรมไทยมีให้เห็นอยู่ในรูปของบ้านเรือนไทย โบสถ์ วัด และปราสาทราชวัง ซึ่งล้วนแต่สร้างขึ้นให้เหมาะสมกับสภาพอากาศและการใช้สอยจริง\n" + +"\n" + +" ดูเพิ่มที่ ศิลปะไทย\n" + +"\n" + +"กีฬา\n" + +"ราชมังคลากีฬาสถาน การกีฬาแห่งประเทศไทย\n" + +"ราชมังคลากีฬาสถาน การกีฬาแห่งประเทศไทย\n" + +"\n" + +"กีฬาที่นิยมมากที่สุดในประเทศไทยได้แก่ ฟุตบอล โดยในการแข่งขันระหว่างประเทศ ทีมชาติไทยได้เข้าเล่นและได้อันดับสูงสุดในเอเชียนคัพ ได้อันดับ 3 ใน เอเชียนคัพ 1972 กีฬาอื่นที่นิยมเล่นได้แก่ บาสเกตบอล มวย และแบดมินตัน โดยในประเทศไทยมีการจัดฟุตบอลอาชีพ โดยแบ่งแยกตามทีมประจำจังหวัด สำหรับกีฬาไทย ได้แก่ มวยไทย และ ตะกร้อ แม้จะมีความนิยมไม่เท่ากีฬาทั่วไป แต่ยังมีการเล่นโดยทั่วไปรวมถึงการเปิดสอนในโรงเรียน\n" + +"\n" + +"ประเทศไทยเป็นตัวแทนจัดงานเอเชียนเกมส์ 4 ครั้ง และซีเกมส์ ทั้งหมด 5 ครั้ง โดยจัดครั้งแรกที่ประเทศไทย\n" + +"\n" + +"นักกีฬาไทยที่มีชื่อเสียงมาก ได้แก่\n" + +"\n" + +" * นักมวย - เขาทราย แกแล็คซี่, สด จิตรลดา, สามารถ พยัคฆ์อรุณ, สมรักษ์ คำสิงห์\n" + +" * นักเทนนิส - ภราดร ศรีชาพันธุ์, แทมมารีน ธนสุกาญจน์, ดนัย อุดมโชค\n" + +" * นักว่ายน้ำ - รัฐพงษ์ ศิริสานนท์(ฉลามนุ้ก), ต่อวัย เสฎฐโสธร, ต่อลาภ เสฎฐโสธร\n" + +" * นักฟุตบอล - ปิยะพงษ์ ผิวอ่อน, เกียรติศักดิ์ เสนาเมือง\n" + +" * นักสนุกเกอร์ - ต๋อง ศิษย์ฉ่อย\n" + +" * นักกรีฑา - เรวดี ศรีท้าว\n" + +" * นักเทควันโด - เยาวภา บุรพลชัย\n" + +" * นักยกน้ำหนัก - อุดมพร พลศักดิ์, ปวีณา ทองสุก\n" + +" * นักกอล์ฟ - ธงชัย ใจดี\n" + +"\n" + +"วันสำคัญ\n" + +"\n" + +"วันสำคัญในประเทศไทยจะมีจำนวนมากโดยเฉพาะวันที่ไม่ใช่วันหยุดราชการ ซึ่งจะตั้งขึ้นหลังจากมีเหตุการณ์สำคัญเกิดขึ้น โดยวันชาติของประเทศไทยตรงกับวันที่ 5 ธันวาคม เป็น ตามวันพระราชสมภพ ของพระบาทสมเด็จพระเจ้าอยู่หัว ภูมิพลอดุลยเดช\n" + +"\n" + +" ดูบทความหลักที่ วันสำคัญในประเทศไทย\n" + +"\n" + +"ลำดับที่สำคัญ\n" + +"\n" + +" * พระมหากษัตริย์ไทยพระบาทสมเด็จพระปรมินทรมหาภูมิพลอดุลยเดช เป็นพระมหากษัตริย์ที่ครองราชย์ในฐานะประมุขแห่งรัฐที่นานที่สุดในโลก\n" + +" * กรุงเทพฯ เป็นเมืองหลวงที่มีชื่อยาวที่สุดในโลก (169 ตัวอักษร)\n" + +" * ดัชนีเศรษฐกิจของประเทศไทย อยู่อันดับที่ 71 จาก 155 เขตเศรษฐกิจ ตาม Index of Economic Freedom\n" + +" * จังหวัดหนองคายได้รับการจัดอันดับจากนิตยสาร Modern Maturity ของสหรัฐเมื่อ พ.ศ. 2544 ว่าเป็นเมืองที่น่าอยู่สำหรับผู้สูงอายุชาวอเมริกันอันดับที่ 7 ของโลก [9]\n" + +" * Growth Competitiveness Index Ranking พ.ศ. 2546 อยู่อันดับที่ 34 จาก 104 [10]\n" + +" * ตึกใบหยก 2 เป็นตึกที่สูงที่สุดในประเทศไทย และสูงเป็นอันดับ 30 ของโลก พ.ศ. 2549\n" + +"\n" + +"อ้างอิง\n" + +"\n" + +" 1. ↑ 4th edition \"ANKOR an introduction to the temples\" Dawn Rooney ISBN: 962-217-683-6\n" + +" 2. ↑ ในสมัยก่อนนั้น (ตั้งแต่คริสต์ศตวรรษที่ 17 ในยุโรป) ภาษาสากลในการติดต่อระหว่างประเทศ (lingua franca) คือ ภาษาฝรั่งเศส เอกสารระหว่างประเทศจะใช้ภาษาฝรั่งเศสเป็นหลัก รวมถึงหนังสือเดินทางไทยรุ่นแรกๆ ด้วย\n" + +" 3. ↑ ดัชนีเศรษฐกิจประเทศไทย จากเว็บไซต์ธนาคารแห่งประเทศไทย\n" + +" 4. ↑ ข้าวไทย ย่างก้าวพัฒนา สร้างไทยเป็นศูนย์กลางข้าวโลก โดย เทคโนโลยีชาวบ้าน มติชน วันที่ 01 มิถุนายน พ.ศ. 2550 ปีที่ 19 ฉบับที่ 408\n" + +" 5. ↑ http://www.thairath.co.th/news.php?section=agriculture&content=52868\n" + +" 6. ↑ ผลผลิตของประเทศไทย จากเว็บไซต์ธนาคารแห่งประเทศไทย\n" + +" 7. ↑ ข้อมูลการท่องเที่ยว จากการท่องเที่ยวแห่งประเทศไทย (ข้อมูลเป็นไฟล์เอกเซล)\n" + +" 8. ↑ 8.0 8.1 8.2 8.3 รายละเอียดประเทศไทยจากเว็บซีไอเอ\n" + +" 9. ↑ http://207.5.46.81/tat_news/detail.asp?id=963\n" + +" 10. ↑ ข้อมูลจาก Webforum.org พ.ศ. 2546\n" + +"\n" + +"แหล่งข้อมูลอื่น\n" + +"Commons\n" + +"คอมมอนส์ มีภาพและสื่ออื่นๆ เกี่ยวกับ:\n" + +"ประเทศไทย\n" + +"ฟลิคเกอร์\n" + +"ฟลิคเกอร์ มีรูปภาพเกี่ยวกับ: ประเทศไทย\n" + +"\n" + +" * รัฐบาลไทย\n" + +" * การท่องเที่ยวแห่งประเทศไทย\n" + +" * ประเทศไทยศึกษา ห้องสมุดรัฐสภา สหรัฐอเมริกา\n" + +" * พจนานุกรมท่องเที่ยวไทย\n" + +" * แผนที่ประเทศไทย Longdo Map\n"; + +function get_most_popular(text) { + var i; + var frequencies = new Object(); + var letter; + for (i = 0; i < text.length; i++) { + letter = text.charAt(i); + if (typeof(frequencies[letter]) == 'undefined') + frequencies[letter] = 0; + frequencies[letter]++; + } + var most = []; + for (letter in frequencies) { + if (frequencies[letter] > 50) { + most.push(letter); + } + } + most.sort(); + return most; +} + + +var languages = new Array( + chinese, // 1 + cyrillic, // 2 + devanagari, // 3 + english, // 4 + greek, // 5 + hebrew, // 6 + japanese, // 7 + korean, // 8 + persian, // 9 + source, // 10 + thai); // 11 + + +var number_re = /[0-9]/; +var latin_lc = "[a-zA\u0631]"; +assertEquals(7, latin_lc.length); +var latin_lc_re = new RegExp(latin_lc); +var latin_lc_re2 = new RegExp(/[a-zA\u0631]/); + +assertEquals(13793, chinese.length, "chinese utf8 in source"); +assertEquals(60606, cyrillic.length, "cyrillic utf8 in source"); +assertEquals(20203, devanagari.length, "devanagari utf8 in source"); +assertEquals(37505, english.length, "english utf8 in source"); +assertEquals(30052, greek.length, "greek utf8 in source"); +assertEquals(25640, hebrew.length, "hebrew utf8 in source"); +assertEquals(31082, japanese.length, "japanese utf8 in source"); +assertEquals(12291, korean.length, "korean utf8 in source"); +assertEquals(13851, persian.length, "persian utf8 in source"); +assertEquals(177470, source.length, "source utf8 in source"); +assertEquals(18315, thai.length, "thai utf8 in source"); + +munged_sizes = new Array(17197, 2511, 2645, 3820, 3086, 2609, + 27231, 12972, 2014, 24943, 2773); + + +var i = 0; +for (idx in languages) { + i++; + var text = languages[idx]; + assertTrue(latin_lc_re.test(text), "latin_lc" + i); + assertTrue(latin_lc_re2.test(text), "latin_lc" + i); + assertTrue(number_re.test(text), "number " + i); + var most_popular = get_most_popular(text); + var idx; + var re = "([x"; + var last_c = -9999; + for (idx in most_popular) { + var c = most_popular[idx]; + if ("^]-\n\\".indexOf(c) == -1) { + if (c.charCodeAt(0) > last_c && + c.charCodeAt(0) - 20 < last_c) { + re += "-" + c; + last_c = -9999; + } else { + re += c; + last_c = c.charCodeAt(0); + } + } + } + re += "]+)"; + var char_class = new RegExp(re, "g"); + var munged = text.replace(char_class, "foo"); + assertEquals(munged_sizes[i - 1], munged.length, "munged size " + i); +} + + +function hex(x) { + x &= 15; + if (x < 10) { + return String.fromCharCode(x + 48); + } else { + return String.fromCharCode(x + 97 - 10); + } +} + + +function dump_re(re) { + var out = ""; + for (var i = 0; i < re.length; i++) { + var c = re.charCodeAt(i); + if (c >= 32 && c <= 126) { + out += re[i]; + } else if (c < 256) { + out += "\\x" + hex(c >> 4) + hex(c); + } else { + out += "\\u" + hex(c >> 12) + hex(c >> 8) + hex(c >> 4) + hex(c); + } + } + print ("re = " + out); +} + +var thai_l_thingy = "\u0e44"; +var thai_l_regexp = new RegExp(thai_l_thingy); +var thai_l_regexp2 = new RegExp("[" + thai_l_thingy + "]"); +assertTrue(thai_l_regexp.test(thai_l_thingy)); +assertTrue(thai_l_regexp2.test(thai_l_thingy)); + + diff --git a/deps/v8/test/mjsunit/unusual-constructor.js b/deps/v8/test/mjsunit/unusual-constructor.js new file mode 100644 index 0000000000..4e1ec2ec2d --- /dev/null +++ b/deps/v8/test/mjsunit/unusual-constructor.js @@ -0,0 +1,38 @@ +// Copyright 2008 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 = new (Function.__proto__)(); + + +var threw = false; +try { + obj.toString(); +} catch (e) { + assertInstanceof(e, TypeError); + threw = true; +} +assertTrue(threw); diff --git a/deps/v8/test/mjsunit/uri.js b/deps/v8/test/mjsunit/uri.js new file mode 100644 index 0000000000..178ff1f2a7 --- /dev/null +++ b/deps/v8/test/mjsunit/uri.js @@ -0,0 +1,78 @@ +// Copyright 2008 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 of URI encoding and decoding. + +assertEquals("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.!~*'();/?:@&=+$,#", + encodeURI("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ-_.!~*'();/?:@&=+$,#")); + +var cc1 = 0x007D; +var s1 = String.fromCharCode(cc1); +var cc2 = 0x0000; +var s2 = String.fromCharCode(cc2); +var cc3 = 0x0080; +var s3 = String.fromCharCode(cc3); +var cc4 = 0x0555; +var s4 = String.fromCharCode(cc4); +var cc5 = 0x07FF; +var s5 = String.fromCharCode(cc5); +var cc6 = 0x0800; +var s6 = String.fromCharCode(cc6); +var cc7 = 0xAEEE; +var s7 = String.fromCharCode(cc7); +var cc8_1 = 0xD800; +var cc8_2 = 0xDC00; +var s8 = String.fromCharCode(cc8_1)+String.fromCharCode(cc8_2); +var cc9_1 = 0xDBFF; +var cc9_2 = 0xDFFF; +var s9 = String.fromCharCode(cc9_1)+String.fromCharCode(cc9_2); +var cc10 = 0xE000; +var s10 = String.fromCharCode(cc10); + +assertEquals('%7D', encodeURI(s1)); +assertEquals('%00', encodeURI(s2)); +assertEquals('%C2%80', encodeURI(s3)); +assertEquals('%D5%95', encodeURI(s4)); +assertEquals('%DF%BF', encodeURI(s5)); +assertEquals('%E0%A0%80', encodeURI(s6)); +assertEquals('%EA%BB%AE', encodeURI(s7)); +assertEquals('%F0%90%80%80', encodeURI(s8)); +assertEquals('%F4%8F%BF%BF', encodeURI(s9)); +assertEquals('%EE%80%80', encodeURI(s10)); + +assertEquals(cc1, decodeURI(encodeURI(s1)).charCodeAt(0)); +assertEquals(cc2, decodeURI(encodeURI(s2)).charCodeAt(0)); +assertEquals(cc3, decodeURI(encodeURI(s3)).charCodeAt(0)); +assertEquals(cc4, decodeURI(encodeURI(s4)).charCodeAt(0)); +assertEquals(cc5, decodeURI(encodeURI(s5)).charCodeAt(0)); +assertEquals(cc6, decodeURI(encodeURI(s6)).charCodeAt(0)); +assertEquals(cc7, decodeURI(encodeURI(s7)).charCodeAt(0)); +assertEquals(cc8_1, decodeURI(encodeURI(s8)).charCodeAt(0)); +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)); diff --git a/deps/v8/test/mjsunit/value-callic-prototype-change.js b/deps/v8/test/mjsunit/value-callic-prototype-change.js new file mode 100644 index 0000000000..52f06297b0 --- /dev/null +++ b/deps/v8/test/mjsunit/value-callic-prototype-change.js @@ -0,0 +1,94 @@ +// Copyright 2008 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 inline caches correctly detect that constant +// functions on value prototypes change. + +function testString() { + function f(s, expected) { + var result = s.toString(); + assertEquals(expected, result); + }; + + for (var i = 0; i < 10; i++) { + var s = String.fromCharCode(i); + f(s, s); + } + + String.prototype.toString = function() { return "ostehaps"; }; + + for (var i = 0; i < 10; i++) { + var s = String.fromCharCode(i); + f(s, "ostehaps"); + } +} + +testString(); + + +function testNumber() { + Number.prototype.toString = function() { return 0; }; + + function f(n, expected) { + var result = n.toString(); + assertEquals(expected, result); + }; + + for (var i = 0; i < 10; i++) { + f(i, 0); + } + + Number.prototype.toString = function() { return 42; }; + + for (var i = 0; i < 10; i++) { + f(i, 42); + } +} + +testNumber(); + + +function testBoolean() { + Boolean.prototype.toString = function() { return 0; }; + + function f(b, expected) { + var result = b.toString(); + assertEquals(expected, result); + }; + + for (var i = 0; i < 10; i++) { + f((i % 2 == 0), 0); + } + + Boolean.prototype.toString = function() { return 42; }; + + for (var i = 0; i < 10; i++) { + f((i % 2 == 0), 42); + } +} + +testBoolean(); diff --git a/deps/v8/test/mjsunit/var.js b/deps/v8/test/mjsunit/var.js new file mode 100644 index 0000000000..5999d7028e --- /dev/null +++ b/deps/v8/test/mjsunit/var.js @@ -0,0 +1,37 @@ +// Copyright 2008 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. + +assertTrue(!x && typeof x == 'undefined'); +assertTrue(!y && typeof y == 'undefined'); +if (false) { var x = 42; } +if (true) { var y = 87; } +assertTrue(!x && typeof x == 'undefined'); +assertEquals(87, y); + +assertTrue(!z && typeof z == 'undefined'); +if (false) { var z; } +assertTrue(!z && typeof z == 'undefined'); diff --git a/deps/v8/test/mjsunit/with-function-expression.js b/deps/v8/test/mjsunit/with-function-expression.js new file mode 100644 index 0000000000..17de8175da --- /dev/null +++ b/deps/v8/test/mjsunit/with-function-expression.js @@ -0,0 +1,36 @@ +// Copyright 2008 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 source = "(function x() { with({}) { return '' + x; } })()"; + +// Don't throw exceptions. +assertDoesNotThrow(source); + +// Check that the return value is a function. Use regexp to avoid +// depending on the exact printing of the function. +var regexp = /function/; +var res = assertTrue(eval(source).match(regexp) == 'function'); diff --git a/deps/v8/test/mjsunit/with-leave.js b/deps/v8/test/mjsunit/with-leave.js new file mode 100644 index 0000000000..ded62caf57 --- /dev/null +++ b/deps/v8/test/mjsunit/with-leave.js @@ -0,0 +1,61 @@ +// Copyright 2008 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. + +L: with ({x:12}) { + assertEquals(12, x); + break L; + assertTrue(false); +} + +do { + with ({x:15}) { + assertEquals(15, x); + continue; + assertTrue(false); + } +} while (false); + +var caught = false; +try { + with ({x:18}) { throw 25; assertTrue(false); } +} catch (e) { + caught = true; + assertEquals(25, e); + with ({y:19}) { + assertEquals(19, y); + try { + // NOTE: This checks that the object containing x has been + // removed from the context chain. + x; + assertTrue(false); // should not reach here + } catch (e2) { + assertTrue(e2 instanceof ReferenceError); + } + } +} +assertTrue(caught); + diff --git a/deps/v8/test/mjsunit/with-parameter-access.js b/deps/v8/test/mjsunit/with-parameter-access.js new file mode 100644 index 0000000000..747da22bff --- /dev/null +++ b/deps/v8/test/mjsunit/with-parameter-access.js @@ -0,0 +1,47 @@ +// Copyright 2008 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. + +// Return a parameter from inside a with statement. +function f(x) { + with ({}) { + return x; + } +} + +assertEquals(5, f(5)); + + +function g(x) { + function h() { + with ({}) { + return x; + } + } + return h(); +} + +assertEquals(7, g(7)); diff --git a/deps/v8/test/mjsunit/with-prototype.js b/deps/v8/test/mjsunit/with-prototype.js new file mode 100644 index 0000000000..e760f4e2f3 --- /dev/null +++ b/deps/v8/test/mjsunit/with-prototype.js @@ -0,0 +1,44 @@ +// Copyright 2009 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Test the behavior of an assignment in a with statement where the +// extension object contains a property with the name assigned to in +// the prototype chain. + +var o = {}; +var p = { x: 42 }; +o.__proto__ = p; + +function f() { + with (o) { + x = 123; + } +} +f(); + +assertEquals(42, p.x); +assertEquals(123, o.x); diff --git a/deps/v8/test/mjsunit/with-value.js b/deps/v8/test/mjsunit/with-value.js new file mode 100644 index 0000000000..a4da1fad9c --- /dev/null +++ b/deps/v8/test/mjsunit/with-value.js @@ -0,0 +1,38 @@ +// Copyright 2008 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. + +// Values used in 'with' statements should be wrapped in an object +// before establishing the context. +(function() { + // 7 should be converted to an number object + with (7) { assertTrue(typeof valueOf == 'function'); } +})(); + +/* This should be fairly easy again. May need some work in the +compiler's VisitWith() function, or perhaps the runtime routine's +PushContextForWith(). +*/
\ No newline at end of file |