diff options
author | Ryan Dahl <ry@tinyclouds.org> | 2011-01-28 01:56:31 -0800 |
---|---|---|
committer | Ryan Dahl <ry@tinyclouds.org> | 2011-01-28 01:57:00 -0800 |
commit | 7eaa956baee9070f8a073aa5c1bff01b1b8f2f5d (patch) | |
tree | f23f0a06b77cfd983640ff0fcf9e5d4714e4d108 /deps/v8/test | |
parent | 97375c475e17562a016aa4d13f94030bd0f3ae37 (diff) | |
download | node-new-7eaa956baee9070f8a073aa5c1bff01b1b8f2f5d.tar.gz |
Upgrade V8 to 3.0.12
Diffstat (limited to 'deps/v8/test')
-rw-r--r-- | deps/v8/test/cctest/cctest.status | 12 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-api.cc | 9 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-assembler-arm.cc | 4 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-assembler-mips.cc | 4 | ||||
-rw-r--r-- | deps/v8/test/cctest/test-assembler-x64.cc | 49 | ||||
-rw-r--r-- | deps/v8/test/es5conform/es5conform.status | 5 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/debug-evaluate-locals.js | 23 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/delete-global-properties.js | 17 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/mjsunit.status | 3 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/regress/regress-70066.js | 146 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/strict-mode.js | 168 | ||||
-rw-r--r-- | deps/v8/test/mjsunit/string-charcodeat.js | 20 |
12 files changed, 418 insertions, 42 deletions
diff --git a/deps/v8/test/cctest/cctest.status b/deps/v8/test/cctest/cctest.status index 5d2d9cc410..1009f85c0f 100644 --- a/deps/v8/test/cctest/cctest.status +++ b/deps/v8/test/cctest/cctest.status @@ -51,6 +51,8 @@ test-heap-profiler/HeapSnapshotsDiff: PASS || FAIL test-serialize/TestThatAlwaysFails: FAIL test-serialize/DependentTestThatAlwaysFails: FAIL +# BUG(1079) +test-api/CaptureStackTraceForUncaughtException: PASS || FAIL ############################################################################## [ $arch == x64 ] @@ -77,12 +79,9 @@ test-deoptimization/DeoptimizeCompare: FAIL # Tests that time out with crankshaft. test-api/Threading: SKIP -# BUG(1049): Currently no deoptimization support. +# BUG(1069): Context serialization fails on optimized functions. test-serialize/ContextSerialization: SKIP test-serialize/ContextDeserialization: SKIP -test-debug/BreakPointReturn: SKIP -test-debug/DebugStepLinearMixedICs: SKIP -test-debug/DebugConditional: SKIP ############################################################################## [ $arch == arm ] @@ -104,6 +103,11 @@ test-log/ProfLazyMode: SKIP test-debug/DebuggerAgentProtocolOverflowHeader: SKIP test-sockets/Socket: SKIP +# BUG(1075): Some deserialization tests fail om ARM +test-serialize/Deserialize: SKIP +test-serialize/DeserializeFromSecondSerializationAndRunScript2: SKIP +test-serialize/DeserializeAndRunScript2: SKIP +test-serialize/DeserializeFromSecondSerialization: SKIP ############################################################################## [ $arch == arm && $crankshaft ] diff --git a/deps/v8/test/cctest/test-api.cc b/deps/v8/test/cctest/test-api.cc index de00fbba46..48dc72e7b3 100644 --- a/deps/v8/test/cctest/test-api.cc +++ b/deps/v8/test/cctest/test-api.cc @@ -2383,8 +2383,17 @@ TEST(APIThrowMessageOverwrittenToString) { CompileRun("asdf;"); CompileRun("ReferenceError.prototype.constructor = void 0;"); CompileRun("asdf;"); + CompileRun("ReferenceError.prototype.__proto__ = new Object();"); + CompileRun("asdf;"); + CompileRun("ReferenceError.prototype = new Object();"); + CompileRun("asdf;"); v8::Handle<Value> string = CompileRun("try { asdf; } catch(e) { e + ''; }"); CHECK(string->Equals(v8_str("Whoops"))); + CompileRun("ReferenceError.prototype.constructor = new Object();" + "ReferenceError.prototype.constructor.name = 1;" + "Number.prototype.toString = function() { return 'Whoops'; };" + "ReferenceError.prototype.toString = Object.prototype.toString;"); + CompileRun("asdf;"); v8::V8::RemoveMessageListeners(check_message); } diff --git a/deps/v8/test/cctest/test-assembler-arm.cc b/deps/v8/test/cctest/test-assembler-arm.cc index 0f12f985a3..af1a4e8aa4 100644 --- a/deps/v8/test/cctest/test-assembler-arm.cc +++ b/deps/v8/test/cctest/test-assembler-arm.cc @@ -45,11 +45,7 @@ typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); static v8::Persistent<v8::Context> env; -// The test framework does not accept flags on the command line, so we set them static void InitializeVM() { - // enable generation of comments - FLAG_debug_code = true; - if (env.IsEmpty()) { env = v8::Context::New(); } diff --git a/deps/v8/test/cctest/test-assembler-mips.cc b/deps/v8/test/cctest/test-assembler-mips.cc index 955562b287..ecb42e2f7b 100644 --- a/deps/v8/test/cctest/test-assembler-mips.cc +++ b/deps/v8/test/cctest/test-assembler-mips.cc @@ -47,14 +47,10 @@ typedef Object* (*F3)(void* p, int p1, int p2, int p3, int p4); static v8::Persistent<v8::Context> env; -// The test framework does not accept flags on the command line, so we set them. static void InitializeVM() { // Disable compilation of natives. FLAG_disable_native_files = true; - // Enable generation of comments. - FLAG_debug_code = true; - if (env.IsEmpty()) { env = v8::Context::New(); } diff --git a/deps/v8/test/cctest/test-assembler-x64.cc b/deps/v8/test/cctest/test-assembler-x64.cc index f100b73485..5d292df05f 100644 --- a/deps/v8/test/cctest/test-assembler-x64.cc +++ b/deps/v8/test/cctest/test-assembler-x64.cc @@ -48,6 +48,12 @@ using v8::internal::rcx; using v8::internal::rdx; using v8::internal::rbp; using v8::internal::rsp; +using v8::internal::r8; +using v8::internal::r9; +using v8::internal::r12; +using v8::internal::r13; +using v8::internal::times_1; + using v8::internal::FUNCTION_CAST; using v8::internal::CodeDesc; using v8::internal::less_equal; @@ -289,4 +295,47 @@ TEST(AssemblerX64LoopImmediates) { CHECK_EQ(1, result); } + +TEST(OperandRegisterDependency) { + int offsets[4] = {0, 1, 0xfed, 0xbeefcad}; + for (int i = 0; i < 4; i++) { + int offset = offsets[i]; + CHECK(Operand(rax, offset).AddressUsesRegister(rax)); + CHECK(!Operand(rax, offset).AddressUsesRegister(r8)); + CHECK(!Operand(rax, offset).AddressUsesRegister(rcx)); + + CHECK(Operand(rax, rax, times_1, offset).AddressUsesRegister(rax)); + CHECK(!Operand(rax, rax, times_1, offset).AddressUsesRegister(r8)); + CHECK(!Operand(rax, rax, times_1, offset).AddressUsesRegister(rcx)); + + CHECK(Operand(rax, rcx, times_1, offset).AddressUsesRegister(rax)); + CHECK(Operand(rax, rcx, times_1, offset).AddressUsesRegister(rcx)); + CHECK(!Operand(rax, rcx, times_1, offset).AddressUsesRegister(r8)); + CHECK(!Operand(rax, rcx, times_1, offset).AddressUsesRegister(r9)); + CHECK(!Operand(rax, rcx, times_1, offset).AddressUsesRegister(rdx)); + CHECK(!Operand(rax, rcx, times_1, offset).AddressUsesRegister(rsp)); + + CHECK(Operand(rsp, offset).AddressUsesRegister(rsp)); + CHECK(!Operand(rsp, offset).AddressUsesRegister(rax)); + CHECK(!Operand(rsp, offset).AddressUsesRegister(r12)); + + CHECK(Operand(rbp, offset).AddressUsesRegister(rbp)); + CHECK(!Operand(rbp, offset).AddressUsesRegister(rax)); + CHECK(!Operand(rbp, offset).AddressUsesRegister(r13)); + + CHECK(Operand(rbp, rax, times_1, offset).AddressUsesRegister(rbp)); + CHECK(Operand(rbp, rax, times_1, offset).AddressUsesRegister(rax)); + CHECK(!Operand(rbp, rax, times_1, offset).AddressUsesRegister(rcx)); + CHECK(!Operand(rbp, rax, times_1, offset).AddressUsesRegister(r13)); + CHECK(!Operand(rbp, rax, times_1, offset).AddressUsesRegister(r8)); + CHECK(!Operand(rbp, rax, times_1, offset).AddressUsesRegister(rsp)); + + CHECK(Operand(rsp, rbp, times_1, offset).AddressUsesRegister(rsp)); + CHECK(Operand(rsp, rbp, times_1, offset).AddressUsesRegister(rbp)); + CHECK(!Operand(rsp, rbp, times_1, offset).AddressUsesRegister(rax)); + CHECK(!Operand(rsp, rbp, times_1, offset).AddressUsesRegister(r12)); + CHECK(!Operand(rsp, rbp, times_1, offset).AddressUsesRegister(r13)); + } +} + #undef __ diff --git a/deps/v8/test/es5conform/es5conform.status b/deps/v8/test/es5conform/es5conform.status index a51bd30200..47b6887887 100644 --- a/deps/v8/test/es5conform/es5conform.status +++ b/deps/v8/test/es5conform/es5conform.status @@ -41,11 +41,6 @@ chapter10/10.4/10.4.2/10.4.2-2-c-1: FAIL_OK # We are compatible with Safari and Firefox. chapter11/11.1/11.1.5: UNIMPLEMENTED -# Delete returns true in eval even when it should return false. -# Please see http://code.google.com/p/v8/issues/detail?id=759 -chapter11/11.4/11.4.1//11.4.1-4.a-5: FAIL -chapter11/11.4/11.4.1//11.4.1-4.a-7: FAIL - # We do not have a global object called 'global' as required by tests. chapter15/15.1: FAIL_OK diff --git a/deps/v8/test/mjsunit/debug-evaluate-locals.js b/deps/v8/test/mjsunit/debug-evaluate-locals.js index 8430bd3576..4b87829169 100644 --- a/deps/v8/test/mjsunit/debug-evaluate-locals.js +++ b/deps/v8/test/mjsunit/debug-evaluate-locals.js @@ -34,18 +34,18 @@ exception = false; function checkFrame0(name, value) { - assertTrue(name == 'a' || name == 'b', 'frame0 name'); + assertTrue(name == 'a' || name == 'b'); if (name == 'a') { assertEquals(1, value); - } else if (name == 'b') { + } + if (name == 'b') { assertEquals(2, value); } } function checkFrame1(name, value) { - assertTrue(name == '.arguments' || name == 'arguments' || name == 'a', - 'frame1 name'); + assertTrue(name == '.arguments' || name == 'a'); if (name == 'a') { assertEquals(3, value); } @@ -53,10 +53,12 @@ function checkFrame1(name, value) { function checkFrame2(name, value) { - assertTrue(name == 'a' || name == 'b', 'frame2 name'); + assertTrue(name == '.arguments' || name == 'a' || + name == 'arguments' || name == 'b'); if (name == 'a') { assertEquals(5, value); - } else if (name == 'b') { + } + if (name == 'b') { assertEquals(0, value); } } @@ -71,17 +73,18 @@ function listener(event, exec_state, event_data, data) { checkFrame0(frame0.localName(0), frame0.localValue(0).value()); checkFrame0(frame0.localName(1), frame0.localValue(1).value()); - // Frame 1 has normal variables a and arguments (and the .arguments - // variable). + // 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()); - checkFrame1(frame1.localName(2), frame1.localValue(2).value()); - // Frame 2 has normal variables a and b. + // 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()); diff --git a/deps/v8/test/mjsunit/delete-global-properties.js b/deps/v8/test/mjsunit/delete-global-properties.js index b3813dc150..2acf591635 100644 --- a/deps/v8/test/mjsunit/delete-global-properties.js +++ b/deps/v8/test/mjsunit/delete-global-properties.js @@ -1,4 +1,4 @@ -// Copyright 2008 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: @@ -32,6 +32,17 @@ 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()); +assertEquals(1, f()); -/* Perhaps related to bugs/11? */ +// Check that deleting and reintroducing global variables works. +// Get into the IC case for storing to a deletable global property. +function introduce_x() { x = 42; } +for (var i = 0; i < 10; i++) introduce_x(); +// Check that the property has been introduced. +assertTrue(this.hasOwnProperty('x')); +// Check that deletion works. +delete x; +assertFalse(this.hasOwnProperty('x')); +// Check that reintroduction works. +introduce_x(); +assertTrue(this.hasOwnProperty('x')); diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status index 39ddf5a415..057c0fa874 100644 --- a/deps/v8/test/mjsunit/mjsunit.status +++ b/deps/v8/test/mjsunit/mjsunit.status @@ -119,9 +119,6 @@ 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/deps/v8/test/mjsunit/regress/regress-70066.js b/deps/v8/test/mjsunit/regress/regress-70066.js new file mode 100644 index 0000000000..b8386a706e --- /dev/null +++ b/deps/v8/test/mjsunit/regress/regress-70066.js @@ -0,0 +1,146 @@ +// 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. + +// Regression test for Chromium issue 70066. Delete should work properly +// from inside 'with' scopes. +// http://code.google.com/p/chromium/issues/detail?id=70066 + +x = 0; + +// Delete on a slot from a function's own context. +function test1() { + var value = 1; + var status; + with ({}) { status = delete value; } + return value + ":" + status; +} + +assertEquals("1:false", test1(), "test1"); +assertEquals(0, x, "test1"); // Global x is undisturbed. + + +// Delete on a slot from an outer context. +function test2() { + function f() { + with ({}) { return delete value; } + } + var value = 2; + var status = f(); + return value + ":" + status; +} + +assertEquals("2:false", test2(), "test2"); +assertEquals(0, x, "test2"); // Global x is undisturbed. + + +// Delete on an argument. This hits the same code paths as test5 because +// 'with' forces all parameters to be indirected through the arguments +// object. +function test3(value) { + var status; + with ({}) { status = delete value; } + return value + ":" + status; +} + +assertEquals("undefined:true", test3(3), "test3"); +assertEquals(0, x, "test3"); // Global x is undisturbed. + + +// Delete on an argument from an outer context. This hits the same code +// path as test2. +function test4(value) { + function f() { + with ({}) { return delete value; } + } + var status = f(); + return value + ":" + status; +} + +assertEquals("4:false", test4(4), "test4"); +assertEquals(0, x, "test4"); // Global x is undisturbed. + + +// Delete on an argument found in the arguments object. Such properties are +// normally DONT_DELETE in JavaScript but deletion is allowed by V8. +function test5(value) { + var status; + with ({}) { status = delete value; } + return arguments[0] + ":" + status; +} + +assertEquals("undefined:true", test5(5), "test5"); +assertEquals(0, x, "test5"); // Global x is undisturbed. + +function test6(value) { + function f() { + with ({}) { return delete value; } + } + var status = f(); + return arguments[0] + ":" + status; +} + +assertEquals("undefined:true", test6(6), "test6"); +assertEquals(0, x, "test6"); // Global x is undisturbed. + + +// Delete on a property found on 'with' object. +function test7(object) { + with (object) { return delete value; } +} + +var o = {value: 7}; +assertEquals(true, test7(o), "test7"); +assertEquals(void 0, o.value, "test7"); +assertEquals(0, x, "test7"); // Global x is undisturbed. + + +// Delete on a global property. +function test8() { + with ({}) { return delete x; } +} + +assertEquals(true, test8(), "test8"); +assertThrows("x", "test8"); // Global x should be deleted. + + +// Delete on a property that is not found anywhere. +function test9() { + with ({}) { return delete x; } +} + +assertThrows("x", "test9"); // Make sure it's not there. +assertEquals(true, test9(), "test9"); + + +// Delete on a DONT_DELETE property of the global object. +var y = 10; +function test10() { + with ({}) { return delete y; } +} + +assertEquals(false, test10(), "test10"); +assertEquals(10, y, "test10"); diff --git a/deps/v8/test/mjsunit/strict-mode.js b/deps/v8/test/mjsunit/strict-mode.js index 924b34f936..6f3a244134 100644 --- a/deps/v8/test/mjsunit/strict-mode.js +++ b/deps/v8/test/mjsunit/strict-mode.js @@ -44,6 +44,23 @@ function CheckStrictMode(code, exception) { }", exception); } +function CheckFunctionConstructorStrictMode() { + var args = []; + for (var i = 0; i < arguments.length; i ++) { + args[i] = arguments[i]; + } + // Create non-strict function. No exception. + args[arguments.length] = ""; + assertDoesNotThrow(function() { + Function.apply(this, args); + }); + // Create strict mode function. Exception expected. + args[arguments.length] = "'use strict';"; + assertThrows(function() { + Function.apply(this, args); + }, SyntaxError); +} + // Incorrect 'use strict' directive. function UseStrictEscape() { "use\\x20strict"; @@ -76,19 +93,29 @@ CheckStrictMode("function eval() {}", SyntaxError) CheckStrictMode("function arguments() {}", SyntaxError) // Function parameter named 'eval'. -//CheckStrictMode("function foo(a, b, eval, c, d) {}", SyntaxError) +CheckStrictMode("function foo(a, b, eval, c, d) {}", SyntaxError) // Function parameter named 'arguments'. -//CheckStrictMode("function foo(a, b, arguments, c, d) {}", SyntaxError) +CheckStrictMode("function foo(a, b, arguments, c, d) {}", SyntaxError) // Property accessor parameter named 'eval'. -//CheckStrictMode("var o = { set foo(eval) {} }", SyntaxError) +CheckStrictMode("var o = { set foo(eval) {} }", SyntaxError) // Property accessor parameter named 'arguments'. -//CheckStrictMode("var o = { set foo(arguments) {} }", SyntaxError) +CheckStrictMode("var o = { set foo(arguments) {} }", SyntaxError) // Duplicate function parameter name. -//CheckStrictMode("function foo(a, b, c, d, b) {}", SyntaxError) +CheckStrictMode("function foo(a, b, c, d, b) {}", SyntaxError) + +// Function constructor: eval parameter name. +CheckFunctionConstructorStrictMode("eval") + +// Function constructor: arguments parameter name. +CheckFunctionConstructorStrictMode("arguments") + +// Function constructor: duplicate parameter name. +CheckFunctionConstructorStrictMode("a", "b", "c", "b") +CheckFunctionConstructorStrictMode("a,b,c,b") // catch(eval) CheckStrictMode("try{}catch(eval){};", SyntaxError) @@ -103,10 +130,10 @@ CheckStrictMode("var eval;", SyntaxError) CheckStrictMode("var arguments;", SyntaxError) // Strict mode applies to the function in which the directive is used.. -//assertThrows('\ -//function foo(eval) {\ -// "use strict";\ -//}', SyntaxError); +assertThrows('\ +function foo(eval) {\ + "use strict";\ +}', SyntaxError); // Strict mode doesn't affect the outer stop of strict code. function NotStrict(eval) { @@ -115,3 +142,126 @@ function NotStrict(eval) { } with ({}) {}; } + +// Octal literal +CheckStrictMode("var x = 012"); +CheckStrictMode("012"); +CheckStrictMode("'Hello octal\\032'"); +CheckStrictMode("function octal() { return 012; }"); +CheckStrictMode("function octal() { return '\\032'; }"); + +// Octal before "use strict" +assertThrows('\ + function strict() {\ + "octal\\032directive";\ + "use strict";\ + }', SyntaxError); + +// Duplicate data properties. +CheckStrictMode("var x = { dupe : 1, nondupe: 3, dupe : 2 };", SyntaxError) +CheckStrictMode("var x = { '1234' : 1, '2345' : 2, '1234' : 3 };", SyntaxError) +CheckStrictMode("var x = { '1234' : 1, '2345' : 2, 1234 : 3 };", SyntaxError) +CheckStrictMode("var x = { 3.14 : 1, 2.71 : 2, 3.14 : 3 };", SyntaxError) +CheckStrictMode("var x = { 3.14 : 1, '3.14' : 2 };", SyntaxError) +CheckStrictMode("var x = { 123: 1, 123.00000000000000000000000000000000000000000000000000000000000000000001 : 2 }", SyntaxError) + +// Non-conflicting data properties. +function StrictModeNonDuplicate() { + "use strict"; + var x = { 123 : 1, "0123" : 2 }; + var x = { 123: 1, '123.00000000000000000000000000000000000000000000000000000000000000000001' : 2 } +} + +// Two getters (non-strict) +assertThrows("var x = { get foo() { }, get foo() { } };", SyntaxError) +assertThrows("var x = { get foo(){}, get 'foo'(){}};", SyntaxError) +assertThrows("var x = { get 12(){}, get '12'(){}};", SyntaxError) + +// Two setters (non-strict) +assertThrows("var x = { set foo(v) { }, set foo(v) { } };", SyntaxError) +assertThrows("var x = { set foo(v) { }, set 'foo'(v) { } };", SyntaxError) +assertThrows("var x = { set 13(v) { }, set '13'(v) { } };", SyntaxError) + +// Setter and data (non-strict) +assertThrows("var x = { foo: 'data', set foo(v) { } };", SyntaxError) +assertThrows("var x = { set foo(v) { }, foo: 'data' };", SyntaxError) +assertThrows("var x = { foo: 'data', set 'foo'(v) { } };", SyntaxError) +assertThrows("var x = { set foo(v) { }, 'foo': 'data' };", SyntaxError) +assertThrows("var x = { 'foo': 'data', set foo(v) { } };", SyntaxError) +assertThrows("var x = { set 'foo'(v) { }, foo: 'data' };", SyntaxError) +assertThrows("var x = { 'foo': 'data', set 'foo'(v) { } };", SyntaxError) +assertThrows("var x = { set 'foo'(v) { }, 'foo': 'data' };", SyntaxError) +assertThrows("var x = { 12: 1, set '12'(v){}};", SyntaxError); +assertThrows("var x = { 12: 1, set 12(v){}};", SyntaxError); +assertThrows("var x = { '12': 1, set '12'(v){}};", SyntaxError); +assertThrows("var x = { '12': 1, set 12(v){}};", SyntaxError); + +// Getter and data (non-strict) +assertThrows("var x = { foo: 'data', get foo() { } };", SyntaxError) +assertThrows("var x = { get foo() { }, foo: 'data' };", SyntaxError) +assertThrows("var x = { 'foo': 'data', get foo() { } };", SyntaxError) +assertThrows("var x = { get 'foo'() { }, 'foo': 'data' };", SyntaxError) +assertThrows("var x = { '12': 1, get '12'(){}};", SyntaxError); +assertThrows("var x = { '12': 1, get 12(){}};", SyntaxError); + +// Assignment to eval or arguments +CheckStrictMode("function strict() { eval = undefined; }", SyntaxError) +CheckStrictMode("function strict() { arguments = undefined; }", SyntaxError) +CheckStrictMode("function strict() { print(eval = undefined); }", SyntaxError) +CheckStrictMode("function strict() { print(arguments = undefined); }", SyntaxError) +CheckStrictMode("function strict() { var x = eval = undefined; }", SyntaxError) +CheckStrictMode("function strict() { var x = arguments = undefined; }", SyntaxError) + +// Compound assignment to eval or arguments +CheckStrictMode("function strict() { eval *= undefined; }", SyntaxError) +CheckStrictMode("function strict() { arguments /= undefined; }", SyntaxError) +CheckStrictMode("function strict() { print(eval %= undefined); }", SyntaxError) +CheckStrictMode("function strict() { print(arguments %= undefined); }", SyntaxError) +CheckStrictMode("function strict() { var x = eval += undefined; }", SyntaxError) +CheckStrictMode("function strict() { var x = arguments -= undefined; }", SyntaxError) +CheckStrictMode("function strict() { eval <<= undefined; }", SyntaxError) +CheckStrictMode("function strict() { arguments >>= undefined; }", SyntaxError) +CheckStrictMode("function strict() { print(eval >>>= undefined); }", SyntaxError) +CheckStrictMode("function strict() { print(arguments &= undefined); }", SyntaxError) +CheckStrictMode("function strict() { var x = eval ^= undefined; }", SyntaxError) +CheckStrictMode("function strict() { var x = arguments |= undefined; }", SyntaxError) + +// Postfix increment with eval or arguments +CheckStrictMode("function strict() { eval++; }", SyntaxError) +CheckStrictMode("function strict() { arguments++; }", SyntaxError) +CheckStrictMode("function strict() { print(eval++); }", SyntaxError) +CheckStrictMode("function strict() { print(arguments++); }", SyntaxError) +CheckStrictMode("function strict() { var x = eval++; }", SyntaxError) +CheckStrictMode("function strict() { var x = arguments++; }", SyntaxError) + +// Postfix decrement with eval or arguments +CheckStrictMode("function strict() { eval--; }", SyntaxError) +CheckStrictMode("function strict() { arguments--; }", SyntaxError) +CheckStrictMode("function strict() { print(eval--); }", SyntaxError) +CheckStrictMode("function strict() { print(arguments--); }", SyntaxError) +CheckStrictMode("function strict() { var x = eval--; }", SyntaxError) +CheckStrictMode("function strict() { var x = arguments--; }", SyntaxError) + +// Prefix increment with eval or arguments +CheckStrictMode("function strict() { ++eval; }", SyntaxError) +CheckStrictMode("function strict() { ++arguments; }", SyntaxError) +CheckStrictMode("function strict() { print(++eval); }", SyntaxError) +CheckStrictMode("function strict() { print(++arguments); }", SyntaxError) +CheckStrictMode("function strict() { var x = ++eval; }", SyntaxError) +CheckStrictMode("function strict() { var x = ++arguments; }", SyntaxError) + +// Prefix decrement with eval or arguments +CheckStrictMode("function strict() { --eval; }", SyntaxError) +CheckStrictMode("function strict() { --arguments; }", SyntaxError) +CheckStrictMode("function strict() { print(--eval); }", SyntaxError) +CheckStrictMode("function strict() { print(--arguments); }", SyntaxError) +CheckStrictMode("function strict() { var x = --eval; }", SyntaxError) +CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError) + +// Prefix unary operators other than delete, ++, -- are valid in strict mode +function StrictModeUnaryOperators() { + "use strict"; + var x = [void eval, typeof eval, +eval, -eval, ~eval, !eval]; + var y = [void arguments, typeof arguments, + +arguments, -arguments, ~arguments, !arguments]; +}
\ No newline at end of file diff --git a/deps/v8/test/mjsunit/string-charcodeat.js b/deps/v8/test/mjsunit/string-charcodeat.js index fb7ab9af86..f18d0a532e 100644 --- a/deps/v8/test/mjsunit/string-charcodeat.js +++ b/deps/v8/test/mjsunit/string-charcodeat.js @@ -205,3 +205,23 @@ assertTrue(isNaN(long.charCodeAt(-1)), 35); assertEquals(49, long.charCodeAt(0), 36); assertEquals(56, long.charCodeAt(65535), 37); assertTrue(isNaN(long.charCodeAt(65536)), 38); + + +// Test crankshaft code when the function is set directly on the +// string prototype object instead of the hidden prototype object. +// See http://code.google.com/p/v8/issues/detail?id=1070 + +String.prototype.x = String.prototype.charCodeAt; + +function directlyOnPrototype() { + assertEquals(97, "a".x(0)); + assertEquals(98, "b".x(0)); + assertEquals(99, "c".x(0)); + assertEquals(97, "a".x(0)); + assertEquals(98, "b".x(0)); + assertEquals(99, "c".x(0)); +} + +for (var i = 0; i < 10000; i++) { + directlyOnPrototype(); +} |