| 1 |
// |jit-test| --no-sse4; |
| 2 |
|
| 3 |
// This test is a fork of dce-with-rinstructions.js. It tests recover |
| 4 |
// instructions which are only executed on pre-SSE4 processors. |
| 5 |
|
| 6 |
setJitCompilerOption("baseline.warmup.trigger", 10); |
| 7 |
setJitCompilerOption("ion.warmup.trigger", 20); |
| 8 |
|
| 9 |
// Prevent the GC from cancelling Ion compilations, when we expect them to succeed |
| 10 |
gczeal(0); |
| 11 |
|
| 12 |
const max = 200; |
| 13 |
|
| 14 |
// Check that we are able to remove the operation inside recover test |
| 15 |
// functions (denoted by "rop..."), when we inline the first version |
| 16 |
// of uceFault, and ensure that the bailout is correct when uceFault |
| 17 |
// is replaced (which cause an invalidation bailout) |
| 18 |
let uceFault = function (i) { |
| 19 |
if (i > 98) |
| 20 |
uceFault = function (i) { return true; }; |
| 21 |
return false; |
| 22 |
}; |
| 23 |
|
| 24 |
let uceFault_ceil_double = eval( |
| 25 |
`(${uceFault})` |
| 26 |
.replace('uceFault', 'uceFault_ceil_double') |
| 27 |
); |
| 28 |
function rceil_double(i) { |
| 29 |
const x = Math.ceil(i + (-1 >>> 0)); |
| 30 |
if (uceFault_ceil_double(i) || uceFault_ceil_double(i)) |
| 31 |
assertEq(x, 99 + (-1 >>> 0)); /* = i + 2 ^ 32 - 1 */ |
| 32 |
assertRecoveredOnBailout(x, true); |
| 33 |
return i; |
| 34 |
} |
| 35 |
|
| 36 |
let uceFault_floor_double = eval( |
| 37 |
`(${uceFault})` |
| 38 |
.replace('uceFault', 'uceFault_floor_double') |
| 39 |
); |
| 40 |
function rfloor_double(i) { |
| 41 |
const x = Math.floor(i + (-1 >>> 0)); |
| 42 |
if (uceFault_floor_double(i) || uceFault_floor_double(i)) |
| 43 |
assertEq(x, 99 + (-1 >>> 0)); /* = i + 2 ^ 32 - 1 */ |
| 44 |
assertRecoveredOnBailout(x, true); |
| 45 |
return i; |
| 46 |
} |
| 47 |
|
| 48 |
for (let j = 100 - max; j < 100; j++) { |
| 49 |
with({}){} // Do not Ion-compile this loop. |
| 50 |
const i = j < 2 ? (Math.abs(j) % 50) + 2 : j; |
| 51 |
rceil_double(i); |
| 52 |
rfloor_double(i); |
| 53 |
} |