summaryrefslogtreecommitdiffstats
path: root/js/src/jit-test/tests/ion/truncate.js
blob: 3f4d353ac058239301fb0b076af0f38e428fa2fb (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
function f() {
    var x = Math.pow(2, 31); // take it as argument if constant propagation comes in you way.
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 32
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 33
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 34
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 35
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 36
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 37
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 38
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 39
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 40
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 41
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 42
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 43
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 44
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 45
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 46
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 47
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 48
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 49
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 50
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 51
    x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 52
    x = x + x; assertEq((x + 1) | 0, 0); // 2 ** 53
}

for (var i = 0; i <= 10_000; i++)
    f();