OLD | NEW |
1 // Copyright 2015 the V8 project authors. All rights reserved. | 1 // Copyright 2015 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Flags: --allow-natives-syntax --harmony-sharedarraybuffer | 5 // Flags: --allow-natives-syntax --harmony-sharedarraybuffer |
6 | 6 |
7 (function TestFailsWithNonSharedArray() { | 7 (function TestFailsWithNonSharedArray() { |
8 var ab = new ArrayBuffer(16); | 8 var ab = new ArrayBuffer(16); |
9 | 9 |
10 var i8a = new Int8Array(ab); | 10 var i8a = new Int8Array(ab); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 | 97 |
98 (function TestWaitNotAllowed() { | 98 (function TestWaitNotAllowed() { |
99 %SetAllowAtomicsWait(false); | 99 %SetAllowAtomicsWait(false); |
100 var i32a = new Int32Array(new SharedArrayBuffer(16)); | 100 var i32a = new Int32Array(new SharedArrayBuffer(16)); |
101 assertThrows(function() { | 101 assertThrows(function() { |
102 Atomics.wait(i32a, 0, 0, -1); | 102 Atomics.wait(i32a, 0, 0, -1); |
103 }); | 103 }); |
104 %SetAllowAtomicsWait(true); | 104 %SetAllowAtomicsWait(true); |
105 })(); | 105 })(); |
106 | 106 |
| 107 (function TestWakePositiveInfinity() { |
| 108 var i32a = new Int32Array(new SharedArrayBuffer(16)); |
| 109 Atomics.wake(i32a, 0, Number.POSITIVE_INFINITY); |
| 110 })(); |
| 111 |
107 //// WORKER ONLY TESTS | 112 //// WORKER ONLY TESTS |
108 | 113 |
109 if (this.Worker) { | 114 if (this.Worker) { |
110 | 115 |
111 var TestWaitWithTimeout = function(timeout) { | 116 var TestWaitWithTimeout = function(timeout) { |
112 var sab = new SharedArrayBuffer(16); | 117 var sab = new SharedArrayBuffer(16); |
113 var i32a = new Int32Array(sab); | 118 var i32a = new Int32Array(sab); |
114 | 119 |
115 var workerScript = | 120 var workerScript = |
116 `onmessage = function(msg) { | 121 `onmessage = function(msg) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 // Finally wake the last waiter. | 226 // Finally wake the last waiter. |
222 assertEquals(1, Atomics.wake(i32a, 4, 1)); | 227 assertEquals(1, Atomics.wake(i32a, 4, 1)); |
223 assertEquals("ok", workers[waitingId].getMessage()); | 228 assertEquals("ok", workers[waitingId].getMessage()); |
224 workers[waitingId].terminate(); | 229 workers[waitingId].terminate(); |
225 | 230 |
226 assertEquals(0, %AtomicsNumWaitersForTesting(i32a, 4)); | 231 assertEquals(0, %AtomicsNumWaitersForTesting(i32a, 4)); |
227 | 232 |
228 })(); | 233 })(); |
229 | 234 |
230 } | 235 } |
OLD | NEW |