js/src/jit-test/tests/basic/testShiftLeft.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.)

     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