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
Родитель c4b7a6598a
Коммит a5e003cc23
2 изменённых файлов: 26 добавлений и 0 удалений

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

@ -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:

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

@ -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