Bug 1544386 part 1 - Call ElementAccessHasExtraIndexedProperty instead of ArrayPrototypeHasIndexedProperty when inlining array natives. r=tcampbell

This simplifies the code a bit because ElementAccessHasExtraIndexedProperty
checks for length-overflow and sparse-indexes so the callers don't have to
do that anymore.

Differential Revision: https://phabricator.services.mozilla.com/D29486

--HG--
extra : moz-landing-system : lando
This commit is contained in:
Jan de Mooij 2019-05-08 17:48:26 +00:00
Родитель 7b96f9e12f
Коммит 532113a26a
3 изменённых файлов: 5 добавлений и 28 удалений

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

@ -927,9 +927,10 @@ IonBuilder::InliningResult IonBuilder::inlineArrayPopShift(
return InliningStatus_NotInlined;
}
// Watch out for extra indexed properties on the object or its prototype.
bool hasIndexedProperty;
MOZ_TRY_VAR(hasIndexedProperty,
ArrayPrototypeHasIndexedProperty(this, script()));
ElementAccessHasExtraIndexedProperty(this, obj));
if (hasIndexedProperty) {
trackOptimizationOutcome(TrackedOutcome::ProtoIndexedProps);
return InliningStatus_NotInlined;
@ -1046,16 +1047,10 @@ IonBuilder::InliningResult IonBuilder::inlineArrayPush(CallInfo& callInfo) {
if (clasp != &ArrayObject::class_) {
return InliningStatus_NotInlined;
}
if (thisTypes->hasObjectFlags(
constraints(),
OBJECT_FLAG_SPARSE_INDEXES | OBJECT_FLAG_LENGTH_OVERFLOW)) {
trackOptimizationOutcome(TrackedOutcome::ArrayBadFlags);
return InliningStatus_NotInlined;
}
bool hasIndexedProperty;
MOZ_TRY_VAR(hasIndexedProperty,
ArrayPrototypeHasIndexedProperty(this, script()));
ElementAccessHasExtraIndexedProperty(this, obj));
if (hasIndexedProperty) {
trackOptimizationOutcome(TrackedOutcome::ProtoIndexedProps);
return InliningStatus_NotInlined;
@ -1183,17 +1178,11 @@ IonBuilder::InliningResult IonBuilder::inlineArraySlice(CallInfo& callInfo) {
if (clasp != &ArrayObject::class_) {
return InliningStatus_NotInlined;
}
if (thisTypes->hasObjectFlags(
constraints(),
OBJECT_FLAG_SPARSE_INDEXES | OBJECT_FLAG_LENGTH_OVERFLOW)) {
trackOptimizationOutcome(TrackedOutcome::ArrayBadFlags);
return InliningStatus_NotInlined;
}
// Watch out for indexed properties on the prototype.
// Watch out for extra indexed properties on the object or its prototype.
bool hasIndexedProperty;
MOZ_TRY_VAR(hasIndexedProperty,
ArrayPrototypeHasIndexedProperty(this, script()));
ElementAccessHasExtraIndexedProperty(this, obj));
if (hasIndexedProperty) {
trackOptimizationOutcome(TrackedOutcome::ProtoIndexedProps);
return InliningStatus_NotInlined;

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

@ -5972,16 +5972,6 @@ AbortReasonOr<bool> PrototypeHasIndexedProperty(IonBuilder* builder,
return false;
}
// Whether Array.prototype, or an object on its proto chain, has an indexed
// property.
AbortReasonOr<bool> jit::ArrayPrototypeHasIndexedProperty(IonBuilder* builder,
JSScript* script) {
if (JSObject* proto = script->global().maybeGetArrayPrototype()) {
return PrototypeHasIndexedProperty(builder, proto);
}
return true;
}
// Whether obj or any of its prototypes have an indexed property.
AbortReasonOr<bool> jit::TypeCanHaveExtraIndexedProperties(
IonBuilder* builder, TemporaryTypeSet* types) {

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

@ -12143,8 +12143,6 @@ bool PropertyWriteNeedsTypeBarrier(TempAllocator& alloc,
PropertyName* name, MDefinition** pvalue,
bool canModify,
MIRType implicitType = MIRType::None);
AbortReasonOr<bool> ArrayPrototypeHasIndexedProperty(IonBuilder* builder,
JSScript* script);
AbortReasonOr<bool> TypeCanHaveExtraIndexedProperties(IonBuilder* builder,
TemporaryTypeSet* types);