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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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() { | 107 (function TestWakePositiveInfinity() { |
108 var i32a = new Int32Array(new SharedArrayBuffer(16)); | 108 var i32a = new Int32Array(new SharedArrayBuffer(16)); |
109 Atomics.wake(i32a, 0, Number.POSITIVE_INFINITY); | 109 Atomics.wake(i32a, 0, Number.POSITIVE_INFINITY); |
110 })(); | 110 })(); |
111 | 111 |
| 112 // In a previous version, this test caused a check failure |
| 113 (function TestObjectWaitValue() { |
| 114 var sab = new SharedArrayBuffer(16); |
| 115 var i32a = new Int32Array(sab); |
| 116 assertEquals("timed-out", Atomics.wait(i32a, 0, Math, 0)); |
| 117 })(); |
| 118 |
| 119 |
112 //// WORKER ONLY TESTS | 120 //// WORKER ONLY TESTS |
113 | 121 |
114 if (this.Worker) { | 122 if (this.Worker) { |
115 | 123 |
116 var TestWaitWithTimeout = function(timeout) { | 124 var TestWaitWithTimeout = function(timeout) { |
117 var sab = new SharedArrayBuffer(16); | 125 var sab = new SharedArrayBuffer(16); |
118 var i32a = new Int32Array(sab); | 126 var i32a = new Int32Array(sab); |
119 | 127 |
120 var workerScript = | 128 var workerScript = |
121 `onmessage = function(msg) { | 129 `onmessage = function(msg) { |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
226 // Finally wake the last waiter. | 234 // Finally wake the last waiter. |
227 assertEquals(1, Atomics.wake(i32a, 4, 1)); | 235 assertEquals(1, Atomics.wake(i32a, 4, 1)); |
228 assertEquals("ok", workers[waitingId].getMessage()); | 236 assertEquals("ok", workers[waitingId].getMessage()); |
229 workers[waitingId].terminate(); | 237 workers[waitingId].terminate(); |
230 | 238 |
231 assertEquals(0, %AtomicsNumWaitersForTesting(i32a, 4)); | 239 assertEquals(0, %AtomicsNumWaitersForTesting(i32a, 4)); |
232 | 240 |
233 })(); | 241 })(); |
234 | 242 |
235 } | 243 } |
OLD | NEW |