[v8-test262-automation] Changes from https://github.com/v8/v8.git at sha d540724b on Fri Nov 09 2018 18:55:42 GMT+0000 (Coordinated Universal Time)

This commit is contained in:
test262-automation 2018-11-09 18:56:19 +00:00
parent 8ed9947df1
commit 43cce788bd
32 changed files with 149 additions and 774 deletions

View File

@ -29,9 +29,6 @@
[ALWAYS, {
# TODO(jochen): The following test is flaky.
'overrides/caching': [PASS, FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=8414
'regress-8414': [FAIL],
}], # ALWAYS
['variant == no_wasm_traps', {
@ -52,16 +49,11 @@
'relative-time-format/default-locale-fr-CA': [FAIL],
'relative-time-format/default-locale-pt-BR': [FAIL],
# These tests use some locales which are unsupported on Android.
'regress-8413-day': [FAIL],
'regress-8413-era': [FAIL],
'regress-8413-hour': [FAIL],
'regress-8413-minute': [FAIL],
'regress-8413-month': [FAIL],
'regress-8413-second': [FAIL],
'regress-8413-timeZoneName': [FAIL],
'regress-8413-weekday': [FAIL],
'regress-8413-year': [FAIL],
# https://bugs.chromium.org/p/v8/issues/detail?id=8432
'regress-8432': [FAIL],
# https://crbug.com/v8/8414
'regress-8414': [FAIL],
}], # 'system == android'
['tsan', {
# Run for too long under some tsan configs.

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -2,6 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// "ar-SA" has problem on Android, split it to regress-8432.js
// All the known locales egrep by
// find third_party/icu/source/data/locales/*.txt|cut -d: -f 1| \
// sort -u|cut -d/ -f6|cut -d. -f1|tr "_" "-"
@ -9,7 +10,7 @@ let locales = [
"af-NA", "af", "af-ZA", "agq-CM", "agq", "ak-GH", "ak", "am-ET", "am", "an",
"ar-001", "ar-AE", "ar-BH", "ar-DJ", "ar-DZ", "ar-EG", "ar-EH", "ar-ER",
"ar-IL", "ar-IQ", "ar-JO", "ar-KM", "ar-KW", "ar-LB", "ar-LY", "ar-MA",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", "ar-SA", "ar-SD", "ar-SO", "ar-SS",
"ar-MR", "ar-OM", "ar-PS", "ar-QA", /* "ar-SA", */ "ar-SD", "ar-SO", "ar-SS",
"ars", "ar-SY", "ar-TD", "ar-TN", "ar", "ar-YE", "asa", "asa-TZ", "as-IN",
"ast-ES", "ast", "as", "az-AZ", "az-Cyrl-AZ", "az-Cyrl", "az-Latn-AZ",
"az-Latn", "az", "bas-CM", "bas", "be-BY", "bem", "bem-ZM", "be", "bez",

View File

@ -0,0 +1,42 @@
// Copyright 2018 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.
// Somehow only ar-SA fail on Android in regress-8413*.js
// Split it into this test just for ar-SA
// This is likely to be an ICU data trimming issue only apply to Android.
let locales = [ "ar-SA" ];
// "Table 5: Components of date and time formats" as in
// https://ecma-international.org/ecma-402/#sec-datetimeformat-abstracts
let table5 = [
["weekday", ["narrow", "short", "long"]],
["era", ["narrow", "short", "long"]],
["year", ["2-digit", "numeric"]],
["month", ["2-digit", "numeric", "narrow", "short", "long"]],
["day", ["2-digit", "numeric"]],
["hour", ["2-digit", "numeric"]],
["minute", ["2-digit", "numeric"]],
["second", ["2-digit", "numeric"]],
["timeZoneName", ["short", "long"]]
];
// Test each locale
for (let loc of locales) {
// Test each property in Table 5
for (let row of table5) {
let prop = row[0];
let values = row[1];
// Test each value of the property
for (let value of values) {
let opt = {};
opt[prop] = value;
let dft = new Intl.DateTimeFormat([loc], opt);
let result = dft.resolvedOptions();
assertTrue(values.indexOf(result[prop]) >= 0,
"Expect new Intl.DateTimeFormat([" + loc + "], {" + prop + ": '" +
value + "'}).resolvedOptions()['" + prop + "'] to return one of [" +
values + "] but got '" + result[prop] + "'");
}
}
}

View File

@ -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-do-expressions
// Flags: --allow-natives-syntax
(function TestBasics() {
var C = class C {}
@ -1038,31 +1038,6 @@ function testClassRestrictedProperties(C) {
(function testReturnFromClassLiteral() {
function usingDoExpressionInBody() {
let x = 42;
let dummy = function() {x};
try {
class C {
dummy() {C}
[do {return}]() {}
};
} finally {
return x;
}
}
assertEquals(42, usingDoExpressionInBody());
function usingDoExpressionInExtends() {
let x = 42;
let dummy = function() {x};
try {
class C extends (do {return}) { dummy() {C} };
} finally {
return x;
}
}
assertEquals(42, usingDoExpressionInExtends());
function usingYieldInBody() {
function* foo() {
class C {

View File

@ -0,0 +1,12 @@
// Copyright 2018 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.
// Previously, spreading in-object properties would always treat double fields
// as tagged, potentially dereferencing a Float64.
function inobjectDouble() {
"use strict";
this.x = -3.9;
}
const instance = new inobjectDouble();
const clone = { ...instance, };

View File

@ -0,0 +1,15 @@
// Copyright 2018 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 clone(src) {
return { ...src };
}
function inobjectDoubles() {
"use strict";
this.p0 = -6400510997704731;
}
// Check that unboxed double is not treated as tagged
assertEquals({ p0: -6400510997704731 }, clone(new inobjectDoubles()));

View File

@ -145,6 +145,10 @@
assertEquals(-4n, BigInt.asIntN(3, "12"));
assertEquals(0x123456789abcdefn,
BigInt.asIntN(64, 0xabcdef0123456789abcdefn));
}{
// Regression test for crbug.com/v8/8426.
assertEquals(-0x8000000000000000n,
BigInt.asIntN(64, -0x8000000000000000n));
}
// BigInt.asUintN

View File

@ -1,21 +0,0 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-do-expressions --nolazy
function hoist_unique_do_var() {
var f = (y = do { var unique = 3 }) => unique;
assertEquals(3, f());
assertThrows(() => unique, ReferenceError);
}
hoist_unique_do_var();
function hoist_duplicate_do_var() {
var duplicate = 100;
var f = (y = do { var duplicate = 3 }) => duplicate;
assertEquals(3, f());
// TODO(verwaest): The {duplicate} declarations were invalidly merged.
assertEquals(3, duplicate);
}
hoist_duplicate_do_var();

View File

@ -1,95 +0,0 @@
// Copyright 2017 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-do-expressions
(function testBasic() {
let f = (x = eval("var z = 42; z"), y = do { 43 }) => x + y;
assertEquals(85, f());
})();
(function testReturnParam() {
let f = (x = eval("var z = 42; z"), y = do { x }) => x + y;
assertEquals(84, f());
})();
(function testCaptureParam() {
let f = (x = eval("var z = 42; z"), y = do { () => x }) => x + y();
assertEquals(84, f());
})();
(function testScoped() {
let f = (x = eval("var z = 42; z"), y = do { let z; x }) => x + y;
assertEquals(84, f());
})();
(function testCaptureScoped() {
let f = (x = eval("var z = 42; z"), y = do { let z; () => x }) => x + y();
assertEquals(84, f());
})();
(function testCaptureOuter() {
let z = 44;
let f = (x = eval("var z = 42; z"), y = do { () => z }) => x + y();
assertEquals(86, f())
})();
(function testCaptureOuterScoped() {
let z = 44;
let f = (x = eval("var z = 42; z"), y = do { let q; () => z }) => x + y();
assertEquals(86, f())
})();
(function testWith() {
let f = (x = eval("var z = 42; z"),
y = do {
with ({foo: "bar"}) {
() => x }
}) => x + y();
assertEquals(84, f())
})();
(function testTry() {
let f = (x = eval("var z = 42; z"),
y = do {
try { () => x }
catch (e) { }
}) => x + y();
assertEquals(84, f())
})();
(function testCatch() {
let f = (x = eval("var z = 42; z"),
y = do {
try { throw 42 }
catch (e) { () => x }
}) => x + y();
assertEquals(84, f())
})();
(function testFinally() {
let z = 44;
let q;
let f = (x = eval("var z = 42; z"),
y = do {
try { }
catch (e) { }
finally { q = () => z }
q;
}) => x + y();
assertEquals(86, f())
})();
(function testFinallyThrow() {
let z = 44;
let q;
let f = (x = eval("var z = 42; z"),
y = do {
try { throw 42; }
catch (e) { }
finally { q = () => z }
q;
}) => x + y();
assertEquals(86, f())
})();

View File

@ -1,109 +0,0 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-do-expressions
(function TestDoForInDoBreak() {
function f(o, i) {
var a = "result@" + do {
var r = "(";
for (var x in o) {
var b = "end@" + do {
if (x == i) { break } else { r += o[x]; x }
}
}
r + ")";
}
return a + "," + b;
}
assertEquals("result@(3),end@0", f([3], 2));
assertEquals("result@(35),end@1", f([3,5], 2));
assertEquals("result@(35),end@1", f([3,5,7], 2));
assertEquals("result@(35),end@1", f([3,5,7,9], 2));
%OptimizeFunctionOnNextCall(f);
assertEquals("result@(3),end@0", f([3], 2));
assertEquals("result@(35),end@1", f([3,5], 2));
assertEquals("result@(35),end@1", f([3,5,7], 2));
assertEquals("result@(35),end@1", f([3,5,7,9], 2));
})();
(function TestDoForInDoContinue() {
function f(o, i) {
var a = "result@" + do {
var r = "("
for (var x in o) {
var b = "end@" + do {
if (x == i) { continue } else { r += o[x]; x }
}
}
r + ")"
}
return a + "," + b
}
assertEquals("result@(3),end@0", f([3], 2));
assertEquals("result@(35),end@1", f([3,5], 2));
assertEquals("result@(35),end@1", f([3,5,7], 2));
assertEquals("result@(359),end@3", f([3,5,7,9], 2));
%OptimizeFunctionOnNextCall(f);
assertEquals("result@(3),end@0", f([3], 2));
assertEquals("result@(35),end@1", f([3,5], 2));
assertEquals("result@(35),end@1", f([3,5,7], 2));
assertEquals("result@(359),end@3", f([3,5,7,9], 2));
})();
(function TestDoForNestedWithTargetLabels() {
function f(mode) {
var loop = true;
var head = "<";
var tail = ">";
var middle =
"1" + do { loop1: for(; loop; head += "A") {
"2" + do { loop2: for(; loop; head += "B") {
"3" + do { loop3: for(; loop; head += "C") {
"4" + do { loop4: for(; loop; head += "D") {
"5" + do { loop5: for(; loop; head += "E") {
"6" + do { loop6: for(; loop; head += "F") {
loop = false;
switch (mode) {
case "b1": break loop1;
case "b2": break loop2;
case "b3": break loop3;
case "b4": break loop4;
case "b5": break loop5;
case "b6": break loop6;
case "c1": continue loop1;
case "c2": continue loop2;
case "c3": continue loop3;
case "c4": continue loop4;
case "c5": continue loop5;
case "c6": continue loop6;
default: "7";
}
}}
}}
}}
}}
}}
}}
return head + middle + tail;
}
function test() {
assertEquals( "<1undefined>", f("b1"));
assertEquals( "<A1undefined>", f("c1"));
assertEquals( "<A12undefined>", f("b2"));
assertEquals( "<BA12undefined>", f("c2"));
assertEquals( "<BA123undefined>", f("b3"));
assertEquals( "<CBA123undefined>", f("c3"));
assertEquals( "<CBA1234undefined>", f("b4"));
assertEquals( "<DCBA1234undefined>", f("c4"));
assertEquals( "<DCBA12345undefined>", f("b5"));
assertEquals( "<EDCBA12345undefined>", f("c5"));
assertEquals( "<EDCBA123456undefined>", f("b6"));
assertEquals("<FEDCBA123456undefined>", f("c6"));
assertEquals("<FEDCBA1234567>", f("xx"));
}
test();
%OptimizeFunctionOnNextCall(f);
test();
})();

View File

@ -1,305 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-do-expressions --allow-natives-syntax --no-always-opt --opt
function returnValue(v) { return v; }
function MyError() {}
var global = this;
function TestBasic() {
// Looping and lexical declarations
assertEquals(512, returnValue(do {
let n = 2;
for (let i = 0; i < 4; i++) n <<= 2;
}));
// Strings do the right thing
assertEquals("spooky halloween", returnValue(do {
"happy halloween".replace('happy', 'spooky');
}));
// Do expressions with no completion produce an undefined value
assertEquals(undefined, returnValue(do {}));
assertEquals(undefined, returnValue(do { var x = 99; }));
assertEquals(undefined, returnValue(do { function f() {}; }));
assertEquals(undefined, returnValue(do { let z = 33; }));
// Propagation of exception
assertThrows(function() {
(do {
throw new MyError();
"potatoes";
});
}, MyError);
assertThrows(function() {
return do {
throw new MyError();
"potatoes";
};
}, MyError);
// Return value within do-block overrides `return |do-expression|`
assertEquals("inner-return", (function() {
return "outer-return" + do {
return "inner-return";
"";
};
})());
var count = 0, n = 1;
// Breaking out |do-expression|
assertEquals(3, (function() {
for (var i = 0; i < 10; ++i) (count += 2 * do { if (i === 3) break; ++n });
return i;
})());
// (2 * 2) + (2 * 3) + (2 * 4)
assertEquals(18, count);
// Continue in |do-expression|
count = 0, n = 1;
assertEquals([1, 3, 5, 7, 9], (function() {
var values = [];
for (var i = 0; i < 10; ++i) {
count += 2 * (do {
if ((i & 1) === 0) continue;
values.push(i);
++n;
}) + 1;
}
// (2*2) + 1 + (2*3) + 1 + (2*4) + 1 + (2*5) + 1 + (2*6) + 1
return values;
})());
assertEquals(count, 45);
assertThrows("(do { break; });", SyntaxError);
assertThrows("(do { continue; });", SyntaxError);
// Real-world use case for desugaring
var array = [1, 2, 3, 4, 5], iterable = [6, 7, 8,9];
assertEquals([1, 2, 3, 4, 5, 6, 7, 8, 9], do {
for (var element of iterable) array.push(element);
array;
});
// Nested do-expressions
assertEquals(125, do { (do { (do { 5 * 5 * 5 }) }) });
// Directives are not honoured
(do {
"use strict";
foo = 80;
assertEquals(foo, 80);
});
// Non-empty operand stack testing
var O = {
method1() {
let x = 256;
return x + do {
for (var i = 0; i < 4; ++i) x += i;
} + 17;
},
method2() {
let x = 256;
this.reset();
return x + do {
for (var i = 0; i < this.length(); ++i) x += this.index() * 2;
};
},
_index: 0,
index() {
return ++this._index;
},
_length: 4,
length() { return this._length; },
reset() { this._index = 0; }
};
assertEquals(535, O["method" + do { 1 } + ""]());
assertEquals(532, O["method" + do { ({ valueOf() { return "2"; } }); }]());
assertEquals(532, O[
do { let s = ""; for (let c of "method") s += c; } + "2"]());
}
TestBasic();
function TestDeoptimization1() {
function f(v) {
return 88 + do {
v.a * v.b + v.c;
};
}
var o1 = {};
o1.a = 10;
o1.b = 5;
o1.c = 50;
var o2 = {};
o2.c = 100;
o2.a = 10;
o2.b = 10;
assertEquals(188, f(o1));
assertEquals(188, f(o1));
%OptimizeFunctionOnNextCall(f);
assertEquals(188, f(o1));
assertOptimized(f);
assertEquals(288, f(o2));
assertUnoptimized(f);
assertEquals(288, f(o2));
}
TestDeoptimization1();
function TestInParameterInitializers() {
var first_name = "George";
var last_name = "Jetson";
function fn1(name = do { first_name + " " + last_name }) {
return name;
}
assertEquals("George Jetson", fn1());
var _items = [1, 2, 3, NaN, 4, 5];
function fn2(items = do {
let items = [];
for (var el of _items) {
if (el !== el) {
items;
break;
}
items.push(el), items;
}
}) {
return items;
}
assertEquals([1, 2, 3], fn2());
function thrower() { throw new MyError(); }
function fn3(exception = do { try { thrower(); } catch (e) { e } }) {
return exception;
}
assertDoesNotThrow(fn3);
assertInstanceof(fn3(), MyError);
function fn4(exception = do { throw new MyError() }) {}
function catcher(fn) {
try {
fn();
assertUnreachable("fn() initializer should throw");
} catch (e) {
assertInstanceof(e, MyError);
}
}
catcher(fn4);
}
TestInParameterInitializers();
function TestWithEval() {
(function sloppy1() {
assertEquals(do { eval("var x = 5"), x }, 5);
assertEquals(x, 5);
})();
assertThrows(function strict1() {
"use strict";
(do { eval("var x = 5"), x }, 5);
}, ReferenceError);
assertThrows(function strict2() {
(do { eval("'use strict'; var x = 5"), x }, 5);
}, ReferenceError);
}
TestWithEval();
function TestHoisting() {
(do { var a = 1; });
assertEquals(a, 1);
assertEquals(global.a, undefined);
(do {
for (let it of [1, 2, 3, 4, 5]) {
var b = it;
}
});
assertEquals(b, 5);
assertEquals(global.b, undefined);
{
let x = 1
// TODO(caitp): ensure VariableStatements in |do-expressions| in parameter
// initializers, are evaluated in the same VariableEnvironment as they would
// be for eval().
// function f1(a = do { var x = 2 }, b = x) { return b }
// assertEquals(1, f1())
// function f2(a = x, b = do { var x = 2 }) { return a }
// assertEquals(1, f2())
function f3({a = do { var x = 2 }, b = x}) { return b }
assertEquals(2, f3({}))
function f4({a = x, b = do { var x = 2 }}) { return b }
assertEquals(undefined, f4({}))
function f5(a = do { var y = 0 }) {}
assertThrows(() => y, ReferenceError)
}
// TODO(caitp): Always block-scope function declarations in |do| expressions
//(do {
// assertEquals(true, inner_func());
// function inner_func() { return true; }
//});
//assertThrows(function() { return innerFunc(); }, ReferenceError);
}
TestHoisting();
// v8:4661
function tryFinallySimple() { (do { try {} finally {} }); }
tryFinallySimple();
tryFinallySimple();
tryFinallySimple();
tryFinallySimple();
var finallyRanCount = 0;
function tryFinallyDoExpr() {
return (do {
try {
throw "BOO";
} catch (e) {
"Caught: " + e + " (" + finallyRanCount + ")"
} finally {
++finallyRanCount;
}
});
}
assertEquals("Caught: BOO (0)", tryFinallyDoExpr());
assertEquals(1, finallyRanCount);
assertEquals("Caught: BOO (1)", tryFinallyDoExpr());
assertEquals(2, finallyRanCount);
assertEquals("Caught: BOO (2)", tryFinallyDoExpr());
assertEquals(3, finallyRanCount);
assertEquals("Caught: BOO (3)", tryFinallyDoExpr());
assertEquals(4, finallyRanCount);
function TestOSR() {
var numbers = do {
let nums = [];
for (let i = 0; i < 1000; ++i) {
let value = (Math.random() * 100) | 0;
nums.push(value === 0 ? 1 : value), nums;
}
};
assertEquals(numbers.length, 1000);
}
for (var i = 0; i < 64; ++i) TestOSR();

View File

@ -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-do-expressions --allow-natives-syntax
// Flags: --allow-natives-syntax
function MaybeOptimizeOrDeoptimize(f) {
@ -428,14 +428,6 @@ function Throw(generator, ...args) {
assertEquals({value: 4, done: false}, Next(g));
}
{
function* foo() { yield 2; (do {yield 3}) + 42; yield 4 }
g = foo();
assertEquals({value: 2, done: false}, Next(g));
assertEquals({value: 3, done: false}, Next(g));
assertEquals({value: 4, done: false}, Next(g));
}
{
function* foo() { yield 2; return (yield 3) + 42; yield 4 }
g = foo();

View File

@ -1,21 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-do-expressions
(function testWithSimpleLoopVariable() {
var f = (x, y = (do { var s=0; for (var e of x) s += e; s; })) => y*(y+1);
var result = f([1,2,3]); // core dump here, if not fixed.
assertEquals(result, 42);
})();
(function testWithComplexLoopVariable() {
var f = (x, i=x[0]-1, a=[],
y = (do { var s=0;
for (a[i] of x) s += a[i++];
s;
})) => y*(a[0]+a[1]*a[2]);
var result = f([1,2,3]); // core dump here, if not fixed.
assertEquals(result, 42);
})();

View File

@ -1,45 +0,0 @@
// Copyright 2016 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-do-expressions
(function DoTryCatchInsideBinop() {
function f(a, b) {
return a + do { try { throw "boom" } catch(e) { b } }
}
assertEquals(3, f(1, 2));
assertEquals(3, f(1, 2));
%OptimizeFunctionOnNextCall(f);
assertEquals(3, f(1, 2));
})();
(function DoTryCatchInsideCall() {
function f(a, b) {
return Math.max(a, do { try { throw a } catch(e) { e + b } })
}
assertEquals(3, f(1, 2));
assertEquals(3, f(1, 2));
%OptimizeFunctionOnNextCall(f);
assertEquals(3, f(1, 2));
})();
(function DoTryCatchInsideTry() {
function f(a, b) {
try { return do { try { throw a } catch(e) { e + b } } } catch(e) {}
}
assertEquals(3, f(1, 2));
assertEquals(3, f(1, 2));
%OptimizeFunctionOnNextCall(f);
assertEquals(3, f(1, 2));
})();
(function DoTryCatchInsideFinally() {
function f(a, b) {
try {} finally { return do { try { throw a } catch(e) { e + b } } }
}
assertEquals(3, f(1, 2));
assertEquals(3, f(1, 2));
%OptimizeFunctionOnNextCall(f);
assertEquals(3, f(1, 2));
})();

View File

@ -1,24 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-do-expressions
(function testCatchScopeInDoExpression() {
var f = (s = 17, y = do { try { throw 25; } catch(e) { s += e; }; }) => s;
var result = f();
assertEquals(result, 42);
})();
(function testCatchScopeInDoExpression() {
var f = (s = 17, y = do { let t; try { throw 25; } catch(e) { s += e; }; }) => s;
var result = f();
assertEquals(result, 42);
})();
(function testCatchScopeInDoExpression() {
let t1;
var f = (s = 17, y = do { let t2; try { throw 25; } catch(e) { s += e; }; }) => s;
var result = f();
assertEquals(result, 42);
})();

View File

@ -1,16 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
//
// Flags: --harmony-do-expressions --allow-natives-syntax
function func1() {
for (var i = 0; i < 64; ++i) func2();
}
%OptimizeFunctionOnNextCall(func1);
func1();
function func2() {
var v = do {};
}

View File

@ -1,16 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --harmony-do-expressions
(function testWithoutOtherLiteral() {
var result = ((x = [...[42]]) => x)();
assertEquals(result, [42]);
})();
(function testWithSomeOtherLiteral() {
[]; // important: an array literal before the arrow function
var result = ((x = [...[42]]) => x)(); // will core dump, if not fixed.
assertEquals(result, [42]);
})();

View File

@ -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: --invoke-weak-callbacks --omit-quit --wasm-async-compilation --expose-wasm --allow-natives-syntax
// Flags: --invoke-weak-callbacks --omit-quit --expose-wasm --allow-natives-syntax
load("test/mjsunit/wasm/wasm-constants.js");
load("test/mjsunit/wasm/wasm-module-builder.js");

View File

@ -0,0 +1,11 @@
// Copyright 2018 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 f() {
}
var large_array = Array(150 * 1024);
assertThrows('new f(... large_array)', RangeError);

View File

@ -1,14 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-do-expressions
function f() {
print(
do {
for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }
}
);
}
f();

View File

@ -0,0 +1,39 @@
// Copyright 2018 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() {
function foo() {
const x = 1e-1;
return Object.is(-0, x * (-1e-308));
}
assertFalse(foo());
assertFalse(foo());
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo());
})();
(function() {
function foo(x) {
return Object.is(-0, x * (-1e-308));
}
assertFalse(foo(1e-1));
assertFalse(foo(1e-1));
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo(1e-1));
})();
(function() {
function foo(x) {
return Object.is(-0, x);
}
assertFalse(foo(1e-1 * (-1e-308)));
assertFalse(foo(1e-1 * (-1e-308)));
%OptimizeFunctionOnNextCall(foo);
assertFalse(foo(1e-1 * (-1e-308)));
})();

View File

@ -1,18 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-do-expressions
function f(x) {
switch (x) {
case 1: return "one";
case 2: return "two";
case do { for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); } }:
case 3: return "WAT";
}
}
assertEquals("one", f(1));
assertEquals("two", f(2));
assertEquals("WAT", f(3));

View File

@ -1,30 +0,0 @@
// Copyright 2015 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// Flags: --allow-natives-syntax --harmony-do-expressions
"use strict";
var p = {};
var testCases = [
{ s:"[1, do { _OSR_ 2 }, 3]", r:[1, 2, 3] },
{ s:"[1, ...[2], do { _OSR_ 3 }, 4]", r:[1, 2, 3, 4] },
{ s:"[1, ...do { _OSR_ [2,3] }, 4]", r:[1, 2, 3, 4] },
{ s:"{ a:do { _OSR_ 1 } }", r:{ a:1 } },
{ s:"{ a:do { _OSR_ 2 }, __proto__:p }", r:{ a:2, __proto__:p } },
{ s:"{ a:do { _OSR_ 3 }, get b() { return 4; } }", r:{ a:3, b:4 } },
{ s:"{ [do { _OSR_ 'b' }]: 3 }", r:{ b:3 } },
{ s:"{ [do { _OSR_ 'b' }]: 3, c: 4 }", r:{ b:3, c:4 } },
{ s:"{ [do { _OSR_ 'b' }]: 3, __proto__:p }", r:{ b:3, __proto__:p } },
{ s:"{ get [do { _OSR_ 'c' }]() { return 4; } }", r:{ c:4 } },
{ s:"class { [do { _OSR_ 'f' }]() {} }" },
{ s:"class { [do { _OSR_ 'f' }]() {}; g() {} }" },
];
for (var i = 0; i < testCases.length; ++i) {
var source = "(function f" + i + "(x) { return " + testCases[i].s + "})";
var osr = "for (var i = 0; i < 10; i++) { if (i == 5) %OptimizeOsr(); }";
var result = eval(source.replace("_OSR_", osr))();
if (testCases[i].r) assertEquals(testCases[i].r, result);
}

View File

@ -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: --wasm-async-compilation
__v_0 = new Uint8Array([
0x00, 0x61, 0x73, 0x6d, 0x01, 0x00, 0x00, 0x00, 0x01, 0x05, 0x01,
0x60, 0x00, 0x01, 0x7f, 0x03, 0x02, 0x01, 0x00, 0x05, 0x03, 0x01,