blob: 640eebc7f3bb2426898ca292b8596f7ac59d8d9d (
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.fround(i - 123456.7);
var o = (i & 1) ? o1 : o2;
o.thrower;
res++;
}
} catch(e) {}
assertEq(res, -121555.703125);
return res;
}
f();
|