Bug 1513661 - Part 2: Update test262 - Dec 12 2018 edition. r=jorendorff

This commit is contained in:
André Bargull 2018-12-12 11:36:00 -08:00
parent d16ddd04ec
commit d0c5b77fff
315 changed files with 5413 additions and 423 deletions

View File

@ -1,6 +1,7 @@
commit 2726142bb97e4538703eda748c3b7300183bc66d
Author: test262-automation <test262-automation@bocoup.com>
Date: Wed Nov 14 19:00:37 2018 +0000
commit 8e3c6d048449a2e47c7748eafa350f49c0b8b7bc
Author: Leo Balter <leonardo.balter@gmail.com>
Date: Mon Dec 10 10:59:09 2018 -0500
[v8-test262-automation] Updated curation log with latest revision sha's from export and changed files.
sourceRevisionAtLastExport: ac250b9b targetRevisionAtLastExport: 6218e682b2
Merge pull request #1987 from test262-automation/v8-test262-automation-export-07b313100e
Import test changes from V8

View File

@ -8,6 +8,8 @@ description: >
features: [Array.prototype.flat]
---*/
assert.sameValue(typeof Array.prototype.flat, 'function');
var a = [];
a.constructor = null;
assert.throws(TypeError, function() {

View File

@ -7,6 +7,8 @@ description: >
features: [Array.prototype.flat]
---*/
assert.sameValue(typeof Array.prototype.flat, 'function');
assert.throws(TypeError, function() {
[].flat.call(null);
}, 'null value');

View File

@ -7,6 +7,8 @@ description: >
features: [Array.prototype.flat]
---*/
assert.sameValue(typeof Array.prototype.flat, 'function');
assert.throws(TypeError, function() {
[].flat(Symbol());
}, 'symbol value');

View File

@ -7,6 +7,8 @@ description: >
features: [Array.prototype.flatMap]
---*/
assert.sameValue(typeof Array.prototype.flatMap, "function");
assert.throws(TypeError, function() {
[].flatMap({});
}, 'non callable argument');

View File

@ -8,6 +8,8 @@ description: >
features: [Array.prototype.flatMap]
---*/
assert.sameValue(typeof Array.prototype.flatMap, 'function');
var a = [];
a.constructor = null;
assert.throws(TypeError, function() {

View File

@ -7,6 +7,8 @@ description: >
features: [Array.prototype.flatMap]
---*/
assert.sameValue(typeof Array.prototype.flatMap, 'function');
assert.throws(TypeError, function() {
[].flatMap.call(null);
}, 'null value');

View File

@ -17,10 +17,12 @@ info: |
b. Let exists be ? HasProperty(source, P).
c. If exists is true, then
i. Let element be ? Get(source, P).
features: [Array.prototype.flat]
features: [Array.prototype.flatMap]
includes: [compareArray.js]
---*/
assert.sameValue(typeof Array.prototype.flatMap, 'function');
const getCalls = [], hasCalls = [];
const handler = {
get : function (t, p, r) { getCalls.push(p); return Reflect.get(t, p, r); },

View File

@ -0,0 +1,38 @@
// Copyright (C) 2018 Mathias Bynens. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.sort
description: >
Stability of Array.prototype.sort for an array with 11 elements.
info: |
The sort is required to be stable (that is, elements that compare equal
remain in their original order).
The array length of 11 was chosen because V8 used an unstable
QuickSort for arrays with more than 10 elements until v7.0 (September
2018). https://v8.dev/blog/array-sort
---*/
const array = [
{ name: 'A', rating: 2 },
{ name: 'B', rating: 3 },
{ name: 'C', rating: 2 },
{ name: 'D', rating: 4 },
{ name: 'E', rating: 3 },
{ name: 'F', rating: 3 },
{ name: 'G', rating: 4 },
{ name: 'H', rating: 3 },
{ name: 'I', rating: 2 },
{ name: 'J', rating: 2 },
{ name: 'K', rating: 2 },
];
assert.sameValue(array.length, 11);
// Sort the elements by `rating` in descending order.
// (This updates `array` in place.)
array.sort((a, b) => b.rating - a.rating);
const reduced = array.reduce((acc, element) => acc + element.name, '');
assert.sameValue(reduced, 'DGBEFHACIJK');
reportCompare(0, 0);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
// Copyright (C) 2018 Mathias Bynens. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.sort
description: >
Stability of Array.prototype.sort for an array with 5 elements.
info: |
The sort is required to be stable (that is, elements that compare equal
remain in their original order).
---*/
const array = [
{ name: 'A', rating: 2 },
{ name: 'B', rating: 3 },
{ name: 'C', rating: 2 },
{ name: 'D', rating: 3 },
{ name: 'E', rating: 3 },
];
assert.sameValue(array.length, 5);
// Sort the elements by `rating` in descending order.
// (This updates `array` in place.)
array.sort((a, b) => b.rating - a.rating);
const reduced = array.reduce((acc, element) => acc + element.name, '');
assert.sameValue(reduced, 'BDEAC');
reportCompare(0, 0);

View File

@ -0,0 +1,548 @@
// Copyright (C) 2018 Mathias Bynens. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
esid: sec-array.prototype.sort
description: >
Stability of Array.prototype.sort for an array with 513 elements.
info: |
The sort is required to be stable (that is, elements that compare equal
remain in their original order).
The array length of 513 was chosen because until late 2018, Chakra
used to apply an unstable QuickSort for arrays with more than 512
elements, although it used a stable insertion sort for anything else.
https://github.com/Microsoft/ChakraCore/pull/5724
---*/
const array = [
{ name: 'A00', rating: 2 },
{ name: 'A01', rating: 2 },
{ name: 'A02', rating: 2 },
{ name: 'A03', rating: 2 },
{ name: 'A04', rating: 2 },
{ name: 'A05', rating: 2 },
{ name: 'A06', rating: 2 },
{ name: 'A07', rating: 2 },
{ name: 'A08', rating: 2 },
{ name: 'A09', rating: 2 },
{ name: 'A10', rating: 2 },
{ name: 'A11', rating: 2 },
{ name: 'A12', rating: 2 },
{ name: 'A13', rating: 2 },
{ name: 'A14', rating: 2 },
{ name: 'A15', rating: 2 },
{ name: 'A16', rating: 2 },
{ name: 'A17', rating: 2 },
{ name: 'A18', rating: 2 },
{ name: 'A19', rating: 2 },
{ name: 'A20', rating: 2 },
{ name: 'A21', rating: 2 },
{ name: 'A22', rating: 2 },
{ name: 'A23', rating: 2 },
{ name: 'A24', rating: 2 },
{ name: 'A25', rating: 2 },
{ name: 'A26', rating: 2 },
{ name: 'A27', rating: 2 },
{ name: 'A28', rating: 2 },
{ name: 'A29', rating: 2 },
{ name: 'A30', rating: 2 },
{ name: 'A31', rating: 2 },
{ name: 'A32', rating: 2 },
{ name: 'A33', rating: 2 },
{ name: 'A34', rating: 2 },
{ name: 'A35', rating: 2 },
{ name: 'A36', rating: 2 },
{ name: 'A37', rating: 2 },
{ name: 'A38', rating: 2 },
{ name: 'A39', rating: 2 },
{ name: 'A40', rating: 2 },
{ name: 'A41', rating: 2 },
{ name: 'A42', rating: 2 },
{ name: 'A43', rating: 2 },
{ name: 'A44', rating: 2 },
{ name: 'A45', rating: 2 },
{ name: 'A46', rating: 2 },
{ name: 'B00', rating: 3 },
{ name: 'B01', rating: 3 },
{ name: 'B02', rating: 3 },
{ name: 'B03', rating: 3 },
{ name: 'B04', rating: 3 },
{ name: 'B05', rating: 3 },
{ name: 'B06', rating: 3 },
{ name: 'B07', rating: 3 },
{ name: 'B08', rating: 3 },
{ name: 'B09', rating: 3 },
{ name: 'B10', rating: 3 },
{ name: 'B11', rating: 3 },
{ name: 'B12', rating: 3 },
{ name: 'B13', rating: 3 },
{ name: 'B14', rating: 3 },
{ name: 'B15', rating: 3 },
{ name: 'B16', rating: 3 },
{ name: 'B17', rating: 3 },
{ name: 'B18', rating: 3 },
{ name: 'B19', rating: 3 },
{ name: 'B20', rating: 3 },
{ name: 'B21', rating: 3 },
{ name: 'B22', rating: 3 },
{ name: 'B23', rating: 3 },
{ name: 'B24', rating: 3 },
{ name: 'B25', rating: 3 },
{ name: 'B26', rating: 3 },
{ name: 'B27', rating: 3 },
{ name: 'B28', rating: 3 },
{ name: 'B29', rating: 3 },
{ name: 'B30', rating: 3 },
{ name: 'B31', rating: 3 },
{ name: 'B32', rating: 3 },
{ name: 'B33', rating: 3 },
{ name: 'B34', rating: 3 },
{ name: 'B35', rating: 3 },
{ name: 'B36', rating: 3 },
{ name: 'B37', rating: 3 },
{ name: 'B38', rating: 3 },
{ name: 'B39', rating: 3 },
{ name: 'B40', rating: 3 },
{ name: 'B41', rating: 3 },
{ name: 'B42', rating: 3 },
{ name: 'B43', rating: 3 },
{ name: 'B44', rating: 3 },
{ name: 'B45', rating: 3 },
{ name: 'B46', rating: 3 },
{ name: 'C00', rating: 2 },
{ name: 'C01', rating: 2 },
{ name: 'C02', rating: 2 },
{ name: 'C03', rating: 2 },
{ name: 'C04', rating: 2 },
{ name: 'C05', rating: 2 },
{ name: 'C06', rating: 2 },
{ name: 'C07', rating: 2 },
{ name: 'C08', rating: 2 },
{ name: 'C09', rating: 2 },
{ name: 'C10', rating: 2 },
{ name: 'C11', rating: 2 },
{ name: 'C12', rating: 2 },
{ name: 'C13', rating: 2 },
{ name: 'C14', rating: 2 },
{ name: 'C15', rating: 2 },
{ name: 'C16', rating: 2 },
{ name: 'C17', rating: 2 },
{ name: 'C18', rating: 2 },
{ name: 'C19', rating: 2 },
{ name: 'C20', rating: 2 },
{ name: 'C21', rating: 2 },
{ name: 'C22', rating: 2 },
{ name: 'C23', rating: 2 },
{ name: 'C24', rating: 2 },
{ name: 'C25', rating: 2 },
{ name: 'C26', rating: 2 },
{ name: 'C27', rating: 2 },
{ name: 'C28', rating: 2 },
{ name: 'C29', rating: 2 },
{ name: 'C30', rating: 2 },
{ name: 'C31', rating: 2 },
{ name: 'C32', rating: 2 },
{ name: 'C33', rating: 2 },
{ name: 'C34', rating: 2 },
{ name: 'C35', rating: 2 },
{ name: 'C36', rating: 2 },
{ name: 'C37', rating: 2 },
{ name: 'C38', rating: 2 },
{ name: 'C39', rating: 2 },
{ name: 'C40', rating: 2 },
{ name: 'C41', rating: 2 },
{ name: 'C42', rating: 2 },
{ name: 'C43', rating: 2 },
{ name: 'C44', rating: 2 },
{ name: 'C45', rating: 2 },
{ name: 'C46', rating: 2 },
{ name: 'D00', rating: 4 },
{ name: 'D01', rating: 4 },
{ name: 'D02', rating: 4 },
{ name: 'D03', rating: 4 },
{ name: 'D04', rating: 4 },
{ name: 'D05', rating: 4 },
{ name: 'D06', rating: 4 },
{ name: 'D07', rating: 4 },
{ name: 'D08', rating: 4 },
{ name: 'D09', rating: 4 },
{ name: 'D10', rating: 4 },
{ name: 'D11', rating: 4 },
{ name: 'D12', rating: 4 },
{ name: 'D13', rating: 4 },
{ name: 'D14', rating: 4 },
{ name: 'D15', rating: 4 },
{ name: 'D16', rating: 4 },
{ name: 'D17', rating: 4 },
{ name: 'D18', rating: 4 },
{ name: 'D19', rating: 4 },
{ name: 'D20', rating: 4 },
{ name: 'D21', rating: 4 },
{ name: 'D22', rating: 4 },
{ name: 'D23', rating: 4 },
{ name: 'D24', rating: 4 },
{ name: 'D25', rating: 4 },
{ name: 'D26', rating: 4 },
{ name: 'D27', rating: 4 },
{ name: 'D28', rating: 4 },
{ name: 'D29', rating: 4 },
{ name: 'D30', rating: 4 },
{ name: 'D31', rating: 4 },
{ name: 'D32', rating: 4 },
{ name: 'D33', rating: 4 },
{ name: 'D34', rating: 4 },
{ name: 'D35', rating: 4 },
{ name: 'D36', rating: 4 },
{ name: 'D37', rating: 4 },
{ name: 'D38', rating: 4 },
{ name: 'D39', rating: 4 },
{ name: 'D40', rating: 4 },
{ name: 'D41', rating: 4 },
{ name: 'D42', rating: 4 },
{ name: 'D43', rating: 4 },
{ name: 'D44', rating: 4 },
{ name: 'D45', rating: 4 },
{ name: 'D46', rating: 4 },
{ name: 'E00', rating: 3 },
{ name: 'E01', rating: 3 },
{ name: 'E02', rating: 3 },
{ name: 'E03', rating: 3 },
{ name: 'E04', rating: 3 },
{ name: 'E05', rating: 3 },
{ name: 'E06', rating: 3 },
{ name: 'E07', rating: 3 },
{ name: 'E08', rating: 3 },
{ name: 'E09', rating: 3 },
{ name: 'E10', rating: 3 },
{ name: 'E11', rating: 3 },
{ name: 'E12', rating: 3 },
{ name: 'E13', rating: 3 },
{ name: 'E14', rating: 3 },
{ name: 'E15', rating: 3 },
{ name: 'E16', rating: 3 },
{ name: 'E17', rating: 3 },
{ name: 'E18', rating: 3 },
{ name: 'E19', rating: 3 },
{ name: 'E20', rating: 3 },
{ name: 'E21', rating: 3 },
{ name: 'E22', rating: 3 },
{ name: 'E23', rating: 3 },
{ name: 'E24', rating: 3 },
{ name: 'E25', rating: 3 },
{ name: 'E26', rating: 3 },
{ name: 'E27', rating: 3 },
{ name: 'E28', rating: 3 },
{ name: 'E29', rating: 3 },
{ name: 'E30', rating: 3 },
{ name: 'E31', rating: 3 },
{ name: 'E32', rating: 3 },
{ name: 'E33', rating: 3 },
{ name: 'E34', rating: 3 },
{ name: 'E35', rating: 3 },
{ name: 'E36', rating: 3 },
{ name: 'E37', rating: 3 },
{ name: 'E38', rating: 3 },
{ name: 'E39', rating: 3 },
{ name: 'E40', rating: 3 },
{ name: 'E41', rating: 3 },
{ name: 'E42', rating: 3 },
{ name: 'E43', rating: 3 },
{ name: 'E44', rating: 3 },
{ name: 'E45', rating: 3 },
{ name: 'E46', rating: 3 },
{ name: 'F00', rating: 3 },
{ name: 'F01', rating: 3 },
{ name: 'F02', rating: 3 },
{ name: 'F03', rating: 3 },
{ name: 'F04', rating: 3 },
{ name: 'F05', rating: 3 },
{ name: 'F06', rating: 3 },
{ name: 'F07', rating: 3 },
{ name: 'F08', rating: 3 },
{ name: 'F09', rating: 3 },
{ name: 'F10', rating: 3 },
{ name: 'F11', rating: 3 },
{ name: 'F12', rating: 3 },
{ name: 'F13', rating: 3 },
{ name: 'F14', rating: 3 },
{ name: 'F15', rating: 3 },
{ name: 'F16', rating: 3 },
{ name: 'F17', rating: 3 },
{ name: 'F18', rating: 3 },
{ name: 'F19', rating: 3 },
{ name: 'F20', rating: 3 },
{ name: 'F21', rating: 3 },
{ name: 'F22', rating: 3 },
{ name: 'F23', rating: 3 },
{ name: 'F24', rating: 3 },
{ name: 'F25', rating: 3 },
{ name: 'F26', rating: 3 },
{ name: 'F27', rating: 3 },
{ name: 'F28', rating: 3 },
{ name: 'F29', rating: 3 },
{ name: 'F30', rating: 3 },
{ name: 'F31', rating: 3 },
{ name: 'F32', rating: 3 },
{ name: 'F33', rating: 3 },
{ name: 'F34', rating: 3 },
{ name: 'F35', rating: 3 },
{ name: 'F36', rating: 3 },
{ name: 'F37', rating: 3 },
{ name: 'F38', rating: 3 },
{ name: 'F39', rating: 3 },
{ name: 'F40', rating: 3 },
{ name: 'F41', rating: 3 },
{ name: 'F42', rating: 3 },
{ name: 'F43', rating: 3 },
{ name: 'F44', rating: 3 },
{ name: 'F45', rating: 3 },
{ name: 'F46', rating: 3 },
{ name: 'G00', rating: 4 },
{ name: 'G01', rating: 4 },
{ name: 'G02', rating: 4 },
{ name: 'G03', rating: 4 },
{ name: 'G04', rating: 4 },
{ name: 'G05', rating: 4 },
{ name: 'G06', rating: 4 },
{ name: 'G07', rating: 4 },
{ name: 'G08', rating: 4 },
{ name: 'G09', rating: 4 },
{ name: 'G10', rating: 4 },
{ name: 'G11', rating: 4 },
{ name: 'G12', rating: 4 },
{ name: 'G13', rating: 4 },
{ name: 'G14', rating: 4 },
{ name: 'G15', rating: 4 },
{ name: 'G16', rating: 4 },
{ name: 'G17', rating: 4 },
{ name: 'G18', rating: 4 },
{ name: 'G19', rating: 4 },
{ name: 'G20', rating: 4 },
{ name: 'G21', rating: 4 },
{ name: 'G22', rating: 4 },
{ name: 'G23', rating: 4 },
{ name: 'G24', rating: 4 },
{ name: 'G25', rating: 4 },
{ name: 'G26', rating: 4 },
{ name: 'G27', rating: 4 },
{ name: 'G28', rating: 4 },
{ name: 'G29', rating: 4 },
{ name: 'G30', rating: 4 },
{ name: 'G31', rating: 4 },
{ name: 'G32', rating: 4 },
{ name: 'G33', rating: 4 },
{ name: 'G34', rating: 4 },
{ name: 'G35', rating: 4 },
{ name: 'G36', rating: 4 },
{ name: 'G37', rating: 4 },
{ name: 'G38', rating: 4 },
{ name: 'G39', rating: 4 },
{ name: 'G40', rating: 4 },
{ name: 'G41', rating: 4 },
{ name: 'G42', rating: 4 },
{ name: 'G43', rating: 4 },
{ name: 'G44', rating: 4 },
{ name: 'G45', rating: 4 },
{ name: 'G46', rating: 4 },
{ name: 'H00', rating: 3 },
{ name: 'H01', rating: 3 },
{ name: 'H02', rating: 3 },
{ name: 'H03', rating: 3 },
{ name: 'H04', rating: 3 },
{ name: 'H05', rating: 3 },
{ name: 'H06', rating: 3 },
{ name: 'H07', rating: 3 },
{ name: 'H08', rating: 3 },
{ name: 'H09', rating: 3 },
{ name: 'H10', rating: 3 },
{ name: 'H11', rating: 3 },
{ name: 'H12', rating: 3 },
{ name: 'H13', rating: 3 },
{ name: 'H14', rating: 3 },
{ name: 'H15', rating: 3 },
{ name: 'H16', rating: 3 },
{ name: 'H17', rating: 3 },
{ name: 'H18', rating: 3 },
{ name: 'H19', rating: 3 },
{ name: 'H20', rating: 3 },
{ name: 'H21', rating: 3 },
{ name: 'H22', rating: 3 },
{ name: 'H23', rating: 3 },
{ name: 'H24', rating: 3 },
{ name: 'H25', rating: 3 },
{ name: 'H26', rating: 3 },
{ name: 'H27', rating: 3 },
{ name: 'H28', rating: 3 },
{ name: 'H29', rating: 3 },
{ name: 'H30', rating: 3 },
{ name: 'H31', rating: 3 },
{ name: 'H32', rating: 3 },
{ name: 'H33', rating: 3 },
{ name: 'H34', rating: 3 },
{ name: 'H35', rating: 3 },
{ name: 'H36', rating: 3 },
{ name: 'H37', rating: 3 },
{ name: 'H38', rating: 3 },
{ name: 'H39', rating: 3 },
{ name: 'H40', rating: 3 },
{ name: 'H41', rating: 3 },
{ name: 'H42', rating: 3 },
{ name: 'H43', rating: 3 },
{ name: 'H44', rating: 3 },
{ name: 'H45', rating: 3 },
{ name: 'H46', rating: 3 },
{ name: 'I00', rating: 2 },
{ name: 'I01', rating: 2 },
{ name: 'I02', rating: 2 },
{ name: 'I03', rating: 2 },
{ name: 'I04', rating: 2 },
{ name: 'I05', rating: 2 },
{ name: 'I06', rating: 2 },
{ name: 'I07', rating: 2 },
{ name: 'I08', rating: 2 },
{ name: 'I09', rating: 2 },
{ name: 'I10', rating: 2 },
{ name: 'I11', rating: 2 },
{ name: 'I12', rating: 2 },
{ name: 'I13', rating: 2 },
{ name: 'I14', rating: 2 },
{ name: 'I15', rating: 2 },
{ name: 'I16', rating: 2 },
{ name: 'I17', rating: 2 },
{ name: 'I18', rating: 2 },
{ name: 'I19', rating: 2 },
{ name: 'I20', rating: 2 },
{ name: 'I21', rating: 2 },
{ name: 'I22', rating: 2 },
{ name: 'I23', rating: 2 },
{ name: 'I24', rating: 2 },
{ name: 'I25', rating: 2 },
{ name: 'I26', rating: 2 },
{ name: 'I27', rating: 2 },
{ name: 'I28', rating: 2 },
{ name: 'I29', rating: 2 },
{ name: 'I30', rating: 2 },
{ name: 'I31', rating: 2 },
{ name: 'I32', rating: 2 },
{ name: 'I33', rating: 2 },
{ name: 'I34', rating: 2 },
{ name: 'I35', rating: 2 },
{ name: 'I36', rating: 2 },
{ name: 'I37', rating: 2 },
{ name: 'I38', rating: 2 },
{ name: 'I39', rating: 2 },
{ name: 'I40', rating: 2 },
{ name: 'I41', rating: 2 },
{ name: 'I42', rating: 2 },
{ name: 'I43', rating: 2 },
{ name: 'I44', rating: 2 },
{ name: 'I45', rating: 2 },
{ name: 'I46', rating: 2 },
{ name: 'J00', rating: 2 },
{ name: 'J01', rating: 2 },
{ name: 'J02', rating: 2 },
{ name: 'J03', rating: 2 },
{ name: 'J04', rating: 2 },
{ name: 'J05', rating: 2 },
{ name: 'J06', rating: 2 },
{ name: 'J07', rating: 2 },
{ name: 'J08', rating: 2 },
{ name: 'J09', rating: 2 },
{ name: 'J10', rating: 2 },
{ name: 'J11', rating: 2 },
{ name: 'J12', rating: 2 },
{ name: 'J13', rating: 2 },
{ name: 'J14', rating: 2 },
{ name: 'J15', rating: 2 },
{ name: 'J16', rating: 2 },
{ name: 'J17', rating: 2 },
{ name: 'J18', rating: 2 },
{ name: 'J19', rating: 2 },
{ name: 'J20', rating: 2 },
{ name: 'J21', rating: 2 },
{ name: 'J22', rating: 2 },
{ name: 'J23', rating: 2 },
{ name: 'J24', rating: 2 },
{ name: 'J25', rating: 2 },
{ name: 'J26', rating: 2 },
{ name: 'J27', rating: 2 },
{ name: 'J28', rating: 2 },
{ name: 'J29', rating: 2 },
{ name: 'J30', rating: 2 },
{ name: 'J31', rating: 2 },
{ name: 'J32', rating: 2 },
{ name: 'J33', rating: 2 },
{ name: 'J34', rating: 2 },
{ name: 'J35', rating: 2 },
{ name: 'J36', rating: 2 },
{ name: 'J37', rating: 2 },
{ name: 'J38', rating: 2 },
{ name: 'J39', rating: 2 },
{ name: 'J40', rating: 2 },
{ name: 'J41', rating: 2 },
{ name: 'J42', rating: 2 },
{ name: 'J43', rating: 2 },
{ name: 'J44', rating: 2 },
{ name: 'J45', rating: 2 },
{ name: 'J46', rating: 2 },
{ name: 'K00', rating: 2 },
{ name: 'K01', rating: 2 },
{ name: 'K02', rating: 2 },
{ name: 'K03', rating: 2 },
{ name: 'K04', rating: 2 },
{ name: 'K05', rating: 2 },
{ name: 'K06', rating: 2 },
{ name: 'K07', rating: 2 },
{ name: 'K08', rating: 2 },
{ name: 'K09', rating: 2 },
{ name: 'K10', rating: 2 },
{ name: 'K11', rating: 2 },
{ name: 'K12', rating: 2 },
{ name: 'K13', rating: 2 },
{ name: 'K14', rating: 2 },
{ name: 'K15', rating: 2 },
{ name: 'K16', rating: 2 },
{ name: 'K17', rating: 2 },
{ name: 'K18', rating: 2 },
{ name: 'K19', rating: 2 },
{ name: 'K20', rating: 2 },
{ name: 'K21', rating: 2 },
{ name: 'K22', rating: 2 },
{ name: 'K23', rating: 2 },
{ name: 'K24', rating: 2 },
{ name: 'K25', rating: 2 },
{ name: 'K26', rating: 2 },
{ name: 'K27', rating: 2 },
{ name: 'K28', rating: 2 },
{ name: 'K29', rating: 2 },
{ name: 'K30', rating: 2 },
{ name: 'K31', rating: 2 },
{ name: 'K32', rating: 2 },
{ name: 'K33', rating: 2 },
{ name: 'K34', rating: 2 },
{ name: 'K35', rating: 2 },
{ name: 'K36', rating: 2 },
{ name: 'K37', rating: 2 },
{ name: 'K38', rating: 2 },
{ name: 'K39', rating: 2 },
{ name: 'K40', rating: 2 },
{ name: 'K41', rating: 2 },
{ name: 'K42', rating: 2 },
];
assert.sameValue(array.length, 513);
// Sort the elements by `rating` in descending order.
// (This updates `array` in place.)
array.sort((a, b) => b.rating - a.rating);
const reduced = array.reduce((acc, element) => {
const letter = element.name.slice(0, 1);
const previousLetter = acc.slice(-1);
if (previousLetter === letter) {
return acc;
}
return acc + letter;
}, '');
assert.sameValue(reduced, 'DGBEFHACIJK');
reportCompare(0, 0);

View File

@ -23,6 +23,10 @@ const BUFFER_SIZE = 4;
// `Atomics.notify`.
const TIMEOUT = $262.agent.timeouts.long;
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
for (var i = 0; i < NUMAGENT; i++) {
$262.agent.start(`
$262.agent.receiveBroadcast(function(sab) {
@ -54,11 +58,7 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
// Wait for agents to be running.
$262.agent.waitUntil(i64a, RUNNING, BigInt(NUMAGENT + 1));

View File

@ -44,7 +44,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
// An agent may have been interrupted between reporting its initial report

View File

@ -42,7 +42,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
// An agent may have been interrupted between reporting its initial report

View File

@ -27,7 +27,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -58,7 +58,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait for agents to be running.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT + 1);

View File

@ -31,7 +31,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait for agents to be running.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -43,7 +43,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait for agents to be running.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -43,7 +43,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait for agents to be running.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -27,7 +27,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -35,7 +35,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait for agents to be running.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -27,7 +27,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);

View File

@ -35,7 +35,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait for agents to be running.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -25,7 +25,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// There are ZERO agents waiting to notify...

View File

@ -11,7 +11,7 @@ includes: [atomicsHelper.js]
features: [Atomics, SharedArrayBuffer, TypedArray]
---*/
const RUNNING = 1;
const RUNNING = 0;
$262.agent.start(`
$262.agent.receiveBroadcast(function(sab) {
@ -25,7 +25,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// There are ZERO matching agents waiting on index 1

View File

@ -35,7 +35,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait for agents to be running.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -29,6 +29,47 @@ description: >
return r;
};
}
/**
*
* Share a given Int32Array or BigInt64Array to all running agents. Ensure that the
* provided TypedArray is a "shared typed array".
*
* NOTE: Migrating all tests to this API is necessary to prevent tests from hanging
* indefinitely when a SAB is sent to a worker but the code in the worker attempts to
* create a non-sharable TypedArray (something that is not Int32Array or BigInt64Array).
* When that scenario occurs, an exception is thrown and the agent worker can no
* longer communicate with any other threads that control the SAB. If the main
* thread happens to be spinning in the $262.agent.waitUntil() while loop, it will never
* meet its termination condition and the test will hang indefinitely.
*
* Because we've defined $262.agent.broadcast(SAB) in
* https://github.com/tc39/test262/blob/master/INTERPRETING.md, there are host implementations
* that assume compatibility, which must be maintained.
*
*
* $262.agent.safeBroadcast(TA) should not be included in
* https://github.com/tc39/test262/blob/master/INTERPRETING.md
*
*
* @param {(Int32Array|BigInt64Array)} typedArray An Int32Array or BigInt64Array with a SharedArrayBuffer
*/
$262.agent.safeBroadcast = function(typedArray) {
let Constructor = Object.getPrototypeOf(typedArray).constructor;
let temp = new Constructor(
new SharedArrayBuffer(Constructor.BYTES_PER_ELEMENT)
);
try {
// This will never actually wait, but that's fine because we only
// want to ensure that this typedArray CAN be waited on and is shareable.
Atomics.wait(temp, 0, Constructor === Int32Array ? 1 : BigInt(1));
} catch (error) {
$ERROR(`${Constructor.name} cannot be used as a shared typed array. (${error})`);
}
$262.agent.broadcast(typedArray.buffer);
};
/**
* With a given Int32Array or BigInt64Array, wait until the expected number of agents have
* reported themselves by calling:
@ -40,6 +81,7 @@ description: >
* @param {number} expected The number of agents that are expected to report as active.
*/
$262.agent.waitUntil = function(typedArray, index, expected) {
var agents = 0;
while ((agents = Atomics.load(typedArray, index)) !== expected) {
/* nothing */
@ -77,7 +119,7 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
* $262.agent.leaving();
* });
* `);
* $262.agent.broadcast(i32a.buffer);
* $262.agent.safeBroadcast(i32a.buffer);
*
* // Wait until the agent was started and then try to yield control to increase
* // the likelihood the agent has called `Atomics.wait` and is now waiting.
@ -107,7 +149,7 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
* });
* `);
* }
* $262.agent.broadcast(i32a.buffer);
* $262.agent.safeBroadcast(i32a.buffer);
*
* // Wait until the agents were started and then try to yield control to increase
* // the likelihood the agents have called `Atomics.wait` and are now waiting.
@ -152,7 +194,7 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
* });
* `);
* }
* $262.agent.broadcast(i32a.buffer);
* $262.agent.safeBroadcast(i32a.buffer);
*
* // Wait until the agents were started and then try to yield control to increase
* // the likelihood the agents have called `Atomics.wait` and are now waiting.
@ -205,7 +247,7 @@ $262.agent.timeouts = {
* $262.agent.leaving();
* });
* `);
* $262.agent.broadcast(i32a.buffer);
* $262.agent.safeBroadcast(i32a.buffer);
*
* // Wait until agent was started and then try to yield control.
* $262.agent.waitUntil(i32a, RUNNING, 1);

View File

@ -51,7 +51,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait until both agents started.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -17,6 +17,10 @@ includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
const RUNNING = 1;
$262.agent.start(`
@ -47,11 +51,7 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -18,6 +18,10 @@ includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
const RUNNING = 1;
$262.agent.start(`
@ -30,11 +34,7 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -10,6 +10,10 @@ includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
const RUNNING = 1;
$262.agent.start(`
@ -22,11 +26,7 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -39,7 +39,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -20,9 +20,12 @@ features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/
const RUNNING = 1;
const value = "42n";
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.start(`
$262.agent.receiveBroadcast(function(sab) {
const i64a = new BigInt64Array(sab);
@ -34,15 +37,11 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
// NB: We don't actually explicitly need to wait for the agent to start in this
// test case, we only do it for consistency with other test cases which do
// require the main agent to wait and yield control.
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -26,6 +26,10 @@ features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
var NUMAGENT = 2;
var RUNNING = 4;
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)
);
$262.agent.start(`
$262.agent.receiveBroadcast(function(sab) {
const i64a = new BigInt64Array(sab);
@ -48,11 +52,7 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)
);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
// Wait until all agents started.
$262.agent.waitUntil(i64a, RUNNING, BigInt(NUMAGENT));

View File

@ -17,11 +17,14 @@ includes: [atomicsHelper.js]
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
---*/
var NUMAGENT = 3;
var WAIT_INDEX = 0;
var RUNNING = 1;
var LOCK_INDEX = 2;
var NUMAGENT = 3;
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
for (var i = 0; i < NUMAGENT; i++) {
var agentNum = i;
@ -51,11 +54,7 @@ for (var i = 0; i < NUMAGENT; i++) {
`);
}
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
// Wait until all agents started.
$262.agent.waitUntil(i64a, RUNNING, BigInt(NUMAGENT));

View File

@ -26,6 +26,10 @@ features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
const RUNNING = 1;
const TIMEOUT = $262.agent.timeouts.huge;
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.start(`
$262.agent.receiveBroadcast(function(sab) {
const i64a = new BigInt64Array(sab);
@ -41,11 +45,7 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i64a.buffer);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -51,7 +51,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -34,7 +34,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -26,7 +26,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -39,7 +39,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -32,7 +32,7 @@ $262.agent.start(`
});
`);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -51,7 +51,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -57,7 +57,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -60,7 +60,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -29,6 +29,47 @@ description: >
return r;
};
}
/**
*
* Share a given Int32Array or BigInt64Array to all running agents. Ensure that the
* provided TypedArray is a "shared typed array".
*
* NOTE: Migrating all tests to this API is necessary to prevent tests from hanging
* indefinitely when a SAB is sent to a worker but the code in the worker attempts to
* create a non-sharable TypedArray (something that is not Int32Array or BigInt64Array).
* When that scenario occurs, an exception is thrown and the agent worker can no
* longer communicate with any other threads that control the SAB. If the main
* thread happens to be spinning in the $262.agent.waitUntil() while loop, it will never
* meet its termination condition and the test will hang indefinitely.
*
* Because we've defined $262.agent.broadcast(SAB) in
* https://github.com/tc39/test262/blob/master/INTERPRETING.md, there are host implementations
* that assume compatibility, which must be maintained.
*
*
* $262.agent.safeBroadcast(TA) should not be included in
* https://github.com/tc39/test262/blob/master/INTERPRETING.md
*
*
* @param {(Int32Array|BigInt64Array)} typedArray An Int32Array or BigInt64Array with a SharedArrayBuffer
*/
$262.agent.safeBroadcast = function(typedArray) {
let Constructor = Object.getPrototypeOf(typedArray).constructor;
let temp = new Constructor(
new SharedArrayBuffer(Constructor.BYTES_PER_ELEMENT)
);
try {
// This will never actually wait, but that's fine because we only
// want to ensure that this typedArray CAN be waited on and is shareable.
Atomics.wait(temp, 0, Constructor === Int32Array ? 1 : BigInt(1));
} catch (error) {
$ERROR(`${Constructor.name} cannot be used as a shared typed array. (${error})`);
}
$262.agent.broadcast(typedArray.buffer);
};
/**
* With a given Int32Array or BigInt64Array, wait until the expected number of agents have
* reported themselves by calling:
@ -40,6 +81,7 @@ description: >
* @param {number} expected The number of agents that are expected to report as active.
*/
$262.agent.waitUntil = function(typedArray, index, expected) {
var agents = 0;
while ((agents = Atomics.load(typedArray, index)) !== expected) {
/* nothing */
@ -77,7 +119,7 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
* $262.agent.leaving();
* });
* `);
* $262.agent.broadcast(i32a.buffer);
* $262.agent.safeBroadcast(i32a.buffer);
*
* // Wait until the agent was started and then try to yield control to increase
* // the likelihood the agent has called `Atomics.wait` and is now waiting.
@ -107,7 +149,7 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
* });
* `);
* }
* $262.agent.broadcast(i32a.buffer);
* $262.agent.safeBroadcast(i32a.buffer);
*
* // Wait until the agents were started and then try to yield control to increase
* // the likelihood the agents have called `Atomics.wait` and are now waiting.
@ -152,7 +194,7 @@ $262.agent.waitUntil = function(typedArray, index, expected) {
* });
* `);
* }
* $262.agent.broadcast(i32a.buffer);
* $262.agent.safeBroadcast(i32a.buffer);
*
* // Wait until the agents were started and then try to yield control to increase
* // the likelihood the agents have called `Atomics.wait` and are now waiting.
@ -205,7 +247,7 @@ $262.agent.timeouts = {
* $262.agent.leaving();
* });
* `);
* $262.agent.broadcast(i32a.buffer);
* $262.agent.safeBroadcast(i32a.buffer);
*
* // Wait until agent was started and then try to yield control.
* $262.agent.waitUntil(i32a, RUNNING, 1);

View File

@ -73,7 +73,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -48,7 +48,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -64,7 +64,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -51,7 +51,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -49,7 +49,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -40,7 +40,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -42,7 +42,7 @@ const i32a = new Int32Array(
// test case, we only do it for consistency with other test cases which do
// require the main agent to wait and yield control.
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -39,7 +39,7 @@ const i32a = new Int32Array(
// test case, we only do it for consistency with other test cases which do
// require the main agent to wait and yield control.
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -52,7 +52,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 5)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait until all agents started.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -55,7 +55,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
// Wait until all agents started.
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);

View File

@ -45,7 +45,7 @@ const i32a = new Int32Array(
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.broadcast(i32a.buffer);
$262.agent.safeBroadcast(i32a);
$262.agent.waitUntil(i32a, RUNNING, 1);
// Try to yield control to ensure the agent actually started to wait.

View File

@ -10,7 +10,8 @@ info: |
2. Let bigint ? ToBigInt(bigint).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asIntN, 'function');
assert.throws(TypeError, function() {
BigInt.asIntN(0, undefined);
}, "ToBigInt: undefined => TypeError");

View File

@ -10,7 +10,8 @@ info: |
2. Let bigint ? ToBigInt(bigint).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asIntN, 'function');
function err() {
throw new Test262Error();
}

View File

@ -10,6 +10,8 @@ info: |
1. Let bits be ? ToIndex(bits).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asIntN, 'function');
assert.throws(RangeError, function() {
BigInt.asIntN(-1, 0n);

View File

@ -10,6 +10,8 @@ info: |
1. Let bits be ? ToIndex(bits).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asIntN, 'function');
function err() {
throw new Test262Error();

View File

@ -10,6 +10,8 @@ info: |
2. Let bigint ? ToBigInt(bigint).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asUintN, 'function');
assert.throws(TypeError, function() {
BigInt.asUintN(0, undefined);

View File

@ -10,6 +10,8 @@ info: |
2. Let bigint ? ToBigInt(bigint).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asUintN, 'function');
function err() {
throw new Test262Error();

View File

@ -10,6 +10,8 @@ info: |
1. Let bits be ? ToIndex(bits).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asUintN, 'function');
assert.throws(RangeError, function() {
BigInt.asUintN(-1, 0n);

View File

@ -10,6 +10,8 @@ info: |
1. Let bits be ? ToIndex(bits).
features: [BigInt, computed-property-names, Symbol, Symbol.toPrimitive]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.sameValue(typeof BigInt.asUintN, 'function');
function err() {
throw new Test262Error();

View File

@ -10,6 +10,7 @@ info: |
...
features: [BigInt]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.throws(TypeError, function() {
new BigInt();

View File

@ -16,6 +16,7 @@ info: |
[[BigIntData]] internal slot.
features: [BigInt]
---*/
assert.sameValue(typeof BigInt, 'function');
assert.throws(TypeError, function() {
BigInt.prototype.toString(1);

View File

@ -22,6 +22,8 @@ features: [BigInt, Symbol, Symbol.toPrimitive]
var toString = BigInt.prototype.toString;
assert.sameValue(typeof toString, 'function');
assert.throws(TypeError, function() {
toString.call({
x: 1n

View File

@ -21,6 +21,7 @@ features: [BigInt]
---*/
var valueOf = BigInt.prototype.valueOf;
assert.sameValue(typeof valueOf, 'function');
assert.throws(TypeError, function() {
valueOf.call({});

View File

@ -22,6 +22,8 @@ features: [BigInt, Symbol]
var valueOf = BigInt.prototype.valueOf;
assert.sameValue(typeof valueOf, 'function');
assert.throws(TypeError, function() {
valueOf.call(undefined);
}, "undefined");

View File

@ -49,6 +49,7 @@ var iterable = {
},
};
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(iterable);
});

View File

@ -49,6 +49,7 @@ var iterable = {
},
};
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(iterable);
});

View File

@ -45,6 +45,7 @@ var iterable = {
},
};
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(iterable);
});

View File

@ -36,6 +36,7 @@ var iterable = {
},
};
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(iterable);
});

View File

@ -14,6 +14,7 @@ info: |
features: [Object.fromEntries]
---*/
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries();
});

View File

@ -7,6 +7,7 @@ esid: sec-object.fromentries
features: [Object.fromEntries]
---*/
assert.sameValue(typeof Object.fromEntries, 'function');
assert.throws(TypeError, function() {
Object.fromEntries(['ab']);
});

View File

@ -8,6 +8,8 @@ esid: sec-promise.prototype.finally
features: [Promise.prototype.finally]
---*/
assert.sameValue(typeof Promise.prototype.finally, 'function');
assert.throws(TypeError, function() {
Promise.prototype.finally.call(undefined);
}, 'undefined');

View File

@ -8,6 +8,7 @@ description: >
esid: sec-promise.prototype.finally
features: [Symbol, Promise.prototype.finally]
---*/
assert.sameValue(typeof Promise.prototype.finally, 'function');
var symbol = Symbol();

View File

@ -23,7 +23,7 @@ var handler = {
_handler = this;
_prop = prop;
return Object.getOwnPropertyDescriptor(t);
return Object.getOwnPropertyDescriptor(t, prop);
}
};
var p = new Proxy(target, handler);

View File

@ -18,8 +18,7 @@ var target = {
number: 1,
symbol: Symbol(),
string: '',
boolean: true,
fn: function() {}
boolean: true
};
var p = new Proxy(target, {
getOwnPropertyDescriptor: function(t, prop) {
@ -43,8 +42,4 @@ assert.throws(TypeError, function() {
Object.getOwnPropertyDescriptor(p, "boolean");
});
assert.throws(TypeError, function() {
Object.getOwnPropertyDescriptor(p, "fn");
});
reportCompare(0, 0);

View File

@ -15,10 +15,10 @@ info: |
9.1.12 [[OwnPropertyKeys]] ( )
1. Let keys be a new empty List.
2. For each own property key P of O that is an integer index, in ascending
2. For each own property key P of O that is an array index, in ascending
numeric index order
a. Add P as the last element of keys.
3. For each own property key P of O that is a String but is not an integer
3. For each own property key P of O that is a String but is not an array
index, in property creation order
a. Add P as the last element of keys.
4. For each own property key P of O that is a Symbol, in property creation
@ -36,18 +36,22 @@ var o1 = {
[Number.MAX_SAFE_INTEGER]: true,
[Symbol.for('z')]: true,
12345678901: true,
4294967294: true,
4294967295: true,
};
var result = Reflect.ownKeys(o1);
assert.sameValue(result.length, 7);
assert.sameValue(result.length, 9);
assert.sameValue(result[0], '1');
assert.sameValue(result[1], '12345678900');
assert.sameValue(result[2], '12345678901');
assert.sameValue(result[3], String(Number.MAX_SAFE_INTEGER));
assert.sameValue(result[4], 'b');
assert.sameValue(result[5], 'a');
assert.sameValue(result[6], Symbol.for('z'));
assert.sameValue(result[1], '4294967294');
assert.sameValue(result[2], '12345678900');
assert.sameValue(result[3], 'b');
assert.sameValue(result[4], 'a');
assert.sameValue(result[5], String(Number.MAX_SAFE_INTEGER));
assert.sameValue(result[6], '12345678901');
assert.sameValue(result[7], '4294967295');
assert.sameValue(result[8], Symbol.for('z'));
var o2 = {};
@ -58,17 +62,21 @@ o2.a = true;
o2[Number.MAX_SAFE_INTEGER] = true;
o2[Symbol.for('z')] = true;
o2[12345678901] = true;
o2[4294967294] = true;
o2[4294967295] = true;
result = Reflect.ownKeys(o2);
assert.sameValue(result.length, 7);
assert.sameValue(result.length, 9);
assert.sameValue(result[0], '1');
assert.sameValue(result[1], '12345678900');
assert.sameValue(result[2], '12345678901');
assert.sameValue(result[3], String(Number.MAX_SAFE_INTEGER));
assert.sameValue(result[4], 'b');
assert.sameValue(result[5], 'a');
assert.sameValue(result[6], Symbol.for('z'));
assert.sameValue(result[1], '4294967294');
assert.sameValue(result[2], '12345678900');
assert.sameValue(result[3], 'b');
assert.sameValue(result[4], 'a');
assert.sameValue(result[5], String(Number.MAX_SAFE_INTEGER));
assert.sameValue(result[6], '12345678901');
assert.sameValue(result[7], '4294967295');
assert.sameValue(result[8], Symbol.for('z'));
reportCompare(0, 0);

View File

@ -8,7 +8,7 @@ description: >
...
3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
...
features: [WeakSet]
---*/
assert.throws(TypeError, function() {

View File

@ -8,7 +8,7 @@ description: >
...
3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
...
features: [WeakSet]
---*/
assert.throws(TypeError, function() {

View File

@ -8,7 +8,7 @@ description: >
...
3. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
...
features: [WeakSet]
---*/
assert.throws(TypeError, function() {

View File

@ -14,6 +14,7 @@ description: >
...
2. If S does not have a [[SetData]] internal slot, throw a TypeError exception.
...
features: [WeakSet]
---*/
assert.throws(TypeError, function() {

Some files were not shown because too many files have changed in this diff Show More