summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/es6
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/es6')
-rw-r--r--deps/v8/test/mjsunit/es6/array-iterator-detached.js47
-rw-r--r--deps/v8/test/mjsunit/es6/arrow-rest-params-lazy-parsing.js2
-rw-r--r--deps/v8/test/mjsunit/es6/block-scoping-top-level-sloppy.js2
-rw-r--r--deps/v8/test/mjsunit/es6/block-scoping-top-level.js1
-rw-r--r--deps/v8/test/mjsunit/es6/classes-lazy-parsing.js2
-rw-r--r--deps/v8/test/mjsunit/es6/completion.js22
-rw-r--r--deps/v8/test/mjsunit/es6/computed-property-names-classes.js6
-rw-r--r--deps/v8/test/mjsunit/es6/debug-blockscopes.js539
-rw-r--r--deps/v8/test/mjsunit/es6/debug-evaluate-arrow-function-receiver.js116
-rw-r--r--deps/v8/test/mjsunit/es6/debug-evaluate-blockscopes.js113
-rw-r--r--deps/v8/test/mjsunit/es6/debug-evaluate-receiver-before-super.js39
-rw-r--r--deps/v8/test/mjsunit/es6/debug-exception-generators.js49
-rw-r--r--deps/v8/test/mjsunit/es6/debug-function-scopes.js116
-rw-r--r--deps/v8/test/mjsunit/es6/debug-liveedit-new-target-1.js75
-rw-r--r--deps/v8/test/mjsunit/es6/debug-liveedit-new-target-2.js63
-rw-r--r--deps/v8/test/mjsunit/es6/debug-liveedit-new-target-3.js73
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/promise-all-uncaught.js70
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/promise-race-uncaught.js70
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-caught-all.js69
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js77
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-in-constructor.js39
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-all.js66
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-late.js73
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js66
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js74
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js84
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js74
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/throw-caught-all.js68
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js78
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/throw-finally-caught-all.js72
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/throw-in-constructor.js40
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/throw-uncaught-all.js67
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js67
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js86
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/try-reject-in-constructor.js42
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/try-throw-reject-in-constructor.js44
-rw-r--r--deps/v8/test/mjsunit/es6/debug-scope-default-param-with-eval.js61
-rw-r--r--deps/v8/test/mjsunit/es6/debug-stepin-default-parameters.js46
-rw-r--r--deps/v8/test/mjsunit/es6/debug-stepin-microtasks.js75
-rw-r--r--deps/v8/test/mjsunit/es6/debug-stepin-proxies.js61
-rw-r--r--deps/v8/test/mjsunit/es6/debug-stepin-string-template.js61
-rw-r--r--deps/v8/test/mjsunit/es6/debug-stepnext-for.js135
-rw-r--r--deps/v8/test/mjsunit/es6/default-parameters-debug.js54
-rw-r--r--deps/v8/test/mjsunit/es6/destructuring-assignment-lazy.js2
-rw-r--r--deps/v8/test/mjsunit/es6/destructuring.js9
-rw-r--r--deps/v8/test/mjsunit/es6/function-name.js49
-rw-r--r--deps/v8/test/mjsunit/es6/generator-destructuring.js9
-rw-r--r--deps/v8/test/mjsunit/es6/generators-debug-liveedit.js119
-rw-r--r--deps/v8/test/mjsunit/es6/generators-debug-scopes.js339
-rw-r--r--deps/v8/test/mjsunit/es6/generators-mirror.js112
-rw-r--r--deps/v8/test/mjsunit/es6/mirror-collections.js165
-rw-r--r--deps/v8/test/mjsunit/es6/mirror-iterators.js103
-rw-r--r--deps/v8/test/mjsunit/es6/mirror-promises.js90
-rw-r--r--deps/v8/test/mjsunit/es6/mirror-symbols.js38
-rw-r--r--deps/v8/test/mjsunit/es6/promise-lookup-getter-setter.js76
-rw-r--r--deps/v8/test/mjsunit/es6/regexp-sticky.js7
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-4400.js2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-468661.js71
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-594084.js1
-rw-r--r--deps/v8/test/mjsunit/es6/string-startswith.js1
-rw-r--r--deps/v8/test/mjsunit/es6/typedarray-neutered.js781
-rw-r--r--deps/v8/test/mjsunit/es6/typedarray.js25
62 files changed, 1013 insertions, 4070 deletions
diff --git a/deps/v8/test/mjsunit/es6/array-iterator-detached.js b/deps/v8/test/mjsunit/es6/array-iterator-detached.js
new file mode 100644
index 0000000000..e9a940191b
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/array-iterator-detached.js
@@ -0,0 +1,47 @@
+// Copyright 2017 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: --allow-natives-syntax
+
+function Baseline() {
+ let array = new Uint8Array([0, 1, 2, 3, 4, 5, 6, 7, 8, 9]);
+
+ let it = array[Symbol.iterator]();
+ assertEquals(0, it.next().value);
+ assertEquals(1, it.next().value);
+ assertEquals(2, it.next().value);
+ %ArrayBufferNeuter(array.buffer);
+ it.next();
+};
+%NeverOptimizeFunction(Baseline);
+
+assertThrows(Baseline, TypeError,
+ "Cannot perform Array Iterator.prototype.next on a detached ArrayBuffer");
+
+function Turbo(count = 10000) {
+ let array = Array(10000);
+ for (let i = 0; i < 10000; ++i) {
+ array[i] = 254;
+ }
+ array[5000] = 255;
+ array = new Uint8Array(array);
+
+ let sum = 0;
+ let it = array[Symbol.iterator]();
+ for (let i = 0; i < count; ++i) {
+ let result = it.next();
+ if (result.value === 255) {
+ %ArrayBufferNeuter(array.buffer);
+ }
+ sum += result.value;
+ }
+ return sum;
+}
+
+Turbo(10);
+Turbo(10);
+%OptimizeFunctionOnNextCall(Turbo);
+
+assertThrows(Turbo, TypeError,
+ "Cannot perform Array Iterator.prototype.next on a detached ArrayBuffer");
diff --git a/deps/v8/test/mjsunit/es6/arrow-rest-params-lazy-parsing.js b/deps/v8/test/mjsunit/es6/arrow-rest-params-lazy-parsing.js
index 05e92b6ed6..2844069d17 100644
--- a/deps/v8/test/mjsunit/es6/arrow-rest-params-lazy-parsing.js
+++ b/deps/v8/test/mjsunit/es6/arrow-rest-params-lazy-parsing.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --min-preparse-length=0
-
(function testRestIndex() {
assertEquals(5, ((...args) => args.length)(1,2,3,4,5));
assertEquals(4, ((a, ...args) => args.length)(1,2,3,4,5));
diff --git a/deps/v8/test/mjsunit/es6/block-scoping-top-level-sloppy.js b/deps/v8/test/mjsunit/es6/block-scoping-top-level-sloppy.js
index 2a3b903f9e..22d12ea231 100644
--- a/deps/v8/test/mjsunit/es6/block-scoping-top-level-sloppy.js
+++ b/deps/v8/test/mjsunit/es6/block-scoping-top-level-sloppy.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --min-preparse-length=0
-
let xxx = 1;
let f = undefined;
{
diff --git a/deps/v8/test/mjsunit/es6/block-scoping-top-level.js b/deps/v8/test/mjsunit/es6/block-scoping-top-level.js
index a421b4fb4f..72434ba19e 100644
--- a/deps/v8/test/mjsunit/es6/block-scoping-top-level.js
+++ b/deps/v8/test/mjsunit/es6/block-scoping-top-level.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --min-preparse-length=0
'use strict';
let xxx = 1;
diff --git a/deps/v8/test/mjsunit/es6/classes-lazy-parsing.js b/deps/v8/test/mjsunit/es6/classes-lazy-parsing.js
index c1bf31da2d..6f5ce47ed6 100644
--- a/deps/v8/test/mjsunit/es6/classes-lazy-parsing.js
+++ b/deps/v8/test/mjsunit/es6/classes-lazy-parsing.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --min-preparse-length=0
-
'use strict';
class Base {
diff --git a/deps/v8/test/mjsunit/es6/completion.js b/deps/v8/test/mjsunit/es6/completion.js
index 6bc7d47a02..9d84a90406 100644
--- a/deps/v8/test/mjsunit/es6/completion.js
+++ b/deps/v8/test/mjsunit/es6/completion.js
@@ -107,9 +107,22 @@ assertEquals(undefined, eval(
'var b = 1; ' +
'outer: while (1) { while (1) { if (b--) 42; else break outer; }; 666 }'));
-// The following is not what ES6 says, but see ES bug 4540.
assertUndef(eval('42; switch (0) { case 0: 1; if (true) break; }')); // ES5: 1
+assertUndef(eval('a: while(true) { do { 0 } while(false); switch(1) { case 0: 1; case 1: break a; }; 0 }'));
+assertUndef(eval('a: while(true) { do { 0 } while(false); try {} finally { break a }; 0 }'));
+assertUndef(eval('a: while(true) { b: while(true) { 0; break b; }; switch(1) { case 1: break a; }; 2 }'));
+assertUndef(eval('a: while(true) { b: while(true) { 0; break b; }; while (true) { break a; }; 2 }'));
+assertUndef(eval('while (true) { 20; a:{ break a; } with ({}) break; 30; }'));
+assertEquals(42, eval('a: while(true) { switch(0) { case 0: 42; case 1: break a; }; 33 }'));
+
+assertUndef(eval(
+ 'for (var i = 0; i < 2; ++i) { if (i) { try {} finally { break; } } 0; }'
+));
+assertUndef(eval(
+ 'for (var i = 0; i < 2; ++i) { if (i) { try {} finally { continue; } } 0; }'
+));
+
////////////////////////////////////////////////////////////////////////////////
@@ -146,10 +159,3 @@ assertUndef(eval(
assertUndef(eval("1; try{2; throwOnReturn();} catch(e){}"));
assertUndef(eval("1; twoFunc();"));
assertEquals(2, eval("1; with ( { a: 0 } ) { 2; }"));
-
-assertUndef(eval('a: while(true) { do { 0 } while(false); switch(1) { case 0: 1; case 1: break a; }; 0 }'));
-assertUndef(eval('a: while(true) { do { 0 } while(false); try {} finally { break a }; 0 }'));
-assertUndef(eval('a: while(true) { b: while(true) { 0; break b; }; switch(1) { case 1: break a; }; 2 }'));
-assertUndef(eval('a: while(true) { b: while(true) { 0; break b; }; while (true) { break a; }; 2 }'));
-assertUndef(eval('while (true) { 20; a:{ break a; } with ({}) break; 30; }'));
-assertEquals(42, eval('a: while(true) { switch(0) { case 0: 42; case 1: break a; }; 33 }'));
diff --git a/deps/v8/test/mjsunit/es6/computed-property-names-classes.js b/deps/v8/test/mjsunit/es6/computed-property-names-classes.js
index eebf99aef5..da8e1d8dcb 100644
--- a/deps/v8/test/mjsunit/es6/computed-property-names-classes.js
+++ b/deps/v8/test/mjsunit/es6/computed-property-names-classes.js
@@ -81,7 +81,7 @@ function ID(x) {
// TODO(arv): It is not clear that we are adding the "standard" properties
// in the right order. As far as I can tell the spec adds them in alphabetical
// order.
- assertArrayEquals(['length', 'name', 'prototype', 'a', 'b', 'c', 'd'],
+ assertArrayEquals(['length', 'prototype', 'a', 'b', 'c', 'd', 'name'],
Object.getOwnPropertyNames(C));
})();
@@ -99,7 +99,7 @@ function ID(x) {
assertEquals('D', C[2]());
// Array indexes first.
assertArrayEquals([], Object.keys(C));
- assertArrayEquals(['1', '2', 'length', 'name', 'prototype', 'a', 'c'],
+ assertArrayEquals(['1', '2', 'length', 'prototype', 'a', 'c', 'name'],
Object.getOwnPropertyNames(C));
})();
@@ -118,7 +118,7 @@ function ID(x) {
assertEquals('C', C.c());
assertEquals('D', C[sym2]());
assertArrayEquals([], Object.keys(C));
- assertArrayEquals(['length', 'name', 'prototype', 'a', 'c'],
+ assertArrayEquals(['length', 'prototype', 'a', 'c', 'name'],
Object.getOwnPropertyNames(C));
assertArrayEquals([sym1, sym2], Object.getOwnPropertySymbols(C));
})();
diff --git a/deps/v8/test/mjsunit/es6/debug-blockscopes.js b/deps/v8/test/mjsunit/es6/debug-blockscopes.js
deleted file mode 100644
index bf04a0a4aa..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-blockscopes.js
+++ /dev/null
@@ -1,539 +0,0 @@
-// 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.
-
-// Flags: --expose-debug-as debug --allow-natives-syntax
-// The functions used for testing backtraces. They are at the top to make the
-// testing of source line/column easier.
-
-"use strict";
-
-// Get the Debug object exposed from the debug context global object.
-var Debug = debug.Debug;
-
-var test_name;
-var listener_delegate;
-var listener_called;
-var exception;
-var begin_test_count = 0;
-var end_test_count = 0;
-var break_count = 0;
-
-
-// Debug event listener which delegates.
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Break) {
- break_count++;
- listener_called = true;
- listener_delegate(exec_state);
- }
- } catch (e) {
- print(e, e.stack);
- exception = e;
- }
-}
-
-// Add the debug event listener.
-Debug.setListener(listener);
-
-
-// Initialize for a new test.
-function BeginTest(name) {
- test_name = name;
- listener_delegate = null;
- listener_called = false;
- exception = null;
- begin_test_count++;
-}
-
-
-// Check result of a test.
-function EndTest() {
- assertTrue(listener_called, "listerner not called for " + test_name);
- assertNull(exception, test_name, exception);
- end_test_count++;
-}
-
-var global_object = this;
-
-// Check that the scope chain contains the expected types of scopes.
-function CheckScopeChain(scopes, exec_state) {
- assertEquals(scopes.length, exec_state.frame().scopeCount());
- for (var i = 0; i < scopes.length; i++) {
- var scope = exec_state.frame().scope(i);
- assertTrue(scope.isScope());
- assertEquals(scopes[i], scope.scopeType());
-
- // Check the global object when hitting the global scope.
- if (scopes[i] == debug.ScopeType.Global) {
- // Objects don't have same class (one is "global", other is "Object",
- // so just check the properties directly.
- assertPropertiesEqual(global_object, scope.scopeObject().value());
- }
- }
-
- // Get the debug command processor.
- var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
-
- // Send a scopes request and check the result.
- var json;
- var request_json = '{"seq":0,"type":"request","command":"scopes"}';
- var response_json = dcp.processDebugJSONRequest(request_json);
- var response = JSON.parse(response_json);
- assertEquals(scopes.length, response.body.scopes.length);
- for (var i = 0; i < scopes.length; i++) {
- assertEquals(i, response.body.scopes[i].index);
- assertEquals(scopes[i], response.body.scopes[i].type);
- if (scopes[i] == debug.ScopeType.Local ||
- scopes[i] == debug.ScopeType.Script ||
- scopes[i] == debug.ScopeType.Closure) {
- assertTrue(response.body.scopes[i].object.ref < 0);
- } else {
- assertTrue(response.body.scopes[i].object.ref >= 0);
- }
- var found = false;
- for (var j = 0; j < response.refs.length && !found; j++) {
- found = response.refs[j].handle == response.body.scopes[i].object.ref;
- }
- assertTrue(found, "Scope object " + response.body.scopes[i].object.ref + " not found");
- }
-}
-
-// Check that the content of the scope is as expected. For functions just check
-// that there is a function.
-function CheckScopeContent(content, number, exec_state) {
- var scope = exec_state.frame().scope(number);
- var count = 0;
- for (var p in content) {
- var property_mirror = scope.scopeObject().property(p);
- if (property_mirror.isUndefined()) {
- print('property ' + p + ' not found in scope');
- }
- assertFalse(property_mirror.isUndefined(), 'property ' + p + ' not found in scope');
- if (typeof(content[p]) === 'function') {
- assertTrue(property_mirror.value().isFunction());
- } else {
- assertEquals(content[p], property_mirror.value().value(), 'property ' + p + ' has unexpected value');
- }
- count++;
- }
-
- // 'arguments' and might be exposed in the local and closure scope. Just
- // ignore this.
- var scope_size = scope.scopeObject().properties().length;
- if (!scope.scopeObject().property('arguments').isUndefined()) {
- scope_size--;
- }
- // Temporary variables introduced by the parser have not been materialized.
- assertTrue(scope.scopeObject().property('').isUndefined());
-
- if (count != scope_size) {
- print('Names found in scope:');
- var names = scope.scopeObject().propertyNames();
- for (var i = 0; i < names.length; i++) {
- print(names[i]);
- }
- }
- assertEquals(count, scope_size);
-
- // Get the debug command processor.
- var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
-
- // Send a scope request for information on a single scope and check the
- // result.
- var request_json = '{"seq":0,"type":"request","command":"scope","arguments":{"number":';
- request_json += scope.scopeIndex();
- request_json += '}}';
- var response_json = dcp.processDebugJSONRequest(request_json);
- var response = JSON.parse(response_json);
- assertEquals(scope.scopeType(), response.body.type);
- assertEquals(number, response.body.index);
- if (scope.scopeType() == debug.ScopeType.Local ||
- scope.scopeType() == debug.ScopeType.Closure) {
- assertTrue(response.body.object.ref < 0);
- } else {
- assertTrue(response.body.object.ref >= 0);
- }
- var found = false;
- for (var i = 0; i < response.refs.length && !found; i++) {
- found = response.refs[i].handle == response.body.object.ref;
- }
- assertTrue(found, "Scope object " + response.body.object.ref + " not found");
-}
-
-
-function assertEqualsUnlessOptimized(expected, value, f) {
- try {
- assertEquals(expected, value);
- } catch (e) {
- assertOptimized(f);
- }
-}
-
-// Simple empty block scope in local scope.
-BeginTest("Local block 1");
-
-function local_block_1() {
- {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
-};
-local_block_1();
-EndTest();
-
-
-// Simple empty block scope in local scope with a parameter.
-BeginTest("Local 2");
-
-function local_2(a) {
- {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1}, 0, exec_state);
-};
-local_2(1);
-EndTest();
-
-
-// Local scope with a parameter and a local variable.
-BeginTest("Local 3");
-
-function local_3(a) {
- let x = 3;
- debugger;
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1,x:3}, 0, exec_state);
-};
-local_3(1);
-EndTest();
-
-
-// Local scope with parameters and local variables.
-BeginTest("Local 4");
-
-function local_4(a, b) {
- let x = 3;
- let y = 4;
- debugger;
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1,b:2,x:3,y:4}, 0, exec_state);
-};
-local_4(1, 2);
-EndTest();
-
-
-// Single variable in a block scope.
-BeginTest("Local 5");
-
-function local_5(a) {
- {
- let x = 5;
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:5}, 0, exec_state);
- CheckScopeContent({a:1}, 1, exec_state);
-};
-local_5(1);
-EndTest();
-
-
-// Two variables in a block scope.
-BeginTest("Local 6");
-
-function local_6(a) {
- {
- let x = 6;
- let y = 7;
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:6,y:7}, 0, exec_state);
- CheckScopeContent({a:1}, 1, exec_state);
-};
-local_6(1);
-EndTest();
-
-
-// Two variables in a block scope.
-BeginTest("Local 7");
-
-function local_7(a) {
- {
- {
- let x = 8;
- debugger;
- }
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:8}, 0, exec_state);
- CheckScopeContent({a:1}, 1, exec_state);
-};
-local_7(1);
-EndTest();
-
-
-// Simple closure formed by returning an inner function referering to an outer
-// block local variable and an outer function's parameter.
-BeginTest("Closure 1");
-
-function closure_1(a) {
- var x = 2;
- let y = 3;
- if (true) {
- let z = 4;
- function f() {
- debugger;
- return a + x + y + z;
- };
- return f;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Block,
- debug.ScopeType.Closure,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
- CheckScopeContent({a:1,x:2,y:3}, 2, exec_state);
-};
-closure_1(1)();
-EndTest();
-
-
-// Simple for-in loop over the keys of an object.
-BeginTest("For loop 1");
-
-function for_loop_1() {
- for (let x in {y:undefined}) {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:'y'}, 0, exec_state);
- // The function scope contains a temporary iteration variable, but it is
- // hidden to the debugger.
-};
-for_loop_1();
-EndTest();
-
-
-// For-in loop over the keys of an object with a block scoped let variable
-// shadowing the iteration variable.
-BeginTest("For loop 2");
-
-function for_loop_2() {
- for (let x in {y:undefined}) {
- let x = 3;
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:3}, 0, exec_state);
- CheckScopeContent({x:'y'}, 1, exec_state);
- // The function scope contains a temporary iteration variable, hidden to the
- // debugger.
-};
-for_loop_2();
-EndTest();
-
-
-// Simple for loop.
-BeginTest("For loop 3");
-
-function for_loop_3() {
- for (let x = 3; x < 4; ++x) {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:3}, 0, exec_state);
- CheckScopeContent({}, 1, exec_state);
-};
-for_loop_3();
-EndTest();
-
-
-// For loop with a block scoped let variable shadowing the iteration variable.
-BeginTest("For loop 4");
-
-function for_loop_4() {
- for (let x = 3; x < 4; ++x) {
- let x = 5;
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:5}, 0, exec_state);
- CheckScopeContent({x:3}, 1, exec_state);
- CheckScopeContent({}, 2, exec_state);
-};
-for_loop_4();
-EndTest();
-
-
-// For loop with two variable declarations.
-BeginTest("For loop 5");
-
-function for_loop_5() {
- for (let x = 3, y = 5; x < 4; ++x) {
- debugger;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:3,y:5}, 0, exec_state);
- CheckScopeContent({}, 1, exec_state);
-};
-for_loop_5();
-EndTest();
-
-
-// Uninitialized variables
-BeginTest("Uninitialized 1");
-
-function uninitialized_1() {
- {
- debugger;
- let x = 1;
- }
-}
-
-listener_delegate = function(exec_state) {
- CheckScopeChain([debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({x:undefined}, 0, exec_state);
-};
-uninitialized_1();
-EndTest();
-
-
-// Block scopes shadowing
-BeginTest("Block scopes shadowing 1");
-function shadowing_1() {
- let i = 0;
- {
- let i = 5;
- debugger;
- }
- assertEquals(0, i);
-}
-
-listener_delegate = function (exec_state) {
- assertEqualsUnlessOptimized(5, exec_state.frame(0).evaluate("i").value());
-}
-shadowing_1();
-EndTest();
-
-
-// Block scopes shadowing
-BeginTest("Block scopes shadowing 2");
-function shadowing_2() {
- let i = 0;
- {
- let j = 5;
- debugger;
- }
-}
-
-listener_delegate = function (exec_state) {
- assertEqualsUnlessOptimized(0, exec_state.frame(0).evaluate("i").value());
- assertEqualsUnlessOptimized(5, exec_state.frame(0).evaluate("j").value());
-}
-shadowing_2();
-EndTest();
diff --git a/deps/v8/test/mjsunit/es6/debug-evaluate-arrow-function-receiver.js b/deps/v8/test/mjsunit/es6/debug-evaluate-arrow-function-receiver.js
deleted file mode 100644
index ce7201df9c..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-evaluate-arrow-function-receiver.js
+++ /dev/null
@@ -1,116 +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: --expose-debug-as debug
-
-// Test that debug-evaluate can find the correct this value for an arrow
-// function, if "this" is referenced within the arrow function scope.
-
-Debug = debug.Debug
-
-var break_count = 0;
-var exception = null;
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Break) return;
- try {
- for (var i = 0; i < exec_state.frameCount() - 1; i++) {
- var frame = exec_state.frame(i);
- var this_value = frame.evaluate("this").value();
- var expected = frame.sourceLineText().match(/\/\/ (.*$)/)[1];
- print(expected, this_value, frame.sourceLineText());
- assertEquals(String(expected), String(this_value));
- }
- break_count++;
- } catch (e) {
- exception = e;
- print(e + e.stack);
- }
-}
-
-// Context-allocated receiver.
-function f() {
- debugger; // foo
- return () => {
- debugger; // foo
- with ({}) {
- return () => {
- debugger; // foo
- try {
- throw new Error();
- } catch (e) {
- return () => {
- (() => this); // bind this.
- debugger; // foo
- return () => {
- debugger; // undefined
- return g.call("goo"); // undefined
- }
- };
- }
- };
- }
- };
-}
-
-// Stack-allocated receiver.
-function g() {
- debugger; // goo
- return () => {
- debugger; // undefined
- with ({}) {
- return () => {
- debugger; // undefined
- try {
- throw new Error();
- } catch (e) {
- return () => {
- debugger; // undefined
- return f.call("foo"); // undefined
- };
- }
- };
- }
- };
-}
-
-Debug.setListener(listener);
-
-var h = f.call("foo");
-for (var i = 0; i < 20; i++) h = h();
-var h = g.call("goo");
-for (var i = 0; i < 20; i++) h = h();
-
-function x() {
- (() => this); // bind this.
- function y() {
- (() => {
- (() => this); // bind this.
- debugger; // Y
- })(); // Y
- }
- y.call("Y"); // X
-}
-x.call("X");
-
-function u() {
- (() => this);
- function v() {
- (() => {
- debugger; // undefined
- })(); // V
- }
- v.call("V"); // U
-}
-u.call("U");
-
-(() => {
- (() => this);
- debugger; // [object global]
-})();
-
-Debug.setListener(null);
-
-assertEquals(55, break_count);
-assertNull(exception);
diff --git a/deps/v8/test/mjsunit/es6/debug-evaluate-blockscopes.js b/deps/v8/test/mjsunit/es6/debug-evaluate-blockscopes.js
deleted file mode 100644
index efc334e35f..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-evaluate-blockscopes.js
+++ /dev/null
@@ -1,113 +0,0 @@
-// 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.
-
-// Flags: --expose-debug-as debug
-
-// Test debug evaluation for functions without local context, but with
-// nested catch contexts.
-
-"use strict";
-
-var x;
-var result;
-
-function f() {
- { // Line 1.
- let i = 1; // Line 2.
- try { // Line 3.
- throw 'stuff'; // Line 4.
- } catch (e) { // Line 5.
- x = 2; // Line 6.
- }
- }
-};
-
-// Get the Debug object exposed from the debug context global object.
-var Debug = debug.Debug
-
-function listener(event, exec_state, event_data, data) {
- if (event == Debug.DebugEvent.Break) {
- result = exec_state.frame().evaluate("i").value();
- }
-};
-
-// Add the debug event listener.
-Debug.setListener(listener);
-
-//Set breakpoint on line 6.
-var bp = Debug.setBreakPoint(f, 6);
-
-result = -1;
-f();
-assertEquals(1, result);
-
-// Clear breakpoint.
-Debug.clearBreakPoint(bp);
-// Get rid of the debug event listener.
-Debug.setListener(null);
-
-
-function f1() {
- {
- let i = 1;
- debugger;
- assertEquals(2, i);
- }
-}
-
-function f2() {
- {
- let i = 1;
- debugger;
- assertEquals(2, i);
- return function() { return i++; }
- }
-}
-
-var exception;
-Debug.setListener(function (event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Break) {
- var frame = exec_state.frame();
- assertEquals(1, frame.evaluate("i").value());
- var allScopes = frame.allScopes();
- assertEquals(1, allScopes[0].scopeObject().value().i);
- allScopes[0].setVariableValue("i", 2);
- }
- } catch (e) {
- exception = e;
- }
-});
-
-exception = null;
-f1();
-assertEquals(null, exception, exception);
-exception = null;
-f2();
-assertEquals(null, exception, exception);
-
-Debug.setListener(null);
diff --git a/deps/v8/test/mjsunit/es6/debug-evaluate-receiver-before-super.js b/deps/v8/test/mjsunit/es6/debug-evaluate-receiver-before-super.js
deleted file mode 100644
index dc8ce2cacd..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-evaluate-receiver-before-super.js
+++ /dev/null
@@ -1,39 +0,0 @@
-// 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: --expose-debug-as debug
-
-// Test that debug-evaluate doesn't crash when this is used before super() call
-// in constructor.
-
-Debug = debug.Debug
-
-var result;
-
-function listener(event, exec_state, event_data, data)
-{
- try {
- if (event == Debug.DebugEvent.Break) {
- result = exec_state.frame(0).evaluate("this.a").value();
- }
- } catch (e) {
- result = e.message;
- }
-}
-
-Debug.setListener(listener);
-
-class A { constructor () { this.a = 239; } }
-class B extends A {
- constructor () {
- debugger;
- assertEquals("Cannot read property 'a' of undefined", result);
- super();
- debugger;
- assertEquals(239, result);
- }
-}
-new B();
-
-Debug.setListener(null);
diff --git a/deps/v8/test/mjsunit/es6/debug-exception-generators.js b/deps/v8/test/mjsunit/es6/debug-exception-generators.js
deleted file mode 100644
index b2e7e82964..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-exception-generators.js
+++ /dev/null
@@ -1,49 +0,0 @@
-// 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: --expose-debug-as debug
-
-Debug = debug.Debug
-
-var exception = null;
-var log = [];
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Exception) return;
- try {
- var line = exec_state.frame(0).sourceLineText();
- var match = /Exception (\w)/.exec(line);
- assertNotNull(match);
- assertEquals(match[1], event_data.exception());
- log.push(match[1]);
- } catch (e) {
- exception = e;
- }
-}
-
-
-function* g() {
- try {
- throw "a"; // Ordinary throw. Exception a
- } catch (e) {}
- try {
- yield 1; // Caught internally. Exception b
- } catch (e) {}
- yield 2;
- yield 3; // Caught externally. Exception c
- yield 4;
-}
-
-Debug.setListener(listener);
-Debug.setBreakOnException();
-var g_obj = g();
-assertEquals(1, g_obj.next().value);
-assertEquals(2, g_obj.throw("b").value);
-assertEquals(3, g_obj.next().value);
-assertThrows(() => g_obj.throw("c"));
-assertThrows(() => g_obj.throw("d")); // Closed generator. Exception d
-Debug.setListener(null);
-Debug.clearBreakOnException();
-assertEquals(["a", "b", "c", "d"], log);
-assertNull(exception);
diff --git a/deps/v8/test/mjsunit/es6/debug-function-scopes.js b/deps/v8/test/mjsunit/es6/debug-function-scopes.js
deleted file mode 100644
index c1a20e7b9e..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-function-scopes.js
+++ /dev/null
@@ -1,116 +0,0 @@
-// Copyright 2012 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (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
-
-"use strict";
-let top_level_let = 255;
-
-// Get the Debug object exposed from the debug context global object.
-var Debug = debug.Debug;
-
-function CheckScope(scope_mirror, scope_expectations, expected_scope_type) {
- assertEquals(expected_scope_type, scope_mirror.scopeType());
-
- var scope_object = scope_mirror.scopeObject().value();
-
- for (let name in scope_expectations) {
- let actual = scope_object[name];
- let expected = scope_expectations[name];
- assertEquals(expected, actual);
- }
-}
-
-// A copy of the scope types from debug/mirrors.js.
-var ScopeType = { Global: 0,
- Local: 1,
- With: 2,
- Closure: 3,
- Catch: 4,
- Block: 5,
- Script: 6};
-
-var f1 = (function F1(x) {
- function F2(y) {
- var z = x + y;
- {
- var w = 5;
- var v = "Capybara";
- var F3 = function(a, b) {
- function F4(p) {
- return p + a + b + z + w + v.length;
- }
- return F4;
- }
- return F3(4, 5);
- }
- }
- return F2(17);
-})(5);
-
-var mirror = Debug.MakeMirror(f1);
-
-assertEquals(5, mirror.scopeCount());
-
-CheckScope(mirror.scope(0), { a: 4, b: 5 }, ScopeType.Closure);
-CheckScope(mirror.scope(1), { z: 22, w: 5, v: "Capybara" }, ScopeType.Closure);
-CheckScope(mirror.scope(2), { x: 5 }, ScopeType.Closure);
-CheckScope(mirror.scope(3), { top_level_let: 255 }, ScopeType.Script);
-CheckScope(mirror.scope(4), {}, ScopeType.Global);
-
-var f2 = (function() {
- var v1 = 3;
- var v2 = 4;
- let l0 = 0;
- {
- var v3 = 5;
- let l1 = 6;
- let l2 = 7;
- {
- var v4 = 8;
- let l3 = 9;
- {
- var v5 = "Cat";
- let l4 = 11;
- var v6 = l4;
- return function() {
- return l0 + v1 + v3 + l2 + l3 + v6;
- };
- }
- }
- }
-})();
-
-var mirror = Debug.MakeMirror(f2);
-
-assertEquals(5, mirror.scopeCount());
-
-CheckScope(mirror.scope(0), { l3: 9 }, ScopeType.Block);
-CheckScope(mirror.scope(1), { l2: 7 }, ScopeType.Block);
-CheckScope(mirror.scope(2), { v1:3, l0: 0, v3: 5, v6: 11 }, ScopeType.Closure);
-CheckScope(mirror.scope(3), { top_level_let: 255 }, ScopeType.Script);
-CheckScope(mirror.scope(4), {}, ScopeType.Global);
diff --git a/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-1.js b/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-1.js
deleted file mode 100644
index 8855742abf..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-1.js
+++ /dev/null
@@ -1,75 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test that live-editing a frame that uses new.target fails.
-
-Debug = debug.Debug
-var calls = 0;
-var exceptions = 0;
-var results = [];
-var replace_again;
-
-eval(`
- function LogNewTarget() {
- calls++;
- ReplaceOnce();
- results.push(true);
- results.push(new.target);
- }
-`);
-
-function Dummy() {}
-
-function Replace(fun, original, patch) {
- %ExecuteInDebugContext(function() {
- var change_log = [];
- try {
- var script = Debug.findScript(fun);
- var patch_pos = script.source.indexOf(original);
- Debug.LiveEdit.TestApi.ApplySingleChunkPatch(
- script, patch_pos, original.length, patch, change_log);
- } catch (e) {
- assertEquals("BLOCKED_NO_NEW_TARGET_ON_RESTART",
- change_log[0].functions_on_stack[0].replace_problem);
- assertInstanceof(e, Debug.LiveEdit.Failure);
- exceptions++;
- }
- });
-}
-
-function ReplaceOnce() {
- if (replace_again) {
- replace_again = false;
- Replace(LogNewTarget, "true", "false");
- }
-}
-
-function Revert() {
- Replace(LogNewTarget, "false", "true");
-}
-
-replace_again = true;
-ReplaceOnce();
-new LogNewTarget();
-Revert();
-assertEquals(1, calls);
-assertEquals(0, exceptions);
-assertEquals([false, LogNewTarget], results);
-
-replace_again = true;
-LogNewTarget();
-
-replace_again = true;
-new LogNewTarget();
-
-replace_again = true;
-Reflect.construct(LogNewTarget, [], Dummy);
-
-assertEquals(
- [false, LogNewTarget, true, undefined, true, LogNewTarget, true, Dummy],
- results);
-assertEquals(4, calls); // No restarts
-assertEquals(3, exceptions); // Replace failed.
diff --git a/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-2.js b/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-2.js
deleted file mode 100644
index 8c6dc7e7e1..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-2.js
+++ /dev/null
@@ -1,63 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test that live-editing a frame to introduce new.target fails.
-
-Debug = debug.Debug
-var calls = 0;
-var exceptions = 0;
-var results = [];
-var replace_again;
-
-eval(`
- function LogNewTarget() {
- calls++;
- ReplaceOnce();
- results.push(true);
- }
-`);
-
-function Replace(fun, original, patch) {
- %ExecuteInDebugContext(function() {
- var change_log = [];
- try {
- var script = Debug.findScript(fun);
- var patch_pos = script.source.indexOf(original);
- Debug.LiveEdit.TestApi.ApplySingleChunkPatch(
- script, patch_pos, original.length, patch, change_log);
- } catch (e) {
- assertEquals("BLOCKED_NO_NEW_TARGET_ON_RESTART",
- change_log[0].functions_on_stack[0].replace_problem);
- assertInstanceof(e, Debug.LiveEdit.Failure);
- exceptions++;
- }
- });
-}
-
-function ReplaceOnce(x) {
- if (replace_again) {
- replace_again = false;
- Replace(LogNewTarget, "true", "new.target");
- }
-}
-
-function Revert() {
- Replace(LogNewTarget, "new.target", "true");
-}
-
-replace_again = true;
-ReplaceOnce();
-new LogNewTarget();
-Revert();
-assertEquals(1, calls);
-assertEquals(0, exceptions);
-assertEquals([LogNewTarget], results);
-
-replace_again = true;
-new LogNewTarget();
-assertEquals(2, calls); // No restarts
-assertEquals(1, exceptions); // Replace failed.
-assertEquals([LogNewTarget, true], results);
diff --git a/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-3.js b/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-3.js
deleted file mode 100644
index 40facd3167..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-liveedit-new-target-3.js
+++ /dev/null
@@ -1,73 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test that live-editing a frame above one that uses new.target succeeds.
-
-Debug = debug.Debug
-var wrapper_calls = 0;
-var construct_calls = 0;
-var exceptions = 0;
-var results = [];
-var replace_again;
-
-eval(`
- function LogNewTarget(arg) {
- construct_calls++;
- results.push(new.target);
- }
- function Wrapper() {
- wrapper_calls++;
- ReplaceOnce();
- new LogNewTarget(true);
- }
-`);
-
-function Replace(fun, original, patch) {
- %ExecuteInDebugContext(function() {
- var change_log = [];
- try {
- var script = Debug.findScript(fun);
- var patch_pos = script.source.indexOf(original);
- Debug.LiveEdit.TestApi.ApplySingleChunkPatch(
- script, patch_pos, original.length, patch, change_log);
- } catch (e) {
- exceptions++;
- }
- });
-}
-
-function ReplaceOnce(x) {
- if (replace_again) {
- replace_again = false;
- Replace(Wrapper, "true", "false");
- }
-}
-
-function Revert() {
- Replace(Wrapper, "false", "true");
-}
-
-replace_again = true;
-ReplaceOnce();
-Wrapper();
-Revert();
-assertEquals(1, construct_calls);
-assertEquals(1, wrapper_calls);
-assertEquals(0, exceptions); // Replace succeeds
-assertEquals([LogNewTarget], results);
-
-Wrapper();
-assertEquals(2, construct_calls);
-assertEquals(2, wrapper_calls);
-assertEquals(0, exceptions); // Replace succeeds
-assertEquals([LogNewTarget, LogNewTarget], results);
-
-replace_again = true;
-Wrapper();
-assertEquals(3, construct_calls);
-assertEquals(4, wrapper_calls); // Restarts
-assertEquals(0, exceptions); // Replace succeeds
-assertEquals([LogNewTarget, LogNewTarget, LogNewTarget], results);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/promise-all-uncaught.js b/deps/v8/test/mjsunit/es6/debug-promises/promise-all-uncaught.js
deleted file mode 100644
index c201d13e05..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/promise-all-uncaught.js
+++ /dev/null
@@ -1,70 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we only listen to uncaught exceptions and a
-// Promise p3 created by Promise.all has no catch handler, and is rejected
-// because one of the Promises p2 passed to Promise.all is rejected.
-// We expect one event for p2; the system recognizes the rejection of p3
-// to be redundant and based on the rejection of p2 and does not trigger
-// an additional rejection.
-
-var Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Exception) return;
- try {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("uncaught", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- assertEquals("p2", event_data.promise().name);
- assertTrue(event_data.uncaught());
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-var p1 = Promise.resolve();
-p1.name = "p1";
-
-var p2 = p1.then(function() {
- log.push("throw");
- throw new Error("uncaught"); // event
-});
-
-p2.name = "p2";
-
-var p3 = Promise.all([p2]);
-p3.name = "p3";
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["end main", "throw"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/promise-race-uncaught.js b/deps/v8/test/mjsunit/es6/debug-promises/promise-race-uncaught.js
deleted file mode 100644
index ed6233bc30..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/promise-race-uncaught.js
+++ /dev/null
@@ -1,70 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we only listen to uncaught exceptions and a
-// Promise p3 created by Promise.race has no catch handler, and is rejected
-// because one of the Promises p2 passed to Promise.race is rejected.
-// We expect one event for p2; the system recognizes the rejection of p3
-// to be redundant and based on the rejection of p2 and does not trigger
-// an additional rejection.
-
-var Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Exception) return;
- try {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("uncaught", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- assertEquals("p2", event_data.promise().name);
- assertTrue(event_data.uncaught());
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-var p1 = Promise.resolve();
-p1.name = "p1";
-
-var p2 = p1.then(function() {
- log.push("throw");
- throw new Error("uncaught"); // event
-});
-
-p2.name = "p2";
-
-var p3 = Promise.race([p2]);
-p3.name = "p3";
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["end main", "throw"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-all.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-all.js
deleted file mode 100644
index 8d348ce6b6..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-all.js
+++ /dev/null
@@ -1,69 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we listen to all exceptions and
-// there is a catch handler for the to-be-rejected Promise.
-// We expect a normal Exception debug event to be triggered.
-
-Debug = debug.Debug;
-
-var log = [];
-var expected_events = 1;
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-var q = p.then(
- function(value) {
- log.push("reject");
- return Promise.reject(new Error("reject"));
- });
-
-q.catch(
- function(e) {
- assertEquals("reject", e.message);
- });
-
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("reject", event_data.exception().message);
- assertSame(q, event_data.promise());
- assertFalse(event_data.uncaught());
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "end main", "reject"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js
deleted file mode 100644
index 6cd28259e1..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-caught-by-default-reject-handler.js
+++ /dev/null
@@ -1,77 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we only listen to uncaught exceptions and
-// there is only a default reject handler for the to-be-rejected Promise.
-// We expect only one debug event: when the first Promise is rejected
-// and only has default reject handlers. No event is triggered when
-// simply forwarding the rejection with .then's default handler.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var resolve, reject;
-var p0 = new Promise(function(res, rej) { resolve = res; reject = rej; });
-var p1 = p0.then(function() {
- log.push("p0.then");
- return Promise.reject(new Error("123"));
-});
-var p2 = p1.then(function() {
- log.push("p1.then");
-});
-
-var q = new Promise(function(res, rej) {
- log.push("resolve q");
- res();
-});
-
-q.then(function() {
- log.push("resolve p");
- resolve();
-})
-
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertTrue(event_data.uncaught());
- assertTrue(event_data.promise() instanceof Promise);
- // p1 is rejected, uncaught, with the error from the Promise.reject line
- assertNotNull(event_data.sourceLineText().match("Promise.reject"));
- assertSame(p1, event_data.promise());
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve q", "end main", "resolve p", "p0.then"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-in-constructor.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-in-constructor.js
deleted file mode 100644
index a05b3ac5d6..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-in-constructor.js
+++ /dev/null
@@ -1,39 +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: --expose-debug-as debug
-
-// Test debug events when we only listen to uncaught exceptions and
-// the Promise is rejected in the Promise constructor.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var steps = 0;
-var exception = null;
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- steps++;
- assertEquals("uncaught", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertTrue(event_data.uncaught());
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- }
- } catch (e) {
- exception = e;
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-var p = new Promise(function(resolve, reject) {
- reject(new Error("uncaught")); // event
-});
-
-assertEquals(1, steps);
-assertNull(exception);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-all.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-all.js
deleted file mode 100644
index d4f02cddf7..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-all.js
+++ /dev/null
@@ -1,66 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we listen to all exceptions and
-// there is a catch handler for the to-be-rejected Promise.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-var q = p.then(
- function() {
- log.push("reject");
- return Promise.reject(new Error("uncaught reject"));
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("uncaught reject", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertSame(q, event_data.promise());
- assertTrue(event_data.uncaught());
- // The frame comes from the Promise.reject call
- assertNotNull(/Promise\.reject/.exec(event_data.sourceLineText()));
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "end main", "reject"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-late.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-late.js
deleted file mode 100644
index db58790e39..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-late.js
+++ /dev/null
@@ -1,73 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we only listen to uncaught exceptions and
-// there is a catch handler for the to-be-rejected Promise.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var reject_closure;
-
-var p = new Promise(function(resolve, reject) {
- log.push("postpone p");
- reject_closure = reject;
-});
-
-var q = new Promise(function(resolve, reject) {
- log.push("resolve q");
- resolve();
-});
-
-q.then(function() {
- log.push("reject p");
- reject_closure(new Error("uncaught reject p")); // event
-})
-
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("uncaught reject p", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertSame(p, event_data.promise());
- assertTrue(event_data.uncaught());
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["postpone p", "resolve q", "end main", "reject p"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js
deleted file mode 100644
index 0a5279fbed..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-uncaught-uncaught.js
+++ /dev/null
@@ -1,66 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we only listen to uncaught exceptions and
-// there is no catch handler for the to-be-rejected Promise.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-var q = p.then(
- function() {
- log.push("reject");
- return Promise.reject(Error("uncaught reject")); // event
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("uncaught reject", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertSame(q, event_data.promise());
- assertTrue(event_data.uncaught());
- // The JavaScript frame is from the Promise rejection
- assertTrue(/Promise\.reject/.test(event_data.sourceLineText()));
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "end main", "reject"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js
deleted file mode 100644
index 6aaf882ce8..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-with-invalid-reject.js
+++ /dev/null
@@ -1,74 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when a Promise is rejected, which is caught by a custom
-// promise, which has a number for reject closure. We expect an Exception debug
-// events trying to call the invalid reject closure.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-function MyPromise(resolver) {
- var reject = 1;
- var resolve = function() { };
- log.push("construct");
- resolver(resolve, reject);
-};
-
-MyPromise.prototype = new Promise(function() {});
-p.constructor = MyPromise;
-
-var q = p.then(
- function() {
- log.push("reject caught");
- return Promise.reject(new Error("caught"));
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("number is not a function", event_data.exception().message);
- // All of the frames on the stack are from native Javascript.
- assertEquals(0, exec_state.frameCount());
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "construct", "end main", "reject caught"],
- log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
-
-log.push("end main");
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js
deleted file mode 100644
index 47e335d968..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-with-throw-in-reject.js
+++ /dev/null
@@ -1,84 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when a Promise is rejected, which is caught by a
-// custom promise, which throws a new exception in its reject handler.
-// We expect two Exception debug events:
-// 1) when promise q is rejected.
-// 2) when the custom reject closure in MyPromise throws an exception.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-function MyPromise(resolver) {
- var reject = function() {
- log.push("throw in reject");
- throw new Error("reject"); // event
- };
- var resolve = function() { };
- log.push("construct");
- resolver(resolve, reject);
-};
-
-MyPromise.prototype = new Promise(function() {});
-p.constructor = MyPromise;
-
-var q = p.then(
- function() {
- log.push("reject caught");
- return Promise.reject(new Error("caught"));
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("reject", event_data.exception().message);
- // Assert that the debug event is triggered at the throw site.
- assertTrue(
- exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- }
- } catch (e) {
- // Signal a failure with exit code 1. This is necessary since the
- // debugger swallows exceptions and we expect the chained function
- // and this listener to be executed after the main script is finished.
- print("Unexpected exception: " + e + "\n" + e.stack);
- quit(1);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "construct", "end main",
- "reject caught", "throw in reject"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js b/deps/v8/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js
deleted file mode 100644
index 1595372396..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/reject-with-undefined-reject.js
+++ /dev/null
@@ -1,74 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when a Promise is rejected, which is caught by a custom
-// promise, which has undefined for reject closure. We expect an Exception
-// debug even calling the (undefined) custom rejected closure.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-function MyPromise(resolver) {
- var reject = undefined;
- var resolve = function() { };
- log.push("construct");
- resolver(resolve, reject);
-};
-
-MyPromise.prototype = new Promise(function() {});
-p.constructor = MyPromise;
-
-var q = p.then(
- function() {
- log.push("reject caught");
- return Promise.reject(new Error("caught"));
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("caught", event_data.exception().message);
- // All of the frames on the stack are from native Javascript.
- assertEquals(0, exec_state.frameCount());
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "construct", "end main", "reject caught"],
- log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
-
-log.push("end main");
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-all.js b/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-all.js
deleted file mode 100644
index 8b932490b2..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-all.js
+++ /dev/null
@@ -1,68 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we listen to all exceptions and
-// there is a catch handler for the exception thrown in a Promise.
-// We expect a normal Exception debug event to be triggered.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-var q = p.then(
- function() {
- log.push("throw");
- throw new Error("caught");
- });
-
-q.catch(
- function(e) {
- assertEquals("caught", e.message);
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("caught", event_data.exception().message);
- assertSame(q, event_data.promise());
- assertFalse(event_data.uncaught());
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "end main", "throw"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js b/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js
deleted file mode 100644
index 8b798f7af9..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/throw-caught-by-default-reject-handler.js
+++ /dev/null
@@ -1,78 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we only listen to uncaught exceptions and
-// there is only a default reject handler for the to-be-rejected Promise.
-// We expect only one debug event: when the first Promise is rejected
-// and only has default reject handlers. No event is triggered when
-// simply forwarding the rejection with .then's default handler.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var resolve, reject;
-var p0 = new Promise(function(res, rej) { resolve = res; reject = rej; });
-var p1 = p0.then(function() {
- log.push("p0.then");
- throw new Error("123"); // event
-});
-var p2 = p1.then(function() {
- log.push("p1.then");
-});
-
-var q = new Promise(function(res, rej) {
- log.push("resolve q");
- res();
-});
-
-q.then(function() {
- log.push("resolve p");
- resolve();
-})
-
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertTrue(event_data.uncaught());
- assertTrue(event_data.promise() instanceof Promise);
- // p1 is rejected, uncaught except for its default reject handler.
- assertTrue(
- exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- assertSame(p1, event_data.promise());
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve q", "end main", "resolve p", "p0.then"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/throw-finally-caught-all.js b/deps/v8/test/mjsunit/es6/debug-promises/throw-finally-caught-all.js
deleted file mode 100644
index eb823f518f..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/throw-finally-caught-all.js
+++ /dev/null
@@ -1,72 +0,0 @@
-// 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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we listen to all exceptions and
-// there is a catch handler for the exception thrown in a Promise, first
-// caught by a try-finally, and immediately rethrown.
-// We expect a normal Exception debug event to be triggered.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-var q = p.then(
- function() {
- log.push("throw");
- try {
- throw new Error("caught");
- } finally {
- }
- });
-
-q.catch(
- function(e) {
- assertEquals("caught", e.message);
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("caught", event_data.exception().message);
- assertSame(q, event_data.promise());
- assertFalse(event_data.uncaught());
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "end main", "throw"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/throw-in-constructor.js b/deps/v8/test/mjsunit/es6/debug-promises/throw-in-constructor.js
deleted file mode 100644
index fd6b4dd348..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/throw-in-constructor.js
+++ /dev/null
@@ -1,40 +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: --expose-debug-as debug
-
-// Test debug events when we only listen to uncaught exceptions and
-// an exception is thrown in the Promise constructor.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var step = 0;
-var exception = null;
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- assertEquals(0, step);
- assertEquals("uncaught", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertTrue(event_data.uncaught());
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- step++;
- }
- } catch (e) {
- exception = e;
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-var p = new Promise(function(resolve, reject) {
- throw new Error("uncaught"); // event
-});
-
-assertEquals(1, step);
-assertNull(exception);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/throw-uncaught-all.js b/deps/v8/test/mjsunit/es6/debug-promises/throw-uncaught-all.js
deleted file mode 100644
index 3a73ac9fff..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/throw-uncaught-all.js
+++ /dev/null
@@ -1,67 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we listen to all exceptions and
-// there is no catch handler for the exception thrown in a Promise.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-var q = p.then(
- function() {
- log.push("throw");
- throw new Error("uncaught"); // event
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- // Ignore exceptions during startup in stress runs.
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("uncaught", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertSame(q, event_data.promise());
- assertTrue(event_data.uncaught());
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "end main", "throw"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js b/deps/v8/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
deleted file mode 100644
index 24239f26f3..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/throw-uncaught-uncaught.js
+++ /dev/null
@@ -1,67 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when we only listen to uncaught exceptions and
-// there is a catch handler for the exception thrown in a Promise.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-var q = p.then(
- function() {
- log.push("throw");
- throw new Error("uncaught"); // event
- });
-
-function listener(event, exec_state, event_data, data) {
- if (event == Debug.DebugEvent.AsyncTaskEvent) return;
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- assertEquals("uncaught", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertSame(q, event_data.promise());
- assertTrue(event_data.uncaught());
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "end main", "throw"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js b/deps/v8/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js
deleted file mode 100644
index 622dd2573e..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/throw-with-throw-in-reject.js
+++ /dev/null
@@ -1,86 +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: --expose-debug-as debug --allow-natives-syntax
-
-// Test debug events when an exception is thrown inside a Promise, which is
-// caught by a custom promise, which throws a new exception in its reject
-// handler. We expect two Exception debug events:
-// 1) when the exception is thrown in the promise q.
-// 2) when the custom reject closure in MyPromise throws an exception.
-
-Debug = debug.Debug;
-
-var expected_events = 1;
-var log = [];
-
-var p = new Promise(function(resolve, reject) {
- log.push("resolve");
- resolve();
-});
-
-function MyPromise(resolver) {
- var reject = function() {
- log.push("throw in reject");
- throw new Error("reject"); // event
- };
- var resolve = function() { };
- log.push("construct");
- resolver(resolve, reject);
-};
-
-MyPromise.prototype = new Promise(function() {});
-MyPromise.__proto__ = Promise;
-p.constructor = MyPromise;
-
-var q = p.then(
- function() {
- log.push("throw caught");
- throw new Error("caught"); // event
- });
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- expected_events--;
- assertTrue(expected_events >= 0);
- if (expected_events == 0) {
- assertEquals(["resolve", "construct", "end main",
- "throw caught"], log);
- assertEquals("caught", event_data.exception().message);
- } else {
- assertUnreachable();
- }
- assertSame(q, event_data.promise());
- assertTrue(exec_state.frame(0).sourceLineText().indexOf('// event') > 0);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-log.push("end main");
-
-function testDone(iteration) {
- function checkResult() {
- try {
- assertTrue(iteration < 10);
- if (expected_events === 0) {
- assertEquals(["resolve", "construct", "end main",
- "throw caught", "throw in reject"], log);
- } else {
- testDone(iteration + 1);
- }
- } catch (e) {
- %AbortJS(e + "\n" + e.stack);
- }
- }
-
- %EnqueueMicrotask(checkResult);
-}
-
-testDone(0);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/try-reject-in-constructor.js b/deps/v8/test/mjsunit/es6/debug-promises/try-reject-in-constructor.js
deleted file mode 100644
index 00981a67d0..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/try-reject-in-constructor.js
+++ /dev/null
@@ -1,42 +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: --expose-debug-as debug
-
-// Test debug events when we only listen to uncaught exceptions and
-// the Promise is rejected within a try-catch in the Promise constructor.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var step = 0;
-var exception = null;
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- assertEquals(0, step);
- assertEquals("uncaught", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertTrue(event_data.uncaught());
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- step++;
- }
- } catch (e) {
- exception = e;
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-var p = new Promise(function(resolve, reject) {
- try { // This try-catch must not prevent this uncaught reject event.
- reject(new Error("uncaught")); // event
- } catch (e) { }
-});
-
-assertEquals(1, step);
-assertNull(exception);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/try-throw-reject-in-constructor.js b/deps/v8/test/mjsunit/es6/debug-promises/try-throw-reject-in-constructor.js
deleted file mode 100644
index feff81da90..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-promises/try-throw-reject-in-constructor.js
+++ /dev/null
@@ -1,44 +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: --expose-debug-as debug
-
-// Test debug events when we only listen to uncaught exceptions and
-// an exception is thrown in the Promise constructor, but caught in an
-// inner try-catch. The Promise is rejected afterwards.
-// We expect an Exception debug event with a promise to be triggered.
-
-Debug = debug.Debug;
-
-var step = 0;
-var exception = null;
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Exception) {
- assertEquals(0, step);
- assertEquals("uncaught", event_data.exception().message);
- assertTrue(event_data.promise() instanceof Promise);
- assertTrue(event_data.uncaught());
- // Assert that the debug event is triggered at the throw site.
- assertTrue(exec_state.frame(0).sourceLineText().indexOf("// event") > 0);
- step++;
- }
- } catch (e) {
- exception = e;
- }
-}
-
-Debug.setBreakOnUncaughtException();
-Debug.setListener(listener);
-
-var p = new Promise(function(resolve, reject) {
- try { // This try-catch must not prevent this uncaught reject event.
- throw new Error("caught");
- } catch (e) { }
- reject(new Error("uncaught")); // event
-});
-
-assertEquals(1, step);
-assertNull(exception);
diff --git a/deps/v8/test/mjsunit/es6/debug-scope-default-param-with-eval.js b/deps/v8/test/mjsunit/es6/debug-scope-default-param-with-eval.js
deleted file mode 100644
index d4dc93f2c5..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-scope-default-param-with-eval.js
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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: --expose-debug-as debug
-
-// Test that the parameter initialization block scope set up for
-// sloppy eval is visible to the debugger.
-
-var Debug = debug.Debug;
-var exception = null;
-var break_count = 0;
-
-function call_for_break() {
- return 5;
-}
-
-function test(x = eval("var y = 7; debugger; y") + call_for_break()) {
- return x;
-}
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Break) return;
- try {
- var frame = exec_state.frame(0);
- var block_scope;
- if (break_count++ == 0) {
- // Inside eval.
- assertEquals([ debug.ScopeType.Eval,
- debug.ScopeType.Block,
- debug.ScopeType.Closure,
- debug.ScopeType.Script,
- debug.ScopeType.Global ],
- frame.allScopes().map(s => s.scopeType()));
- exec_state.prepareStep(Debug.StepAction.StepOut);
- block_scope = frame.scope(1);
- } else {
- // Outside of eval.
- assertEquals([ debug.ScopeType.Block,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global ],
- frame.allScopes().map(s => s.scopeType()));
- block_scope = frame.scope(0);
- }
- assertTrue(block_scope.scopeObject().propertyNames().includes('y'));
- assertEquals(7, block_scope.scopeObject().property('y').value().value());
- } catch (e) {
- print(e);
- exception = e;
- }
-}
-
-Debug.setListener(listener);
-
-assertEquals(12, test());
-
-Debug.setListener(null);
-
-assertNull(exception);
-assertEquals(2, break_count);
diff --git a/deps/v8/test/mjsunit/es6/debug-stepin-default-parameters.js b/deps/v8/test/mjsunit/es6/debug-stepin-default-parameters.js
deleted file mode 100644
index aaac9f0d4e..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-stepin-default-parameters.js
+++ /dev/null
@@ -1,46 +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: --expose-debug-as debug
-
-Debug = debug.Debug
-
-var exception = null;
-var log = [];
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Break) return;
- try {
- print(event_data.sourceLineText());
- var entry = "";
- for (var i = 0; i < exec_state.frameCount(); i++) {
- entry += exec_state.frame(i).sourceLineText().substr(-1);
- entry += exec_state.frame(i).sourceColumn();
- }
- log.push(entry);
- exec_state.prepareStep(Debug.StepAction.StepIn);
- } catch (e) {
- exception = e;
- }
-};
-
-function default_arg(x) {
- return "default"; // d
-} // e
-
-function f(arg0 = default_arg()) { // f
- return arg0; // g
-} // h
-
-
-Debug.setListener(listener);
-debugger; // a
-var result = f(); // b
-Debug.setListener(null); // c
-
-assertNull(exception);
-assertEquals("default", result);
-
-assertEquals(["a0","b13","f18b13","d2f18b13","e0f18b13","g2b13","h0b13","c0"],
- log);
diff --git a/deps/v8/test/mjsunit/es6/debug-stepin-microtasks.js b/deps/v8/test/mjsunit/es6/debug-stepin-microtasks.js
deleted file mode 100644
index 9e3bd172c8..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-stepin-microtasks.js
+++ /dev/null
@@ -1,75 +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: --allow-natives-syntax --expose-debug-as debug
-
-Debug = debug.Debug
-var exception = null;
-var break_count = 0;
-const expected_breaks = 9;
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Break) {
- assertTrue(exec_state.frameCount() != 0, "FAIL: Empty stack trace");
- var source = exec_state.frame(0).sourceLineText();
- print("paused at: " + source);
- assertTrue(source.indexOf("// Break " + break_count + ".") > 0,
- "Unexpected pause at: " + source + "\n" +
- "Expected: // Break " + break_count + ".");
- if (source.indexOf("StepOver.") !== -1) {
- exec_state.prepareStep(Debug.StepAction.StepNext);
- } else {
- exec_state.prepareStep(Debug.StepAction.StepIn);
- }
- ++break_count;
- }
- } catch (e) {
- exception = e;
- print(e, e.stack);
- }
-};
-
-Debug.setListener(listener);
-
-Promise.resolve(42)
- .then(promise1)
- .then(Object) // Should skip stepping into native.
- .then(Boolean) // Should skip stepping into native.
- .then(promise2)
- .catch(promise3)
- .then(promise4)
- .catch(function(e) {
- %AbortJS("FAIL: uncaught exception " + e);
- });
-
-function promise1() {
- debugger; // Break 0.
- return exception || 1; // Break 1.
-} // Break 2.
-
-function promise2() {
- throw new Error; // Break 3.
-}
-
-function promise3() {
- return break_count; // Break 4.
-} // Break 5.
-
-function promise4() {
- finalize(); // Break 6. StepOver.
- return 0; // Break 7.
-} // Break 8. StepOver.
-
-function finalize() {
- Promise.resolve().then(function() {
- if (expected_breaks !== break_count) {
- %AbortJS("FAIL: expected <" + expected_breaks + "> breaks instead of <" +
- break_count + ">");
- }
- if (exception !== null) {
- %AbortJS("FAIL: exception: " + exception);
- }
- });
-}
diff --git a/deps/v8/test/mjsunit/es6/debug-stepin-proxies.js b/deps/v8/test/mjsunit/es6/debug-stepin-proxies.js
deleted file mode 100644
index 72c01f0c43..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-stepin-proxies.js
+++ /dev/null
@@ -1,61 +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: --expose-debug-as debug
-
-Debug = debug.Debug
-
-var exception = null;
-var log = [];
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Break) return;
- try {
- print(event_data.sourceLineText());
- var entry = "";
- for (var i = 0; i < exec_state.frameCount(); i++) {
- entry += exec_state.frame(i).sourceLineText().substr(-1);
- entry += exec_state.frame(i).sourceColumn();
- }
- log.push(entry);
- exec_state.prepareStep(Debug.StepAction.StepIn);
- } catch (e) {
- exception = e;
- }
-};
-
-var target = {};
-var handler = {
- has: function(target, name) {
- return true; // h
- }, // i
- get: function(target, name) {
- return 42; // j
- }, // k
- set: function(target, name, value) {
- return false; // l
- }, // m
-}
-
-var proxy = new Proxy(target, handler);
-
-Debug.setListener(listener);
-debugger; // a
-var has = "step" in proxy; // b
-var get = proxy.step; // c
-proxy.step = 43; // d
-
-Debug.setListener(null); // g
-
-assertNull(exception);
-assertTrue(has);
-assertEquals(42, get);
-
-assertEquals([
- "a0",
- "b17", "h4b17", "i2b17", // [[Has]]
- "c15", "j4c15", "k2c15", // [[Get]]
- "d0", "l4d11", "m2d11", // [[Set]]
- "g0"
-], log);
diff --git a/deps/v8/test/mjsunit/es6/debug-stepin-string-template.js b/deps/v8/test/mjsunit/es6/debug-stepin-string-template.js
deleted file mode 100644
index 2d8c39497e..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-stepin-string-template.js
+++ /dev/null
@@ -1,61 +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: --expose-debug-as debug
-
-Debug = debug.Debug
-
-var exception = null;
-var log = [];
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Break) return;
- try {
- print(event_data.sourceLineText());
- var entry = "";
- for (var i = 0; i < exec_state.frameCount(); i++) {
- entry += exec_state.frame(i).sourceLineText().substr(-1);
- entry += exec_state.frame(i).sourceColumn();
- }
- log.push(entry);
- exec_state.prepareStep(Debug.StepAction.StepIn);
- } catch (e) {
- exception = e;
- }
-};
-
-function u(x) {
- return x.toUpperCase(); // d
-} // e
-
-var n = 3;
-
-var o = {
- toString: function() {
- return "D"; // f
- } // g
-}
-
-
-
-Debug.setListener(listener);
-debugger; // a
-var s = `1 ${u("a")} 2 ${u("b")} 3 ${n} 4 ${o}`; // b
-Debug.setListener(null); // c
-
-assertNull(exception);
-
-assertEquals([
- "a0",
- "b44",
- "b13",
- "d2b13",
- "e0b13",
- "b25",
- "d2b25",
- "e0b25",
- "f4b44",
- "g2b44",
- "c0"
-], log);
diff --git a/deps/v8/test/mjsunit/es6/debug-stepnext-for.js b/deps/v8/test/mjsunit/es6/debug-stepnext-for.js
deleted file mode 100644
index d425a46b84..0000000000
--- a/deps/v8/test/mjsunit/es6/debug-stepnext-for.js
+++ /dev/null
@@ -1,135 +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: --expose-debug-as debug --harmony
-
-Debug = debug.Debug;
-var break_count = 0
-var exception = null;
-var log = []
-
-var s = 0;
-var a = [1, 2, 3];
-var b = [1, 2, 3, 4];
-var null_value = null;
-var i = 0;
-
-function f() {
- "use strict";
- debugger; // Break a
- var j; // Break b
-
- for (var i in null_value) { // Break c
- s += a[i];
- }
-
- for (j in null_value) { // Break d
- s += a[j];
- }
-
- for (var i in a) { // Break e
- s += a[i]; // Break E
- }
-
- for (j in a) { // Break f
- s += a[j]; // Break F
- }
-
- for (let i in a) { // Break g
- s += a[i]; // Break G
- }
-
- for (var i of a) { // Break h
- s += i; // Break H
- }
-
- for (j of a) { // Break i
- s += j; // Break I
- }
-
- for (let i of a) { // Break j
- s += i; // Break J
- }
-
- for (var i = 0; i < 3; i++) { // Break k
- s += a[i]; // Break K
- }
-
- for (j = 0; j < 3; j++) { // Break l
- s += a[j]; // Break L
- }
-
- for (let i = 0; i < 3; i++) { // Break m
- s += a[i]; // Break M
- }
-
- for (let i of a) {} // Break n
-
- [1, ...a] // Break o
-
-} // Break y
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Break) return;
- try {
- var line = exec_state.frame(0).sourceLineText();
- var col = exec_state.frame(0).sourceColumn();
- print(line);
- var match = line.match(/\/\/ Break (\w)$/);
- assertEquals(2, match.length);
- log.push(match[1] + col);
- exec_state.prepareStep(Debug.StepAction.StepNext);
- break_count++;
- } catch (e) {
- exception = e;
- }
-}
-
-Debug.setListener(listener);
-f();
-Debug.setListener(null); // Break z
-
-print("log:\n"+ JSON.stringify(log));
-// The let declaration differs from var in that the loop variable
-// is declared in every iteration.
-// TODO(verwaest): For-of has hacky position numbers for Symbol.iterator and
-// .next. Restore to proper positions once the CallPrinter can disambiguate
-// based on other values.
-var expected = [
- // Entry
- "a2",
- // Empty for-in-var: get enumerable
- "c16",
- // Empty for-in: get enumerable
- "d12",
- // For-in-var: get enumerable, assign, body, assign, body, ...
- "e16","e11","E4","e11","E4","e11","E4","e11",
- // For-in: get enumerable, assign, body, assign, body, ...
- "f12","f7","F4","f7","F4","f7","F4","f7",
- // For-in-let: get enumerable, next, body, next, ...
- "g16","g11","G4","g11","G4","g11","G4","g11",
- // For-of-var: [Symbol.iterator](), next(), body, next(), body, ...
- "h16","h13","H4","h13","H4","h13","H4","h13",
- // For-of: [Symbol.iterator](), next(), body, next(), body, ...
- "i12","i9","I4","i9","I4","i9","I4","i9",
- // For-of-let: [Symbol.iterator](), next(), body, next(), ...
- "j18","j14","J4","j14","J4","j14","J4","j14",
- // For-var: init, condition, body, next, condition, body, ...
- "k15","k20","K4","k26","k20","K4","k26","k20","K4","k26","k20",
- // For: init, condition, body, next, condition, body, ...
- "l7","l16","L4","l22","l16","L4","l22","l16","L4","l22","l16",
- // For-let: init, condition, body, next, condition, body, ...
- "m15","m20","M4","m26","m20","M4","m26","m20","M4","m26","m20",
- // For-of, empty: [Symbol.iterator](), next() once
- "n16", "n13",
- // Spread: expression statement, spread
- "o2", "o9",
- // Exit.
- "y0","z0",
-]
-print("expected:\n"+ JSON.stringify(expected));
-
-assertArrayEquals(expected, log);
-assertEquals(54, s);
-assertNull(exception);
diff --git a/deps/v8/test/mjsunit/es6/default-parameters-debug.js b/deps/v8/test/mjsunit/es6/default-parameters-debug.js
deleted file mode 100644
index 49adfa4610..0000000000
--- a/deps/v8/test/mjsunit/es6/default-parameters-debug.js
+++ /dev/null
@@ -1,54 +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: --expose-debug-as debug
-
-// Get the Debug object exposed from the debug context global object.
-Debug = debug.Debug
-
-listenerComplete = false;
-breakPointCount = 0;
-exception = null;
-
-function listener(event, exec_state, event_data, data) {
- if (event != Debug.DebugEvent.Break) return;
- try {
- breakPointCount++;
- if (breakPointCount == 1) {
- // Break point in initializer for parameter `a`, invoked by
- // initializer for parameter `b`
- assertEquals('default', exec_state.frame(0).evaluate('mode').value());
- assertTrue(exec_state.frame(1).evaluate('b').isUndefined());
- assertTrue(exec_state.frame(1).evaluate('c').isUndefined());
- } else if (breakPointCount == 2) {
- // Break point in IIFE initializer for parameter `c`
- assertEquals('modeFn', exec_state.frame(1).evaluate('a.name').value());
- assertEquals('default', exec_state.frame(1).evaluate('b').value());
- assertTrue(exec_state.frame(1).evaluate('c').isUndefined());
- } else if (breakPointCount == 3) {
- // Break point in function body --- `c` parameter is shadowed
- assertEquals('modeFn', exec_state.frame(0).evaluate('a.name').value());
- assertEquals('default', exec_state.frame(0).evaluate('b').value());
- assertEquals('local', exec_state.frame(0).evaluate('d').value());
- }
- } catch (e) {
- exception = e;
- }
-};
-
-// Add the debug event listener.
-Debug.setListener(listener);
-
-function f(a = function modeFn(mode) { debugger; return mode; },
- b = a("default"),
- c = (function() { debugger; })()) {
- var d = 'local';
- debugger;
-};
-
-f();
-
-// Make sure that the debug event listener vas invoked.
-assertEquals(3, breakPointCount);
-assertNull(exception);
diff --git a/deps/v8/test/mjsunit/es6/destructuring-assignment-lazy.js b/deps/v8/test/mjsunit/es6/destructuring-assignment-lazy.js
index fdae30ec63..ac3cbf0f41 100644
--- a/deps/v8/test/mjsunit/es6/destructuring-assignment-lazy.js
+++ b/deps/v8/test/mjsunit/es6/destructuring-assignment-lazy.js
@@ -2,8 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --min-preparse-length=0
-
function f() {
var a, b;
[ a, b ] = [1, 2];
diff --git a/deps/v8/test/mjsunit/es6/destructuring.js b/deps/v8/test/mjsunit/es6/destructuring.js
index a4f88844d4..f09165a24e 100644
--- a/deps/v8/test/mjsunit/es6/destructuring.js
+++ b/deps/v8/test/mjsunit/es6/destructuring.js
@@ -1082,10 +1082,11 @@
var g21 = ({x}) => { { function x() { return 2 } } return x(); }
assertThrows(() => g21({x: 1}), TypeError);
- assertThrows("'use strict'; function f(x) { let x = 0; }", SyntaxError);
- assertThrows("'use strict'; function f({x}) { let x = 0; }", SyntaxError);
- assertThrows("'use strict'; function f(x) { const x = 0; }", SyntaxError);
- assertThrows("'use strict'; function f({x}) { const x = 0; }", SyntaxError);
+ // These errors are not recognized in lazy parsing; see mjsunit/bugs/bug-2728.js
+ assertThrows("'use strict'; (function f(x) { let x = 0; })()", SyntaxError);
+ assertThrows("'use strict'; (function f({x}) { let x = 0; })()", SyntaxError);
+ assertThrows("'use strict'; (function f(x) { const x = 0; })()", SyntaxError);
+ assertThrows("'use strict'; (function f({x}) { const x = 0; })()", SyntaxError);
assertThrows("'use strict'; let g = (x) => { let x = 0; }", SyntaxError);
assertThrows("'use strict'; let g = ({x}) => { let x = 0; }", SyntaxError);
diff --git a/deps/v8/test/mjsunit/es6/function-name.js b/deps/v8/test/mjsunit/es6/function-name.js
index 3b0a6fcacb..95bc2d4416 100644
--- a/deps/v8/test/mjsunit/es6/function-name.js
+++ b/deps/v8/test/mjsunit/es6/function-name.js
@@ -373,3 +373,52 @@
assertEquals('function () {}', obj.h.toString());
assertEquals('() => {}', obj.i.toString());
})();
+
+(function testClassNameOrder() {
+ assertEquals(['length', 'prototype'], Object.getOwnPropertyNames(class {}));
+
+ class A { }
+ assertEquals(['length', 'prototype', 'name'], Object.getOwnPropertyNames(A));
+
+ class B { static foo() { } }
+ assertEquals(['length', 'prototype', 'foo', 'name'], Object.getOwnPropertyNames(B));
+
+ class C { static name() { } static foo() { } }
+ assertEquals(['length', 'prototype', 'name', 'foo'], Object.getOwnPropertyNames(C));
+})();
+
+(function testStaticName() {
+ class C { static name() { return 42; } }
+ assertEquals(42, C.name());
+ assertEquals(undefined, new C().name);
+
+ class D { static get name() { return 17; } }
+ assertEquals(17, D.name);
+ assertEquals(undefined, new D().name);
+
+ var c = class { static name() { return 42; } }
+ assertEquals(42, c.name());
+ assertEquals(undefined, new c().name);
+
+ var d = class { static get name() { return 17; } }
+ assertEquals(17, d.name);
+ assertEquals(undefined, new d().name);
+})();
+
+(function testNonStaticName() {
+ class C { name() { return 42; } }
+ assertEquals('C', C.name);
+ assertEquals(42, new C().name());
+
+ class D { get name() { return 17; } }
+ assertEquals('D', D.name);
+ assertEquals(17, new D().name);
+
+ var c = class { name() { return 42; } }
+ assertEquals('c', c.name);
+ assertEquals(42, new c().name());
+
+ var d = class { get name() { return 17; } }
+ assertEquals('d', d.name);
+ assertEquals(17, new d().name);
+})();
diff --git a/deps/v8/test/mjsunit/es6/generator-destructuring.js b/deps/v8/test/mjsunit/es6/generator-destructuring.js
index 7228782c09..44730ac970 100644
--- a/deps/v8/test/mjsunit/es6/generator-destructuring.js
+++ b/deps/v8/test/mjsunit/es6/generator-destructuring.js
@@ -51,10 +51,11 @@
function* f21({x}) { { function x() { return 2 } } return x; }
assertEquals(1, f21({x: 1}).next().value);
- assertThrows("'use strict'; function* f(x) { let x = 0; }", SyntaxError);
- assertThrows("'use strict'; function* f({x}) { let x = 0; }", SyntaxError);
- assertThrows("'use strict'; function* f(x) { const x = 0; }", SyntaxError);
- assertThrows("'use strict'; function* f({x}) { const x = 0; }", SyntaxError);
+ // These errors are not recognized in lazy parsing; see mjsunit/bugs/bug-2728.js
+ assertThrows("'use strict'; (function* f(x) { let x = 0; })()", SyntaxError);
+ assertThrows("'use strict'; (function* f({x}) { let x = 0; })()", SyntaxError);
+ assertThrows("'use strict'; (function* f(x) { const x = 0; })()", SyntaxError);
+ assertThrows("'use strict'; (function* f({x}) { const x = 0; })()", SyntaxError);
}());
(function TestDefaults() {
diff --git a/deps/v8/test/mjsunit/es6/generators-debug-liveedit.js b/deps/v8/test/mjsunit/es6/generators-debug-liveedit.js
deleted file mode 100644
index 987a42c41c..0000000000
--- a/deps/v8/test/mjsunit/es6/generators-debug-liveedit.js
+++ /dev/null
@@ -1,119 +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: --expose-debug-as debug --allow-natives-syntax
-
-var Debug = debug.Debug;
-var LiveEdit = Debug.LiveEdit;
-
-unique_id = 0;
-
-var Generator = (function*(){}).constructor;
-
-function assertIteratorResult(value, done, result) {
- assertEquals({value: value, done: done}, result);
-}
-
-function MakeGenerator() {
- // Prevents eval script caching.
- unique_id++;
- return Generator('callback',
- "/* " + unique_id + "*/\n" +
- "yield callback();\n" +
- "return 'Cat';\n");
-}
-
-function MakeFunction() {
- // Prevents eval script caching.
- unique_id++;
- return Function('callback',
- "/* " + unique_id + "*/\n" +
- "callback();\n" +
- "return 'Cat';\n");
-}
-
-// First, try MakeGenerator with no perturbations.
-(function(){
- var generator = MakeGenerator();
- function callback() {};
- var iter = generator(callback);
- assertIteratorResult(undefined, false, iter.next());
- assertIteratorResult("Cat", true, iter.next());
-})();
-
-function patch(fun, from, to) {
- function debug() {
- var log = new Array();
- var script = Debug.findScript(fun);
- var pos = script.source.indexOf(from);
- try {
- LiveEdit.TestApi.ApplySingleChunkPatch(script, pos, from.length, to,
- log);
- } finally {
- print("Change log: " + JSON.stringify(log) + "\n");
- }
- }
- %ExecuteInDebugContext(debug);
-}
-
-// Try to edit a MakeGenerator while it's running, then again while it's
-// stopped.
-(function(){
- var generator = MakeGenerator();
-
- var gen_patch_attempted = false;
- function attempt_gen_patch() {
- assertFalse(gen_patch_attempted);
- gen_patch_attempted = true;
- assertThrows(function() { patch(generator, "'Cat'", "'Capybara'") },
- LiveEdit.Failure);
- };
- var iter = generator(attempt_gen_patch);
- assertIteratorResult(undefined, false, iter.next());
- // Patch should not succeed because there is a live generator activation on
- // the stack.
- assertIteratorResult("Cat", true, iter.next());
- assertTrue(gen_patch_attempted);
-
- // At this point one iterator is live, but closed, so the patch will succeed.
- patch(generator, "'Cat'", "'Capybara'");
- iter = generator(function(){});
- assertIteratorResult(undefined, false, iter.next());
- // Patch successful.
- assertIteratorResult("Capybara", true, iter.next());
-
- // Patching will fail however when a live iterator is suspended.
- iter = generator(function(){});
- assertIteratorResult(undefined, false, iter.next());
- assertThrows(function() { patch(generator, "'Capybara'", "'Tapir'") },
- LiveEdit.Failure);
- assertIteratorResult("Capybara", true, iter.next());
-
- // Try to patch functions with activations inside and outside generator
- // function activations. We should succeed in the former case, but not in the
- // latter.
- var fun_outside = MakeFunction();
- var fun_inside = MakeFunction();
- var fun_patch_attempted = false;
- var fun_patch_restarted = false;
- function attempt_fun_patches() {
- if (fun_patch_attempted) {
- assertFalse(fun_patch_restarted);
- fun_patch_restarted = true;
- return;
- }
- fun_patch_attempted = true;
- // Patching outside a generator activation must fail.
- assertThrows(function() { patch(fun_outside, "'Cat'", "'Cobra'") },
- LiveEdit.Failure);
- // Patching inside a generator activation may succeed.
- patch(fun_inside, "'Cat'", "'Koala'");
- }
- iter = generator(function() { return fun_inside(attempt_fun_patches) });
- assertEquals('Cat',
- fun_outside(function () {
- assertIteratorResult('Koala', false, iter.next());
- assertTrue(fun_patch_restarted);
- }));
-})();
diff --git a/deps/v8/test/mjsunit/es6/generators-debug-scopes.js b/deps/v8/test/mjsunit/es6/generators-debug-scopes.js
deleted file mode 100644
index 126572d16f..0000000000
--- a/deps/v8/test/mjsunit/es6/generators-debug-scopes.js
+++ /dev/null
@@ -1,339 +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: --expose-debug-as debug
-
-var Debug = debug.Debug;
-
-function RunTest(name, formals_and_body, args, handler, continuation) {
- var handler_called = false;
- var exception = null;
-
- function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Break) {
- handler_called = true;
- handler(exec_state);
- }
- } catch (e) {
- exception = e;
- }
- }
-
- function run(thunk) {
- handler_called = false;
- exception = null;
-
- var res = thunk();
- if (continuation)
- continuation(res);
-
- assertTrue(handler_called, "listener not called for " + name);
- assertNull(exception, name + " / " + exception);
- }
-
- var fun = Function.apply(null, formals_and_body);
- var gen = (function*(){}).constructor.apply(null, formals_and_body);
-
- Debug.setListener(listener);
-
- run(function () { return fun.apply(null, args) });
- run(function () { return gen.apply(null, args).next().value });
-
- // TODO(wingo): Uncomment after bug 2838 is fixed.
- // Debug.setListener(null);
-}
-
-// Check that two scope are the same.
-function assertScopeMirrorEquals(scope1, scope2) {
- assertEquals(scope1.scopeType(), scope2.scopeType());
- assertEquals(scope1.frameIndex(), scope2.frameIndex());
- assertEquals(scope1.scopeIndex(), scope2.scopeIndex());
- assertPropertiesEqual(scope1.scopeObject().value(), scope2.scopeObject().value());
-}
-
-function CheckFastAllScopes(scopes, exec_state) {
- var fast_all_scopes = exec_state.frame().allScopes(true);
- var length = fast_all_scopes.length;
- assertTrue(scopes.length >= length);
- for (var i = 0; i < scopes.length && i < length; i++) {
- var scope = fast_all_scopes[length - i - 1];
- assertTrue(scope.isScope());
- assertEquals(scopes[scopes.length - i - 1], scope.scopeType());
- }
-}
-
-// Check that the scope chain contains the expected types of scopes.
-function CheckScopeChain(scopes, exec_state) {
- var all_scopes = exec_state.frame().allScopes();
- assertEquals(scopes.length, exec_state.frame().scopeCount());
- assertEquals(scopes.length, all_scopes.length, "FrameMirror.allScopes length");
- for (var i = 0; i < scopes.length; i++) {
- var scope = exec_state.frame().scope(i);
- assertTrue(scope.isScope());
- assertEquals(scopes[i], scope.scopeType());
- assertScopeMirrorEquals(all_scopes[i], scope);
-
- // Check the global object when hitting the global scope.
- if (scopes[i] == debug.ScopeType.Global) {
- // Objects don't have same class (one is "global", other is "Object",
- // so just check the properties directly.
- assertPropertiesEqual(this, scope.scopeObject().value());
- }
- }
- CheckFastAllScopes(scopes, exec_state);
-
- // Get the debug command processor.
- var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
-
- // Send a scopes request and check the result.
- var json;
- var request_json = '{"seq":0,"type":"request","command":"scopes"}';
- var response_json = dcp.processDebugJSONRequest(request_json);
- var response = JSON.parse(response_json);
- assertEquals(scopes.length, response.body.scopes.length);
- for (var i = 0; i < scopes.length; i++) {
- assertEquals(i, response.body.scopes[i].index);
- assertEquals(scopes[i], response.body.scopes[i].type);
- if (scopes[i] == debug.ScopeType.Local ||
- scopes[i] == debug.ScopeType.Script ||
- scopes[i] == debug.ScopeType.Closure) {
- assertTrue(response.body.scopes[i].object.ref < 0);
- } else {
- assertTrue(response.body.scopes[i].object.ref >= 0);
- }
- var found = false;
- for (var j = 0; j < response.refs.length && !found; j++) {
- found = response.refs[j].handle == response.body.scopes[i].object.ref;
- }
- assertTrue(found, "Scope object " + response.body.scopes[i].object.ref + " not found");
- }
-}
-
-// Check that the content of the scope is as expected. For functions just check
-// that there is a function.
-function CheckScopeContent(content, number, exec_state) {
- var scope = exec_state.frame().scope(number);
- var count = 0;
- for (var p in content) {
- var property_mirror = scope.scopeObject().property(p);
- assertFalse(property_mirror.isUndefined(), 'property ' + p + ' not found in scope');
- if (typeof(content[p]) === 'function') {
- assertTrue(property_mirror.value().isFunction());
- } else {
- assertEquals(content[p], property_mirror.value().value(), 'property ' + p + ' has unexpected value');
- }
- count++;
- }
-
- // 'arguments' and might be exposed in the local and closure scope. Just
- // ignore this.
- var scope_size = scope.scopeObject().properties().length;
- if (!scope.scopeObject().property('arguments').isUndefined()) {
- scope_size--;
- }
- // Skip property with empty name.
- if (!scope.scopeObject().property('').isUndefined()) {
- scope_size--;
- }
-
- if (count != scope_size) {
- print('Names found in scope:');
- var names = scope.scopeObject().propertyNames();
- for (var i = 0; i < names.length; i++) {
- print(names[i]);
- }
- }
- assertEquals(count, scope_size);
-
- // Get the debug command processor.
- var dcp = exec_state.debugCommandProcessor("unspecified_running_state");
-
- // Send a scope request for information on a single scope and check the
- // result.
- var request_json = '{"seq":0,"type":"request","command":"scope","arguments":{"number":';
- request_json += scope.scopeIndex();
- request_json += '}}';
- var response_json = dcp.processDebugJSONRequest(request_json);
- var response = JSON.parse(response_json);
- assertEquals(scope.scopeType(), response.body.type);
- assertEquals(number, response.body.index);
- if (scope.scopeType() == debug.ScopeType.Local ||
- scope.scopeType() == debug.ScopeType.Script ||
- scope.scopeType() == debug.ScopeType.Closure) {
- assertTrue(response.body.object.ref < 0);
- } else {
- assertTrue(response.body.object.ref >= 0);
- }
- var found = false;
- for (var i = 0; i < response.refs.length && !found; i++) {
- found = response.refs[i].handle == response.body.object.ref;
- }
- assertTrue(found, "Scope object " + response.body.object.ref + " not found");
-}
-
-
-// Simple empty local scope.
-RunTest("Local 1",
- ['debugger;'],
- [],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
- });
-
-// Local scope with a parameter.
-RunTest("Local 2",
- ['a', 'debugger;'],
- [1],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1}, 0, exec_state);
- });
-
-// Local scope with a parameter and a local variable.
-RunTest("Local 3",
- ['a', 'var x = 3; debugger;'],
- [1],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1,x:3}, 0, exec_state);
- });
-
-// Local scope with parameters and local variables.
-RunTest("Local 4",
- ['a', 'b', 'var x = 3; var y = 4; debugger;'],
- [1, 2],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1,b:2,x:3,y:4}, 0, exec_state);
- });
-
-// Empty local scope with use of eval.
-RunTest("Local 5",
- ['eval(""); debugger;'],
- [],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
- });
-
-// Local introducing local variable using eval.
-RunTest("Local 6",
- ['eval("var i = 5"); debugger;'],
- [],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({i:5}, 0, exec_state);
- });
-
-// Local scope with parameters, local variables and local variable introduced
-// using eval.
-RunTest("Local 7",
- ['a', 'b',
- "var x = 3; var y = 4;\n"
- + "eval('var i = 5'); eval ('var j = 6');\n"
- + "debugger;"],
- [1, 2],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6}, 0, exec_state);
- });
-
-// Nested empty with blocks.
-RunTest("With",
- ["with ({}) { with ({}) { debugger; } }"],
- [],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.With,
- debug.ScopeType.With,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({}, 0, exec_state);
- CheckScopeContent({}, 1, exec_state);
- });
-
-// Simple closure formed by returning an inner function referering the outer
-// functions arguments.
-RunTest("Closure 1",
- ['a', 'return function() { debugger; return a; }'],
- [1],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Local,
- debug.ScopeType.Closure,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({a:1}, 1, exec_state);
- },
- function (result) { result() });
-
-RunTest("The full monty",
- ['a', 'b',
- "var x = 3;\n" +
- "var y = 4;\n" +
- "eval('var i = 5');\n" +
- "eval('var j = 6');\n" +
- "function f(a, b) {\n" +
- " var x = 9;\n" +
- " var y = 10;\n" +
- " eval('var i = 11');\n" +
- " eval('var j = 12');\n" +
- " with ({j:13}){\n" +
- " return function() {\n" +
- " var x = 14;\n" +
- " with ({a:15}) {\n" +
- " with ({b:16}) {\n" +
- " debugger;\n" +
- " some_global = a;\n" +
- " return f;\n" +
- " }\n" +
- " }\n" +
- " };\n" +
- " }\n" +
- "}\n" +
- "return f(a, b);"],
- [1, 2],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.With,
- debug.ScopeType.With,
- debug.ScopeType.Local,
- debug.ScopeType.With,
- debug.ScopeType.Closure,
- debug.ScopeType.Closure,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({b:16}, 0, exec_state);
- CheckScopeContent({a:15}, 1, exec_state);
- CheckScopeContent({x:14}, 2, exec_state);
- CheckScopeContent({j:13}, 3, exec_state);
- CheckScopeContent({a:1,b:2,x:9,y:10,i:11,j:12}, 4, exec_state);
- CheckScopeContent({a:1,b:2,x:3,y:4,i:5,j:6,f:function(){}}, 5, exec_state);
- },
- function (result) { result() });
-
-RunTest("Catch block 1",
- ["try { throw 'Exception'; } catch (e) { debugger; }"],
- [],
- function (exec_state) {
- CheckScopeChain([debug.ScopeType.Catch,
- debug.ScopeType.Local,
- debug.ScopeType.Script,
- debug.ScopeType.Global], exec_state);
- CheckScopeContent({e:'Exception'}, 0, exec_state);
- });
diff --git a/deps/v8/test/mjsunit/es6/generators-mirror.js b/deps/v8/test/mjsunit/es6/generators-mirror.js
deleted file mode 100644
index bf21f4dff5..0000000000
--- a/deps/v8/test/mjsunit/es6/generators-mirror.js
+++ /dev/null
@@ -1,112 +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: --expose-debug-as debug
-// Test the mirror object for functions.
-
-function *generator(f) {
- "use strict";
- yield;
- f();
- yield;
-}
-
-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 TestGeneratorMirror(g, status, line, column, receiver) {
- // Create mirror and JSON representation.
- var mirror = debug.MakeMirror(g);
- var serializer = debug.MakeMirrorSerializer();
- var json = JSON.stringify(serializer.serializeValue(mirror));
- var refs = new MirrorRefCache(
- JSON.stringify(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.GeneratorMirror);
-
- // Check the mirror properties.
- assertTrue(mirror.isGenerator());
- assertEquals('generator', mirror.type());
- assertFalse(mirror.isPrimitive());
- assertEquals('Generator', mirror.className());
-
- assertEquals(receiver, mirror.receiver().value());
- assertEquals(generator, mirror.func().value());
-
- assertEquals(status, mirror.status());
-
- // Note that line numbers are 0-based, not 1-based.
- var loc = mirror.sourceLocation();
- if (status === 'suspended') {
- assertTrue(!!loc);
- assertEquals(line, loc.line);
- assertEquals(column, loc.column);
- } else {
- assertEquals(undefined, loc);
- }
-
- TestInternalProperties(mirror, status, receiver);
-}
-
-function TestInternalProperties(mirror, status, receiver) {
- var properties = mirror.internalProperties();
- assertEquals(3, properties.length);
- assertEquals("[[GeneratorStatus]]", properties[0].name());
- assertEquals(status, properties[0].value().value());
- assertEquals("[[GeneratorFunction]]", properties[1].name());
- assertEquals(generator, properties[1].value().value());
- assertEquals("[[GeneratorReceiver]]", properties[2].name());
- assertEquals(receiver, properties[2].value().value());
-}
-
-var iter = generator(function() {
- var mirror = debug.MakeMirror(iter);
- assertEquals('running', mirror.status());
- assertEquals(undefined, mirror.sourceLocation());
- TestInternalProperties(mirror, 'running');
-});
-
-TestGeneratorMirror(iter, 'suspended', 7, 19);
-
-iter.next();
-TestGeneratorMirror(iter, 'suspended', 9, 2);
-
-iter.next();
-TestGeneratorMirror(iter, 'suspended', 11, 2);
-
-iter.next();
-TestGeneratorMirror(iter, 'closed');
-
-// Test generator with receiver.
-var obj = {foo: 42};
-var iter2 = generator.call(obj, function() {
- var mirror = debug.MakeMirror(iter2);
- assertEquals('running', mirror.status());
- assertEquals(undefined, mirror.sourceLocation());
- TestInternalProperties(mirror, 'running', obj);
-});
-
-TestGeneratorMirror(iter2, 'suspended', 7, 19, obj);
-
-iter2.next();
-TestGeneratorMirror(iter2, 'suspended', 9, 2, obj);
-
-iter2.next();
-TestGeneratorMirror(iter2, 'suspended', 11, 2, obj);
-
-iter2.next();
-TestGeneratorMirror(iter2, 'closed', 0, 0, obj);
diff --git a/deps/v8/test/mjsunit/es6/mirror-collections.js b/deps/v8/test/mjsunit/es6/mirror-collections.js
deleted file mode 100644
index 4232ef91cb..0000000000
--- a/deps/v8/test/mjsunit/es6/mirror-collections.js
+++ /dev/null
@@ -1,165 +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: --expose-debug-as debug --expose-gc
-
-function testMapMirror(mirror) {
- // Create JSON representation.
- var serializer = debug.MakeMirrorSerializer();
- var json = JSON.stringify(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.MapMirror);
-
- assertTrue(mirror.isMap());
-
- // Parse JSON representation and check.
- var fromJSON = eval('(' + json + ')');
- assertEquals('map', fromJSON.type);
-}
-
-function testSetMirror(mirror) {
- // Create JSON representation.
- var serializer = debug.MakeMirrorSerializer();
- var json = JSON.stringify(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.SetMirror);
-
- assertTrue(mirror.isSet());
-
- // Parse JSON representation and check.
- var fromJSON = eval('(' + json + ')');
- assertEquals('set', fromJSON.type);
-}
-
-var o1 = new Object();
-var o2 = new Object();
-var o3 = new Object();
-
-// Test the mirror object for Maps
-var map = new Map();
-map.set(o1, 11);
-map.set(o2, 22);
-map.delete(o1);
-var mapMirror = debug.MakeMirror(map);
-testMapMirror(mapMirror);
-
-var entries = mapMirror.entries();
-assertEquals(1, entries.length);
-assertSame(o2, entries[0].key);
-assertEquals(22, entries[0].value);
-map.set(o1, 33);
-map.set(o3, o2);
-map.delete(o2);
-map.set(undefined, 44);
-
-entries = mapMirror.entries();
-assertEquals(3, entries.length);
-assertSame(o1, entries[0].key);
-assertEquals(33, entries[0].value);
-assertSame(o3, entries[1].key);
-assertSame(o2, entries[1].value);
-assertEquals(undefined, entries[2].key);
-assertEquals(44, entries[2].value);
-
-assertEquals(3, mapMirror.entries(0).length);
-assertEquals(1, mapMirror.entries(1).length);
-assertEquals(2, mapMirror.entries(2).length);
-
-// Test the mirror object for Sets
-var set = new Set();
-set.add(o1);
-set.add(o2);
-set.delete(o1);
-set.add(undefined);
-var setMirror = debug.MakeMirror(set);
-testSetMirror(setMirror);
-var values = setMirror.values();
-assertEquals(2, values.length);
-assertEquals(1, setMirror.values(1).length);
-assertSame(o2, values[0]);
-assertEquals(undefined, values[1]);
-
-function initWeakMap(weakMap) {
- weakMap.set(o1, 11);
- weakMap.set(new Object(), 22);
- weakMap.set(o3, 33);
- weakMap.set(new Object(), 44);
- var weakMapMirror = debug.MakeMirror(weakMap);
- testMapMirror(weakMapMirror);
- weakMap.set(new Object(), 55);
- assertTrue(weakMapMirror.entries().length <= 5);
- return weakMapMirror;
-}
-
-// Test the mirror object for WeakMaps
-var weakMap = new WeakMap();
-var weakMapMirror = initWeakMap(weakMap);
-gc();
-
-function testWeakMapEntries(weakMapMirror) {
- var entries = weakMapMirror.entries();
- assertEquals(2, entries.length);
- assertEquals(2, weakMapMirror.entries(0).length);
- assertEquals(1, weakMapMirror.entries(1).length);
- var found = 0;
- for (var i = 0; i < entries.length; i++) {
- if (Object.is(entries[i].key, o1)) {
- assertEquals(11, entries[i].value);
- found++;
- }
- if (Object.is(entries[i].key, o3)) {
- assertEquals(33, entries[i].value);
- found++;
- }
- }
- assertEquals(2, found);
-}
-
-testWeakMapEntries(weakMapMirror);
-
-function initWeakSet(weakSet) {
- weakSet.add(o1);
- weakSet.add(new Object());
- weakSet.add(o2);
- weakSet.add(new Object());
- weakSet.add(new Object());
- weakSet.add(o3);
- weakSet.delete(o2);
- var weakSetMirror = debug.MakeMirror(weakSet);
- testSetMirror(weakSetMirror);
- assertTrue(weakSetMirror.values().length <= 5);
- return weakSetMirror;
-}
-
-// Test the mirror object for WeakSets
-var weakSet = new WeakSet();
-var weakSetMirror = initWeakSet(weakSet);
-gc();
-
-function testWeakSetValues(weakSetMirror) {
- var values = weakSetMirror.values();
- assertEquals(2, values.length);
- assertEquals(2, weakSetMirror.values(0).length);
- assertEquals(1, weakSetMirror.values(1).length);
- var found = 0;
- for (var i = 0; i < values.length; i++) {
- if (Object.is(values[i], o1)) {
- found++;
- }
- if (Object.is(values[i], o3)) {
- found++;
- }
- }
- assertEquals(2, found);
-}
-
-testWeakSetValues(weakSetMirror);
diff --git a/deps/v8/test/mjsunit/es6/mirror-iterators.js b/deps/v8/test/mjsunit/es6/mirror-iterators.js
deleted file mode 100644
index 22ce42493f..0000000000
--- a/deps/v8/test/mjsunit/es6/mirror-iterators.js
+++ /dev/null
@@ -1,103 +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: --expose-debug-as debug
-// Test the mirror object for collection iterators.
-
-function testIteratorMirror(iter, offset, expected, opt_limit) {
- while (offset-- > 0) iter.next();
-
- var mirror = debug.MakeMirror(iter);
- assertTrue(mirror.isIterator());
-
- var preview = mirror.preview(opt_limit);
- assertArrayEquals(expected, preview);
-
- // Check that iterator has not changed after taking preview.
- var values = [];
- for (var i of iter) {
- if (opt_limit && values.length >= opt_limit) break;
- values.push(i);
- }
- assertArrayEquals(expected, values);
-}
-
-function testIteratorInternalProperties(iter, offset, kind, index, has_more) {
- while (offset-- > 0) iter.next();
-
- var mirror = debug.MakeMirror(iter);
- assertTrue(mirror.isIterator());
-
- var properties = mirror.internalProperties();
- assertEquals(3, properties.length);
- assertEquals("[[IteratorHasMore]]", properties[0].name());
- assertEquals(has_more, properties[0].value().value());
- assertEquals("[[IteratorIndex]]", properties[1].name());
- assertEquals(index, properties[1].value().value());
- assertEquals("[[IteratorKind]]", properties[2].name());
- assertEquals(kind, properties[2].value().value());
-}
-
-var o1 = { foo: 1 };
-var o2 = { foo: 2 };
-
-var map = new Map();
-map.set(41, 42);
-map.set(o1, o2);
-
-testIteratorMirror(map.keys(), 0, [41, o1]);
-testIteratorMirror(map.values(), 0, [42, o2]);
-testIteratorMirror(map.entries(), 0, [[41, 42], [o1, o2]]);
-
-testIteratorMirror(map.keys(), 1, [o1]);
-testIteratorMirror(map.values(), 1, [o2]);
-testIteratorMirror(map.entries(), 1, [[o1, o2]]);
-
-testIteratorMirror(map.keys(), 2, []);
-testIteratorMirror(map.values(), 2, []);
-testIteratorMirror(map.entries(), 2, []);
-
-// Test with maximum limit.
-testIteratorMirror(map.keys(), 0, [41], 1);
-testIteratorMirror(map.values(), 0, [42], 1);
-testIteratorMirror(map.entries(), 0, [[41, 42]], 1);
-
-testIteratorInternalProperties(map.keys(), 0, "keys", 0, true);
-testIteratorInternalProperties(map.values(), 1, "values", 1, true);
-testIteratorInternalProperties(map.entries(), 2, "entries", 2, false);
-testIteratorInternalProperties(map.keys(), 3, "keys", 2, false);
-
-var set = new Set();
-set.add(41);
-set.add(42);
-set.add(o1);
-set.add(o2);
-
-testIteratorMirror(set.keys(), 0, [41, 42, o1, o2]);
-testIteratorMirror(set.values(), 0, [41, 42, o1, o2]);
-testIteratorMirror(set.entries(), 0, [[41, 41], [42, 42], [o1, o1], [o2, o2]]);
-
-testIteratorMirror(set.keys(), 1, [42, o1, o2]);
-testIteratorMirror(set.values(), 1, [42, o1, o2]);
-testIteratorMirror(set.entries(), 1, [[42, 42], [o1, o1], [o2, o2]]);
-
-testIteratorMirror(set.keys(), 3, [o2]);
-testIteratorMirror(set.values(), 3, [o2]);
-testIteratorMirror(set.entries(), 3, [[o2, o2]]);
-
-testIteratorMirror(set.keys(), 5, []);
-testIteratorMirror(set.values(), 5, []);
-testIteratorMirror(set.entries(), 5, []);
-
-// Test with maximum limit.
-testIteratorMirror(set.keys(), 1, [42, o1], 2);
-testIteratorMirror(set.values(), 1, [42, o1], 2);
-testIteratorMirror(set.entries(), 1, [[42, 42], [o1, o1]], 2);
-
-testIteratorInternalProperties(set.keys(), 0, "values", 0, true);
-testIteratorInternalProperties(set.values(), 1, "values", 1, true);
-testIteratorInternalProperties(set.entries(), 2, "entries", 2, true);
-testIteratorInternalProperties(set.keys(), 3, "values", 3, true);
-testIteratorInternalProperties(set.values(), 4, "values", 4, false);
-testIteratorInternalProperties(set.entries(), 5, "entries", 4, false);
diff --git a/deps/v8/test/mjsunit/es6/mirror-promises.js b/deps/v8/test/mjsunit/es6/mirror-promises.js
deleted file mode 100644
index deeba8f549..0000000000
--- a/deps/v8/test/mjsunit/es6/mirror-promises.js
+++ /dev/null
@@ -1,90 +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: --expose-debug-as debug
-// Test the mirror object for promises.
-
-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 testPromiseMirror(promise, status, value) {
- // Create mirror and JSON representation.
- var mirror = debug.MakeMirror(promise);
- var serializer = debug.MakeMirrorSerializer();
- var json = JSON.stringify(serializer.serializeValue(mirror));
- var refs = new MirrorRefCache(
- JSON.stringify(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.PromiseMirror);
-
- // Check the mirror properties.
- assertEquals(status, mirror.status());
- assertTrue(mirror.isPromise());
- assertEquals('promise', mirror.type());
- assertFalse(mirror.isPrimitive());
- assertEquals("Object", mirror.className());
- assertEquals("#<Promise>", mirror.toText());
- assertSame(promise, mirror.value());
- assertTrue(mirror.promiseValue() instanceof debug.Mirror);
- assertEquals(value, mirror.promiseValue().value());
-
- // Parse JSON representation and check.
- var fromJSON = eval('(' + json + ')');
- assertEquals('promise', fromJSON.type);
- assertEquals('Object', fromJSON.className);
- assertEquals('function', refs.lookup(fromJSON.constructorFunction.ref).type);
- assertEquals('Promise', refs.lookup(fromJSON.constructorFunction.ref).name);
- assertEquals(status, fromJSON.status);
- assertEquals(value, refs.lookup(fromJSON.promiseValue.ref).value);
-}
-
-// Test a number of different promises.
-var resolved = new Promise(function(resolve, reject) { resolve() });
-var rejected = new Promise(function(resolve, reject) { reject() });
-var pending = new Promise(function(resolve, reject) {});
-
-testPromiseMirror(resolved, "resolved", undefined);
-testPromiseMirror(rejected, "rejected", undefined);
-testPromiseMirror(pending, "pending", undefined);
-
-var resolvedv = new Promise(function(resolve, reject) { resolve('resolve') });
-var rejectedv = new Promise(function(resolve, reject) { reject('reject') });
-var thrownv = new Promise(function(resolve, reject) { throw 'throw' });
-
-testPromiseMirror(resolvedv, "resolved", 'resolve');
-testPromiseMirror(rejectedv, "rejected", 'reject');
-testPromiseMirror(thrownv, "rejected", 'throw');
-
-// Test internal properties of different promises.
-var m1 = debug.MakeMirror(new Promise(
- function(resolve, reject) { resolve(1) }));
-var ip = m1.internalProperties();
-assertEquals(2, ip.length);
-assertEquals("[[PromiseStatus]]", ip[0].name());
-assertEquals("[[PromiseValue]]", ip[1].name());
-assertEquals("resolved", ip[0].value().value());
-assertEquals(1, ip[1].value().value());
-
-var m2 = debug.MakeMirror(new Promise(function(resolve, reject) { reject(2) }));
-ip = m2.internalProperties();
-assertEquals("rejected", ip[0].value().value());
-assertEquals(2, ip[1].value().value());
-
-var m3 = debug.MakeMirror(new Promise(function(resolve, reject) { }));
-ip = m3.internalProperties();
-assertEquals("pending", ip[0].value().value());
-assertEquals("undefined", typeof(ip[1].value().value()));
diff --git a/deps/v8/test/mjsunit/es6/mirror-symbols.js b/deps/v8/test/mjsunit/es6/mirror-symbols.js
deleted file mode 100644
index f218332abf..0000000000
--- a/deps/v8/test/mjsunit/es6/mirror-symbols.js
+++ /dev/null
@@ -1,38 +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: --expose-debug-as debug
-// Test the mirror object for symbols.
-
-function testSymbolMirror(symbol, description) {
- // Create mirror and JSON representation.
- var mirror = debug.MakeMirror(symbol);
- var serializer = debug.MakeMirrorSerializer();
- var json = JSON.stringify(serializer.serializeValue(mirror));
-
- // Check the mirror hierachy.
- assertTrue(mirror instanceof debug.Mirror);
- assertTrue(mirror instanceof debug.ValueMirror);
- assertTrue(mirror instanceof debug.SymbolMirror);
-
- // Check the mirror properties.
- assertTrue(mirror.isSymbol());
- assertEquals(description, mirror.description());
- assertEquals('symbol', mirror.type());
- assertTrue(mirror.isPrimitive());
- var description_text = description === undefined ? "" : description;
- assertEquals('Symbol(' + description_text + ')', mirror.toText());
- assertSame(symbol, mirror.value());
-
- // Parse JSON representation and check.
- var fromJSON = eval('(' + json + ')');
- assertEquals('symbol', fromJSON.type);
- assertEquals(description, fromJSON.description);
-}
-
-// Test a number of different symbols.
-testSymbolMirror(Symbol("a"), "a");
-testSymbolMirror(Symbol(12), "12");
-testSymbolMirror(Symbol.for("b"), "b");
-testSymbolMirror(Symbol(), undefined);
diff --git a/deps/v8/test/mjsunit/es6/promise-lookup-getter-setter.js b/deps/v8/test/mjsunit/es6/promise-lookup-getter-setter.js
new file mode 100644
index 0000000000..c08bfa762b
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/promise-lookup-getter-setter.js
@@ -0,0 +1,76 @@
+// 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.
+
+let get = () => {};
+let set = () => {};
+let target = {};
+let handler = {
+ getOwnPropertyDescriptor(target, prop) {
+ let configurable = true;
+ if (prop == "both") {
+ return { get, set, configurable };
+ } else if (prop == "get") {
+ return { get, configurable };
+ } else if (prop == "set") {
+ return { set, configurable };
+ } else if (prop == "data") {
+ return { value: 42, configurable };
+ } else {
+ return Reflect.getOwnPropertyDescriptor(target, prop);
+ }
+ }
+};
+
+// Test behavior on own properties.
+let proxy = new Proxy(target, handler);
+assertSame(get, proxy.__lookupGetter__("both"));
+assertSame(get, proxy.__lookupGetter__("get"));
+assertSame(undefined, proxy.__lookupGetter__("set"));
+assertSame(undefined, proxy.__lookupGetter__("data"));
+assertSame(set, proxy.__lookupSetter__("both"));
+assertSame(undefined, proxy.__lookupSetter__("get"));
+assertSame(set, proxy.__lookupSetter__("set"));
+assertSame(undefined, proxy.__lookupSetter__("data"));
+
+// Test behavior on the prototype chain.
+let object = { __proto__: proxy };
+assertSame(get, object.__lookupGetter__("both"));
+assertSame(get, object.__lookupGetter__("get"));
+assertSame(undefined, object.__lookupGetter__("set"));
+assertSame(undefined, object.__lookupGetter__("data"));
+assertSame(set, object.__lookupSetter__("both"));
+assertSame(undefined, object.__lookupSetter__("get"));
+assertSame(set, object.__lookupSetter__("set"));
+assertSame(undefined, object.__lookupSetter__("data"));
+
+// Test being shadowed while on prototype chain.
+let shadower = { __proto__: proxy, both: 1, get: 2, set: 3, data: 4 };
+assertSame(undefined, shadower.__lookupGetter__("both"));
+assertSame(undefined, shadower.__lookupGetter__("get"));
+assertSame(undefined, shadower.__lookupGetter__("set"));
+assertSame(undefined, shadower.__lookupGetter__("data"));
+assertSame(undefined, shadower.__lookupSetter__("both"));
+assertSame(undefined, shadower.__lookupSetter__("get"));
+assertSame(undefined, shadower.__lookupSetter__("set"));
+assertSame(undefined, shadower.__lookupSetter__("data"));
+
+// Test getPrototypeOf trap.
+let getFoo = () => {};
+let setFoo = () => {};
+let proto = {};
+Reflect.defineProperty(proto, "foo", { get: getFoo, set: setFoo });
+Reflect.setPrototypeOf(target, proto);
+assertSame(getFoo, proxy.__lookupGetter__("foo"));
+assertSame(setFoo, proxy.__lookupSetter__("foo"));
+handler.getPrototypeOf = () => null;
+assertSame(undefined, proxy.__lookupGetter__("foo"));
+assertSame(undefined, proxy.__lookupSetter__("foo"));
+handler.getPrototypeOf = () => proto;
+assertSame(getFoo, proxy.__lookupGetter__("foo"));
+assertSame(setFoo, proxy.__lookupSetter__("foo"));
+
+// Test shadowing the prototype.
+Reflect.defineProperty(proto, "data", { get: getFoo, set: setFoo });
+assertSame(undefined, proxy.__lookupGetter__("data"));
+assertSame(undefined, proxy.__lookupSetter__("data"));
diff --git a/deps/v8/test/mjsunit/es6/regexp-sticky.js b/deps/v8/test/mjsunit/es6/regexp-sticky.js
index c0633f9173..df39763694 100644
--- a/deps/v8/test/mjsunit/es6/regexp-sticky.js
+++ b/deps/v8/test/mjsunit/es6/regexp-sticky.js
@@ -128,3 +128,10 @@ mhat.lastIndex = 2;
assertFalse(mhat.test("..foo"));
mhat.lastIndex = 2;
assertTrue(mhat.test(".\nfoo"));
+
+// Check that we don't apply incorrect optimization to sticky regexps that
+// are anchored at end.
+var stickyanchored = /bar$/y;
+assertFalse(stickyanchored.test("foobar"));
+stickyanchored.lastIndex = 3;
+assertTrue(stickyanchored.test("foobar"));
diff --git a/deps/v8/test/mjsunit/es6/regress/regress-4400.js b/deps/v8/test/mjsunit/es6/regress/regress-4400.js
index 98ad269bfb..ab33148bb6 100644
--- a/deps/v8/test/mjsunit/es6/regress/regress-4400.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-4400.js
@@ -2,7 +2,5 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --min-preparse-length=0
-
function borked(a = [], b = {}, c) {}
borked();
diff --git a/deps/v8/test/mjsunit/es6/regress/regress-468661.js b/deps/v8/test/mjsunit/es6/regress/regress-468661.js
deleted file mode 100644
index db71352f74..0000000000
--- a/deps/v8/test/mjsunit/es6/regress/regress-468661.js
+++ /dev/null
@@ -1,71 +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: --expose-debug-as debug
-
-Debug = debug.Debug
-var exception = null;
-var break_count = 0;
-const expected_breaks = 9;
-
-var expected_values =
- [ReferenceError, undefined, 0, 0, 0, 0, 1,
- ReferenceError, ReferenceError];
-
-function listener(event, exec_state, event_data, data) {
- try {
- if (event == Debug.DebugEvent.Break) {
- assertTrue(exec_state.frameCount() != 0, "FAIL: Empty stack trace");
- var frameMirror = exec_state.frame(0);
-
- var v = null;;
- try {
- v = frameMirror.evaluate('i').value();
- } catch(e) {
- v = e;
- }
- frameMirror.allScopes();
- var source = frameMirror.sourceLineText();
- print("paused at: " + source);
- assertTrue(source.indexOf("// Break " + break_count + ".") > 0,
- "Unexpected pause at: " + source + "\n" +
- "Expected: // Break " + break_count + ".");
- if (expected_values[break_count] === ReferenceError) {
- assertTrue(v instanceof ReferenceError);
- } else {
- assertSame(expected_values[break_count], v);
- }
- ++break_count;
-
- if (break_count !== expected_breaks) {
- exec_state.prepareStep(Debug.StepAction.StepIn);
- print("Next step prepared");
- }
- }
- } catch(e) {
- exception = e;
- print(e, e.stack);
- }
-};
-
-Debug.setListener(listener);
-
-var sum = 0;
-(function (){
- 'use strict';
-
- debugger; // Break 0.
-
- for (let i=0; // Break 1.
- i < 1; // Break 2. // Break 6.
- i++) { // Break 5.
- let key = i; // Break 3.
- sum += key; // Break 4.
- }
-}()); // Break 7.
-
-assertNull(exception); // Break 8.
-assertEquals(expected_breaks, break_count);
-
-Debug.setListener(null);
diff --git a/deps/v8/test/mjsunit/es6/regress/regress-594084.js b/deps/v8/test/mjsunit/es6/regress/regress-594084.js
index 4953cc9bb6..2a427eb3d3 100644
--- a/deps/v8/test/mjsunit/es6/regress/regress-594084.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-594084.js
@@ -2,7 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// Flags: --lazy --min-preparse-length=0
(function() {
function CRASH(defaultParameter =
(function() { function functionDeclaration() { return 0; } }())) {
diff --git a/deps/v8/test/mjsunit/es6/string-startswith.js b/deps/v8/test/mjsunit/es6/string-startswith.js
index 449d07a56d..9f4f5838c0 100644
--- a/deps/v8/test/mjsunit/es6/string-startswith.js
+++ b/deps/v8/test/mjsunit/es6/string-startswith.js
@@ -24,6 +24,7 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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("abc".startsWith("a", Infinity));
assertEquals(1, String.prototype.startsWith.length);
diff --git a/deps/v8/test/mjsunit/es6/typedarray-neutered.js b/deps/v8/test/mjsunit/es6/typedarray-neutered.js
new file mode 100644
index 0000000000..f272f4f084
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/typedarray-neutered.js
@@ -0,0 +1,781 @@
+// 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: --allow-natives-syntax
+
+// Disable the neutering protector.
+%ArrayBufferNeuter(new ArrayBuffer(1024));
+
+// ArrayBuffer
+
+function TestByteLength(param, expectedByteLength) {
+ var ab = new ArrayBuffer(param);
+ assertSame(expectedByteLength, ab.byteLength);
+}
+
+function TestArrayBufferCreation() {
+ TestByteLength(1, 1);
+ TestByteLength(256, 256);
+ TestByteLength(2.567, 2);
+
+ TestByteLength("abc", 0);
+
+ TestByteLength(0, 0);
+
+ assertThrows(function() { new ArrayBuffer(-10); }, RangeError);
+ assertThrows(function() { new ArrayBuffer(-2.567); }, RangeError);
+
+/* TODO[dslomov]: Reenable the test
+ assertThrows(function() {
+ var ab1 = new ArrayBuffer(0xFFFFFFFFFFFF)
+ }, RangeError);
+*/
+
+ var ab = new ArrayBuffer();
+ assertSame(0, ab.byteLength);
+ assertEquals("[object ArrayBuffer]",
+ Object.prototype.toString.call(ab));
+}
+
+TestArrayBufferCreation();
+
+function TestByteLengthNotWritable() {
+ var ab = new ArrayBuffer(1024);
+ assertSame(1024, ab.byteLength);
+
+ assertThrows(function() { "use strict"; ab.byteLength = 42; }, TypeError);
+}
+
+TestByteLengthNotWritable();
+
+function TestSlice(expectedResultLen, initialLen, start, end) {
+ var ab = new ArrayBuffer(initialLen);
+ var a1 = new Uint8Array(ab);
+ for (var i = 0; i < a1.length; i++) {
+ a1[i] = 0xCA;
+ }
+ var slice = ab.slice(start, end);
+ assertSame(expectedResultLen, slice.byteLength);
+ var a2 = new Uint8Array(slice);
+ for (var i = 0; i < a2.length; i++) {
+ assertSame(0xCA, a2[i]);
+ }
+}
+
+function TestArrayBufferSlice() {
+ var ab = new ArrayBuffer(1024);
+ var ab1 = ab.slice(512, 1024);
+ assertSame(512, ab1.byteLength);
+
+ TestSlice(512, 1024, 512, 1024);
+ TestSlice(512, 1024, 512);
+
+ TestSlice(0, 0, 1, 20);
+ TestSlice(100, 100, 0, 100);
+ TestSlice(100, 100, 0, 1000);
+
+ TestSlice(0, 100, 5, 1);
+
+ TestSlice(1, 100, -11, -10);
+ TestSlice(9, 100, -10, 99);
+ TestSlice(0, 100, -10, 80);
+ TestSlice(10, 100, 80, -10);
+
+ TestSlice(10, 100, 90, "100");
+ TestSlice(10, 100, "90", "100");
+
+ TestSlice(0, 100, 90, "abc");
+ TestSlice(10, 100, "abc", 10);
+
+ TestSlice(10, 100, 0.96, 10.96);
+ TestSlice(10, 100, 0.96, 10.01);
+ TestSlice(10, 100, 0.01, 10.01);
+ TestSlice(10, 100, 0.01, 10.96);
+
+ TestSlice(10, 100, 90);
+ TestSlice(10, 100, -10);
+}
+
+TestArrayBufferSlice();
+
+// Typed arrays
+
+function TestTypedArray(constr, elementSize, typicalElement) {
+ assertSame(elementSize, constr.BYTES_PER_ELEMENT);
+
+ var ab = new ArrayBuffer(256*elementSize);
+
+ var a0 = new constr(30);
+ assertEquals("[object " + constr.name + "]",
+ Object.prototype.toString.call(a0));
+
+ assertTrue(ArrayBuffer.isView(a0));
+ assertSame(elementSize, a0.BYTES_PER_ELEMENT);
+ assertSame(30, a0.length);
+ assertSame(30*elementSize, a0.byteLength);
+ assertSame(0, a0.byteOffset);
+ assertSame(30*elementSize, a0.buffer.byteLength);
+
+ var aLen0 = new constr(0);
+ assertSame(elementSize, aLen0.BYTES_PER_ELEMENT);
+ assertSame(0, aLen0.length);
+ assertSame(0, aLen0.byteLength);
+ assertSame(0, aLen0.byteOffset);
+ assertSame(0, aLen0.buffer.byteLength);
+
+ var aOverBufferLen0 = new constr(ab, 128*elementSize, 0);
+ assertSame(ab, aOverBufferLen0.buffer);
+ assertSame(elementSize, aOverBufferLen0.BYTES_PER_ELEMENT);
+ assertSame(0, aOverBufferLen0.length);
+ assertSame(0, aOverBufferLen0.byteLength);
+ assertSame(128*elementSize, aOverBufferLen0.byteOffset);
+
+ var a1 = new constr(ab, 128*elementSize, 128);
+ assertSame(ab, a1.buffer);
+ assertSame(elementSize, a1.BYTES_PER_ELEMENT);
+ assertSame(128, a1.length);
+ assertSame(128*elementSize, a1.byteLength);
+ assertSame(128*elementSize, a1.byteOffset);
+
+
+ var a2 = new constr(ab, 64*elementSize, 128);
+ assertSame(ab, a2.buffer);
+ assertSame(elementSize, a2.BYTES_PER_ELEMENT);
+ assertSame(128, a2.length);
+ assertSame(128*elementSize, a2.byteLength);
+ assertSame(64*elementSize, a2.byteOffset);
+
+ var a3 = new constr(ab, 192*elementSize);
+ assertSame(ab, a3.buffer);
+ assertSame(64, a3.length);
+ assertSame(64*elementSize, a3.byteLength);
+ assertSame(192*elementSize, a3.byteOffset);
+
+ var a4 = new constr(ab);
+ assertSame(ab, a4.buffer);
+ assertSame(256, a4.length);
+ assertSame(256*elementSize, a4.byteLength);
+ assertSame(0, a4.byteOffset);
+
+
+ var i;
+ for (i = 0; i < 128; i++) {
+ a1[i] = typicalElement;
+ }
+
+ for (i = 0; i < 128; i++) {
+ assertSame(typicalElement, a1[i]);
+ }
+
+ for (i = 0; i < 64; i++) {
+ assertSame(0, a2[i]);
+ }
+
+ for (i = 64; i < 128; i++) {
+ assertSame(typicalElement, a2[i]);
+ }
+
+ for (i = 0; i < 64; i++) {
+ assertSame(typicalElement, a3[i]);
+ }
+
+ for (i = 0; i < 128; i++) {
+ assertSame(0, a4[i]);
+ }
+
+ for (i = 128; i < 256; i++) {
+ assertSame(typicalElement, a4[i]);
+ }
+
+ var aAtTheEnd = new constr(ab, 256*elementSize);
+ assertSame(elementSize, aAtTheEnd.BYTES_PER_ELEMENT);
+ assertSame(0, aAtTheEnd.length);
+ assertSame(0, aAtTheEnd.byteLength);
+ assertSame(256*elementSize, aAtTheEnd.byteOffset);
+
+ assertThrows(function () { new constr(ab, 257*elementSize); }, RangeError);
+ assertThrows(
+ function () { new constr(ab, 128*elementSize, 192); },
+ RangeError);
+
+ if (elementSize !== 1) {
+ assertThrows(function() { new constr(ab, 128*elementSize - 1, 10); },
+ RangeError);
+ var unalignedArrayBuffer = new ArrayBuffer(10*elementSize + 1);
+ var goodArray = new constr(unalignedArrayBuffer, 0, 10);
+ assertSame(10, goodArray.length);
+ assertSame(10*elementSize, goodArray.byteLength);
+ assertThrows(function() { new constr(unalignedArrayBuffer)}, RangeError);
+ assertThrows(function() { new constr(unalignedArrayBuffer, 5*elementSize)},
+ RangeError);
+ }
+
+ var aFromUndef = new constr();
+ assertSame(elementSize, aFromUndef.BYTES_PER_ELEMENT);
+ assertSame(0, aFromUndef.length);
+ assertSame(0*elementSize, aFromUndef.byteLength);
+ assertSame(0, aFromUndef.byteOffset);
+ assertSame(0*elementSize, aFromUndef.buffer.byteLength);
+
+ var aFromNull = new constr(null);
+ assertSame(elementSize, aFromNull.BYTES_PER_ELEMENT);
+ assertSame(0, aFromNull.length);
+ assertSame(0*elementSize, aFromNull.byteLength);
+ assertSame(0, aFromNull.byteOffset);
+ assertSame(0*elementSize, aFromNull.buffer.byteLength);
+
+ var aFromBool = new constr(true);
+ assertSame(elementSize, aFromBool.BYTES_PER_ELEMENT);
+ assertSame(1, aFromBool.length);
+ assertSame(1*elementSize, aFromBool.byteLength);
+ assertSame(0, aFromBool.byteOffset);
+ assertSame(1*elementSize, aFromBool.buffer.byteLength);
+
+ var aFromString = new constr("30");
+ assertSame(elementSize, aFromString.BYTES_PER_ELEMENT);
+ assertSame(30, aFromString.length);
+ assertSame(30*elementSize, aFromString.byteLength);
+ assertSame(0, aFromString.byteOffset);
+ assertSame(30*elementSize, aFromString.buffer.byteLength);
+
+ assertThrows(function() { new constr(Symbol()); }, TypeError);
+
+ var jsArray = [];
+ for (i = 0; i < 30; i++) {
+ jsArray.push(typicalElement);
+ }
+ var aFromArray = new constr(jsArray);
+ assertSame(elementSize, aFromArray.BYTES_PER_ELEMENT);
+ assertSame(30, aFromArray.length);
+ assertSame(30*elementSize, aFromArray.byteLength);
+ assertSame(0, aFromArray.byteOffset);
+ assertSame(30*elementSize, aFromArray.buffer.byteLength);
+ for (i = 0; i < 30; i++) {
+ assertSame(typicalElement, aFromArray[i]);
+ }
+
+ var abLen0 = new ArrayBuffer(0);
+ var aOverAbLen0 = new constr(abLen0);
+ assertSame(abLen0, aOverAbLen0.buffer);
+ assertSame(elementSize, aOverAbLen0.BYTES_PER_ELEMENT);
+ assertSame(0, aOverAbLen0.length);
+ assertSame(0, aOverAbLen0.byteLength);
+ assertSame(0, aOverAbLen0.byteOffset);
+
+ var aNoParam = new constr();
+ assertSame(elementSize, aNoParam.BYTES_PER_ELEMENT);
+ assertSame(0, aNoParam.length);
+ assertSame(0, aNoParam.byteLength);
+ assertSame(0, aNoParam.byteOffset);
+
+ var a = new constr(ab, 64*elementSize, 128);
+ assertEquals("[object " + constr.name + "]",
+ Object.prototype.toString.call(a));
+ var desc = Object.getOwnPropertyDescriptor(
+ constr.prototype.__proto__, Symbol.toStringTag);
+ assertTrue(desc.configurable);
+ assertFalse(desc.enumerable);
+ assertFalse(!!desc.writable);
+ assertFalse(!!desc.set);
+ assertEquals("function", typeof desc.get);
+
+ // Test that the constructor can be called with an iterable
+ function* gen() { for (var i = 0; i < 10; i++) yield i; }
+ var genArr = new constr(gen());
+ assertEquals(10, genArr.length);
+ assertEquals(0, genArr[0]);
+ assertEquals(9, genArr[9]);
+ // Arrays can be converted to TypedArrays
+ genArr = new constr([1, 2, 3]);
+ assertEquals(3, genArr.length);
+ assertEquals(1, genArr[0]);
+ assertEquals(3, genArr[2]);
+ // Redefining Array.prototype[Symbol.iterator] still works
+ var arrayIterator = Array.prototype[Symbol.iterator];
+ Array.prototype[Symbol.iterator] = gen;
+ genArr = new constr([1, 2, 3]);
+ assertEquals(10, genArr.length);
+ assertEquals(0, genArr[0]);
+ assertEquals(9, genArr[9]);
+ Array.prototype[Symbol.iterator] = arrayIterator;
+ // Other array-like things can be made into a TypedArray
+ var myObject = { 0: 5, 1: 6, length: 2 };
+ genArr = new constr(myObject);
+ assertEquals(2, genArr.length);
+ assertEquals(5, genArr[0]);
+ assertEquals(6, genArr[1]);
+ // Iterator takes precedence over array-like, and the property
+ // is read only once.
+ var iteratorReadCount = 0;
+ Object.defineProperty(myObject, Symbol.iterator, {
+ get: function() { iteratorReadCount++; return gen; }
+ });
+ genArr = new constr(myObject);
+ assertEquals(10, genArr.length);
+ assertEquals(0, genArr[0]);
+ assertEquals(9, genArr[9]);
+ assertEquals(1, iteratorReadCount);
+}
+
+TestTypedArray(Uint8Array, 1, 0xFF);
+TestTypedArray(Int8Array, 1, -0x7F);
+TestTypedArray(Uint16Array, 2, 0xFFFF);
+TestTypedArray(Int16Array, 2, -0x7FFF);
+TestTypedArray(Uint32Array, 4, 0xFFFFFFFF);
+TestTypedArray(Int32Array, 4, -0x7FFFFFFF);
+TestTypedArray(Float32Array, 4, 0.5);
+TestTypedArray(Float64Array, 8, 0.5);
+TestTypedArray(Uint8ClampedArray, 1, 0xFF);
+
+function SubarrayTestCase(constructor, item, expectedResultLen, expectedStartIndex,
+ initialLen, start, end) {
+ var a = new constructor(initialLen);
+ var s = a.subarray(start, end);
+ assertSame(constructor, s.constructor);
+ assertSame(expectedResultLen, s.length);
+ if (s.length > 0) {
+ s[0] = item;
+ assertSame(item, a[expectedStartIndex]);
+ }
+}
+
+function TestSubArray(constructor, item) {
+ SubarrayTestCase(constructor, item, 512, 512, 1024, 512, 1024);
+ SubarrayTestCase(constructor, item, 512, 512, 1024, 512);
+
+ SubarrayTestCase(constructor, item, 0, undefined, 0, 1, 20);
+ SubarrayTestCase(constructor, item, 100, 0, 100, 0, 100);
+ SubarrayTestCase(constructor, item, 100, 0, 100, 0, 1000);
+ SubarrayTestCase(constructor, item, 0, undefined, 100, 5, 1);
+
+ SubarrayTestCase(constructor, item, 1, 89, 100, -11, -10);
+ SubarrayTestCase(constructor, item, 9, 90, 100, -10, 99);
+ SubarrayTestCase(constructor, item, 0, undefined, 100, -10, 80);
+ SubarrayTestCase(constructor, item, 10,80, 100, 80, -10);
+
+ SubarrayTestCase(constructor, item, 10,90, 100, 90, "100");
+ SubarrayTestCase(constructor, item, 10,90, 100, "90", "100");
+
+ SubarrayTestCase(constructor, item, 0, undefined, 100, 90, "abc");
+ SubarrayTestCase(constructor, item, 10,0, 100, "abc", 10);
+
+ SubarrayTestCase(constructor, item, 10,0, 100, 0.96, 10.96);
+ SubarrayTestCase(constructor, item, 10,0, 100, 0.96, 10.01);
+ SubarrayTestCase(constructor, item, 10,0, 100, 0.01, 10.01);
+ SubarrayTestCase(constructor, item, 10,0, 100, 0.01, 10.96);
+
+
+ SubarrayTestCase(constructor, item, 10,90, 100, 90);
+ SubarrayTestCase(constructor, item, 10,90, 100, -10);
+
+ var method = constructor.prototype.subarray;
+ method.call(new constructor(100), 0, 100);
+ var o = {};
+ assertThrows(function() { method.call(o, 0, 100); }, TypeError);
+}
+
+TestSubArray(Uint8Array, 0xFF);
+TestSubArray(Int8Array, -0x7F);
+TestSubArray(Uint16Array, 0xFFFF);
+TestSubArray(Int16Array, -0x7FFF);
+TestSubArray(Uint32Array, 0xFFFFFFFF);
+TestSubArray(Int32Array, -0x7FFFFFFF);
+TestSubArray(Float32Array, 0.5);
+TestSubArray(Float64Array, 0.5);
+TestSubArray(Uint8ClampedArray, 0xFF);
+
+function TestTypedArrayOutOfRange(constructor, value, result) {
+ var a = new constructor(1);
+ a[0] = value;
+ assertSame(result, a[0]);
+}
+
+TestTypedArrayOutOfRange(Uint8Array, 0x1FA, 0xFA);
+TestTypedArrayOutOfRange(Uint8Array, -1, 0xFF);
+
+TestTypedArrayOutOfRange(Int8Array, 0x1FA, 0x7A - 0x80);
+
+TestTypedArrayOutOfRange(Uint16Array, 0x1FFFA, 0xFFFA);
+TestTypedArrayOutOfRange(Uint16Array, -1, 0xFFFF);
+TestTypedArrayOutOfRange(Int16Array, 0x1FFFA, 0x7FFA - 0x8000);
+
+TestTypedArrayOutOfRange(Uint32Array, 0x1FFFFFFFA, 0xFFFFFFFA);
+TestTypedArrayOutOfRange(Uint32Array, -1, 0xFFFFFFFF);
+TestTypedArrayOutOfRange(Int32Array, 0x1FFFFFFFA, 0x7FFFFFFA - 0x80000000);
+
+TestTypedArrayOutOfRange(Uint8ClampedArray, 0x1FA, 0xFF);
+TestTypedArrayOutOfRange(Uint8ClampedArray, -1, 0);
+
+var typedArrayConstructors = [
+ Uint8Array,
+ Int8Array,
+ Uint16Array,
+ Int16Array,
+ Uint32Array,
+ Int32Array,
+ Uint8ClampedArray,
+ Float32Array,
+ Float64Array];
+
+function TestPropertyTypeChecks(constructor) {
+ function CheckProperty(name) {
+ assertThrows(function() { 'use strict'; new constructor(10)[name] = 0; })
+ var d = Object.getOwnPropertyDescriptor(constructor.prototype.__proto__, name);
+ var o = {};
+ assertThrows(function() {d.get.call(o);}, TypeError);
+ for (var i = 0; i < typedArrayConstructors.length; i++) {
+ var ctor = typedArrayConstructors[i];
+ var a = new ctor(10);
+ d.get.call(a); // shouldn't throw
+ }
+ }
+
+ CheckProperty("buffer");
+ CheckProperty("byteOffset");
+ CheckProperty("byteLength");
+ CheckProperty("length");
+}
+
+for(i = 0; i < typedArrayConstructors.length; i++) {
+ TestPropertyTypeChecks(typedArrayConstructors[i]);
+}
+
+
+function TestTypedArraySet() {
+ // Test array.set in different combinations.
+
+ function assertArrayPrefix(expected, array) {
+ for (var i = 0; i < expected.length; ++i) {
+ assertEquals(expected[i], array[i]);
+ }
+ }
+
+ var a11 = new Int16Array([1, 2, 3, 4, 0, -1])
+ var a12 = new Uint16Array(15)
+ a12.set(a11, 3)
+ assertArrayPrefix([0, 0, 0, 1, 2, 3, 4, 0, 0xffff, 0, 0], a12)
+ assertThrows(function(){ a11.set(a12) })
+
+ var a21 = [1, undefined, 10, NaN, 0, -1, {valueOf: function() {return 3}}]
+ var a22 = new Int32Array(12)
+ a22.set(a21, 2)
+ assertArrayPrefix([0, 0, 1, 0, 10, 0, 0, -1, 3, 0], a22)
+
+ var a31 = new Float32Array([2, 4, 6, 8, 11, NaN, 1/0, -3])
+ var a32 = a31.subarray(2, 6)
+ a31.set(a32, 4)
+ assertArrayPrefix([2, 4, 6, 8, 6, 8, 11, NaN], a31)
+ assertArrayPrefix([6, 8, 6, 8], a32)
+
+ var a4 = new Uint8ClampedArray([3,2,5,6])
+ a4.set(a4)
+ assertArrayPrefix([3, 2, 5, 6], a4)
+
+ // Cases with overlapping backing store but different element sizes.
+ var b = new ArrayBuffer(4)
+ var a5 = new Int16Array(b)
+ var a50 = new Int8Array(b)
+ var a51 = new Int8Array(b, 0, 2)
+ var a52 = new Int8Array(b, 1, 2)
+ var a53 = new Int8Array(b, 2, 2)
+
+ a5.set([0x5050, 0x0a0a])
+ assertArrayPrefix([0x50, 0x50, 0x0a, 0x0a], a50)
+ assertArrayPrefix([0x50, 0x50], a51)
+ assertArrayPrefix([0x50, 0x0a], a52)
+ assertArrayPrefix([0x0a, 0x0a], a53)
+
+ a50.set([0x50, 0x50, 0x0a, 0x0a])
+ a51.set(a5)
+ assertArrayPrefix([0x50, 0x0a, 0x0a, 0x0a], a50)
+
+ a50.set([0x50, 0x50, 0x0a, 0x0a])
+ a52.set(a5)
+ assertArrayPrefix([0x50, 0x50, 0x0a, 0x0a], a50)
+
+ a50.set([0x50, 0x50, 0x0a, 0x0a])
+ a53.set(a5)
+ assertArrayPrefix([0x50, 0x50, 0x50, 0x0a], a50)
+
+ a50.set([0x50, 0x51, 0x0a, 0x0b])
+ a5.set(a51)
+ assertArrayPrefix([0x0050, 0x0051], a5)
+
+ a50.set([0x50, 0x51, 0x0a, 0x0b])
+ a5.set(a52)
+ assertArrayPrefix([0x0051, 0x000a], a5)
+
+ a50.set([0x50, 0x51, 0x0a, 0x0b])
+ a5.set(a53)
+ assertArrayPrefix([0x000a, 0x000b], a5)
+
+ // Mixed types of same size.
+ var a61 = new Float32Array([1.2, 12.3])
+ var a62 = new Int32Array(2)
+ a62.set(a61)
+ assertArrayPrefix([1, 12], a62)
+ a61.set(a62)
+ assertArrayPrefix([1, 12], a61)
+
+ // Invalid source
+ var a = new Uint16Array(50);
+ var expected = [];
+ for (i = 0; i < 50; i++) {
+ a[i] = i;
+ expected.push(i);
+ }
+ a.set({});
+ assertArrayPrefix(expected, a);
+ assertThrows(function() { a.set.call({}) }, TypeError);
+ assertThrows(function() { a.set.call([]) }, TypeError);
+
+ assertThrows(function() { a.set(0); }, TypeError);
+ assertThrows(function() { a.set(0, 1); }, TypeError);
+
+ assertEquals(1, a.set.length);
+}
+
+TestTypedArraySet();
+
+function TestTypedArraysWithIllegalIndices() {
+ var a = new Int32Array(100);
+
+ a[-10] = 10;
+ assertEquals(undefined, a[-10]);
+ a["-10"] = 10;
+ assertEquals(undefined, a["-10"]);
+
+ var s = " -10";
+ a[s] = 10;
+ assertEquals(10, a[s]);
+ var s1 = " -10 ";
+ a[s] = 10;
+ assertEquals(10, a[s]);
+
+ a["-1e2"] = 10;
+ assertEquals(10, a["-1e2"]);
+ assertEquals(undefined, a[-1e2]);
+
+ a["-0"] = 256;
+ var s2 = " -0";
+ a[s2] = 255;
+ assertEquals(undefined, a["-0"]);
+ assertEquals(255, a[s2]);
+ assertEquals(0, a[-0]);
+
+ a[-Infinity] = 50;
+ assertEquals(undefined, a[-Infinity]);
+
+ a[1.5] = 10;
+ assertEquals(undefined, a[1.5]);
+ var nan = Math.sqrt(-1);
+ a[nan] = 5;
+ assertEquals(undefined, a[nan]);
+
+ var x = 0;
+ var y = -0;
+ assertEquals(Infinity, 1/x);
+ assertEquals(-Infinity, 1/y);
+ a[x] = 5;
+ a[y] = 27;
+ assertEquals(27, a[x]);
+ assertEquals(27, a[y]);
+}
+
+TestTypedArraysWithIllegalIndices();
+
+function TestTypedArraysWithIllegalIndicesStrict() {
+ 'use strict';
+ var a = new Int32Array(100);
+
+ a[-10] = 10;
+ assertEquals(undefined, a[-10]);
+ a["-10"] = 10;
+ assertEquals(undefined, a["-10"]);
+
+ var s = " -10";
+ a[s] = 10;
+ assertEquals(10, a[s]);
+ var s1 = " -10 ";
+ a[s] = 10;
+ assertEquals(10, a[s]);
+
+ a["-1e2"] = 10;
+ assertEquals(10, a["-1e2"]);
+ assertEquals(undefined, a[-1e2]);
+
+ a["-0"] = 256;
+ var s2 = " -0";
+ a[s2] = 255;
+ assertEquals(undefined, a["-0"]);
+ assertEquals(255, a[s2]);
+ assertEquals(0, a[-0]);
+
+ /* Chromium bug: 424619
+ * a[-Infinity] = 50;
+ * assertEquals(undefined, a[-Infinity]);
+ */
+ a[1.5] = 10;
+ assertEquals(undefined, a[1.5]);
+ var nan = Math.sqrt(-1);
+ a[nan] = 5;
+ assertEquals(undefined, a[nan]);
+
+ var x = 0;
+ var y = -0;
+ assertEquals(Infinity, 1/x);
+ assertEquals(-Infinity, 1/y);
+ a[x] = 5;
+ a[y] = 27;
+ assertEquals(27, a[x]);
+ assertEquals(27, a[y]);
+}
+
+TestTypedArraysWithIllegalIndicesStrict();
+
+// DataView
+function TestDataViewConstructor() {
+ var ab = new ArrayBuffer(256);
+
+ var d1 = new DataView(ab, 1, 255);
+ assertTrue(ArrayBuffer.isView(d1));
+ assertSame(ab, d1.buffer);
+ assertSame(1, d1.byteOffset);
+ assertSame(255, d1.byteLength);
+
+ var d2 = new DataView(ab, 2);
+ assertSame(ab, d2.buffer);
+ assertSame(2, d2.byteOffset);
+ assertSame(254, d2.byteLength);
+
+ var d3 = new DataView(ab);
+ assertSame(ab, d3.buffer);
+ assertSame(0, d3.byteOffset);
+ assertSame(256, d3.byteLength);
+
+ var d3a = new DataView(ab, 1, 0);
+ assertSame(ab, d3a.buffer);
+ assertSame(1, d3a.byteOffset);
+ assertSame(0, d3a.byteLength);
+
+ var d3b = new DataView(ab, 256, 0);
+ assertSame(ab, d3b.buffer);
+ assertSame(256, d3b.byteOffset);
+ assertSame(0, d3b.byteLength);
+
+ var d3c = new DataView(ab, 256);
+ assertSame(ab, d3c.buffer);
+ assertSame(256, d3c.byteOffset);
+ assertSame(0, d3c.byteLength);
+
+ var d4 = new DataView(ab, 1, 3.1415926);
+ assertSame(ab, d4.buffer);
+ assertSame(1, d4.byteOffset);
+ assertSame(3, d4.byteLength);
+
+
+ // error cases
+ assertThrows(function() { new DataView(ab, -1); }, RangeError);
+ assertThrows(function() { new DataView(); }, TypeError);
+ assertThrows(function() { new DataView([]); }, TypeError);
+ assertThrows(function() { new DataView(ab, 257); }, RangeError);
+ assertThrows(function() { new DataView(ab, 1, 1024); }, RangeError);
+}
+
+TestDataViewConstructor();
+
+function TestDataViewPropertyTypeChecks() {
+ var a = new DataView(new ArrayBuffer(10));
+ function CheckProperty(name) {
+ var d = Object.getOwnPropertyDescriptor(DataView.prototype, name);
+ var o = {}
+ assertThrows(function() {d.get.call(o);}, TypeError);
+ d.get.call(a); // shouldn't throw
+ }
+
+ CheckProperty("buffer");
+ CheckProperty("byteOffset");
+ CheckProperty("byteLength");
+
+ function CheckGetSetLength(name) {
+ assertEquals(1, DataView.prototype["get" + name].length);
+ assertEquals(2, DataView.prototype["set" + name].length);
+ }
+ CheckGetSetLength("Int8");
+ CheckGetSetLength("Uint8");
+ CheckGetSetLength("Int16");
+ CheckGetSetLength("Uint16");
+ CheckGetSetLength("Int32");
+ CheckGetSetLength("Uint32");
+ CheckGetSetLength("Float32");
+ CheckGetSetLength("Float64");
+}
+
+
+TestDataViewPropertyTypeChecks();
+
+
+function TestDataViewToStringTag() {
+ var a = new DataView(new ArrayBuffer(10));
+ assertEquals("[object DataView]", Object.prototype.toString.call(a));
+ var desc = Object.getOwnPropertyDescriptor(
+ DataView.prototype, Symbol.toStringTag);
+ assertTrue(desc.configurable);
+ assertFalse(desc.enumerable);
+ assertFalse(desc.writable);
+ assertEquals("DataView", desc.value);
+}
+
+
+// General tests for properties
+
+// Test property attribute [[Enumerable]]
+function TestEnumerable(func, obj) {
+ function props(x) {
+ var array = [];
+ for (var p in x) array.push(p);
+ return array.sort();
+ }
+ assertArrayEquals([], props(func));
+ assertArrayEquals([], props(func.prototype));
+ if (obj)
+ assertArrayEquals([], props(obj));
+}
+TestEnumerable(ArrayBuffer, new ArrayBuffer());
+for(i = 0; i < typedArrayConstructors.length; i++) {
+ TestEnumerable(typedArrayConstructors[i]);
+}
+TestEnumerable(DataView, new DataView(new ArrayBuffer()));
+
+// Test arbitrary properties on ArrayBuffer
+function TestArbitrary(m) {
+ function TestProperty(map, property, value) {
+ map[property] = value;
+ assertEquals(value, map[property]);
+ }
+ for (var i = 0; i < 20; i++) {
+ TestProperty(m, 'key' + i, 'val' + i);
+ TestProperty(m, 'foo' + i, 'bar' + i);
+ }
+}
+TestArbitrary(new ArrayBuffer(256));
+for(i = 0; i < typedArrayConstructors.length; i++) {
+ TestArbitrary(new typedArrayConstructors[i](10));
+}
+TestArbitrary(new DataView(new ArrayBuffer(256)));
+
+
+// Test direct constructor call
+assertThrows(function() { ArrayBuffer(); }, TypeError);
+assertThrows(function() { DataView(new ArrayBuffer()); }, TypeError);
+
+function TestNonConfigurableProperties(constructor) {
+ var arr = new constructor([100])
+ assertFalse(Object.getOwnPropertyDescriptor(arr,"0").configurable)
+ assertFalse(delete arr[0])
+}
+
+for(i = 0; i < typedArrayConstructors.length; i++) {
+ TestNonConfigurableProperties(typedArrayConstructors[i]);
+}
diff --git a/deps/v8/test/mjsunit/es6/typedarray.js b/deps/v8/test/mjsunit/es6/typedarray.js
index b1bd8937be..ca68db96c9 100644
--- a/deps/v8/test/mjsunit/es6/typedarray.js
+++ b/deps/v8/test/mjsunit/es6/typedarray.js
@@ -334,6 +334,31 @@ function TestTypedArray(constr, elementSize, typicalElement) {
assertEquals(0, genArr[0]);
assertEquals(9, genArr[9]);
assertEquals(1, iteratorReadCount);
+
+ // Modified %ArrayIteratorPrototype%.next() method is honoured (v8:5699)
+ const ArrayIteratorPrototype = Object.getPrototypeOf([][Symbol.iterator]());
+ const ArrayIteratorPrototypeNext = ArrayIteratorPrototype.next;
+ ArrayIteratorPrototype.next = function() {
+ return { done: true };
+ };
+ genArr = new constr([1, 2, 3]);
+ assertEquals(0, genArr.length);
+ ArrayIteratorPrototype.next = ArrayIteratorPrototypeNext;
+
+ // Modified %ArrayIteratorPrototype%.next() during iteration is honoured as
+ // well.
+ genArr = new constr(Object.defineProperty([1, , 3], 1, {
+ get() {
+ ArrayIteratorPrototype.next = function() {
+ return { done: true };
+ }
+ return 2;
+ }
+ }));
+ assertEquals(2, genArr.length);
+ assertEquals(1, genArr[0]);
+ assertEquals(2, genArr[1]);
+ ArrayIteratorPrototype.next = ArrayIteratorPrototypeNext;
}
TestTypedArray(Uint8Array, 1, 0xFF);