Bug 898021 - Mark values written to integer typed arrays as truncated, r=jandem.

This commit is contained in:
Brian Hackett 2013-07-26 11:29:48 -06:00
parent c4b7a6598a
commit a5e003cc23
2 changed files with 26 additions and 0 deletions

View File

@ -5233,6 +5233,7 @@ class MStoreTypedArrayElement
void setRacy() {
racy_ = true;
}
bool isOperandTruncated(size_t index) const;
};
class MStoreTypedArrayElementHole
@ -5295,6 +5296,7 @@ class MStoreTypedArrayElementHole
AliasSet getAliasSet() const {
return AliasSet::Store(AliasSet::TypedArrayElement);
}
bool isOperandTruncated(size_t index) const;
};
// Store a value infallibly to a statically known typed array.
@ -5322,6 +5324,11 @@ class MStoreTypedArrayElementStatic :
}
ArrayBufferView::ViewType viewType() const { return JS_GetArrayBufferViewType(typedArray_); }
bool isFloatArray() const {
return (viewType() == TypedArrayObject::TYPE_FLOAT32 ||
viewType() == TypedArrayObject::TYPE_FLOAT64);
}
void *base() const;
size_t length() const;
@ -5330,6 +5337,7 @@ class MStoreTypedArrayElementStatic :
AliasSet getAliasSet() const {
return AliasSet::Store(AliasSet::TypedArrayElement);
}
bool isOperandTruncated(size_t index) const;
};
// Compute an "effective address", i.e., a compound computation of the form:

View File

@ -1824,6 +1824,24 @@ MToDouble::isOperandTruncated(size_t index) const
return type() == MIRType_Int32;
}
bool
MStoreTypedArrayElement::isOperandTruncated(size_t index) const
{
return index == 2 && !isFloatArray();
}
bool
MStoreTypedArrayElementHole::isOperandTruncated(size_t index) const
{
return index == 3 && !isFloatArray();
}
bool
MStoreTypedArrayElementStatic::isOperandTruncated(size_t index) const
{
return index == 1 && !isFloatArray();
}
// Ensure that all observables uses can work with a truncated
// version of the |candidate|'s result.
static bool