js/src/jit-test/tests/ion/truncate.js

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

     1 function f() {
     2     var x = Math.pow(2, 31); // take it as argument if constant propagation comes in you way.
     3     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 32
     4     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 33
     5     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 34
     6     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 35
     7     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 36
     8     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 37
     9     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 38
    10     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 39
    11     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 40
    12     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 41
    13     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 42
    14     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 43
    15     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 44
    16     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 45
    17     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 46
    18     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 47
    19     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 48
    20     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 49
    21     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 50
    22     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 51
    23     x = x + x; assertEq((x + 1) | 0, 1); // 2 ** 52
    24     x = x + x; assertEq((x + 1) | 0, 0); // 2 ** 53
    25 }
    27 for (var i = 0; i <= 100000; i++)
    28     f();

mercurial