js/src/jit-test/tests/jaeger/testDenseCallElem.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 // vim: set ts=8 sts=4 et sw=4 tw=99:
     3 function fillDense(a) {
     4 }
     6 function testDenseUKeyUArray(a, key) {
     7     a.push(function () { return this[3]; });
     8     a.push(function () { return this[4]; });
     9     a.push(function() { return this[5]; });
    10     a.push(20);
    11     a.push("hi");
    12     a.push(500);
    13     assertEq(a[key](), 20);
    14     assertEq(a[key + 1](), "hi");
    15     assertEq(a[key + 2](), 500);
    16 }
    18 function testDenseVKeyUArray(a) {
    19     a.push(function () { return this[3]; });
    20     a.push(function () { return this[4]; });
    21     a.push(function() { return this[5]; });
    22     a.push(20);
    23     a.push("hi");
    24     a.push(500);
    25     var key = a.length & 1;
    26     assertEq(a[key](), 20);
    27     assertEq(a[(key + 1) & 3](), "hi");
    28     assertEq(a[(key + 2) & 3](), 500);
    29 }
    31 function testDenseKKeyUArray(a, key) {
    32     a.push(function () { return this[3]; });
    33     a.push(function () { return this[4]; });
    34     a.push(function() { return this[5]; });
    35     a.push(20);
    36     a.push("hi");
    37     a.push(500);
    38     assertEq(a[0](), 20);
    39     assertEq(a[1](), "hi");
    40     assertEq(a[2](), 500);
    41 }
    43 function testDenseUKeyVArray(key) {
    44     var a = [function () { return this[3]; },
    45              function () { return this[4]; },
    46              function() { return this[5]; },
    47              20,
    48              "hi",
    49              500];
    50     assertEq(a[key](), 20);
    51     assertEq(a[key + 1](), "hi");
    52     assertEq(a[key + 2](), 500);
    53 }
    55 function testDenseVKeyVArray() {
    56     var a = [function () { return this[3]; },
    57              function () { return this[4]; },
    58              function() { return this[5]; },
    59              20,
    60              "hi",
    61              500];
    62     var key = a.length & 1;
    63     assertEq(a[key](), 20);
    64     assertEq(a[(key + 1) & 3](), "hi");
    65     assertEq(a[(key + 2) & 3](), 500);
    66 }
    68 function testDenseKKeyVArray() {
    69     var a = [function () { return this[3]; },
    70              function () { return this[4]; },
    71              function() { return this[5]; },
    72              20,
    73              "hi",
    74              500];
    75     assertEq(a[0](), 20);
    76     assertEq(a[1](), "hi");
    77     assertEq(a[2](), 500);
    78 }
    80 for (var i = 0; i < 5; i++) {
    81     testDenseUKeyUArray([], 0);
    82     testDenseVKeyUArray([]);
    83     testDenseKKeyUArray([]);
    84     testDenseUKeyVArray(0);
    85     testDenseVKeyVArray();
    86     testDenseKKeyVArray();
    87 }

mercurial