OLD | NEW |
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 | 8 |
9 function runSelect2(module, which, a, b) { | 9 function runSelect2(module, which, a, b) { |
10 assertEquals(which == 0 ? a : b, module.select(a, b)); | 10 assertEquals(which == 0 ? a : b, module.select(a, b)); |
(...skipping 17 matching lines...) Expand all Loading... |
28 kDeclFunctions, 1, | 28 kDeclFunctions, 1, |
29 kDeclFunctionName | kDeclFunctionExport, | 29 kDeclFunctionName | kDeclFunctionExport, |
30 0, 0, | 30 0, 0, |
31 kNameOffset, 0, 0, 0, // name offset | 31 kNameOffset, 0, 0, 0, // name offset |
32 kBodySize, 0, // body size | 32 kBodySize, 0, // body size |
33 kExprGetLocal, which, // -- | 33 kExprGetLocal, which, // -- |
34 kDeclEnd, | 34 kDeclEnd, |
35 's','e','l','e','c','t',0 // name | 35 's','e','l','e','c','t',0 // name |
36 ); | 36 ); |
37 | 37 |
38 var module = WASM.instantiateModule(data); | 38 var module = _WASMEXP_.instantiateModule(data); |
39 | 39 |
40 assertEquals("function", typeof module.select); | 40 assertEquals("function", typeof module.select); |
41 runSelect2(module, which, 99, 97); | 41 runSelect2(module, which, 99, 97); |
42 runSelect2(module, which, -99, -97); | 42 runSelect2(module, which, -99, -97); |
43 | 43 |
44 if (type != kAstF32) { | 44 if (type != kAstF32) { |
45 runSelect2(module, which, 0x80000000 | 0, 0x7fffffff | 0); | 45 runSelect2(module, which, 0x80000000 | 0, 0x7fffffff | 0); |
46 runSelect2(module, which, 0x80000001 | 0, 0x7ffffffe | 0); | 46 runSelect2(module, which, 0x80000001 | 0, 0x7ffffffe | 0); |
47 runSelect2(module, which, 0xffffffff | 0, 0xfffffffe | 0); | 47 runSelect2(module, which, 0xffffffff | 0, 0xfffffffe | 0); |
48 runSelect2(module, which, -2147483647, 2147483646); | 48 runSelect2(module, which, -2147483647, 2147483646); |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 kDeclFunctions, 1, | 104 kDeclFunctions, 1, |
105 kDeclFunctionName | kDeclFunctionExport, | 105 kDeclFunctionName | kDeclFunctionExport, |
106 0, 0, | 106 0, 0, |
107 kNameOffset, 0, 0, 0, // name offset | 107 kNameOffset, 0, 0, 0, // name offset |
108 kBodySize, 0, // body size | 108 kBodySize, 0, // body size |
109 kExprGetLocal, which, // -- | 109 kExprGetLocal, which, // -- |
110 kDeclEnd, | 110 kDeclEnd, |
111 's','e','l','e','c','t',0 // name | 111 's','e','l','e','c','t',0 // name |
112 ); | 112 ); |
113 | 113 |
114 var module = WASM.instantiateModule(data); | 114 var module = _WASMEXP_.instantiateModule(data); |
115 | 115 |
116 assertEquals("function", typeof module.select); | 116 assertEquals("function", typeof module.select); |
117 runSelect10(module, which, 99, 97); | 117 runSelect10(module, which, 99, 97); |
118 runSelect10(module, which, -99, -97); | 118 runSelect10(module, which, -99, -97); |
119 | 119 |
120 if (type != kAstF32) { | 120 if (type != kAstF32) { |
121 runSelect10(module, which, 0x80000000 | 0, 0x7fffffff | 0); | 121 runSelect10(module, which, 0x80000000 | 0, 0x7fffffff | 0); |
122 runSelect10(module, which, 0x80000001 | 0, 0x7ffffffe | 0); | 122 runSelect10(module, which, 0x80000001 | 0, 0x7ffffffe | 0); |
123 runSelect10(module, which, 0xffffffff | 0, 0xfffffffe | 0); | 123 runSelect10(module, which, 0xffffffff | 0, 0xfffffffe | 0); |
124 runSelect10(module, which, -2147483647, 2147483646); | 124 runSelect10(module, which, -2147483647, 2147483646); |
125 runSelect10(module, which, -2147483646, 2147483645); | 125 runSelect10(module, which, -2147483646, 2147483645); |
126 runSelect10(module, which, -2147483648, 2147483647); | 126 runSelect10(module, which, -2147483648, 2147483647); |
127 } | 127 } |
128 | 128 |
129 if (type != kAstI32 && type != kAstI64) { | 129 if (type != kAstI32 && type != kAstI64) { |
130 runSelect10(module, which, -1.25, 5.25); | 130 runSelect10(module, which, -1.25, 5.25); |
131 runSelect10(module, which, Infinity, -Infinity); | 131 runSelect10(module, which, Infinity, -Infinity); |
132 } | 132 } |
133 } | 133 } |
134 } | 134 } |
135 | 135 |
136 | 136 |
137 testSelect10(kAstI32); | 137 testSelect10(kAstI32); |
138 testSelect10(kAstF32); | 138 testSelect10(kAstF32); |
139 testSelect10(kAstF64); | 139 testSelect10(kAstF64); |
OLD | NEW |