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 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 var funcs = [ | 212 var funcs = [ |
213 i32_add, | 213 i32_add, |
214 i32_sub, | 214 i32_sub, |
215 i32_mul, | 215 i32_mul, |
216 // TODO(titzer): i32_mul requires Math.imul | 216 // TODO(titzer): i32_mul requires Math.imul |
217 // TODO(titzer): i32_div divide by zero is incorrect | 217 // TODO(titzer): i32_div divide by zero is incorrect |
218 // TODO(titzer): i32_mod by zero is incorrect | 218 // TODO(titzer): i32_mod by zero is incorrect |
219 i32_and, | 219 i32_and, |
220 i32_or, | 220 i32_or, |
221 i32_xor, | 221 i32_xor, |
222 // TODO(titzer): i32_shl on arm | 222 i32_shl, |
223 // TODO(titzer): i32_shr on arm | 223 i32_shr, |
224 // TODO(titzer): i32_sar on arm | 224 i32_sar, |
225 i32_eq, | 225 i32_eq, |
226 i32_ne, | 226 i32_ne, |
227 i32_lt, | 227 i32_lt, |
228 i32_lteq, | 228 i32_lteq, |
229 i32_gt, | 229 i32_gt, |
230 i32_gteq, | 230 i32_gteq, |
231 i32_min, | 231 i32_min, |
232 i32_max, | 232 i32_max, |
233 i32_abs | 233 i32_abs |
234 ]; | 234 ]; |
235 | 235 |
236 (function () { | 236 (function () { |
237 for (func of funcs) { | 237 for (func of funcs) { |
238 RunThreeWayTest(WrapInAsmModule(func), function (module) { | 238 RunThreeWayTest(WrapInAsmModule(func), function (module) { |
239 if (func.length == 1) { | 239 if (func.length == 1) { |
240 for (a of inputs) { | 240 for (a of inputs) { |
241 assertEquals(func(a), module.main(a)); | 241 assertEquals(func(a), module.main(a)); |
242 } | 242 } |
243 } else { | 243 } else { |
244 for (a of inputs) { | 244 for (a of inputs) { |
245 for (b of inputs) { | 245 for (b of inputs) { |
246 assertEquals(func(a, b), module.main(a, b)); | 246 assertEquals(func(a, b), module.main(a, b)); |
247 } | 247 } |
248 } | 248 } |
249 } | 249 } |
250 }); | 250 }); |
251 } | 251 } |
252 | 252 |
253 })(); | 253 })(); |
OLD | NEW |