mirror of https://github.com/tc39/test262.git
Atomics: fix buffer sizes
This commit is contained in:
parent
5ebd632d8f
commit
84f448f060
|
@ -35,7 +35,7 @@ function getReport() {
|
|||
* @param {Number} index The index of which all agents will report.
|
||||
* @param {Number} expected The number of agents that are expected to report as active.
|
||||
*/
|
||||
function waitUntil(i32a, index, expected ) {
|
||||
function waitUntil(i32a, index, expected) {
|
||||
var i = 0;
|
||||
while (Atomics.load(i32a, index) !== expected && i < 15) {
|
||||
$262.agent.sleep(10);
|
||||
|
|
|
@ -27,7 +27,7 @@ const poisoned = {
|
|||
};
|
||||
|
||||
try {
|
||||
$DETACHBUFFER(i64a.buffer); // Detaching a non-shared ArrayBuffer sets the [[ArrayBufferData]] value to null
|
||||
$DETACHBUFFER(i32a.buffer); // Detaching a non-shared ArrayBuffer sets the [[ArrayBufferData]] value to null
|
||||
} catch (error) {
|
||||
$ERROR(`An unexpected error occurred when detaching ArrayBuffer: ${error.message}`);
|
||||
}
|
||||
|
|
|
@ -38,9 +38,6 @@ const i32a = new Int32Array(
|
|||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)
|
||||
);
|
||||
|
||||
|
||||
const i32a = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||
|
||||
$262.agent.broadcast(i32a.buffer);
|
||||
$262.agent.sleep(150);
|
||||
|
||||
|
|
|
@ -41,7 +41,7 @@ $262.agent.broadcast(i32a.buffer);
|
|||
// Wait for agents to be running.
|
||||
waitUntil(i32a, RUNNING, NUMAGENT);
|
||||
|
||||
// Then wait some more to give the agents a fair chance to wait. If we don't,
|
||||
// Sleep to allow the agents a fair chance to wait. If we don't,
|
||||
// we risk sending the wakeup before agents are sleeping, and we hang.
|
||||
$262.agent.sleep(50);
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
esid: sec-atomics.wake
|
||||
description: >
|
||||
Test that Atomics.wake wakes zero waiters if the count is NaN
|
||||
includes: [testAtomics.js]
|
||||
includes: [atomicsHelper.js,testAtomics.js]
|
||||
features: [ArrayBuffer, DataView, let, arrow-function, for-of, Atomics, BigInt, SharedArrayBuffer, TypedArray]
|
||||
---*/
|
||||
|
||||
|
|
|
@ -19,7 +19,7 @@ $262.agent.start(`
|
|||
`);
|
||||
|
||||
const i32a = new Int32Array(
|
||||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)
|
||||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2)
|
||||
);
|
||||
|
||||
$262.agent.broadcast(i32a.buffer);
|
||||
|
@ -28,12 +28,7 @@ waitUntil(i32a, 1, 1);
|
|||
|
||||
assert.sameValue(Atomics.wake(i32a, 0, 1), 1, 'Atomics.wake(i32a, 0, 1) returns 1');
|
||||
|
||||
$262.agent.sleep(10);
|
||||
|
||||
// Collect and check results
|
||||
var report = getReport();
|
||||
|
||||
assert.sameValue(report, 'ok', 'The value of `report` is "ok"');
|
||||
assert.sameValue(getReport(), 'ok', 'The value of `report` is "ok"');
|
||||
|
||||
// Already awake, this should be a noop
|
||||
assert.sameValue(Atomics.wake(i32a, 0, 1), 0, 'Atomics.wake(i32a, 0, 1) returns 0');
|
||||
|
|
|
@ -29,7 +29,7 @@ for (var i = 0; i < NUMAGENT; i++ ) {
|
|||
}
|
||||
|
||||
const i32a = new Int32Array(
|
||||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)
|
||||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 4)
|
||||
);
|
||||
|
||||
$262.agent.broadcast(i32a.buffer);
|
||||
|
|
|
@ -19,7 +19,7 @@ $262.agent.start(`
|
|||
`);
|
||||
|
||||
const i32a = new Int32Array(
|
||||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)
|
||||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2)
|
||||
);
|
||||
|
||||
$262.agent.broadcast(i32a.buffer);
|
||||
|
|
|
@ -20,7 +20,7 @@ $262.agent.start(`
|
|||
`);
|
||||
|
||||
const i32a = new Int32Array(
|
||||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT)
|
||||
new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT * 2)
|
||||
);
|
||||
|
||||
$262.agent.broadcast(i32a.buffer);
|
||||
|
|
Loading…
Reference in New Issue