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

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

Issue 1676613002: [Atomics] Fix atomic access index validation (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: merge master Created 4 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
« no previous file with comments | « test/mjsunit/asm/atomics-sub.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, offset) { 7 function Module(stdlib, foreign, heap, offset) {
8 "use asm"; 8 "use asm";
9 var MEM8 = new stdlib.Int8Array(heap, offset); 9 var MEM8 = new stdlib.Int8Array(heap, offset);
10 var MEM16 = new stdlib.Int16Array(heap, offset); 10 var MEM16 = new stdlib.Int16Array(heap, offset);
(...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after
71 function testElementType(taConstr, f, offset) { 71 function testElementType(taConstr, f, offset) {
72 clearArray(); 72 clearArray();
73 73
74 var ta = new taConstr(sab, offset); 74 var ta = new taConstr(sab, offset);
75 var name = Object.prototype.toString.call(ta); 75 var name = Object.prototype.toString.call(ta);
76 assertEquals(0, f(0, 0xf), name); 76 assertEquals(0, f(0, 0xf), name);
77 assertEquals(0xf, ta[0]); 77 assertEquals(0xf, ta[0]);
78 assertEquals(0xf, f(0, 0x11), name); 78 assertEquals(0xf, f(0, 0x11), name);
79 assertEquals(0x1e, ta[0]); 79 assertEquals(0x1e, ta[0]);
80 // out of bounds 80 // out of bounds
81 assertEquals(0, f(-1, 0), name); 81 assertThrows(function() { f(-1, 0); });
82 assertEquals(0, f(ta.length, 0), name); 82 assertThrows(function() { f(ta.length, 0); });
83 } 83 }
84 84
85 function testElement(m, offset) { 85 function testElement(m, offset) {
86 testElementType(Int8Array, m.xori8, offset); 86 testElementType(Int8Array, m.xori8, offset);
87 testElementType(Int16Array, m.xori16, offset); 87 testElementType(Int16Array, m.xori16, offset);
88 testElementType(Int32Array, m.xori32, offset); 88 testElementType(Int32Array, m.xori32, offset);
89 testElementType(Uint8Array, m.xoru8, offset); 89 testElementType(Uint8Array, m.xoru8, offset);
90 testElementType(Uint16Array, m.xoru16, offset); 90 testElementType(Uint16Array, m.xoru16, offset);
91 testElementType(Uint32Array, m.xoru32, offset); 91 testElementType(Uint32Array, m.xoru32, offset);
92 } 92 }
93 93
94 var offset = 0; 94 var offset = 0;
95 var sab = new SharedArrayBuffer(16); 95 var sab = new SharedArrayBuffer(16);
96 var m1 = Module(this, {}, sab, offset); 96 var m1 = Module(this, {}, sab, offset);
97 testElement(m1, offset); 97 testElement(m1, offset);
98 98
99 offset = 32; 99 offset = 32;
100 sab = new SharedArrayBuffer(64); 100 sab = new SharedArrayBuffer(64);
101 var m2 = Module(this, {}, sab, offset); 101 var m2 = Module(this, {}, sab, offset);
102 testElement(m2, offset); 102 testElement(m2, offset);
OLDNEW
« no previous file with comments | « test/mjsunit/asm/atomics-sub.js ('k') | test/mjsunit/harmony/atomics.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698