Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(975)

Side by Side Diff: test/mjsunit/harmony/atomics.js

Issue 1422533009: Support SAB atomics for offset-TypedArray (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: add a test case Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « test/mjsunit/asm/atomics-xor.js ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 the V8 project authors. All rights reserved. 1 // Copyright 2014 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: --harmony-sharedarraybuffer 5 // Flags: --harmony-sharedarraybuffer
6 // 6 //
7 7
8 function toRangeWrapped(value) { 8 function toRangeWrapped(value) {
9 var range = this.max - this.min + 1; 9 var range = this.max - this.min + 1;
10 while (value < this.min) { 10 while (value < this.min) {
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 for (var i = 0; i < ia.length; ++i) { 71 for (var i = 0; i < ia.length; ++i) {
72 if (i == expectedIndex) continue; 72 if (i == expectedIndex) continue;
73 assertEquals(22, ia[i], name); 73 assertEquals(22, ia[i], name);
74 } 74 }
75 } 75 }
76 76
77 (function TestBadIndex() { 77 (function TestBadIndex() {
78 var sab = new SharedArrayBuffer(8); 78 var sab = new SharedArrayBuffer(8);
79 var si32a = new Int32Array(sab); 79 var si32a = new Int32Array(sab);
80 var si32a2 = new Int32Array(sab, 4);
80 81
81 // Non-integer indexes are converted to an integer first, so they should all 82 // Non-integer indexes are converted to an integer first, so they should all
82 // operate on index 0. 83 // operate on index 0.
83 [undefined, null, false, 'hi', {}].forEach(function(i) { 84 [undefined, null, false, 'hi', {}].forEach(function(i) {
85
84 var name = String(i); 86 var name = String(i);
85
86 testAtomicOp(Atomics.compareExchange, si32a, i, 0, name); 87 testAtomicOp(Atomics.compareExchange, si32a, i, 0, name);
87 testAtomicOp(Atomics.load, si32a, i, 0, name); 88 testAtomicOp(Atomics.load, si32a, i, 0, name);
88 testAtomicOp(Atomics.store, si32a, i, 0, name); 89 testAtomicOp(Atomics.store, si32a, i, 0, name);
89 testAtomicOp(Atomics.add, si32a, i, 0, name); 90 testAtomicOp(Atomics.add, si32a, i, 0, name);
90 testAtomicOp(Atomics.sub, si32a, i, 0, name); 91 testAtomicOp(Atomics.sub, si32a, i, 0, name);
91 testAtomicOp(Atomics.and, si32a, i, 0, name); 92 testAtomicOp(Atomics.and, si32a, i, 0, name);
92 testAtomicOp(Atomics.or, si32a, i, 0, name); 93 testAtomicOp(Atomics.or, si32a, i, 0, name);
93 testAtomicOp(Atomics.xor, si32a, i, 0, name); 94 testAtomicOp(Atomics.xor, si32a, i, 0, name);
94 testAtomicOp(Atomics.exchange, si32a, i, 0, name); 95 testAtomicOp(Atomics.exchange, si32a, i, 0, name);
95 }); 96 });
96 97
97 // Out-of-bounds indexes should return undefined. 98 // Out-of-bounds indexes should return undefined.
98 // TODO(binji): Should these throw RangeError instead? 99 // TODO(binji): Should these throw RangeError instead?
99 [-1, 2, 100].forEach(function(i) { 100 [-1, 2, 100].forEach(function(i) {
100 var name = String(i); 101 var name = String(i);
101 assertEquals(undefined, Atomics.compareExchange(si32a, i, 0, 0), name); 102 assertEquals(undefined, Atomics.compareExchange(si32a, i, 0, 0), name);
102 assertEquals(undefined, Atomics.load(si32a, i), name); 103 assertEquals(undefined, Atomics.load(si32a, i), name);
103 assertEquals(undefined, Atomics.store(si32a, i, 0), name); 104 assertEquals(undefined, Atomics.store(si32a, i, 0), name);
104 assertEquals(undefined, Atomics.add(si32a, i, 0), name); 105 assertEquals(undefined, Atomics.add(si32a, i, 0), name);
105 assertEquals(undefined, Atomics.sub(si32a, i, 0), name); 106 assertEquals(undefined, Atomics.sub(si32a, i, 0), name);
106 assertEquals(undefined, Atomics.and(si32a, i, 0), name); 107 assertEquals(undefined, Atomics.and(si32a, i, 0), name);
107 assertEquals(undefined, Atomics.or(si32a, i, 0), name); 108 assertEquals(undefined, Atomics.or(si32a, i, 0), name);
108 assertEquals(undefined, Atomics.xor(si32a, i, 0), name); 109 assertEquals(undefined, Atomics.xor(si32a, i, 0), name);
109 assertEquals(undefined, Atomics.exchange(si32a, i, 0), name); 110 assertEquals(undefined, Atomics.exchange(si32a, i, 0), name);
110 }); 111 });
111 112
113 // Out-of-bounds indexes for offset-array
114 [-1, 1, 100].forEach(function(i) {
115 var name = String(i);
116 assertEquals(undefined, Atomics.compareExchange(si32a2, i, 0, 0), name);
117 assertEquals(undefined, Atomics.load(si32a2, i), name);
118 assertEquals(undefined, Atomics.store(si32a2, i, 0), name);
119 assertEquals(undefined, Atomics.add(si32a2, i, 0), name);
120 assertEquals(undefined, Atomics.sub(si32a2, i, 0), name);
121 assertEquals(undefined, Atomics.and(si32a2, i, 0), name);
122 assertEquals(undefined, Atomics.or(si32a2, i, 0), name);
123 assertEquals(undefined, Atomics.xor(si32a2, i, 0), name);
124 assertEquals(undefined, Atomics.exchange(si32a2, i, 0), name);
125 });
126
112 // Monkey-patch length and make sure these functions still return undefined. 127 // Monkey-patch length and make sure these functions still return undefined.
113 Object.defineProperty(si32a, 'length', {get: function() { return 1000; }}); 128 Object.defineProperty(si32a, 'length', {get: function() { return 1000; }});
114 [2, 100].forEach(function(i) { 129 [2, 100].forEach(function(i) {
115 var name = String(i); 130 var name = String(i);
116 assertEquals(undefined, Atomics.compareExchange(si32a, i, 0, 0), name); 131 assertEquals(undefined, Atomics.compareExchange(si32a, i, 0, 0), name);
117 assertEquals(undefined, Atomics.load(si32a, i), name); 132 assertEquals(undefined, Atomics.load(si32a, i), name);
118 assertEquals(undefined, Atomics.store(si32a, i, 0), name); 133 assertEquals(undefined, Atomics.store(si32a, i, 0), name);
119 assertEquals(undefined, Atomics.add(si32a, i, 0), name); 134 assertEquals(undefined, Atomics.add(si32a, i, 0), name);
120 assertEquals(undefined, Atomics.sub(si32a, i, 0), name); 135 assertEquals(undefined, Atomics.sub(si32a, i, 0), name);
121 assertEquals(undefined, Atomics.and(si32a, i, 0), name); 136 assertEquals(undefined, Atomics.and(si32a, i, 0), name);
122 assertEquals(undefined, Atomics.or(si32a, i, 0), name); 137 assertEquals(undefined, Atomics.or(si32a, i, 0), name);
123 assertEquals(undefined, Atomics.xor(si32a, i, 0), name); 138 assertEquals(undefined, Atomics.xor(si32a, i, 0), name);
124 assertEquals(undefined, Atomics.exchange(si32a, i, 0), name); 139 assertEquals(undefined, Atomics.exchange(si32a, i, 0), name);
125 }); 140 });
126 })(); 141 })();
127 142
128 (function TestGoodIndex() { 143 (function TestGoodIndex() {
129 var sab = new SharedArrayBuffer(64); 144 var sab = new SharedArrayBuffer(64);
130 var si32a = new Int32Array(sab); 145 var si32a = new Int32Array(sab);
146 var si32a2 = new Int32Array(sab, 32);
131 147
132 var valueOf = {valueOf: function(){ return 3;}}; 148 var valueOf = {valueOf: function(){ return 3;}};
133 var toString = {toString: function(){ return '3';}}; 149 var toString = {toString: function(){ return '3';}};
134 150
135 [3, 3.5, '3', '3.5', valueOf, toString].forEach(function(i) { 151 [3, 3.5, '3', '3.5', valueOf, toString].forEach(function(i) {
136 var name = String(i); 152 var name = String(i);
137 153 [si32a, si32a2].forEach(function(array) {
138 testAtomicOp(Atomics.compareExchange, si32a, i, 3, name); 154 testAtomicOp(Atomics.compareExchange, array, i, 3, name);
139 testAtomicOp(Atomics.load, si32a, i, 3, name); 155 testAtomicOp(Atomics.load, array, i, 3, name);
140 testAtomicOp(Atomics.store, si32a, i, 3, name); 156 testAtomicOp(Atomics.store, array, i, 3, name);
141 testAtomicOp(Atomics.add, si32a, i, 3, name); 157 testAtomicOp(Atomics.add, array, i, 3, name);
142 testAtomicOp(Atomics.sub, si32a, i, 3, name); 158 testAtomicOp(Atomics.sub, array, i, 3, name);
143 testAtomicOp(Atomics.and, si32a, i, 3, name); 159 testAtomicOp(Atomics.and, array, i, 3, name);
144 testAtomicOp(Atomics.or, si32a, i, 3, name); 160 testAtomicOp(Atomics.or, array, i, 3, name);
145 testAtomicOp(Atomics.xor, si32a, i, 3, name); 161 testAtomicOp(Atomics.xor, array, i, 3, name);
146 testAtomicOp(Atomics.exchange, si32a, i, 3, name); 162 testAtomicOp(Atomics.exchange, array, i, 3, name);
163 })
147 }); 164 });
148 })(); 165 })();
149 166
167 function clearArray(sab) {
168 var ui8 = new Uint8Array(sab);
169 for (var i = 0; i < sab.byteLength; ++i) {
170 ui8[i] = 0;
171 }
172 }
173
150 (function TestCompareExchange() { 174 (function TestCompareExchange() {
151 IntegerTypedArrayConstructors.forEach(function(t) { 175 IntegerTypedArrayConstructors.forEach(function(t) {
152 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 176 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
153 var sta = new t.constr(sab); 177 var sta = new t.constr(sab);
154 var name = Object.prototype.toString.call(sta); 178 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
155 for (var i = 0; i < 10; ++i) {
156 // sta[i] == 0, CAS will store
157 assertEquals(0, Atomics.compareExchange(sta, i, 0, 50), name);
158 assertEquals(50, sta[i], name);
159 179
160 // sta[i] == 50, CAS will not store 180 [sta, sta2].forEach(function(array) {
161 assertEquals(50, Atomics.compareExchange(sta, i, 0, 100), name); 181 clearArray(array.buffer);
162 assertEquals(50, sta[i], name); 182 var name = Object.prototype.toString.call(array);
163 } 183 for (var i = 0; i < array.length; ++i) {
184 // array[i] == 0, CAS will store
185 assertEquals(0, Atomics.compareExchange(array, i, 0, 50), name);
186 assertEquals(50, array[i], name);
187
188 // array[i] == 50, CAS will not store
189 assertEquals(50, Atomics.compareExchange(array, i, 0, 100), name);
190 assertEquals(50, array[i], name);
191 }
192 })
164 }); 193 });
165 })(); 194 })();
166 195
167 (function TestLoad() { 196 (function TestLoad() {
168 IntegerTypedArrayConstructors.forEach(function(t) { 197 IntegerTypedArrayConstructors.forEach(function(t) {
169 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 198 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
170 var sta = new t.constr(sab); 199 var sta = new t.constr(sab);
171 var name = Object.prototype.toString.call(sta); 200 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
172 for (var i = 0; i < 10; ++i) { 201
173 sta[i] = 0; 202 [sta, sta2].forEach(function(array) {
174 assertEquals(0, Atomics.load(sta, i), name); 203 clearArray(array.buffer);
175 sta[i] = 50; 204 var name = Object.prototype.toString.call(array);
176 assertEquals(50, Atomics.load(sta, i), name); 205 for (var i = 0; i < array.length; ++i) {
177 } 206 array[i] = 0;
207 assertEquals(0, Atomics.load(array, i), name);
208 array[i] = 50;
209 assertEquals(50, Atomics.load(array, i), name);
210 }
211 })
178 }); 212 });
179 })(); 213 })();
180 214
181 (function TestStore() { 215 (function TestStore() {
182 IntegerTypedArrayConstructors.forEach(function(t) { 216 IntegerTypedArrayConstructors.forEach(function(t) {
183 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 217 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
184 var sta = new t.constr(sab); 218 var sta = new t.constr(sab);
185 var name = Object.prototype.toString.call(sta); 219 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
186 for (var i = 0; i < 10; ++i) {
187 assertEquals(50, Atomics.store(sta, i, 50), name);
188 assertEquals(50, sta[i], name);
189 220
190 assertEquals(100, Atomics.store(sta, i, 100), name); 221 [sta, sta2].forEach(function(array) {
191 assertEquals(100, sta[i], name); 222 clearArray(array.buffer);
192 } 223 var name = Object.prototype.toString.call(array);
224 for (var i = 0; i < array.length; ++i) {
225 assertEquals(50, Atomics.store(array, i, 50), name);
226 assertEquals(50, array[i], name);
227
228 assertEquals(100, Atomics.store(array, i, 100), name);
229 assertEquals(100, array[i], name);
230 }
231 })
193 }); 232 });
194 })(); 233 })();
195 234
196 (function TestAdd() { 235 (function TestAdd() {
197 IntegerTypedArrayConstructors.forEach(function(t) { 236 IntegerTypedArrayConstructors.forEach(function(t) {
198 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 237 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
199 var sta = new t.constr(sab); 238 var sta = new t.constr(sab);
200 var name = Object.prototype.toString.call(sta); 239 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
201 for (var i = 0; i < 10; ++i) {
202 assertEquals(0, Atomics.add(sta, i, 50), name);
203 assertEquals(50, sta[i], name);
204 240
205 assertEquals(50, Atomics.add(sta, i, 70), name); 241 [sta, sta2].forEach(function(array) {
206 assertEquals(120, sta[i], name); 242 clearArray(array.buffer);
207 } 243 var name = Object.prototype.toString.call(array);
244 for (var i = 0; i < array.length; ++i) {
245 assertEquals(0, Atomics.add(array, i, 50), name);
246 assertEquals(50, array[i], name);
247
248 assertEquals(50, Atomics.add(array, i, 70), name);
249 assertEquals(120, array[i], name);
250 }
251 })
208 }); 252 });
209 })(); 253 })();
210 254
211 (function TestSub() { 255 (function TestSub() {
212 IntegerTypedArrayConstructors.forEach(function(t) { 256 IntegerTypedArrayConstructors.forEach(function(t) {
213 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 257 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
214 var sta = new t.constr(sab); 258 var sta = new t.constr(sab);
215 var name = Object.prototype.toString.call(sta); 259 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
216 for (var i = 0; i < 10; ++i) {
217 sta[i] = 120;
218 assertEquals(120, Atomics.sub(sta, i, 50), name);
219 assertEquals(70, sta[i], name);
220 260
221 assertEquals(70, Atomics.sub(sta, i, 70), name); 261 [sta, sta2].forEach(function(array) {
222 assertEquals(0, sta[i], name); 262 clearArray(array.buffer);
223 } 263 var name = Object.prototype.toString.call(array);
264 for (var i = 0; i < array.length; ++i) {
265 array[i] = 120;
266 assertEquals(120, Atomics.sub(array, i, 50), name);
267 assertEquals(70, array[i], name);
268
269 assertEquals(70, Atomics.sub(array, i, 70), name);
270 assertEquals(0, array[i], name);
271 }
272 })
224 }); 273 });
225 })(); 274 })();
226 275
227 (function TestAnd() { 276 (function TestAnd() {
228 IntegerTypedArrayConstructors.forEach(function(t) { 277 IntegerTypedArrayConstructors.forEach(function(t) {
229 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 278 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
230 var sta = new t.constr(sab); 279 var sta = new t.constr(sab);
231 var name = Object.prototype.toString.call(sta); 280 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
232 for (var i = 0; i < 10; ++i) {
233 sta[i] = 0x3f;
234 assertEquals(0x3f, Atomics.and(sta, i, 0x30), name);
235 assertEquals(0x30, sta[i], name);
236 281
237 assertEquals(0x30, Atomics.and(sta, i, 0x20), name); 282 [sta, sta2].forEach(function(array) {
238 assertEquals(0x20, sta[i], name); 283 clearArray(array.buffer);
239 } 284 var name = Object.prototype.toString.call(sta);
285 for (var i = 0; i < array.length; ++i) {
286 array[i] = 0x3f;
287 assertEquals(0x3f, Atomics.and(array, i, 0x30), name);
288 assertEquals(0x30, array[i], name);
289
290 assertEquals(0x30, Atomics.and(array, i, 0x20), name);
291 assertEquals(0x20, array[i], name);
292 }
293 })
240 }); 294 });
241 })(); 295 })();
242 296
243 (function TestOr() { 297 (function TestOr() {
244 IntegerTypedArrayConstructors.forEach(function(t) { 298 IntegerTypedArrayConstructors.forEach(function(t) {
245 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 299 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
246 var sta = new t.constr(sab); 300 var sta = new t.constr(sab);
247 var name = Object.prototype.toString.call(sta); 301 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
248 for (var i = 0; i < 10; ++i) {
249 sta[i] = 0x30;
250 assertEquals(0x30, Atomics.or(sta, i, 0x1c), name);
251 assertEquals(0x3c, sta[i], name);
252 302
253 assertEquals(0x3c, Atomics.or(sta, i, 0x09), name); 303 [sta, sta2].forEach(function(array) {
254 assertEquals(0x3d, sta[i], name); 304 clearArray(array.buffer);
255 } 305 var name = Object.prototype.toString.call(array);
306 for (var i = 0; i < array.length; ++i) {
307 array[i] = 0x30;
308 assertEquals(0x30, Atomics.or(array, i, 0x1c), name);
309 assertEquals(0x3c, array[i], name);
310
311 assertEquals(0x3c, Atomics.or(array, i, 0x09), name);
312 assertEquals(0x3d, array[i], name);
313 }
314 })
256 }); 315 });
257 })(); 316 })();
258 317
259 (function TestXor() { 318 (function TestXor() {
260 IntegerTypedArrayConstructors.forEach(function(t) { 319 IntegerTypedArrayConstructors.forEach(function(t) {
261 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 320 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
262 var sta = new t.constr(sab); 321 var sta = new t.constr(sab);
263 var name = Object.prototype.toString.call(sta); 322 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
264 for (var i = 0; i < 10; ++i) {
265 sta[i] = 0x30;
266 assertEquals(0x30, Atomics.xor(sta, i, 0x1c), name);
267 assertEquals(0x2c, sta[i], name);
268 323
269 assertEquals(0x2c, Atomics.xor(sta, i, 0x09), name); 324 [sta, sta2].forEach(function(array) {
270 assertEquals(0x25, sta[i], name); 325 clearArray(array.buffer);
271 } 326 var name = Object.prototype.toString.call(array);
327 for (var i = 0; i < array.length; ++i) {
328 array[i] = 0x30;
329 assertEquals(0x30, Atomics.xor(array, i, 0x1c), name);
330 assertEquals(0x2c, array[i], name);
331
332 assertEquals(0x2c, Atomics.xor(array, i, 0x09), name);
333 assertEquals(0x25, array[i], name);
334 }
335 })
272 }); 336 });
273 })(); 337 })();
274 338
275 (function TestExchange() { 339 (function TestExchange() {
276 IntegerTypedArrayConstructors.forEach(function(t) { 340 IntegerTypedArrayConstructors.forEach(function(t) {
277 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT); 341 var sab = new SharedArrayBuffer(10 * t.constr.BYTES_PER_ELEMENT);
278 var sta = new t.constr(sab); 342 var sta = new t.constr(sab);
279 var name = Object.prototype.toString.call(sta); 343 var sta2 = new t.constr(sab, 5 * t.constr.BYTES_PER_ELEMENT);
280 for (var i = 0; i < 10; ++i) {
281 sta[i] = 0x30;
282 assertEquals(0x30, Atomics.exchange(sta, i, 0x1c), name);
283 assertEquals(0x1c, sta[i], name);
284 344
285 assertEquals(0x1c, Atomics.exchange(sta, i, 0x09), name); 345 [sta, sta2].forEach(function(array) {
286 assertEquals(0x09, sta[i], name); 346 clearArray(array.buffer);
287 } 347 var name = Object.prototype.toString.call(array);
348 for (var i = 0; i < array.length; ++i) {
349 array[i] = 0x30;
350 assertEquals(0x30, Atomics.exchange(array, i, 0x1c), name);
351 assertEquals(0x1c, array[i], name);
352
353 assertEquals(0x1c, Atomics.exchange(array, i, 0x09), name);
354 assertEquals(0x09, array[i], name);
355 }
356 })
288 }); 357 });
289 })(); 358 })();
290 359
291 (function TestIsLockFree() { 360 (function TestIsLockFree() {
292 // For all platforms we support, 1, 2 and 4 bytes should be lock-free. 361 // For all platforms we support, 1, 2 and 4 bytes should be lock-free.
293 assertEquals(true, Atomics.isLockFree(1)); 362 assertEquals(true, Atomics.isLockFree(1));
294 assertEquals(true, Atomics.isLockFree(2)); 363 assertEquals(true, Atomics.isLockFree(2));
295 assertEquals(true, Atomics.isLockFree(4)); 364 assertEquals(true, Atomics.isLockFree(4));
296 365
297 // Sizes that aren't equal to a typedarray BYTES_PER_ELEMENT always return 366 // Sizes that aren't equal to a typedarray BYTES_PER_ELEMENT always return
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 // Exchange 520 // Exchange
452 sta[0] = val = 0x12; 521 sta[0] = val = 0x12;
453 operand = 0x22 + offset; 522 operand = 0x22 + offset;
454 valWrapped = t.toRange(operand); 523 valWrapped = t.toRange(operand);
455 assertEquals(val, Atomics.exchange(sta, 0, operand), name); 524 assertEquals(val, Atomics.exchange(sta, 0, operand), name);
456 assertEquals(valWrapped, sta[0], name); 525 assertEquals(valWrapped, sta[0], name);
457 } 526 }
458 527
459 }); 528 });
460 })(); 529 })();
OLDNEW
« no previous file with comments | « test/mjsunit/asm/atomics-xor.js ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698