Atomics: (bigint) initialize BigInt64Array before calling $262.agent.start(string-of-program-code)

This commit is contained in:
Rick Waldron 2018-11-20 15:57:39 -05:00
parent 8793bf5d57
commit e91645c812
7 changed files with 29 additions and 31 deletions

View File

@ -22,6 +22,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) {
@ -53,10 +57,6 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * BUFFER_SIZE)
);
$262.agent.safeBroadcast(i64a);
// Wait for agents to be running.

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(`
@ -29,10 +33,6 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);

View File

@ -9,6 +9,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(`
@ -21,10 +25,6 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);

View File

@ -19,9 +19,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);
@ -33,10 +36,6 @@ $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.

View File

@ -25,6 +25,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);
@ -47,10 +51,6 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 5)
);
$262.agent.safeBroadcast(i64a);
// Wait until all agents started.

View File

@ -16,11 +16,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;
@ -50,10 +53,6 @@ for (var i = 0; i < NUMAGENT; i++) {
`);
}
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.safeBroadcast(i64a);
// Wait until all agents started.

View File

@ -25,6 +25,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);
@ -40,10 +44,6 @@ $262.agent.start(`
});
`);
const i64a = new BigInt64Array(
new SharedArrayBuffer(BigInt64Array.BYTES_PER_ELEMENT * 4)
);
$262.agent.safeBroadcast(i64a);
$262.agent.waitUntil(i64a, RUNNING, 1n);