summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/exc-bailout-double-reg.js
blob: 62f5a9543355c0392821378b6f00651cba01ca0c (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
var x = 0;
var o1 = {x: 1};
var o2 = {};
for (var o of [o1, o2]) {
    Object.defineProperty(o, "thrower", {get: function() {
        if (x++ > 1900) {
            throw "error";
        }
    }});
}
function f() {
    var res = 0;
    try {
        for (var i = 0; i < 2000; i++) {
            res = Math.abs(i - 123456.7);
            var o = (i & 1) ? o1 : o2;
            o.thrower;
            res++;
        }
    } catch(e) {}
    assertEq(res, 121555.7);
    return res;
}
f();