Bug 1383645 - Allow to inline UnsafeGetReservedSlot when the object is typed as MIRType::Value. r=jandem

--HG--
extra : rebase_source : add4c452e0a6c11c79a5667107db1dcdfa07de9a
extra : histedit_source : 4d8eab6953cca1ee91bf78a4a7aadb37aaacc73b
This commit is contained in:
André Bargull 2017-07-28 13:01:01 -07:00
parent c520c1cf95
commit abbfb48e01

View File

@ -2765,13 +2765,16 @@ IonBuilder::inlineUnsafeSetReservedSlot(CallInfo& callInfo)
}
if (getInlineReturnType() != MIRType::Undefined)
return InliningStatus_NotInlined;
if (callInfo.getArg(0)->type() != MIRType::Object)
MDefinition* obj = callInfo.getArg(0);
if (obj->type() != MIRType::Object && obj->type() != MIRType::Value)
return InliningStatus_NotInlined;
if (callInfo.getArg(1)->type() != MIRType::Int32)
MDefinition* arg = callInfo.getArg(1);
if (arg->type() != MIRType::Int32)
return InliningStatus_NotInlined;
// Don't inline if we don't have a constant slot.
MDefinition* arg = callInfo.getArg(1);
if (!arg->isConstant())
return InliningStatus_NotInlined;
uint32_t slot = uint32_t(arg->toConstant()->toInt32());
@ -2779,12 +2782,12 @@ IonBuilder::inlineUnsafeSetReservedSlot(CallInfo& callInfo)
callInfo.setImplicitlyUsedUnchecked();
MStoreFixedSlot* store =
MStoreFixedSlot::NewBarriered(alloc(), callInfo.getArg(0), slot, callInfo.getArg(2));
MStoreFixedSlot::NewBarriered(alloc(), obj, slot, callInfo.getArg(2));
current->add(store);
current->push(store);
if (NeedsPostBarrier(callInfo.getArg(2)))
current->add(MPostWriteBarrier::New(alloc(), callInfo.getArg(0), callInfo.getArg(2)));
current->add(MPostWriteBarrier::New(alloc(), obj, callInfo.getArg(2)));
return InliningStatus_Inlined;
}
@ -2796,20 +2799,23 @@ IonBuilder::inlineUnsafeGetReservedSlot(CallInfo& callInfo, MIRType knownValueTy
trackOptimizationOutcome(TrackedOutcome::CantInlineNativeBadForm);
return InliningStatus_NotInlined;
}
if (callInfo.getArg(0)->type() != MIRType::Object)
MDefinition* obj = callInfo.getArg(0);
if (obj->type() != MIRType::Object && obj->type() != MIRType::Value)
return InliningStatus_NotInlined;
if (callInfo.getArg(1)->type() != MIRType::Int32)
MDefinition* arg = callInfo.getArg(1);
if (arg->type() != MIRType::Int32)
return InliningStatus_NotInlined;
// Don't inline if we don't have a constant slot.
MDefinition* arg = callInfo.getArg(1);
if (!arg->isConstant())
return InliningStatus_NotInlined;
uint32_t slot = uint32_t(arg->toConstant()->toInt32());
callInfo.setImplicitlyUsedUnchecked();
MLoadFixedSlot* load = MLoadFixedSlot::New(alloc(), callInfo.getArg(0), slot);
MLoadFixedSlot* load = MLoadFixedSlot::New(alloc(), obj, slot);
current->add(load);
current->push(load);
if (knownValueType != MIRType::Value) {