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

Side by Side Diff: test/mjsunit/harmony/atomics-value-check.js

Issue 2799863002: [Atomics] use TFJ builtins for atomic add, sub, and, or, and xor (Closed)
Patch Set: [Atomics] use TFJ builtins for atomic add, sub, and, or, and xor Created 3 years, 8 months 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
OLDNEW
(Empty)
1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 // Flags: --harmony-sharedarraybuffer
6 //
7
8 var sab = new SharedArrayBuffer(4);
9 var sta = new Int8Array(sab);
10 sta[0] = 5;
11 var workerScript =
12 `onmessage=function(msg) {
13 postMessage(0);
14 };`;
15 var worker = new Worker(workerScript);
16
17 var value_obj = {
18 valueOf: function() {worker.postMessage({sab:sab}, [sta.buffer]);
19 return 5}
20 }
21 var value = Object.create(value_obj);
22
23 assertThrows(function() {Atomics.exchange(sta, 0, value)});
24 assertThrows(function() {Atomics.compareExchange(sta, 0, 5, value)});
25 assertThrows(function() {Atomics.compareExchange(sta, 0, value, 5)});
26 assertThrows(function() {Atomics.add(sta, 0, value)});
27 assertThrows(function() {Atomics.sub(sta, 0, value)});
28 assertThrows(function() {Atomics.and(sta, 0, value)});
29 assertThrows(function() {Atomics.or(sta, 0, value)});
30 assertThrows(function() {Atomics.xor(sta, 0, value)});
31
32 var index_obj = {
33 valueOf: function() {worker.postMessage({sab:sab}, [sta.buffer]);
34 return 0}
35 }
36 var index = Object.create(index_obj);
37
38 assertThrows(function() {Atomics.exchange(sta, index, 1)});
39 assertThrows(function() {Atomics.compareExchange(sta, index, 5, 2)});
40 assertThrows(function() {Atomics.add(sta, index, 3)});
41 assertThrows(function() {Atomics.sub(sta, index, 4)});
42 assertThrows(function() {Atomics.and(sta, index, 5)});
43 assertThrows(function() {Atomics.or(sta, index, 6)});
44 assertThrows(function() {Atomics.xor(sta, index, 7)});
OLDNEW
« src/builtins/builtins-sharedarraybuffer-gen.cc ('K') | « src/runtime/runtime-atomics.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698