js/src/jit-test/tests/jaeger/inline/mathAbs.js

Thu, 15 Jan 2015 21:03:48 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 15 Jan 2015 21:03:48 +0100
branch
TOR_BUG_9701
changeset 11
deefc01c0e14
permissions
-rw-r--r--

Integrate friendly tips from Tor colleagues to make (or not) 4.5 alpha 3;
This includes removal of overloaded (but unused) methods, and addition of
a overlooked call to DataStruct::SetData(nsISupports, uint32_t, bool.)

     2 assertEq(Math.abs(-10), 10);
     3 assertEq(Math.abs(-2147483648), 2147483648);
     4 assertEq(Math.abs(2147483648), 2147483648);
     5 assertEq(Math.abs(-0), 0);
     6 assertEq(Math.abs(0), 0);
     7 assertEq(Math.abs(-3.14), 3.14);
     8 assertEq(Math.abs(NaN), NaN);
    10 /* Inferred as abs(int). */
    11 function abs1(x) {
    12     return Math.abs(x);
    13 }
    14 assertEq(abs1(1), 1);
    15 assertEq(abs1(-1), 1);
    16 assertEq(abs1(0), 0);
    17 assertEq(abs1(-123) + abs1(234), 357);
    18 assertEq(abs1(-2147483648), 2147483648); // recompile to return double
    19 assertEq(abs1(-2), 2);
    21 /* Inferred as abs(double). */
    22 function abs2(x) {
    23     return Math.abs(x);
    24 }
    25 assertEq(abs2(-2.2), 2.2);
    26 assertEq(abs2(123), 123);
    27 assertEq(abs2(-456), 456);
    28 assertEq(abs2(-0), 0);
    29 assertEq(abs2(1.3), 1.3);
    30 assertEq(abs2(NaN), NaN);

mercurial