mirror of https://github.com/tc39/test262.git
fixes after rebase
This commit is contained in:
parent
afe2647d19
commit
6335c39ade
|
@ -13,13 +13,13 @@ features: [Atomics, BigInt, SharedArrayBuffer, TypedArray]
|
|||
const WAIT_INDEX = 0; // Waiters on this will be woken
|
||||
const WAIT_FAKE = 1; // Waiters on this will not be woken
|
||||
const RUNNING = 2; // Accounting of live agents
|
||||
const WAKE_INDEX = 3; // Accounting for too early timeouts
|
||||
const NOTIFY_INDEX = 3; // Accounting for too early timeouts
|
||||
const NUMAGENT = 3;
|
||||
const TIMEOUT_AGENT_MESSAGES = 2; // Number of messages for the timeout agent
|
||||
const BUFFER_SIZE = 4;
|
||||
|
||||
// Long timeout to ensure the agent doesn't timeout before the main agent calls
|
||||
// `Atomics.wake`.
|
||||
// `Atomics.notify`.
|
||||
const TIMEOUT = $262.agent.timeouts.long;
|
||||
|
||||
for (var i = 0; i < NUMAGENT; i++) {
|
||||
|
@ -43,10 +43,10 @@ $262.agent.start(`
|
|||
$262.agent.report("B " + Atomics.wait(i64a, ${WAIT_FAKE}, 0n, ${TIMEOUT}));
|
||||
|
||||
// If this value is not 1n, then the agent timeout before the main agent
|
||||
// called Atomics.wake.
|
||||
const result = Atomics.load(i64a, ${WAKE_INDEX}) === 1n
|
||||
? "timeout after Atomics.wake"
|
||||
: "timeout before Atomics.wake";
|
||||
// called Atomics.notify.
|
||||
const result = Atomics.load(i64a, ${NOTIFY_INDEX}) === 1n
|
||||
? "timeout after Atomics.notify"
|
||||
: "timeout before Atomics.notify";
|
||||
$262.agent.report("W " + result);
|
||||
|
||||
$262.agent.leaving();
|
||||
|
@ -73,7 +73,7 @@ assert.sameValue(
|
|||
'Atomics.notify(i64a, WAIT_INDEX) returns the value of `NUMAGENT`'
|
||||
);
|
||||
|
||||
Atomics.store(i64a, WAKE_INDEX, 1n);
|
||||
Atomics.store(i64a, NOTIFY_INDEX, 1n);
|
||||
|
||||
const reports = [];
|
||||
for (var i = 0; i < NUMAGENT + TIMEOUT_AGENT_MESSAGES; i++) {
|
||||
|
@ -85,5 +85,5 @@ for (var i = 0; i < NUMAGENT; i++) {
|
|||
assert.sameValue(reports[i], 'A ok', 'The value of reports[i] is "A ok"');
|
||||
}
|
||||
assert.sameValue(reports[NUMAGENT], 'B timed-out', 'The value of reports[NUMAGENT] is "B timed-out"');
|
||||
assert.sameValue(reports[NUMAGENT + 1], "W timeout after Atomics.wake",
|
||||
'The value of reports[NUMAGENT + 1] is "W timeout after Atomics.wake"');
|
||||
assert.sameValue(reports[NUMAGENT + 1], "W timeout after Atomics.notify",
|
||||
'The value of reports[NUMAGENT + 1] is "W timeout after Atomics.notify"');
|
||||
|
|
|
@ -13,13 +13,13 @@ features: [Atomics, SharedArrayBuffer, TypedArray]
|
|||
const WAIT_INDEX = 0; // Waiters on this will be woken
|
||||
const WAIT_FAKE = 1; // Waiters on this will not be woken
|
||||
const RUNNING = 2; // Accounting of live agents
|
||||
const WAKE_INDEX = 3; // Accounting for too early timeouts
|
||||
const NOTIFY_INDEX = 3; // Accounting for too early timeouts
|
||||
const NUMAGENT = 3;
|
||||
const TIMEOUT_AGENT_MESSAGES = 2; // Number of messages for the timeout agent
|
||||
const BUFFER_SIZE = 4;
|
||||
|
||||
// Long timeout to ensure the agent doesn't timeout before the main agent calls
|
||||
// `Atomics.wake`.
|
||||
// `Atomics.notify`.
|
||||
const TIMEOUT = $262.agent.timeouts.long;
|
||||
|
||||
for (var i = 0; i < NUMAGENT; i++) {
|
||||
|
@ -43,10 +43,10 @@ $262.agent.start(`
|
|||
$262.agent.report("B " + Atomics.wait(i32a, ${WAIT_FAKE}, 0, ${TIMEOUT}));
|
||||
|
||||
// If this value is not 1, then the agent timeout before the main agent
|
||||
// called Atomics.wake.
|
||||
const result = Atomics.load(i32a, ${WAKE_INDEX}) === 1
|
||||
? "timeout after Atomics.wake"
|
||||
: "timeout before Atomics.wake";
|
||||
// called Atomics.notify.
|
||||
const result = Atomics.load(i32a, ${NOTIFY_INDEX}) === 1
|
||||
? "timeout after Atomics.notify"
|
||||
: "timeout before Atomics.notify";
|
||||
$262.agent.report("W " + result);
|
||||
|
||||
$262.agent.leaving();
|
||||
|
@ -73,7 +73,7 @@ assert.sameValue(
|
|||
'Atomics.notify(i32a, WAIT_INDEX) returns the value of `NUMAGENT`'
|
||||
);
|
||||
|
||||
Atomics.store(i32a, WAKE_INDEX, 1);
|
||||
Atomics.store(i32a, NOTIFY_INDEX, 1);
|
||||
|
||||
const reports = [];
|
||||
for (var i = 0; i < NUMAGENT + TIMEOUT_AGENT_MESSAGES; i++) {
|
||||
|
@ -85,5 +85,5 @@ for (var i = 0; i < NUMAGENT; i++) {
|
|||
assert.sameValue(reports[i], "A ok", 'The value of reports[i] is "A ok"');
|
||||
}
|
||||
assert.sameValue(reports[NUMAGENT], "B timed-out", 'The value of reports[NUMAGENT] is "B timed-out"');
|
||||
assert.sameValue(reports[NUMAGENT + 1], "W timeout after Atomics.wake",
|
||||
'The value of reports[NUMAGENT + 1] is "W timeout after Atomics.wake"');
|
||||
assert.sameValue(reports[NUMAGENT + 1], "W timeout after Atomics.notify",
|
||||
'The value of reports[NUMAGENT + 1] is "W timeout after Atomics.notify"');
|
||||
|
|
|
@ -37,5 +37,5 @@ assert.sameValue(Atomics.notify(i32a, 0, 1), 1, 'Atomics.notify(i32a, 0, 1) retu
|
|||
|
||||
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');
|
||||
|
||||
// Already awake, this should be a noop
|
||||
// Already notified, this should be a noop
|
||||
assert.sameValue(Atomics.notify(i32a, 0, 1), 0, 'Atomics.notify(i32a, 0, 1) returns 0');
|
||||
|
|
|
@ -81,4 +81,4 @@ assert(lapse >= 0, 'The result of `(lapse >= 0)` is true (timeout should be a mi
|
|||
|
||||
assert(lapse <= $262.agent.MAX_TIME_EPSILON, 'The result of `(lapse <= $262.agent.MAX_TIME_EPSILON)` is true');
|
||||
|
||||
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0');
|
||||
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
|
||||
|
|
|
@ -49,9 +49,4 @@ assert.sameValue(
|
|||
'timed-out',
|
||||
'$262.agent.getReport() returns "timed-out"'
|
||||
);
|
||||
<<<<<<< HEAD
|
||||
assert.sameValue(Atomics.wake(i64a, 0), 0, 'Atomics.wake(i64a, 0) returns 0');
|
||||
=======
|
||||
assert.sameValue(Atomics.notify(i64a, 0), 0, 'Atomics.notify(i64a, 0) returns 0');
|
||||
|
||||
>>>>>>> e6e13b293e... First renaming for wake to notify in the wait folder
|
||||
|
|
|
@ -56,4 +56,4 @@ assert.sameValue(
|
|||
'timed-out',
|
||||
'$262.agent.getReport() returns "timed-out"'
|
||||
);
|
||||
assert.sameValue(Atomics.wake(i32a, 0), 0, 'Atomics.wake(i32a, 0) returns 0');
|
||||
assert.sameValue(Atomics.nofity(i32a, 0), 0, 'Atomics.nofity(i32a, 0) returns 0');
|
||||
|
|
|
@ -56,19 +56,19 @@ $262.agent.broadcast(i32a.buffer);
|
|||
// Wait until all agents started.
|
||||
$262.agent.waitUntil(i32a, RUNNING, NUMAGENT);
|
||||
|
||||
// Wake index 1, notifies nothing
|
||||
// Notify index 1, notifies nothing
|
||||
assert.sameValue(Atomics.notify(i32a, 1), 0, 'Atomics.notify(i32a, 1) returns 0');
|
||||
|
||||
// Wake index 3, notifies nothing
|
||||
// Notify index 3, notifies nothing
|
||||
assert.sameValue(Atomics.notify(i32a, 3), 0, 'Atomics.notify(i32a, 3) returns 0');
|
||||
|
||||
// Wake index 2, notifies 1
|
||||
// Notify index 2, notifies 1
|
||||
var woken = 0;
|
||||
while ((woken = Atomics.notify(i32a, 2)) === 0) ;
|
||||
assert.sameValue(woken, 1, 'Atomics.notify(i32a, 2) returns 1');
|
||||
assert.sameValue($262.agent.getReport(), 'ok', '$262.agent.getReport() returns "ok"');
|
||||
|
||||
// Wake index 0, notifies 1
|
||||
// Notify index 0, notifies 1
|
||||
var woken = 0;
|
||||
while ((woken = Atomics.notify(i32a, 0)) === 0) ;
|
||||
assert.sameValue(woken, 1, 'Atomics.notify(i32a, 0) returns 1');
|
||||
|
|
Loading…
Reference in New Issue