From b8e0da25ee8efac3bb05cd6b2730aafbd96119f4 Mon Sep 17 00:00:00 2001 From: Ben Murdoch Date: Mon, 16 May 2011 14:20:40 +0100 Subject: Update V8 to r6387 as required by WebKit r76408 Change-Id: Icfc5385b0996bd592f8b1ac8cbb44767ee09f1f6 --- test/cctest/cctest.status | 14 +++- test/cctest/test-api.cc | 93 ++++++++++++++++++++++ test/cctest/test-disasm-ia32.cc | 14 +++- test/cctest/testcfg.py | 1 + test/es5conform/testcfg.py | 2 + test/message/testcfg.py | 3 + test/mjsunit/array-slice.js | 59 ++++++++++++++ test/mjsunit/closures.js | 45 +++++++++++ .../mjsunit/compiler/regress-closures-with-eval.js | 51 ++++++++++++ test/mjsunit/compiler/regress-serialized-slots.js | 61 ++++++++++++++ test/mjsunit/debug-breakpoints.js | 86 ++++++++++++++++++++ test/mjsunit/debug-liveedit-diff.js | 27 +++++-- test/mjsunit/debug-liveedit-newsource.js | 4 +- test/mjsunit/delay-syntax-error.js | 17 ++-- test/mjsunit/error-constructors.js | 31 +++++++- test/mjsunit/mjsunit.status | 3 + test/mjsunit/regress/regress-1036894.js | 10 +-- test/mjsunit/regress/regress-990205.js | 6 +- test/mjsunit/regress/regress-create-exception.js | 2 +- test/mjsunit/testcfg.py | 6 ++ test/mozilla/mozilla.status | 11 +-- 21 files changed, 507 insertions(+), 39 deletions(-) create mode 100644 test/mjsunit/closures.js create mode 100644 test/mjsunit/compiler/regress-closures-with-eval.js create mode 100644 test/mjsunit/compiler/regress-serialized-slots.js (limited to 'test') diff --git a/test/cctest/cctest.status b/test/cctest/cctest.status index 7c1197ae..a7eca5b3 100644 --- a/test/cctest/cctest.status +++ b/test/cctest/cctest.status @@ -29,6 +29,10 @@ prefix cctest test-api/Bug*: FAIL +# The problem is that a code object can get a different optimizable flag +# in crankshaft after creation. +test-log/EquivalenceOfLoggingAndTraversal: SKIP + ############################################################################## # BUG(281): This test fails on some Linuxes. @@ -73,6 +77,12 @@ test-deoptimization/DeoptimizeCompare: FAIL # Tests that time out with crankshaft. test-api/Threading: SKIP +# BUG(1049): Currently no deoptimization support. +test-serialize/ContextSerialization: SKIP +test-serialize/ContextDeserialization: SKIP +test-debug/BreakPointReturn: SKIP +test-debug/DebugStepLinearMixedICs: SKIP + ############################################################################## [ $arch == arm ] @@ -98,10 +108,6 @@ test-sockets/Socket: SKIP ############################################################################## [ $arch == arm && $crankshaft ] -# Tests that can fail with crankshaft. -test-deoptimization/DeoptimizeBinaryOperationMOD: PASS || FAIL -test-deoptimization/DeoptimizeBinaryOperationDIV: PASS || FAIL - # Tests that time out with crankshaft. test-debug/ThreadedDebugging: SKIP test-debug/DebugBreakLoop: SKIP diff --git a/test/cctest/test-api.cc b/test/cctest/test-api.cc index 95399736..6a2f3289 100644 --- a/test/cctest/test-api.cc +++ b/test/cctest/test-api.cc @@ -814,6 +814,75 @@ THREADED_TEST(FunctionTemplate) { } +static void* expected_ptr; +static v8::Handle callback(const v8::Arguments& args) { + void* ptr = v8::External::Unwrap(args.Data()); + CHECK_EQ(expected_ptr, ptr); + return v8::Boolean::New(true); +} + + +static void TestExternalPointerWrapping() { + v8::HandleScope scope; + LocalContext env; + + v8::Handle data = v8::External::Wrap(expected_ptr); + + v8::Handle obj = v8::Object::New(); + obj->Set(v8_str("func"), + v8::FunctionTemplate::New(callback, data)->GetFunction()); + env->Global()->Set(v8_str("obj"), obj); + + CHECK(CompileRun( + "function foo() {\n" + " for (var i = 0; i < 13; i++) obj.func();\n" + "}\n" + "foo(), true")->BooleanValue()); +} + + +THREADED_TEST(ExternalWrap) { + // Check heap allocated object. + int* ptr = new int; + expected_ptr = ptr; + TestExternalPointerWrapping(); + delete ptr; + + // Check stack allocated object. + int foo; + expected_ptr = &foo; + TestExternalPointerWrapping(); + + // Check not aligned addresses. + const int n = 100; + char* s = new char[n]; + for (int i = 0; i < n; i++) { + expected_ptr = s + i; + TestExternalPointerWrapping(); + } + + delete[] s; + + // Check several invalid addresses. + expected_ptr = reinterpret_cast(1); + TestExternalPointerWrapping(); + + expected_ptr = reinterpret_cast(0xdeadbeef); + TestExternalPointerWrapping(); + + expected_ptr = reinterpret_cast(0xdeadbeef + 1); + TestExternalPointerWrapping(); + +#if defined(V8_HOST_ARCH_X64) + expected_ptr = reinterpret_cast(0xdeadbeefdeadbeef); + TestExternalPointerWrapping(); + + expected_ptr = reinterpret_cast(0xdeadbeefdeadbeef + 1); + TestExternalPointerWrapping(); +#endif +} + + THREADED_TEST(FindInstanceInPrototypeChain) { v8::HandleScope scope; LocalContext env; @@ -2288,6 +2357,30 @@ TEST(TryCatchInTryFinally) { } +static void check_reference_error_message( + v8::Handle message, + v8::Handle data) { + const char* reference_error = "Uncaught ReferenceError: asdf is not defined"; + CHECK(message->Get()->Equals(v8_str(reference_error))); +} + + +// Test that overwritten toString methods are not invoked on uncaught +// exception formatting. However, they are invoked when performing +// normal error string conversions. +TEST(APIThrowMessageOverwrittenToString) { + v8::HandleScope scope; + v8::V8::AddMessageListener(check_reference_error_message); + LocalContext context; + CompileRun("ReferenceError.prototype.toString =" + " function() { return 'Whoops' }"); + CompileRun("asdf;"); + v8::Handle string = CompileRun("try { asdf; } catch(e) { e + ''; }"); + CHECK(string->Equals(v8_str("Whoops"))); + v8::V8::RemoveMessageListeners(check_message); +} + + static void receive_message(v8::Handle message, v8::Handle data) { message->Get(); diff --git a/test/cctest/test-disasm-ia32.cc b/test/cctest/test-disasm-ia32.cc index b563f8fc..30d708e4 100644 --- a/test/cctest/test-disasm-ia32.cc +++ b/test/cctest/test-disasm-ia32.cc @@ -416,7 +416,7 @@ TEST(DisasmIa320) { } } - // andpd, cmpltsd, movaps, psllq. + // andpd, cmpltsd, movaps, psllq, psrlq, por. { if (CpuFeatures::IsSupported(SSE2)) { CpuFeatures::Scope fscope(SSE2); @@ -431,6 +431,18 @@ TEST(DisasmIa320) { __ psllq(xmm0, 17); __ psllq(xmm1, 42); + + __ psllq(xmm0, xmm1); + __ psllq(xmm1, xmm2); + + __ psrlq(xmm0, 17); + __ psrlq(xmm1, 42); + + __ psrlq(xmm0, xmm1); + __ psrlq(xmm1, xmm2); + + __ por(xmm0, xmm1); + __ por(xmm1, xmm2); } } diff --git a/test/cctest/testcfg.py b/test/cctest/testcfg.py index 485f2cfd..b15342ed 100644 --- a/test/cctest/testcfg.py +++ b/test/cctest/testcfg.py @@ -92,6 +92,7 @@ class CcTestConfiguration(test.TestConfiguration): dependency = relative_path[0] + '/' + dependency if self.Contains(path, full_path): result.append(CcTestCase(full_path, executable, mode, raw_test, dependency, self.context)) + result.sort() return result def GetTestStatus(self, sections, defs): diff --git a/test/es5conform/testcfg.py b/test/es5conform/testcfg.py index 43d61047..e3a60cc4 100644 --- a/test/es5conform/testcfg.py +++ b/test/es5conform/testcfg.py @@ -82,8 +82,10 @@ class ES5ConformTestConfiguration(test.TestConfiguration): for root, dirs, files in os.walk(current_root): for dotted in [x for x in dirs if x.startswith('.')]: dirs.remove(dotted) + dirs.sort() root_path = root[len(self.root):].split(os.path.sep) root_path = current_path + [x for x in root_path if x] + files.sort() for file in files: if file.endswith('.js'): full_path = root_path + [file[:-3]] diff --git a/test/message/testcfg.py b/test/message/testcfg.py index 7dae047d..21a0428f 100644 --- a/test/message/testcfg.py +++ b/test/message/testcfg.py @@ -107,6 +107,9 @@ class MessageTestConfiguration(test.TestConfiguration): 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'))] + mjsunit.sort() + regress.sort() + bugs.sort() all_tests = mjsunit + regress + bugs result = [] for test in all_tests: diff --git a/test/mjsunit/array-slice.js b/test/mjsunit/array-slice.js index 50b5b273..5ae31dc5 100644 --- a/test/mjsunit/array-slice.js +++ b/test/mjsunit/array-slice.js @@ -231,3 +231,62 @@ func(['a', 1, undefined], 'a', 1, undefined); func(['a', 1, undefined, void(0)], 'a', 1, undefined, void(0)); })(); + +// Check slicing on arguments object when missing arguments get assigined. +(function() { + function func(x, y) { + assertEquals(1, arguments.length); + assertEquals(undefined, y); + y = 239; + assertEquals(1, arguments.length); // arguments length is the same. + assertEquals([x], Array.prototype.slice.call(arguments, 0)); + } + + func('a'); +})(); + +// Check slicing on arguments object when length property has been set. +(function() { + function func(x, y) { + assertEquals(1, arguments.length); + arguments.length = 7; + assertEquals([x,,,,,,,], Array.prototype.slice.call(arguments, 0)); + } + + func('a'); +})(); + +// Check slicing on arguments object when length property has been set to +// some strange value. +(function() { + function func(x, y) { + assertEquals(1, arguments.length); + arguments.length = 'foobar'; + assertEquals([], Array.prototype.slice.call(arguments, 0)); + } + + func('a'); +})(); + +// Check slicing on arguments object when extra argument has been added +// via indexed assignment. +(function() { + function func(x, y) { + assertEquals(1, arguments.length); + arguments[3] = 239; + assertEquals([x], Array.prototype.slice.call(arguments, 0)); + } + + func('a'); +})(); + +// Check slicing on arguments object when argument has been deleted by index. +(function() { + function func(x, y, z) { + assertEquals(3, arguments.length); + delete arguments[1]; + assertEquals([x,,z], Array.prototype.slice.call(arguments, 0)); + } + + func('a', 'b', 'c'); +})(); diff --git a/test/mjsunit/closures.js b/test/mjsunit/closures.js new file mode 100644 index 00000000..ee487a4b --- /dev/null +++ b/test/mjsunit/closures.js @@ -0,0 +1,45 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +function runner(f, expected) { + for (var i = 0; i < 1000000; i++) { + assertEquals(expected, f.call(this)); + } +} + +function test(n) { + function MyFunction() { + var result = n * 2 + arguments.length; + return result; + } + runner(MyFunction, n * 2); +} + +test(1); +test(42); +test(239); + diff --git a/test/mjsunit/compiler/regress-closures-with-eval.js b/test/mjsunit/compiler/regress-closures-with-eval.js new file mode 100644 index 00000000..507d74f3 --- /dev/null +++ b/test/mjsunit/compiler/regress-closures-with-eval.js @@ -0,0 +1,51 @@ +// Copyright 2010 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +// Verifies that closures in presence of eval work fine. +function withEval(expr, filter) { + function walk(v) { + for (var i in v) { + for (var i in v) {} + } + return filter(v); + } + + var o = eval(expr); + return walk(o); +} + +function makeTagInfoJSON(n) { + var a = new Array(n); + for (var i = 0; i < n; i++) a.push('{}'); + return a; +} + +var expr = '([' + makeTagInfoJSON(128).join(', ') + '])' + +for (var n = 0; n < 300; n++) { + withEval(expr, function(a) { return a; }); +} diff --git a/test/mjsunit/compiler/regress-serialized-slots.js b/test/mjsunit/compiler/regress-serialized-slots.js new file mode 100644 index 00000000..0bd7528f --- /dev/null +++ b/test/mjsunit/compiler/regress-serialized-slots.js @@ -0,0 +1,61 @@ +// Copyright 2011 the V8 project authors. All rights reserved. +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following +// disclaimer in the documentation and/or other materials provided +// with the distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived +// from this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (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 test verifies that parameters of the outer function are correctly +// accessible from the inner closure. + +function runner(f, expected) { + for (var i = 0; i < 10000; i++) { // Loop to trigger optimization. + assertEquals(expected, f.call(this, 10)); + } +} + +Function.prototype.bind = function(thisObject) +{ + var func = this; + var args = Array.prototype.slice.call(arguments, 1); + function bound() + { + // Note outer function parameter access (|thisObject|). + return func.apply( + thisObject, + args.concat(Array.prototype.slice.call(arguments, 0))); + } + return bound; +} + +function sum(x, y) { + return x + y; +} + +function test(n) { + runner(sum.bind(this, n), n + 10); +} + +test(1); +test(42); +test(239); diff --git a/test/mjsunit/debug-breakpoints.js b/test/mjsunit/debug-breakpoints.js index 0bc349c4..13020343 100644 --- a/test/mjsunit/debug-breakpoints.js +++ b/test/mjsunit/debug-breakpoints.js @@ -118,3 +118,89 @@ Debug.clearBreakPoint(bp3); // b=2; // } assertTrue(Debug.showBreakPoints(g).indexOf("[B0]") < 0); + + +// Tests for setting break points by script id and position. +function setBreakpointByPosition(f, position) +{ + var break_point = Debug.setBreakPointByScriptIdAndPosition( + Debug.findScript(f).id, + position + Debug.sourcePosition(f), + "", + true); + return break_point.number(); +} + +bp = setBreakpointByPosition(f, 0); +assertEquals("() {[B0]a=1;b=2}", Debug.showBreakPoints(f)); +Debug.clearBreakPoint(bp); +assertEquals("() {a=1;b=2}", Debug.showBreakPoints(f)); +bp1 = setBreakpointByPosition(f, 8); +assertEquals("() {a=1;[B0]b=2}", Debug.showBreakPoints(f)); +bp2 = setBreakpointByPosition(f, 4); +assertEquals("() {[B0]a=1;[B1]b=2}", Debug.showBreakPoints(f)); +bp3 = setBreakpointByPosition(f, 11); +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)); + +bp = setBreakpointByPosition(g, 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 (column = 0). +bp1 = setBreakpointByPosition(g, 12); +//function g() { +//a=1; +//[B0]b=2; +//} +assertTrue(Debug.showBreakPoints(g).indexOf("[B0]b=2;") > 0); +bp2 = setBreakpointByPosition(g, 5); +//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 = setBreakpointByPosition(g, 19); +//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/test/mjsunit/debug-liveedit-diff.js b/test/mjsunit/debug-liveedit-diff.js index 7edf704f..0d26a30b 100644 --- a/test/mjsunit/debug-liveedit-diff.js +++ b/test/mjsunit/debug-liveedit-diff.js @@ -31,11 +31,15 @@ Debug = debug.Debug function CheckCompareOneWay(s1, s2) { - var diff_array = Debug.LiveEdit.TestApi.CompareStringsLinewise(s1, s2); + var diff_array = Debug.LiveEdit.TestApi.CompareStrings(s1, s2); var pos1 = 0; var pos2 = 0; print("Compare:"); + print("s1='" + s1 + "'"); + print("s2='" + s2 + "'"); + print("Diff:"); + print("" + diff_array); for (var i = 0; i < diff_array.length; i += 3) { var similar_length = diff_array[i] - pos1; assertEquals(s1.substring(pos1, pos1 + similar_length), @@ -45,12 +49,12 @@ function CheckCompareOneWay(s1, s2) { pos1 += similar_length; pos2 += similar_length; print("<<< " + pos1 + " " + diff_array[i + 1]); - print(s1.substring(pos1, pos1 + diff_array[i + 1])); + print(s1.substring(pos1, diff_array[i + 1])); print("==="); - print(s2.substring(pos2, pos2 + diff_array[i + 2])); + print(s2.substring(pos2, diff_array[i + 2])); print(">>> " + pos2 + " " + diff_array[i + 2]); - pos1 += diff_array[i + 1]; - pos2 += diff_array[i + 2]; + pos1 = diff_array[i + 1]; + pos2 = diff_array[i + 2]; } { // After last change @@ -64,9 +68,18 @@ function CheckCompareOneWay(s1, s2) { print(""); } -function CheckCompare(s1, s2) { +function CheckCompareOneWayPlayWithLF(s1, s2) { + var s1Oneliner = s1.replace(/\n/g, ' '); + var s2Oneliner = s2.replace(/\n/g, ' '); CheckCompareOneWay(s1, s2); - CheckCompareOneWay(s2, s1); + CheckCompareOneWay(s1Oneliner, s2); + CheckCompareOneWay(s1, s2Oneliner); + CheckCompareOneWay(s1Oneliner, s2Oneliner); +} + +function CheckCompare(s1, s2) { + CheckCompareOneWayPlayWithLF(s1, s2); + CheckCompareOneWayPlayWithLF(s2, s1); } CheckCompare("", ""); diff --git a/test/mjsunit/debug-liveedit-newsource.js b/test/mjsunit/debug-liveedit-newsource.js index 7b8945a7..a60e69f9 100644 --- a/test/mjsunit/debug-liveedit-newsource.js +++ b/test/mjsunit/debug-liveedit-newsource.js @@ -64,6 +64,6 @@ print("Change log: " + JSON.stringify(change_log) + "\n"); assertEquals("Capybara", ChooseAnimal()); // Global variable do not get changed (without restarting script). assertEquals(25, something1); -// Function is oneliner, so currently it is treated as damaged and not patched. -assertEquals(17, ChooseNumber()); +// We should support changes in oneliners. +assertEquals(18, ChooseNumber()); assertEquals("Hello Peter", ChooseAnimal.Factory()("Peter")); diff --git a/test/mjsunit/delay-syntax-error.js b/test/mjsunit/delay-syntax-error.js index 4fcb1435..64cc1429 100644 --- a/test/mjsunit/delay-syntax-error.js +++ b/test/mjsunit/delay-syntax-error.js @@ -25,17 +25,18 @@ // (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. +// To be compatible with JSC syntax errors for illegal returns should be delayed +// to runtime. +// Invalid continue and break statements are caught at compile time. -// Do not throw syntax errors for illegal return, break and continue -// at compile time. +// Do not throw syntax errors for illegal return 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. +// Throw syntax errors for illegal break and continue at compile time. +assertThrows("if (false) break;"); +assertThrows("if (false) continue;"); + +// Throw syntax errors for illegal return, break and continue at runtime. assertThrows("return;"); assertThrows("break;"); assertThrows("continue;"); diff --git a/test/mjsunit/error-constructors.js b/test/mjsunit/error-constructors.js index ca2aa060..8f463fc2 100644 --- a/test/mjsunit/error-constructors.js +++ b/test/mjsunit/error-constructors.js @@ -1,4 +1,4 @@ -// Copyright 2009 the V8 project authors. All rights reserved. +// Copyright 2011 the V8 project authors. All rights reserved. // Redistribution and use in source and binary forms, with or without // modification, are permitted provided that the following conditions are // met: @@ -30,3 +30,32 @@ assertFalse(e.hasOwnProperty('message')); Error.prototype.toString = Object.prototype.toString; assertEquals("[object Error]", Error.prototype.toString()); assertEquals(Object.prototype, Error.prototype.__proto__); + +// Check that error construction does not call setters for the +// properties on error objects in prototypes. +function fail() { assertTrue(false); }; +ReferenceError.prototype.__defineSetter__('stack', fail); +ReferenceError.prototype.__defineSetter__('message', fail); +ReferenceError.prototype.__defineSetter__('type', fail); +ReferenceError.prototype.__defineSetter__('arguments', fail); +var e0 = new ReferenceError(); +var e1 = new ReferenceError('123'); +assertTrue(e1.hasOwnProperty('message')); +assertTrue(e0.hasOwnProperty('stack')); +assertTrue(e1.hasOwnProperty('stack')); +assertTrue(e0.hasOwnProperty('type')); +assertTrue(e1.hasOwnProperty('type')); +assertTrue(e0.hasOwnProperty('arguments')); +assertTrue(e1.hasOwnProperty('arguments')); + +// Check that the name property on error prototypes is read-only and +// dont-delete. This is not specified, but allowing overwriting the +// name property with a getter can leaks error objects from different +// script tags in the same context in a browser setting. We therefore +// disallow changes to the name property on error objects. +assertEquals("ReferenceError", ReferenceError.prototype.name); +delete ReferenceError.prototype.name; +assertEquals("ReferenceError", ReferenceError.prototype.name); +ReferenceError.prototype.name = "not a reference error"; +assertEquals("ReferenceError", ReferenceError.prototype.name); + diff --git a/test/mjsunit/mjsunit.status b/test/mjsunit/mjsunit.status index 057c0fa8..39ddf5a4 100644 --- a/test/mjsunit/mjsunit.status +++ b/test/mjsunit/mjsunit.status @@ -119,6 +119,9 @@ compiler/simple-osr: FAIL # BUG (1026) This test is currently flaky. compiler/simple-osr: SKIP +# BUG(1049): Currently no deoptimization support. +debug-liveedit-newsource: SKIP +debug-liveedit-1: SKIP ############################################################################## [ $arch == mips ] diff --git a/test/mjsunit/regress/regress-1036894.js b/test/mjsunit/regress/regress-1036894.js index d89ceda1..03ed8f9d 100644 --- a/test/mjsunit/regress/regress-1036894.js +++ b/test/mjsunit/regress/regress-1036894.js @@ -25,14 +25,14 @@ // (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);} })); }"); +assertThrows("$=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);} })); }"); } +function foo() { + assertThrows("$=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);} })); }"); +assertThrows("$=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/test/mjsunit/regress/regress-990205.js b/test/mjsunit/regress/regress-990205.js index 1ab5bf88..b3024c23 100644 --- a/test/mjsunit/regress/regress-990205.js +++ b/test/mjsunit/regress/regress-990205.js @@ -25,11 +25,15 @@ // (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 throw syntax errors early for invalid break and continue statements. +// (Notice that the example isn't valid ECMAScript due to the +// function declaration that is not at top level.) + 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()); +assertThrows("f()"); diff --git a/test/mjsunit/regress/regress-create-exception.js b/test/mjsunit/regress/regress-create-exception.js index 7d53f1cd..2119ce2b 100644 --- a/test/mjsunit/regress/regress-create-exception.js +++ b/test/mjsunit/regress/regress-create-exception.js @@ -49,7 +49,7 @@ function foo() { return j; // Make sure that future optimizations don't eliminate j. } catch(e) { ok = true; - assertTrue(re.test(e)); + assertTrue(re.test(e), 'e: ' + e); } assertTrue(ok); } diff --git a/test/mjsunit/testcfg.py b/test/mjsunit/testcfg.py index d8fe24d3..5cb46bc2 100644 --- a/test/mjsunit/testcfg.py +++ b/test/mjsunit/testcfg.py @@ -111,6 +111,12 @@ class MjsunitTestConfiguration(test.TestConfiguration): third_party = [current_path + ['third_party', t] for t in self.Ls(join(self.root, 'third_party'))] tools = [current_path + ['tools', t] for t in self.Ls(join(self.root, 'tools'))] compiler = [current_path + ['compiler', t] for t in self.Ls(join(self.root, 'compiler'))] + mjsunit.sort() + regress.sort() + bugs.sort() + third_party.sort() + tools.sort() + compiler.sort() all_tests = mjsunit + regress + bugs + third_party + tools + compiler result = [] for test in all_tests: diff --git a/test/mozilla/mozilla.status b/test/mozilla/mozilla.status index 1d989edd..a119bf2a 100644 --- a/test/mozilla/mozilla.status +++ b/test/mozilla/mozilla.status @@ -833,15 +833,9 @@ js1_5/Regress/regress-404755: SKIP js1_5/Regress/regress-451322: SKIP js1_5/extensions/regress-371636: SKIP +# BUG(1040): Allow this test to timeout. +js1_5/GC/regress-203278-2: PASS || TIMEOUT -[ $arch == arm && $crankshaft ] - -# Test that only fail with crankshaft. -js1_5/Regress/regress-416628: CRASH -js1_5/Regress/regress-96128-n: PASS || CRASH - -# BUG(1031). -ecma/TypeConversion/9.2: FAIL [ $fast == yes && $arch == arm ] @@ -859,7 +853,6 @@ js1_5/Regress/regress-347306-01: SKIP js1_5/Regress/regress-280769-1: SKIP js1_5/Regress/regress-280769-5: SKIP js1_5/GC/regress-306788: SKIP -js1_5/GC/regress-203278-2: SKIP js1_5/GC/regress-278725: SKIP js1_5/GC/regress-203278-3: SKIP js1_5/GC/regress-311497: SKIP -- cgit v1.2.3