summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit')
-rw-r--r--deps/v8/test/mjsunit/asm/construct-double.js33
-rw-r--r--deps/v8/test/mjsunit/asm/double-hi.js40
-rw-r--r--deps/v8/test/mjsunit/asm/double-lo.js40
-rw-r--r--deps/v8/test/mjsunit/asm/if-cloning.js34
-rw-r--r--deps/v8/test/mjsunit/asm/math-clz32.js31
-rw-r--r--deps/v8/test/mjsunit/bugs/harmony/debug-blockscopes.js2
-rw-r--r--deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js40
-rw-r--r--deps/v8/test/mjsunit/compiler/eager-deopt-simple.js18
-rw-r--r--deps/v8/test/mjsunit/compiler/osr-forin-nested.js35
-rw-r--r--deps/v8/test/mjsunit/compiler/osr-infinite.js78
-rw-r--r--deps/v8/test/mjsunit/compiler/osr-labeled.js47
-rw-r--r--deps/v8/test/mjsunit/compiler/osr-literals-adapted.js56
-rw-r--r--deps/v8/test/mjsunit/compiler/osr-literals.js56
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-463056.js9
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-468727.js16
-rw-r--r--deps/v8/test/mjsunit/compiler/regress-469089.js16
-rw-r--r--deps/v8/test/mjsunit/compiler/truncating-store-deopt.js28
-rw-r--r--deps/v8/test/mjsunit/compiler/try-deopt.js56
-rw-r--r--deps/v8/test/mjsunit/constant-folding-2.js2
-rw-r--r--deps/v8/test/mjsunit/debug-allscopes-on-debugger.js58
-rw-r--r--deps/v8/test/mjsunit/debug-liveedit-check-stack.js6
-rw-r--r--deps/v8/test/mjsunit/debug-references.js5
-rw-r--r--deps/v8/test/mjsunit/debug-scopes.js24
-rw-r--r--deps/v8/test/mjsunit/debug-set-variable-value.js15
-rw-r--r--deps/v8/test/mjsunit/debug-sourceinfo.js618
-rw-r--r--deps/v8/test/mjsunit/debug-step-turbofan.js2
-rw-r--r--deps/v8/test/mjsunit/debug-stepframe-clearing.js97
-rw-r--r--deps/v8/test/mjsunit/debug-stepin-foreach.js8
-rw-r--r--deps/v8/test/mjsunit/es6/block-conflicts.js (renamed from deps/v8/test/mjsunit/harmony/block-conflicts.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/block-const-assign.js160
-rw-r--r--deps/v8/test/mjsunit/es6/block-early-errors.js (renamed from deps/v8/test/mjsunit/harmony/block-early-errors.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/block-for.js (renamed from deps/v8/test/mjsunit/harmony/block-for.js)5
-rw-r--r--deps/v8/test/mjsunit/es6/block-leave.js (renamed from deps/v8/test/mjsunit/harmony/block-leave.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/block-let-crankshaft.js (renamed from deps/v8/test/mjsunit/harmony/block-let-crankshaft.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/block-let-declaration.js (renamed from deps/v8/test/mjsunit/harmony/block-let-declaration.js)26
-rw-r--r--deps/v8/test/mjsunit/es6/block-let-semantics.js (renamed from deps/v8/test/mjsunit/harmony/block-let-semantics.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/block-non-strict-errors.js (renamed from deps/v8/test/mjsunit/harmony/block-non-strict-errors.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/block-scoping.js (renamed from deps/v8/test/mjsunit/harmony/block-scoping.js)8
-rw-r--r--deps/v8/test/mjsunit/es6/collections.js122
-rw-r--r--deps/v8/test/mjsunit/es6/debug-blockscopes.js (renamed from deps/v8/test/mjsunit/harmony/debug-blockscopes.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/debug-evaluate-blockscopes.js (renamed from deps/v8/test/mjsunit/harmony/debug-evaluate-blockscopes.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/debug-function-scopes.js (renamed from deps/v8/test/mjsunit/harmony/debug-function-scopes.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/resolve-after-aborted-try-finally.js32
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/resolve-after-try-catch.js29
-rw-r--r--deps/v8/test/mjsunit/es6/debug-promises/rethrow-in-try-finally.js30
-rw-r--r--deps/v8/test/mjsunit/es6/debug-stepin-promises.js65
-rw-r--r--deps/v8/test/mjsunit/es6/empty-for.js (renamed from deps/v8/test/mjsunit/harmony/empty-for.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/function-length-configurable.js119
-rw-r--r--deps/v8/test/mjsunit/es6/function-name-configurable.js115
-rw-r--r--deps/v8/test/mjsunit/es6/generators-debug-liveedit.js4
-rw-r--r--deps/v8/test/mjsunit/es6/generators-objects.js2
-rw-r--r--deps/v8/test/mjsunit/es6/indexed-integer-exotics.js63
-rw-r--r--deps/v8/test/mjsunit/es6/iteration-semantics.js32
-rw-r--r--deps/v8/test/mjsunit/es6/iteration-syntax.js2
-rw-r--r--deps/v8/test/mjsunit/es6/map-minus-zero.js51
-rw-r--r--deps/v8/test/mjsunit/es6/promises.js200
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-2243.js (renamed from deps/v8/test/mjsunit/harmony/regress/regress-2243.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-2322.js (renamed from deps/v8/test/mjsunit/harmony/regress/regress-2322.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-2506.js (renamed from deps/v8/test/mjsunit/regress/regress-2506.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-2858.js (renamed from deps/v8/test/mjsunit/harmony/regress/regress-2858.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-3426.js (renamed from deps/v8/test/mjsunit/harmony/regress/regress-3426.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-347906.js (renamed from deps/v8/test/mjsunit/regress/regress-347906.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-3683.js (renamed from deps/v8/test/mjsunit/harmony/regress/regress-3683.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-3741.js (renamed from deps/v8/test/mjsunit/harmony/regress/regress-3741.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-3938.js8
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-411237.js (renamed from deps/v8/test/mjsunit/regress/regress-411237.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-468661.js75
-rw-r--r--deps/v8/test/mjsunit/es6/regress/regress-474783.js24
-rw-r--r--deps/v8/test/mjsunit/es6/set-minus-zero.js51
-rw-r--r--deps/v8/test/mjsunit/es6/string-codepointat.js (renamed from deps/v8/test/mjsunit/harmony/string-codepointat.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/string-endswith.js (renamed from deps/v8/test/mjsunit/harmony/string-endswith.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/string-fromcodepoint.js (renamed from deps/v8/test/mjsunit/harmony/string-fromcodepoint.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/string-includes.js (renamed from deps/v8/test/mjsunit/harmony/string-includes.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/string-raw.js (renamed from deps/v8/test/mjsunit/harmony/string-raw.js)38
-rw-r--r--deps/v8/test/mjsunit/es6/string-repeat.js (renamed from deps/v8/test/mjsunit/harmony/string-repeat.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/string-startswith.js (renamed from deps/v8/test/mjsunit/harmony/string-startswith.js)2
-rw-r--r--deps/v8/test/mjsunit/es6/symbols.js5
-rw-r--r--deps/v8/test/mjsunit/es6/templates.js (renamed from deps/v8/test/mjsunit/harmony/templates.js)165
-rw-r--r--deps/v8/test/mjsunit/es7/object-observe.js67
-rw-r--r--deps/v8/test/mjsunit/function-length-accessor.js2
-rw-r--r--deps/v8/test/mjsunit/function-prototype.js3
-rw-r--r--deps/v8/test/mjsunit/harmony/block-const-assign.js137
-rw-r--r--deps/v8/test/mjsunit/harmony/computed-property-names-classes.js131
-rw-r--r--deps/v8/test/mjsunit/harmony/computed-property-names.js23
-rw-r--r--deps/v8/test/mjsunit/harmony/module-linking.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/module-resolution.js2
-rw-r--r--deps/v8/test/mjsunit/harmony/private.js5
-rw-r--r--deps/v8/test/mjsunit/harmony/reflect-apply.js212
-rw-r--r--deps/v8/test/mjsunit/harmony/reflect-construct.js277
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-3501.js (renamed from deps/v8/test/mjsunit/regress/regress-3501.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-crbug-448730.js (renamed from deps/v8/test/mjsunit/regress/regress-crbug-448730.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-crbug-451770.js (renamed from deps/v8/test/mjsunit/regress/regress-crbug-451770.js)0
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-crbug-461520.js18
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-crbug-465671-null.js16
-rw-r--r--deps/v8/test/mjsunit/harmony/regress/regress-crbug-465671.js16
-rw-r--r--deps/v8/test/mjsunit/harmony/rest-params.js34
-rw-r--r--deps/v8/test/mjsunit/harmony/typedarrays.js4
-rw-r--r--deps/v8/test/mjsunit/json2.js5
-rw-r--r--deps/v8/test/mjsunit/mjsunit.status48
-rw-r--r--deps/v8/test/mjsunit/regexp-stack-overflow.js18
-rw-r--r--deps/v8/test/mjsunit/regress/regress-1530.js8
-rw-r--r--deps/v8/test/mjsunit/regress/regress-270142.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-330046.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3960.js36
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3969.js36
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3976.js80
-rw-r--r--deps/v8/test/mjsunit/regress/regress-3985.js45
-rw-r--r--deps/v8/test/mjsunit/regress/regress-4023.js67
-rw-r--r--deps/v8/test/mjsunit/regress/regress-4027.js60
-rw-r--r--deps/v8/test/mjsunit/regress/regress-430201b.js43
-rw-r--r--deps/v8/test/mjsunit/regress/regress-460937.js19
-rw-r--r--deps/v8/test/mjsunit/regress/regress-463028.js18
-rw-r--r--deps/v8/test/mjsunit/regress/regress-469605.js43
-rw-r--r--deps/v8/test/mjsunit/regress/regress-470804.js53
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-385002.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-401915.js2
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-465564.js (renamed from deps/v8/test/mjsunit/harmony/disable-harmony-string.js)4
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-467047.js17
-rw-r--r--deps/v8/test/mjsunit/regress/regress-crbug-467531.js25
-rw-r--r--deps/v8/test/mjsunit/regress/regress-filter-contexts.js14
-rw-r--r--deps/v8/test/mjsunit/regress/regress-function-length-strict.js2
-rw-r--r--deps/v8/test/mjsunit/regress/string-compare-memcmp.js2
-rw-r--r--deps/v8/test/mjsunit/stack-traces.js34
-rw-r--r--deps/v8/test/mjsunit/strict-mode.js16
-rw-r--r--deps/v8/test/mjsunit/string-concat.js14
-rw-r--r--deps/v8/test/mjsunit/string-index.js16
-rw-r--r--deps/v8/test/mjsunit/strong/arrays.js12
-rw-r--r--deps/v8/test/mjsunit/strong/classes.js47
-rw-r--r--deps/v8/test/mjsunit/strong/declaration-after-use.js258
-rw-r--r--deps/v8/test/mjsunit/strong/functions.js68
130 files changed, 4293 insertions, 723 deletions
diff --git a/deps/v8/test/mjsunit/asm/construct-double.js b/deps/v8/test/mjsunit/asm/construct-double.js
new file mode 100644
index 0000000000..8bb5000082
--- /dev/null
+++ b/deps/v8/test/mjsunit/asm/construct-double.js
@@ -0,0 +1,33 @@
+// 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: --allow-natives-syntax
+
+var stdlib = this;
+var foreign = {};
+var heap = new ArrayBuffer(64 * 1024);
+
+
+var m = (function(stdlib, foreign, heap) {
+ "use asm";
+ function cd1(i, j) {
+ i = i|0;
+ j = j|0;
+ return +%_ConstructDouble(i, j);
+ }
+ function cd2(i) {
+ i = i|0;
+ return +%_ConstructDouble(0, i);
+ }
+ return { cd1: cd1, cd2: cd2 };
+})(stdlib, foreign, heap);
+
+assertEquals(0.0, m.cd1(0, 0));
+assertEquals(%ConstructDouble(0, 1), m.cd2(1));
+for (var i = -2147483648; i < 2147483648; i += 3999773) {
+ assertEquals(%ConstructDouble(0, i), m.cd2(i));
+ for (var j = -2147483648; j < 2147483648; j += 3999773) {
+ assertEquals(%ConstructDouble(i, j), m.cd1(i, j));
+ }
+}
diff --git a/deps/v8/test/mjsunit/asm/double-hi.js b/deps/v8/test/mjsunit/asm/double-hi.js
new file mode 100644
index 0000000000..5a5f942f7b
--- /dev/null
+++ b/deps/v8/test/mjsunit/asm/double-hi.js
@@ -0,0 +1,40 @@
+// 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: --allow-natives-syntax
+
+var stdlib = this;
+var foreign = {};
+var heap = new ArrayBuffer(64 * 1024);
+
+
+var m = (function(stdlib, foreign, heap) {
+ "use asm";
+ function hi1(i) {
+ i = +i;
+ return %_DoubleHi(i)|0;
+ }
+ function hi2(i, j) {
+ i = +i;
+ j = +j;
+ return %_DoubleHi(i)+%_DoubleHi(j)|0;
+ }
+ return { hi1: hi1, hi2: hi2 };
+})(stdlib, foreign, heap);
+
+assertEquals(0, m.hi1(0.0));
+assertEquals(-2147483648, m.hi1(-0.0));
+assertEquals(2146435072, m.hi1(Infinity));
+assertEquals(-1048576, m.hi1(-Infinity));
+assertEquals(0, m.hi2(0.0, 0.0));
+assertEquals(-2147483648, m.hi2(0.0, -0.0));
+assertEquals(-2147483648, m.hi2(-0.0, 0.0));
+assertEquals(0, m.hi2(-0.0, -0.0));
+for (var i = -2147483648; i < 2147483648; i += 3999773) {
+ assertEquals(%_DoubleHi(i), m.hi1(i));
+ assertEquals(i, m.hi1(%ConstructDouble(i, 0)));
+ assertEquals(i, m.hi1(%ConstructDouble(i, i)));
+ assertEquals(i+i|0, m.hi2(%ConstructDouble(i, 0), %ConstructDouble(i, 0)));
+ assertEquals(i+i|0, m.hi2(%ConstructDouble(i, i), %ConstructDouble(i, i)));
+}
diff --git a/deps/v8/test/mjsunit/asm/double-lo.js b/deps/v8/test/mjsunit/asm/double-lo.js
new file mode 100644
index 0000000000..39d5b5268f
--- /dev/null
+++ b/deps/v8/test/mjsunit/asm/double-lo.js
@@ -0,0 +1,40 @@
+// 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: --allow-natives-syntax
+
+var stdlib = this;
+var foreign = {};
+var heap = new ArrayBuffer(64 * 1024);
+
+
+var m = (function(stdlib, foreign, heap) {
+ "use asm";
+ function lo1(i) {
+ i = +i;
+ return %_DoubleLo(i)|0;
+ }
+ function lo2(i, j) {
+ i = +i;
+ j = +j;
+ return %_DoubleLo(i)+%_DoubleLo(j)|0;
+ }
+ return { lo1: lo1, lo2: lo2 };
+})(stdlib, foreign, heap);
+
+assertEquals(0, m.lo1(0.0));
+assertEquals(0, m.lo1(-0.0));
+assertEquals(0, m.lo1(Infinity));
+assertEquals(0, m.lo1(-Infinity));
+assertEquals(0, m.lo2(0.0, 0.0));
+assertEquals(0, m.lo2(0.0, -0.0));
+assertEquals(0, m.lo2(-0.0, 0.0));
+assertEquals(0, m.lo2(-0.0, -0.0));
+for (var i = -2147483648; i < 2147483648; i += 3999773) {
+ assertEquals(%_DoubleLo(i), m.lo1(i));
+ assertEquals(i, m.lo1(%ConstructDouble(0, i)));
+ assertEquals(i, m.lo1(%ConstructDouble(i, i)));
+ assertEquals(i+i|0, m.lo2(%ConstructDouble(0, i), %ConstructDouble(0, i)));
+ assertEquals(i+i|0, m.lo2(%ConstructDouble(i, i), %ConstructDouble(i, i)));
+}
diff --git a/deps/v8/test/mjsunit/asm/if-cloning.js b/deps/v8/test/mjsunit/asm/if-cloning.js
new file mode 100644
index 0000000000..99d4edc67a
--- /dev/null
+++ b/deps/v8/test/mjsunit/asm/if-cloning.js
@@ -0,0 +1,34 @@
+// 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.
+
+var if0 = (function Module() {
+ "use asm";
+ function if0(i, j) {
+ i = i|0;
+ j = j|0;
+ if (i == 0 ? j == 0 : 0) return 1;
+ return 0;
+ }
+ return {if0: if0};
+})().if0;
+assertEquals(1, if0(0, 0));
+assertEquals(0, if0(11, 0));
+assertEquals(0, if0(0, -1));
+assertEquals(0, if0(-1024, 1));
+
+
+var if1 = (function Module() {
+ "use asm";
+ function if1(i, j) {
+ i = i|0;
+ j = j|0;
+ if (i == 0 ? j == 0 : 1) return 0;
+ return 1;
+ }
+ return {if1: if1};
+})().if1;
+assertEquals(0, if1(0, 0));
+assertEquals(0, if1(11, 0));
+assertEquals(1, if1(0, -1));
+assertEquals(0, if1(-1024, 9));
diff --git a/deps/v8/test/mjsunit/asm/math-clz32.js b/deps/v8/test/mjsunit/asm/math-clz32.js
new file mode 100644
index 0000000000..004aa65b46
--- /dev/null
+++ b/deps/v8/test/mjsunit/asm/math-clz32.js
@@ -0,0 +1,31 @@
+// 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: --allow-natives-syntax
+
+var stdlib = { Math: Math };
+
+var f = (function Module(stdlib) {
+ "use asm";
+
+ var clz32 = stdlib.Math.clz32;
+
+ function f(a) {
+ a = a >>> 0;
+ return clz32(a)|0;
+ }
+
+ return f;
+})(stdlib);
+
+assertEquals(32, f(0));
+assertEquals(32, f(NaN));
+assertEquals(32, f(undefined));
+for (var i = 0; i < 32; ++i) {
+ assertEquals(i, f((-1) >>> i));
+}
+for (var i = -2147483648; i < 2147483648; i += 3999773) {
+ assertEquals(%MathClz32(i), f(i));
+ assertEquals(%_MathClz32(i), f(i));
+}
diff --git a/deps/v8/test/mjsunit/bugs/harmony/debug-blockscopes.js b/deps/v8/test/mjsunit/bugs/harmony/debug-blockscopes.js
index 9ef8efbc0c..52c94e7548 100644
--- a/deps/v8/test/mjsunit/bugs/harmony/debug-blockscopes.js
+++ b/deps/v8/test/mjsunit/bugs/harmony/debug-blockscopes.js
@@ -25,7 +25,7 @@
// (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 --harmony-scoping
+// Flags: --expose-debug-as debug
// The functions used for testing backtraces. They are at the top to make the
// testing of source line/column easier.
diff --git a/deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js b/deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js
new file mode 100644
index 0000000000..c93ef9dfd5
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/deopt-tonumber-binop.js
@@ -0,0 +1,40 @@
+// 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: --allow-natives-syntax
+//
+var f = (function() {
+ "use asm";
+ function f(x, y) {
+ return x - y;
+ }
+ return f;
+})();
+
+var counter = 0;
+
+var deopt = { toString : function() {
+ %DeoptimizeFunction(f);
+ counter++;
+ return "2";
+} };
+
+var o = { toString : function() {
+ counter++;
+ return "1";
+} };
+
+counter = 0;
+assertEquals(1, f(deopt, o));
+assertEquals(2, counter);
+
+%OptimizeFunctionOnNextCall(f);
+counter = 0;
+assertEquals(-1, f(o, deopt));
+assertEquals(2, counter);
+
+%OptimizeFunctionOnNextCall(f);
+counter = 0;
+assertEquals(0, f(deopt, deopt));
+assertEquals(2, counter);
diff --git a/deps/v8/test/mjsunit/compiler/eager-deopt-simple.js b/deps/v8/test/mjsunit/compiler/eager-deopt-simple.js
new file mode 100644
index 0000000000..067400cfc6
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/eager-deopt-simple.js
@@ -0,0 +1,18 @@
+// 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: --allow-natives-syntax
+
+function g(a, b, c) {
+ return a + b + c;
+}
+
+function f() {
+ return g(1, (%_DeoptimizeNow(), 2), 3);
+}
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+assertEquals(6, f());
diff --git a/deps/v8/test/mjsunit/compiler/osr-forin-nested.js b/deps/v8/test/mjsunit/compiler/osr-forin-nested.js
new file mode 100644
index 0000000000..ad55b30bd8
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/osr-forin-nested.js
@@ -0,0 +1,35 @@
+// 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: --turbo-osr --allow-natives-syntax
+
+function test(e, f, v) {
+ assertEquals(e, f(v));
+ assertEquals(e, f(v));
+ assertEquals(e, f(v));
+}
+
+function foo(t) {
+ for (var x in t) {
+ for (var i = 0; i < 2; i++) {
+ %OptimizeOsr();
+ }
+ }
+ return 5;
+}
+
+test(5, foo, {x:20});
+
+function bar(t) {
+ var sum = 0;
+ for (var x in t) {
+ for (var i = 0; i < 2; i++) {
+ %OptimizeOsr();
+ sum += t[x];
+ }
+ }
+ return sum;
+}
+
+test(62, bar, {x:20,y:11});
diff --git a/deps/v8/test/mjsunit/compiler/osr-infinite.js b/deps/v8/test/mjsunit/compiler/osr-infinite.js
new file mode 100644
index 0000000000..aa74c877d5
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/osr-infinite.js
@@ -0,0 +1,78 @@
+// 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: --use-osr --allow-natives-syntax --turbo-osr
+
+var global_counter = 0;
+
+function thrower() {
+ var x = global_counter++;
+ if (x == 5) %OptimizeOsr(thrower.caller);
+ if (x == 10) throw "terminate";
+}
+
+%NeverOptimizeFunction(thrower); // Don't want to inline the thrower.
+%NeverOptimizeFunction(test); // Don't want to inline the func into test.
+
+function test(func) {
+ for (var i = 0; i < 3; i++) {
+ global_counter = 0;
+ assertThrows(func);
+ }
+}
+
+function n1() {
+ while (true) thrower();
+}
+
+function n2() {
+ while (true) while (true) thrower();
+}
+
+function n3() {
+ while (true) while (true) while (true) thrower();
+}
+
+function n4() {
+ while (true) while (true) while (true) while (true) thrower();
+}
+
+function b1(a) {
+ while (true) {
+ thrower();
+ if (a) break
+ }
+}
+
+
+function b2(a) {
+ while (true) {
+ while (true) {
+ thrower();
+ if (a) break
+ }
+ }
+}
+
+
+function b3(a) {
+ while (true) {
+ while (true) {
+ while (true) {
+ thrower();
+ if (a) break
+ }
+ if (a) break
+ }
+ }
+}
+
+
+test(n1);
+test(n2);
+test(n3);
+test(n4);
+test(b1);
+test(b2);
+test(b3);
diff --git a/deps/v8/test/mjsunit/compiler/osr-labeled.js b/deps/v8/test/mjsunit/compiler/osr-labeled.js
new file mode 100644
index 0000000000..1a9709285e
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/osr-labeled.js
@@ -0,0 +1,47 @@
+// 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: --allow-natives-syntax --use-osr --turbo-osr
+
+function foo() {
+ var sum = 0;
+ A: for (var i = 0; i < 5; i++) {
+ B: for (var j = 0; j < 5; j++) {
+ C: for (var k = 0; k < 10; k++) {
+ if (k === 5) %OptimizeOsr();
+ if (k === 6) break B;
+ sum++;
+ }
+ }
+ }
+ return sum;
+}
+
+assertEquals(30, foo());
+assertEquals(30, foo());
+
+function bar(a) {
+ var sum = 0;
+ A: for (var i = 0; i < 5; i++) {
+ B: for (var j = 0; j < 5; j++) {
+ C: for (var k = 0; k < 10; k++) {
+ sum++;
+ %OptimizeOsr();
+ if (a === 1) break A;
+ if (a === 2) break B;
+ if (a === 3) break C;
+ }
+ }
+ }
+ return sum;
+}
+
+assertEquals(1, bar(1));
+assertEquals(1, bar(1));
+
+assertEquals(5, bar(2));
+assertEquals(5, bar(2));
+
+assertEquals(25, bar(3));
+assertEquals(25, bar(3));
diff --git a/deps/v8/test/mjsunit/compiler/osr-literals-adapted.js b/deps/v8/test/mjsunit/compiler/osr-literals-adapted.js
new file mode 100644
index 0000000000..950d8b0762
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/osr-literals-adapted.js
@@ -0,0 +1,56 @@
+// 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: --allow-natives-syntax --use-osr --turbo-osr
+
+function mod() {
+ function f0() {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function f1(a) {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function f2(a,b) {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function f3(a,b,c) {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function f4(a,b,c,d) {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function bar() {
+ assertEquals(3, f0().blah);
+ assertEquals(3, f1().blah);
+ assertEquals(3, f2().blah);
+ assertEquals(3, f3().blah);
+ assertEquals(3, f4().blah);
+ }
+ bar();
+}
+
+
+mod();
+mod();
+mod();
diff --git a/deps/v8/test/mjsunit/compiler/osr-literals.js b/deps/v8/test/mjsunit/compiler/osr-literals.js
new file mode 100644
index 0000000000..d9f68a0b37
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/osr-literals.js
@@ -0,0 +1,56 @@
+// 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: --allow-natives-syntax --use-osr --turbo-osr
+
+function mod() {
+ function f0() {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function f1(a) {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function f2(a,b) {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function f3(a,b,c) {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function f4(a,b,c,d) {
+ for (var i = 0; i < 3; i = i + 1 | 0) {
+ %OptimizeOsr();
+ }
+ return {blah: i};
+ }
+
+ function bar() {
+ assertEquals(3, f0().blah);
+ assertEquals(3, f1(1).blah);
+ assertEquals(3, f2(1,2).blah);
+ assertEquals(3, f3(1,2,3).blah);
+ assertEquals(3, f4(1,2,3,4).blah);
+ }
+ bar();
+}
+
+
+mod();
+mod();
+mod();
diff --git a/deps/v8/test/mjsunit/compiler/regress-463056.js b/deps/v8/test/mjsunit/compiler/regress-463056.js
new file mode 100644
index 0000000000..fb871618e4
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-463056.js
@@ -0,0 +1,9 @@
+// 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.
+
+function f() {
+ return ((0%0)&1) + (1>>>(0%0));
+}
+
+f();
diff --git a/deps/v8/test/mjsunit/compiler/regress-468727.js b/deps/v8/test/mjsunit/compiler/regress-468727.js
new file mode 100644
index 0000000000..a69efe5a56
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-468727.js
@@ -0,0 +1,16 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --noanalyze-environment-liveness
+
+function f() {
+ var __v_7 = -126 - __v_3;
+ var __v_17 = ((__v_15 & __v_14) != 4) | 16;
+ if (__v_17) {
+ var __v_11 = 1 << __v_7;
+ }
+ __v_12 >>= __v_3;
+}
+
+assertThrows(f);
diff --git a/deps/v8/test/mjsunit/compiler/regress-469089.js b/deps/v8/test/mjsunit/compiler/regress-469089.js
new file mode 100644
index 0000000000..6aff2b7203
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/regress-469089.js
@@ -0,0 +1,16 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --expose-gc
+
+(function() {
+ var __v_6 = false;
+ function f(val, idx) {
+ if (idx === 1) {
+ gc();
+ __v_6 = (val === 0);
+ }
+ }
+ f(.1, 1);
+})();
diff --git a/deps/v8/test/mjsunit/compiler/truncating-store-deopt.js b/deps/v8/test/mjsunit/compiler/truncating-store-deopt.js
new file mode 100644
index 0000000000..a640caf583
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/truncating-store-deopt.js
@@ -0,0 +1,28 @@
+// 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: --allow-natives-syntax
+
+function g(a, b, c) {
+ return a + b + c;
+}
+
+var asm = (function Module(global, env, buffer) {
+ "use asm";
+
+ var i32 = new global.Int32Array(buffer);
+
+ // This is not valid asm.js, but we should still generate correct code.
+ function store(x) {
+ return g(1, i32[0] = x, 2);
+ }
+
+ return { store: store };
+})({
+ "Int32Array": Int32Array
+}, {}, new ArrayBuffer(64 * 1024));
+
+var o = { toString : function() { %DeoptimizeFunction(asm.store); return "1"; } }
+
+asm.store(o);
diff --git a/deps/v8/test/mjsunit/compiler/try-deopt.js b/deps/v8/test/mjsunit/compiler/try-deopt.js
new file mode 100644
index 0000000000..dc44e7326f
--- /dev/null
+++ b/deps/v8/test/mjsunit/compiler/try-deopt.js
@@ -0,0 +1,56 @@
+// 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.
+
+// TODO(mstarzinger): Add FLAG_turbo_exceptions once we want ClusterFuzz.
+// Flags: --allow-natives-syntax --turbo-deoptimization
+
+function DeoptFromTry(x) {
+ try {
+ %DeoptimizeFunction(DeoptFromTry);
+ throw x;
+ } catch (e) {
+ return e + 1;
+ }
+ return x + 2;
+}
+%OptimizeFunctionOnNextCall(DeoptFromTry);
+assertEquals(24, DeoptFromTry(23));
+
+
+function DeoptFromCatch(x) {
+ try {
+ throw x;
+ } catch (e) {
+ %DeoptimizeFunction(DeoptFromCatch);
+ return e + 1;
+ }
+ return x + 2;
+}
+%OptimizeFunctionOnNextCall(DeoptFromCatch);
+assertEquals(24, DeoptFromCatch(23));
+
+
+function DeoptFromFinally_Return(x) {
+ try {
+ throw x;
+ } finally {
+ %DeoptimizeFunction(DeoptFromFinally_Return);
+ return x + 1;
+ }
+ return x + 2;
+}
+%OptimizeFunctionOnNextCall(DeoptFromFinally_Return);
+assertEquals(24, DeoptFromFinally_Return(23));
+
+
+function DeoptFromFinally_ReThrow(x) {
+ try {
+ throw x;
+ } finally {
+ %DeoptimizeFunction(DeoptFromFinally_ReThrow);
+ }
+ return x + 2;
+}
+%OptimizeFunctionOnNextCall(DeoptFromFinally_ReThrow);
+assertThrows("DeoptFromFinally_ReThrow(new Error)", Error);
diff --git a/deps/v8/test/mjsunit/constant-folding-2.js b/deps/v8/test/mjsunit/constant-folding-2.js
index 73cf040f5a..3f82c2fa43 100644
--- a/deps/v8/test/mjsunit/constant-folding-2.js
+++ b/deps/v8/test/mjsunit/constant-folding-2.js
@@ -26,7 +26,7 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --nodead-code-elimination --fold-constants --allow-natives-syntax
+// Flags: --nodead-code-elimination --fold-constants --allow-natives-syntax --nostress-opt
function test(f) {
f();
diff --git a/deps/v8/test/mjsunit/debug-allscopes-on-debugger.js b/deps/v8/test/mjsunit/debug-allscopes-on-debugger.js
new file mode 100644
index 0000000000..f0613b2926
--- /dev/null
+++ b/deps/v8/test/mjsunit/debug-allscopes-on-debugger.js
@@ -0,0 +1,58 @@
+// 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;
+
+function listener(event, exec_state, event_data, data) {
+ try {
+ if (event == Debug.DebugEvent.Break) {
+ assertTrue(exec_state.frameCount() != 0, "FAIL: Empty stack trace");
+ // Count number of expected breakpoints in this source file.
+ if (!break_count) {
+ var source_text = exec_state.frame(0).func().script().source();
+ expected_breaks = source_text.match(/\/\/\s*Break\s+\d+\./g).length;
+ print("Expected breaks: " + expected_breaks);
+ }
+ var frameMirror = exec_state.frame(0);
+
+ 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 + ".");
+ ++break_count;
+
+ if (break_count !== expected_breaks) {
+ exec_state.prepareStep(Debug.StepAction.StepIn, 1);
+ print("Next step prepared");
+ }
+ }
+ } catch(e) {
+ exception = e;
+ print(e, e.stack);
+ }
+};
+
+Debug.setListener(listener);
+
+var sum = 0;
+(function (){
+ 'use strict';
+
+ debugger; // Break 0.
+ var i = 0; // Break 1.
+ i++; // Break 2.
+ i++; // Break 3.
+ return i; // Break 4.
+}()); // Break 5.
+
+assertNull(exception); // Break 6.
+assertEquals(expected_breaks, break_count);
+
+Debug.setListener(null);
diff --git a/deps/v8/test/mjsunit/debug-liveedit-check-stack.js b/deps/v8/test/mjsunit/debug-liveedit-check-stack.js
index 6948a70d6b..d843ca6a60 100644
--- a/deps/v8/test/mjsunit/debug-liveedit-check-stack.js
+++ b/deps/v8/test/mjsunit/debug-liveedit-check-stack.js
@@ -25,7 +25,7 @@
// (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
+// Flags: --expose-debug-as debug --allow-natives-syntax
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug
@@ -87,13 +87,13 @@ function WrapInCatcher(f, holder) {
function WrapInNativeCall(f) {
return function() {
- return Debug.ExecuteInDebugContext(f, true);
+ return %Call(undefined, f);
};
}
function WrapInDebuggerCall(f) {
return function() {
- return Debug.ExecuteInDebugContext(f, false);
+ return %ExecuteInDebugContext(f);
};
}
diff --git a/deps/v8/test/mjsunit/debug-references.js b/deps/v8/test/mjsunit/debug-references.js
index bb339768b8..cb9f3701e2 100644
--- a/deps/v8/test/mjsunit/debug-references.js
+++ b/deps/v8/test/mjsunit/debug-references.js
@@ -26,6 +26,8 @@
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
// Flags: --expose-debug-as debug --turbo-deoptimization
+// Flags: --stack-trace-on-illegal
+
// Get the Debug object exposed from the debug context global object.
Debug = debug.Debug
@@ -98,7 +100,8 @@ function listener(event, exec_state, event_data, data) {
listenerComplete = true;
}
} catch (e) {
- exception = e
+ exception = e;
+ print(e + "\n" + e.stack);
};
};
diff --git a/deps/v8/test/mjsunit/debug-scopes.js b/deps/v8/test/mjsunit/debug-scopes.js
index 7c08120e2a..78a70af26a 100644
--- a/deps/v8/test/mjsunit/debug-scopes.js
+++ b/deps/v8/test/mjsunit/debug-scopes.js
@@ -1049,6 +1049,30 @@ catch_block_7();
EndTest();
+BeginTest("Classes and methods 1");
+
+listener_delegate = function(exec_state) {
+ "use strict"
+ CheckScopeChain([debug.ScopeType.Local,
+ debug.ScopeType.Block,
+ debug.ScopeType.Script,
+ debug.ScopeType.Global], exec_state);
+ CheckScopeContent({C1: class { m() { debugger; }} }, 1, exec_state);
+};
+
+(function() {
+ "use strict";
+ class C1 {
+ m() {
+ debugger;
+ }
+ }
+ new C1().m();
+})();
+
+EndTest();
+
+
assertEquals(begin_test_count, break_count,
'one or more tests did not enter the debugger');
assertEquals(begin_test_count, end_test_count,
diff --git a/deps/v8/test/mjsunit/debug-set-variable-value.js b/deps/v8/test/mjsunit/debug-set-variable-value.js
index 4667a71d6b..65434289d0 100644
--- a/deps/v8/test/mjsunit/debug-set-variable-value.js
+++ b/deps/v8/test/mjsunit/debug-set-variable-value.js
@@ -29,6 +29,7 @@
// Get the Debug object exposed from the debug context global object.
var Debug = debug.Debug;
+var DebugCommandProcessor = debug.DebugCommandProcessor;
// Accepts a function/closure 'fun' that must have a debugger statement inside.
// A variable 'variable_name' must be initialized before debugger statement
@@ -291,18 +292,18 @@ RunPauseTest(0, 5, 'p', 2012, 2012, (function Factory() {
// Test value description protocol JSON
-assertEquals(true, Debug.TestApi.CommandProcessorResolveValue({value: true}));
+assertEquals(true, DebugCommandProcessor.resolveValue_({value: true}));
-assertSame(null, Debug.TestApi.CommandProcessorResolveValue({type: "null"}));
+assertSame(null, DebugCommandProcessor.resolveValue_({type: "null"}));
assertSame(undefined,
- Debug.TestApi.CommandProcessorResolveValue({type: "undefined"}));
+ DebugCommandProcessor.resolveValue_({type: "undefined"}));
-assertSame("123", Debug.TestApi.CommandProcessorResolveValue(
+assertSame("123", DebugCommandProcessor.resolveValue_(
{type: "string", stringDescription: "123"}));
-assertSame(123, Debug.TestApi.CommandProcessorResolveValue(
+assertSame(123, DebugCommandProcessor.resolveValue_(
{type: "number", stringDescription: "123"}));
-assertSame(Number, Debug.TestApi.CommandProcessorResolveValue(
+assertSame(Number, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(Number).handle()}));
-assertSame(RunClosureTest, Debug.TestApi.CommandProcessorResolveValue(
+assertSame(RunClosureTest, DebugCommandProcessor.resolveValue_(
{handle: Debug.MakeMirror(RunClosureTest).handle()}));
diff --git a/deps/v8/test/mjsunit/debug-sourceinfo.js b/deps/v8/test/mjsunit/debug-sourceinfo.js
index ddf80dc51c..1dbe1b7a0a 100644
--- a/deps/v8/test/mjsunit/debug-sourceinfo.js
+++ b/deps/v8/test/mjsunit/debug-sourceinfo.js
@@ -1,352 +1,266 @@
-// Copyright 2008 the V8 project authors. All rights reserved.
-// Redistribution and use in source and binary forms, with or without
-// modification, are permitted provided that the following conditions are
-// met:
-//
-// * Redistributions of source code must retain the above copyright
-// notice, this list of conditions and the following disclaimer.
-// * Redistributions in binary form must reproduce the above
-// copyright notice, this list of conditions and the following
-// disclaimer in the documentation and/or other materials provided
-// with the distribution.
-// * Neither the name of Google Inc. nor the names of its
-// contributors may be used to endorse or promote products derived
-// from this software without specific prior written permission.
-//
-// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-
-// Flags: --expose-debug-as debug
-// For this test to work this file MUST have CR LF line endings.
-function a() { b(); };
-function b() {
- c(true);
-};
- function c(x) {
- if (x) {
- return 1;
- } else {
- return 1;
- }
- };
-function d(x) {
- x = 1 ;
- x = 2 ;
- x = 3 ;
- x = 4 ;
- x = 5 ;
- x = 6 ;
- x = 7 ;
- x = 8 ;
- x = 9 ;
- x = 10;
- x = 11;
- x = 12;
- x = 13;
- x = 14;
- x = 15;
-}
-
-// Get the Debug object exposed from the debug context global object.
-Debug = debug.Debug
-
-// This is the number of comment lines above the first test function.
-var comment_lines = 29;
-
-// This is the last position in the entire file (note: this equals
-// file size of <debug-sourceinfo.js> - 1, since starting at 0).
-var last_position = 14312;
-// This is the last line of entire file (note: starting at 0).
-var last_line = 351;
-// This is the last column of last line (note: starting at 0 and +2, due
-// to trailing <CR><LF>).
-var last_column = 2;
-
-// This magic number is the length or the first line comment (actually number
-// of characters before 'function a(...'.
-var comment_line_length = 1726;
-var start_a = 10 + comment_line_length;
-var start_b = 37 + comment_line_length;
-var start_c = 71 + comment_line_length;
-var start_d = 163 + comment_line_length;
-
-// The position of the first line of d(), i.e. "x = 1 ;".
-var start_code_d = start_d + 7;
-// The line # of the first line of d() (note: starting at 0).
-var start_line_d = 41;
-var line_length_d = 11;
-var num_lines_d = 15;
-
-assertEquals(start_a, Debug.sourcePosition(a));
-assertEquals(start_b, Debug.sourcePosition(b));
-assertEquals(start_c, Debug.sourcePosition(c));
-assertEquals(start_d, Debug.sourcePosition(d));
-
-var script = Debug.findScript(a);
-assertTrue(script.data === Debug.findScript(b).data);
-assertTrue(script.data === Debug.findScript(c).data);
-assertTrue(script.data === Debug.findScript(d).data);
-assertTrue(script.source === Debug.findScript(b).source);
-assertTrue(script.source === Debug.findScript(c).source);
-assertTrue(script.source === Debug.findScript(d).source);
-
-// Test that when running through source positions the position, line and
-// column progresses as expected.
-var position;
-var line;
-var column;
-for (var p = 0; p < 100; p++) {
- var location = script.locationFromPosition(p);
- if (p > 0) {
- assertEquals(position + 1, location.position);
- if (line == location.line) {
- assertEquals(column + 1, location.column);
- } else {
- assertEquals(line + 1, location.line);
- assertEquals(0, location.column);
- }
- } else {
- assertEquals(0, location.position);
- assertEquals(0, location.line);
- assertEquals(0, location.column);
- }
-
- // Remember the location.
- position = location.position;
- line = location.line;
- column = location.column;
-}
-
-// Every line of d() is the same length. Verify we can loop through all
-// positions and find the right line # for each.
-var p = start_code_d;
-for (line = 0; line < num_lines_d; line++) {
- for (column = 0; column < line_length_d; column++) {
- var location = script.locationFromPosition(p);
- assertEquals(p, location.position);
- assertEquals(start_line_d + line, location.line);
- assertEquals(column, location.column);
- p++;
- }
-}
-
-// Test first position.
-assertEquals(0, script.locationFromPosition(0).position);
-assertEquals(0, script.locationFromPosition(0).line);
-assertEquals(0, script.locationFromPosition(0).column);
-
-// Test second position.
-assertEquals(1, script.locationFromPosition(1).position);
-assertEquals(0, script.locationFromPosition(1).line);
-assertEquals(1, script.locationFromPosition(1).column);
-
-// Test first position in function a().
-assertEquals(start_a, script.locationFromPosition(start_a).position);
-assertEquals(0, script.locationFromPosition(start_a).line - comment_lines);
-assertEquals(10, script.locationFromPosition(start_a).column);
-
-// Test first position in function b().
-assertEquals(start_b, script.locationFromPosition(start_b).position);
-assertEquals(1, script.locationFromPosition(start_b).line - comment_lines);
-assertEquals(13, script.locationFromPosition(start_b).column);
-
-// Test first position in function c().
-assertEquals(start_c, script.locationFromPosition(start_c).position);
-assertEquals(4, script.locationFromPosition(start_c).line - comment_lines);
-assertEquals(12, script.locationFromPosition(start_c).column);
-
-// Test first position in function d().
-assertEquals(start_d, script.locationFromPosition(start_d).position);
-assertEquals(11, script.locationFromPosition(start_d).line - comment_lines);
-assertEquals(10, script.locationFromPosition(start_d).column);
-
-// Test first line.
-assertEquals(0, script.locationFromLine().position);
-assertEquals(0, script.locationFromLine().line);
-assertEquals(0, script.locationFromLine().column);
-assertEquals(0, script.locationFromLine(0).position);
-assertEquals(0, script.locationFromLine(0).line);
-assertEquals(0, script.locationFromLine(0).column);
-
-// Test first line column 1.
-assertEquals(1, script.locationFromLine(0, 1).position);
-assertEquals(0, script.locationFromLine(0, 1).line);
-assertEquals(1, script.locationFromLine(0, 1).column);
-
-// Test first line offset 1.
-assertEquals(1, script.locationFromLine(0, 0, 1).position);
-assertEquals(0, script.locationFromLine(0, 0, 1).line);
-assertEquals(1, script.locationFromLine(0, 0, 1).column);
-
-// Test offset function a().
-assertEquals(start_a, script.locationFromLine(void 0, void 0, start_a).position);
-assertEquals(0, script.locationFromLine(void 0, void 0, start_a).line - comment_lines);
-assertEquals(10, script.locationFromLine(void 0, void 0, start_a).column);
-assertEquals(start_a, script.locationFromLine(0, void 0, start_a).position);
-assertEquals(0, script.locationFromLine(0, void 0, start_a).line - comment_lines);
-assertEquals(10, script.locationFromLine(0, void 0, start_a).column);
-assertEquals(start_a, script.locationFromLine(0, 0, start_a).position);
-assertEquals(0, script.locationFromLine(0, 0, start_a).line - comment_lines);
-assertEquals(10, script.locationFromLine(0, 0, start_a).column);
-
-// Test second line offset function a().
-assertEquals(start_a + 14, script.locationFromLine(1, 0, start_a).position);
-assertEquals(1, script.locationFromLine(1, 0, start_a).line - comment_lines);
-assertEquals(0, script.locationFromLine(1, 0, start_a).column);
-
-// Test second line column 2 offset function a().
-assertEquals(start_a + 14 + 2, script.locationFromLine(1, 2, start_a).position);
-assertEquals(1, script.locationFromLine(1, 2, start_a).line - comment_lines);
-assertEquals(2, script.locationFromLine(1, 2, start_a).column);
-
-// Test offset function b().
-assertEquals(start_b, script.locationFromLine(0, 0, start_b).position);
-assertEquals(1, script.locationFromLine(0, 0, start_b).line - comment_lines);
-assertEquals(13, script.locationFromLine(0, 0, start_b).column);
-
-// Test second line offset function b().
-assertEquals(start_b + 6, script.locationFromLine(1, 0, start_b).position);
-assertEquals(2, script.locationFromLine(1, 0, start_b).line - comment_lines);
-assertEquals(0, script.locationFromLine(1, 0, start_b).column);
-
-// Test second line column 11 offset function b().
-assertEquals(start_b + 6 + 11, script.locationFromLine(1, 11, start_b).position);
-assertEquals(2, script.locationFromLine(1, 11, start_b).line - comment_lines);
-assertEquals(11, script.locationFromLine(1, 11, start_b).column);
-
-// Test second line column 12 offset function b. Second line in b is 11 long
-// using column 12 wraps to next line.
-assertEquals(start_b + 6 + 12, script.locationFromLine(1, 12, start_b).position);
-assertEquals(3, script.locationFromLine(1, 12, start_b).line - comment_lines);
-assertEquals(0, script.locationFromLine(1, 12, start_b).column);
-
-// Test the Debug.findSourcePosition which wraps SourceManager.
-assertEquals(0 + start_a, Debug.findFunctionSourceLocation(a, 0, 0).position);
-assertEquals(0 + start_b, Debug.findFunctionSourceLocation(b, 0, 0).position);
-assertEquals(6 + start_b, Debug.findFunctionSourceLocation(b, 1, 0).position);
-assertEquals(8 + start_b, Debug.findFunctionSourceLocation(b, 1, 2).position);
-assertEquals(18 + start_b, Debug.findFunctionSourceLocation(b, 2, 0).position);
-assertEquals(0 + start_c, Debug.findFunctionSourceLocation(c, 0, 0).position);
-assertEquals(7 + start_c, Debug.findFunctionSourceLocation(c, 1, 0).position);
-assertEquals(21 + start_c, Debug.findFunctionSourceLocation(c, 2, 0).position);
-assertEquals(38 + start_c, Debug.findFunctionSourceLocation(c, 3, 0).position);
-assertEquals(52 + start_c, Debug.findFunctionSourceLocation(c, 4, 0).position);
-assertEquals(69 + start_c, Debug.findFunctionSourceLocation(c, 5, 0).position);
-assertEquals(76 + start_c, Debug.findFunctionSourceLocation(c, 6, 0).position);
-assertEquals(0 + start_d, Debug.findFunctionSourceLocation(d, 0, 0).position);
-assertEquals(7 + start_d, Debug.findFunctionSourceLocation(d, 1, 0).position);
-for (i = 1; i <= num_lines_d; i++) {
- assertEquals(7 + (i * line_length_d) + start_d, Debug.findFunctionSourceLocation(d, (i + 1), 0).position);
-}
-assertEquals(175 + start_d, Debug.findFunctionSourceLocation(d, 17, 0).position);
-
-// Make sure invalid inputs work properly.
-assertEquals(0, script.locationFromPosition(-1).line);
-assertEquals(null, script.locationFromPosition(last_position + 1));
-
-// Test last position.
-assertEquals(last_position, script.locationFromPosition(last_position).position);
-assertEquals(last_line, script.locationFromPosition(last_position).line);
-assertEquals(last_column, script.locationFromPosition(last_position).column);
-
-// Test source line and restriction. All the following tests start from line 1
-// column 2 in function b, which is the call to c.
-// c(true);
-// ^
-
-var location;
-
-location = script.locationFromLine(1, 0, start_b);
-assertEquals(' c(true);', location.sourceText());
-
-result = ['c', ' c', ' c(', ' c(', ' c(t']
-for (var i = 1; i <= 5; i++) {
- location = script.locationFromLine(1, 2, start_b);
- location.restrict(i);
- assertEquals(result[i - 1], location.sourceText());
-}
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(1, 0);
-assertEquals('c', location.sourceText());
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(2, 0);
-assertEquals('c(', location.sourceText());
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(2, 1);
-assertEquals(' c', location.sourceText());
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(2, 2);
-assertEquals(' c', location.sourceText());
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(2, 3);
-assertEquals(' c', location.sourceText());
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(3, 1);
-assertEquals(' c(', location.sourceText());
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(5, 0);
-assertEquals('c(tru', location.sourceText());
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(5, 2);
-assertEquals(' c(t', location.sourceText());
-
-location = script.locationFromLine(1, 2, start_b);
-location.restrict(5, 4);
-assertEquals(' c(t', location.sourceText());
-
-// All the following tests start from line 1 column 10 in function b, which is
-// the final character.
-// c(true);
-// ^
-
-location = script.locationFromLine(1, 10, start_b);
-location.restrict(5, 0);
-assertEquals('rue);', location.sourceText());
-
-location = script.locationFromLine(1, 10, start_b);
-location.restrict(7, 0);
-assertEquals('(true);', location.sourceText());
-
-// All the following tests start from line 1 column 0 in function b, which is
-// the first character.
-// c(true);
-//^
-
-location = script.locationFromLine(1, 0, start_b);
-location.restrict(5, 0);
-assertEquals(' c(t', location.sourceText());
-
-location = script.locationFromLine(1, 0, start_b);
-location.restrict(5, 4);
-assertEquals(' c(t', location.sourceText());
-
-location = script.locationFromLine(1, 0, start_b);
-location.restrict(7, 0);
-assertEquals(' c(tru', location.sourceText());
-
-location = script.locationFromLine(1, 0, start_b);
-location.restrict(7, 6);
-assertEquals(' c(tru', location.sourceText());
-
-// Test that script.sourceLine(line) works.
-for (line = 0; line < num_lines_d; line++) {
- var line_content_regexp = new RegExp(" x = " + (line + 1));
- assertTrue(line_content_regexp.test(script.sourceLine(start_line_d + line)));
-}
+// Copyright 2008 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (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
+function a() { b(); };
+function b() {
+ c(true);
+};
+ function c(x) {
+ if (x) {
+ return 1;
+ } else {
+ return 1;
+ }
+ };
+function d(x) {
+ x = 1 ;
+ x = 2 ;
+ x = 3 ;
+ x = 4 ;
+ x = 5 ;
+ x = 6 ;
+ x = 7 ;
+ x = 8 ;
+ x = 9 ;
+ x = 10;
+ x = 11;
+ x = 12;
+ x = 13;
+ x = 14;
+ x = 15;
+}
+
+// Get the Debug object exposed from the debug context global object.
+Debug = debug.Debug
+
+// This is the number of comment lines above the first test function.
+var comment_lines = 28;
+
+// This is the last position in the entire file (note: this equals
+// file size of <debug-sourceinfo.js> - 1, since starting at 0).
+var last_position = 11337;
+// This is the last line of entire file (note: starting at 0).
+var last_line = 265;
+// This is the last column of last line (note: starting at 0 and +1, due
+// to trailing <LF>).
+var last_column = 1;
+
+// This magic number is the length or the first line comment (actually number
+// of characters before 'function a(...'.
+var comment_line_length = 1633;
+var start_a = 9 + comment_line_length;
+var start_b = 35 + comment_line_length;
+var start_c = 66 + comment_line_length;
+var start_d = 151 + comment_line_length;
+
+// The position of the first line of d(), i.e. "x = 1 ;".
+var start_code_d = start_d + 6;
+// The line # of the first line of d() (note: starting at 0).
+var start_line_d = 40;
+var line_length_d = 10;
+var num_lines_d = 15;
+
+assertEquals(start_a, Debug.sourcePosition(a));
+assertEquals(start_b, Debug.sourcePosition(b));
+assertEquals(start_c, Debug.sourcePosition(c));
+assertEquals(start_d, Debug.sourcePosition(d));
+
+var script = Debug.findScript(a);
+assertTrue(script.data === Debug.findScript(b).data);
+assertTrue(script.data === Debug.findScript(c).data);
+assertTrue(script.data === Debug.findScript(d).data);
+assertTrue(script.source === Debug.findScript(b).source);
+assertTrue(script.source === Debug.findScript(c).source);
+assertTrue(script.source === Debug.findScript(d).source);
+
+// Test that when running through source positions the position, line and
+// column progresses as expected.
+var position;
+var line;
+var column;
+for (var p = 0; p < 100; p++) {
+ var location = script.locationFromPosition(p);
+ if (p > 0) {
+ assertEquals(position + 1, location.position);
+ if (line == location.line) {
+ assertEquals(column + 1, location.column);
+ } else {
+ assertEquals(line + 1, location.line);
+ assertEquals(0, location.column);
+ }
+ } else {
+ assertEquals(0, location.position);
+ assertEquals(0, location.line);
+ assertEquals(0, location.column);
+ }
+
+ // Remember the location.
+ position = location.position;
+ line = location.line;
+ column = location.column;
+}
+
+// Every line of d() is the same length. Verify we can loop through all
+// positions and find the right line # for each.
+var p = start_code_d;
+for (line = 0; line < num_lines_d; line++) {
+ for (column = 0; column < line_length_d; column++) {
+ var location = script.locationFromPosition(p);
+ assertEquals(p, location.position);
+ assertEquals(start_line_d + line, location.line);
+ assertEquals(column, location.column);
+ p++;
+ }
+}
+
+// Test first position.
+assertEquals(0, script.locationFromPosition(0).position);
+assertEquals(0, script.locationFromPosition(0).line);
+assertEquals(0, script.locationFromPosition(0).column);
+
+// Test second position.
+assertEquals(1, script.locationFromPosition(1).position);
+assertEquals(0, script.locationFromPosition(1).line);
+assertEquals(1, script.locationFromPosition(1).column);
+
+// Test first position in function a().
+assertEquals(start_a, script.locationFromPosition(start_a).position);
+assertEquals(0, script.locationFromPosition(start_a).line - comment_lines);
+assertEquals(10, script.locationFromPosition(start_a).column);
+
+// Test first position in function b().
+assertEquals(start_b, script.locationFromPosition(start_b).position);
+assertEquals(1, script.locationFromPosition(start_b).line - comment_lines);
+assertEquals(13, script.locationFromPosition(start_b).column);
+
+// Test first position in function c().
+assertEquals(start_c, script.locationFromPosition(start_c).position);
+assertEquals(4, script.locationFromPosition(start_c).line - comment_lines);
+assertEquals(12, script.locationFromPosition(start_c).column);
+
+// Test first position in function d().
+assertEquals(start_d, script.locationFromPosition(start_d).position);
+assertEquals(11, script.locationFromPosition(start_d).line - comment_lines);
+assertEquals(10, script.locationFromPosition(start_d).column);
+
+// Test first line.
+assertEquals(0, script.locationFromLine().position);
+assertEquals(0, script.locationFromLine().line);
+assertEquals(0, script.locationFromLine().column);
+assertEquals(0, script.locationFromLine(0).position);
+assertEquals(0, script.locationFromLine(0).line);
+assertEquals(0, script.locationFromLine(0).column);
+
+// Test first line column 1.
+assertEquals(1, script.locationFromLine(0, 1).position);
+assertEquals(0, script.locationFromLine(0, 1).line);
+assertEquals(1, script.locationFromLine(0, 1).column);
+
+// Test first line offset 1.
+assertEquals(1, script.locationFromLine(0, 0, 1).position);
+assertEquals(0, script.locationFromLine(0, 0, 1).line);
+assertEquals(1, script.locationFromLine(0, 0, 1).column);
+
+// Test offset function a().
+assertEquals(start_a, script.locationFromLine(void 0, void 0, start_a).position);
+assertEquals(0, script.locationFromLine(void 0, void 0, start_a).line - comment_lines);
+assertEquals(10, script.locationFromLine(void 0, void 0, start_a).column);
+assertEquals(start_a, script.locationFromLine(0, void 0, start_a).position);
+assertEquals(0, script.locationFromLine(0, void 0, start_a).line - comment_lines);
+assertEquals(10, script.locationFromLine(0, void 0, start_a).column);
+assertEquals(start_a, script.locationFromLine(0, 0, start_a).position);
+assertEquals(0, script.locationFromLine(0, 0, start_a).line - comment_lines);
+assertEquals(10, script.locationFromLine(0, 0, start_a).column);
+
+// Test second line offset function a().
+assertEquals(start_a + 13, script.locationFromLine(1, 0, start_a).position);
+assertEquals(1, script.locationFromLine(1, 0, start_a).line - comment_lines);
+assertEquals(0, script.locationFromLine(1, 0, start_a).column);
+
+// Test second line column 2 offset function a().
+assertEquals(start_a + 13 + 1, script.locationFromLine(1, 1, start_a).position);
+assertEquals(1, script.locationFromLine(1, 2, start_a).line - comment_lines);
+assertEquals(2, script.locationFromLine(1, 2, start_a).column);
+
+// Test offset function b().
+assertEquals(start_b, script.locationFromLine(0, 0, start_b).position);
+assertEquals(1, script.locationFromLine(0, 0, start_b).line - comment_lines);
+assertEquals(13, script.locationFromLine(0, 0, start_b).column);
+
+// Test second line offset function b().
+assertEquals(start_b + 5, script.locationFromLine(1, 0, start_b).position);
+assertEquals(2, script.locationFromLine(1, 0, start_b).line - comment_lines);
+assertEquals(0, script.locationFromLine(1, 0, start_b).column);
+
+// Test second line column 10 offset function b().
+assertEquals(start_b + 5 + 10, script.locationFromLine(1, 10, start_b).position);
+assertEquals(2, script.locationFromLine(1, 10, start_b).line - comment_lines);
+assertEquals(10, script.locationFromLine(1, 10, start_b).column);
+
+// Test second line column 11 offset function b. Second line in b is 10 long
+// using column 11 wraps to next line.
+assertEquals(start_b + 5 + 11, script.locationFromLine(1, 11, start_b).position);
+assertEquals(3, script.locationFromLine(1, 11, start_b).line - comment_lines);
+assertEquals(0, script.locationFromLine(1, 11, start_b).column);
+
+// Test the Debug.findSourcePosition which wraps SourceManager.
+assertEquals(0 + start_a, Debug.findFunctionSourceLocation(a, 0, 0).position);
+assertEquals(0 + start_b, Debug.findFunctionSourceLocation(b, 0, 0).position);
+assertEquals(5 + start_b, Debug.findFunctionSourceLocation(b, 1, 0).position);
+assertEquals(7 + start_b, Debug.findFunctionSourceLocation(b, 1, 2).position);
+assertEquals(16 + start_b, Debug.findFunctionSourceLocation(b, 2, 0).position);
+assertEquals(0 + start_c, Debug.findFunctionSourceLocation(c, 0, 0).position);
+assertEquals(6 + start_c, Debug.findFunctionSourceLocation(c, 1, 0).position);
+assertEquals(19 + start_c, Debug.findFunctionSourceLocation(c, 2, 0).position);
+assertEquals(35 + start_c, Debug.findFunctionSourceLocation(c, 3, 0).position);
+assertEquals(48 + start_c, Debug.findFunctionSourceLocation(c, 4, 0).position);
+assertEquals(64 + start_c, Debug.findFunctionSourceLocation(c, 5, 0).position);
+assertEquals(70 + start_c, Debug.findFunctionSourceLocation(c, 6, 0).position);
+assertEquals(0 + start_d, Debug.findFunctionSourceLocation(d, 0, 0).position);
+assertEquals(6 + start_d, Debug.findFunctionSourceLocation(d, 1, 0).position);
+for (i = 1; i <= num_lines_d; i++) {
+ assertEquals(6 + (i * line_length_d) + start_d, Debug.findFunctionSourceLocation(d, (i + 1), 0).position);
+}
+assertEquals(158 + start_d, Debug.findFunctionSourceLocation(d, 17, 0).position);
+
+// Make sure invalid inputs work properly.
+assertEquals(0, script.locationFromPosition(-1).line);
+assertEquals(null, script.locationFromPosition(last_position + 1));
+
+// Test last position.
+assertEquals(last_position, script.locationFromPosition(last_position).position);
+assertEquals(last_line, script.locationFromPosition(last_position).line);
+assertEquals(last_column, script.locationFromPosition(last_position).column);
+
+// Test that script.sourceLine(line) works.
+var location;
+
+for (line = 0; line < num_lines_d; line++) {
+ var line_content_regexp = new RegExp(" x = " + (line + 1));
+ assertTrue(line_content_regexp.test(script.sourceLine(start_line_d + line)));
+}
diff --git a/deps/v8/test/mjsunit/debug-step-turbofan.js b/deps/v8/test/mjsunit/debug-step-turbofan.js
index c8c346b2c7..1710942e9a 100644
--- a/deps/v8/test/mjsunit/debug-step-turbofan.js
+++ b/deps/v8/test/mjsunit/debug-step-turbofan.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --turbo-filter=g --allow-natives-syntax
+// Flags: --expose-debug-as debug --turbo-filter=g --allow-natives-syntax
// Test that Debug::PrepareForBreakPoints can deal with turbofan code (g)
// on the stack. Without deoptimization support, we will not be able to
diff --git a/deps/v8/test/mjsunit/debug-stepframe-clearing.js b/deps/v8/test/mjsunit/debug-stepframe-clearing.js
new file mode 100644
index 0000000000..c440e78dd2
--- /dev/null
+++ b/deps/v8/test/mjsunit/debug-stepframe-clearing.js
@@ -0,0 +1,97 @@
+// 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
+
+// This test ensures that IC learning doesn't interfere with stepping into
+// property accessor. f1()'s ICs are allowed to learn to a monomorphic state,
+// and the breakpoints flooding get() are allowed to expire, then we ensure
+// that we can step into get() again later (when k == 1).
+function f1() {
+ for (var k = 0; k < 2; k++) { // Break 1
+ var v10 = 0; // Line 2
+ for (var i = 0; i < 10; i++) { // Line 3
+ var v12 = o.slappy; // Line 4
+ var v13 = 3 // Line 5
+ } // Line 6
+ print("break here"); // Break 3
+ } // Line 8
+ print("exiting f1"); // Line 9 (dummy break)
+}
+
+function get() {
+ var g0 = 0; // Break 2
+ var g1 = 1;
+ return 3;
+}
+
+
+var o = {};
+Object.defineProperty(o, "slappy", { get : get });
+
+Debug = debug.Debug;
+var break_count = 0
+var exception = null;
+var bp_f1_line7;
+var bp_f1_line9;
+
+function listener(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Break) return;
+ try {
+ var line = exec_state.frame(0).sourceLineText();
+ print(line);
+ var match = line.match(/\/\/ Break (\d+)$/);
+ assertEquals(2, match.length);
+ var match_value = parseInt(match[1]);
+
+ if (break_count >= 0 && break_count < 2) {
+ // 0, 1: Keep stepping through frames.
+ assertEquals(break_count, match_value);
+ exec_state.prepareStep(Debug.StepAction.StepFrame, 1);
+ } else if (break_count === 2) {
+ // 2: let the code run to a breakpoint we set. The load should
+ // go monomorphic.
+ assertEquals(break_count, match_value);
+ } else if (break_count === 3) {
+ // 3: back to frame stepping. Does the monomorphic slappy accessor
+ // call still have the ability to break like before?
+ assertEquals(break_count, match_value);
+ Debug.clearBreakPoint(bp_f1_line7);
+ exec_state.prepareStep(Debug.StepAction.StepFrame, 1);
+ } else {
+ assertEquals(4, break_count);
+ assertEquals(2, match_value);
+ // Apparently we can still stop in the accessor even though we cleared
+ // breakpoints earlier and there was a monomorphic step.
+ // Allow running to completion now.
+ Debug.clearBreakPoint(bp_f1_line9);
+ }
+
+ break_count++;
+ } catch (e) {
+ print(e + e.stack);
+ exception = e;
+ }
+}
+
+for (var j = 1; j < 3; j++) {
+ break_count = 0;
+ Debug.setListener(listener);
+
+ // Breakpoints are added here rather than in the listener because their
+ // addition causes a full (clearing) gc that clears type feedback when we
+ // want to let it build up. Also, bp_f1_line9 is set simply because if we
+ // handled then deleted bp_f1_line7, then the debugger clears DebugInfo from
+ // f1 while we are still using it, again, resetting type feedback which is
+ // undesirable.
+ bp_f1_line7 = Debug.setBreakPoint(f1, 7);
+ bp_f1_line9 = Debug.setBreakPoint(f1, 9);
+
+ debugger; // Break 0
+ f1();
+ Debug.setListener(null);
+ assertTrue(break_count === 5);
+}
+
+assertNull(exception);
diff --git a/deps/v8/test/mjsunit/debug-stepin-foreach.js b/deps/v8/test/mjsunit/debug-stepin-foreach.js
index fa728e019c..c2702f794a 100644
--- a/deps/v8/test/mjsunit/debug-stepin-foreach.js
+++ b/deps/v8/test/mjsunit/debug-stepin-foreach.js
@@ -37,15 +37,17 @@ function listener(event, exec_state, event_data, data) {
};
Debug.setListener(listener);
+var bound_callback = callback.bind(null);
debugger; // Break 0.
[1,2].forEach(callback); // Break 1.
+[3,4].forEach(bound_callback); // Break 6.
function callback(x) {
- return x; // Break 2. // Break 4.
-} // Break 3. // Break 5.
+ return x; // Break 2. // Break 4. // Break 7. // Break 9.
+} // Break 3. // Break 5. // Break 8. // Break 10.
-assertNull(exception); // Break 6.
+assertNull(exception); // Break 11.
assertEquals(expected_breaks, break_count);
Debug.setListener(null);
diff --git a/deps/v8/test/mjsunit/harmony/block-conflicts.js b/deps/v8/test/mjsunit/es6/block-conflicts.js
index d19a34a2c3..fdd581dd70 100644
--- a/deps/v8/test/mjsunit/harmony/block-conflicts.js
+++ b/deps/v8/test/mjsunit/es6/block-conflicts.js
@@ -1,8 +1,6 @@
// Copyright 2011 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// Flags: --harmony-scoping
// Test for conflicting variable bindings.
diff --git a/deps/v8/test/mjsunit/es6/block-const-assign.js b/deps/v8/test/mjsunit/es6/block-const-assign.js
new file mode 100644
index 0000000000..f78faa689d
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/block-const-assign.js
@@ -0,0 +1,160 @@
+// 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: --harmony-computed-property-names
+
+// Test that we throw early syntax errors in harmony mode
+// when using an immutable binding in an assigment or with
+// prefix/postfix decrement/increment operators.
+
+"use strict";
+
+const decls = [
+ // Const declaration.
+ function(use) { return "const c = 1; " + use + ";" }, TypeError,
+ function(use) { return "const x = 0, c = 1; " + use + ";" }, TypeError,
+ function(use) { return "const c = 1, x = (" + use + ");" }, TypeError,
+ function(use) { return use + "; const c = 1;" }, ReferenceError,
+ function(use) { return use + "; const x = 0, c = 1;" }, ReferenceError,
+ function(use) { return "const x = (" + use + "), c = 1;" }, ReferenceError,
+ function(use) { return "const c = (" + use + ");" }, ReferenceError,
+
+ // Function expression.
+ function(use) { return "(function c() { " + use + "; })();"; }, TypeError,
+ // TODO(rossberg): Once we have default parameters, test using 'c' there.
+
+ // Class expression.
+ function(use) {
+ return "new class c { constructor() { " + use + " } };";
+ }, TypeError,
+ function(use) {
+ return "(new class c { m() { " + use + " } }).m();";
+ }, TypeError,
+ function(use) {
+ return "(new class c { get a() { " + use + " } }).a;";
+ }, TypeError,
+ function(use) {
+ return "(new class c { set a(x) { " + use + " } }).a = 0;";
+ }, TypeError,
+ function(use) {
+ return "(class c { static m() { " + use + " } }).s();";
+ }, TypeError,
+ function(use) {
+ return "(class c extends (" + use + ") {});";
+ }, ReferenceError,
+ function(use) {
+ return "(class c { [" + use + "]() {} });";
+ }, ReferenceError,
+ function(use) {
+ return "(class c { get [" + use + "]() {} });";
+ }, ReferenceError,
+ function(use) {
+ return "(class c { set [" + use + "](x) {} });";
+ }, ReferenceError,
+ function(use) {
+ return "(class c { static [" + use + "]() {} });";
+ }, ReferenceError,
+
+ // For loop.
+ function(use) {
+ return "for (const c = 0; " + use + ";) {}"
+ }, TypeError,
+ function(use) {
+ return "for (const x = 0, c = 0; " + use + ";) {}"
+ }, TypeError,
+ function(use) {
+ return "for (const c = 0; ; " + use + ") {}"
+ }, TypeError,
+ function(use) {
+ return "for (const x = 0, c = 0; ; " + use + ") {}"
+ }, TypeError,
+ function(use) {
+ return "for (const c = 0; ;) { " + use + "; }"
+ }, TypeError,
+ function(use) {
+ return "for (const x = 0, c = 0; ;) { " + use + "; }"
+ }, TypeError,
+ function(use) {
+ return "for (const c in {a: 1}) { " + use + "; }"
+ }, TypeError,
+ function(use) {
+ return "for (const c of [1]) { " + use + "; }"
+ }, TypeError,
+ function(use) {
+ return "for (const x = (" + use + "), c = 0; ;) {}"
+ }, ReferenceError,
+ function(use) {
+ return "for (const c = (" + use + "); ;) {}"
+ }, ReferenceError,
+]
+
+let uses = [
+ 'c = 1',
+ 'c += 1',
+ '++c',
+ 'c--',
+];
+
+let declcontexts = [
+ function(decl) { return decl; },
+ function(decl) { return "eval(\'" + decl + "\')"; },
+ function(decl) { return "{ " + decl + " }"; },
+ function(decl) { return "(function() { " + decl + " })()"; },
+];
+
+let usecontexts = [
+ function(use) { return use; },
+ function(use) { return "eval(\"" + use + "\")"; },
+ function(use) { return "(function() { " + use + " })()"; },
+ function(use) { return "(function() { eval(\"" + use + "\"); })()"; },
+ function(use) { return "eval(\"(function() { " + use + "; })\")()"; },
+];
+
+function Test(program, error) {
+ program = "'use strict'; " + program;
+ try {
+ print(program, " // throw " + error.name);
+ eval(program);
+ } catch (e) {
+ assertInstanceof(e, error);
+ if (e === TypeError) {
+ assertTrue(e.toString().indexOf("Assignment to constant variable") >= 0);
+ }
+ return;
+ }
+ assertUnreachable();
+}
+
+for (var d = 0; d < decls.length; d += 2) {
+ for (var u = 0; u < uses.length; ++u) {
+ for (var o = 0; o < declcontexts.length; ++o) {
+ for (var i = 0; i < usecontexts.length; ++i) {
+ Test(declcontexts[o](decls[d](usecontexts[i](uses[u]))), decls[d + 1]);
+ }
+ }
+ }
+}
diff --git a/deps/v8/test/mjsunit/harmony/block-early-errors.js b/deps/v8/test/mjsunit/es6/block-early-errors.js
index 8ed5ea84ec..bf24942bb1 100644
--- a/deps/v8/test/mjsunit/harmony/block-early-errors.js
+++ b/deps/v8/test/mjsunit/es6/block-early-errors.js
@@ -25,8 +25,6 @@
// (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: --harmony-scoping
-
function CheckException(e) {
var string = e.toString();
assertInstanceof(e, SyntaxError);
diff --git a/deps/v8/test/mjsunit/harmony/block-for.js b/deps/v8/test/mjsunit/es6/block-for.js
index 110f1ccf45..b91af0116c 100644
--- a/deps/v8/test/mjsunit/harmony/block-for.js
+++ b/deps/v8/test/mjsunit/es6/block-for.js
@@ -24,9 +24,6 @@
// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
// (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: --harmony-scoping
-
"use strict";
function props(x) {
@@ -147,7 +144,7 @@ function closure_in_for_cond() {
assertEquals(k, a[k]());
}
}
-closure_in_for_next();
+closure_in_for_cond();
function closure_in_for_next() {
diff --git a/deps/v8/test/mjsunit/harmony/block-leave.js b/deps/v8/test/mjsunit/es6/block-leave.js
index 87d35b396d..338631b76e 100644
--- a/deps/v8/test/mjsunit/harmony/block-leave.js
+++ b/deps/v8/test/mjsunit/es6/block-leave.js
@@ -25,8 +25,6 @@
// (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: --harmony-scoping
-
"use strict";
// We want to test the context chain shape. In each of the tests cases
diff --git a/deps/v8/test/mjsunit/harmony/block-let-crankshaft.js b/deps/v8/test/mjsunit/es6/block-let-crankshaft.js
index e8e00b200e..9cfdf847fc 100644
--- a/deps/v8/test/mjsunit/harmony/block-let-crankshaft.js
+++ b/deps/v8/test/mjsunit/es6/block-let-crankshaft.js
@@ -25,7 +25,7 @@
// (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: --harmony-scoping --allow-natives-syntax
+// Flags: --allow-natives-syntax
"use strict";
diff --git a/deps/v8/test/mjsunit/harmony/block-let-declaration.js b/deps/v8/test/mjsunit/es6/block-let-declaration.js
index 44a0049a44..5fbb12824b 100644
--- a/deps/v8/test/mjsunit/harmony/block-let-declaration.js
+++ b/deps/v8/test/mjsunit/es6/block-let-declaration.js
@@ -25,8 +25,6 @@
// (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: --harmony-scoping
-
// Test let declarations in various settings.
"use strict";
@@ -70,8 +68,8 @@ TestLocalThrows("do let x; while (false)", SyntaxError);
TestLocalThrows("while (false) let x;", SyntaxError);
TestLocalThrows("label: let x;", SyntaxError);
TestLocalThrows("for (;false;) let x;", SyntaxError);
-TestLocalThrows("switch (true) { case true: let x; }", SyntaxError);
-TestLocalThrows("switch (true) { default: let x; }", SyntaxError);
+TestLocalDoesNotThrow("switch (true) { case true: let x; }");
+TestLocalDoesNotThrow("switch (true) { default: let x; }");
// Test const declarations with initialisers in statement positions.
TestLocalThrows("if (true) const x = 1;", SyntaxError);
@@ -80,8 +78,8 @@ TestLocalThrows("do const x = 1; while (false)", SyntaxError);
TestLocalThrows("while (false) const x = 1;", SyntaxError);
TestLocalThrows("label: const x = 1;", SyntaxError);
TestLocalThrows("for (;false;) const x = 1;", SyntaxError);
-TestLocalThrows("switch (true) { case true: const x = 1; }", SyntaxError);
-TestLocalThrows("switch (true) { default: const x = 1; }", SyntaxError);
+TestLocalDoesNotThrow("switch (true) { case true: const x = 1; }");
+TestLocalDoesNotThrow("switch (true) { default: const x = 1; }");
// Test const declarations without initialisers.
TestLocalThrows("const x;", SyntaxError);
@@ -149,11 +147,11 @@ function f() {
f();
// Test function declarations in statement position in strict mode.
-TestLocalThrows("function f() { if (true) function g() {}", SyntaxError);
-TestLocalThrows("function f() { if (true) {} else function g() {}", SyntaxError);
-TestLocalThrows("function f() { do function g() {} while (false)", SyntaxError);
-TestLocalThrows("function f() { while (false) function g() {}", SyntaxError);
-TestLocalThrows("function f() { label: function g() {}", SyntaxError);
-TestLocalThrows("function f() { for (;false;) function g() {}", SyntaxError);
-TestLocalThrows("function f() { switch (true) { case true: function g() {} }", SyntaxError);
-TestLocalThrows("function f() { switch (true) { default: function g() {} }", SyntaxError);
+TestLocalThrows("function f() { if (true) function g() {} }", SyntaxError);
+TestLocalThrows("function f() { if (true) {} else function g() {} }", SyntaxError);
+TestLocalThrows("function f() { do function g() {} while (false) }", SyntaxError);
+TestLocalThrows("function f() { while (false) function g() {} }", SyntaxError);
+TestLocalThrows("function f() { label: function g() {} }", SyntaxError);
+TestLocalThrows("function f() { for (;false;) function g() {} }", SyntaxError);
+TestLocalDoesNotThrow("function f() { switch (true) { case true: function g() {} } }");
+TestLocalDoesNotThrow("function f() { switch (true) { default: function g() {} } }");
diff --git a/deps/v8/test/mjsunit/harmony/block-let-semantics.js b/deps/v8/test/mjsunit/es6/block-let-semantics.js
index a37b795b0a..b0a826a007 100644
--- a/deps/v8/test/mjsunit/harmony/block-let-semantics.js
+++ b/deps/v8/test/mjsunit/es6/block-let-semantics.js
@@ -25,8 +25,6 @@
// (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: --harmony-scoping
-
"use strict";
// Test temporal dead zone semantics of let bound variables in
diff --git a/deps/v8/test/mjsunit/harmony/block-non-strict-errors.js b/deps/v8/test/mjsunit/es6/block-non-strict-errors.js
index 11fa5c6a52..48cac21141 100644
--- a/deps/v8/test/mjsunit/harmony/block-non-strict-errors.js
+++ b/deps/v8/test/mjsunit/es6/block-non-strict-errors.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-scoping --harmony-classes
+// Flags: --harmony-classes
function CheckError(source) {
var exception = null;
diff --git a/deps/v8/test/mjsunit/harmony/block-scoping.js b/deps/v8/test/mjsunit/es6/block-scoping.js
index 001d9fbfd5..5f481b8bf2 100644
--- a/deps/v8/test/mjsunit/harmony/block-scoping.js
+++ b/deps/v8/test/mjsunit/es6/block-scoping.js
@@ -25,7 +25,7 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-// Flags: --allow-natives-syntax --harmony-scoping
+// Flags: --allow-natives-syntax
// Test functionality of block scopes.
"use strict";
@@ -101,7 +101,8 @@ function f4(one) {
assertEquals(4, eval('z'));
assertEquals(5, eval('u'));
assertEquals(6, eval('v'));
- };
+ }
+ f();
}
}
f4(1);
@@ -122,7 +123,8 @@ function f5(one) {
assertEquals(4, z);
assertEquals(5, u);
assertEquals(6, v);
- };
+ }
+ f();
}
}
f5(1);
diff --git a/deps/v8/test/mjsunit/es6/collections.js b/deps/v8/test/mjsunit/es6/collections.js
index 92cd087839..888b6863c1 100644
--- a/deps/v8/test/mjsunit/es6/collections.js
+++ b/deps/v8/test/mjsunit/es6/collections.js
@@ -51,6 +51,21 @@ function TestValidMapCalls(m) {
assertDoesNotThrow(function () { m.set(new Object) });
assertDoesNotThrow(function () { m.has(new Object) });
assertDoesNotThrow(function () { m.delete(new Object) });
+ assertDoesNotThrow(function () { m.get(undefined) });
+ assertDoesNotThrow(function () { m.get(null) });
+ assertDoesNotThrow(function () { m.get(0) });
+ assertDoesNotThrow(function () { m.get('a-key') });
+ assertDoesNotThrow(function () { m.get(Symbol()) });
+ assertDoesNotThrow(function () { m.has(undefined) });
+ assertDoesNotThrow(function () { m.has(null) });
+ assertDoesNotThrow(function () { m.has(0) });
+ assertDoesNotThrow(function () { m.has('a-key') });
+ assertDoesNotThrow(function () { m.has(Symbol()) });
+ assertDoesNotThrow(function () { m.delete(undefined) });
+ assertDoesNotThrow(function () { m.delete(null) });
+ assertDoesNotThrow(function () { m.delete(0) });
+ assertDoesNotThrow(function () { m.delete('a-key') });
+ assertDoesNotThrow(function () { m.delete(Symbol()) });
}
TestValidMapCalls(new Map);
TestValidMapCalls(new WeakMap);
@@ -58,14 +73,11 @@ TestValidMapCalls(new WeakMap);
// Test invalid getter and setter calls for WeakMap only
function TestInvalidCalls(m) {
- assertThrows(function () { m.get(undefined) }, TypeError);
assertThrows(function () { m.set(undefined, 0) }, TypeError);
- assertThrows(function () { m.get(null) }, TypeError);
assertThrows(function () { m.set(null, 0) }, TypeError);
- assertThrows(function () { m.get(0) }, TypeError);
assertThrows(function () { m.set(0, 0) }, TypeError);
- assertThrows(function () { m.get('a-key') }, TypeError);
assertThrows(function () { m.set('a-key', 0) }, TypeError);
+ assertThrows(function () { m.set(Symbol(), 0) }, TypeError);
}
TestInvalidCalls(new WeakMap);
@@ -73,57 +85,79 @@ TestInvalidCalls(new WeakMap);
// Test expected behavior for Sets and WeakSets
function TestSet(set, key) {
assertFalse(set.has(key));
- assertSame(set, set.add(key));
- assertTrue(set.has(key));
- assertTrue(set.delete(key));
+ assertFalse(set.delete(key));
+ if (typeof key === 'object' && !(set instanceof WeakSet)) {
+ assertSame(set, set.add(key));
+ assertTrue(set.has(key));
+ assertTrue(set.delete(key));
+ }
assertFalse(set.has(key));
assertFalse(set.delete(key));
assertFalse(set.has(key));
}
function TestSetBehavior(set) {
+ // Fill
for (var i = 0; i < 20; i++) {
TestSet(set, new Object);
TestSet(set, i);
TestSet(set, i / 100);
TestSet(set, 'key-' + i);
+ TestSet(set, Symbol(i));
}
- var keys = [ +0, -0, +Infinity, -Infinity, true, false, null, undefined ];
+
+ var keys = [
+ -0, +0, 1, 1/3, 10, +Infinity, -Infinity, NaN, true, false, null, undefined,
+ 'x', Symbol(), {}, function(){}
+ ];
for (var i = 0; i < keys.length; i++) {
TestSet(set, keys[i]);
}
}
TestSetBehavior(new Set);
-TestSet(new WeakSet, new Object);
+TestSetBehavior(new WeakSet);
// Test expected mapping behavior for Maps and WeakMaps
function TestMapping(map, key, value) {
- assertSame(map, map.set(key, value));
- assertSame(value, map.get(key));
+ assertFalse(map.has(key));
+ assertSame(undefined, map.get(key));
+ assertFalse(map.delete(key));
+ if (typeof key === 'object' && !(map instanceof WeakMap)) {
+ assertSame(map, map.set(key, value));
+ assertSame(value, map.get(key));
+ assertTrue(map.has(key));
+ assertTrue(map.delete(key));
+ }
+ assertFalse(map.has(key));
+ assertSame(undefined, map.get(key));
+ assertFalse(map.delete(key));
+ assertFalse(map.has(key));
+ assertSame(undefined, map.get(key));
}
-function TestMapBehavior1(m) {
+function TestMapBehavior(m) {
+ // Fill
TestMapping(m, new Object, 23);
TestMapping(m, new Object, 'the-value');
TestMapping(m, new Object, new Object);
-}
-TestMapBehavior1(new Map);
-TestMapBehavior1(new WeakMap);
-
-
-// Test expected mapping behavior for Maps only
-function TestMapBehavior2(m) {
for (var i = 0; i < 20; i++) {
TestMapping(m, i, new Object);
TestMapping(m, i / 10, new Object);
TestMapping(m, 'key-' + i, new Object);
+ TestMapping(m, Symbol(i), new Object);
}
- // -0 is handled in TestMinusZeroMap
- var keys = [ 0, +Infinity, -Infinity, true, false, null, undefined ];
+
+ var keys = [
+ -0, +0, 1, 1/3, 10, +Infinity, -Infinity, NaN, true, false, null, undefined,
+ 'x', Symbol(), {}, function(){}
+ ];
for (var i = 0; i < keys.length; i++) {
+ TestMapping(m, keys[i], 23);
+ TestMapping(m, keys[i], 'the-value');
TestMapping(m, keys[i], new Object);
}
}
-TestMapBehavior2(new Map);
+TestMapBehavior(new Map);
+TestMapBehavior(new WeakMap);
// Test expected querying behavior of Maps and WeakMaps
@@ -132,8 +166,6 @@ function TestQuery(m) {
var values = [ 'x', 0, +Infinity, -Infinity, true, false, null, undefined ];
for (var i = 0; i < values.length; i++) {
TestMapping(m, key, values[i]);
- assertTrue(m.has(key));
- assertFalse(m.has(new Object));
}
}
TestQuery(new Map);
@@ -144,7 +176,6 @@ TestQuery(new WeakMap);
function TestDelete(m) {
var key = new Object;
TestMapping(m, key, 'to-be-deleted');
- assertTrue(m.delete(key));
assertFalse(m.delete(key));
assertFalse(m.delete(new Object));
assertSame(m.get(key), undefined);
@@ -1190,8 +1221,9 @@ function TestSetConstructorIterableValue(ctor) {
// Strict mode is required to prevent implicit wrapping in the getter.
Object.defineProperty(Number.prototype, Symbol.iterator, {
get: function() {
- assertEquals('object', typeof this);
+ assertEquals('number', typeof this);
return function() {
+ assertEquals('number', typeof this);
return oneAndTwo.keys();
};
},
@@ -1380,8 +1412,9 @@ function TestMapConstructorIterableValue(ctor) {
// Strict mode is required to prevent implicit wrapping in the getter.
Object.defineProperty(Number.prototype, Symbol.iterator, {
get: function() {
- assertEquals('object', typeof this);
+ assertEquals('number', typeof this);
return function() {
+ assertEquals('number', typeof this);
return oneAndTwo.entries();
};
},
@@ -1406,3 +1439,38 @@ TestCollectionToString(Map);
TestCollectionToString(Set);
TestCollectionToString(WeakMap);
TestCollectionToString(WeakSet);
+
+
+function TestConstructorOrderOfAdderIterator(ctor, adderName) {
+ var iterable = new Map();
+ iterable.set({}, {});
+ iterable.set({}, {});
+ var iterableFunction = iterable[Symbol.iterator];
+ Object.defineProperty(iterable, Symbol.iterator, {
+ get: function() {
+ log += 'iterator';
+ return iterableFunction;
+ }
+ });
+
+ var log = '';
+ var adderFunction = ctor.prototype[adderName];
+
+ Object.defineProperty(ctor.prototype, adderName, {
+ get: function() {
+ log += adderName;
+ return adderFunction;
+ }
+ });
+
+ new ctor(iterable);
+ assertEquals(adderName + 'iterator', log);
+
+ Object.defineProperty(ctor.prototype, adderName, {
+ value: adderFunction
+ });
+}
+TestConstructorOrderOfAdderIterator(Map, 'set');
+TestConstructorOrderOfAdderIterator(Set, 'add');
+TestConstructorOrderOfAdderIterator(WeakMap, 'set');
+TestConstructorOrderOfAdderIterator(WeakSet, 'add');
diff --git a/deps/v8/test/mjsunit/harmony/debug-blockscopes.js b/deps/v8/test/mjsunit/es6/debug-blockscopes.js
index 8180377e6d..9f5d13e900 100644
--- a/deps/v8/test/mjsunit/harmony/debug-blockscopes.js
+++ b/deps/v8/test/mjsunit/es6/debug-blockscopes.js
@@ -25,7 +25,7 @@
// (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 --harmony-scoping
+// Flags: --expose-debug-as debug
// The functions used for testing backtraces. They are at the top to make the
// testing of source line/column easier.
diff --git a/deps/v8/test/mjsunit/harmony/debug-evaluate-blockscopes.js b/deps/v8/test/mjsunit/es6/debug-evaluate-blockscopes.js
index d133cc07ce..e24ca78315 100644
--- a/deps/v8/test/mjsunit/harmony/debug-evaluate-blockscopes.js
+++ b/deps/v8/test/mjsunit/es6/debug-evaluate-blockscopes.js
@@ -25,7 +25,7 @@
// (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 --harmony-scoping
+// Flags: --expose-debug-as debug
// Test debug evaluation for functions without local context, but with
// nested catch contexts.
diff --git a/deps/v8/test/mjsunit/harmony/debug-function-scopes.js b/deps/v8/test/mjsunit/es6/debug-function-scopes.js
index 1b380c2b84..699bd5343d 100644
--- a/deps/v8/test/mjsunit/harmony/debug-function-scopes.js
+++ b/deps/v8/test/mjsunit/es6/debug-function-scopes.js
@@ -25,7 +25,7 @@
// (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 --harmony-scoping
+// Flags: --expose-debug-as debug
"use strict";
let top_level_let = 255;
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/resolve-after-aborted-try-finally.js b/deps/v8/test/mjsunit/es6/debug-promises/resolve-after-aborted-try-finally.js
new file mode 100644
index 0000000000..918ae2a2e8
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/debug-promises/resolve-after-aborted-try-finally.js
@@ -0,0 +1,32 @@
+// 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 events = [];
+
+function listener(event, exec_state, event_data, data) {
+ if (event == Debug.DebugEvent.PromiseEvent) events.push(event_data.status());
+}
+
+Debug.setListener(listener);
+
+var p = new Promise(function(resolve, reject) {
+ do {
+ try {
+ throw new Error("reject");
+ } finally {
+ break; // No rethrow.
+ }
+ } while (false);
+ resolve();
+});
+
+assertEquals([0 /* create */, 1 /* resolve */], events);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/resolve-after-try-catch.js b/deps/v8/test/mjsunit/es6/debug-promises/resolve-after-try-catch.js
new file mode 100644
index 0000000000..298201f103
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/debug-promises/resolve-after-try-catch.js
@@ -0,0 +1,29 @@
+// 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 events = [];
+
+function listener(event, exec_state, event_data, data) {
+ if (event == Debug.DebugEvent.PromiseEvent) events.push(event_data.status());
+}
+
+Debug.setListener(listener);
+
+var p = new Promise(function (resolve, reject) {
+ try {
+ throw new Error("reject");
+ } catch (e) {
+ }
+ resolve();
+});
+
+assertEquals([0 /* create */, 1 /* resolve */], events);
diff --git a/deps/v8/test/mjsunit/es6/debug-promises/rethrow-in-try-finally.js b/deps/v8/test/mjsunit/es6/debug-promises/rethrow-in-try-finally.js
new file mode 100644
index 0000000000..b1e2ff98e1
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/debug-promises/rethrow-in-try-finally.js
@@ -0,0 +1,30 @@
+// 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 events = [];
+
+function listener(event, exec_state, event_data, data) {
+ if (event == Debug.DebugEvent.PromiseEvent) events.push(event_data.status());
+}
+
+Debug.setListener(listener);
+
+var p = new Promise(function(resolve, reject) {
+ try {
+ throw new Error("reject");
+ } finally {
+ // Implicit rethrow.
+ }
+ resolve();
+});
+
+assertEquals([0 /* create */, -1 /* rethrown */], events);
diff --git a/deps/v8/test/mjsunit/es6/debug-stepin-promises.js b/deps/v8/test/mjsunit/es6/debug-stepin-promises.js
new file mode 100644
index 0000000000..8548a2badd
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/debug-stepin-promises.js
@@ -0,0 +1,65 @@
+// 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 --noalways-opt
+// Tests stepping into through Promises.
+
+Debug = debug.Debug
+var exception = null;
+var break_count = 0;
+var expected_breaks = -1;
+
+function listener(event, exec_state, event_data, data) {
+ try {
+ if (event == Debug.DebugEvent.Break) {
+ assertTrue(exec_state.frameCount() != 0, "FAIL: Empty stack trace");
+ if (!break_count) {
+ // Count number of expected breakpoints in this source file.
+ var source_text = exec_state.frame(0).func().script().source();
+ expected_breaks = source_text.match(/\/\/\s*Break\s+\d+\./g).length;
+ print("Expected breaks: " + expected_breaks);
+ }
+ 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 + ".");
+ ++break_count;
+ if (break_count !== expected_breaks) {
+ exec_state.prepareStep(Debug.StepAction.StepIn, 1);
+ }
+ }
+ } catch(e) {
+ exception = e;
+ print(e, e.stack);
+ }
+};
+
+Debug.setListener(listener);
+
+Promise.resolve(42)
+ .then(
+ function f0() {
+ debugger; // Break 0.
+ } // Break 1.
+ )
+ .then(callback)
+ .then(callback.bind(null))
+ .then(Object)
+ .then(callback.bind(null).bind(null))
+ .then(finalize)
+ .catch(function(err) {
+ %AbortJS("FAIL: " + err);
+ });
+
+function callback(x) {
+ return x; // Break 2. // Break 4. // Break 6.
+} // Break 3. // Break 5. // Break 7.
+
+function finalize() {
+ assertNull(exception); // Break 8.
+ assertEquals(expected_breaks, break_count);
+
+ Debug.setListener(null);
+}
diff --git a/deps/v8/test/mjsunit/harmony/empty-for.js b/deps/v8/test/mjsunit/es6/empty-for.js
index 02211260ff..dad892d328 100644
--- a/deps/v8/test/mjsunit/harmony/empty-for.js
+++ b/deps/v8/test/mjsunit/es6/empty-for.js
@@ -25,8 +25,6 @@
// (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: --harmony-scoping
-
"use strict";
function for_const() {
diff --git a/deps/v8/test/mjsunit/es6/function-length-configurable.js b/deps/v8/test/mjsunit/es6/function-length-configurable.js
new file mode 100644
index 0000000000..e5b51aba20
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/function-length-configurable.js
@@ -0,0 +1,119 @@
+// 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.
+
+function getStrictF() {
+ 'use strict';
+ return function f(x) {};
+}
+
+
+function getSloppyF() {
+ return function f(x) {};
+}
+
+
+function getStrictGenerator() {
+ 'use strict';
+ return function* f(x) {};
+}
+
+
+function getSloppyGenerator() {
+ return function* f(x) {};
+}
+
+
+function test(testFunction) {
+ testFunction(getStrictF());
+ testFunction(getSloppyF());
+ testFunction(getStrictGenerator());
+ testFunction(getSloppyGenerator());
+}
+
+
+function testDescriptor(f) {
+ var descr = Object.getOwnPropertyDescriptor(f, 'length');
+ assertTrue(descr.configurable);
+ assertFalse(descr.enumerable);
+ assertEquals(1, descr.value);
+ assertFalse(descr.writable);
+}
+test(testDescriptor);
+
+
+function testSet(f) {
+ f.length = 2;
+ assertEquals(1, f.length);
+}
+test(testSet);
+
+
+function testSetStrict(f) {
+ 'use strict';
+ assertThrows(function() {
+ f.length = 2;
+ }, TypeError);
+}
+test(testSetStrict);
+
+
+function testReconfigureAsDataProperty(f) {
+ Object.defineProperty(f, 'length', {
+ value: 2,
+ });
+ assertEquals(2, f.length);
+ Object.defineProperty(f, 'length', {
+ writable: true
+ });
+ f.length = 3;
+ assertEquals(3, f.length);
+
+ f.length = 42;
+ assertEquals(42, f.length);
+}
+test(testReconfigureAsDataProperty);
+
+
+function testReconfigureAsAccessorProperty(f) {
+ var length = 2;
+ Object.defineProperty(f, 'length', {
+ get: function() { return length; },
+ set: function(v) { length = v; }
+ });
+ assertEquals(2, f.length);
+ f.length = 3;
+ assertEquals(3, f.length);
+}
+test(testReconfigureAsAccessorProperty);
+
+
+(function testSetOnInstance() {
+ // This needs to come before testDelete below
+ assertTrue(Function.prototype.hasOwnProperty('length'));
+
+ function f() {}
+ delete f.length;
+ assertEquals(0, f.length);
+
+ f.length = 42;
+ assertEquals(0, f.length); // non writable prototype property.
+ assertFalse(f.hasOwnProperty('length'));
+
+ Object.defineProperty(Function.prototype, 'length', {writable: true});
+
+ f.length = 123;
+ assertTrue(f.hasOwnProperty('length'));
+ assertEquals(123, f.length);
+})();
+
+
+(function testDelete() {
+ function f(x) {}
+ assertTrue(delete f.length);
+ assertFalse(f.hasOwnProperty('length'));
+ assertEquals(0, f.length);
+
+ assertTrue(delete Function.prototype.length);
+ assertEquals(undefined, f.length);
+})();
diff --git a/deps/v8/test/mjsunit/es6/function-name-configurable.js b/deps/v8/test/mjsunit/es6/function-name-configurable.js
new file mode 100644
index 0000000000..f0ff406da8
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/function-name-configurable.js
@@ -0,0 +1,115 @@
+// 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.
+
+function getStrictF() {
+ 'use strict';
+ return function f() {};
+}
+
+
+function getSloppyF() {
+ return function f() {};
+}
+
+
+function test(testFunction) {
+ testFunction(getStrictF());
+ testFunction(getSloppyF());
+}
+
+
+function testDescriptor(f) {
+ var descr = Object.getOwnPropertyDescriptor(f, 'name');
+ assertTrue(descr.configurable);
+ assertFalse(descr.enumerable);
+ assertEquals('f', descr.value);
+ assertFalse(descr.writable);
+}
+test(testDescriptor);
+
+
+function testSet(f) {
+ f.name = 'g';
+ assertEquals('f', f.name);
+}
+test(testSet);
+
+
+function testSetStrict(f) {
+ 'use strict';
+ assertThrows(function() {
+ f.name = 'g';
+ }, TypeError);
+}
+test(testSetStrict);
+
+
+function testReconfigureAsDataProperty(f) {
+ Object.defineProperty(f, 'name', {
+ value: 'g',
+ });
+ assertEquals('g', f.name);
+ Object.defineProperty(f, 'name', {
+ writable: true
+ });
+ f.name = 'h';
+ assertEquals('h', f.name);
+
+ f.name = 42;
+ assertEquals(42, f.name);
+}
+test(testReconfigureAsDataProperty);
+
+
+function testReconfigureAsAccessorProperty(f) {
+ var name = 'g';
+ Object.defineProperty(f, 'name', {
+ get: function() { return name; },
+ set: function(v) { name = v; }
+ });
+ assertEquals('g', f.name);
+ f.name = 'h';
+ assertEquals('h', f.name);
+}
+test(testReconfigureAsAccessorProperty);
+
+
+function testFunctionToString(f) {
+ Object.defineProperty(f, 'name', {
+ value: {toString: function() { assertUnreachable(); }},
+ });
+ assertEquals('function f() {}', f.toString());
+}
+test(testFunctionToString);
+
+
+(function testSetOnInstance() {
+ // This needs to come before testDelete below
+ assertTrue(Function.prototype.hasOwnProperty('name'));
+
+ function f() {}
+ delete f.name;
+ assertEquals('Empty', f.name);
+
+ f.name = 42;
+ assertEquals('Empty', f.name); // non writable prototype property.
+ assertFalse(f.hasOwnProperty('name'));
+
+ Object.defineProperty(Function.prototype, 'name', {writable: true});
+
+ f.name = 123;
+ assertTrue(f.hasOwnProperty('name'));
+ assertEquals(123, f.name);
+})();
+
+
+(function testDelete() {
+ function f() {}
+ assertTrue(delete f.name);
+ assertFalse(f.hasOwnProperty('name'));
+ assertEquals('Empty', f.name);
+
+ assertTrue(delete Function.prototype.name);
+ assertEquals(undefined, f.name);
+})();
diff --git a/deps/v8/test/mjsunit/es6/generators-debug-liveedit.js b/deps/v8/test/mjsunit/es6/generators-debug-liveedit.js
index 6f0c443afc..987a42c41c 100644
--- a/deps/v8/test/mjsunit/es6/generators-debug-liveedit.js
+++ b/deps/v8/test/mjsunit/es6/generators-debug-liveedit.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --expose-debug-as debug
+// Flags: --expose-debug-as debug --allow-natives-syntax
var Debug = debug.Debug;
var LiveEdit = Debug.LiveEdit;
@@ -54,7 +54,7 @@ function patch(fun, from, to) {
print("Change log: " + JSON.stringify(log) + "\n");
}
}
- Debug.ExecuteInDebugContext(debug, false);
+ %ExecuteInDebugContext(debug);
}
// Try to edit a MakeGenerator while it's running, then again while it's
diff --git a/deps/v8/test/mjsunit/es6/generators-objects.js b/deps/v8/test/mjsunit/es6/generators-objects.js
index 8039ca8bb1..5112443ea0 100644
--- a/deps/v8/test/mjsunit/es6/generators-objects.js
+++ b/deps/v8/test/mjsunit/es6/generators-objects.js
@@ -25,7 +25,7 @@
// (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: --harmony-scoping --allow-natives-syntax --harmony-tostring
+// Flags: --allow-natives-syntax --harmony-tostring
// Test instantations of generators.
diff --git a/deps/v8/test/mjsunit/es6/indexed-integer-exotics.js b/deps/v8/test/mjsunit/es6/indexed-integer-exotics.js
new file mode 100644
index 0000000000..7aefd78c4f
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/indexed-integer-exotics.js
@@ -0,0 +1,63 @@
+// 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
+
+Object.prototype["10"] = "unreachable";
+Object.prototype["7"] = "unreachable";
+Object.prototype["-1"] = "unreachable";
+Object.prototype["-0"] = "unreachable";
+Object.prototype["4294967296"] = "unreachable";
+
+var array = new Int32Array(10);
+
+function check() {
+ for (var i = 0; i < 4; i++) {
+ assertEquals(undefined, array["-1"]);
+ assertEquals(undefined, array["-0"]);
+ assertEquals(undefined, array["10"]);
+ assertEquals(undefined, array["4294967296"]);
+ }
+ assertEquals("unreachable", array.__proto__["-1"]);
+ assertEquals("unreachable", array.__proto__["-0"]);
+ assertEquals("unreachable", array.__proto__["10"]);
+ assertEquals("unreachable", array.__proto__["4294967296"]);
+}
+
+check();
+
+array["-1"] = "unreachable";
+array["-0"] = "unreachable";
+array["10"] = "unreachable";
+array["4294967296"] = "unreachable";
+
+check();
+
+delete array["-0"];
+delete array["-1"];
+delete array["10"];
+delete array["4294967296"];
+
+assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "-1"));
+assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "-0"));
+assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "10"));
+assertEquals(undefined, Object.getOwnPropertyDescriptor(array, "4294967296"));
+assertEquals(10, Object.keys(array).length);
+
+check();
+
+function f() { return array["-1"]; }
+
+for (var i = 0; i < 3; i++) {
+ assertEquals(undefined, f());
+}
+%OptimizeFunctionOnNextCall(f);
+assertEquals(undefined, f());
+
+Object.defineProperty(new Int32Array(), "-1", {'value': 1});
+Object.defineProperty(new Int32Array(), "-0", {'value': 1});
+Object.defineProperty(new Int32Array(), "-10", {'value': 1});
+Object.defineProperty(new Int32Array(), "4294967296", {'value': 1});
+
+check();
diff --git a/deps/v8/test/mjsunit/es6/iteration-semantics.js b/deps/v8/test/mjsunit/es6/iteration-semantics.js
index 544c94d915..f29e6e011b 100644
--- a/deps/v8/test/mjsunit/es6/iteration-semantics.js
+++ b/deps/v8/test/mjsunit/es6/iteration-semantics.js
@@ -25,7 +25,7 @@
// (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: --harmony-scoping --harmony-proxies
+// Flags: --harmony-proxies
// Test for-of semantics.
@@ -200,9 +200,11 @@ assertEquals([undefined, 1, 2, 3],
// Done.
{ value: 4, done: 42 }])));
// Results that are not objects.
-assertEquals([undefined, undefined, undefined],
- fold(append, [],
- results([10, "foo", /qux/, { value: 37, done: true }])));
+assertThrows(function() {
+ assertEquals([undefined, undefined, undefined],
+ fold(append, [],
+ results([10, "foo", /qux/, { value: 37, done: true }])));
+}, TypeError);
// Getters (shudder).
assertEquals([1, 2],
fold(append, [],
@@ -334,3 +336,25 @@ function poison_proxy_after(iterable, n) {
}));
}
assertEquals(45, fold(sum, 0, poison_proxy_after(integers_until(10), 10)));
+
+
+function test_iterator_result_object_non_object(value, descr) {
+ var arr = [];
+ var ex;
+ var message = 'Iterator result ' + (descr || value) + ' is not an object';
+ try {
+ fold(append, arr,
+ results([{value: 1}, {}, value, {value: 2}, {done: true}]));
+ } catch (e) {
+ ex = e;
+ }
+ assertInstanceof(ex, TypeError);
+ assertEquals(message, ex.message);
+ assertArrayEquals([1, undefined], arr);
+}
+test_iterator_result_object_non_object(null);
+test_iterator_result_object_non_object(undefined);
+test_iterator_result_object_non_object(42);
+test_iterator_result_object_non_object('abc');
+test_iterator_result_object_non_object(false);
+test_iterator_result_object_non_object(Symbol('x'), 'Symbol(x)');
diff --git a/deps/v8/test/mjsunit/es6/iteration-syntax.js b/deps/v8/test/mjsunit/es6/iteration-syntax.js
index 4be94c5db4..c6a7d477bc 100644
--- a/deps/v8/test/mjsunit/es6/iteration-syntax.js
+++ b/deps/v8/test/mjsunit/es6/iteration-syntax.js
@@ -25,8 +25,6 @@
// (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: --harmony-scoping
-
// Test for-of syntax.
"use strict";
diff --git a/deps/v8/test/mjsunit/es6/map-minus-zero.js b/deps/v8/test/mjsunit/es6/map-minus-zero.js
new file mode 100644
index 0000000000..f9f397ec5c
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/map-minus-zero.js
@@ -0,0 +1,51 @@
+// 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.
+
+'use strict';
+
+var map = new Map();
+
+var objectKey = {};
+var stringKey = 'keykeykey';
+var numberKey = 42.24;
+var booleanKey = true;
+var undefinedKey = undefined;
+var nullKey = null;
+var nanKey = NaN;
+var zeroKey = 0;
+var minusZeroKey = -0;
+
+assertEquals(map.size, 0);
+
+map.set(objectKey, 'aaa');
+map.set(stringKey, 'bbb');
+map.set(numberKey, 'ccc');
+map.set(booleanKey, 'ddd');
+map.set(undefinedKey, 'eee');
+map.set(nullKey, 'fff');
+map.set(nanKey, 'ggg');
+map.set(zeroKey, 'hhh');
+
+assertEquals(8, map.size);
+
+assertEquals('aaa', map.get(objectKey));
+assertEquals('bbb', map.get(stringKey));
+assertEquals('ccc', map.get(numberKey));
+assertEquals('ddd', map.get(booleanKey));
+assertEquals('eee', map.get(undefinedKey));
+assertEquals('fff', map.get(nullKey));
+assertEquals('ggg', map.get(nanKey));
+assertEquals('hhh', map.get(zeroKey));
+
+assertEquals(undefined, map.get({}));
+assertEquals('bbb', map.get('keykeykey'));
+assertEquals('ccc', map.get(42.24));
+assertEquals('ddd', map.get(true));
+assertEquals('eee', map.get(undefined));
+assertEquals('fff', map.get(null));
+assertEquals('ggg', map.get(NaN));
+assertEquals('hhh', map.get(0));
+assertEquals('hhh', map.get(-0));
+assertEquals('hhh', map.get(1 / Infinity));
+assertEquals('hhh', map.get(-1 / Infinity));
diff --git a/deps/v8/test/mjsunit/es6/promises.js b/deps/v8/test/mjsunit/es6/promises.js
index 04059aa720..63b6d2f94a 100644
--- a/deps/v8/test/mjsunit/es6/promises.js
+++ b/deps/v8/test/mjsunit/es6/promises.js
@@ -32,6 +32,8 @@ var call = Function.prototype.call.call.bind(Function.prototype.call)
var observe = Object.observe;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var defineProperty = Object.defineProperty;
+var numberPrototype = Number.prototype;
+var symbolIterator = Symbol.iterator;
(function() {
@@ -637,14 +639,6 @@ function assertAsyncDone(iteration) {
})();
(function() {
- Promise.all({}).chain(
- assertUnreachable,
- function(r) { assertAsync(r instanceof TypeError, "all/no-array") }
- )
- assertAsyncRan()
-})();
-
-(function() {
Promise.all([]).chain(
function(x) { assertAsync(x.length === 0, "all/resolve/empty") },
assertUnreachable
@@ -653,6 +647,45 @@ function assertAsyncDone(iteration) {
})();
(function() {
+ function testPromiseAllNonIterable(value) {
+ Promise.all(value).chain(
+ assertUnreachable,
+ function(r) {
+ assertAsync(r instanceof TypeError, 'all/non iterable');
+ });
+ assertAsyncRan();
+ }
+ testPromiseAllNonIterable(null);
+ testPromiseAllNonIterable(undefined);
+ testPromiseAllNonIterable({});
+ testPromiseAllNonIterable(42);
+})();
+
+(function() {
+ var deferred = Promise.defer();
+ var p = deferred.promise;
+ function* f() {
+ yield 1;
+ yield p;
+ yield 3;
+ }
+ Promise.all(f()).chain(
+ function(x) {
+ assertAsync(x.length === 3, "all/resolve/iterable");
+ assertAsync(x[0] === 1, "all/resolve/iterable/0");
+ assertAsync(x[1] === 2, "all/resolve/iterable/1");
+ assertAsync(x[2] === 3, "all/resolve/iterable/2");
+ },
+ assertUnreachable);
+ deferred.resolve(2);
+ assertAsyncRan();
+ assertAsyncRan();
+ assertAsyncRan();
+ assertAsyncRan();
+})();
+
+
+(function() {
var deferred1 = Promise.defer()
var p1 = deferred1.promise
var deferred2 = Promise.defer()
@@ -706,6 +739,52 @@ function assertAsyncDone(iteration) {
assertAsyncRan()
})();
+
+(function() {
+ 'use strict';
+ var getCalls = 0;
+ var funcCalls = 0;
+ var nextCalls = 0;
+ defineProperty(numberPrototype, symbolIterator, {
+ get: function() {
+ assertEquals('number', typeof this);
+ getCalls++;
+ return function() {
+ assertEquals('number', typeof this);
+ funcCalls++;
+ var n = this;
+ var i = 0
+ return {
+ next() {
+ nextCalls++;
+ return {value: i++, done: i > n};
+ }
+ };
+ };
+ },
+ configurable: true
+ });
+
+ Promise.all(3).chain(
+ function(x) {
+ assertAsync(x.length === 3, "all/iterable/number/length");
+ assertAsync(x[0] === 0, "all/iterable/number/0");
+ assertAsync(x[1] === 1, "all/iterable/number/1");
+ assertAsync(x[2] === 2, "all/iterable/number/2");
+ },
+ assertUnreachable);
+ delete numberPrototype[symbolIterator];
+
+ assertEquals(getCalls, 1);
+ assertEquals(funcCalls, 1);
+ assertEquals(nextCalls, 3 + 1); // + 1 for {done: true}
+ assertAsyncRan();
+ assertAsyncRan();
+ assertAsyncRan();
+ assertAsyncRan();
+})();
+
+
(function() {
Promise.race([]).chain(
assertUnreachable,
@@ -736,14 +815,6 @@ function assertAsyncDone(iteration) {
})();
(function() {
- Promise.race({}).chain(
- assertUnreachable,
- function(r) { assertAsync(r instanceof TypeError, "one/no-array") }
- )
- assertAsyncRan()
-})();
-
-(function() {
var deferred1 = Promise.defer()
var p1 = deferred1.promise
var deferred2 = Promise.defer()
@@ -804,6 +875,103 @@ function assertAsyncDone(iteration) {
assertAsyncRan()
})();
+
+(function() {
+ function testPromiseRaceNonIterable(value) {
+ Promise.race(value).chain(
+ assertUnreachable,
+ function(r) {
+ assertAsync(r instanceof TypeError, 'race/non iterable');
+ });
+ assertAsyncRan();
+ }
+ testPromiseRaceNonIterable(null);
+ testPromiseRaceNonIterable(undefined);
+ testPromiseRaceNonIterable({});
+ testPromiseRaceNonIterable(42);
+})();
+
+
+(function() {
+ var deferred1 = Promise.defer()
+ var p1 = deferred1.promise
+ var deferred2 = Promise.defer()
+ var p2 = deferred2.promise
+ var deferred3 = Promise.defer()
+ var p3 = deferred3.promise
+ function* f() {
+ yield p1;
+ yield p2;
+ yield p3;
+ }
+ Promise.race(f()).chain(
+ function(x) { assertAsync(x === 3, "race/iterable/resolve/reject") },
+ assertUnreachable
+ )
+ deferred3.resolve(3)
+ deferred1.reject(1)
+ assertAsyncRan()
+})();
+
+(function() {
+ var deferred1 = Promise.defer()
+ var p1 = deferred1.promise
+ var deferred2 = Promise.defer()
+ var p2 = deferred2.promise
+ var deferred3 = Promise.defer()
+ var p3 = deferred3.promise
+ function* f() {
+ yield p1;
+ yield p2;
+ yield p3;
+ }
+ Promise.race(f()).chain(
+ assertUnreachable,
+ function(x) { assertAsync(x === 3, "race/iterable/reject/resolve") }
+ )
+ deferred3.reject(3)
+ deferred1.resolve(1)
+ assertAsyncRan()
+})();
+
+(function() {
+ 'use strict';
+ var getCalls = 0;
+ var funcCalls = 0;
+ var nextCalls = 0;
+ defineProperty(numberPrototype, symbolIterator, {
+ get: function() {
+ assertEquals('number', typeof this);
+ getCalls++;
+ return function() {
+ assertEquals('number', typeof this);
+ funcCalls++;
+ var n = this;
+ var i = 0
+ return {
+ next() {
+ nextCalls++;
+ return {value: i++, done: i > n};
+ }
+ };
+ };
+ },
+ configurable: true
+ });
+
+ Promise.race(3).chain(
+ function(x) {
+ assertAsync(x === 0, "race/iterable/number");
+ },
+ assertUnreachable);
+ delete numberPrototype[symbolIterator];
+
+ assertEquals(getCalls, 1);
+ assertEquals(funcCalls, 1);
+ assertEquals(nextCalls, 3 + 1); // + 1 for {done: true}
+ assertAsyncRan();
+})();
+
(function() {
var log
function MyPromise(resolver) {
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-2243.js b/deps/v8/test/mjsunit/es6/regress/regress-2243.js
index e2411d241b..d5377cfd54 100644
--- a/deps/v8/test/mjsunit/harmony/regress/regress-2243.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-2243.js
@@ -25,7 +25,5 @@
// (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: --harmony-scoping
-
assertThrows("'use strict'; (function f() { f = 123; })()", TypeError);
assertThrows("(function f() { 'use strict'; f = 123; })()", TypeError);
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-2322.js b/deps/v8/test/mjsunit/es6/regress/regress-2322.js
index 1195bab67c..6eca046397 100644
--- a/deps/v8/test/mjsunit/harmony/regress/regress-2322.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-2322.js
@@ -25,8 +25,6 @@
// (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: --harmony-scoping
-
"use strict";
assertThrows("'use strict'; for (let x in x);", ReferenceError);
diff --git a/deps/v8/test/mjsunit/regress/regress-2506.js b/deps/v8/test/mjsunit/es6/regress/regress-2506.js
index 0eb2770e59..b5cc91dbd7 100644
--- a/deps/v8/test/mjsunit/regress/regress-2506.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-2506.js
@@ -1,8 +1,6 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// Flags: --harmony-scoping
'use strict';
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-2858.js b/deps/v8/test/mjsunit/es6/regress/regress-2858.js
index 4ce9478497..3b54b17da0 100644
--- a/deps/v8/test/mjsunit/harmony/regress/regress-2858.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-2858.js
@@ -1,8 +1,6 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// Flags: --harmony-scoping
"use strict";
function f() {
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-3426.js b/deps/v8/test/mjsunit/es6/regress/regress-3426.js
index c3b11a1792..fd4903b1f8 100644
--- a/deps/v8/test/mjsunit/harmony/regress/regress-3426.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-3426.js
@@ -2,6 +2,4 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-scoping
-
assertThrows("(function() { 'use strict'; { let f; var f; } })", SyntaxError);
diff --git a/deps/v8/test/mjsunit/regress/regress-347906.js b/deps/v8/test/mjsunit/es6/regress/regress-347906.js
index c751618928..daa62f5df7 100644
--- a/deps/v8/test/mjsunit/regress/regress-347906.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-347906.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --allow-natives-syntax --harmony
+// Flags: --allow-natives-syntax
function foo() {
return Math.clz32(12.34);
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-3683.js b/deps/v8/test/mjsunit/es6/regress/regress-3683.js
index a00d82bd1f..2c18632719 100644
--- a/deps/v8/test/mjsunit/harmony/regress/regress-3683.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-3683.js
@@ -1,8 +1,6 @@
// Copyright 2014 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// Flags: --harmony-scoping
"use strict";
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-3741.js b/deps/v8/test/mjsunit/es6/regress/regress-3741.js
index 8a9dd9e09c..0c5074a0f8 100644
--- a/deps/v8/test/mjsunit/harmony/regress/regress-3741.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-3741.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
-// Flags: --harmony-scoping --allow-natives-syntax
+// Flags: --allow-natives-syntax
'use strict';
function f24(deopt) {
let x = 1;
diff --git a/deps/v8/test/mjsunit/es6/regress/regress-3938.js b/deps/v8/test/mjsunit/es6/regress/regress-3938.js
new file mode 100644
index 0000000000..bd7d1befa1
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/regress/regress-3938.js
@@ -0,0 +1,8 @@
+// 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.
+
+'use strict';
+
+assertThrows(function() { for (const i = 0; ; i++) {} }, TypeError);
+assertThrows("'use strict'; for (const i = 0; ; i++) {}", TypeError);
diff --git a/deps/v8/test/mjsunit/regress/regress-411237.js b/deps/v8/test/mjsunit/es6/regress/regress-411237.js
index 8b75ba3015..ece6481737 100644
--- a/deps/v8/test/mjsunit/regress/regress-411237.js
+++ b/deps/v8/test/mjsunit/es6/regress/regress-411237.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --allow-natives-syntax --harmony
+// Flags: --allow-natives-syntax
try {
%OptimizeFunctionOnNextCall(print);
diff --git a/deps/v8/test/mjsunit/es6/regress/regress-468661.js b/deps/v8/test/mjsunit/es6/regress/regress-468661.js
new file mode 100644
index 0000000000..656190da0b
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/regress/regress-468661.js
@@ -0,0 +1,75 @@
+// 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;
+
+var expected_values =
+ [ReferenceError, ReferenceError, 0, 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");
+ // Count number of expected breakpoints in this source file.
+ if (!break_count) {
+ var source_text = exec_state.frame(0).func().script().source();
+ expected_breaks = source_text.match(/\/\/\s*Break\s+\d+\./g).length;
+ print("Expected breaks: " + expected_breaks);
+ }
+ 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, 1);
+ 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 3. // Break 6. // Break 7.
+ i++) {
+ let key = i; // Break 4.
+ sum += key; // Break 5.
+ }
+}()); // Break 8.
+
+assertNull(exception); // Break 9.
+assertEquals(expected_breaks, break_count);
+
+Debug.setListener(null);
diff --git a/deps/v8/test/mjsunit/es6/regress/regress-474783.js b/deps/v8/test/mjsunit/es6/regress/regress-474783.js
new file mode 100644
index 0000000000..e258dcb49f
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/regress/regress-474783.js
@@ -0,0 +1,24 @@
+// 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.
+
+
+"use strict";
+class Base {
+}
+class Subclass extends Base {
+ constructor(a,b,c) {
+ arguments[1];
+ }
+}
+assertThrows(function() { Subclass(); }, TypeError);
+assertThrows(function() { Subclass(1); }, TypeError);
+assertThrows(function() { Subclass(1, 2); }, TypeError);
+assertThrows(function() { Subclass(1, 2, 3); }, TypeError);
+assertThrows(function() { Subclass(1, 2, 3, 4); }, TypeError);
+
+assertThrows(function() { Subclass.call(); }, TypeError);
+assertThrows(function() { Subclass.call({}); }, TypeError);
+assertThrows(function() { Subclass.call({}, 1); }, TypeError);
+assertThrows(function() { Subclass.call({}, 1, 2); }, TypeError);
+assertThrows(function() { Subclass.call({}, 1, 2, 3, 4); }, TypeError);
diff --git a/deps/v8/test/mjsunit/es6/set-minus-zero.js b/deps/v8/test/mjsunit/es6/set-minus-zero.js
new file mode 100644
index 0000000000..792332c648
--- /dev/null
+++ b/deps/v8/test/mjsunit/es6/set-minus-zero.js
@@ -0,0 +1,51 @@
+// 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.
+
+'use strict';
+
+var set = new Set();
+
+var objectKey = {};
+var stringKey = 'keykeykey';
+var numberKey = 42.24;
+var booleanKey = true;
+var undefinedKey = undefined;
+var nullKey = null;
+var nanKey = NaN;
+var zeroKey = 0;
+var minusZeroKey = -0;
+
+assertEquals(set.size, 0);
+
+set.add(objectKey);
+set.add(stringKey);
+set.add(numberKey);
+set.add(booleanKey);
+set.add(undefinedKey);
+set.add(nullKey);
+set.add(nanKey);
+set.add(zeroKey);
+
+assertEquals(8, set.size);
+
+assertTrue(set.has(objectKey));
+assertTrue(set.has(stringKey));
+assertTrue(set.has(numberKey));
+assertTrue(set.has(booleanKey));
+assertTrue(set.has(undefinedKey));
+assertTrue(set.has(nullKey));
+assertTrue(set.has(nanKey));
+assertTrue(set.has(zeroKey));
+
+assertFalse(set.has({}));
+assertTrue(set.has('keykeykey'));
+assertTrue(set.has(42.24));
+assertTrue(set.has(true));
+assertTrue(set.has(undefined));
+assertTrue(set.has(null));
+assertTrue(set.has(NaN));
+assertTrue(set.has(0));
+assertTrue(set.has(-0));
+assertTrue(set.has(1 / Infinity));
+assertTrue(set.has(-1 / Infinity));
diff --git a/deps/v8/test/mjsunit/harmony/string-codepointat.js b/deps/v8/test/mjsunit/es6/string-codepointat.js
index 411b0f23c7..976d5be6af 100644
--- a/deps/v8/test/mjsunit/harmony/string-codepointat.js
+++ b/deps/v8/test/mjsunit/es6/string-codepointat.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: --harmony-strings
-
// Tests taken from:
// https://github.com/mathiasbynens/String.prototype.codePointAt
diff --git a/deps/v8/test/mjsunit/harmony/string-endswith.js b/deps/v8/test/mjsunit/es6/string-endswith.js
index cc76b5fe4e..cbf2ed8766 100644
--- a/deps/v8/test/mjsunit/harmony/string-endswith.js
+++ b/deps/v8/test/mjsunit/es6/string-endswith.js
@@ -25,8 +25,6 @@
// (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: --harmony-strings
-
assertEquals(1, String.prototype.endsWith.length);
var testString = "Hello World";
diff --git a/deps/v8/test/mjsunit/harmony/string-fromcodepoint.js b/deps/v8/test/mjsunit/es6/string-fromcodepoint.js
index 97ecf0eec5..c4634ace44 100644
--- a/deps/v8/test/mjsunit/harmony/string-fromcodepoint.js
+++ b/deps/v8/test/mjsunit/es6/string-fromcodepoint.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: --harmony-strings
-
// Tests taken from:
// https://github.com/mathiasbynens/String.fromCodePoint
diff --git a/deps/v8/test/mjsunit/harmony/string-includes.js b/deps/v8/test/mjsunit/es6/string-includes.js
index 33ed8ea44c..61bf779483 100644
--- a/deps/v8/test/mjsunit/harmony/string-includes.js
+++ b/deps/v8/test/mjsunit/es6/string-includes.js
@@ -25,8 +25,6 @@
// (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: --harmony-strings
-
assertEquals(1, String.prototype.includes.length);
var reString = "asdf[a-z]+(asdf)?";
diff --git a/deps/v8/test/mjsunit/harmony/string-raw.js b/deps/v8/test/mjsunit/es6/string-raw.js
index 28e2af9164..2c6bb2ff30 100644
--- a/deps/v8/test/mjsunit/harmony/string-raw.js
+++ b/deps/v8/test/mjsunit/es6/string-raw.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: --harmony-templates
-
(function testStringRawArity() {
assertEquals(1, String.raw.length);
})();
@@ -256,3 +254,39 @@
assertEquals("12345", String.raw(callSiteObj, arg(2), arg(4), arg(6)));
assertEquals(["length", "raw1", "arg2", "raw3", "arg4", "raw5"], order);
})();
+
+
+(function testStringRawToStringSubstitutionsOrder() {
+ var subs = [];
+ var log = [];
+ function stringify(toString) {
+ var valueOf = "_" + toString + "_";
+ return {
+ toString: function() { return toString; },
+ valueOf: function() { return valueOf; }
+ };
+ }
+ function getter(name, value) {
+ return {
+ get: function() {
+ log.push("get" + name);
+ return value;
+ },
+ set: function(v) {
+ log.push("set" + name);
+ }
+ };
+ }
+ Object.defineProperties(subs, {
+ 0: getter(0, stringify("a")),
+ 1: getter(1, stringify("b")),
+ 2: getter(2, stringify("c"))
+ });
+
+ assertEquals("-a-b-c-", String.raw`-${subs[0]}-${subs[1]}-${subs[2]}-`);
+ assertArrayEquals(["get0", "get1", "get2"], log);
+
+ log.length = 0;
+ assertEquals("-a-", String.raw`-${subs[0]}-`);
+ assertArrayEquals(["get0"], log);
+})();
diff --git a/deps/v8/test/mjsunit/harmony/string-repeat.js b/deps/v8/test/mjsunit/es6/string-repeat.js
index 0af74483a0..15caea14f3 100644
--- a/deps/v8/test/mjsunit/harmony/string-repeat.js
+++ b/deps/v8/test/mjsunit/es6/string-repeat.js
@@ -25,8 +25,6 @@
// (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: --harmony-strings
-
assertEquals("000", String.prototype.repeat.call(0, 3));
assertEquals("-1-1-1", String.prototype.repeat.call(-1, 3));
assertEquals("2.12.12.1", String.prototype.repeat.call(2.1, 3));
diff --git a/deps/v8/test/mjsunit/harmony/string-startswith.js b/deps/v8/test/mjsunit/es6/string-startswith.js
index d72f2946f5..887db994a0 100644
--- a/deps/v8/test/mjsunit/harmony/string-startswith.js
+++ b/deps/v8/test/mjsunit/es6/string-startswith.js
@@ -25,8 +25,6 @@
// (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: --harmony-strings
-
assertEquals(1, String.prototype.startsWith.length);
var testString = "Hello World";
diff --git a/deps/v8/test/mjsunit/es6/symbols.js b/deps/v8/test/mjsunit/es6/symbols.js
index b9811f509e..46c3daba8a 100644
--- a/deps/v8/test/mjsunit/es6/symbols.js
+++ b/deps/v8/test/mjsunit/es6/symbols.js
@@ -245,25 +245,20 @@ TestCall()
function TestCollections() {
var set = new Set
var map = new Map
- var weakmap = new WeakMap
for (var i in symbols) {
set.add(symbols[i])
map.set(symbols[i], i)
- weakmap.set(symbols[i], i)
}
assertEquals(symbols.length, set.size)
assertEquals(symbols.length, map.size)
for (var i in symbols) {
assertTrue(set.has(symbols[i]))
assertTrue(map.has(symbols[i]))
- assertTrue(weakmap.has(symbols[i]))
assertEquals(i, map.get(symbols[i]))
- assertEquals(i, weakmap.get(symbols[i]))
}
for (var i in symbols) {
assertTrue(set.delete(symbols[i]))
assertTrue(map.delete(symbols[i]))
- assertTrue(weakmap.delete(symbols[i]))
}
assertEquals(0, set.size)
assertEquals(0, map.size)
diff --git a/deps/v8/test/mjsunit/harmony/templates.js b/deps/v8/test/mjsunit/es6/templates.js
index a884f58fb6..15296e8722 100644
--- a/deps/v8/test/mjsunit/harmony/templates.js
+++ b/deps/v8/test/mjsunit/es6/templates.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-templates --harmony-unicode
+// Flags: --harmony-unicode
var num = 5;
var str = "str";
@@ -423,10 +423,12 @@ var obj = {
Object.defineProperty(Array.prototype, 0, {
set: function() {
assertUnreachable();
- }
+ },
+ configurable: true
});
function tag(){}
tag`a${1}b`;
+ delete Array.prototype[0];
})();
@@ -518,3 +520,162 @@ var obj = {
assertThrows("`${(function() { \"use strict\"; return \"\\07\"; })()}`",
SyntaxError);
})();
+
+
+var global = this;
+(function testCallNew() {
+ "use strict";
+ var called = false;
+ var calledWith;
+ global.log = function(x) { called = true; calledWith = x; }
+
+ assertInstanceof(new Function`log("test")`, Object);
+ assertTrue(called);
+ assertSame("test", calledWith);
+ delete global.log;
+})();
+
+
+(function testCallNew2() {
+ "use strict";
+ var log = [];
+ function tag(x) {
+ log.push(x);
+ if (!(this instanceof tag)) {
+ return tag;
+ }
+ this.x = x === void 0 ? null : x;
+ return this;
+ }
+ // No arguments passed to constructor
+ var instance = new tag`x``y``z`;
+ assertInstanceof(instance, tag);
+ assertSame(tag.prototype, Object.getPrototypeOf(instance));
+ assertEquals({ x: null }, instance);
+ assertEquals([["x"], ["y"], ["z"], undefined], log);
+
+ // Arguments passed to constructor
+ log.length = 0;
+ instance = new tag`x2` `y2` `z2` (`test`);
+ assertInstanceof(instance, tag);
+ assertSame(tag.prototype, Object.getPrototypeOf(instance));
+ assertEquals({ x: "test" }, instance);
+ assertEquals([["x2"], ["y2"], ["z2"], "test"], log);
+})();
+
+
+(function testCallResultOfTagFn() {
+ "use strict";
+ var i = 0;
+ var raw = [];
+ function tag(cs) {
+ var args = Array.prototype.slice.call(arguments);
+ var text = String.raw.apply(null, args);
+ if (i++ < 2) {
+ raw.push("tag;" + text);
+ return tag;
+ }
+
+ raw.push("raw;" + text);
+ return text;
+ }
+ assertEquals("test3", tag`test1``test2``test3`);
+ assertEquals([
+ "tag;test1",
+ "tag;test2",
+ "raw;test3"
+ ], raw);
+})();
+
+
+(function testToStringSubstitutions() {
+ var a = {
+ toString: function() { return "a"; },
+ valueOf: function() { return "-a-"; }
+ };
+ var b = {
+ toString: function() { return "b"; },
+ valueOf: function() { return "-b-"; }
+ };
+ assertEquals("a", `${a}`);
+ assertEquals("ab", `${a}${b}`);
+ assertEquals("-a--b-", `${a + b}`);
+ assertEquals("-a-", `${a + ""}`);
+ assertEquals("1a", `1${a}`);
+ assertEquals("1a2", `1${a}2`);
+ assertEquals("1a2b", `1${a}2${b}`);
+ assertEquals("1a2b3", `1${a}2${b}3`);
+})();
+
+
+(function testToStringSubstitutionsOrder() {
+ var subs = [];
+ var log = [];
+ function getter(name, value) {
+ return {
+ get: function() {
+ log.push("get" + name);
+ return value;
+ },
+ set: function(v) {
+ log.push("set" + name);
+ }
+ };
+ }
+ Object.defineProperties(subs, {
+ 0: getter(0, "a"),
+ 1: getter(1, "b"),
+ 2: getter(2, "c")
+ });
+
+ assertEquals("-a-b-c-", `-${subs[0]}-${subs[1]}-${subs[2]}-`);
+ assertArrayEquals(["get0", "get1", "get2"], log);
+})();
+
+
+(function testTaggedToStringSubstitutionsOrder() {
+ var subs = [];
+ var log = [];
+ var tagged = [];
+ function getter(name, value) {
+ return {
+ get: function() {
+ log.push("get" + name);
+ return value;
+ },
+ set: function(v) {
+ log.push("set" + name);
+ }
+ };
+ }
+ Object.defineProperties(subs, {
+ 0: getter(0, 1),
+ 1: getter(1, 2),
+ 2: getter(2, 3)
+ });
+
+ function tag(cs) {
+ var n_substitutions = arguments.length - 1;
+ var n_cooked = cs.length;
+ var e = cs[0];
+ var i = 0;
+ assertEquals(n_cooked, n_substitutions + 1);
+ while (i < n_substitutions) {
+ var sub = arguments[i++ + 1];
+ var tail = cs[i];
+ tagged.push(sub);
+ e = e.concat(sub, tail);
+ }
+ return e;
+ }
+
+ assertEquals("-1-2-3-", tag`-${subs[0]}-${subs[1]}-${subs[2]}-`);
+ assertArrayEquals(["get0", "get1", "get2"], log);
+ assertArrayEquals([1, 2, 3], tagged);
+
+ tagged.length = 0;
+ log.length = 0;
+ assertEquals("-1-", tag`-${subs[0]}-`);
+ assertArrayEquals(["get0"], log);
+ assertArrayEquals([1], tagged);
+})();
diff --git a/deps/v8/test/mjsunit/es7/object-observe.js b/deps/v8/test/mjsunit/es7/object-observe.js
index 5af205eadf..b2853c4048 100644
--- a/deps/v8/test/mjsunit/es7/object-observe.js
+++ b/deps/v8/test/mjsunit/es7/object-observe.js
@@ -1142,7 +1142,9 @@ var properties = ["a", "1", 1, "length", "setPrototype", "name", "caller"];
function blacklisted(obj, prop) {
return (obj instanceof Int32Array && prop == 1) ||
(obj instanceof Int32Array && prop === "length") ||
- (obj instanceof ArrayBuffer && prop == 1)
+ (obj instanceof ArrayBuffer && prop == 1) ||
+ (obj instanceof Function && prop === "name") || // Has its own test.
+ (obj instanceof Function && prop === "length"); // Has its own test.
}
for (var i in objects) for (var j in properties) {
@@ -1798,3 +1800,66 @@ for (var b1 = 0; b1 < 2; ++b1)
for (var n = 0; n < 3; ++n)
for (var i in mutationByIncr)
TestFastElementsLength(mutationByIncr[i], b1 != 0, b2 != 0, 7*n, 7*n+1);
+
+
+(function TestFunctionName() {
+ reset();
+
+ function fun() {}
+ Object.observe(fun, observer.callback);
+ fun.name = 'x'; // No change. Not writable.
+ Object.defineProperty(fun, 'name', {value: 'a'});
+ Object.defineProperty(fun, 'name', {writable: true});
+ fun.name = 'b';
+ delete fun.name;
+ fun.name = 'x'; // No change. Function.prototype.name is non writable
+ Object.defineProperty(Function.prototype, 'name', {writable: true});
+ fun.name = 'c';
+ fun.name = 'c'; // Same, no update.
+ Object.deliverChangeRecords(observer.callback);
+ observer.assertCallbackRecords([
+ { object: fun, type: 'update', name: 'name', oldValue: 'fun' },
+ { object: fun, type: 'reconfigure', name: 'name'},
+ { object: fun, type: 'update', name: 'name', oldValue: 'a' },
+ { object: fun, type: 'delete', name: 'name', oldValue: 'b' },
+ { object: fun, type: 'add', name: 'name' },
+ ]);
+})();
+
+
+(function TestFunctionLength() {
+ reset();
+
+ function fun(x) {}
+ Object.observe(fun, observer.callback);
+ fun.length = 'x'; // No change. Not writable.
+ Object.defineProperty(fun, 'length', {value: 'a'});
+ Object.defineProperty(fun, 'length', {writable: true});
+ fun.length = 'b';
+ delete fun.length;
+ fun.length = 'x'; // No change. Function.prototype.length is non writable
+ Object.defineProperty(Function.prototype, 'length', {writable: true});
+ fun.length = 'c';
+ fun.length = 'c'; // Same, no update.
+ Object.deliverChangeRecords(observer.callback);
+ observer.assertCallbackRecords([
+ { object: fun, type: 'update', name: 'length', oldValue: 1 },
+ { object: fun, type: 'reconfigure', name: 'length'},
+ { object: fun, type: 'update', name: 'length', oldValue: 'a' },
+ { object: fun, type: 'delete', name: 'length', oldValue: 'b' },
+ { object: fun, type: 'add', name: 'length' },
+ ]);
+})();
+
+
+(function TestObserveInvalidAcceptMessage() {
+ var ex;
+ try {
+ Object.observe({}, function(){}, "not an object");
+ } catch (e) {
+ ex = e;
+ }
+ assertInstanceof(ex, TypeError);
+ assertEquals("Third argument to Object.observe must be an array of strings.",
+ ex.message);
+})()
diff --git a/deps/v8/test/mjsunit/function-length-accessor.js b/deps/v8/test/mjsunit/function-length-accessor.js
index 97c9f65822..386ac99643 100644
--- a/deps/v8/test/mjsunit/function-length-accessor.js
+++ b/deps/v8/test/mjsunit/function-length-accessor.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-scoping --lazy
+// Flags: --lazy
function foo(a, b, c, d) {
"use strict"
diff --git a/deps/v8/test/mjsunit/function-prototype.js b/deps/v8/test/mjsunit/function-prototype.js
index 7eac6df121..76ab53cf07 100644
--- a/deps/v8/test/mjsunit/function-prototype.js
+++ b/deps/v8/test/mjsunit/function-prototype.js
@@ -34,6 +34,9 @@ function TestNonObjectPrototype(value) {
var f = new F();
assertEquals(value, F.prototype);
assertEquals(Object.prototype, f.__proto__);
+ // Test that map transitions don't break anything.
+ F.property = "value";
+ assertEquals(value, F.prototype);
}
var values = [123, "asdf", true];
diff --git a/deps/v8/test/mjsunit/harmony/block-const-assign.js b/deps/v8/test/mjsunit/harmony/block-const-assign.js
deleted file mode 100644
index c21a0a3480..0000000000
--- a/deps/v8/test/mjsunit/harmony/block-const-assign.js
+++ /dev/null
@@ -1,137 +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: --harmony-scoping
-
-// Test that we throw early syntax errors in harmony mode
-// when using an immutable binding in an assigment or with
-// prefix/postfix decrement/increment operators.
-
-"use strict";
-
-// Function local const.
-function constDecl0(use) {
- return "(function() { const constvar = 1; " + use + "; })();";
-}
-
-
-function constDecl1(use) {
- return "(function() { " + use + "; const constvar = 1; })();";
-}
-
-
-// Function local const, assign from eval.
-function constDecl2(use) {
- use = "eval('(function() { " + use + " })')()";
- return "(function() { const constvar = 1; " + use + "; })();";
-}
-
-
-function constDecl3(use) {
- use = "eval('(function() { " + use + " })')()";
- return "(function() { " + use + "; const constvar = 1; })();";
-}
-
-
-// Block local const.
-function constDecl4(use) {
- return "(function() { { const constvar = 1; " + use + "; } })();";
-}
-
-
-function constDecl5(use) {
- return "(function() { { " + use + "; const constvar = 1; } })();";
-}
-
-
-// Block local const, assign from eval.
-function constDecl6(use) {
- use = "eval('(function() {" + use + "})')()";
- return "(function() { { const constvar = 1; " + use + "; } })();";
-}
-
-
-function constDecl7(use) {
- use = "eval('(function() {" + use + "})')()";
- return "(function() { { " + use + "; const constvar = 1; } })();";
-}
-
-
-// Function expression name.
-function constDecl8(use) {
- return "(function constvar() { " + use + "; })();";
-}
-
-
-// Function expression name, assign from eval.
-function constDecl9(use) {
- use = "eval('(function(){" + use + "})')()";
- return "(function constvar() { " + use + "; })();";
-}
-
-let decls = [ constDecl0,
- constDecl1,
- constDecl2,
- constDecl3,
- constDecl4,
- constDecl5,
- constDecl6,
- constDecl7,
- constDecl8,
- constDecl9
- ];
-let declsForTDZ = new Set([constDecl1, constDecl3, constDecl5, constDecl7]);
-let uses = [ 'constvar = 1;',
- 'constvar += 1;',
- '++constvar;',
- 'constvar++;'
- ];
-
-function Test(d,u) {
- 'use strict';
- try {
- print(d(u));
- eval(d(u));
- } catch (e) {
- if (declsForTDZ.has(d) && u !== uses[0]) {
- // In these cases, read of a const variable occurs
- // before a write to it, so TDZ kicks in before const check.
- assertInstanceof(e, ReferenceError);
- return;
- }
- assertInstanceof(e, TypeError);
- assertTrue(e.toString().indexOf("Assignment to constant variable") >= 0);
- return;
- }
- assertUnreachable();
-}
-
-for (var d = 0; d < decls.length; ++d) {
- for (var u = 0; u < uses.length; ++u) {
- Test(decls[d], uses[u]);
- }
-}
diff --git a/deps/v8/test/mjsunit/harmony/computed-property-names-classes.js b/deps/v8/test/mjsunit/harmony/computed-property-names-classes.js
index 4e50f8a461..ab5d39e867 100644
--- a/deps/v8/test/mjsunit/harmony/computed-property-names-classes.js
+++ b/deps/v8/test/mjsunit/harmony/computed-property-names-classes.js
@@ -312,41 +312,74 @@ function assertIteratorResult(value, done, result) {
(function TestPrototype() {
- // Normally a static prototype property is not allowed.
- class C {
- static ['prototype']() {
- return 1;
+ assertThrows(function() {
+ class C {
+ static ['prototype']() {
+ return 1;
+ }
}
- }
- assertEquals(1, C.prototype());
+ }, TypeError);
- class C2 {
- static get ['prototype']() {
- return 2;
+ assertThrows(function() {
+ class C2 {
+ static get ['prototype']() {
+ return 2;
+ }
}
- }
- assertEquals(2, C2.prototype);
+ }, TypeError);
- var calls = 0;
- class C3 {
- static set ['prototype'](x) {
- assertEquals(3, x);
- calls++;
+ assertThrows(function() {
+ class C3 {
+ static set ['prototype'](x) {
+ assertEquals(3, x);
+ }
}
- }
- C3.prototype = 3;
- assertEquals(1, calls);
+ }, TypeError);
+
+ assertThrows(function() {
+ class C4 {
+ static *['prototype']() {
+ yield 1;
+ yield 2;
+ }
+ }
+ }, TypeError);
+})();
- class C4 {
- static *['prototype']() {
- yield 1;
- yield 2;
+
+(function TestPrototypeConcat() {
+ assertThrows(function() {
+ class C {
+ static ['pro' + 'tot' + 'ype']() {
+ return 1;
+ }
}
- }
- var iter = C4.prototype();
- assertIteratorResult(1, false, iter.next());
- assertIteratorResult(2, false, iter.next());
- assertIteratorResult(undefined, true, iter.next());
+ }, TypeError);
+
+ assertThrows(function() {
+ class C2 {
+ static get ['pro' + 'tot' + 'ype']() {
+ return 2;
+ }
+ }
+ }, TypeError);
+
+ assertThrows(function() {
+ class C3 {
+ static set ['pro' + 'tot' + 'ype'](x) {
+ assertEquals(3, x);
+ }
+ }
+ }, TypeError);
+
+ assertThrows(function() {
+ class C4 {
+ static *['pro' + 'tot' + 'ype']() {
+ yield 1;
+ yield 2;
+ }
+ }
+ }, TypeError);
})();
@@ -388,3 +421,45 @@ function assertIteratorResult(value, done, result) {
assertIteratorResult(2, false, iter.next());
assertIteratorResult(undefined, true, iter.next());
})();
+
+
+(function TestExceptionInName() {
+ function MyError() {};
+ function throwMyError() {
+ throw new MyError();
+ }
+ assertThrows(function() {
+ class C {
+ [throwMyError()]() {}
+ }
+ }, MyError);
+ assertThrows(function() {
+ class C {
+ get [throwMyError()]() { return 42; }
+ }
+ }, MyError);
+ assertThrows(function() {
+ class C {
+ set [throwMyError()](_) { }
+ }
+ }, MyError);
+})();
+
+
+(function TestTdzName() {
+ assertThrows(function() {
+ class C {
+ [C]() {}
+ }
+ }, ReferenceError);
+ assertThrows(function() {
+ class C {
+ get [C]() { return 42; }
+ }
+ }, ReferenceError);
+ assertThrows(function() {
+ class C {
+ set [C](_) { }
+ }
+ }, ReferenceError);
+})();
diff --git a/deps/v8/test/mjsunit/harmony/computed-property-names.js b/deps/v8/test/mjsunit/harmony/computed-property-names.js
index 69360771c1..36e1411169 100644
--- a/deps/v8/test/mjsunit/harmony/computed-property-names.js
+++ b/deps/v8/test/mjsunit/harmony/computed-property-names.js
@@ -277,3 +277,26 @@ function ID(x) {
assertEquals('X', object.x);
assertEquals(proto, Object.getPrototypeOf(object));
})();
+
+
+(function TestExceptionInName() {
+ function MyError() {};
+ function throwMyError() {
+ throw new MyError();
+ }
+ assertThrows(function() {
+ var o = {
+ [throwMyError()]: 42
+ };
+ }, MyError);
+ assertThrows(function() {
+ var o = {
+ get [throwMyError()]() { return 42; }
+ };
+ }, MyError);
+ assertThrows(function() {
+ var o = {
+ set [throwMyError()](_) { }
+ };
+ }, MyError);
+})();
diff --git a/deps/v8/test/mjsunit/harmony/module-linking.js b/deps/v8/test/mjsunit/harmony/module-linking.js
index 3a5bc89793..faaf7f2e49 100644
--- a/deps/v8/test/mjsunit/harmony/module-linking.js
+++ b/deps/v8/test/mjsunit/harmony/module-linking.js
@@ -25,7 +25,7 @@
// (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: --harmony-modules --harmony-scoping
+// Flags: --harmony-modules
// Test basic module linking and initialization.
diff --git a/deps/v8/test/mjsunit/harmony/module-resolution.js b/deps/v8/test/mjsunit/harmony/module-resolution.js
index 1a95347d14..7f1e431313 100644
--- a/deps/v8/test/mjsunit/harmony/module-resolution.js
+++ b/deps/v8/test/mjsunit/harmony/module-resolution.js
@@ -25,7 +25,7 @@
// (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: --harmony-modules --harmony-scoping
+// Flags: --harmony-modules
// Test basic module interface inference.
diff --git a/deps/v8/test/mjsunit/harmony/private.js b/deps/v8/test/mjsunit/harmony/private.js
index 218094c3d5..c08daf1050 100644
--- a/deps/v8/test/mjsunit/harmony/private.js
+++ b/deps/v8/test/mjsunit/harmony/private.js
@@ -196,25 +196,20 @@ TestSet()
function TestCollections() {
var set = new Set
var map = new Map
- var weakmap = new WeakMap
for (var i in symbols) {
set.add(symbols[i])
map.set(symbols[i], i)
- weakmap.set(symbols[i], i)
}
assertEquals(symbols.length, set.size)
assertEquals(symbols.length, map.size)
for (var i in symbols) {
assertTrue(set.has(symbols[i]))
assertTrue(map.has(symbols[i]))
- assertTrue(weakmap.has(symbols[i]))
assertEquals(i, map.get(symbols[i]))
- assertEquals(i, weakmap.get(symbols[i]))
}
for (var i in symbols) {
assertTrue(set.delete(symbols[i]))
assertTrue(map.delete(symbols[i]))
- assertTrue(weakmap.delete(symbols[i]))
}
assertEquals(0, set.size)
assertEquals(0, map.size)
diff --git a/deps/v8/test/mjsunit/harmony/reflect-apply.js b/deps/v8/test/mjsunit/harmony/reflect-apply.js
new file mode 100644
index 0000000000..2cfb98282b
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/reflect-apply.js
@@ -0,0 +1,212 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-reflect
+
+
+(function testReflectApplyArity() {
+ assertEquals(3, Reflect.apply.length);
+})();
+
+
+(function testReflectApplyNonConstructor() {
+ assertThrows(function() {
+ new Reflect.apply(function(){}, null, []);
+ }, TypeError);
+})();
+
+
+(function testAppliedReceiverSloppy() {
+ function returnThis() { return this; }
+ var receiver = {};
+
+ assertSame(this, Reflect.apply(returnThis, void 0, []));
+ assertSame(this, Reflect.apply(returnThis, null, []));
+ assertSame(this, Reflect.apply(returnThis, this, []));
+ assertSame(receiver, Reflect.apply(returnThis, receiver, []));
+
+ // Wrap JS values
+ assertSame(String.prototype,
+ Object.getPrototypeOf(Reflect.apply(returnThis, "str", [])));
+ assertSame(Number.prototype,
+ Object.getPrototypeOf(Reflect.apply(returnThis, 123, [])));
+ assertSame(Boolean.prototype,
+ Object.getPrototypeOf(Reflect.apply(returnThis, true, [])));
+ assertSame(Symbol.prototype,
+ Object.getPrototypeOf(
+ Reflect.apply(returnThis, Symbol("test"), [])));
+})();
+
+
+(function testAppliedReceiverStrict() {
+ function returnThis() { 'use strict'; return this; }
+ var receiver = {};
+
+ assertSame(void 0, Reflect.apply(returnThis, void 0, []));
+ assertSame(this, Reflect.apply(returnThis, this, []));
+ assertSame(receiver, Reflect.apply(returnThis, receiver, []));
+
+ // Don't wrap value types
+ var regexp = /123/;
+ var symbol = Symbol("test");
+ assertSame("str", Reflect.apply(returnThis, "str", []));
+ assertSame(123, Reflect.apply(returnThis, 123, []));
+ assertSame(true, Reflect.apply(returnThis, true, []));
+ assertSame(regexp, Reflect.apply(returnThis, regexp, []));
+ assertSame(symbol, Reflect.apply(returnThis, symbol, []));
+})();
+
+
+(function testAppliedArgumentsLength() {
+ function returnLengthStrict() { 'use strict'; return arguments.length; }
+ function returnLengthSloppy() { return arguments.length; }
+
+ assertEquals(0, Reflect.apply(returnLengthStrict, this, []));
+ assertEquals(0, Reflect.apply(returnLengthSloppy, this, []));
+ assertEquals(0, Reflect.apply(returnLengthStrict, this, {}));
+ assertEquals(0, Reflect.apply(returnLengthSloppy, this, {}));
+
+ for (var i = 0; i < 256; ++i) {
+ assertEquals(i, Reflect.apply(returnLengthStrict, this, new Array(i)));
+ assertEquals(i, Reflect.apply(returnLengthSloppy, this, new Array(i)));
+ assertEquals(i, Reflect.apply(returnLengthStrict, this, { length: i }));
+ assertEquals(i, Reflect.apply(returnLengthSloppy, this, { length: i }));
+ }
+})();
+
+
+(function testAppliedArgumentsLengthThrows() {
+ function noopStrict() { 'use strict'; }
+ function noopSloppy() { }
+ function MyError() {}
+
+ var argsList = {};
+ Object.defineProperty(argsList, "length", {
+ get: function() { throw new MyError(); }
+ });
+
+ assertThrows(function() {
+ Reflect.apply(noopStrict, this, argsList);
+ }, MyError);
+
+ assertThrows(function() {
+ Reflect.apply(noopSloppy, this, argsList);
+ }, MyError);
+})();
+
+
+(function testAppliedArgumentsElementThrows() {
+ function noopStrict() { 'use strict'; }
+ function noopSloppy() { }
+ function MyError() {}
+
+ var argsList = { length: 1 };
+ Object.defineProperty(argsList, "0", {
+ get: function() { throw new MyError(); }
+ });
+
+ assertThrows(function() {
+ Reflect.apply(noopStrict, this, argsList);
+ }, MyError);
+
+ assertThrows(function() {
+ Reflect.apply(noopSloppy, this, argsList);
+ }, MyError);
+})();
+
+
+(function testAppliedNonFunctionStrict() {
+ 'use strict';
+ assertThrows(function() { Reflect.apply(void 0); }, TypeError);
+ assertThrows(function() { Reflect.apply(null); }, TypeError);
+ assertThrows(function() { Reflect.apply(123); }, TypeError);
+ assertThrows(function() { Reflect.apply("str"); }, TypeError);
+ assertThrows(function() { Reflect.apply(Symbol("x")); }, TypeError);
+ assertThrows(function() { Reflect.apply(/123/); }, TypeError);
+ assertThrows(function() { Reflect.apply(NaN); }, TypeError);
+ assertThrows(function() { Reflect.apply({}); }, TypeError);
+ assertThrows(function() { Reflect.apply([]); }, TypeError);
+})();
+
+
+(function testAppliedNonFunctionSloppy() {
+ assertThrows(function() { Reflect.apply(void 0); }, TypeError);
+ assertThrows(function() { Reflect.apply(null); }, TypeError);
+ assertThrows(function() { Reflect.apply(123); }, TypeError);
+ assertThrows(function() { Reflect.apply("str"); }, TypeError);
+ assertThrows(function() { Reflect.apply(Symbol("x")); }, TypeError);
+ assertThrows(function() { Reflect.apply(/123/); }, TypeError);
+ assertThrows(function() { Reflect.apply(NaN); }, TypeError);
+ assertThrows(function() { Reflect.apply({}); }, TypeError);
+ assertThrows(function() { Reflect.apply([]); }, TypeError);
+})();
+
+
+(function testAppliedArgumentsNonList() {
+ function noopStrict() { 'use strict'; }
+ function noopSloppy() {}
+ var R = void 0;
+ assertThrows(function() { Reflect.apply(noopStrict, R, null); }, TypeError);
+ assertThrows(function() { Reflect.apply(noopSloppy, R, null); }, TypeError);
+ assertThrows(function() { Reflect.apply(noopStrict, R, 1); }, TypeError);
+ assertThrows(function() { Reflect.apply(noopSloppy, R, 1); }, TypeError);
+ assertThrows(function() { Reflect.apply(noopStrict, R, "BAD"); }, TypeError);
+ assertThrows(function() { Reflect.apply(noopSloppy, R, "BAD"); }, TypeError);
+ assertThrows(function() { Reflect.apply(noopStrict, R, true); }, TypeError);
+ assertThrows(function() { Reflect.apply(noopSloppy, R, true); }, TypeError);
+ var sym = Symbol("x");
+ assertThrows(function() { Reflect.apply(noopStrict, R, sym); }, TypeError);
+ assertThrows(function() { Reflect.apply(noopSloppy, R, sym); }, TypeError);
+})();
+
+
+(function testAppliedArgumentValue() {
+ function returnFirstStrict(a) { 'use strict'; return a; }
+ function returnFirstSloppy(a) { return a; }
+ function returnLastStrict(a) {
+ 'use strict'; return arguments[arguments.length - 1]; }
+ function returnLastSloppy(a) { return arguments[arguments.length - 1]; }
+ function returnSumStrict() {
+ 'use strict';
+ var sum = arguments[0];
+ for (var i = 1; i < arguments.length; ++i) {
+ sum += arguments[i];
+ }
+ return sum;
+ }
+ function returnSumSloppy() {
+ var sum = arguments[0];
+ for (var i = 1; i < arguments.length; ++i) {
+ sum += arguments[i];
+ }
+ return sum;
+ }
+
+ assertEquals("OK!", Reflect.apply(returnFirstStrict, this, ["OK!"]));
+ assertEquals("OK!", Reflect.apply(returnFirstSloppy, this, ["OK!"]));
+ assertEquals("OK!", Reflect.apply(returnFirstStrict, this,
+ { 0: "OK!", length: 1 }));
+ assertEquals("OK!", Reflect.apply(returnFirstSloppy, this,
+ { 0: "OK!", length: 1 }));
+ assertEquals("OK!", Reflect.apply(returnLastStrict, this,
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, "OK!"]));
+ assertEquals("OK!", Reflect.apply(returnLastSloppy, this,
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, "OK!"]));
+ assertEquals("OK!", Reflect.apply(returnLastStrict, this,
+ { 9: "OK!", length: 10 }));
+ assertEquals("OK!", Reflect.apply(returnLastSloppy, this,
+ { 9: "OK!", length: 10 }));
+ assertEquals("TEST", Reflect.apply(returnSumStrict, this,
+ ["T", "E", "S", "T"]));
+ assertEquals("TEST!!", Reflect.apply(returnSumStrict, this,
+ ["T", "E", "S", "T", "!", "!"]));
+ assertEquals(10, Reflect.apply(returnSumStrict, this,
+ { 0: 1, 1: 2, 2: 3, 3: 4, length: 4 }));
+ assertEquals("TEST", Reflect.apply(returnSumSloppy, this,
+ ["T", "E", "S", "T"]));
+ assertEquals("TEST!!", Reflect.apply(returnSumSloppy, this,
+ ["T", "E", "S", "T", "!", "!"]));
+ assertEquals(10, Reflect.apply(returnSumSloppy, this,
+ { 0: 1, 1: 2, 2: 3, 3: 4, length: 4 }));
+})();
diff --git a/deps/v8/test/mjsunit/harmony/reflect-construct.js b/deps/v8/test/mjsunit/harmony/reflect-construct.js
new file mode 100644
index 0000000000..2211e3f783
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/reflect-construct.js
@@ -0,0 +1,277 @@
+// Copyright 2014 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-reflect
+
+
+(function testReflectConstructArity() {
+ assertEquals(2, Reflect.construct.length);
+})();
+
+
+(function testReflectConstructNonConstructor() {
+ assertThrows(function() {
+ new Reflect.construct(function(){}, []);
+ }, TypeError);
+})();
+
+
+(function testReflectConstructBasic() {
+ function Constructor() { "use strict"; }
+ assertInstanceof(Reflect.construct(Constructor, []), Constructor);
+})();
+
+
+(function testReflectConstructBasicSloppy() {
+ function Constructor() {}
+ assertInstanceof(Reflect.construct(Constructor, []), Constructor);
+})();
+
+
+(function testReflectConstructReturnSomethingElseStrict() {
+ var R = {};
+ function Constructor() { "use strict"; return R; }
+ assertSame(R, Reflect.construct(Constructor, []));
+})();
+
+
+(function testReflectConstructReturnSomethingElseSloppy() {
+ var R = {};
+ function Constructor() { return R; }
+ assertSame(R, Reflect.construct(Constructor, []));
+})();
+
+
+(function testReflectConstructNewTargetStrict() {
+ "use strict";
+ function Constructor() { this[9] = 1; }
+ var O = Reflect.construct(Constructor, [], Array);
+ assertEquals(1, O[9]);
+ // Ordinary object with Array.prototype --- no exotic Array magic
+ assertFalse(Array.isArray(O));
+ assertEquals(0, O.length);
+ assertSame(Array.prototype, Object.getPrototypeOf(O));
+})();
+
+
+(function testReflectConstructNewTargetSloppy() {
+ function Constructor() { this[9] = 1; }
+ var O = Reflect.construct(Constructor, [], Array);
+ assertEquals(1, O[9]);
+ // Ordinary object with Array.prototype --- no exotic Array magic
+ assertFalse(Array.isArray(O));
+ assertEquals(0, O.length);
+ assertSame(Array.prototype, Object.getPrototypeOf(O));
+})();
+
+
+(function testReflectConstructNewTargetStrict2() {
+ "use strict";
+ function Constructor() { this[9] = 1; }
+ Constructor.prototype.add = function(x) {
+ this[this.length] = x; return this;
+ }
+ var O = Reflect.construct(Array, [1, 2, 3], Constructor);
+ // Exotic Array object with Constructor.prototype
+ assertTrue(Array.isArray(O));
+ assertSame(Constructor.prototype, Object.getPrototypeOf(O));
+ assertFalse(O instanceof Array);
+ assertEquals(3, O.length);
+ assertEquals(undefined, O[9]);
+ assertSame(O, O.add(4));
+ assertEquals(4, O.length);
+ assertEquals(4, O[3]);
+})();
+
+
+(function testReflectConstructNewTargetSloppy2() {
+ function Constructor() { this[9] = 1; }
+ Constructor.prototype.add = function(x) {
+ this[this.length] = x; return this;
+ }
+ var O = Reflect.construct(Array, [1, 2, 3], Constructor);
+ // Exotic Array object with Constructor.prototype
+ assertTrue(Array.isArray(O));
+ assertSame(Constructor.prototype, Object.getPrototypeOf(O));
+ assertFalse(O instanceof Array);
+ assertEquals(3, O.length);
+ assertEquals(undefined, O[9]);
+ assertSame(O, O.add(4));
+ assertEquals(4, O.length);
+ assertEquals(4, O[3]);
+})();
+
+
+(function testReflectConstructNewTargetStrict3() {
+ "use strict";
+ function A() {}
+ function B() {}
+ var O = Reflect.construct(A, [], B);
+ // TODO(caitp): bug: newTarget prototype is not used if it is not
+ // explicitly set.
+ //assertSame(B.prototype, Object.getPrototypeOf(O));
+})();
+
+
+(function testReflectConstructNewTargetSloppy3() {
+ function A() {}
+ function B() {}
+ var O = Reflect.construct(A, [], B);
+ // TODO(caitp): bug: newTarget prototype is not used if it is not
+ // explicitly set.
+ //assertSame(B.prototype, Object.getPrototypeOf(O));
+})();
+
+
+(function testAppliedArgumentsLength() {
+ function lengthStrict() { 'use strict'; this.a = arguments.length; }
+ function lengthSloppy() { this.a = arguments.length; }
+
+ assertEquals(0, Reflect.construct(lengthStrict, []).a);
+ assertEquals(0, Reflect.construct(lengthSloppy, []).a);
+ assertEquals(0, Reflect.construct(lengthStrict, {}).a);
+ assertEquals(0, Reflect.construct(lengthSloppy, {}).a);
+
+ for (var i = 0; i < 256; ++i) {
+ assertEquals(i, Reflect.construct(lengthStrict, new Array(i)).a);
+ assertEquals(i, Reflect.construct(lengthSloppy, new Array(i)).a);
+ assertEquals(i, Reflect.construct(lengthStrict, { length: i }).a);
+ assertEquals(i, Reflect.construct(lengthSloppy, { length: i }).a);
+ }
+})();
+
+
+(function testAppliedArgumentsLengthThrows() {
+ function noopStrict() { 'use strict'; }
+ function noopSloppy() { }
+ function MyError() {}
+
+ var argsList = {};
+ Object.defineProperty(argsList, "length", {
+ get: function() { throw new MyError(); }
+ });
+
+ assertThrows(function() {
+ Reflect.construct(noopStrict, argsList);
+ }, MyError);
+
+ assertThrows(function() {
+ Reflect.construct(noopSloppy, argsList);
+ }, MyError);
+})();
+
+
+(function testAppliedArgumentsElementThrows() {
+ function noopStrict() { 'use strict'; }
+ function noopSloppy() { }
+ function MyError() {}
+
+ var argsList = { length: 1 };
+ Object.defineProperty(argsList, "0", {
+ get: function() { throw new MyError(); }
+ });
+
+ assertThrows(function() {
+ Reflect.construct(noopStrict, argsList);
+ }, MyError);
+
+ assertThrows(function() {
+ Reflect.construct(noopSloppy, argsList);
+ }, MyError);
+})();
+
+
+(function testAppliedNonFunctionStrict() {
+ 'use strict';
+ assertThrows(function() { Reflect.construct(void 0, []); }, TypeError);
+ assertThrows(function() { Reflect.construct(null, []); }, TypeError);
+ assertThrows(function() { Reflect.construct(123, []); }, TypeError);
+ assertThrows(function() { Reflect.construct("str", []); }, TypeError);
+ assertThrows(function() { Reflect.construct(Symbol("x"), []); }, TypeError);
+ assertThrows(function() { Reflect.construct(/123/, []); }, TypeError);
+ assertThrows(function() { Reflect.construct(NaN, []); }, TypeError);
+ assertThrows(function() { Reflect.construct({}, []); }, TypeError);
+ assertThrows(function() { Reflect.construct([], []); }, TypeError);
+})();
+
+
+(function testAppliedNonFunctionSloppy() {
+ assertThrows(function() { Reflect.construct(void 0, []); }, TypeError);
+ assertThrows(function() { Reflect.construct(null, []); }, TypeError);
+ assertThrows(function() { Reflect.construct(123, []); }, TypeError);
+ assertThrows(function() { Reflect.construct("str", []); }, TypeError);
+ assertThrows(function() { Reflect.construct(Symbol("x"), []); }, TypeError);
+ assertThrows(function() { Reflect.construct(/123/, []); }, TypeError);
+ assertThrows(function() { Reflect.construct(NaN, []); }, TypeError);
+ assertThrows(function() { Reflect.construct({}, []); }, TypeError);
+ assertThrows(function() { Reflect.construct([], []); }, TypeError);
+})();
+
+
+(function testAppliedArgumentsNonList() {
+ function noopStrict() { 'use strict'; }
+ function noopSloppy() {}
+ assertThrows(function() { Reflect.construct(noopStrict, null); }, TypeError);
+ assertThrows(function() { Reflect.construct(noopSloppy, null); }, TypeError);
+ assertThrows(function() { Reflect.construct(noopStrict, 1); }, TypeError);
+ assertThrows(function() { Reflect.construct(noopSloppy, 1); }, TypeError);
+ assertThrows(function() { Reflect.construct(noopStrict, "BAD"); }, TypeError);
+ assertThrows(function() { Reflect.construct(noopSloppy, "BAD"); }, TypeError);
+ assertThrows(function() { Reflect.construct(noopStrict, true); }, TypeError);
+ assertThrows(function() { Reflect.construct(noopSloppy, true); }, TypeError);
+ var sym = Symbol("x");
+ assertThrows(function() { Reflect.construct(noopStrict, sym); }, TypeError);
+ assertThrows(function() { Reflect.construct(noopSloppy, sym); }, TypeError);
+})();
+
+
+(function testAppliedArgumentValue() {
+ function firstStrict(a) { 'use strict'; this.a = a; }
+ function firstSloppy(a) { this.a = a; }
+ function lastStrict(a) {
+ 'use strict'; this.a = arguments[arguments.length - 1]; }
+ function lastSloppy(a) { this.a = arguments[arguments.length - 1]; }
+ function sumStrict() {
+ 'use strict';
+ var sum = arguments[0];
+ for (var i = 1; i < arguments.length; ++i) {
+ sum += arguments[i];
+ }
+ this.a = sum;
+ }
+ function sumSloppy() {
+ var sum = arguments[0];
+ for (var i = 1; i < arguments.length; ++i) {
+ sum += arguments[i];
+ }
+ this.a = sum;
+ }
+
+ assertEquals("OK!", Reflect.construct(firstStrict, ["OK!"]).a);
+ assertEquals("OK!", Reflect.construct(firstSloppy, ["OK!"]).a);
+ assertEquals("OK!", Reflect.construct(firstStrict,
+ { 0: "OK!", length: 1 }).a);
+ assertEquals("OK!", Reflect.construct(firstSloppy,
+ { 0: "OK!", length: 1 }).a);
+ assertEquals("OK!", Reflect.construct(lastStrict,
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, "OK!"]).a);
+ assertEquals("OK!", Reflect.construct(lastSloppy,
+ [0, 1, 2, 3, 4, 5, 6, 7, 8, "OK!"]).a);
+ assertEquals("OK!", Reflect.construct(lastStrict,
+ { 9: "OK!", length: 10 }).a);
+ assertEquals("OK!", Reflect.construct(lastSloppy,
+ { 9: "OK!", length: 10 }).a);
+ assertEquals("TEST", Reflect.construct(sumStrict,
+ ["T", "E", "S", "T"]).a);
+ assertEquals("TEST!!", Reflect.construct(sumStrict,
+ ["T", "E", "S", "T", "!", "!"]).a);
+ assertEquals(10, Reflect.construct(sumStrict,
+ { 0: 1, 1: 2, 2: 3, 3: 4, length: 4 }).a);
+ assertEquals("TEST", Reflect.construct(sumSloppy,
+ ["T", "E", "S", "T"]).a);
+ assertEquals("TEST!!", Reflect.construct(sumSloppy,
+ ["T", "E", "S", "T", "!", "!"]).a);
+ assertEquals(10, Reflect.construct(sumSloppy,
+ { 0: 1, 1: 2, 2: 3, 3: 4, length: 4 }).a);
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-3501.js b/deps/v8/test/mjsunit/harmony/regress/regress-3501.js
index 4b449e458f..4b449e458f 100644
--- a/deps/v8/test/mjsunit/regress/regress-3501.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-3501.js
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-448730.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-448730.js
index 31d276aa83..31d276aa83 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-448730.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-448730.js
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-451770.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-451770.js
index 942814a316..942814a316 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-451770.js
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-451770.js
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-461520.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-461520.js
new file mode 100644
index 0000000000..c30260db72
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-461520.js
@@ -0,0 +1,18 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-proxies
+
+var fuse = 1;
+var handler = {
+ get: function() { return function() {} },
+ getPropertyDescriptor: function() {
+ if (fuse-- == 0) throw "please die";
+ return {value: function() {}, configurable: true};
+ }
+};
+
+var p = Proxy.create(handler);
+var o = Object.create(p);
+with (o) { f() }
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-465671-null.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-465671-null.js
new file mode 100644
index 0000000000..d24599c385
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-465671-null.js
@@ -0,0 +1,16 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-arrow-functions
+
+// This used to trigger a segfault because of NULL being accessed.
+function f() {
+ var a = [10];
+ try {
+ f();
+ } catch(e) {
+ a.map((v) => v + 1);
+ }
+}
+f();
diff --git a/deps/v8/test/mjsunit/harmony/regress/regress-crbug-465671.js b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-465671.js
new file mode 100644
index 0000000000..24f4d05475
--- /dev/null
+++ b/deps/v8/test/mjsunit/harmony/regress/regress-crbug-465671.js
@@ -0,0 +1,16 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// Flags: --harmony-arrow-functions
+
+// This used to trigger crash because of an unhandled stack overflow.
+function f() {
+ var a = [10];
+ try {
+ f();
+ } catch(e) {
+ a.map(v => v + 1);
+ }
+}
+f();
diff --git a/deps/v8/test/mjsunit/harmony/rest-params.js b/deps/v8/test/mjsunit/harmony/rest-params.js
index 5bb258ee68..341cb33087 100644
--- a/deps/v8/test/mjsunit/harmony/rest-params.js
+++ b/deps/v8/test/mjsunit/harmony/rest-params.js
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --harmony-rest-parameters
+// Flags: --harmony-rest-parameters --harmony-classes
(function testRestIndex() {
assertEquals(5, (function(...args) { return args.length; })(1,2,3,4,5));
@@ -180,3 +180,35 @@ var O = {
assertEquals([], ((...args) => args)());
assertEquals([1,2,3], ((...args) => args)(1,2,3));
})();*/
+
+
+(function testRestParamsWithNewTarget() {
+ "use strict";
+ class Base {
+ constructor(...a) {
+ this.base = a;
+ assertEquals(arguments.length, a.length);
+ var args = [];
+ for (var i = 0; i < arguments.length; ++i) {
+ args.push(arguments[i]);
+ }
+ assertEquals(args, a);
+ }
+ }
+ class Child extends Base {
+ constructor(...b) {
+ super(1, 2, 3);
+ this.child = b;
+ assertEquals(arguments.length, b.length);
+ var args = [];
+ for (var i = 0; i < arguments.length; ++i) {
+ args.push(arguments[i]);
+ }
+ assertEquals(args, b);
+ }
+ }
+
+ var c = new Child(1, 2, 3);
+ assertEquals([1, 2, 3], c.child);
+ assertEquals([1, 2, 3], c.base);
+})();
diff --git a/deps/v8/test/mjsunit/harmony/typedarrays.js b/deps/v8/test/mjsunit/harmony/typedarrays.js
index a4d6e7927a..0cdb7ed396 100644
--- a/deps/v8/test/mjsunit/harmony/typedarrays.js
+++ b/deps/v8/test/mjsunit/harmony/typedarrays.js
@@ -530,7 +530,7 @@ function TestTypedArraysWithIllegalIndices() {
* assertEquals(undefined, a[-Infinity]);
*/
a[1.5] = 10;
- assertEquals(undefined, a[1.5]);
+ assertEquals(10, a[1.5]);
var nan = Math.sqrt(-1);
a[nan] = 5;
assertEquals(5, a[nan]);
@@ -579,7 +579,7 @@ function TestTypedArraysWithIllegalIndicesStrict() {
* assertEquals(undefined, a[-Infinity]);
*/
a[1.5] = 10;
- assertEquals(undefined, a[1.5]);
+ assertEquals(10, a[1.5]);
var nan = Math.sqrt(-1);
a[nan] = 5;
assertEquals(5, a[nan]);
diff --git a/deps/v8/test/mjsunit/json2.js b/deps/v8/test/mjsunit/json2.js
index f048f05290..f68c76c92a 100644
--- a/deps/v8/test/mjsunit/json2.js
+++ b/deps/v8/test/mjsunit/json2.js
@@ -183,3 +183,8 @@ try {
externalizeString(str, true);
} catch (e) { }
TestStringify("\"external\"", str, null, 0);
+
+var o = {};
+o.somespecialproperty = 10;
+o["\x19"] = 10;
+assertThrows("JSON.parse('{\"somespecialproperty\":100, \"\x19\":10}')");
diff --git a/deps/v8/test/mjsunit/mjsunit.status b/deps/v8/test/mjsunit/mjsunit.status
index dc96a1de35..4b3ae5dd7c 100644
--- a/deps/v8/test/mjsunit/mjsunit.status
+++ b/deps/v8/test/mjsunit/mjsunit.status
@@ -68,6 +68,7 @@
'compare-known-objects-slow': [PASS, NO_VARIANTS],
'elements-kind': [PASS, NO_VARIANTS],
'opt-elements-kind': [PASS, NO_VARIANTS],
+ 'smi-representation': [PASS, NO_VARIANTS],
# Some tests are just too slow to run for now.
'big-object-literal': [PASS, NO_VARIANTS],
@@ -95,25 +96,11 @@
'debug-evaluate-locals': [PASS, NO_VARIANTS],
'debug-liveedit-check-stack': [PASS, NO_VARIANTS], # only in no-snap mode.
'debug-liveedit-double-call': [PASS, NO_VARIANTS],
- 'debug-step-stub-callfunction': [PASS, NO_VARIANTS],
'debug-set-variable-value': [PASS, NO_VARIANTS],
- 'debug-stepin-accessor': [PASS, NO_VARIANTS],
- 'debug-stepin-builtin': [PASS, NO_VARIANTS],
- 'debug-stepin-constructor': [PASS, NO_VARIANTS],
- 'debug-stepin-function-call': [PASS, NO_VARIANTS],
- 'debug-stepnext-do-while': [PASS, NO_VARIANTS],
'debug-stepout-scope-part1': [PASS, NO_VARIANTS],
'debug-stepout-scope-part2': [PASS, NO_VARIANTS],
'debug-stepout-scope-part3': [PASS, NO_VARIANTS],
- 'es6/debug-stepin-microtasks': [PASS, NO_VARIANTS],
- 'es6/debug-stepnext-for': [PASS, NO_VARIANTS],
- 'harmony/debug-evaluate-blockscopes': [PASS, NO_VARIANTS],
-
- # TODO(jarin): Some tests don't like --turbo-deoptimzation very much.
- 'asm/embenchen/lua_binarytrees': [SKIP],
- 'es6/symbols': [PASS, NO_VARIANTS],
- 'regress/regress-354433': [PASS, NO_VARIANTS], # only on ARM simulator.
- 'regress/regress-crbug-259300': [PASS, NO_VARIANTS],
+ 'es6/debug-evaluate-blockscopes': [PASS, NO_VARIANTS],
##############################################################################
# Too slow in debug mode with --stress-opt mode.
@@ -123,6 +110,11 @@
'regress/regress-create-exception': [PASS, ['mode == debug', SKIP]],
##############################################################################
+ # Too slow in debug mode for validation of elements.
+ 'regress/regress-430201': [PASS, ['mode == debug', SKIP]],
+ 'regress/regress-430201b': [PASS, ['mode == debug', SKIP]],
+
+ ##############################################################################
# Too slow in debug mode for GC stress mode.
'regress/regress-crbug-217858': [PASS, ['mode == debug', SKIP]],
@@ -139,6 +131,7 @@
# Very slow on ARM and MIPS, contains no architecture dependent code.
'unicode-case-overoptimization': [PASS, NO_VARIANTS, ['arch == arm or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips', TIMEOUT]],
+ 'regress/regress-3976': [PASS, NO_VARIANTS, ['arch == arm or arch == android_arm or arch == android_arm64 or arch == mipsel or arch == mips64el or arch == mips', SKIP]],
##############################################################################
# This test expects to reach a certain recursion depth, which may not work
@@ -185,6 +178,10 @@
# nosse2. Also for arm novfp3.
'regress/regress-2989': [FAIL, NO_VARIANTS, ['system == linux and arch == x87 or arch == arm and simulator == True', PASS]],
+ # BUG(v8:3985). Wrong materialization of arguments object after throwing
+ # an exception.
+ 'regress/regress-3985': [PASS, FAIL],
+
# Skip endain dependent test for mips due to different typed views of the same
# array buffer.
'nans': [PASS, ],
@@ -194,6 +191,9 @@
# Too slow for slow variants.
'asm/embenchen/*': [PASS, SLOW, FAST_VARIANTS],
+
+ # BUG(v8:3838).
+ 'regress/regress-3116': [PASS, ['isolates', FLAKY]],
}], # ALWAYS
##############################################################################
@@ -210,7 +210,7 @@
'fast-prototype': [SKIP],
'field-type-tracking': [SKIP],
'getters-on-elements': [SKIP],
- 'harmony/block-let-crankshaft': [SKIP],
+ 'es6/block-let-crankshaft': [SKIP],
'opt-elements-kind': [SKIP],
'osr-elements-kind': [SKIP],
'regress/regress-crbug-137689': [SKIP],
@@ -244,8 +244,10 @@
# Issue 3723.
'regress/regress-3717': [SKIP],
- # Issue 3776.
- 'debug-stepframe': [SKIP],
+ # Issue 3924.
+ 'mjsunit/debug-clearbreakpointgroup': [SKIP],
+ # Issue 3969.
+ 'mjsunit/debug-references': [SKIP],
}], # 'gc_stress == True'
##############################################################################
@@ -585,7 +587,17 @@
'readonly': [SKIP],
'array-feedback': [SKIP],
+ # Deopting uses just enough memory to make this one OOM.
+ 'regress/regress-3976': [SKIP],
+
# Deopt every n garbage collections collides with deopt every n times.
'regress/regress-2653': [SKIP],
}], # 'deopt_fuzzer == True'
+
+##############################################################################
+['arch == ppc and simulator_run == True or arch == ppc64 and simulator_run == True', {
+
+ # take too long with the simulator.
+ 'regress/regress-1132': [SKIP],
+}], # 'arch == ppc and simulator_run == True'
]
diff --git a/deps/v8/test/mjsunit/regexp-stack-overflow.js b/deps/v8/test/mjsunit/regexp-stack-overflow.js
new file mode 100644
index 0000000000..63f6971ace
--- /dev/null
+++ b/deps/v8/test/mjsunit/regexp-stack-overflow.js
@@ -0,0 +1,18 @@
+// 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: --stack-size=100
+
+var re = /\w/;
+re.test("a"); // Trigger regexp compile.
+
+function rec() {
+ try {
+ return rec();
+ } catch (e) {
+ return re.test("b");
+ }
+}
+
+assertTrue(rec());
diff --git a/deps/v8/test/mjsunit/regress/regress-1530.js b/deps/v8/test/mjsunit/regress/regress-1530.js
index 20d1f265c0..fa86f62ce5 100644
--- a/deps/v8/test/mjsunit/regress/regress-1530.js
+++ b/deps/v8/test/mjsunit/regress/regress-1530.js
@@ -80,8 +80,10 @@ assertFalse(Object.getOwnPropertyDescriptor(f, 'prototype').writable);
assertThrows("'use strict'; f.prototype = {}");
assertThrows("Object.defineProperty(f, 'prototype', { value: {} })");
-// Verify that non-writability of other properties is respected.
-assertThrows("Object.defineProperty(f, 'name', { value: {} })");
-assertThrows("Object.defineProperty(f, 'length', { value: {} })");
+// Verify that non-configurability of other properties is respected, but
+// non-writability is ignored by Object.defineProperty().
+// name and length are configurable in ES6
+Object.defineProperty(f, 'name', { value: {} });
+Object.defineProperty(f, 'length', { value: {} });
assertThrows("Object.defineProperty(f, 'caller', { value: {} })");
assertThrows("Object.defineProperty(f, 'arguments', { value: {} })");
diff --git a/deps/v8/test/mjsunit/regress/regress-270142.js b/deps/v8/test/mjsunit/regress/regress-270142.js
index 6e0865c4f8..63f4d1414e 100644
--- a/deps/v8/test/mjsunit/regress/regress-270142.js
+++ b/deps/v8/test/mjsunit/regress/regress-270142.js
@@ -39,7 +39,7 @@ function g(x) {
function checkNameDescriptor(f) {
var descriptor = Object.getOwnPropertyDescriptor(f, "name");
- assertFalse(descriptor.configurable);
+ assertTrue(descriptor.configurable);
assertFalse(descriptor.enumerable);
assertFalse(descriptor.writable);
}
diff --git a/deps/v8/test/mjsunit/regress/regress-330046.js b/deps/v8/test/mjsunit/regress/regress-330046.js
index d94b804ac0..eb0d3f38a2 100644
--- a/deps/v8/test/mjsunit/regress/regress-330046.js
+++ b/deps/v8/test/mjsunit/regress/regress-330046.js
@@ -58,4 +58,4 @@ f(10, o3);
// The old code is already deoptimized, but f still points to it.
// Disassembling it will crash.
-%DebugDisassembleFunction(f);
+%DisassembleFunction(f);
diff --git a/deps/v8/test/mjsunit/regress/regress-3960.js b/deps/v8/test/mjsunit/regress/regress-3960.js
new file mode 100644
index 0000000000..4aaab0b067
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3960.js
@@ -0,0 +1,36 @@
+// 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: --allow-natives-syntax
+
+// Test that setting break point is works correctly when the debugger is
+// activated late, which leads to duplicate shared function infos.
+
+(function() {
+ var Debug = %GetDebugContext().Debug;
+
+ function listener(event, exec_state, event_data, data) {
+ if (event != Debug.DebugEvent.Break) return;
+ try {
+ assertTrue(/foo/.test(exec_state.frame(0).sourceLineText()));
+ break_count++;
+ } catch (e) {
+ exception = e;
+ }
+ }
+
+ for (var i = 0; i < 3; i++) {
+ var foo = function() { a = 1; }
+ var exception = null;
+ var break_count = 0;
+ Debug.setListener(listener);
+ if (i < 2) Debug.setBreakPoint(foo, 0, 0);
+ assertTrue(/\[B\d\]a = 1/.test(Debug.showBreakPoints(foo)));
+ foo();
+ assertEquals(1, break_count);
+ assertNull(exception);
+ }
+
+ Debug.setListener(null);
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-3969.js b/deps/v8/test/mjsunit/regress/regress-3969.js
new file mode 100644
index 0000000000..4659e1caf8
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3969.js
@@ -0,0 +1,36 @@
+// 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: --allow-natives-syntax
+
+function Inner() {
+ this.property = "OK";
+ this.o2 = 1;
+}
+
+function Outer(inner) {
+ this.inner = inner;
+}
+
+var inner = new Inner();
+var outer = new Outer(inner);
+
+Outer.prototype.boom = function() {
+ return this.inner.property;
+}
+
+assertEquals("OK", outer.boom());
+assertEquals("OK", outer.boom());
+%OptimizeFunctionOnNextCall(Outer.prototype.boom);
+assertEquals("OK", outer.boom());
+
+inner = undefined;
+%SetAllocationTimeout(0 /*interval*/, 2 /*timeout*/);
+// Call something that will do GC while holding a handle to outer's map.
+// The key is that this lets inner's map die while keeping outer's map alive.
+delete outer.inner;
+
+outer = new Outer({field: 1.51, property: "OK"});
+
+assertEquals("OK", outer.boom());
diff --git a/deps/v8/test/mjsunit/regress/regress-3976.js b/deps/v8/test/mjsunit/regress/regress-3976.js
new file mode 100644
index 0000000000..c151f689f4
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3976.js
@@ -0,0 +1,80 @@
+// Copyright 2015 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (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: --max-old-space-size=60
+
+table = [];
+
+for (var i = 0; i < 32; i++) {
+ table[i] = String.fromCharCode(i + 0x410);
+}
+
+
+var random = (function() {
+ var seed = 10;
+ return function() {
+ seed = (seed * 1009) % 8831;
+ return seed;
+ };
+})();
+
+
+function key(length) {
+ var s = "";
+ for (var i = 0; i < length; i++) {
+ s += table[random() % 32];
+ }
+ return '"' + s + '"';
+}
+
+
+function value() {
+ return '[{' + '"field1" : ' + random() + ', "field2" : ' + random() + '}]';
+}
+
+
+function generate(n) {
+ var s = '{';
+ for (var i = 0; i < n; i++) {
+ if (i > 0) s += ', ';
+ s += key(random() % 10 + 7);
+ s += ':';
+ s += value();
+ }
+ s += '}';
+ return s;
+}
+
+
+print("generating");
+
+var str = generate(50000);
+
+print("parsing " + str.length);
+JSON.parse(str);
+
+print("done");
diff --git a/deps/v8/test/mjsunit/regress/regress-3985.js b/deps/v8/test/mjsunit/regress/regress-3985.js
new file mode 100644
index 0000000000..6dbc4bdadd
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-3985.js
@@ -0,0 +1,45 @@
+// 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: --allow-natives-syntax
+
+var shouldThrow = false;
+
+function h() {
+ try { // Prevent inlining in Crankshaft.
+ } catch(e) { }
+ var res = g.arguments[0].x;
+ if (shouldThrow) {
+ throw res;
+ }
+ return res;
+}
+
+function g(o) { h(); }
+
+function f1() {
+ var o = { x : 1 };
+ g(o);
+ return o.x;
+}
+
+function f2() {
+ var o = { x : 2 };
+ g(o);
+ return o.x;
+}
+
+f1();
+f2();
+f1();
+f2();
+%OptimizeFunctionOnNextCall(f1);
+%OptimizeFunctionOnNextCall(f2);
+shouldThrow = true;
+try { f1(); } catch(e) {
+ assertEquals(e, 1);
+}
+try { f2(); } catch(e) {
+ assertEquals(e, 2);
+}
diff --git a/deps/v8/test/mjsunit/regress/regress-4023.js b/deps/v8/test/mjsunit/regress/regress-4023.js
new file mode 100644
index 0000000000..902741f6f5
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-4023.js
@@ -0,0 +1,67 @@
+// 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: --allow-natives-syntax --expose-gc --block-concurrent-recompilation
+
+function Inner() {
+ this.property = "OK";
+ this.prop2 = 1;
+}
+
+function Outer() {
+ this.o = "u";
+}
+function KeepMapAlive(o) {
+ return o.o;
+}
+function SetInner(o, i) {
+ o.inner_field = i;
+}
+function Crash(o) {
+ return o.inner_field.property;
+}
+
+var inner = new Inner();
+var outer = new Outer();
+
+// Collect type feedback.
+SetInner(new Outer(), inner);
+SetInner(outer, inner);
+
+// This function's only purpose is to stash away a Handle that keeps
+// outer's map alive during the gc() call below. We store this handle
+// on the compiler thread :-)
+KeepMapAlive(outer);
+KeepMapAlive(outer);
+%OptimizeFunctionOnNextCall(KeepMapAlive, "concurrent");
+KeepMapAlive(outer);
+
+// So far, all is well. Collect type feedback and optimize.
+print(Crash(outer));
+print(Crash(outer));
+%OptimizeFunctionOnNextCall(Crash);
+print(Crash(outer));
+
+// Null out references and perform GC. This will keep outer's map alive
+// (due to the handle created above), but will let inner's map die. Hence,
+// inner_field's field type stored in outer's map will get cleared.
+inner = undefined;
+outer = undefined;
+gc();
+
+// We could unblock the compiler thread now. But why bother?
+
+// Now optimize SetInner while inner_field's type is still cleared!
+// This will generate optimized code that stores arbitrary objects
+// into inner_field without checking their type against the field type.
+%OptimizeFunctionOnNextCall(SetInner);
+
+// Use the optimized code to store an arbitrary object into
+// o2's inner_field, without triggering any dependent code deopts...
+var o2 = new Outer();
+SetInner(o2, { invalid: 1.51, property: "OK" });
+// ...and then use the existing code expecting an Inner-class object to
+// read invalid data (in this case, a raw double).
+// We crash trying to convert the raw double into a printable string.
+print(Crash(o2));
diff --git a/deps/v8/test/mjsunit/regress/regress-4027.js b/deps/v8/test/mjsunit/regress/regress-4027.js
new file mode 100644
index 0000000000..3a5d11b8e5
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-4027.js
@@ -0,0 +1,60 @@
+// 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: --allow-natives-syntax --expose-gc
+
+function Inner() {
+ this.inner_name = "inner";
+}
+
+function Boom() {
+ this.boom = "boom";
+}
+
+function Outer() {
+ this.outer_name = "outer";
+}
+
+function SetInner(inner, value) {
+ inner.prop = value;
+}
+
+function SetOuter(outer, value) {
+ outer.inner = value;
+}
+
+var inner1 = new Inner();
+var inner2 = new Inner();
+
+SetInner(inner1, 10);
+SetInner(inner2, 10);
+
+var outer1 = new Outer();
+var outer2 = new Outer();
+var outer3 = new Outer();
+
+SetOuter(outer1, inner1);
+SetOuter(outer1, inner1);
+SetOuter(outer1, inner1);
+
+SetOuter(outer2, inner2);
+SetOuter(outer2, inner2);
+SetOuter(outer2, inner2);
+
+SetOuter(outer3, inner2);
+SetOuter(outer3, inner2);
+SetOuter(outer3, inner2);
+
+
+SetInner(inner2, 6.5);
+
+outer1 = null;
+inner1 = null;
+
+gc();
+
+var boom = new Boom();
+SetOuter(outer2, boom);
+
+gc();
diff --git a/deps/v8/test/mjsunit/regress/regress-430201b.js b/deps/v8/test/mjsunit/regress/regress-430201b.js
new file mode 100644
index 0000000000..056504d1d7
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-430201b.js
@@ -0,0 +1,43 @@
+// Copyright 2010 the V8 project authors. All rights reserved.
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions are
+// met:
+//
+// * Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+// * Redistributions in binary form must reproduce the above
+// copyright notice, this list of conditions and the following
+// disclaimer in the documentation and/or other materials provided
+// with the distribution.
+// * Neither the name of Google Inc. nor the names of its
+// contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+// Flags: --allow-natives-syntax --expose-gc
+
+(function() {
+ var array_1 = [];
+
+ %SetFlags("--stress-compaction");
+ for (var a = 0; a < 10000; a++) { array_1[a * 100] = 0; }
+
+ gc();
+ gc();
+
+ var array_2 = [];
+ for (var i = 0; i < 321361; i++) {
+ array_2[i] = String.fromCharCode(i)[0];
+ }
+})();
diff --git a/deps/v8/test/mjsunit/regress/regress-460937.js b/deps/v8/test/mjsunit/regress/regress-460937.js
new file mode 100644
index 0000000000..cd57f93328
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-460937.js
@@ -0,0 +1,19 @@
+// 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: --allow-natives-syntax
+
+function f() {
+ var a = new Array(100000);
+ var i = 0;
+ while (!%HasFastDoubleElements(a)) {
+ a[i] = i;
+ i += 0.1;
+ }
+ a[1] = 1.5;
+}
+
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
diff --git a/deps/v8/test/mjsunit/regress/regress-463028.js b/deps/v8/test/mjsunit/regress/regress-463028.js
new file mode 100644
index 0000000000..1454ef1aea
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-463028.js
@@ -0,0 +1,18 @@
+// 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: --allow-natives-syntax
+
+var o = {}
+Object.defineProperty(o, "z", {
+ set: function() {
+ %DeoptimizeFunction(f);
+ },
+});
+
+function f(o) {
+ return 19 + (void(o.z = 12));
+}
+
+f(o);
diff --git a/deps/v8/test/mjsunit/regress/regress-469605.js b/deps/v8/test/mjsunit/regress/regress-469605.js
new file mode 100644
index 0000000000..65725117bd
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-469605.js
@@ -0,0 +1,43 @@
+// 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.
+
+function counter() {
+ var i = 100;
+ return function() {
+ if (i-- > 0) return i;
+ throw "done";
+ }
+}
+
+var c1 = counter();
+var c2 = counter();
+
+var f = (function() {
+ "use asm";
+ return function f(i) {
+ i = i|0;
+ do {
+ if (i > 0) c1();
+ else c2();
+ } while (true);
+ }
+})();
+
+assertThrows(function() { f(0); });
+assertThrows(function() { f(1); });
+
+var c3 = counter();
+
+var g = (function() {
+ "use asm";
+ return function g(i) {
+ i = i + 1;
+ do {
+ i = c3(i);
+ } while (true);
+ }
+})();
+
+assertThrows(function() { g(0); });
+assertThrows(function() { g(1); });
diff --git a/deps/v8/test/mjsunit/regress/regress-470804.js b/deps/v8/test/mjsunit/regress/regress-470804.js
new file mode 100644
index 0000000000..cebb91f7e0
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-470804.js
@@ -0,0 +1,53 @@
+// 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-gc
+
+function f() {
+ this.foo00 = 0;
+ this.foo01 = 0;
+ this.foo02 = 0;
+ this.foo03 = 0;
+ this.foo04 = 0;
+ this.foo05 = 0;
+ this.foo06 = 0;
+ this.foo07 = 0;
+ this.foo08 = 0;
+ this.foo09 = 0;
+ this.foo0a = 0;
+ this.foo0b = 0;
+ this.foo0c = 0;
+ this.foo0d = 0;
+ this.foo0e = 0;
+ this.foo0f = 0;
+ this.foo10 = 0;
+ this.foo11 = 0;
+ this.foo12 = 0;
+ this.foo13 = 0;
+ this.foo14 = 0;
+ this.foo15 = 0;
+ this.foo16 = 0;
+ this.foo17 = 0;
+ this.foo18 = 0;
+ this.foo19 = 0;
+ this.foo1a = 0;
+ this.foo1b = 0;
+ this.foo1c = 0;
+ this.foo1d = 0;
+ this.foo1e = 0;
+ this.foo1f = 0;
+ this.d = 1.3;
+ gc();
+ this.boom = 230;
+ this.boom = 1.4;
+}
+
+function g() {
+ return new f();
+}
+g();
+g();
+var o = g();
+assertEquals(0, o.foo00);
+assertEquals(1.4, o.boom);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-385002.js b/deps/v8/test/mjsunit/regress/regress-crbug-385002.js
index 34713e27d4..e9023e1d6d 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-385002.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-385002.js
@@ -4,7 +4,7 @@
// Flags: --stack-size=200 --allow-natives-syntax
-%Break(); // Schedule an interrupt that does not go away.
+%ScheduleBreak(); // Schedule an interrupt that does not go away.
function f() { f(); }
assertThrows(f, RangeError);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-401915.js b/deps/v8/test/mjsunit/regress/regress-crbug-401915.js
index 96dce04868..67ea19158e 100644
--- a/deps/v8/test/mjsunit/regress/regress-crbug-401915.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-401915.js
@@ -10,7 +10,7 @@ Debug.setBreakOnException();
try {
try {
- %DebugPushPromise(new Promise(function() {}));
+ %DebugPushPromise(new Promise(function() {}), function() {});
} catch (e) {
}
throw new Error();
diff --git a/deps/v8/test/mjsunit/harmony/disable-harmony-string.js b/deps/v8/test/mjsunit/regress/regress-crbug-465564.js
index 0b88ae0be9..ea0c8dcf66 100644
--- a/deps/v8/test/mjsunit/harmony/disable-harmony-string.js
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-465564.js
@@ -2,6 +2,6 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-// Flags: --noharmony-strings
+// Flags: --allow-natives-syntax --cache=code
-assertEquals(undefined, String.prototype.includes);
+assertEquals(-1, %StringCompare("a", "b"));
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-467047.js b/deps/v8/test/mjsunit/regress/regress-crbug-467047.js
new file mode 100644
index 0000000000..373e984a2c
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-467047.js
@@ -0,0 +1,17 @@
+// 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: --stack-size=100
+
+function captureMatch(re) {
+ var local_variable = 0;
+ "abcd".replace(re, function() { });
+ assertEquals("abcd", RegExp.input);
+ assertEquals("a", RegExp.leftContext);
+ assertEquals("bc", RegExp.lastMatch);
+ assertEquals("d", RegExp.rightContext);
+ assertEquals("foo", captureMatch(/^bar/));
+}
+
+assertThrows(function() { captureMatch(/(bc)/) }, RangeError);
diff --git a/deps/v8/test/mjsunit/regress/regress-crbug-467531.js b/deps/v8/test/mjsunit/regress/regress-crbug-467531.js
new file mode 100644
index 0000000000..73256c7acc
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-crbug-467531.js
@@ -0,0 +1,25 @@
+// 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: --turbo-filter=* --always-opt
+
+assertThrows(function() {
+ "use strict";
+ try {
+ x = ref_error;
+ let x = 0;
+ } catch (e) {
+ throw e;
+ }
+}, ReferenceError);
+
+assertThrows(function() {
+ "use strict";
+ try {
+ x = ref_error;
+ let x = 0;
+ } finally {
+ // re-throw
+ }
+}, ReferenceError);
diff --git a/deps/v8/test/mjsunit/regress/regress-filter-contexts.js b/deps/v8/test/mjsunit/regress/regress-filter-contexts.js
new file mode 100644
index 0000000000..d2abe00325
--- /dev/null
+++ b/deps/v8/test/mjsunit/regress/regress-filter-contexts.js
@@ -0,0 +1,14 @@
+// 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: --allow-natives-syntax
+
+function f() { return f.x; }
+f.__proto__ = null;
+f.prototype = "";
+
+f();
+f();
+%OptimizeFunctionOnNextCall(f);
+f();
diff --git a/deps/v8/test/mjsunit/regress/regress-function-length-strict.js b/deps/v8/test/mjsunit/regress/regress-function-length-strict.js
index 700f34a67a..77cca24054 100644
--- a/deps/v8/test/mjsunit/regress/regress-function-length-strict.js
+++ b/deps/v8/test/mjsunit/regress/regress-function-length-strict.js
@@ -37,5 +37,5 @@ var desc = Object.getOwnPropertyDescriptor(foo, 'length');
assertEquals(3, desc.value);
assertFalse(desc.writable);
assertFalse(desc.enumerable);
-assertFalse(desc.configurable);
+assertTrue(desc.configurable);
assertThrows(function() { foo.length = 2; }, TypeError);
diff --git a/deps/v8/test/mjsunit/regress/string-compare-memcmp.js b/deps/v8/test/mjsunit/regress/string-compare-memcmp.js
index 45f47343ee..ae4b33ace9 100644
--- a/deps/v8/test/mjsunit/regress/string-compare-memcmp.js
+++ b/deps/v8/test/mjsunit/regress/string-compare-memcmp.js
@@ -4,4 +4,4 @@
// Flags: --allow-natives-syntax
-assertEquals(-1, %StringCompare("abc\u0102", "abc\u0201"));
+assertEquals(-1, %StringCompareRT("abc\u0102", "abc\u0201"));
diff --git a/deps/v8/test/mjsunit/stack-traces.js b/deps/v8/test/mjsunit/stack-traces.js
index f80a627b24..b256033b53 100644
--- a/deps/v8/test/mjsunit/stack-traces.js
+++ b/deps/v8/test/mjsunit/stack-traces.js
@@ -94,6 +94,37 @@ function testAnonymousMethod() {
(function () { FAIL }).call([1, 2, 3]);
}
+function testFunctionName() {
+ function gen(name, counter) {
+ var f = function foo() {
+ if (counter === 0) {
+ FAIL;
+ }
+ gen(name, counter - 1)();
+ }
+ if (counter === 4) {
+ Object.defineProperty(f, 'name', {get: function(){ throw 239; }});
+ } else if (counter == 3) {
+ Object.defineProperty(f, 'name', {value: 'boo' + '_' + counter});
+ } else {
+ Object.defineProperty(f, 'name', {writable: true});
+ if (counter === 2)
+ f.name = 42;
+ else
+ f.name = name + '_' + counter;
+ }
+ return f;
+ }
+ gen('foo', 4)();
+}
+
+function testFunctionInferredName() {
+ var f = function() {
+ FAIL;
+ }
+ f();
+}
+
function CustomError(message, stripPoint) {
this.message = message;
Error.captureStackTrace(this, stripPoint);
@@ -261,6 +292,9 @@ testTrace("testValue", testValue, ["at Number.causeError"]);
testTrace("testConstructor", testConstructor, ["new Plonk"]);
testTrace("testRenamedMethod", testRenamedMethod, ["Wookie.a$b$c$d [as d]"]);
testTrace("testAnonymousMethod", testAnonymousMethod, ["Array.<anonymous>"]);
+testTrace("testFunctionName", testFunctionName,
+ [" at foo_0 ", " at foo_1", " at foo ", " at boo_3 ", " at foo "]);
+testTrace("testFunctionInferredName", testFunctionInferredName, [" at f "]);
testTrace("testDefaultCustomError", testDefaultCustomError,
["hep-hey", "new CustomError"],
["collectStackTrace"]);
diff --git a/deps/v8/test/mjsunit/strict-mode.js b/deps/v8/test/mjsunit/strict-mode.js
index d0839ba0fb..c97429f7b7 100644
--- a/deps/v8/test/mjsunit/strict-mode.js
+++ b/deps/v8/test/mjsunit/strict-mode.js
@@ -25,8 +25,7 @@
// (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: --turbo-deoptimization --noharmony-scoping
-// Flags: --noharmony-classes --noharmony-object-literals
+// Flags: --turbo-deoptimization
function CheckStrictMode(code, exception) {
assertDoesNotThrow(code);
@@ -287,19 +286,6 @@ CheckStrictMode("function strict() { print(--arguments); }", SyntaxError);
CheckStrictMode("function strict() { var x = --eval; }", SyntaxError);
CheckStrictMode("function strict() { var x = --arguments; }", SyntaxError);
-// Use of const in strict mode is disallowed in anticipation of ES Harmony.
-CheckStrictMode("const x = 0;", SyntaxError);
-CheckStrictMode("for (const x = 0; false;) {}", SyntaxError);
-CheckStrictMode("function strict() { const x = 0; }", SyntaxError);
-
-// Strict mode only allows functions in StatementList
-CheckStrictMode("if (true) { function invalid() {} }", SyntaxError);
-CheckStrictMode("for (;false;) { function invalid() {} }", SyntaxError);
-CheckStrictMode("{ function invalid() {} }", SyntaxError);
-CheckStrictMode("try { function invalid() {} } catch(e) {}", SyntaxError);
-CheckStrictMode("try { } catch(e) { function invalid() {} }", SyntaxError);
-CheckStrictMode("function outer() {{ function invalid() {} }}", SyntaxError);
-
// Delete of an unqualified identifier
CheckStrictMode("delete unqualified;", SyntaxError);
CheckStrictMode("function strict() { delete unqualified; }", SyntaxError);
diff --git a/deps/v8/test/mjsunit/string-concat.js b/deps/v8/test/mjsunit/string-concat.js
new file mode 100644
index 0000000000..c669b3bd4b
--- /dev/null
+++ b/deps/v8/test/mjsunit/string-concat.js
@@ -0,0 +1,14 @@
+// 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.
+
+function Stringified(toString) {
+ var valueOf = "-" + toString + "-";
+ return {
+ toString: function() { return toString; },
+ valueOf: function() { return valueOf; }
+ };
+}
+
+assertEquals("a.b.", "a.".concat(Stringified("b.")));
+assertEquals("a.b.c.", "a.".concat(Stringified("b."), Stringified("c.")));
diff --git a/deps/v8/test/mjsunit/string-index.js b/deps/v8/test/mjsunit/string-index.js
index 315708ca5f..1c0e3d915d 100644
--- a/deps/v8/test/mjsunit/string-index.js
+++ b/deps/v8/test/mjsunit/string-index.js
@@ -25,6 +25,8 @@
// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+// Flags: --allow-natives-syntax
+
/**
* @fileoverview Test indexing on strings with [].
*/
@@ -250,6 +252,20 @@ for (var i = 0; i < 100; ++i) {
assertEquals(expected, actual);
}
+// Test out of range with a heap number case.
+var num = Math.floor(4) * 0.5;
+// TODO(mvstanton): figure out a reliable way to get a heap number every time.
+// assertFalse(!%_IsSmi(num));
+var keys = [0, num];
+var str = 'ab', arr = ['a', undefined];
+for (var i = 0; i < 100; ++i) {
+ var index = Math.floor(i / 50);
+ var key = keys[index];
+ var expected = arr[index];
+ var actual = str[key];
+ assertEquals(expected, actual);
+}
+
// Test two byte string.
var str = '\u0427', arr = ['\u0427'];
for (var i = 0; i < 50; ++i) {
diff --git a/deps/v8/test/mjsunit/strong/arrays.js b/deps/v8/test/mjsunit/strong/arrays.js
new file mode 100644
index 0000000000..b9e4fad357
--- /dev/null
+++ b/deps/v8/test/mjsunit/strong/arrays.js
@@ -0,0 +1,12 @@
+// 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: --strong-mode
+
+(function NoEllisions() {
+ assertThrows("'use strong'; [,]", SyntaxError);
+ assertThrows("'use strong'; [,3]", SyntaxError);
+ assertThrows("'use strong'; [3,,4]", SyntaxError);
+ assertTrue(eval("'use strong'; [3,] !== [3,4,]"));
+})();
diff --git a/deps/v8/test/mjsunit/strong/classes.js b/deps/v8/test/mjsunit/strong/classes.js
index 3c7caf5f84..e33742af3f 100644
--- a/deps/v8/test/mjsunit/strong/classes.js
+++ b/deps/v8/test/mjsunit/strong/classes.js
@@ -3,15 +3,58 @@
// found in the LICENSE file.
// Flags: --strong-mode
+// Flags: --harmony-classes --harmony-arrow-functions
'use strong';
class C {}
+function assertTypeError(script) { assertThrows(script, TypeError) }
+function assertSyntaxError(script) { assertThrows(script, SyntaxError) }
+function assertReferenceError(script) { assertThrows(script, ReferenceError) }
+
(function ImmutableClassBindings() {
class D {}
- assertThrows(function(){ eval("C = 0") }, TypeError);
- assertThrows(function(){ eval("D = 0") }, TypeError);
+ assertTypeError(function(){ eval("C = 0") });
+ assertTypeError(function(){ eval("D = 0") });
assertEquals('function', typeof C);
assertEquals('function', typeof D);
})();
+
+function constructor(body) {
+ return "'use strong'; " +
+ "(class extends Object { constructor() { " + body + " } })";
+}
+
+(function NoMissingSuper() {
+ assertReferenceError(constructor(""));
+ assertReferenceError(constructor("1"));
+})();
+
+(function NoNestedSuper() {
+ assertSyntaxError(constructor("(super());"));
+ assertSyntaxError(constructor("(() => super())();"));
+ assertSyntaxError(constructor("{ super(); }"));
+ assertSyntaxError(constructor("if (1) super();"));
+})();
+
+(function NoDuplicateSuper() {
+ assertSyntaxError(constructor("super(), super();"));
+ assertSyntaxError(constructor("super(); super();"));
+ assertSyntaxError(constructor("super(); (super());"));
+ assertSyntaxError(constructor("super(); { super() }"));
+ assertSyntaxError(constructor("super(); (() => super())();"));
+})();
+
+(function NoReturnValue() {
+ assertSyntaxError(constructor("return {};"));
+ assertSyntaxError(constructor("return undefined;"));
+ assertSyntaxError(constructor("{ return {}; }"));
+ assertSyntaxError(constructor("if (1) return {};"));
+})();
+
+(function NoReturnBeforeSuper() {
+ assertSyntaxError(constructor("return; super();"));
+ assertSyntaxError(constructor("if (0) return; super();"));
+ assertSyntaxError(constructor("{ return; } super();"));
+})();
diff --git a/deps/v8/test/mjsunit/strong/declaration-after-use.js b/deps/v8/test/mjsunit/strong/declaration-after-use.js
new file mode 100644
index 0000000000..aa5ff67283
--- /dev/null
+++ b/deps/v8/test/mjsunit/strong/declaration-after-use.js
@@ -0,0 +1,258 @@
+// 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: --strong-mode --harmony_rest_parameters --harmony_arrow_functions --harmony_classes --harmony_computed-property_names
+
+// Note that it's essential for these tests that the reference is inside dead
+// code (because we already produce ReferenceErrors for run-time unresolved
+// variables and don't want to confuse those with strong mode errors). But the
+// errors should *not* be inside lazy, unexecuted functions, since lazy parsing
+// doesn't produce strong mode scoping errors).
+
+// In addition, assertThrows will call eval and that changes variable binding
+// types (see e.g., UNBOUND_EVAL_SHADOWED). We can avoid unwanted side effects
+// by wrapping the code to be tested inside an outer function.
+function assertThrowsHelper(code) {
+ "use strict";
+ let prologue = "(function outer() { if (false) { ";
+ let epilogue = " } })();";
+
+ assertThrows("'use strong'; " + prologue + code + epilogue, ReferenceError);
+
+ // Make sure the error happens only in strong mode (note that we need strict
+ // mode here because of let).
+ assertDoesNotThrow("'use strict'; " + prologue + code + epilogue);
+}
+
+(function DeclarationAfterUse() {
+ // Note that these tests only test cases where the declaration is found but is
+ // after the use. In particular, we cannot yet detect cases where the use can
+ // possibly bind to a global variable.
+ assertThrowsHelper("x; let x = 0;");
+ assertThrowsHelper("function f() { x; let x = 0; }");
+ assertThrowsHelper("function f() { x; } let x = 0;");
+
+ // These tests needs to be done a bit more manually, since var is not allowed
+ // in strong mode:
+ assertThrows(
+ `(function outer() {
+ function f() { 'use strong'; if (false) { x; } } var x = 0; f();
+ })()`,
+ ReferenceError);
+ assertDoesNotThrow(
+ "(function outer() {\n" +
+ " function f() { if (false) { x; } } var x = 0; f(); \n" +
+ "})()");
+
+ assertThrows(
+ "(function outer() {\n" +
+ " function f() { 'use strong'; if (false) { x; } } var x; f(); \n" +
+ "})()",
+ ReferenceError);
+ assertDoesNotThrow(
+ "(function outer() {\n" +
+ " function f() { if (false) { x; } } var x; f(); \n" +
+ "})()");
+
+ // Errors are also detected when the declaration and the use are in the same
+ // eval scope.
+ assertThrows("'use strong'; eval('if (false) { x; let x = 0;}')",
+ ReferenceError);
+ assertDoesNotThrow("'use strict'; eval('if (false) { x; let x = 0; }')");
+
+ // Use occurring in the initializer of the declaration:
+ assertThrowsHelper("let x = x + 1;");
+ assertThrowsHelper("let x = x;");
+ assertThrowsHelper("let x = y, y = 4;");
+ assertThrowsHelper("let x = function() { x; }");
+ assertThrowsHelper("let x = a => { x; }");
+ assertThrowsHelper("function f(x) { return x; }; let x = f(x);");
+ assertThrowsHelper("const x = x;");
+ assertThrowsHelper("const x = function() { x; }");
+ assertThrowsHelper("const x = a => { x; }");
+ assertThrowsHelper("function f(x) {return x}; const x = f(x);");
+
+ assertThrowsHelper("for (let x = x; ; ) { }");
+ assertThrowsHelper("for (const x = x; ; ) { }");
+ assertThrowsHelper("for (let x = y, y; ; ) { }");
+ assertThrowsHelper("for (const x = y, y = 0; ; ) { }");
+
+ // Computed property names
+ assertThrowsHelper("let o = { 'a': 'b', [o.a]: 'c'};");
+})();
+
+
+(function DeclarationAfterUseInClasses() {
+ assertThrowsHelper("class C extends C { }");
+ assertThrowsHelper("let C = class C2 extends C { }");
+ assertThrowsHelper("let C = class C2 extends C2 { }");
+
+ assertThrowsHelper("let C = class C2 { constructor() { C; } }");
+ assertThrowsHelper("let C = class C2 { method() { C; } }");
+ assertThrowsHelper("let C = class C2 { *generator_method() { C; } }");
+
+ assertThrowsHelper(
+ `let C = class C2 {
+ static a() { return 'A'; }
+ [C.a()]() { return 'B'; }
+ };`);
+
+ assertThrowsHelper(
+ `let C = class C2 {
+ static a() { return 'A'; }
+ [C2.a()]() { return 'B'; }
+ };`);
+
+ assertThrowsHelper(
+ `let C = class C2 {
+ [(function() { C; return 'A';})()]() { return 'B'; }
+ };`);
+
+ // The reference to C or C2 is inside a function, but not a method.
+ assertThrowsHelper(
+ `let C = class C2 {
+ [(function() { C2; return 'A';})()]() { return 'B'; }
+ };`);
+
+ assertThrowsHelper(
+ `let C = class C2 {
+ [(function() { C; return 'A';})()]() { return 'B'; }
+ };`);
+
+ // The reference to C or C2 is inside a method, but it's not a method of the
+ // relevant class (C2).
+ assertThrowsHelper(
+ `let C = class C2 {
+ [(new (class D { m() { C2; return 'A'; } })).m()]() {
+ return 'B';
+ }
+ }`);
+
+ assertThrowsHelper(
+ `let C = class C2 {
+ [(new (class D { m() { C; return 'A'; } })).m()]() {
+ return 'B';
+ }
+ }`);
+
+ assertThrowsHelper(
+ `let C = class C2 {
+ [({m() { C2; return 'A'; }}).m()]() { return 'B'; }
+ }`);
+
+ assertThrowsHelper(
+ `let C = class C2 {
+ [({m() { C; return 'A'; }}).m()]() { return 'B'; }
+ }`);
+
+ assertThrowsHelper(
+ `class COuter {
+ m() {
+ class CInner {
+ [({ m() { CInner; return 'A'; } }).m()]() {
+ return 'B';
+ }
+ }
+ }
+ }`);
+})();
+
+
+(function UsesWhichAreFine() {
+ "use strong";
+
+ let var1 = 0;
+ var1;
+
+ let var2a = 0, var2b = var2a + 1, var2c = 2 + var2b;
+
+ for (let var3 = 0; var3 < 1; var3++) {
+ var3;
+ }
+
+ for (let var4a = 0, var4b = var4a; var4a + var4b < 4; var4a++, var4b++) {
+ var4a;
+ var4b;
+ }
+
+ let var5 = 5;
+ for (; var5 < 10; ++var5) { }
+
+ let arr = [1, 2];
+ for (let i of arr) {
+ i;
+ }
+
+ let var6 = [1, 2];
+ // The second var6 resolves to outside (not to the first var6).
+ for (let var6 of var6) { var6; }
+
+ try {
+ throw "error";
+ } catch (e) {
+ e;
+ }
+
+ function func1() { func1; this; }
+ func1();
+ func1;
+
+ function * func2() { func2; this; }
+ func2();
+ func2;
+
+ function func4(p, ...rest) { p; rest; this; func2; }
+ func4();
+
+ let func5 = (p1, p2) => { p1; p2; };
+ func5();
+
+ let func5b = p1 => p1;
+ func5b();
+
+ function func6() {
+ var1, var2a, var2b, var2c;
+ }
+
+ (function eval1() {
+ let var7 = 0; // Declaration position will be something large.
+ // But use position will be something small, however, this is not an error,
+ // since the use is inside an eval scope.
+ eval("var7;");
+ })();
+
+
+ class C1 { constructor() { C1; } }; new C1();
+ let C2 = class C3 { constructor() { C3; } }; new C2();
+
+ class C4 { method() { C4; } *generator_method() { C4; } }; new C4();
+ let C5 = class C6 { method() { C6; } *generator_method() { C6; } }; new C5();
+
+ class C7 { static method() { C7; } }; new C7();
+ let C8 = class C9 { static method() { C9; } }; new C8();
+
+ class C10 { get x() { C10; } }; new C10();
+ let C11 = class C12 { get x() { C12; } }; new C11();
+
+ // Regression test for unnamed classes.
+ let C13 = class { m() { var1; } };
+
+ class COuter {
+ m() {
+ class CInner {
+ // Here we can refer to COuter but not to CInner (see corresponding
+ // assertion test):
+ [({ m() { COuter; return 'A'; } }).m()]() { return 'B'; }
+ // And here we can refer to both:
+ n() { COuter; CInner; }
+ }
+ return new CInner();
+ }
+ }
+ (new COuter()).m().n();
+
+ // Making sure the check which is supposed to prevent "object literal inside
+ // computed property name references the class name" is not too generic:
+ class C14 { m() { let obj = { n() { C14 } }; obj.n(); } }; (new C14()).m();
+})();
diff --git a/deps/v8/test/mjsunit/strong/functions.js b/deps/v8/test/mjsunit/strong/functions.js
index 4869ac6dfa..6956462e5d 100644
--- a/deps/v8/test/mjsunit/strong/functions.js
+++ b/deps/v8/test/mjsunit/strong/functions.js
@@ -6,28 +6,82 @@
'use strong';
+function f() {}
+function* g() {}
+
(function NoArguments() {
assertThrows("'use strong'; arguments", SyntaxError);
assertThrows("'use strong'; function f() { arguments }", SyntaxError);
+ assertThrows("'use strong'; function* g() { arguments }", SyntaxError);
assertThrows("'use strong'; let f = function() { arguments }", SyntaxError);
+ assertThrows("'use strong'; let g = function*() { arguments }", SyntaxError);
assertThrows("'use strong'; let f = () => arguments", SyntaxError);
// The following are strict mode errors already.
assertThrows("'use strong'; let arguments", SyntaxError);
assertThrows("'use strong'; function f(arguments) {}", SyntaxError);
+ assertThrows("'use strong'; function* g(arguments) {}", SyntaxError);
assertThrows("'use strong'; let f = (arguments) => {}", SyntaxError);
})();
-function g() {}
+(function NoArgumentsProperty() {
+ assertFalse(f.hasOwnProperty("arguments"));
+ assertFalse(g.hasOwnProperty("arguments"));
+ assertThrows(function(){ f.arguments = 0 }, TypeError);
+ assertThrows(function(){ g.arguments = 0 }, TypeError);
+})();
+
+(function NoCaller() {
+ assertFalse(f.hasOwnProperty("caller"));
+ assertFalse(g.hasOwnProperty("caller"));
+ assertThrows(function(){ f.caller = 0 }, TypeError);
+ assertThrows(function(){ g.caller = 0 }, TypeError);
+})();
+
+(function NoCallee() {
+ assertFalse("callee" in f);
+ assertFalse("callee" in g);
+ assertThrows(function(){ f.callee = 0 }, TypeError);
+ assertThrows(function(){ g.callee = 0 }, TypeError);
+})();
-(function LexicalFunctionBindings(global) {
+(function LexicalBindings(global) {
+ assertEquals('function', typeof f);
assertEquals('function', typeof g);
+ assertEquals(undefined, global.f);
assertEquals(undefined, global.g);
})(this);
-(function ImmutableFunctionBindings() {
- function f() {}
- assertThrows(function(){ eval("g = 0") }, TypeError);
- assertThrows(function(){ eval("f = 0") }, TypeError);
- assertEquals('function', typeof g);
+(function ImmutableBindings() {
+ function f2() {}
+ function* g2() {}
+ assertThrows(function(){ f = 0 }, TypeError);
+ assertThrows(function(){ g = 0 }, TypeError);
+ assertThrows(function(){ f2 = 0 }, TypeError);
+ assertThrows(function(){ g2 = 0 }, TypeError);
assertEquals('function', typeof f);
+ assertEquals('function', typeof g);
+ assertEquals('function', typeof f2);
+ assertEquals('function', typeof g2);
+})();
+
+(function NonExtensible() {
+ assertThrows(function(){ f.a = 0 }, TypeError);
+ assertThrows(function(){ g.a = 0 }, TypeError);
+ assertThrows(function(){ Object.defineProperty(f, "a", {value: 0}) }, TypeError);
+ assertThrows(function(){ Object.defineProperty(g, "a", {value: 0}) }, TypeError);
+ assertThrows(function(){ Object.setPrototypeOf(f, {}) }, TypeError);
+ assertThrows(function(){ Object.setPrototypeOf(g, {}) }, TypeError);
+})();
+
+(function NoPrototype() {
+ assertFalse("prototype" in f);
+ assertFalse(g.hasOwnProperty("prototype"));
+ assertThrows(function(){ f.prototype = 0 }, TypeError);
+ assertThrows(function(){ g.prototype = 0 }, TypeError);
+ assertThrows(function(){ f.prototype.a = 0 }, TypeError);
+})();
+
+(function NonConstructor() {
+ assertThrows(function(){ new f }, TypeError);
+ assertThrows(function(){ new g }, TypeError);
})();