| 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 TestStdlibConstants() { | 7 (function TestStdlibConstants() { |
| 8 function Module(stdlib) { | 8 function Module(stdlib) { |
| 9 "use asm"; | 9 "use asm"; |
| 10 | 10 |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 assertEquals(1, m.caller()); | 43 assertEquals(1, m.caller()); |
| 44 assertTrue(isNaN(m.nanCheck())); | 44 assertTrue(isNaN(m.nanCheck())); |
| 45 })(); | 45 })(); |
| 46 | 46 |
| 47 | 47 |
| 48 (function TestStdlibFunctionsInside() { | 48 (function TestStdlibFunctionsInside() { |
| 49 function Module(stdlib) { | 49 function Module(stdlib) { |
| 50 "use asm"; | 50 "use asm"; |
| 51 | 51 |
| 52 var StdlibMathCeil = stdlib.Math.ceil; | 52 var StdlibMathCeil = stdlib.Math.ceil; |
| 53 var StdlibMathClz32 = stdlib.Math.clz32; |
| 53 var StdlibMathFloor = stdlib.Math.floor; | 54 var StdlibMathFloor = stdlib.Math.floor; |
| 54 var StdlibMathSqrt = stdlib.Math.sqrt; | 55 var StdlibMathSqrt = stdlib.Math.sqrt; |
| 55 var StdlibMathAbs = stdlib.Math.abs; | 56 var StdlibMathAbs = stdlib.Math.abs; |
| 56 var StdlibMathMin = stdlib.Math.min; | 57 var StdlibMathMin = stdlib.Math.min; |
| 57 var StdlibMathMax = stdlib.Math.max; | 58 var StdlibMathMax = stdlib.Math.max; |
| 58 | 59 |
| 59 var StdlibMathAcos = stdlib.Math.acos; | 60 var StdlibMathAcos = stdlib.Math.acos; |
| 60 var StdlibMathAsin = stdlib.Math.asin; | 61 var StdlibMathAsin = stdlib.Math.asin; |
| 61 var StdlibMathAtan = stdlib.Math.atan; | 62 var StdlibMathAtan = stdlib.Math.atan; |
| 62 var StdlibMathCos = stdlib.Math.cos; | 63 var StdlibMathCos = stdlib.Math.cos; |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 != fround(1236.4)) return 0; | 100 != fround(1236.4)) return 0; |
| 100 | 101 |
| 101 if (!(deltaEqual(+StdlibMathAcos(0.1), 1.4706289056333368)|0)) return 0; | 102 if (!(deltaEqual(+StdlibMathAcos(0.1), 1.4706289056333368)|0)) return 0; |
| 102 if (!(deltaEqual(+StdlibMathAsin(0.2), 0.2013579207903308)|0)) return 0; | 103 if (!(deltaEqual(+StdlibMathAsin(0.2), 0.2013579207903308)|0)) return 0; |
| 103 if (!(deltaEqual(+StdlibMathAtan(0.2), 0.19739555984988078)|0)) return 0; | 104 if (!(deltaEqual(+StdlibMathAtan(0.2), 0.19739555984988078)|0)) return 0; |
| 104 if (!(deltaEqual(+StdlibMathCos(0.2), 0.9800665778412416)|0)) return 0; | 105 if (!(deltaEqual(+StdlibMathCos(0.2), 0.9800665778412416)|0)) return 0; |
| 105 if (!(deltaEqual(+StdlibMathSin(0.2), 0.19866933079506122)|0)) return 0; | 106 if (!(deltaEqual(+StdlibMathSin(0.2), 0.19866933079506122)|0)) return 0; |
| 106 if (!(deltaEqual(+StdlibMathTan(0.2), 0.20271003550867250)|0)) return 0; | 107 if (!(deltaEqual(+StdlibMathTan(0.2), 0.20271003550867250)|0)) return 0; |
| 107 if (!(deltaEqual(+StdlibMathExp(0.2), 1.2214027581601699)|0)) return 0; | 108 if (!(deltaEqual(+StdlibMathExp(0.2), 1.2214027581601699)|0)) return 0; |
| 108 if (!(deltaEqual(+StdlibMathLog(0.2), -1.6094379124341003)|0)) return 0; | 109 if (!(deltaEqual(+StdlibMathLog(0.2), -1.6094379124341003)|0)) return 0; |
| 110 if ((StdlibMathClz32(134217728)|0) != 4) return 0; |
| 109 | 111 |
| 110 if ((StdlibMathImul(6, 7)|0) != 42) return 0; | 112 if ((StdlibMathImul(6, 7)|0) != 42) return 0; |
| 111 if (!(deltaEqual(+StdlibMathAtan2(6.0, 7.0), 0.7086262721276703)|0)) | 113 if (!(deltaEqual(+StdlibMathAtan2(6.0, 7.0), 0.7086262721276703)|0)) |
| 112 return 0; | 114 return 0; |
| 113 if (+StdlibMathPow(6.0, 7.0) != 279936.0) return 0; | 115 if (+StdlibMathPow(6.0, 7.0) != 279936.0) return 0; |
| 114 | 116 |
| 115 return 1; | 117 return 1; |
| 116 } | 118 } |
| 117 | 119 |
| 118 return {caller:caller}; | 120 return {caller:caller}; |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 if (!compare(expected, actual)) { | 352 if (!compare(expected, actual)) { |
| 351 print(expected + ' !== ' + actual + ' for ' + name + | 353 print(expected + ' !== ' + actual + ' for ' + name + |
| 352 ' with input ' + val0 + ' ' + val1); | 354 ' with input ' + val0 + ' ' + val1); |
| 353 assertTrue(false); | 355 assertTrue(false); |
| 354 } | 356 } |
| 355 } | 357 } |
| 356 } | 358 } |
| 357 } | 359 } |
| 358 } | 360 } |
| 359 })(); | 361 })(); |
| OLD | NEW |