mirror of
https://github.com/tc39/test262.git
synced 2025-07-26 23:44:27 +02:00
parent
2871a9c8ed
commit
ea45caf046
@ -8,26 +8,26 @@ description: >
|
|||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab, id) {
|
$262.agent.receiveBroadcast(function (sab, id) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
var then = Date.now();
|
var then = Date.now();
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, 500)); // Timeout 500ms
|
$262.agent.report(Atomics.wait(ia, 0, 0, 500)); // Timeout 500ms
|
||||||
$.agent.report(Date.now() - then);
|
$262.agent.report(Date.now() - then);
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
assert.sameValue(getReport(), "timed-out");
|
assert.sameValue(getReport(), "timed-out");
|
||||||
assert.sameValue(Math.abs((getReport()|0) - 500) < $ATOMICS_MAX_TIME_EPSILON, true);
|
assert.sameValue(Math.abs((getReport()|0) - 500) < $ATOMICS_MAX_TIME_EPSILON, true);
|
||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ description: >
|
|||||||
// Let's assume 'wait' is not allowed on the main thread,
|
// Let's assume 'wait' is not allowed on the main thread,
|
||||||
// even in the shell.
|
// even in the shell.
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
var sab = new SharedArrayBuffer(1024);
|
var sab = new SharedArrayBuffer(1024);
|
||||||
var ab = new ArrayBuffer(16);
|
var ab = new ArrayBuffer(16);
|
||||||
@ -25,8 +25,8 @@ var good_indices = [ (view) => 0/-1, // -0
|
|||||||
var view = new Int32Array(sab, 32, 20);
|
var view = new Int32Array(sab, 32, 20);
|
||||||
|
|
||||||
view[0] = 0;
|
view[0] = 0;
|
||||||
$.agent.report("A " + Atomics.wait(view, 0, 0, 0))
|
$262.agent.report("A " + Atomics.wait(view, 0, 0, 0))
|
||||||
$.agent.report("B " + Atomics.wait(view, 0, 37, 0));
|
$262.agent.report("B " + Atomics.wait(view, 0, 37, 0));
|
||||||
|
|
||||||
// In-bounds boundary cases for indexing
|
// In-bounds boundary cases for indexing
|
||||||
for ( let IdxGen of good_indices ) {
|
for ( let IdxGen of good_indices ) {
|
||||||
@ -35,11 +35,11 @@ for ( let IdxGen of good_indices ) {
|
|||||||
// Atomics.store() computes an index from Idx in the same way as other
|
// Atomics.store() computes an index from Idx in the same way as other
|
||||||
// Atomics operations, not quite like view[Idx].
|
// Atomics operations, not quite like view[Idx].
|
||||||
Atomics.store(view, Idx, 37);
|
Atomics.store(view, Idx, 37);
|
||||||
$.agent.report("C " + Atomics.wait(view, Idx, 0));
|
$262.agent.report("C " + Atomics.wait(view, Idx, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
$.agent.report("done");
|
$262.agent.report("done");
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
`)
|
`)
|
||||||
|
|
||||||
assert.sameValue(getReport(), "A timed-out");
|
assert.sameValue(getReport(), "A timed-out");
|
||||||
@ -50,7 +50,7 @@ while ((r = getReport()) != "done")
|
|||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -6,26 +6,26 @@ description: >
|
|||||||
Test that Atomics.wait does not time out with a NaN timeout
|
Test that Atomics.wait does not time out with a NaN timeout
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab, id) {
|
$262.agent.receiveBroadcast(function (sab, id) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, NaN)); // NaN => Infinity
|
$262.agent.report(Atomics.wait(ia, 0, 0, NaN)); // NaN => Infinity
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Ample time
|
$262.agent.sleep(500); // Ample time
|
||||||
assert.sameValue($.agent.getReport(), null);
|
assert.sameValue($262.agent.getReport(), null);
|
||||||
Atomics.wake(ia, 0);
|
Atomics.wake(ia, 0);
|
||||||
assert.sameValue(getReport(), "ok");
|
assert.sameValue(getReport(), "ok");
|
||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -6,23 +6,23 @@ description: >
|
|||||||
Test that Atomics.wait times out with a negative timeout
|
Test that Atomics.wait times out with a negative timeout
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab, id) {
|
$262.agent.receiveBroadcast(function (sab, id) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, -5)); // -5 => 0
|
$262.agent.report(Atomics.wait(ia, 0, 0, -5)); // -5 => 0
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
assert.sameValue(getReport(), "timed-out");
|
assert.sameValue(getReport(), "timed-out");
|
||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -8,30 +8,30 @@ description: >
|
|||||||
includes: [atomicsHelper.js]
|
includes: [atomicsHelper.js]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab, id) {
|
$262.agent.receiveBroadcast(function (sab, id) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
var then = Date.now();
|
var then = Date.now();
|
||||||
Atomics.wait(ia, 0, 0);
|
Atomics.wait(ia, 0, 0);
|
||||||
var diff = Date.now() - then; // Should be about 1000 ms
|
var diff = Date.now() - then; // Should be about 1000 ms
|
||||||
$.agent.report(diff);
|
$262.agent.report(diff);
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agent a chance to wait
|
$262.agent.sleep(500); // Give the agent a chance to wait
|
||||||
Atomics.store(ia, 0, 1); // Change the value, should not wake the agent
|
Atomics.store(ia, 0, 1); // Change the value, should not wake the agent
|
||||||
$.agent.sleep(500); // Wait some more so that we can tell
|
$262.agent.sleep(500); // Wait some more so that we can tell
|
||||||
Atomics.wake(ia, 0); // Really wake it up
|
Atomics.wake(ia, 0); // Really wake it up
|
||||||
assert.sameValue(Math.abs((getReport()|0) - 1000) < $ATOMICS_MAX_TIME_EPSILON, true);
|
assert.sameValue(Math.abs((getReport()|0) - 1000) < $ATOMICS_MAX_TIME_EPSILON, true);
|
||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -6,26 +6,26 @@ description: >
|
|||||||
Test that Atomics.wait returns the right result when it was awoken.
|
Test that Atomics.wait returns the right result when it was awoken.
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab, id) {
|
$262.agent.receiveBroadcast(function (sab, id) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0)); // No timeout => Infinity
|
$262.agent.report(Atomics.wait(ia, 0, 0)); // No timeout => Infinity
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agent a chance to wait
|
$262.agent.sleep(500); // Give the agent a chance to wait
|
||||||
Atomics.wake(ia, 0);
|
Atomics.wake(ia, 0);
|
||||||
assert.sameValue(getReport(), "ok");
|
assert.sameValue(getReport(), "ok");
|
||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,29 +8,29 @@ description: >
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
for ( var i=0 ; i < 3 ; i++ ) {
|
for ( var i=0 ; i < 3 ; i++ ) {
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report("A " + Atomics.wait(ia, 0, 0));
|
$262.agent.report("A " + Atomics.wait(ia, 0, 0));
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report("B " + Atomics.wait(ia, 1, 0, 1000)); // We will timeout eventually
|
$262.agent.report("B " + Atomics.wait(ia, 1, 0, 1000)); // We will timeout eventually
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(2*Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(2*Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agents a chance to wait
|
$262.agent.sleep(500); // Give the agents a chance to wait
|
||||||
assert.sameValue(Atomics.wake(ia, 0), 3); // Wake all on location 0
|
assert.sameValue(Atomics.wake(ia, 0), 3); // Wake all on location 0
|
||||||
var rs = [getReport(), getReport(), getReport(), getReport()];
|
var rs = [getReport(), getReport(), getReport(), getReport()];
|
||||||
// Do not sort the array -- B should timeout much after the others are woken
|
// Do not sort the array -- B should timeout much after the others are woken
|
||||||
@ -41,7 +41,7 @@ assert.sameValue(rs[3], "B timed-out");
|
|||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -7,20 +7,20 @@ description: >
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
for ( var i=0 ; i < 3 ; i++ ) {
|
for ( var i=0 ; i < 3 ; i++ ) {
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We may timeout eventually
|
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We may timeout eventually
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agents a chance to wait
|
$262.agent.sleep(500); // Give the agents a chance to wait
|
||||||
assert.sameValue(Atomics.wake(ia, 0), 3); // Wake all
|
assert.sameValue(Atomics.wake(ia, 0), 3); // Wake all
|
||||||
var rs = [getReport(), getReport(), getReport()];
|
var rs = [getReport(), getReport(), getReport()];
|
||||||
rs.sort();
|
rs.sort();
|
||||||
@ -30,7 +30,7 @@ assert.sameValue(rs[2], "ok");
|
|||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -11,24 +11,24 @@ description: >
|
|||||||
// one by one and observe the wakeup order.
|
// one by one and observe the wakeup order.
|
||||||
|
|
||||||
for ( var i=0 ; i < 3 ; i++ ) {
|
for ( var i=0 ; i < 3 ; i++ ) {
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
while (Atomics.load(ia, ${i+1}) == 0);
|
while (Atomics.load(ia, ${i+1}) == 0);
|
||||||
$.agent.report(${i} + Atomics.wait(ia, 0, 0));
|
$262.agent.report(${i} + Atomics.wait(ia, 0, 0));
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT*4));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT*4));
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
|
|
||||||
// Make them sleep in order 0 1 2 on ia[0]
|
// Make them sleep in order 0 1 2 on ia[0]
|
||||||
for ( var i=0 ; i < 3 ; i++ ) {
|
for ( var i=0 ; i < 3 ; i++ ) {
|
||||||
Atomics.store(ia, i+1, 1);
|
Atomics.store(ia, i+1, 1);
|
||||||
$.agent.sleep(500);
|
$262.agent.sleep(500);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wake them up one at a time and check the order is 0 1 2
|
// Wake them up one at a time and check the order is 0 1 2
|
||||||
@ -39,8 +39,8 @@ for ( var i=0 ; i < 3 ; i++ ) {
|
|||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,25 +6,25 @@ description: >
|
|||||||
Test that Atomics.wake wakes zero waiters if the count is NaN
|
Test that Atomics.wake wakes zero waiters if the count is NaN
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We will timeout eventually
|
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We will timeout eventually
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agent a chance to wait
|
$262.agent.sleep(500); // Give the agent a chance to wait
|
||||||
assert.sameValue(Atomics.wake(ia, 0, NaN), 0); // Don't actually wake it
|
assert.sameValue(Atomics.wake(ia, 0, NaN), 0); // Don't actually wake it
|
||||||
assert.sameValue(getReport(), "timed-out");
|
assert.sameValue(getReport(), "timed-out");
|
||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -6,25 +6,25 @@ description: >
|
|||||||
Test that Atomics.wake wakes zero waiters if the count is negative
|
Test that Atomics.wake wakes zero waiters if the count is negative
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We will timeout eventually
|
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We will timeout eventually
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agent a chance to wait
|
$262.agent.sleep(500); // Give the agent a chance to wait
|
||||||
assert.sameValue(Atomics.wake(ia, 0, -1), 0); // Don't actually wake it
|
assert.sameValue(Atomics.wake(ia, 0, -1), 0); // Don't actually wake it
|
||||||
assert.sameValue(getReport(), "timed-out");
|
assert.sameValue(getReport(), "timed-out");
|
||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -6,28 +6,28 @@ description: >
|
|||||||
Test that Atomics.wake wakes one waiter if that's what the count is.
|
Test that Atomics.wake wakes one waiter if that's what the count is.
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We may timeout eventually
|
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We may timeout eventually
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We may timeout eventually
|
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We may timeout eventually
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agents a chance to wait
|
$262.agent.sleep(500); // Give the agents a chance to wait
|
||||||
assert.sameValue(Atomics.wake(ia, 0, 1), 1); // Wake one
|
assert.sameValue(Atomics.wake(ia, 0, 1), 1); // Wake one
|
||||||
var rs = [getReport(), getReport()];
|
var rs = [getReport(), getReport()];
|
||||||
rs.sort();
|
rs.sort();
|
||||||
@ -36,7 +36,7 @@ assert.sameValue(rs[1], "timed-out");
|
|||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -7,20 +7,20 @@ description: >
|
|||||||
---*/
|
---*/
|
||||||
|
|
||||||
for ( var i=0 ; i < 3 ; i++ ) {
|
for ( var i=0 ; i < 3 ; i++ ) {
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We may timeout eventually
|
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We may timeout eventually
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agents a chance to wait
|
$262.agent.sleep(500); // Give the agents a chance to wait
|
||||||
assert.sameValue(Atomics.wake(ia, 0, 2), 2); // Wake two
|
assert.sameValue(Atomics.wake(ia, 0, 2), 2); // Wake two
|
||||||
var rs = [getReport(), getReport(), getReport()];
|
var rs = [getReport(), getReport(), getReport()];
|
||||||
rs.sort();
|
rs.sort();
|
||||||
@ -30,7 +30,7 @@ assert.sameValue(rs[2], "timed-out");
|
|||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -6,25 +6,25 @@ description: >
|
|||||||
Test that Atomics.wake wakes zero waiters if that's what the count is.
|
Test that Atomics.wake wakes zero waiters if that's what the count is.
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
$.agent.start(
|
$262.agent.start(
|
||||||
`
|
`
|
||||||
$.agent.receiveBroadcast(function (sab) {
|
$262.agent.receiveBroadcast(function (sab) {
|
||||||
var ia = new Int32Array(sab);
|
var ia = new Int32Array(sab);
|
||||||
$.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We will timeout eventually
|
$262.agent.report(Atomics.wait(ia, 0, 0, 1000)); // We will timeout eventually
|
||||||
$.agent.leaving();
|
$262.agent.leaving();
|
||||||
})
|
})
|
||||||
`);
|
`);
|
||||||
|
|
||||||
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
var ia = new Int32Array(new SharedArrayBuffer(Int32Array.BYTES_PER_ELEMENT));
|
||||||
|
|
||||||
$.agent.broadcast(ia.buffer);
|
$262.agent.broadcast(ia.buffer);
|
||||||
$.agent.sleep(500); // Give the agent a chance to wait
|
$262.agent.sleep(500); // Give the agent a chance to wait
|
||||||
assert.sameValue(Atomics.wake(ia, 0, 0), 0); // Don't actually wake it
|
assert.sameValue(Atomics.wake(ia, 0, 0), 0); // Don't actually wake it
|
||||||
assert.sameValue(getReport(), "timed-out");
|
assert.sameValue(getReport(), "timed-out");
|
||||||
|
|
||||||
function getReport() {
|
function getReport() {
|
||||||
var r;
|
var r;
|
||||||
while ((r = $.agent.getReport()) == null)
|
while ((r = $262.agent.getReport()) == null)
|
||||||
$.agent.sleep(100);
|
$262.agent.sleep(100);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ info: |
|
|||||||
features: [Reflect, SharedArrayBuffer]
|
features: [Reflect, SharedArrayBuffer]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var other = $.createRealm().global;
|
var other = $262.createRealm().global;
|
||||||
var C = new other.Function();
|
var C = new other.Function();
|
||||||
C.prototype = null;
|
C.prototype = null;
|
||||||
var buffer = new SharedArrayBuffer(0);
|
var buffer = new SharedArrayBuffer(0);
|
||||||
|
@ -20,7 +20,7 @@ info: |
|
|||||||
features: [Reflect]
|
features: [Reflect]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var other = $.createRealm().global;
|
var other = $262.createRealm().global;
|
||||||
var C = new other.Function();
|
var C = new other.Function();
|
||||||
C.prototype = null;
|
C.prototype = null;
|
||||||
|
|
||||||
|
@ -28,7 +28,7 @@ features: [SharedArrayBuffer]
|
|||||||
features: [Reflect]
|
features: [Reflect]
|
||||||
---*/
|
---*/
|
||||||
|
|
||||||
var other = $.createRealm().global;
|
var other = $262.createRealm().global;
|
||||||
var C = new other.Function();
|
var C = new other.Function();
|
||||||
C.prototype = null;
|
C.prototype = null;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user