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 Math_ceil = stdlib.Math.ceil; | 10 var Math_ceil = stdlib.Math.ceil; |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
221 } | 221 } |
222 | 222 |
223 function f64_atan2(a) { | 223 function f64_atan2(a) { |
224 a = +a; | 224 a = +a; |
225 return +Math_atan2(+a); | 225 return +Math_atan2(+a); |
226 } | 226 } |
227 | 227 |
228 | 228 |
229 var inputs = [ | 229 var inputs = [ |
230 0, 1, 2, 3, 4, | 230 0, 1, 2, 3, 4, |
| 231 NaN, |
| 232 Infinity, |
| 233 -Infinity, |
231 10, 20, 30, 31, 32, 33, 100, 2000, | 234 10, 20, 30, 31, 32, 33, 100, 2000, |
232 30000, 400000, 5000000, | 235 30000, 400000, 5000000, |
233 100000000, 2000000000, | 236 100000000, 2000000000, |
234 2147483646, | 237 2147483646, |
235 2147483647, | 238 2147483647, |
236 2147483648, | 239 2147483648, |
237 2147483649, | 240 2147483649, |
238 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, | 241 0x273a798e, 0x187937a3, 0xece3af83, 0x5495a16b, 0x0b668ecc, 0x11223344, |
239 0x0000009e, 0x00000043, 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, | 242 0x0000af73, 0x0000116b, 0x00658ecc, 0x002b3b4c, |
240 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, | 243 0x88776655, 0x70000000, 0x07200000, 0x7fffffff, 0x56123761, 0x7fffff00, |
241 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, | 244 0xeeeeeeee, 0xfffffffd, 0xf0000000, 0x007fffff, 0x003fffff, 0x001fffff, |
242 0x00003fff, 0x00001fff, 0x00000fff, 0x000007ff, 0x000003ff, 0x000001ff, | |
243 -0, | 245 -0, |
244 -1, -2, -3, -4, | 246 -1, -2, -3, -4, |
245 -10, -20, -30, -31, -32, -33, -100, -2000, | 247 -10, -20, -30, -31, -32, -33, -100, -2000, |
246 -30000, -400000, -5000000, | 248 -30000, -400000, -5000000, |
247 -100000000, -2000000000, | 249 -100000000, -2000000000, |
248 -2147483646, | 250 -2147483646, |
249 -2147483647, | 251 -2147483647, |
250 -2147483648, | 252 -2147483648, |
251 -2147483649, | 253 -2147483649, |
252 0.1, | 254 0.1, |
253 1.1e-2, | 255 1.1e-2, |
254 1.2e-4, | 256 1.2e-4, |
255 1.3e-8, | 257 1.3e-8, |
256 1.4e-11, | 258 1.4e-11, |
257 1.5e-12, | 259 1.5e-12, |
258 1.6e-13 | 260 1.6e-13 |
259 ]; | 261 ]; |
260 | 262 |
261 var funcs = [ | 263 var funcs = [ |
262 f64_add, | 264 f64_add, |
263 f64_sub, | 265 f64_sub, |
264 f64_mul, | 266 f64_mul, |
265 f64_div, | 267 f64_div, |
266 f64_eq, | 268 f64_eq, |
267 f64_ne, | 269 f64_ne, |
268 f64_lt, | 270 f64_lt, |
269 f64_lteq, | 271 f64_lteq, |
270 f64_gt, | 272 f64_gt, |
271 f64_gteq, | 273 f64_gteq, |
272 // TODO(bradnelson) f64_ceil, | 274 f64_ceil, |
273 // TODO(bradnelson) f64_floor, | 275 f64_floor, |
274 // TODO(bradnelson) f64_sqrt, | 276 // TODO(bradnelson) f64_sqrt, |
275 // TODO(bradnelson) f64_abs, | 277 f64_abs, |
276 // TODO(bradnelson) f64_min is wrong for -0 | 278 // TODO(bradnelson) f64_min is wrong for -0 |
277 // TODO(bradnelson) f64_max is wrong for -0 | 279 // TODO(bradnelson) f64_max is wrong for -0 |
278 // TODO(bradnelson) f64_acos, | 280 // TODO(bradnelson) f64_acos, |
279 // TODO(bradnelson) f64_asin, | 281 // TODO(bradnelson) f64_asin, |
280 // TODO(bradnelson) f64_atan, | 282 // TODO(bradnelson) f64_atan, |
281 // TODO(bradnelson) f64_cos, | 283 // TODO(bradnelson) f64_cos, |
282 // TODO(bradnelson) f64_sin, | 284 // TODO(bradnelson) f64_sin, |
283 // TODO(bradnelson) f64_tan, | 285 // TODO(bradnelson) f64_tan, |
284 // TODO(bradnelson) f64_exp, | 286 // TODO(bradnelson) f64_exp, |
285 // TODO(bradnelson) f64_log, | 287 // TODO(bradnelson) f64_log, |
(...skipping 16 matching lines...) Expand all Loading... |
302 assertEquals(func(a, b), module.main(a, b)); | 304 assertEquals(func(a, b), module.main(a, b)); |
303 assertEquals(func(a / 10, b), module.main(a / 10, b)); | 305 assertEquals(func(a / 10, b), module.main(a / 10, b)); |
304 assertEquals(func(a, b / 440.9), module.main(a, b / 440.9)); | 306 assertEquals(func(a, b / 440.9), module.main(a, b / 440.9)); |
305 assertEquals(func(a / -33.1, b), module.main(a / -33.1, b)); | 307 assertEquals(func(a / -33.1, b), module.main(a / -33.1, b)); |
306 } | 308 } |
307 } | 309 } |
308 } | 310 } |
309 }); | 311 }); |
310 } | 312 } |
311 })(); | 313 })(); |
OLD | NEW |