summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/bug1216130.js
blob: 68731389f7f3e8b9755c6eef077d9b70d581b178 (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
function Obj1(x) { this.x = x; }
function f1() {
    var arr = [], o = {};
    for (var i=0; i<2500; i++) {
        arr.push(new Obj1(o));
        if (i < 15) {
            arr[i].x = undefined;
            arr[i].x = Math;
        }
    }
    for (var i=0; i<2500; i++) {
        var y = (i > 2000) ? undefined : o;
        arr[i].x = y;
    }
}
f1();

function f2() {
    var arr = [], p = {};
    for (var i=0; i<2500; i++) {
        var x = (i < 2000) ? p : undefined;
        var o = {x: x};
        if (i < 5) {
            o.x = undefined;
            o.x = p;
        }
        arr.push(o);
    }
    for (var i=0; i<2500; i++) {
        assertEq(arr[i].x, i < 2000 ? p : undefined);
    }
}
f2();

function f3() {
    var arr = [], p = {};
    for (var i=0; i<2500; i++) {
        var x = (i < 2000) ? p : true;
        var o = {x: x};
        if (i < 5) {
            o.x = true;
            o.x = p;
        }
        arr.push(o);
    }
    for (var i=0; i<2500; i++) {
        assertEq(arr[i].x, i < 2000 ? p : true);
    }
}
f3();