diff --git a/js/src/methodjit/Compiler.cpp b/js/src/methodjit/Compiler.cpp index 9dd6e697db2..d788afdc87a 100644 --- a/js/src/methodjit/Compiler.cpp +++ b/js/src/methodjit/Compiler.cpp @@ -5449,13 +5449,11 @@ mjit::Compiler::jsop_setprop(JSAtom *atom, bool usePropCache, bool popGuaranteed #ifdef JSGC_INCREMENTAL_MJ /* Write barrier. */ if (cx->compartment->needsBarrier()) { - frame.pinReg(address.base); stubcc.linkExit(masm.jump(), Uses(0)); stubcc.leave(); stubcc.masm.addPtr(Imm32(address.offset), address.base, Registers::ArgReg1); OOL_STUBCALL(stubs::WriteBarrier, REJOIN_NONE); stubcc.rejoin(Changes(0)); - frame.unpinReg(address.base); } #endif @@ -5492,9 +5490,9 @@ mjit::Compiler::jsop_setprop(JSAtom *atom, bool usePropCache, bool popGuaranteed if (!isObject) notObject = frame.testObject(Assembler::NotEqual, lhs); #ifdef JSGC_INCREMENTAL_MJ + frame.pinReg(reg); if (cx->compartment->needsBarrier() && propertyTypes->needsBarrier(cx)) { /* Write barrier. */ - frame.pinReg(reg); Jump j = masm.testGCThing(Address(reg, JSObject::getFixedSlotOffset(slot))); stubcc.linkExit(j, Uses(0)); stubcc.leave(); @@ -5502,8 +5500,8 @@ mjit::Compiler::jsop_setprop(JSAtom *atom, bool usePropCache, bool popGuaranteed reg, Registers::ArgReg1); OOL_STUBCALL(stubs::GCThingWriteBarrier, REJOIN_NONE); stubcc.rejoin(Changes(0)); - frame.unpinReg(reg); } + frame.unpinReg(reg); #endif if (!isObject) { stubcc.linkExit(notObject.get(), Uses(2)); diff --git a/js/src/methodjit/FastOps.cpp b/js/src/methodjit/FastOps.cpp index 3a319cc16d2..d79084cb377 100644 --- a/js/src/methodjit/FastOps.cpp +++ b/js/src/methodjit/FastOps.cpp @@ -1172,19 +1172,17 @@ mjit::Compiler::jsop_setelem_dense() /* * The sync call below can potentially clobber key.reg() and slotsReg. - * We pin them to avoid this. Additionally, the WriteBarrier stub can + * So we save and restore them. Additionally, the WriteBarrier stub can * clobber both registers. The rejoin call will restore key.reg() but - * not slotsReg. So we save slotsReg in the frame and restore it after - * the stub call. + * not slotsReg. So we restore it again after the stub call. */ stubcc.masm.storePtr(slotsReg, FrameAddress(offsetof(VMFrame, scratch))); - frame.pinReg(slotsReg); if (!key.isConstant()) - frame.pinReg(key.reg()); + stubcc.masm.push(key.reg()); frame.sync(stubcc.masm, Uses(3)); if (!key.isConstant()) - frame.unpinReg(key.reg()); - frame.unpinReg(slotsReg); + stubcc.masm.pop(key.reg()); + stubcc.masm.loadPtr(FrameAddress(offsetof(VMFrame, scratch)), slotsReg); if (key.isConstant()) stubcc.masm.lea(Address(slotsReg, key.index() * sizeof(Value)), Registers::ArgReg1);