mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-27 04:05:32 +00:00
Bug 1404636 - Special-case typed arrays in PropertyReadNeedsTypeBarrier. r=bhackett
This commit is contained in:
parent
e82be8f70e
commit
ab7b5f6697
@ -7806,9 +7806,6 @@ IonBuilder::getElemTryTypedObject(bool* emitted, MDefinition* obj, MDefinition*
|
||||
MOZ_CRASH("Bad kind");
|
||||
}
|
||||
|
||||
static MIRType
|
||||
MIRTypeForTypedArrayRead(Scalar::Type arrayType, bool observedDouble);
|
||||
|
||||
bool
|
||||
IonBuilder::checkTypedObjectIndexInBounds(uint32_t elemSize,
|
||||
MDefinition* obj,
|
||||
@ -8764,29 +8761,6 @@ IonBuilder::convertShiftToMaskForStaticTypedArray(MDefinition* id,
|
||||
return ptr;
|
||||
}
|
||||
|
||||
static MIRType
|
||||
MIRTypeForTypedArrayRead(Scalar::Type arrayType, bool observedDouble)
|
||||
{
|
||||
switch (arrayType) {
|
||||
case Scalar::Int8:
|
||||
case Scalar::Uint8:
|
||||
case Scalar::Uint8Clamped:
|
||||
case Scalar::Int16:
|
||||
case Scalar::Uint16:
|
||||
case Scalar::Int32:
|
||||
return MIRType::Int32;
|
||||
case Scalar::Uint32:
|
||||
return observedDouble ? MIRType::Double : MIRType::Int32;
|
||||
case Scalar::Float32:
|
||||
return MIRType::Float32;
|
||||
case Scalar::Float64:
|
||||
return MIRType::Double;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
MOZ_CRASH("Unknown typed array type");
|
||||
}
|
||||
|
||||
AbortReasonOr<Ok>
|
||||
IonBuilder::jsop_getelem_typed(MDefinition* obj, MDefinition* index,
|
||||
Scalar::Type arrayType)
|
||||
|
@ -6193,6 +6193,14 @@ PropertyReadNeedsTypeBarrier(CompilerConstraintList* constraints,
|
||||
return BarrierKind::TypeSet;
|
||||
}
|
||||
|
||||
if (!name && IsTypedArrayClass(key->clasp())) {
|
||||
Scalar::Type arrayType = Scalar::Type(key->clasp() - &TypedArrayObject::classes[0]);
|
||||
MIRType type = MIRTypeForTypedArrayRead(arrayType, true);
|
||||
if (observed->mightBeMIRType(type))
|
||||
return BarrierKind::NoBarrier;
|
||||
return BarrierKind::TypeSet;
|
||||
}
|
||||
|
||||
jsid id = name ? NameToId(name) : JSID_VOID;
|
||||
HeapTypeSetKey property = key->property(id);
|
||||
if (property.maybeTypes()) {
|
||||
|
@ -15002,6 +15002,29 @@ ArrayPrototypeHasIndexedProperty(IonBuilder* builder, JSScript* script);
|
||||
AbortReasonOr<bool>
|
||||
TypeCanHaveExtraIndexedProperties(IonBuilder* builder, TemporaryTypeSet* types);
|
||||
|
||||
inline MIRType
|
||||
MIRTypeForTypedArrayRead(Scalar::Type arrayType, bool observedDouble)
|
||||
{
|
||||
switch (arrayType) {
|
||||
case Scalar::Int8:
|
||||
case Scalar::Uint8:
|
||||
case Scalar::Uint8Clamped:
|
||||
case Scalar::Int16:
|
||||
case Scalar::Uint16:
|
||||
case Scalar::Int32:
|
||||
return MIRType::Int32;
|
||||
case Scalar::Uint32:
|
||||
return observedDouble ? MIRType::Double : MIRType::Int32;
|
||||
case Scalar::Float32:
|
||||
return MIRType::Float32;
|
||||
case Scalar::Float64:
|
||||
return MIRType::Double;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
MOZ_CRASH("Unknown typed array type");
|
||||
}
|
||||
|
||||
} // namespace jit
|
||||
} // namespace js
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user