Bug 1104647 - IonMonkey: Implement MathFunction(Floor) recover instruction r=nbp

This commit is contained in:
Jeff Hemphill 2017-11-08 15:42:57 +00:00
Родитель 514cedaafc
Коммит a29af12056
3 изменённых файлов: 41 добавлений и 0 удалений

Просмотреть файл

@ -0,0 +1,37 @@
// |jit-test| --no-sse4;
// This test is a fork of dce-with-rinstructions.js. It tests recover
// instructions which are only executed on pre-SSE4 processors.
setJitCompilerOption("baseline.warmup.trigger", 10);
setJitCompilerOption("ion.warmup.trigger", 20);
const max = 200;
// Check that we are able to remove the operation inside recover test
// functions (denoted by "rop..."), when we inline the first version
// of uceFault, and ensure that the bailout is correct when uceFault
// is replaced (which cause an invalidation bailout)
let uceFault = function (i) {
if (i > 98)
uceFault = function (i) { return true; };
return false;
};
let uceFault_floor_double = eval(
uneval(uceFault)
.replace('uceFault', 'uceFault_floor_double')
);
function rfloor_double(i) {
const x = Math.floor(i + (-1 >>> 0));
if (uceFault_floor_double(i) || uceFault_floor_double(i))
assertEq(x, 99 + (-1 >>> 0)); /* = i + 2 ^ 32 - 1 */
assertRecoveredOnBailout(x, true);
return i;
}
for (let j = 100 - max; j < 100; j++) {
with({}){} // Do not Ion-compile this loop.
const i = j < 2 ? (Math.abs(j) % 50) + 2 : j;
rfloor_double(i);
}

Просмотреть файл

@ -7017,6 +7017,7 @@ class MMathFunction
switch(function_) {
case Sin:
case Log:
case Floor:
case Round:
return true;
default:

Просмотреть файл

@ -962,6 +962,9 @@ MMathFunction::writeRecoverData(CompactBufferWriter& writer) const
{
MOZ_ASSERT(canRecoverOnBailout());
switch (function_) {
case Floor:
writer.writeUnsigned(uint32_t(RInstruction::Recover_Floor));
return true;
case Round:
writer.writeUnsigned(uint32_t(RInstruction::Recover_Round));
return true;