diff options
Diffstat (limited to 'deps/v8/test/mjsunit/harmony/regress')
17 files changed, 101 insertions, 94 deletions
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-2219.js b/deps/v8/test/mjsunit/harmony/regress/regress-2219.js index 946c75bd80..29e08603b5 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-2219.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-2219.js @@ -27,6 +27,6 @@ // Flags: --harmony-proxies --expose-gc -var p = Proxy.create({getPropertyDescriptor: function() { gc() }}); +var p = new Proxy({}, {getOwnPropertyDescriptor: function() { gc() }}); var o = Object.create(p); assertSame(23, o.x = 23); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-2225.js b/deps/v8/test/mjsunit/harmony/regress/regress-2225.js index 9957d8d463..75778753b2 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-2225.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-2225.js @@ -28,12 +28,13 @@ // Flags: --harmony-proxies var proxy_has_x = false; -var proxy = Proxy.create({ getPropertyDescriptor:function(key) { - assertSame('x', key); - if (proxy_has_x) { - return { configurable:true, writable:false, value:19 }; +var proxy = new Proxy({}, { + get(t, key, receiver) { + assertSame('x', key); + if (proxy_has_x) { return 19 } + return 8; } -}}); +}); // Test __lookupGetter__/__lookupSetter__ with proxy. assertSame(undefined, Object.prototype.__lookupGetter__.call(proxy, 'foo')); @@ -49,17 +50,27 @@ assertSame(undefined, Object.prototype.__lookupGetter__.call(object, '123')); assertSame(undefined, Object.prototype.__lookupSetter__.call(object, '456')); // Test inline constructors with proxy as prototype. -function f() { this.x = 23; } -f.prototype = proxy; +function F() { this.x = 42 } +F.prototype = proxy; +var instance = new F(); + proxy_has_x = false; -assertSame(23, new f().x); +assertSame(42, instance.x); +delete instance.x; +assertSame(8, instance.x); + proxy_has_x = true; -assertSame(19, new f().x); +assertSame(19, instance.x); // Test inline constructors with proxy in prototype chain. -function g() { this.x = 42; } -g.prototype.__proto__ = proxy; +function G() { this.x = 42; } +G.prototype.__proto__ = proxy; +instance = new G(); + proxy_has_x = false; -assertSame(42, new g().x); +assertSame(42, instance.x); +delete instance.x; +assertSame(8, instance.x); + proxy_has_x = true; -assertSame(19, new g().x); +assertSame(19, instance.x); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-405844.js b/deps/v8/test/mjsunit/harmony/regress/regress-405844.js deleted file mode 100644 index 3d3561f7a5..0000000000 --- a/deps/v8/test/mjsunit/harmony/regress/regress-405844.js +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright 2014 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Flags: --harmony-proxies --harmony-object-observe - -var proxy = Proxy.create({ fix: function() { return {}; } }); -Object.preventExtensions(proxy); -Object.observe(proxy, function(){}); - -var functionProxy = Proxy.createFunction({ fix: function() { return {}; } }, function(){}); -Object.preventExtensions(functionProxy); -Object.observe(functionProxy, function(){}); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-4211.js b/deps/v8/test/mjsunit/harmony/regress/regress-4211.js deleted file mode 100644 index d83c1a71f9..0000000000 --- a/deps/v8/test/mjsunit/harmony/regress/regress-4211.js +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. -// -// Flags: --harmony-rest-parameters - -assertThrows("()=>{}()", SyntaxError); -assertThrows("x=>{}()", SyntaxError); -assertThrows("(...x)=>{}()", SyntaxError); -assertThrows("(x)=>{}()", SyntaxError); -assertThrows("(x,y)=>{}()", SyntaxError); -assertThrows("(x,y,...z)=>{}()", SyntaxError); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-4395-global-eval.js b/deps/v8/test/mjsunit/harmony/regress/regress-4395-global-eval.js index 6cc6f0e747..b4579b141f 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-4395-global-eval.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-4395-global-eval.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Flags: --harmony-default-parameters --harmony-destructuring +// Flags: --harmony-default-parameters --harmony-destructuring-bind ((x, y = eval('x')) => assertEquals(42, y))(42); ((x, {y = eval('x')}) => assertEquals(42, y))(42, {}); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-4395.js b/deps/v8/test/mjsunit/harmony/regress/regress-4395.js index a003856715..fcc6784428 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-4395.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-4395.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Flags: --harmony-destructuring --harmony-default-parameters +// Flags: --harmony-destructuring-bind --harmony-default-parameters (function testExpressionTypes() { "use strict"; diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-4585.js b/deps/v8/test/mjsunit/harmony/regress/regress-4585.js new file mode 100644 index 0000000000..ada91c67ca --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regress/regress-4585.js @@ -0,0 +1,16 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-destructuring-bind + +assertThrows(`for(const { method() {} } = this) {}`, SyntaxError); +assertThrows(`var { method() {} } = this;`, SyntaxError); +assertThrows(`for(const { *method() {} } = this) {}`, SyntaxError); +assertThrows(`var { *method() {} } = this;`, SyntaxError); +assertThrows(`for(var { get foo() {} } = this) {}`, SyntaxError); +assertThrows(`for(var { set foo() {} } = this) {}`, SyntaxError); + +// Still OK in other objects +for (var { name = "" + { toString() { return "test" } } } in { a: 1}) break; +assertEquals(name, "test"); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-4658.js b/deps/v8/test/mjsunit/harmony/regress/regress-4658.js new file mode 100644 index 0000000000..35bea12adc --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regress/regress-4658.js @@ -0,0 +1,21 @@ +// Copyright 2015 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-do-expressions + +(function testWithSimpleLoopVariable() { + var f = (x, y = (do { var s=0; for (var e of x) s += e; s; })) => y*(y+1); + var result = f([1,2,3]); // core dump here, if not fixed. + assertEquals(result, 42); +})(); + +(function testWithComplexLoopVariable() { + var f = (x, i=x[0]-1, a=[], + y = (do { var s=0; + for (a[i] of x) s += a[i++]; + s; + })) => y*(a[0]+a[1]*a[2]); + var result = f([1,2,3]); // core dump here, if not fixed. + assertEquals(result, 42); +})(); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-508074.js b/deps/v8/test/mjsunit/harmony/regress/regress-508074.js deleted file mode 100644 index 93f82cfd0c..0000000000 --- a/deps/v8/test/mjsunit/harmony/regress/regress-508074.js +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-rest-parameters -// Flags: --allow-natives-syntax - -var f = (a, b, ...c) => { - print(a); - print(b); - print(c); - assertEquals(6, a); - assertEquals(5, b); - assertEquals([4, 3, 2, 1], c); -}; - -function g() { - f(6, 5, 4, 3, 2, 1); -}; - -g(); -g(); -g(); - -%OptimizeFunctionOnNextCall(g); -g(); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-513474.js b/deps/v8/test/mjsunit/harmony/regress/regress-513474.js deleted file mode 100644 index ec4bc84a30..0000000000 --- a/deps/v8/test/mjsunit/harmony/regress/regress-513474.js +++ /dev/null @@ -1,7 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-rest-parameters - -(function(...a) { function f() { eval() } })(); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-517455.js b/deps/v8/test/mjsunit/harmony/regress/regress-517455.js index a59fa181b7..f07e8fe63b 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-517455.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-517455.js @@ -2,7 +2,7 @@ // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. // -// Flags: --harmony-destructuring +// Flags: --harmony-destructuring-bind function f({x = ""}) { eval(x) } f({}) diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-576662.js b/deps/v8/test/mjsunit/harmony/regress/regress-576662.js new file mode 100644 index 0000000000..5541b79b5d --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regress/regress-576662.js @@ -0,0 +1,11 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +// Flags: --harmony-proxies + +// https://code.google.com/p/chromium/issues/detail?id=576662 (simplified) + +Realm.create(); +this.__proto__ = new Proxy({},{}); +assertThrows(() => Realm.eval(1, "Realm.global(0).bla = 1")); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-448730.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-448730.js index 31d276aa83..cf26127643 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-448730.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-448730.js @@ -5,7 +5,7 @@ // Flags: --allow-natives-syntax --harmony-proxies function bar() {} -bar({ a: Proxy.create({}) }); +bar({ a: new Proxy({}, {}) }); function foo(x) { x.a.b == ""; } var x = {a: {b: "" }}; foo(x); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-451770.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-451770.js deleted file mode 100644 index 770c8073cf..0000000000 --- a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-451770.js +++ /dev/null @@ -1,15 +0,0 @@ -// Copyright 2015 the V8 project authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -// Flags: --harmony-sloppy - -assertThrows(function f() { - var t = { toString: function() { throw new Error(); } }; - var o = { [t]: 23 }; -}, Error); - -assertThrows(function f() { - var t = { toString: function() { throw new Error(); } }; - class C { [t]() { return 23; } }; -}, Error); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-461520.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-461520.js index c30260db72..7ef9e20520 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-461520.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-461520.js @@ -5,14 +5,16 @@ // Flags: --harmony-proxies var fuse = 1; + var handler = { get: function() { return function() {} }, - getPropertyDescriptor: function() { + has() { return true }, + getOwnPropertyDescriptor: function() { if (fuse-- == 0) throw "please die"; return {value: function() {}, configurable: true}; } }; -var p = Proxy.create(handler); +var p = new Proxy({}, handler); var o = Object.create(p); with (o) { f() } diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-571149.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-571149.js new file mode 100644 index 0000000000..b3325b7fdf --- /dev/null +++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-571149.js @@ -0,0 +1,19 @@ +// Copyright 2016 the V8 project authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + + +(function(a = 0){ + var x; // allocated in a var block, due to use of default parameter + (function() { return !x })(); +})(); + +(function({a}){ + var x; // allocated in a var block, due to use of parameter destructuring + (function() { return !x })(); +})({}); + +(function(...a){ + var x; // allocated in a var block, due to use of rest parameter + (function() { return !x })(); +})(); diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-lookup-transition.js b/deps/v8/test/mjsunit/harmony/regress/regress-lookup-transition.js index 9b32939306..9a440b6ab3 100644 --- a/deps/v8/test/mjsunit/harmony/regress/regress-lookup-transition.js +++ b/deps/v8/test/mjsunit/harmony/regress/regress-lookup-transition.js @@ -4,7 +4,7 @@ // Flags: --harmony-proxies --expose-gc -var proxy = Proxy.create({ getPropertyDescriptor:function(key) { +var proxy = new Proxy({}, { getOwnPropertyDescriptor:function() { gc(); }}); |