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 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 | 189 |
190 var funcs = [ | 190 var funcs = [ |
191 u32_add, | 191 u32_add, |
192 u32_sub, | 192 u32_sub, |
193 u32_div, | 193 u32_div, |
194 u32_mod, | 194 u32_mod, |
195 // TODO(titzer): u32_mul crashes turbofan in asm.js mode | 195 // TODO(titzer): u32_mul crashes turbofan in asm.js mode |
196 u32_and, | 196 u32_and, |
197 u32_or, | 197 u32_or, |
198 u32_xor, | 198 u32_xor, |
199 // TODO(titzer): u32_shl on arm | 199 u32_shl, |
200 // TODO(titzer): u32_shr on arm | 200 u32_shr, |
201 // TODO(titzer): u32_sar on arm | 201 u32_sar, |
202 u32_eq, | 202 u32_eq, |
203 u32_ne, | 203 u32_ne, |
204 u32_lt, | 204 u32_lt, |
205 u32_lteq, | 205 u32_lteq, |
206 u32_gt, | 206 u32_gt, |
207 u32_gteq, | 207 u32_gteq, |
208 // TODO(titzer): u32_min | 208 // TODO(titzer): u32_min |
209 // TODO(titzer): u32_max | 209 // TODO(titzer): u32_max |
210 // TODO(titzer): u32_abs | 210 // TODO(titzer): u32_abs |
211 ]; | 211 ]; |
212 | 212 |
213 (function () { | 213 (function () { |
214 for (func of funcs) { | 214 for (func of funcs) { |
215 RunThreeWayTest(WrapInAsmModule(func), function (module) { | 215 RunThreeWayTest(WrapInAsmModule(func), function (module) { |
216 for (a of inputs) { | 216 for (a of inputs) { |
217 for (b of inputs) { | 217 for (b of inputs) { |
218 var expected = func(a, b); | 218 var expected = func(a, b); |
219 assertEquals(expected, module.main(a, b)); | 219 assertEquals(expected, module.main(a, b)); |
220 } | 220 } |
221 } | 221 } |
222 }); | 222 }); |
223 } | 223 } |
224 | 224 |
225 })(); | 225 })(); |
OLD | NEW |