Debian Codegraph @

js/src/jit-test/tests/atomics/pause-single.js

raw
1 // |jit-test| --enable-atomics-pause; skip-if: !Atomics.pause
2
3 // Call Atomics.pause with no arguments.
4 function noArguments() {
5 for (let i = 0; i < 1000; ++i) {
6 Atomics.pause();
7 }
8 }
9 for (let i = 0; i < 2; ++i) noArguments();
10
11 // Call Atomics.pause with the constant integer zero.
12 function zero() {
13 for (let i = 0; i < 1000; ++i) {
14 Atomics.pause(0);
15 }
16 }
17 for (let i = 0; i < 2; ++i) zero();
18
19 // Call Atomics.pause with an linear increasing integer.
20 function increasingLinear() {
21 for (let i = 0; i < 1000; ++i) {
22 Atomics.pause(i);
23 }
24 }
25 for (let i = 0; i < 2; ++i) increasingLinear();
26
27 // Call Atomics.pause with an linear decreasing integer.
28 function decreasingLinear() {
29 for (let i = 0; i < 1000; ++i) {
30 Atomics.pause(-i);
31 }
32 }
33 for (let i = 0; i < 2; ++i) decreasingLinear();
34
35 // Call Atomics.pause with an exponentially increasing integer.
36 function increasingExp() {
37 for (let i = 0; i < 1000; ++i) {
38 Atomics.pause(2 ** Math.min(i >> 1, 10));
39 }
40 }
41 for (let i = 0; i < 2; ++i) increasingExp();
42
43 // Call Atomics.pause with an exponentially decreasing integer.
44 function decreasingExp() {
45 for (let i = 0; i < 1000; ++i) {
46 Atomics.pause(-(2 ** Math.min(i >> 1, 10)));
47 }
48 }
49 for (let i = 0; i < 2; ++i) decreasingExp();