1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/js/src/jit-test/tests/jaeger/testDenseCallElem.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,89 @@ 1.4 +// vim: set ts=8 sts=4 et sw=4 tw=99: 1.5 + 1.6 +function fillDense(a) { 1.7 +} 1.8 + 1.9 +function testDenseUKeyUArray(a, key) { 1.10 + a.push(function () { return this[3]; }); 1.11 + a.push(function () { return this[4]; }); 1.12 + a.push(function() { return this[5]; }); 1.13 + a.push(20); 1.14 + a.push("hi"); 1.15 + a.push(500); 1.16 + assertEq(a[key](), 20); 1.17 + assertEq(a[key + 1](), "hi"); 1.18 + assertEq(a[key + 2](), 500); 1.19 +} 1.20 + 1.21 +function testDenseVKeyUArray(a) { 1.22 + a.push(function () { return this[3]; }); 1.23 + a.push(function () { return this[4]; }); 1.24 + a.push(function() { return this[5]; }); 1.25 + a.push(20); 1.26 + a.push("hi"); 1.27 + a.push(500); 1.28 + var key = a.length & 1; 1.29 + assertEq(a[key](), 20); 1.30 + assertEq(a[(key + 1) & 3](), "hi"); 1.31 + assertEq(a[(key + 2) & 3](), 500); 1.32 +} 1.33 + 1.34 +function testDenseKKeyUArray(a, key) { 1.35 + a.push(function () { return this[3]; }); 1.36 + a.push(function () { return this[4]; }); 1.37 + a.push(function() { return this[5]; }); 1.38 + a.push(20); 1.39 + a.push("hi"); 1.40 + a.push(500); 1.41 + assertEq(a[0](), 20); 1.42 + assertEq(a[1](), "hi"); 1.43 + assertEq(a[2](), 500); 1.44 +} 1.45 + 1.46 +function testDenseUKeyVArray(key) { 1.47 + var a = [function () { return this[3]; }, 1.48 + function () { return this[4]; }, 1.49 + function() { return this[5]; }, 1.50 + 20, 1.51 + "hi", 1.52 + 500]; 1.53 + assertEq(a[key](), 20); 1.54 + assertEq(a[key + 1](), "hi"); 1.55 + assertEq(a[key + 2](), 500); 1.56 +} 1.57 + 1.58 +function testDenseVKeyVArray() { 1.59 + var a = [function () { return this[3]; }, 1.60 + function () { return this[4]; }, 1.61 + function() { return this[5]; }, 1.62 + 20, 1.63 + "hi", 1.64 + 500]; 1.65 + var key = a.length & 1; 1.66 + assertEq(a[key](), 20); 1.67 + assertEq(a[(key + 1) & 3](), "hi"); 1.68 + assertEq(a[(key + 2) & 3](), 500); 1.69 +} 1.70 + 1.71 +function testDenseKKeyVArray() { 1.72 + var a = [function () { return this[3]; }, 1.73 + function () { return this[4]; }, 1.74 + function() { return this[5]; }, 1.75 + 20, 1.76 + "hi", 1.77 + 500]; 1.78 + assertEq(a[0](), 20); 1.79 + assertEq(a[1](), "hi"); 1.80 + assertEq(a[2](), 500); 1.81 +} 1.82 + 1.83 +for (var i = 0; i < 5; i++) { 1.84 + testDenseUKeyUArray([], 0); 1.85 + testDenseVKeyUArray([]); 1.86 + testDenseKKeyUArray([]); 1.87 + testDenseUKeyVArray(0); 1.88 + testDenseVKeyVArray(); 1.89 + testDenseKKeyVArray(); 1.90 +} 1.91 + 1.92 +