mirror of
https://github.com/tc39/test262.git
synced 2025-07-27 07:54:41 +02:00
Last renamings in the Atomics/wake folder
This commit is contained in:
parent
6533378823
commit
4911c6e77a
@ -4,8 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes all waiters on a location, but does not
|
Test that Atomics.notify notifies all waiters on a location, but does not
|
||||||
wake waiters on other locations.
|
notify waiters on other locations.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
|
features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
@ -63,10 +63,10 @@ $262.agent.broadcast(i64a.buffer);
|
|||||||
$262.agent.waitUntil(i64a, RUNNING, BigInt(NUMAGENT + 1));
|
$262.agent.waitUntil(i64a, RUNNING, BigInt(NUMAGENT + 1));
|
||||||
|
|
||||||
// Try to yield control to ensure the agent actually started to wait. If we
|
// Try to yield control to ensure the agent actually started to wait. If we
|
||||||
// don't, we risk sending the wakeup before agents are sleeping, and we hang.
|
// don't, we risk sending the notification before agents are sleeping, and we hang.
|
||||||
$262.agent.tryYield();
|
$262.agent.tryYield();
|
||||||
|
|
||||||
// Wake all waiting on WAIT_INDEX, should be 3 always, they won't time out.
|
// Notify all waiting on WAIT_INDEX, should be 3 always, they won't time out.
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
Atomics.notify(i64a, WAIT_INDEX),
|
Atomics.notify(i64a, WAIT_INDEX),
|
||||||
NUMAGENT,
|
NUMAGENT,
|
||||||
|
@ -8,7 +8,7 @@ includes: [propertyHelper.js]
|
|||||||
features: [Atomics]
|
features: [Atomics]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyProperty(Atomics, 'wake', {
|
verifyProperty(Atomics, 'notify', {
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
writable: true,
|
writable: true,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
|
@ -5,13 +5,13 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Atomics.notify.name is "wake".
|
Atomics.notify.name is "notify".
|
||||||
includes: [propertyHelper.js]
|
includes: [propertyHelper.js]
|
||||||
features: [Atomics]
|
features: [Atomics]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
verifyProperty(Atomics.notify, 'name', {
|
verifyProperty(Atomics.notify, 'name', {
|
||||||
value: 'wake',
|
value: 'notify',
|
||||||
enumerable: false,
|
enumerable: false,
|
||||||
writable: false,
|
writable: false,
|
||||||
configurable: true,
|
configurable: true,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes zero waiters if the count is negative
|
Test that Atomics.notify notifies zero waiters if the count is negative
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
@ -4,8 +4,8 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes all waiters on a location, but does not
|
Test that Atomics.notify notifies all waiters on a location, but does not
|
||||||
wake waiters on other locations.
|
notify waiters on other locations.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
@ -63,10 +63,10 @@ $262.agent.broadcast(i32a.buffer);
|
|||||||
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT + 1);
|
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT + 1);
|
||||||
|
|
||||||
// Try to yield control to ensure the agent actually started to wait. If we
|
// Try to yield control to ensure the agent actually started to wait. If we
|
||||||
// don't, we risk sending the wakeup before agents are sleeping, and we hang.
|
// don't, we risk sending the notification before agents are sleeping, and we hang.
|
||||||
$262.agent.tryYield();
|
$262.agent.tryYield();
|
||||||
|
|
||||||
// Wake all waiting on WAIT_INDEX, should be 3 always, they won't time out.
|
// Notify all waiting on WAIT_INDEX, should be 3 always, they won't time out.
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
Atomics.notify(i32a, WAIT_INDEX),
|
Atomics.notify(i32a, WAIT_INDEX),
|
||||||
NUMAGENT,
|
NUMAGENT,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes all waiters if that's what the count is.
|
Test that Atomics.notify notifies all waiters if that's what the count is.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
@ -36,10 +36,10 @@ $262.agent.broadcast(i32a.buffer);
|
|||||||
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
|
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
|
||||||
|
|
||||||
// Try to yield control to ensure the agent actually started to wait. If we
|
// Try to yield control to ensure the agent actually started to wait. If we
|
||||||
// don't, we risk sending the wakeup before agents are sleeping, and we hang.
|
// don't, we risk sending the notification before agents are sleeping, and we hang.
|
||||||
$262.agent.tryYield();
|
$262.agent.tryYield();
|
||||||
|
|
||||||
// Wake all waiting on WAIT_INDEX, should be 3 always, they won't time out.
|
// Notify all waiting on WAIT_INDEX, should be 3 always, they won't time out.
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
Atomics.notify(i32a, WAIT_INDEX),
|
Atomics.notify(i32a, WAIT_INDEX),
|
||||||
NUMAGENT,
|
NUMAGENT,
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes agents in the order they are waiting.
|
Test that Atomics.notify notifies agents in the order they are waiting.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
@ -16,8 +16,8 @@ const RUNNING = SPIN + NUMAGENT; // Accounting of live agents
|
|||||||
const BUFFER_SIZE = RUNNING + 1;
|
const BUFFER_SIZE = RUNNING + 1;
|
||||||
|
|
||||||
// Create workers and start them all spinning. We set atomic slots to make
|
// Create workers and start them all spinning. We set atomic slots to make
|
||||||
// them go into a wait, thus controlling the waiting order. Then we wake them
|
// them go into a wait, thus controlling the waiting order. Then we notify them
|
||||||
// one by one and observe the wakeup order.
|
// one by one and observe the notification order.
|
||||||
|
|
||||||
for (var i = 0; i < NUMAGENT; i++) {
|
for (var i = 0; i < NUMAGENT; i++) {
|
||||||
$262.agent.start(`
|
$262.agent.start(`
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes agents in the order they are waiting.
|
Test that Atomics.notify notifies agents in the order they are waiting.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
@ -16,8 +16,8 @@ const RUNNING = SPIN + NUMAGENT; // Accounting of live agents
|
|||||||
const BUFFER_SIZE = RUNNING + 1;
|
const BUFFER_SIZE = RUNNING + 1;
|
||||||
|
|
||||||
// Create workers and start them all spinning. We set atomic slots to make
|
// Create workers and start them all spinning. We set atomic slots to make
|
||||||
// them go into a wait, thus controlling the waiting order. Then we wake them
|
// them go into a wait, thus controlling the waiting order. Then we notify them
|
||||||
// one by one and observe the wakeup order.
|
// one by one and observe the notification order.
|
||||||
|
|
||||||
for (var i = 0; i < NUMAGENT; i++) {
|
for (var i = 0; i < NUMAGENT; i++) {
|
||||||
$262.agent.start(`
|
$262.agent.start(`
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes one waiter if that's what the count is.
|
Test that Atomics.notify notifies one waiter if that's what the count is.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const WAIT_INDEX = 0; // Agents wait here
|
const WAIT_INDEX = 0; // Agents wait here
|
||||||
const RUNNING = 1; // Accounting of live agents here
|
const RUNNING = 1; // Accounting of live agents here
|
||||||
const WAKECOUNT = 1;
|
const NOTIFYCOUNT = 1;
|
||||||
const NUMAGENT = 3;
|
const NUMAGENT = 3;
|
||||||
const BUFFER_SIZE = 4;
|
const BUFFER_SIZE = 4;
|
||||||
|
|
||||||
@ -42,13 +42,13 @@ $262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
|
|||||||
// Try to yield control to ensure the agent actually started to wait.
|
// Try to yield control to ensure the agent actually started to wait.
|
||||||
$262.agent.tryYield();
|
$262.agent.tryYield();
|
||||||
|
|
||||||
// There's a slight risk we'll fail to wake the desired count, if the preceding
|
// There's a slight risk we'll fail to notify the desired count, if the preceding
|
||||||
// tryYield() took much longer than anticipated and workers have started timing
|
// tryYield() took much longer than anticipated and workers have started timing
|
||||||
// out.
|
// out.
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
Atomics.notify(i32a, 0, WAKECOUNT),
|
Atomics.notify(i32a, 0, NOTIFYCOUNT),
|
||||||
WAKECOUNT,
|
NOTIFYCOUNT,
|
||||||
'Atomics.notify(i32a, 0, WAKECOUNT) returns the value of `WAKECOUNT`'
|
'Atomics.notify(i32a, 0, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT`'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Try to sleep past the timeout.
|
// Try to sleep past the timeout.
|
||||||
@ -61,9 +61,9 @@ for (var i = 0; i < NUMAGENT; i++) {
|
|||||||
}
|
}
|
||||||
reports.sort();
|
reports.sort();
|
||||||
|
|
||||||
for (var i = 0; i < WAKECOUNT; i++) {
|
for (var i = 0; i < NOTIFYCOUNT; i++) {
|
||||||
assert.sameValue(reports[i], 'ok', 'The value of reports[i] is "ok"');
|
assert.sameValue(reports[i], 'ok', 'The value of reports[i] is "ok"');
|
||||||
}
|
}
|
||||||
for (var i = WAKECOUNT; i < NUMAGENT; i++) {
|
for (var i = NOTIFYCOUNT; i < NUMAGENT; i++) {
|
||||||
assert.sameValue(reports[i], 'timed-out', 'The value of reports[i] is "timed-out"');
|
assert.sameValue(reports[i], 'timed-out', 'The value of reports[i] is "timed-out"');
|
||||||
}
|
}
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes two waiters if that's what the count is.
|
Test that Atomics.notify notifies two waiters if that's what the count is.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const WAIT_INDEX = 0; // Agents wait here
|
const WAIT_INDEX = 0; // Agents wait here
|
||||||
const RUNNING = 1; // Accounting of live agents here
|
const RUNNING = 1; // Accounting of live agents here
|
||||||
const WAKECOUNT = 2;
|
const NOTIFYCOUNT = 2;
|
||||||
const NUMAGENT = 3;
|
const NUMAGENT = 3;
|
||||||
const BUFFER_SIZE = 4;
|
const BUFFER_SIZE = 4;
|
||||||
|
|
||||||
@ -42,13 +42,13 @@ $262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
|
|||||||
// Try to yield control to ensure the agent actually started to wait.
|
// Try to yield control to ensure the agent actually started to wait.
|
||||||
$262.agent.tryYield();
|
$262.agent.tryYield();
|
||||||
|
|
||||||
// There's a slight risk we'll fail to wake the desired count, if the preceding
|
// There's a slight risk we'll fail to notify the desired count, if the preceding
|
||||||
// tryYield() took much longer than anticipated and workers have started timing
|
// tryYield() took much longer than anticipated and workers have started timing
|
||||||
// out.
|
// out.
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
Atomics.notify(i32a, 0, WAKECOUNT),
|
Atomics.notify(i32a, 0, NOTIFYCOUNT),
|
||||||
WAKECOUNT,
|
NOTIFYCOUNT,
|
||||||
'Atomics.notify(i32a, 0, WAKECOUNT) returns the value of `WAKECOUNT`'
|
'Atomics.notify(i32a, 0, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT`'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Try to sleep past the timeout.
|
// Try to sleep past the timeout.
|
||||||
@ -61,9 +61,9 @@ for (var i = 0; i < NUMAGENT; i++) {
|
|||||||
}
|
}
|
||||||
reports.sort();
|
reports.sort();
|
||||||
|
|
||||||
for (var i = 0; i < WAKECOUNT; i++) {
|
for (var i = 0; i < NOTIFYCOUNT; i++) {
|
||||||
assert.sameValue(reports[i], 'ok', 'The value of reports[i] is "ok"');
|
assert.sameValue(reports[i], 'ok', 'The value of reports[i] is "ok"');
|
||||||
}
|
}
|
||||||
for (var i = WAKECOUNT; i < NUMAGENT; i++) {
|
for (var i = NOTIFYCOUNT; i < NUMAGENT; i++) {
|
||||||
assert.sameValue(reports[i], 'timed-out', 'The value of reports[i] is "timed-out"');
|
assert.sameValue(reports[i], 'timed-out', 'The value of reports[i] is "timed-out"');
|
||||||
}
|
}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes zero waiters if there are no agents waiting.
|
Test that Atomics.notify notifies zero waiters if there are no agents waiting.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
@ -27,5 +27,5 @@ const i32a = new Int32Array(
|
|||||||
$262.agent.broadcast(i32a.buffer);
|
$262.agent.broadcast(i32a.buffer);
|
||||||
$262.agent.waitUntil(i32a, RUNNING, 1);
|
$262.agent.waitUntil(i32a, RUNNING, 1);
|
||||||
|
|
||||||
// There are ZERO agents waiting to wake...
|
// There are ZERO agents waiting to notify...
|
||||||
assert.sameValue(Atomics.notify(i32a, 0, 1), 0, 'Atomics.notify(i32a, 0, 1) returns 0');
|
assert.sameValue(Atomics.notify(i32a, 0, 1), 0, 'Atomics.notify(i32a, 0, 1) returns 0');
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes zero waiters if there are no waiters
|
Test that Atomics.notify notifies zero waiters if there are no waiters
|
||||||
at the index specified.
|
at the index specified.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
|
@ -4,14 +4,14 @@
|
|||||||
/*---
|
/*---
|
||||||
esid: sec-atomics.notify
|
esid: sec-atomics.notify
|
||||||
description: >
|
description: >
|
||||||
Test that Atomics.notify wakes zero waiters if that's what the count is.
|
Test that Atomics.notify notifies zero waiters if that's what the count is.
|
||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
features: [Atomics, SharedArrayBuffer, TypedArray]
|
features: [Atomics, SharedArrayBuffer, TypedArray]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
const WAIT_INDEX = 0; // Agents wait here
|
const WAIT_INDEX = 0; // Agents wait here
|
||||||
const RUNNING = 1; // Accounting of live agents here
|
const RUNNING = 1; // Accounting of live agents here
|
||||||
const WAKECOUNT = 0;
|
const NOTIFYCOUNT = 0;
|
||||||
const NUMAGENT = 3;
|
const NUMAGENT = 3;
|
||||||
const BUFFER_SIZE = 4;
|
const BUFFER_SIZE = 4;
|
||||||
|
|
||||||
@ -43,9 +43,9 @@ $262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
|
|||||||
$262.agent.tryYield();
|
$262.agent.tryYield();
|
||||||
|
|
||||||
assert.sameValue(
|
assert.sameValue(
|
||||||
Atomics.notify(i32a, WAIT_INDEX, WAKECOUNT),
|
Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT),
|
||||||
WAKECOUNT,
|
NOTIFYCOUNT,
|
||||||
'Atomics.notify(i32a, WAIT_INDEX, WAKECOUNT) returns the value of `WAKECOUNT`'
|
'Atomics.notify(i32a, WAIT_INDEX, NOTIFYCOUNT) returns the value of `NOTIFYCOUNT`'
|
||||||
);
|
);
|
||||||
|
|
||||||
// Try to sleep past the timeout.
|
// Try to sleep past the timeout.
|
||||||
|
@ -58,14 +58,14 @@ $262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
|
|||||||
// Try to yield control to ensure the agents actually started to wait.
|
// Try to yield control to ensure the agents actually started to wait.
|
||||||
$262.agent.tryYield();
|
$262.agent.tryYield();
|
||||||
|
|
||||||
// Wake at index 0, undefined => 0.
|
// Notify at index 0, undefined => 0.
|
||||||
var woken = 0;
|
var woken = 0;
|
||||||
while ((woken = Atomics.notify(i32a, undefined, 1)) === 0) ;
|
while ((woken = Atomics.notify(i32a, undefined, 1)) === 0) ;
|
||||||
assert.sameValue(woken, 1, 'Atomics.notify(i32a, undefined, 1) returns 1');
|
assert.sameValue(woken, 1, 'Atomics.notify(i32a, undefined, 1) returns 1');
|
||||||
|
|
||||||
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');
|
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');
|
||||||
|
|
||||||
// Wake again at index 0, default => 0.
|
// Notify again at index 0, default => 0.
|
||||||
var woken = 0;
|
var woken = 0;
|
||||||
while ((woken = Atomics.notify(i32a, /*, default values used */)) === 0) ;
|
while ((woken = Atomics.notify(i32a, /*, default values used */)) === 0) ;
|
||||||
assert.sameValue(woken, 1, 'Atomics.notify(i32a /*, default values used */) returns 1');
|
assert.sameValue(woken, 1, 'Atomics.notify(i32a /*, default values used */) returns 1');
|
||||||
|
Loading…
x
Reference in New Issue
Block a user