OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 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 function WrapInAsmModule(func) { | 7 function WrapInAsmModule(func) { |
8 function MODULE_NAME(stdlib) { | 8 function MODULE_NAME(stdlib) { |
9 "use asm"; | 9 "use asm"; |
10 var imul = stdlib.Math.imul; | 10 var imul = stdlib.Math.imul; |
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 var funcs = [ | 190 var funcs = [ |
191 // TODO(bradnelson): u32_add, | 191 // TODO(bradnelson): u32_add, |
192 // TODO(bradnelson): u32_sub, | 192 // TODO(bradnelson): u32_sub, |
193 // TODO(titzer): u32_mul requires Math.imul | 193 // TODO(titzer): u32_mul requires Math.imul |
194 // TODO(titzer): u32_div by zero is incorrect | 194 // TODO(titzer): u32_div by zero is incorrect |
195 // TODO(titzer): u32_mod by zero is incorrect | 195 // TODO(titzer): u32_mod by zero is incorrect |
196 // TODO(titzer): u32_mul crashes turbofan in asm.js mode | 196 // TODO(titzer): u32_mul crashes turbofan in asm.js mode |
197 u32_and, | 197 u32_and, |
198 u32_or, | 198 u32_or, |
199 u32_xor, | 199 u32_xor, |
200 // TODO(titzer): u32_shl on arm | 200 u32_shl, |
201 // TODO(titzer): u32_shr on arm | 201 u32_shr, |
202 // TODO(titzer): u32_sar on arm | 202 u32_sar, |
203 u32_eq, | 203 u32_eq, |
204 u32_ne, | 204 u32_ne, |
205 u32_lt, | 205 u32_lt, |
206 u32_lteq, | 206 u32_lteq, |
207 u32_gt, | 207 u32_gt, |
208 u32_gteq, | 208 u32_gteq, |
209 // TODO(titzer): u32_min | 209 // TODO(titzer): u32_min |
210 // TODO(titzer): u32_max | 210 // TODO(titzer): u32_max |
211 // TODO(titzer): u32_abs | 211 // TODO(titzer): u32_abs |
212 ]; | 212 ]; |
213 | 213 |
214 (function () { | 214 (function () { |
215 for (func of funcs) { | 215 for (func of funcs) { |
216 RunThreeWayTest(WrapInAsmModule(func), function (module) { | 216 RunThreeWayTest(WrapInAsmModule(func), function (module) { |
217 for (a of inputs) { | 217 for (a of inputs) { |
218 for (b of inputs) { | 218 for (b of inputs) { |
219 var expected = func(a, b); | 219 var expected = func(a, b); |
220 assertEquals(expected, module.main(a, b)); | 220 assertEquals(expected, module.main(a, b)); |
221 } | 221 } |
222 } | 222 } |
223 }); | 223 }); |
224 } | 224 } |
225 | 225 |
226 })(); | 226 })(); |
OLD | NEW |