Atomics: fix buffer sizes

This commit is contained in:
Rick Waldron 2018-06-22 16:35:15 -04:00
parent 5ebd632d8f
commit 84f448f060
9 changed files with 9 additions and 17 deletions

View File

@ -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);

View File

@ -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}`);
}

View File

@ -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);

View File

@ -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);

View File

@ -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]
---*/

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -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);