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

Side by Side Diff: test/mjsunit/asm/atomics-store.js

Issue 1318713007: [Atomics] Remove support for atomic accesses on floating-point values. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: feedback Created 5 years, 3 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
« no previous file with comments | « test/mjsunit/asm/atomics-load.js ('k') | test/mjsunit/harmony/atomics.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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: --harmony-sharedarraybuffer 5 // Flags: --harmony-sharedarraybuffer
6 6
7 function Module(stdlib, foreign, heap) { 7 function Module(stdlib, foreign, heap) {
8 "use asm"; 8 "use asm";
9 var MEM8 = new stdlib.Int8Array(heap); 9 var MEM8 = new stdlib.Int8Array(heap);
10 var MEM16 = new stdlib.Int16Array(heap); 10 var MEM16 = new stdlib.Int16Array(heap);
11 var MEM32 = new stdlib.Int32Array(heap); 11 var MEM32 = new stdlib.Int32Array(heap);
12 var MEMU8 = new stdlib.Uint8Array(heap); 12 var MEMU8 = new stdlib.Uint8Array(heap);
13 var MEMU16 = new stdlib.Uint16Array(heap); 13 var MEMU16 = new stdlib.Uint16Array(heap);
14 var MEMU32 = new stdlib.Uint32Array(heap); 14 var MEMU32 = new stdlib.Uint32Array(heap);
15 var MEMF32 = new stdlib.Float32Array(heap);
16 var MEMF64 = new stdlib.Float64Array(heap);
17 var store = stdlib.Atomics.store; 15 var store = stdlib.Atomics.store;
18 var fround = stdlib.Math.fround; 16 var fround = stdlib.Math.fround;
19 17
20 function storei8(i, x) { 18 function storei8(i, x) {
21 i = i | 0; 19 i = i | 0;
22 x = x | 0; 20 x = x | 0;
23 return store(MEM8, i, x)|0; 21 return store(MEM8, i, x)|0;
24 } 22 }
25 23
26 function storei16(i, x) { 24 function storei16(i, x) {
(...skipping 19 matching lines...) Expand all
46 x = x >>> 0; 44 x = x >>> 0;
47 return store(MEMU16, i, x)>>>0; 45 return store(MEMU16, i, x)>>>0;
48 } 46 }
49 47
50 function storeu32(i, x) { 48 function storeu32(i, x) {
51 i = i | 0; 49 i = i | 0;
52 x = x >>> 0; 50 x = x >>> 0;
53 return store(MEMU32, i, x)>>>0; 51 return store(MEMU32, i, x)>>>0;
54 } 52 }
55 53
56 function storef32(i, x) {
57 i = i | 0;
58 x = fround(x);
59 return fround(store(MEMF32, i, x));
60 }
61
62 function storef64(i, x) {
63 i = i | 0;
64 x = +x;
65 return +store(MEMF64, i, x);
66 }
67
68 return { 54 return {
69 storei8: storei8, 55 storei8: storei8,
70 storei16: storei16, 56 storei16: storei16,
71 storei32: storei32, 57 storei32: storei32,
72 storeu8: storeu8, 58 storeu8: storeu8,
73 storeu16: storeu16, 59 storeu16: storeu16,
74 storeu32: storeu32, 60 storeu32: storeu32,
75 storef32: storef32,
76 storef64: storef64
77 }; 61 };
78 } 62 }
79 63
80 var sab = new SharedArrayBuffer(16); 64 var sab = new SharedArrayBuffer(16);
81 var m = Module(this, {}, sab); 65 var m = Module(this, {}, sab);
82 66
83 function clearArray() { 67 function clearArray() {
84 var ui8 = new Uint8Array(sab); 68 var ui8 = new Uint8Array(sab);
85 for (var i = 0; i < sab.byteLength; ++i) { 69 for (var i = 0; i < sab.byteLength; ++i) {
86 ui8[i] = 0; 70 ui8[i] = 0;
(...skipping 11 matching lines...) Expand all
98 assertEquals(oobValue, f(-1, 0), name); 82 assertEquals(oobValue, f(-1, 0), name);
99 assertEquals(oobValue, f(ta.length, 0), name); 83 assertEquals(oobValue, f(ta.length, 0), name);
100 } 84 }
101 85
102 testElementType(Int8Array, m.storei8, 0); 86 testElementType(Int8Array, m.storei8, 0);
103 testElementType(Int16Array, m.storei16, 0); 87 testElementType(Int16Array, m.storei16, 0);
104 testElementType(Int32Array, m.storei32, 0); 88 testElementType(Int32Array, m.storei32, 0);
105 testElementType(Uint8Array, m.storeu8, 0); 89 testElementType(Uint8Array, m.storeu8, 0);
106 testElementType(Uint16Array, m.storeu16, 0); 90 testElementType(Uint16Array, m.storeu16, 0);
107 testElementType(Uint32Array, m.storeu32, 0); 91 testElementType(Uint32Array, m.storeu32, 0);
108 testElementType(Float32Array, m.storef32, NaN);
109 testElementType(Float64Array, m.storef64, NaN);
OLDNEW
« no previous file with comments | « test/mjsunit/asm/atomics-load.js ('k') | test/mjsunit/harmony/atomics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698