js/src/jit-test/tests/basic/testShiftRightArithmetic.js

Sat, 03 Jan 2015 20:18:00 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Sat, 03 Jan 2015 20:18:00 +0100
branch
TOR_BUG_3246
changeset 7
129ffea94266
permissions
-rw-r--r--

Conditionally enable double key logic according to:
private browsing mode or privacy.thirdparty.isolate preference and
implement in GetCookieStringCommon and FindCookie where it counts...
With some reservations of how to convince FindCookie users to test
condition and pass a nullptr when disabling double key logic.

     1 /* Test the proper operation of the arithmetic right shift operator. This is
     2  * especially important on ARM as an explicit mask is required at the native
     3  * instruction level. */
     5 load(libdir + 'range.js');
     7 /* Test different combinations of literals/variables. */
     8 var s = 4;
     9 var t = 100;
    10 assertEq(42 >> s, 2);
    11 assertEq(s >> 1, 2);
    12 assertEq(23 >> 3, 2);
    13 assertEq(t >> s, 6);
    16 function testShiftRightArithmetic()
    17 {
    18     var r = [];
    19     var i = 0;
    20     var j = 0;
    22     var shifts = [0,1,7,8,15,16,23,24,31];
    24     /* Samples from the simple shift range. */
    25     for (i = 0; i < shifts.length; i++)
    26         r[j++] = -2147483648 >> shifts[i];
    28     /* Samples outside the normal shift range. */
    29     for (i = 0; i < shifts.length; i++)
    30         r[j++] = -2147483648 >> (shifts[i] + 32);
    32     /* Samples far outside the normal shift range. */
    33     for (i = 0; i < shifts.length; i++)
    34         r[j++] = -2147483648 >> (shifts[i] + 224);
    35     for (i = 0; i < shifts.length; i++)
    36         r[j++] = -2147483648 >> (shifts[i] + 256);
    38     return r.join(",");
    39 }
    40 assertEq(testShiftRightArithmetic(), 
    41 	 "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
    42 	 "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
    43 	 "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1,"+
    44 	 "-2147483648,-1073741824,-16777216,-8388608,-65536,-32768,-256,-128,-1");

mercurial