Bug 925586 - IonMonkey: Simplify MLoadTypedArrayElement and MLoadTypedArrayElementStatic range computation. r=nbp

This commit is contained in:
Dan Gohman 2013-10-15 20:49:43 -07:00
parent 6938ab08e8
commit bff2a5d936
2 changed files with 12 additions and 7 deletions

View File

@ -478,6 +478,10 @@ MacroAssembler::loadFromTypedArray(int arrayType, const T &src, AnyRegister dest
convertUInt32ToDouble(temp, dest.fpu());
} else {
load32(src, dest.gpr());
// Bail out if the value doesn't fit into a signed int32 value. This
// is what allows MLoadTypedArrayElement to have a type() of
// MIRType_Int32 for UInt32 array loads.
test32(dest.gpr(), dest.gpr());
j(Assembler::Signed, fail);
}

View File

@ -1265,18 +1265,19 @@ static Range *GetTypedArrayRange(int type)
void
MLoadTypedArrayElement::computeRange()
{
if (Range *range = GetTypedArrayRange(arrayType())) {
if (type() == MIRType_Int32 && !range->hasInt32UpperBound())
range->extendUInt32ToInt32Min();
setRange(range);
}
// We have an Int32 type and if this is a UInt32 load it may produce a value
// outside of our range, but we have a bailout to handle those cases.
setRange(GetTypedArrayRange(arrayType()));
}
void
MLoadTypedArrayElementStatic::computeRange()
{
if (Range *range = GetTypedArrayRange(typedArray_->type()))
setRange(range);
// We don't currently use MLoadTypedArrayElementStatic for uint32, so we
// don't have to worry about it returning a value outside our type.
JS_ASSERT(typedArray_->type() != ScalarTypeRepresentation::TYPE_UINT32);
setRange(GetTypedArrayRange(typedArray_->type()));
}
void