mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1850305 part 3 - Add an assertion. r=iain
This would catch similar issues in the future and is a nice invariant to maintain. Differential Revision: https://phabricator.services.mozilla.com/D187266
This commit is contained in:
parent
7831d3edd1
commit
635571ffcb
@ -43,6 +43,25 @@ template <class T>
|
||||
return replace->typePolicy()->adjustInputs(alloc, replace);
|
||||
}
|
||||
|
||||
static void SetTypePolicyBailoutKind(MInstruction* newIns,
|
||||
MInstruction* forIns) {
|
||||
// Infallible ToFloat32 doesn't bail out.
|
||||
if (newIns->isToFloat32() && !newIns->isGuard()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Ensure we're not introducing TypePolicy bailouts for transpiled CacheIR
|
||||
// instructions. Unbox operations and other guards should have been inserted
|
||||
// by the transpiler.
|
||||
//
|
||||
// This avoids a performance cliff because frequent TypePolicy bailouts will
|
||||
// disable Warp compilation instead of invalidating the script.
|
||||
// See bug 1850305.
|
||||
MOZ_ASSERT(forIns->bailoutKind() != BailoutKind::TranspiledCacheIR);
|
||||
|
||||
newIns->setBailoutKind(BailoutKind::TypePolicy);
|
||||
}
|
||||
|
||||
[[nodiscard]] static bool UnboxOperand(TempAllocator& alloc, MInstruction* def,
|
||||
unsigned op, MIRType expected) {
|
||||
MDefinition* in = def->getOperand(op);
|
||||
@ -51,7 +70,7 @@ template <class T>
|
||||
}
|
||||
|
||||
auto* replace = MUnbox::New(alloc, in, expected, MUnbox::Fallible);
|
||||
replace->setBailoutKind(BailoutKind::TypePolicy);
|
||||
SetTypePolicyBailoutKind(replace, def);
|
||||
def->block()->insertBefore(def, replace);
|
||||
def->replaceOperand(op, replace);
|
||||
|
||||
@ -113,7 +132,7 @@ bool ArithPolicy::adjustInputs(TempAllocator& alloc, MInstruction* ins) const {
|
||||
replace = MToNumberInt32::New(alloc, in);
|
||||
}
|
||||
|
||||
replace->setBailoutKind(BailoutKind::TypePolicy);
|
||||
SetTypePolicyBailoutKind(replace, ins);
|
||||
ins->block()->insertBefore(ins, replace);
|
||||
ins->replaceOperand(i, replace);
|
||||
|
||||
@ -819,7 +838,7 @@ bool CallPolicy::adjustInputs(TempAllocator& alloc, MInstruction* ins) const {
|
||||
if (func->type() != MIRType::Object) {
|
||||
MInstruction* unbox =
|
||||
MUnbox::New(alloc, func, MIRType::Object, MUnbox::Fallible);
|
||||
unbox->setBailoutKind(BailoutKind::TypePolicy);
|
||||
SetTypePolicyBailoutKind(unbox, call);
|
||||
call->block()->insertBefore(call, unbox);
|
||||
call->replaceCallee(unbox);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user