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

Side by Side Diff: test/mjsunit/wasm/params.js

Issue 2594993002: [wasm] Rename wasm::LocalType to wasm::ValueType and kAst* to kWasm* (Closed)
Patch Set: Fix inspector tests Created 3 years, 12 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/wasm/module-memory.js ('k') | test/mjsunit/wasm/test-wasm-module-builder.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: --expose-wasm 5 // Flags: --expose-wasm
6 6
7 load("test/mjsunit/wasm/wasm-constants.js"); 7 load("test/mjsunit/wasm/wasm-constants.js");
8 load("test/mjsunit/wasm/wasm-module-builder.js"); 8 load("test/mjsunit/wasm/wasm-module-builder.js");
9 9
10 function runSelect2(select, which, a, b) { 10 function runSelect2(select, which, a, b) {
11 assertEquals(which == 0 ? a : b, select(a, b)); 11 assertEquals(which == 0 ? a : b, select(a, b));
12 } 12 }
13 13
14 function testSelect2(type) { 14 function testSelect2(type) {
15 for (var which = 0; which < 2; which++) { 15 for (var which = 0; which < 2; which++) {
16 print("type = " + type + ", which = " + which); 16 print("type = " + type + ", which = " + which);
17 17
18 var builder = new WasmModuleBuilder(); 18 var builder = new WasmModuleBuilder();
19 19
20 builder.addFunction("select", makeSig_r_xx(type, type)) 20 builder.addFunction("select", makeSig_r_xx(type, type))
21 .addBody([kExprGetLocal, which]) 21 .addBody([kExprGetLocal, which])
22 .exportFunc() 22 .exportFunc()
23 23
24 var select = builder.instantiate().exports.select; 24 var select = builder.instantiate().exports.select;
25 25
26 runSelect2(select, which, 99, 97); 26 runSelect2(select, which, 99, 97);
27 runSelect2(select, which, -99, -97); 27 runSelect2(select, which, -99, -97);
28 28
29 if (type != kAstF32) { 29 if (type != kWasmF32) {
30 runSelect2(select, which, 0x80000000 | 0, 0x7fffffff | 0); 30 runSelect2(select, which, 0x80000000 | 0, 0x7fffffff | 0);
31 runSelect2(select, which, 0x80000001 | 0, 0x7ffffffe | 0); 31 runSelect2(select, which, 0x80000001 | 0, 0x7ffffffe | 0);
32 runSelect2(select, which, 0xffffffff | 0, 0xfffffffe | 0); 32 runSelect2(select, which, 0xffffffff | 0, 0xfffffffe | 0);
33 runSelect2(select, which, -2147483647, 2147483646); 33 runSelect2(select, which, -2147483647, 2147483646);
34 runSelect2(select, which, -2147483646, 2147483645); 34 runSelect2(select, which, -2147483646, 2147483645);
35 runSelect2(select, which, -2147483648, 2147483647); 35 runSelect2(select, which, -2147483648, 2147483647);
36 } 36 }
37 37
38 if (type != kAstI32 && type != kAstI64) { 38 if (type != kWasmI32 && type != kWasmI64) {
39 runSelect2(select, which, -1.25, 5.25); 39 runSelect2(select, which, -1.25, 5.25);
40 runSelect2(select, which, Infinity, -Infinity); 40 runSelect2(select, which, Infinity, -Infinity);
41 } 41 }
42 } 42 }
43 } 43 }
44 44
45 45
46 testSelect2(kAstI32); 46 testSelect2(kWasmI32);
47 testSelect2(kAstF32); 47 testSelect2(kWasmF32);
48 testSelect2(kAstF64); 48 testSelect2(kWasmF64);
49 49
50 50
51 function runSelect10(select, which, a, b) { 51 function runSelect10(select, which, a, b) {
52 var x = -1; 52 var x = -1;
53 53
54 var result = [ 54 var result = [
55 select(a, b, x, x, x, x, x, x, x, x), 55 select(a, b, x, x, x, x, x, x, x, x),
56 select(x, a, b, x, x, x, x, x, x, x), 56 select(x, a, b, x, x, x, x, x, x, x),
57 select(x, x, a, b, x, x, x, x, x, x), 57 select(x, x, a, b, x, x, x, x, x, x),
58 select(x, x, x, a, b, x, x, x, x, x), 58 select(x, x, x, a, b, x, x, x, x, x),
(...skipping 23 matching lines...) Expand all
82 builder.addFunction("select", makeSig([t,t,t,t,t,t,t,t,t,t], [t])) 82 builder.addFunction("select", makeSig([t,t,t,t,t,t,t,t,t,t], [t]))
83 .addBody([kExprGetLocal, which]) 83 .addBody([kExprGetLocal, which])
84 .exportFunc(); 84 .exportFunc();
85 85
86 var select = builder.instantiate().exports.select; 86 var select = builder.instantiate().exports.select;
87 87
88 assertEquals("function", typeof select); 88 assertEquals("function", typeof select);
89 runSelect10(select, which, 99, 97); 89 runSelect10(select, which, 99, 97);
90 runSelect10(select, which, -99, -97); 90 runSelect10(select, which, -99, -97);
91 91
92 if (t != kAstF32) { 92 if (t != kWasmF32) {
93 runSelect10(select, which, 0x80000000 | 0, 0x7fffffff | 0); 93 runSelect10(select, which, 0x80000000 | 0, 0x7fffffff | 0);
94 runSelect10(select, which, 0x80000001 | 0, 0x7ffffffe | 0); 94 runSelect10(select, which, 0x80000001 | 0, 0x7ffffffe | 0);
95 runSelect10(select, which, 0xffffffff | 0, 0xfffffffe | 0); 95 runSelect10(select, which, 0xffffffff | 0, 0xfffffffe | 0);
96 runSelect10(select, which, -2147483647, 2147483646); 96 runSelect10(select, which, -2147483647, 2147483646);
97 runSelect10(select, which, -2147483646, 2147483645); 97 runSelect10(select, which, -2147483646, 2147483645);
98 runSelect10(select, which, -2147483648, 2147483647); 98 runSelect10(select, which, -2147483648, 2147483647);
99 } 99 }
100 100
101 if (t != kAstI32 && t != kAstI64) { 101 if (t != kWasmI32 && t != kWasmI64) {
102 runSelect10(select, which, -1.25, 5.25); 102 runSelect10(select, which, -1.25, 5.25);
103 runSelect10(select, which, Infinity, -Infinity); 103 runSelect10(select, which, Infinity, -Infinity);
104 } 104 }
105 } 105 }
106 } 106 }
107 107
108 108
109 testSelect10(kAstI32); 109 testSelect10(kWasmI32);
110 testSelect10(kAstF32); 110 testSelect10(kWasmF32);
111 testSelect10(kAstF64); 111 testSelect10(kWasmF64);
OLDNEW
« no previous file with comments | « test/mjsunit/wasm/module-memory.js ('k') | test/mjsunit/wasm/test-wasm-module-builder.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698