Bug 1632672 - Optimize OOB accesses with int32 index better for typed arrays. r=anba

Without type monitoring we can more easily support this now.

Differential Revision: https://phabricator.services.mozilla.com/D100764
This commit is contained in:
Jan de Mooij 2021-01-06 11:13:44 +00:00
Родитель d6a13bfdd2
Коммит 43ad95caa8
1 изменённых файлов: 2 добавлений и 10 удалений

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

@ -2331,19 +2331,11 @@ AttachDecision GetPropIRGenerator::tryAttachTypedArrayElement(
}
TypedArrayObject* tarr = &obj->as<TypedArrayObject>();
// Ensure the index is in-bounds so the element type gets monitored.
if (index >= tarr->length().get()) {
return AttachDecision::NoAction;
}
writer.guardShapeForClass(objId, tarr->shape());
// Don't handle out-of-bounds accesses here because we have to ensure the
// |undefined| type is monitored. See also tryAttachTypedArrayNonInt32Index.
// TODO(no-TI): Monitoring?
bool handleOOB = index >= tarr->length().get();
bool allowDoubleForUint32 = AllowDoubleForUint32Array(tarr, index);
writer.loadTypedArrayElementResult(objId, indexId, tarr->type(),
/* handleOOB = */ false,
writer.loadTypedArrayElementResult(objId, indexId, tarr->type(), handleOOB,
allowDoubleForUint32);
writer.returnFromIC();