mirror of https://github.com/tc39/test262.git
[v8-test262-automation] Changes from https://github.com/v8/v8.git at sha 9f893284 on Thu Oct 11 2018 18:43:07 GMT+0000 (Coordinated Universal Time)
This commit is contained in:
parent
e1ff0bbe5c
commit
25f3532881
|
@ -0,0 +1,27 @@
|
|||
// 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
|
||||
|
||||
// Test that the lazy deoptimization point for JSAsyncFunctionResolve
|
||||
// works correctly, aka that we return the promise and not the result
|
||||
// of the JSResolvePromise operation.
|
||||
(function() {
|
||||
async function foo(x) {
|
||||
return x;
|
||||
}
|
||||
|
||||
assertPromiseResult((async () => {
|
||||
await foo(1);
|
||||
await foo(2);
|
||||
%OptimizeFunctionOnNextCall(foo);
|
||||
const p = new Proxy({}, {
|
||||
get(...args) {
|
||||
%DeoptimizeFunction(foo);
|
||||
return Reflect.get(...args);
|
||||
}
|
||||
});
|
||||
assertEquals(p, await foo(p));
|
||||
})());
|
||||
})();
|
|
@ -0,0 +1,59 @@
|
|||
// 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 --opt
|
||||
|
||||
// Test the extreme case where -0 is produced by rounding errors.
|
||||
(function() {
|
||||
function bar(x) {
|
||||
return 1e-308 * x;
|
||||
}
|
||||
bar(1);
|
||||
|
||||
function foo() {
|
||||
return Object.is(-0, bar(-1e-308));
|
||||
}
|
||||
|
||||
assertTrue(foo());
|
||||
assertTrue(foo());
|
||||
%OptimizeFunctionOnNextCall(foo);
|
||||
assertTrue(foo());
|
||||
})();
|
||||
|
||||
// Test that multiplication of integer by 0 produces the correct results.
|
||||
(function() {
|
||||
function foo(x) {
|
||||
return 0 * Math.round(x);
|
||||
}
|
||||
|
||||
assertEquals(0, foo(0.1));
|
||||
assertEquals(-0, foo(-0.1));
|
||||
assertEquals(NaN, foo(NaN));
|
||||
assertEquals(NaN, foo(Infinity));
|
||||
assertEquals(NaN, foo(-Infinity));
|
||||
%OptimizeFunctionOnNextCall(foo);
|
||||
assertEquals(0, foo(0.1));
|
||||
assertEquals(-0, foo(-0.1));
|
||||
assertEquals(NaN, foo(NaN));
|
||||
assertEquals(NaN, foo(Infinity));
|
||||
assertEquals(NaN, foo(-Infinity));
|
||||
})();
|
||||
|
||||
// Test that multiplication properly preserves -0 and NaN, and doesn't
|
||||
// cut it short incorrectly.
|
||||
(function() {
|
||||
function foo(x, y) {
|
||||
x = Math.sign(x);
|
||||
y = Math.sign(y);
|
||||
return Math.min(x * y, 0);
|
||||
}
|
||||
|
||||
assertEquals(0, foo(1, 0));
|
||||
assertEquals(-0, foo(1, -0));
|
||||
assertEquals(NaN, foo(NaN, -0));
|
||||
%OptimizeFunctionOnNextCall(foo);
|
||||
assertEquals(0, foo(1, 0));
|
||||
assertEquals(-0, foo(1, -0));
|
||||
assertEquals(NaN, foo(NaN, -0));
|
||||
})();
|
|
@ -0,0 +1,23 @@
|
|||
// 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 --no-stress-opt
|
||||
|
||||
var map = new Map([[1,2], [2,3], [3,4]]);
|
||||
|
||||
assertEquals([[1,2], [2,3], [3,4]], [...map]);
|
||||
assertEquals([[1,2], [2,3], [3,4]], [...map.entries()]);
|
||||
assertEquals([1,2,3], [...map.keys()]);
|
||||
assertEquals([2,3,4], [...map.values()]);
|
||||
assertTrue(%MapIteratorProtector());
|
||||
assertTrue(%SetIteratorProtector());
|
||||
|
||||
map[Symbol.iterator] = () => ({next: () => ({done: true})});
|
||||
|
||||
assertTrue(%MapIteratorProtector());
|
||||
assertTrue(%SetIteratorProtector());
|
||||
assertEquals([], [...map]);
|
||||
assertEquals([[1,2], [2,3], [3,4]], [...map.entries()]);
|
||||
assertEquals([1,2,3], [...map.keys()]);
|
||||
assertEquals([2,3,4], [...map.values()]);
|
|
@ -1,57 +0,0 @@
|
|||
// 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 --no-always-opt
|
||||
// Files: test/mjsunit/code-coverage-utils.js
|
||||
|
||||
%DebugToggleBlockCoverage(true);
|
||||
|
||||
TestCoverage(
|
||||
"Repro for the bug",
|
||||
`
|
||||
function lib (n) { // 0000
|
||||
if (n >= 0) { // 0050
|
||||
if (n < 0) { // 0100
|
||||
return; // 0150
|
||||
} // 0200
|
||||
} else if (foo()) { // 0250
|
||||
} // 0300
|
||||
} // 0350
|
||||
function foo () { // 0400
|
||||
console.log('foo') // 0450
|
||||
return false // 0500
|
||||
} // 0550
|
||||
lib(1) // 0600
|
||||
`,
|
||||
[{"start":0,"end":649,"count":1},
|
||||
{"start":0,"end":351,"count":1},
|
||||
{"start":115,"end":205,"count":0},
|
||||
{"start":253,"end":303,"count":0},
|
||||
{"start":400,"end":551,"count":0}]
|
||||
);
|
||||
|
||||
TestCoverage(
|
||||
"Variant with omitted brackets",
|
||||
`
|
||||
function lib (n) { // 0000
|
||||
if (n >= 0) { // 0050
|
||||
if (n < 0) // 0100
|
||||
return; // 0150
|
||||
} // 0200
|
||||
else if (foo()); // 0250
|
||||
} // 0300
|
||||
function foo () { // 0350
|
||||
console.log('foo') // 0400
|
||||
return false // 0450
|
||||
} // 0500
|
||||
lib(1) // 0550
|
||||
`,
|
||||
[{"start":0,"end":599,"count":1},
|
||||
{"start":0,"end":301,"count":1},
|
||||
{"start":156,"end":163,"count":0},
|
||||
{"start":203,"end":268,"count":0},
|
||||
{"start":350,"end":501,"count":0}]
|
||||
);
|
||||
|
||||
%DebugToggleBlockCoverage(false);
|
|
@ -16,7 +16,7 @@ builder0.addFunction('main', kSig_i_i)
|
|||
kExprCallIndirect, sig_index, kTableZero
|
||||
]) // --
|
||||
.exportAs('main');
|
||||
builder0.setFunctionTableBounds(3, 3);
|
||||
builder0.setTableBounds(3, 3);
|
||||
builder0.addExportOfKind('table', kExternalTable);
|
||||
let module0 = new WebAssembly.Module(builder0.toBuffer());
|
||||
let instance0 = new WebAssembly.Instance(module0);
|
||||
|
@ -25,7 +25,7 @@ let builder1 = new WasmModuleBuilder();
|
|||
builder1.setName('module_1');
|
||||
builder1.addFunction('main', kSig_i_v).addBody([kExprUnreachable]);
|
||||
builder1.addImportedTable('z', 'table');
|
||||
builder1.addFunctionTableInit(0, false, [0], true);
|
||||
builder1.addElementSegment(0, false, [0], true);
|
||||
let module1 = new WebAssembly.Module(builder1.toBuffer());
|
||||
let instance1 =
|
||||
new WebAssembly.Instance(module1, {z: {table: instance0.exports.table}});
|
||||
|
|
|
@ -12,7 +12,7 @@ let q_table = builder.addImportedTable("q", "table")
|
|||
let q_base = builder.addImportedGlobal("q", "base", kWasmI32);
|
||||
let q_fun = builder.addImport("q", "fun", kSig_v_v);
|
||||
builder.addType(kSig_i_ii);
|
||||
builder.addFunctionTableInit(q_base, true, [ q_fun ])
|
||||
builder.addElementSegment(q_base, true, [ q_fun ])
|
||||
let module = new WebAssembly.Module(builder.toBuffer());
|
||||
let table = new WebAssembly.Table({
|
||||
element: "anyfunc",
|
||||
|
|
|
@ -17,7 +17,7 @@ builder.addFunction('main', kSig_i_ii).addBody([
|
|||
sig_index1,
|
||||
kTableZero
|
||||
]).exportAs('main');
|
||||
builder.setFunctionTableBounds(kTableSize, kTableSize);
|
||||
builder.setTableBounds(kTableSize, kTableSize);
|
||||
var m1_bytes = builder.toBuffer();
|
||||
var m1 = new WebAssembly.Module(m1_bytes);
|
||||
|
||||
|
|
|
@ -20,6 +20,6 @@ const builder2 = new WasmModuleBuilder();
|
|||
const mul_import = builder2.addImport('q', 'wasm_mul', kSig_i_ii);
|
||||
builder2.addImportedTable('q', 'table');
|
||||
const glob_import = builder2.addImportedGlobal('q', 'glob', kWasmI32);
|
||||
builder2.addFunctionTableInit(glob_import, true, [mul_import]);
|
||||
builder2.addElementSegment(glob_import, true, [mul_import]);
|
||||
builder2.instantiate(
|
||||
{q: {glob: 0, js_div: i => i, wasm_mul: mul, table: table}});
|
||||
|
|
|
@ -33,7 +33,7 @@ load("test/mjsunit/wasm/wasm-module-builder.js");
|
|||
kExprCallIndirect, 0, kTableZero
|
||||
])
|
||||
.exportFunc();
|
||||
builder.addFunctionTableInit(0, false, [0, 1, 1, 0]);
|
||||
builder.addElementSegment(0, false, [0, 1, 1, 0]);
|
||||
|
||||
return builder.instantiate({q: {f2: i1.exports.f2, f1: i1.exports.f1}});
|
||||
})();
|
||||
|
|
|
@ -56,10 +56,10 @@ FEATURE_FLAGS = {
|
|||
'Symbol.prototype.description': '--harmony-symbol-description',
|
||||
'globalThis': '--harmony-global',
|
||||
'well-formed-json-stringify': '--harmony-json-stringify',
|
||||
'export-star-as-namespace-from-module': '--harmony-namespace-exports',
|
||||
}
|
||||
|
||||
SKIPPED_FEATURES = set(['Object.fromEntries',
|
||||
'export-star-as-namespace-from-module',
|
||||
'class-fields-private',
|
||||
'class-static-fields-private',
|
||||
'class-methods-private',
|
||||
|
|
Loading…
Reference in New Issue