Bug 1637220 - Split up StoreTypedElement. r=jandem

Differential Revision: https://phabricator.services.mozilla.com/D74916
This commit is contained in:
Tom Schuster 2020-05-13 11:44:04 +00:00
parent 902fe4e975
commit dc0eb4eac9
4 changed files with 43 additions and 8 deletions

View File

@ -4042,8 +4042,14 @@ AttachDecision SetPropIRGenerator::tryAttachSetTypedElement(
OperandId rhsValId = emitNumericGuard(rhsId, elementType);
writer.storeTypedElement(objId, layout, elementType, indexId, rhsValId,
handleOutOfBounds);
if (layout == TypedThingLayout::TypedArray) {
writer.storeTypedArrayElement(objId, elementType, indexId, rhsValId,
handleOutOfBounds);
} else {
MOZ_ASSERT(!handleOutOfBounds);
writer.storeTypedObjectElement(objId, layout, elementType, indexId,
rhsValId);
}
writer.returnFromIC();
if (handleOutOfBounds) {
@ -4065,7 +4071,6 @@ AttachDecision SetPropIRGenerator::tryAttachSetTypedArrayElementNonInt32Index(
}
Scalar::Type elementType = TypedThingElementType(obj);
TypedThingLayout layout = GetTypedThingLayout(obj->getClass());
// Don't attach if the input type doesn't match the guard added below.
if (Scalar::isBigIntType(elementType)) {
@ -4089,8 +4094,8 @@ AttachDecision SetPropIRGenerator::tryAttachSetTypedArrayElementNonInt32Index(
// can be out-of-bounds.
bool handleOutOfBounds = true;
writer.storeTypedElement(objId, layout, elementType, indexId, rhsValId,
handleOutOfBounds);
writer.storeTypedArrayElement(objId, elementType, indexId, rhsValId,
handleOutOfBounds);
writer.returnFromIC();
attachedTypedArrayOOBStub_ = true;

View File

@ -3774,6 +3774,24 @@ bool CacheIRCompiler::emitStoreTypedElement(ObjOperandId objId,
return true;
}
bool CacheIRCompiler::emitStoreTypedArrayElement(ObjOperandId objId,
Scalar::Type elementType,
Int32OperandId indexId,
uint32_t rhsId,
bool handleOOB) {
return emitStoreTypedElement(objId, TypedThingLayout::TypedArray, elementType,
indexId, rhsId, handleOOB);
}
bool CacheIRCompiler::emitStoreTypedObjectElement(ObjOperandId objId,
TypedThingLayout layout,
Scalar::Type elementType,
Int32OperandId indexId,
uint32_t rhsId) {
return emitStoreTypedElement(objId, layout, elementType, indexId, rhsId,
false);
}
static bool CanNurseryAllocateBigInt(JSContext* cx) {
JS::Zone* zone = cx->zone();
return zone->runtimeFromAnyThread()->gc.nursery().canAllocateBigInts() &&
@ -3935,7 +3953,6 @@ bool CacheIRCompiler::emitLoadTypedElementResult(ObjOperandId objId,
bool CacheIRCompiler::emitLoadTypedArrayElementResult(ObjOperandId objId,
Int32OperandId indexId,
Scalar::Type elementType,
bool handleOOB) {
return emitLoadTypedElementResult(

View File

@ -719,6 +719,10 @@ class MOZ_RAII CacheIRCompiler {
TypedThingLayout layout,
Scalar::Type elementType, bool handleOOB);
bool emitStoreTypedElement(ObjOperandId objId, TypedThingLayout layout,
Scalar::Type elementType, Int32OperandId indexId,
uint32_t rhsId, bool handleOOB);
void emitStoreTypedObjectReferenceProp(ValueOperand val, ReferenceType type,
const Address& dest, Register scratch);

View File

@ -663,7 +663,17 @@
args:
obj: ObjId
- name: StoreTypedElement
- name: StoreTypedArrayElement
shared: true
transpile: false
args:
obj: ObjId
elementType: ScalarTypeImm
index: Int32Id
rhs: RawId
handleOOB: BoolImm
- name: StoreTypedObjectElement
shared: true
transpile: false
args:
@ -672,7 +682,6 @@
elementType: ScalarTypeImm
index: Int32Id
rhs: RawId
handleOOB: BoolImm
- name: CallNativeSetter
shared: false