js/src/jit-test/tests/basic/testShiftLeft.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 // |jit-test| valgrind
     3 /* Test the proper operation of the left shift operator. This is especially
     4  * important on ARM as an explicit mask is required at the native instruction
     5  * level. */
     7 load(libdir + 'range.js');
     9 function testShiftLeft()
    10 {
    11     var r = [];
    12     var i = 0;
    13     var j = 0;
    15     var shifts = [0,1,7,8,15,16,23,24,31];
    17     /* Samples from the simple shift range. */
    18     for (i = 0; i < shifts.length; i++)
    19         r[j++] = 1 << shifts[i];
    21     /* Samples outside the normal shift range. */
    22     for (i = 0; i < shifts.length; i++)
    23         r[j++] = 1 << (shifts[i] + 32);
    25     /* Samples far outside the normal shift range. */
    26     for (i = 0; i < shifts.length; i++)
    27         r[j++] = 1 << (shifts[i] + 224);
    28     for (i = 0; i < shifts.length; i++)
    29         r[j++] = 1 << (shifts[i] + 256);
    31     return r.join(",");
    32 }
    34 assertEq(testShiftLeft(), 
    35 	 "1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+
    36 	 "1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+
    37 	 "1,2,128,256,32768,65536,8388608,16777216,-2147483648,"+
    38 	 "1,2,128,256,32768,65536,8388608,16777216,-2147483648");

mercurial