mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 19:04:45 +00:00
Bug 1649381 part 2 - Use MacroAssembler::guardSpecificAtom for LGuardSpecificAtom. r=evilpie
Depends on D81661 Differential Revision: https://phabricator.services.mozilla.com/D81662
This commit is contained in:
parent
2a7265b269
commit
324ef940d6
@ -4436,19 +4436,15 @@ void CodeGenerator::visitGuardSpecificFunction(LGuardSpecificFunction* guard) {
|
||||
|
||||
void CodeGenerator::visitGuardSpecificAtom(LGuardSpecificAtom* guard) {
|
||||
Register str = ToRegister(guard->str());
|
||||
Register scratch = ToRegister(guard->temp());
|
||||
|
||||
Label done;
|
||||
masm.branchPtr(Assembler::Equal, str, ImmGCPtr(guard->mir()->atom()), &done);
|
||||
LiveRegisterSet volatileRegs = liveVolatileRegs(guard);
|
||||
volatileRegs.takeUnchecked(scratch);
|
||||
|
||||
// The pointers are not equal, so if the input string is also an atom it
|
||||
// must be a different string.
|
||||
bailoutTest32(Assembler::NonZero, Address(str, JSString::offsetOfFlags()),
|
||||
Imm32(JSString::ATOM_BIT), guard->snapshot());
|
||||
|
||||
// Todo: Check length + VM fallback.
|
||||
bailout(guard->snapshot());
|
||||
|
||||
masm.bind(&done);
|
||||
Label bail;
|
||||
masm.guardSpecificAtom(str, guard->mir()->atom(), scratch, volatileRegs,
|
||||
&bail);
|
||||
bailoutFrom(&bail, guard->snapshot());
|
||||
}
|
||||
|
||||
void CodeGenerator::visitGuardSpecificSymbol(LGuardSpecificSymbol* guard) {
|
||||
|
@ -4041,10 +4041,12 @@ void LIRGenerator::visitGuardSpecificFunction(MGuardSpecificFunction* ins) {
|
||||
}
|
||||
|
||||
void LIRGenerator::visitGuardSpecificAtom(MGuardSpecificAtom* ins) {
|
||||
auto* guard = new (alloc()) LGuardSpecificAtom(useRegister(ins->str()));
|
||||
auto* guard =
|
||||
new (alloc()) LGuardSpecificAtom(useRegister(ins->str()), temp());
|
||||
assignSnapshot(guard, Bailout_SpecificAtomGuard);
|
||||
add(guard, ins);
|
||||
redefine(ins, ins->str());
|
||||
assignSafepoint(guard, ins);
|
||||
}
|
||||
|
||||
void LIRGenerator::visitGuardSpecificSymbol(MGuardSpecificSymbol* ins) {
|
||||
|
@ -249,7 +249,6 @@ bool WarpCacheIRTranspiler::emitGuardSpecificAtom(StringOperandId strId,
|
||||
MDefinition* str = getOperand(strId);
|
||||
JSString* expected = stringStubField(expectedOffset);
|
||||
|
||||
// TODO: Improve code-gen.
|
||||
auto* ins = MGuardSpecificAtom::New(alloc(), str, &expected->asAtom());
|
||||
add(ins);
|
||||
|
||||
|
@ -295,21 +295,22 @@ void CodeGeneratorShared::restoreLiveIgnore(LInstruction* ins,
|
||||
masm.PopRegsInMaskIgnore(safepoint->liveRegs(), ignore);
|
||||
}
|
||||
|
||||
void CodeGeneratorShared::saveLiveVolatile(LInstruction* ins) {
|
||||
LiveRegisterSet CodeGeneratorShared::liveVolatileRegs(LInstruction* ins) {
|
||||
MOZ_ASSERT(!ins->isCall());
|
||||
LSafepoint* safepoint = ins->safepoint();
|
||||
LiveRegisterSet regs;
|
||||
regs.set() = RegisterSet::Intersect(safepoint->liveRegs().set(),
|
||||
RegisterSet::Volatile());
|
||||
return regs;
|
||||
}
|
||||
|
||||
void CodeGeneratorShared::saveLiveVolatile(LInstruction* ins) {
|
||||
LiveRegisterSet regs = liveVolatileRegs(ins);
|
||||
masm.PushRegsInMask(regs);
|
||||
}
|
||||
|
||||
void CodeGeneratorShared::restoreLiveVolatile(LInstruction* ins) {
|
||||
MOZ_ASSERT(!ins->isCall());
|
||||
LSafepoint* safepoint = ins->safepoint();
|
||||
LiveRegisterSet regs;
|
||||
regs.set() = RegisterSet::Intersect(safepoint->liveRegs().set(),
|
||||
RegisterSet::Volatile());
|
||||
LiveRegisterSet regs = liveVolatileRegs(ins);
|
||||
masm.PopRegsInMask(regs);
|
||||
}
|
||||
|
||||
|
@ -368,7 +368,8 @@ class CodeGeneratorShared : public LElementVisitor {
|
||||
inline void restoreLive(LInstruction* ins);
|
||||
inline void restoreLiveIgnore(LInstruction* ins, LiveRegisterSet reg);
|
||||
|
||||
// Save/restore all registers that are both live and volatile.
|
||||
// Get/save/restore all registers that are both live and volatile.
|
||||
inline LiveRegisterSet liveVolatileRegs(LInstruction* ins);
|
||||
inline void saveLiveVolatile(LInstruction* ins);
|
||||
inline void restoreLiveVolatile(LInstruction* ins);
|
||||
|
||||
|
@ -6067,15 +6067,18 @@ class LGuardSpecificFunction : public LInstructionHelper<0, 2, 0> {
|
||||
const LAllocation* expected() { return getOperand(1); }
|
||||
};
|
||||
|
||||
class LGuardSpecificAtom : public LInstructionHelper<0, 1, 0> {
|
||||
class LGuardSpecificAtom : public LInstructionHelper<0, 1, 1> {
|
||||
public:
|
||||
LIR_HEADER(GuardSpecificAtom)
|
||||
|
||||
explicit LGuardSpecificAtom(const LAllocation& str)
|
||||
LGuardSpecificAtom(const LAllocation& str, const LDefinition& temp)
|
||||
: LInstructionHelper(classOpcode) {
|
||||
setOperand(0, str);
|
||||
setTemp(0, temp);
|
||||
}
|
||||
const LAllocation* str() { return getOperand(0); }
|
||||
const LDefinition* temp() { return getTemp(0); }
|
||||
|
||||
const MGuardSpecificAtom* mir() const { return mir_->toGuardSpecificAtom(); }
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user