mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 854400 - Convert typed array store code to reuse jsop_setelem_typed r=bhackett
This commit is contained in:
parent
cdc6685302
commit
53716ec656
@ -6510,7 +6510,8 @@ IonBuilder::jsop_setelem()
|
|||||||
|
|
||||||
int arrayType = TypedArray::TYPE_MAX;
|
int arrayType = TypedArray::TYPE_MAX;
|
||||||
if (ElementAccessIsTypedArray(object, index, &arrayType))
|
if (ElementAccessIsTypedArray(object, index, &arrayType))
|
||||||
return jsop_setelem_typed(arrayType, object, index, value);
|
return jsop_setelem_typed(arrayType, SetElem_Normal,
|
||||||
|
object, index, value);
|
||||||
|
|
||||||
if (!PropertyWriteNeedsTypeBarrier(cx, current, &object, NULL, &value)) {
|
if (!PropertyWriteNeedsTypeBarrier(cx, current, &object, NULL, &value)) {
|
||||||
if (ElementAccessIsDenseNative(object, index)) {
|
if (ElementAccessIsDenseNative(object, index)) {
|
||||||
@ -6651,6 +6652,7 @@ IonBuilder::jsop_setelem_typed_static(MDefinition *obj, MDefinition *id, MDefini
|
|||||||
|
|
||||||
bool
|
bool
|
||||||
IonBuilder::jsop_setelem_typed(int arrayType,
|
IonBuilder::jsop_setelem_typed(int arrayType,
|
||||||
|
SetElemSafety safety,
|
||||||
MDefinition *obj, MDefinition *id, MDefinition *value)
|
MDefinition *obj, MDefinition *id, MDefinition *value)
|
||||||
{
|
{
|
||||||
bool staticAccess = false;
|
bool staticAccess = false;
|
||||||
@ -6659,8 +6661,14 @@ IonBuilder::jsop_setelem_typed(int arrayType,
|
|||||||
if (staticAccess)
|
if (staticAccess)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
SetElemICInspector icInspect(inspector->setElemICInspector(pc));
|
bool expectOOB;
|
||||||
bool expectOOB = icInspect.sawOOBTypedArrayWrite();
|
if (safety == SetElem_Normal) {
|
||||||
|
SetElemICInspector icInspect(inspector->setElemICInspector(pc));
|
||||||
|
expectOOB = icInspect.sawOOBTypedArrayWrite();
|
||||||
|
} else {
|
||||||
|
expectOOB = false;
|
||||||
|
}
|
||||||
|
|
||||||
if (expectOOB)
|
if (expectOOB)
|
||||||
spew("Emitting OOB TypedArray SetElem");
|
spew("Emitting OOB TypedArray SetElem");
|
||||||
|
|
||||||
@ -6673,7 +6681,7 @@ IonBuilder::jsop_setelem_typed(int arrayType,
|
|||||||
MInstruction *length = getTypedArrayLength(obj);
|
MInstruction *length = getTypedArrayLength(obj);
|
||||||
current->add(length);
|
current->add(length);
|
||||||
|
|
||||||
if (!expectOOB) {
|
if (!expectOOB && safety == SetElem_Normal) {
|
||||||
// Bounds check.
|
// Bounds check.
|
||||||
id = addBoundsCheck(id, length);
|
id = addBoundsCheck(id, length);
|
||||||
}
|
}
|
||||||
@ -6696,7 +6704,10 @@ IonBuilder::jsop_setelem_typed(int arrayType,
|
|||||||
else
|
else
|
||||||
ins = MStoreTypedArrayElement::New(elements, id, toWrite, arrayType);
|
ins = MStoreTypedArrayElement::New(elements, id, toWrite, arrayType);
|
||||||
current->add(ins);
|
current->add(ins);
|
||||||
current->push(value);
|
|
||||||
|
if (safety == SetElem_Normal)
|
||||||
|
current->push(value);
|
||||||
|
|
||||||
return resumeAfter(ins);
|
return resumeAfter(ins);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -385,6 +385,7 @@ class IonBuilder : public MIRGenerator
|
|||||||
bool jsop_setelem_dense(types::StackTypeSet::DoubleConversion conversion,
|
bool jsop_setelem_dense(types::StackTypeSet::DoubleConversion conversion,
|
||||||
MDefinition *object, MDefinition *index, MDefinition *value);
|
MDefinition *object, MDefinition *index, MDefinition *value);
|
||||||
bool jsop_setelem_typed(int arrayType,
|
bool jsop_setelem_typed(int arrayType,
|
||||||
|
SetElemSafety safety,
|
||||||
MDefinition *object, MDefinition *index, MDefinition *value);
|
MDefinition *object, MDefinition *index, MDefinition *value);
|
||||||
bool jsop_setelem_typed_static(MDefinition *object, MDefinition *index, MDefinition *value,
|
bool jsop_setelem_typed_static(MDefinition *object, MDefinition *index, MDefinition *value,
|
||||||
bool *psucceeded);
|
bool *psucceeded);
|
||||||
|
@ -1034,28 +1034,11 @@ IonBuilder::inlineUnsafeSetTypedArrayElement(CallInfo &callInfo,
|
|||||||
// - arr is a typed array
|
// - arr is a typed array
|
||||||
// - idx < length
|
// - idx < length
|
||||||
|
|
||||||
uint32_t arri = base + 0;
|
MDefinition *obj = callInfo.getArg(base + 0);
|
||||||
uint32_t idxi = base + 1;
|
MDefinition *id = callInfo.getArg(base + 1);
|
||||||
uint32_t elemi = base + 2;
|
MDefinition *elem = callInfo.getArg(base + 2);
|
||||||
|
|
||||||
MInstruction *elements = getTypedArrayElements(callInfo.getArg(arri));
|
if (!jsop_setelem_typed(arrayType, SetElem_Unsafe, obj, id, elem))
|
||||||
current->add(elements);
|
|
||||||
|
|
||||||
MToInt32 *id = MToInt32::New(callInfo.getArg(idxi));
|
|
||||||
current->add(id);
|
|
||||||
|
|
||||||
MDefinition *value = callInfo.getArg(elemi);
|
|
||||||
if (arrayType == TypedArray::TYPE_UINT8_CLAMPED) {
|
|
||||||
value = MClampToUint8::New(value);
|
|
||||||
current->add(value->toInstruction());
|
|
||||||
}
|
|
||||||
|
|
||||||
MStoreTypedArrayElement *store = MStoreTypedArrayElement::New(elements, id, value, arrayType);
|
|
||||||
store->setRacy();
|
|
||||||
|
|
||||||
current->add(store);
|
|
||||||
|
|
||||||
if (!resumeAfter(store))
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
Loading…
Reference in New Issue
Block a user