зеркало из https://github.com/mozilla/gecko-dev.git
Bug 988950 - Speed up post barrier checks in Ion r=jandem
This commit is contained in:
Родитель
02fe457dec
Коммит
beb6652b55
|
@ -1826,20 +1826,21 @@ CodeGenerator::visitPostWriteBarrierO(LPostWriteBarrierO *lir)
|
|||
return false;
|
||||
|
||||
const Nursery &nursery = GetIonContext()->runtime->gcNursery();
|
||||
Register temp = ToRegister(lir->temp());
|
||||
|
||||
if (lir->object()->isConstant()) {
|
||||
JS_ASSERT(!nursery.isInside(&lir->object()->toConstant()->toObject()));
|
||||
} else {
|
||||
Label tenured;
|
||||
Register objreg = ToRegister(lir->object());
|
||||
masm.branchPtr(Assembler::Below, objreg, ImmWord(nursery.start()), &tenured);
|
||||
masm.branchPtr(Assembler::Below, objreg, ImmWord(nursery.heapEnd()), ool->rejoin());
|
||||
masm.bind(&tenured);
|
||||
masm.movePtr(ImmWord(-ptrdiff_t(nursery.start())), temp);
|
||||
masm.addPtr(objreg, temp);
|
||||
masm.branchPtr(Assembler::Below, temp, Imm32(Nursery::NurserySize), ool->rejoin());
|
||||
}
|
||||
|
||||
Register valuereg = ToRegister(lir->value());
|
||||
masm.branchPtr(Assembler::Below, valuereg, ImmWord(nursery.start()), ool->rejoin());
|
||||
masm.branchPtr(Assembler::Below, valuereg, ImmWord(nursery.heapEnd()), ool->entry());
|
||||
masm.movePtr(ImmWord(-ptrdiff_t(nursery.start())), temp);
|
||||
masm.addPtr(valuereg, temp);
|
||||
masm.branchPtr(Assembler::Below, temp, Imm32(Nursery::NurserySize), ool->entry());
|
||||
|
||||
masm.bind(ool->rejoin());
|
||||
#endif
|
||||
|
@ -1862,16 +1863,19 @@ CodeGenerator::visitPostWriteBarrierV(LPostWriteBarrierV *lir)
|
|||
if (lir->object()->isConstant()) {
|
||||
JS_ASSERT(!nursery.isInside(&lir->object()->toConstant()->toObject()));
|
||||
} else {
|
||||
Label tenured;
|
||||
Register temp = ToRegister(lir->temp());
|
||||
Register objreg = ToRegister(lir->object());
|
||||
masm.branchPtr(Assembler::Below, objreg, ImmWord(nursery.start()), &tenured);
|
||||
masm.branchPtr(Assembler::Below, objreg, ImmWord(nursery.heapEnd()), ool->rejoin());
|
||||
masm.bind(&tenured);
|
||||
masm.movePtr(ImmWord(-ptrdiff_t(nursery.start())), temp);
|
||||
masm.addPtr(objreg, temp);
|
||||
masm.branchPtr(Assembler::Below, temp, Imm32(Nursery::NurserySize), ool->rejoin());
|
||||
}
|
||||
|
||||
Register valuereg = masm.extractObject(value, ToTempUnboxRegister(lir->temp()));
|
||||
masm.branchPtr(Assembler::Below, valuereg, ImmWord(nursery.start()), ool->rejoin());
|
||||
masm.branchPtr(Assembler::Below, valuereg, ImmWord(nursery.heapEnd()), ool->entry());
|
||||
// This section is a little different because we mustn't trash the temp
|
||||
// register before we use its contents.
|
||||
Register temp = ToRegister(lir->temp());
|
||||
masm.unboxObject(value, temp);
|
||||
masm.addPtr(ImmWord(-ptrdiff_t(nursery.start())), temp);
|
||||
masm.branchPtr(Assembler::Below, temp, Imm32(Nursery::NurserySize), ool->entry());
|
||||
|
||||
masm.bind(ool->rejoin());
|
||||
#endif
|
||||
|
|
|
@ -5497,14 +5497,16 @@ class LMonitorTypes : public LInstructionHelper<0, BOX_PIECES, 1>
|
|||
};
|
||||
|
||||
// Generational write barrier used when writing an object to another object.
|
||||
class LPostWriteBarrierO : public LInstructionHelper<0, 2, 0>
|
||||
class LPostWriteBarrierO : public LInstructionHelper<0, 2, 1>
|
||||
{
|
||||
public:
|
||||
LIR_HEADER(PostWriteBarrierO)
|
||||
|
||||
LPostWriteBarrierO(const LAllocation &obj, const LAllocation &value) {
|
||||
LPostWriteBarrierO(const LAllocation &obj, const LAllocation &value,
|
||||
const LDefinition &temp) {
|
||||
setOperand(0, obj);
|
||||
setOperand(1, value);
|
||||
setTemp(0, temp);
|
||||
}
|
||||
|
||||
const MPostWriteBarrier *mir() const {
|
||||
|
@ -5516,6 +5518,9 @@ class LPostWriteBarrierO : public LInstructionHelper<0, 2, 0>
|
|||
const LAllocation *value() {
|
||||
return getOperand(1);
|
||||
}
|
||||
const LDefinition *temp() {
|
||||
return getTemp(0);
|
||||
}
|
||||
};
|
||||
|
||||
// Generational write barrier used when writing a value to another object.
|
||||
|
|
|
@ -2331,13 +2331,15 @@ LIRGenerator::visitPostWriteBarrier(MPostWriteBarrier *ins)
|
|||
#ifdef JSGC_GENERATIONAL
|
||||
switch (ins->value()->type()) {
|
||||
case MIRType_Object: {
|
||||
LPostWriteBarrierO *lir = new(alloc()) LPostWriteBarrierO(useRegisterOrConstant(ins->object()),
|
||||
useRegister(ins->value()));
|
||||
LPostWriteBarrierO *lir =
|
||||
new(alloc()) LPostWriteBarrierO(useRegisterOrConstant(ins->object()),
|
||||
useRegister(ins->value()),
|
||||
temp());
|
||||
return add(lir, ins) && assignSafepoint(lir, ins);
|
||||
}
|
||||
case MIRType_Value: {
|
||||
LPostWriteBarrierV *lir =
|
||||
new(alloc()) LPostWriteBarrierV(useRegisterOrConstant(ins->object()), tempToUnbox());
|
||||
new(alloc()) LPostWriteBarrierV(useRegisterOrConstant(ins->object()), temp());
|
||||
if (!useBox(lir, LPostWriteBarrierV::Input, ins->value()))
|
||||
return false;
|
||||
return add(lir, ins) && assignSafepoint(lir, ins);
|
||||
|
|
|
@ -2519,6 +2519,12 @@ MacroAssemblerARMCompat::cmpPtr(const Register &lhs, const ImmGCPtr &rhs)
|
|||
ma_cmp(lhs, rhs);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerARMCompat::cmpPtr(const Register &lhs, const Imm32 &rhs)
|
||||
{
|
||||
ma_cmp(lhs, rhs);
|
||||
}
|
||||
|
||||
void
|
||||
MacroAssemblerARMCompat::cmpPtr(const Address &lhs, const Register &rhs)
|
||||
{
|
||||
|
|
|
@ -989,6 +989,9 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
|||
movePtr(imm, ScratchRegister);
|
||||
branchPtr(cond, lhs, ScratchRegister, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Imm32 imm, Label *label) {
|
||||
branch32(cond, lhs, imm, label);
|
||||
}
|
||||
void decBranchPtr(Condition cond, const Register &lhs, Imm32 imm, Label *label) {
|
||||
subPtr(imm, lhs);
|
||||
branch32(cond, lhs, Imm32(0), label);
|
||||
|
@ -1374,6 +1377,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM
|
|||
void cmpPtr(const Register &lhs, const ImmPtr &rhs);
|
||||
void cmpPtr(const Register &lhs, const Register &rhs);
|
||||
void cmpPtr(const Register &lhs, const ImmGCPtr &rhs);
|
||||
void cmpPtr(const Register &lhs, const Imm32 &rhs);
|
||||
void cmpPtr(const Address &lhs, const Register &rhs);
|
||||
void cmpPtr(const Address &lhs, const ImmWord &rhs);
|
||||
void cmpPtr(const Address &lhs, const ImmPtr &rhs);
|
||||
|
|
|
@ -673,6 +673,9 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS
|
|||
movePtr(imm, ScratchRegister);
|
||||
branchPtr(cond, lhs, ScratchRegister, label);
|
||||
}
|
||||
void branchPtr(Condition cond, Register lhs, Imm32 imm, Label *label) {
|
||||
ma_b(lhs, imm, label, cond);
|
||||
}
|
||||
void decBranchPtr(Condition cond, const Register &lhs, Imm32 imm, Label *label) {
|
||||
subPtr(imm, lhs);
|
||||
branch32(cond, lhs, Imm32(0), label);
|
||||
|
|
|
@ -457,6 +457,9 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared
|
|||
movq(rhs, ScratchReg);
|
||||
cmpq(lhs, ScratchReg);
|
||||
}
|
||||
void cmpPtr(const Register &lhs, const Imm32 rhs) {
|
||||
cmpq(lhs, rhs);
|
||||
}
|
||||
void cmpPtr(const Operand &lhs, const ImmGCPtr rhs) {
|
||||
movq(rhs, ScratchReg);
|
||||
cmpq(lhs, ScratchReg);
|
||||
|
|
|
@ -491,6 +491,9 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared
|
|||
void cmpPtr(Register lhs, const ImmGCPtr rhs) {
|
||||
cmpl(lhs, rhs);
|
||||
}
|
||||
void cmpPtr(Register lhs, const Imm32 rhs) {
|
||||
cmpl(lhs, rhs);
|
||||
}
|
||||
void cmpPtr(const Operand &lhs, const ImmWord rhs) {
|
||||
cmpl(lhs, rhs);
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче