summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/bug1073861.js
blob: fe837c45c72f679176aca7544cf6f977234a08f9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
function a(a, b, c, g) {
    for (;;) {
        if (0 > c) return a;
        a: {
            for (;;) {
                var k = a.forward[c];
                if (t(k))
                    if (k.key < b) a = k;
                    else break a;
                else break a
            }
            a = void 0
        }
        null !=
            g && (g[c] = a);
        c -= 1
    }
}

function t(a) {
    return null != a && !1 !== a
}


var d = {forward: [{},null,{}]}
for (var i=0; i < 1000; i++) {
    a(d, 0, 1, null);
    a(d, 0, 0, null);
}




function test(a) {
  var t = a[0]
  if (t) {
    return t.test;
  }
}

function test2(a) {
  var t = a[0]
  if (t) {
    if (t) {
      return t.test;
    }
  }
}

function test3(a) {
  var t = a[0]
  if (t !== null) {
    if (t !== undefined) {
      return t.test;
    }
  }
}

var a = [{test:1}]
var b = [undefined]
assertEq(test(b), undefined)
assertEq(test(a), 1)
assertEq(test(a), 1)
assertEq(test2(b), undefined)
assertEq(test2(a), 1)
assertEq(test2(a), 1)
assertEq(test3(b), undefined)
assertEq(test3(a), 1)
assertEq(test3(a), 1)