Index: test/mjsunit/wasm/asm-wasm.js |
diff --git a/test/mjsunit/wasm/asm-wasm.js b/test/mjsunit/wasm/asm-wasm.js |
index 661358d817ee5531aef5ff5da5a1aa59d515f69d..2ceba5e6a68228b21cf84dea82dfed5bf8c08ee4 100644 |
--- a/test/mjsunit/wasm/asm-wasm.js |
+++ b/test/mjsunit/wasm/asm-wasm.js |
@@ -1256,196 +1256,10 @@ TestForeignVariables(); |
})(); |
-(function TestStdlibConstants() { |
- function Module(stdlib) { |
- "use asm"; |
- |
- var StdlibInfinity = stdlib.Infinity; |
- var StdlibNaN = stdlib.NaN; |
- var StdlibMathE = stdlib.Math.E; |
- var StdlibMathLN10 = stdlib.Math.LN10; |
- var StdlibMathLN2 = stdlib.Math.LN2; |
- var StdlibMathLOG2E = stdlib.Math.LOG2E; |
- var StdlibMathLOG10E = stdlib.Math.LOG10E; |
- var StdlibMathPI = stdlib.Math.PI; |
- var StdlibMathSQRT1_2 = stdlib.Math.SQRT1_2; |
- var StdlibMathSQRT2 = stdlib.Math.SQRT2; |
- |
- function caller() { |
- if (StdlibInfinity != 1.0 / 0.0) return 0; |
- if (StdlibMathE != 2.718281828459045) return 0; |
- if (StdlibMathLN10 != 2.302585092994046) return 0; |
- if (StdlibMathLN2 != 0.6931471805599453) return 0; |
- if (StdlibMathLOG2E != 1.4426950408889634) return 0; |
- if (StdlibMathLOG10E != 0.4342944819032518) return 0; |
- if (StdlibMathPI != 3.141592653589793) return 0; |
- if (StdlibMathSQRT1_2 != 0.7071067811865476) return 0; |
- if (StdlibMathSQRT2 != 1.4142135623730951) return 0; |
- return 1; |
- } |
- |
- function nanCheck() { |
- return +StdlibNaN; |
- } |
- |
- return {caller:caller, nanCheck:nanCheck}; |
- } |
- |
- var m =Wasm.instantiateModuleFromAsm(Module.toString()); |
- assertEquals(1, m.caller()); |
- assertTrue(isNaN(m.nanCheck())); |
-})(); |
- |
- |
-(function TestStdlibFunctions() { |
- function Module(stdlib) { |
- "use asm"; |
- |
- var StdlibMathCeil = stdlib.Math.ceil; |
- var StdlibMathFloor = stdlib.Math.floor; |
- var StdlibMathSqrt = stdlib.Math.sqrt; |
- var StdlibMathAbs = stdlib.Math.abs; |
- var StdlibMathMin = stdlib.Math.min; |
- var StdlibMathMax = stdlib.Math.max; |
- |
- var StdlibMathAcos = stdlib.Math.acos; |
- var StdlibMathAsin = stdlib.Math.asin; |
- var StdlibMathAtan = stdlib.Math.atan; |
- var StdlibMathCos = stdlib.Math.cos; |
- var StdlibMathSin = stdlib.Math.sin; |
- var StdlibMathTan = stdlib.Math.tan; |
- var StdlibMathExp = stdlib.Math.exp; |
- var StdlibMathLog = stdlib.Math.log; |
- |
- var StdlibMathAtan2 = stdlib.Math.atan2; |
- var StdlibMathPow = stdlib.Math.pow; |
- var StdlibMathImul = stdlib.Math.imul; |
- |
- var fround = stdlib.Math.fround; |
- |
- function deltaEqual(x, y) { |
- x = +x; |
- y = +y; |
- var t = 0.0; |
- t = x - y; |
- if (t < 0.0) { |
- t = t * -1.0; |
- } |
- return (t < 1.0e-13) | 0; |
- } |
- |
- function caller() { |
- if (!deltaEqual(StdlibMathSqrt(123.0), 11.090536506409418)) return 0; |
- if (StdlibMathSqrt(fround(256.0)) != fround(16.0)) return 0; |
- if (StdlibMathCeil(123.7) != 124.0) return 0; |
- if (StdlibMathCeil(fround(123.7)) != fround(124.0)) return 0; |
- if (StdlibMathFloor(123.7) != 123.0) return 0; |
- if (StdlibMathFloor(fround(123.7)) != fround(123.0)) return 0; |
- if (StdlibMathAbs(-123.0) != 123.0) return 0; |
- if (StdlibMathAbs(fround(-123.0)) != fround(123.0)) return 0; |
- if (StdlibMathMin(123.4, 1236.4) != 123.4) return 0; |
- if (StdlibMathMin(fround(123.4), |
- fround(1236.4)) != fround(123.4)) return 0; |
- if (StdlibMathMax(123.4, 1236.4) != 1236.4) return 0; |
- if (StdlibMathMax(fround(123.4), fround(1236.4)) |
- != fround(1236.4)) return 0; |
- |
- if (!deltaEqual(StdlibMathAcos(0.1), 1.4706289056333368)) return 0; |
- if (!deltaEqual(StdlibMathAsin(0.2), 0.2013579207903308)) return 0; |
- if (!deltaEqual(StdlibMathAtan(0.2), 0.19739555984988078)) return 0; |
- if (!deltaEqual(StdlibMathCos(0.2), 0.9800665778412416)) return 0; |
- if (!deltaEqual(StdlibMathSin(0.2), 0.19866933079506122)) return 0; |
- if (!deltaEqual(StdlibMathTan(0.2), 0.20271003550867250)) return 0; |
- if (!deltaEqual(StdlibMathExp(0.2), 1.2214027581601699)) return 0; |
- if (!deltaEqual(StdlibMathLog(0.2), -1.6094379124341003)) return 0; |
- |
- if (StdlibMathImul(6, 7) != 42) return 0; |
- if (!deltaEqual(StdlibMathAtan2(6.0, 7.0), 0.7086262721276703)) return 0; |
- if (StdlibMathPow(6.0, 7.0) != 279936.0) return 0; |
- |
- return 1; |
- } |
- |
- return {caller:caller}; |
- } |
- |
- var m = Wasm.instantiateModuleFromAsm(Module.toString()); |
- assertEquals(1, m.caller()); |
-})(); |
- |
- |
-(function TestAbsInt() { |
- function Module(stdlib) { |
- "use asm"; |
- var abs = stdlib.Math.abs; |
- function func(x) { |
- x = x | 0; |
- return abs(x|0)|0; |
- } |
- return {func:func}; |
- } |
- var m = Wasm.instantiateModuleFromAsm(Module.toString()); |
- var values = [0, 1, -1, 0x40000000, 0x7FFFFFFF, -0x80000000]; |
- for (var i = 0; i < values.length; i++) { |
- var val = values[i]; |
- assertEquals(Math.abs(val) | 0, m.func(val)); |
- } |
-})(); |
- |
- |
-(function TestAbsFloat() { |
- function Module(stdlib) { |
- "use asm"; |
- var fround = stdlib.Math.fround; |
- var abs = stdlib.Math.abs; |
- function func(x) { |
- x = fround(x); |
- x = abs(x); |
- return fround(x); |
- } |
- return {func:func}; |
- } |
- var m = Wasm.instantiateModuleFromAsm(Module.toString()); |
- var values = [ |
- 0, -0, 1, -1, 0.9, -0.9, 1.414, 0x7F, -0x80, -0x8000, -0x80000000, |
- 0x7FFF, 0x7FFFFFFF, Infinity, -Infinity, NaN |
- ]; |
- for (var i = 0; i < values.length; i++) { |
- var val = values[i]; |
- assertEquals(Math.fround(Math.abs(val)), m.func(val)); |
- } |
-})(); |
- |
- |
-(function TestAbsDouble() { |
- function Module(stdlib) { |
- "use asm"; |
- var fround = stdlib.Math.fround; |
- var abs = stdlib.Math.abs; |
- function func(x) { |
- x = +x; |
- x = abs(x); |
- return +x; |
- } |
- return {func:func}; |
- } |
- var m = Wasm.instantiateModuleFromAsm(Module.toString()); |
- var values = [ |
- 0, -0, 1, -1, 0.9, -0.9, 1.414, 0x7F, -0x80, -0x8000, -0x80000000, |
- 0x7FFF, 0x7FFFFFFF, Infinity, -Infinity, NaN |
- ]; |
- for (var i = 0; i < values.length; i++) { |
- var val = values[i]; |
- assertEquals(Math.abs(val), m.func(val)); |
- } |
-})(); |
- |
- |
(function TestFloatAsDouble() { |
function Module(stdlib) { |
"use asm"; |
var fround = stdlib.Math.fround; |
- var abs = stdlib.Math.abs; |
function func() { |
var x = fround(1.0); |
return +fround(x); |