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

Side by Side Diff: test/mjsunit/asm/int16array-negative-offset.js

Issue 2663243002: [asm] Fix lots of invalid asm.js tests (Closed)
Patch Set: Rebase Created 3 years, 10 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/infinite-loops-taken.js ('k') | test/mjsunit/asm/int16array-outofbounds.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 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 var stdlib = this; 5 var stdlib = this;
6 var buffer = new ArrayBuffer(64 * 1024); 6 var buffer = new ArrayBuffer(64 * 1024);
7 var foreign = {} 7 var foreign = {}
8 8
9 9
10 var m = (function Module(stdlib, foreign, heap) { 10 var m = (function Module(stdlib, foreign, heap) {
11 "use asm"; 11 "use asm";
12 var MEM16 = new stdlib.Int16Array(heap); 12 var MEM16 = new stdlib.Int16Array(heap);
13 function load(i) { 13 function load(i) {
14 i = i|0; 14 i = i|0;
15 i = MEM16[i >> 1]|0; 15 i = MEM16[i >> 1]|0;
16 return i; 16 return i | 0;
17 } 17 }
18 function store(i, v) { 18 function store(i, v) {
19 i = i|0; 19 i = i|0;
20 v = v|0; 20 v = v|0;
21 MEM16[i >> 1] = v; 21 MEM16[i >> 1] = v;
22 } 22 }
23 function load8(i) { 23 function load8(i) {
24 i = i|0; 24 i = i|0;
25 i = MEM16[i + 8 >> 1]|0; 25 i = MEM16[i + 8 >> 1]|0;
26 return i; 26 return i | 0;
27 } 27 }
28 function store8(i, v) { 28 function store8(i, v) {
29 i = i|0; 29 i = i|0;
30 v = v|0; 30 v = v|0;
31 MEM16[i + 8 >> 1] = v; 31 MEM16[i + 8 >> 1] = v;
32 } 32 }
33 return { load: load, store: store, load8: load8, store8: store8 }; 33 return { load: load, store: store, load8: load8, store8: store8 };
34 })(stdlib, foreign, buffer); 34 })(stdlib, foreign, buffer);
35 35
36 assertEquals(0, m.load(-8)); 36 assertEquals(0, m.load(-8));
37 assertEquals(0, m.load8(-16)); 37 assertEquals(0, m.load8(-16));
38 m.store(0, 42); 38 m.store(0, 42);
39 assertEquals(42, m.load8(-8)); 39 assertEquals(42, m.load8(-8));
40 m.store8(-8, 99); 40 m.store8(-8, 99);
41 assertEquals(99, m.load(0)); 41 assertEquals(99, m.load(0));
42 assertEquals(99, m.load8(-8)); 42 assertEquals(99, m.load8(-8));
OLDNEW
« no previous file with comments | « test/mjsunit/asm/infinite-loops-taken.js ('k') | test/mjsunit/asm/int16array-outofbounds.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698