mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-11 04:15:43 +00:00
Bug 931488 - IonMonkey: Implement computeRange for MArrayPush, MBoundsCheck, MRandom, and some MMathFunctions. r=nbp
This commit is contained in:
parent
706d13e86b
commit
8dbf258814
@ -3664,6 +3664,8 @@ class MRandom : public MNullaryInstruction
|
||||
bool possiblyCalls() const {
|
||||
return true;
|
||||
}
|
||||
|
||||
void computeRange();
|
||||
};
|
||||
|
||||
class MMathFunction
|
||||
@ -3751,6 +3753,7 @@ class MMathFunction
|
||||
|| function_ == ASin || function_ == ACos || function_ == Floor;
|
||||
}
|
||||
void trySpecializeFloat32();
|
||||
void computeRange();
|
||||
};
|
||||
|
||||
class MAdd : public MBinaryArithInstruction
|
||||
@ -5258,6 +5261,7 @@ class MBoundsCheck
|
||||
virtual AliasSet getAliasSet() const {
|
||||
return AliasSet::None();
|
||||
}
|
||||
void computeRange();
|
||||
};
|
||||
|
||||
// Bailout if index < minimum.
|
||||
@ -5615,6 +5619,7 @@ class MArrayPush
|
||||
AliasSet getAliasSet() const {
|
||||
return AliasSet::Store(AliasSet::Element | AliasSet::ObjectFields);
|
||||
}
|
||||
void computeRange();
|
||||
};
|
||||
|
||||
// Array.prototype.concat on two dense arrays.
|
||||
|
@ -1365,6 +1365,55 @@ MArgumentsLength::computeRange()
|
||||
setRange(Range::NewUInt32Range(0, SNAPSHOT_MAX_NARGS));
|
||||
}
|
||||
|
||||
void
|
||||
MBoundsCheck::computeRange()
|
||||
{
|
||||
// Just transfer the incoming index range to the output. The length() is
|
||||
// also interesting, but it is handled as a bailout check, and we're
|
||||
// computing a pre-bailout range here.
|
||||
setRange(new Range(index()));
|
||||
}
|
||||
|
||||
void
|
||||
MArrayPush::computeRange()
|
||||
{
|
||||
// MArrayPush returns the new array length.
|
||||
setRange(Range::NewUInt32Range(0, UINT32_MAX));
|
||||
}
|
||||
|
||||
void
|
||||
MMathFunction::computeRange()
|
||||
{
|
||||
Range opRange(getOperand(0));
|
||||
switch (function()) {
|
||||
case Sin:
|
||||
case Cos:
|
||||
if (!opRange.canBeInfiniteOrNaN())
|
||||
setRange(Range::NewDoubleRange(-1.0, 1.0));
|
||||
break;
|
||||
case Sign:
|
||||
if (!opRange.canBeNaN()) {
|
||||
// Note that Math.sign(-0) is -0, and we treat -0 as equal to 0.
|
||||
int32_t lower = -1;
|
||||
int32_t upper = 1;
|
||||
if (opRange.hasInt32LowerBound() && opRange.lower() >= 0)
|
||||
lower = 0;
|
||||
if (opRange.hasInt32UpperBound() && opRange.upper() <= 0)
|
||||
upper = 0;
|
||||
setRange(Range::NewInt32Range(lower, upper));
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MRandom::computeRange()
|
||||
{
|
||||
setRange(Range::NewDoubleRange(0.0, 1.0));
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Range Analysis
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
Loading…
Reference in New Issue
Block a user