Backed out changeset b7b0305f5747 (bug 1135042)

This commit is contained in:
Carsten "Tomcat" Book 2015-03-03 12:08:17 +01:00
parent 3266e6c445
commit 7473717653
3 changed files with 51 additions and 66 deletions

View File

@ -2984,9 +2984,9 @@ LIRGenerator::visitStoreTypedArrayElement(MStoreTypedArrayElement *ins)
if (ins->isSimdWrite()) {
MOZ_ASSERT_IF(ins->writeType() == Scalar::Float32x4, ins->value()->type() == MIRType_Float32x4);
MOZ_ASSERT_IF(ins->writeType() == Scalar::Int32x4, ins->value()->type() == MIRType_Int32x4);
} else if (ins->isFloatWrite()) {
MOZ_ASSERT_IF(ins->writeType() == Scalar::Float32, ins->value()->type() == MIRType_Float32);
MOZ_ASSERT_IF(ins->writeType() == Scalar::Float64, ins->value()->type() == MIRType_Double);
} else if (ins->isFloatArray()) {
MOZ_ASSERT_IF(ins->arrayType() == Scalar::Float32, ins->value()->type() == MIRType_Float32);
MOZ_ASSERT_IF(ins->arrayType() == Scalar::Float64, ins->value()->type() == MIRType_Double);
} else {
MOZ_ASSERT(ins->value()->type() == MIRType_Int32);
}
@ -2996,7 +2996,7 @@ LIRGenerator::visitStoreTypedArrayElement(MStoreTypedArrayElement *ins)
LAllocation value;
// For byte arrays, the value has to be in a byte register on x86.
if (ins->isByteWrite())
if (ins->isByteArray() && !ins->isSimdWrite())
value = useByteOpRegisterOrNonDoubleConstant(ins->value());
else
value = useRegisterOrNonDoubleConstant(ins->value());
@ -3023,7 +3023,7 @@ LIRGenerator::visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole *ins)
MOZ_ASSERT(ins->index()->type() == MIRType_Int32);
MOZ_ASSERT(ins->length()->type() == MIRType_Int32);
if (ins->isFloatWrite()) {
if (ins->isFloatArray()) {
MOZ_ASSERT_IF(ins->arrayType() == Scalar::Float32, ins->value()->type() == MIRType_Float32);
MOZ_ASSERT_IF(ins->arrayType() == Scalar::Float64, ins->value()->type() == MIRType_Double);
} else {
@ -3036,7 +3036,7 @@ LIRGenerator::visitStoreTypedArrayElementHole(MStoreTypedArrayElementHole *ins)
LAllocation value;
// For byte arrays, the value has to be in a byte register on x86.
if (ins->isByteWrite())
if (ins->isByteArray())
value = useByteOpRegisterOrNonDoubleConstant(ins->value());
else
value = useRegisterOrNonDoubleConstant(ins->value());

View File

@ -9062,52 +9062,12 @@ class MLoadTypedArrayElementStatic
void collectRangeInfoPreTrunc() MOZ_OVERRIDE;
};
// Base class for MIR ops that write to typed arrays.
class StoreTypedArrayBase
{
Scalar::Type writeType_;
protected:
StoreTypedArrayBase(Scalar::Type writeType)
: writeType_(writeType)
{
MOZ_ASSERT(isIntegerWrite() || isFloatWrite() || isSimdWrite());
}
public:
void setWriteType(Scalar::Type type) {
writeType_ = type;
}
Scalar::Type writeType() const {
return writeType_;
}
bool isByteWrite() const {
return writeType_ == Scalar::Int8 ||
writeType_ == Scalar::Uint8 ||
writeType_ == Scalar::Uint8Clamped;
}
bool isIntegerWrite() const {
return isByteWrite () ||
writeType_ == Scalar::Int16 ||
writeType_ == Scalar::Uint16 ||
writeType_ == Scalar::Int32 ||
writeType_ == Scalar::Uint32;
}
bool isFloatWrite() const {
return writeType_ == Scalar::Float32 ||
writeType_ == Scalar::Float64;
}
bool isSimdWrite() const {
return Scalar::isSimdType(writeType());
}
};
class MStoreTypedArrayElement
: public MTernaryInstruction,
public StoreTypedArrayBase,
public StoreTypedArrayPolicy::Data
{
Scalar::Type arrayType_;
Scalar::Type writeType_;
bool requiresBarrier_;
int32_t offsetAdjustment_;
@ -9118,8 +9078,8 @@ class MStoreTypedArrayElement
Scalar::Type arrayType, MemoryBarrierRequirement requiresBarrier,
int32_t offsetAdjustment)
: MTernaryInstruction(elements, index, value),
StoreTypedArrayBase(arrayType),
arrayType_(arrayType),
writeType_(arrayType),
requiresBarrier_(requiresBarrier == DoesRequireMemoryBarrier),
offsetAdjustment_(offsetAdjustment),
racy_(false)
@ -9145,9 +9105,27 @@ class MStoreTypedArrayElement
requiresBarrier, offsetAdjustment);
}
void setWriteType(Scalar::Type type) {
writeType_ = type;
}
Scalar::Type writeType() const {
return writeType_;
}
Scalar::Type arrayType() const {
return arrayType_;
}
bool isSimdWrite() const {
return Scalar::isSimdType(writeType());
}
bool isByteArray() const {
return arrayType_ == Scalar::Int8 ||
arrayType_ == Scalar::Uint8 ||
arrayType_ == Scalar::Uint8Clamped;
}
bool isFloatArray() const {
return arrayType_ == Scalar::Float32 ||
arrayType_ == Scalar::Float64;
}
MDefinition *elements() const {
return getOperand(0);
}
@ -9183,13 +9161,13 @@ class MStoreTypedArrayElement
class MStoreTypedArrayElementHole
: public MAryInstruction<4>,
public StoreTypedArrayBase,
public StoreTypedArrayHolePolicy::Data
{
Scalar::Type arrayType_;
MStoreTypedArrayElementHole(MDefinition *elements, MDefinition *length, MDefinition *index,
MDefinition *value, Scalar::Type arrayType)
: MAryInstruction<4>(),
StoreTypedArrayBase(arrayType)
: MAryInstruction<4>(), arrayType_(arrayType)
{
initOperand(0, elements);
initOperand(1, length);
@ -9213,9 +9191,16 @@ class MStoreTypedArrayElementHole
}
Scalar::Type arrayType() const {
MOZ_ASSERT(!Scalar::isSimdType(writeType()),
"arrayType == writeType iff the write type isn't SIMD");
return writeType();
return arrayType_;
}
bool isByteArray() const {
return arrayType_ == Scalar::Int8 ||
arrayType_ == Scalar::Uint8 ||
arrayType_ == Scalar::Uint8Clamped;
}
bool isFloatArray() const {
return arrayType_ == Scalar::Float32 ||
arrayType_ == Scalar::Float64;
}
MDefinition *elements() const {
return getOperand(0);
@ -9235,7 +9220,7 @@ class MStoreTypedArrayElementHole
TruncateKind operandTruncateKind(size_t index) const MOZ_OVERRIDE;
bool canConsumeFloat32(MUse *use) const MOZ_OVERRIDE {
return use == getUseFor(3) && arrayType() == Scalar::Float32;
return use == getUseFor(3) && arrayType_ == Scalar::Float32;
}
ALLOW_CLONE(MStoreTypedArrayElementHole)
@ -9243,20 +9228,16 @@ class MStoreTypedArrayElementHole
// Store a value infallibly to a statically known typed array.
class MStoreTypedArrayElementStatic :
public MBinaryInstruction,
public StoreTypedArrayBase,
public StoreTypedArrayElementStaticPolicy::Data
public MBinaryInstruction
, public StoreTypedArrayElementStaticPolicy::Data
{
MStoreTypedArrayElementStatic(JSObject *someTypedArray, MDefinition *ptr, MDefinition *v,
int32_t offset, bool needsBoundsCheck)
: MBinaryInstruction(ptr, v),
StoreTypedArrayBase(AnyTypedArrayType(someTypedArray_)),
someTypedArray_(someTypedArray),
: MBinaryInstruction(ptr, v), someTypedArray_(someTypedArray),
offset_(offset), needsBoundsCheck_(needsBoundsCheck)
{}
AlwaysTenured<JSObject*> someTypedArray_;
// An offset to be encoded in the store instruction - taking advantage of the
// addressing modes. This is only non-zero when the access is proven to be
// within bounds.
@ -9276,7 +9257,11 @@ class MStoreTypedArrayElementStatic :
}
Scalar::Type accessType() const {
return writeType();
return AnyTypedArrayType(someTypedArray_);
}
bool isFloatArray() const {
return accessType() == Scalar::Float32 ||
accessType() == Scalar::Float64;
}
void *base() const;

View File

@ -2645,21 +2645,21 @@ MDefinition::TruncateKind
MStoreTypedArrayElement::operandTruncateKind(size_t index) const
{
// An integer store truncates the stored value.
return index == 2 && isIntegerWrite() ? Truncate : NoTruncate;
return index == 2 && !isFloatArray() && !isSimdWrite() ? Truncate : NoTruncate;
}
MDefinition::TruncateKind
MStoreTypedArrayElementHole::operandTruncateKind(size_t index) const
{
// An integer store truncates the stored value.
return index == 3 && isIntegerWrite() ? Truncate : NoTruncate;
return index == 3 && !isFloatArray() ? Truncate : NoTruncate;
}
MDefinition::TruncateKind
MStoreTypedArrayElementStatic::operandTruncateKind(size_t index) const
{
// An integer store truncates the stored value.
return index == 1 && isIntegerWrite() ? Truncate : NoTruncate;
return index == 1 && !isFloatArray() ? Truncate : NoTruncate;
}
MDefinition::TruncateKind