зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1166700 - Tolerate null failures targets when storing to an unboxed object must fail, r=jandem.
This commit is contained in:
Родитель
39c4e2667f
Коммит
a89b8ff96b
|
@ -888,6 +888,20 @@ template void
|
|||
MacroAssembler::loadUnboxedProperty(BaseIndex address, JSValueType type,
|
||||
TypedOrValueRegister output);
|
||||
|
||||
static void
|
||||
StoreUnboxedFailure(MacroAssembler& masm, Label* failure)
|
||||
{
|
||||
// Storing a value to an unboxed property is a fallible operation and
|
||||
// the caller must provide a failure label if a particular unboxed store
|
||||
// might fail. Sometimes, however, a store that cannot succeed (such as
|
||||
// storing a string to an int32 property) will be marked as infallible.
|
||||
// This can only happen if the code involved is unreachable.
|
||||
if (failure)
|
||||
masm.jump(failure);
|
||||
else
|
||||
masm.assumeUnreachable("Incompatible write to unboxed property");
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void
|
||||
MacroAssembler::storeUnboxedProperty(T address, JSValueType type,
|
||||
|
@ -899,12 +913,12 @@ MacroAssembler::storeUnboxedProperty(T address, JSValueType type,
|
|||
if (value.value().isBoolean())
|
||||
store8(Imm32(value.value().toBoolean()), address);
|
||||
else
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
} else if (value.reg().hasTyped()) {
|
||||
if (value.reg().type() == MIRType_Boolean)
|
||||
store8(value.reg().typedReg().gpr(), address);
|
||||
else
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
} else {
|
||||
if (failure)
|
||||
branchTestBoolean(Assembler::NotEqual, value.reg().valueReg(), failure);
|
||||
|
@ -917,12 +931,12 @@ MacroAssembler::storeUnboxedProperty(T address, JSValueType type,
|
|||
if (value.value().isInt32())
|
||||
store32(Imm32(value.value().toInt32()), address);
|
||||
else
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
} else if (value.reg().hasTyped()) {
|
||||
if (value.reg().type() == MIRType_Int32)
|
||||
store32(value.reg().typedReg().gpr(), address);
|
||||
else
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
} else {
|
||||
if (failure)
|
||||
branchTestInt32(Assembler::NotEqual, value.reg().valueReg(), failure);
|
||||
|
@ -936,7 +950,7 @@ MacroAssembler::storeUnboxedProperty(T address, JSValueType type,
|
|||
loadConstantDouble(value.value().toNumber(), ScratchDoubleReg);
|
||||
storeDouble(ScratchDoubleReg, address);
|
||||
} else {
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
}
|
||||
} else if (value.reg().hasTyped()) {
|
||||
if (value.reg().type() == MIRType_Int32) {
|
||||
|
@ -945,7 +959,7 @@ MacroAssembler::storeUnboxedProperty(T address, JSValueType type,
|
|||
} else if (value.reg().type() == MIRType_Double) {
|
||||
storeDouble(value.reg().typedReg().fpu(), address);
|
||||
} else {
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
}
|
||||
} else {
|
||||
ValueOperand reg = value.reg().valueReg();
|
||||
|
@ -967,13 +981,13 @@ MacroAssembler::storeUnboxedProperty(T address, JSValueType type,
|
|||
if (value.value().isObjectOrNull())
|
||||
storePtr(ImmGCPtr(value.value().toObjectOrNull()), address);
|
||||
else
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
} else if (value.reg().hasTyped()) {
|
||||
MOZ_ASSERT(value.reg().type() != MIRType_Null);
|
||||
if (value.reg().type() == MIRType_Object)
|
||||
storePtr(value.reg().typedReg().gpr(), address);
|
||||
else
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
} else {
|
||||
if (failure) {
|
||||
Label ok;
|
||||
|
@ -990,12 +1004,12 @@ MacroAssembler::storeUnboxedProperty(T address, JSValueType type,
|
|||
if (value.value().isString())
|
||||
storePtr(ImmGCPtr(value.value().toString()), address);
|
||||
else
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
} else if (value.reg().hasTyped()) {
|
||||
if (value.reg().type() == MIRType_String)
|
||||
storePtr(value.reg().typedReg().gpr(), address);
|
||||
else
|
||||
jump(failure);
|
||||
StoreUnboxedFailure(*this, failure);
|
||||
} else {
|
||||
if (failure)
|
||||
branchTestString(Assembler::NotEqual, value.reg().valueReg(), failure);
|
||||
|
|
Загрузка…
Ссылка в новой задаче