diff --git a/js/src/ion/arm/MacroAssembler-arm.cpp b/js/src/ion/arm/MacroAssembler-arm.cpp index f1634ad2bb8a..ee5612280a24 100644 --- a/js/src/ion/arm/MacroAssembler-arm.cpp +++ b/js/src/ion/arm/MacroAssembler-arm.cpp @@ -2490,41 +2490,51 @@ MacroAssemblerARMCompat::storeValue(ValueOperand val, Operand dst) { } void -MacroAssemblerARMCompat::storeValue(ValueOperand val, Register base, Register index, int32_t shift) +MacroAssemblerARMCompat::storeValue(ValueOperand val, const BaseIndex &dest) { - if (isValueDTRDCandidate(val)) { + if (isValueDTRDCandidate(val) && (abs(dest.offset) <= 255)) { Register tmpIdx; - if (shift == 0) { - tmpIdx = index; - } else if (shift < 0) { - ma_asr(Imm32(-shift), index, ScratchRegister); - tmpIdx = ScratchRegister; + if (dest.offset == 0) { + if (dest.scale == TimesOne) { + tmpIdx = dest.index; + } else { + ma_lsl(Imm32(dest.scale), dest.index, ScratchRegister); + tmpIdx = ScratchRegister; + } + ma_strd(val.payloadReg(), val.typeReg(), EDtrAddr(dest.base, EDtrOffReg(tmpIdx))); } else { - ma_lsl(Imm32(shift), index, ScratchRegister); - tmpIdx = ScratchRegister; + ma_alu(dest.base, lsl(dest.index, dest.scale), ScratchRegister, op_add); + ma_strd(val.payloadReg(), val.typeReg(), + EDtrAddr(ScratchRegister, EDtrOffImm(dest.offset))); } - ma_strd(val.payloadReg(), val.typeReg(), EDtrAddr(base, EDtrOffReg(tmpIdx))); } else { - // The ideal case is the base is dead so the sequence: - // str val.payloadReg(), [base, index LSL shift]! - // str val.typeReg(), [base, #4] - // only clobbers dead registers - // Sadly, this information is not available, so the scratch register is necessary. - ma_alu(base, lsl(index, shift), ScratchRegister, op_add); - - // This case is handled by a simpler function. - storeValue(val, Address(ScratchRegister, 0)); + ma_alu(dest.base, lsl(dest.index, dest.scale), ScratchRegister, op_add); + storeValue(val, Address(ScratchRegister, dest.offset)); } } void -MacroAssemblerARMCompat::loadValue(Register base, Register index, ValueOperand val, Imm32 off) +MacroAssemblerARMCompat::loadValue(const BaseIndex &addr, ValueOperand val) { - - ma_alu(base, lsl(index, TimesEight), ScratchRegister, op_add); - - // This case is handled by a simpler function. - loadValue(Address(ScratchRegister, off.value), val); + if (isValueDTRDCandidate(val) && (abs(addr.offset) <= 255)) { + Register tmpIdx; + if (addr.offset == 0) { + if (addr.scale == TimesOne) { + tmpIdx = addr.index; + } else { + ma_lsl(Imm32(addr.scale), addr.index, ScratchRegister); + tmpIdx = ScratchRegister; + } + ma_ldrd(EDtrAddr(addr.base, EDtrOffReg(tmpIdx)), val.payloadReg(), val.typeReg()); + } else { + ma_alu(addr.base, lsl(addr.index, addr.scale), ScratchRegister, op_add); + ma_ldrd(EDtrAddr(ScratchRegister, EDtrOffImm(addr.offset)), + val.payloadReg(), val.typeReg()); + } + } else { + ma_alu(addr.base, lsl(addr.index, addr.scale), ScratchRegister, op_add); + loadValue(Address(ScratchRegister, addr.offset), val); + } } void diff --git a/js/src/ion/arm/MacroAssembler-arm.h b/js/src/ion/arm/MacroAssembler-arm.h index d961c1b3ac18..d82d32912c12 100644 --- a/js/src/ion/arm/MacroAssembler-arm.h +++ b/js/src/ion/arm/MacroAssembler-arm.h @@ -782,7 +782,13 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void moveValue(const Value &val, const ValueOperand &dest); void storeValue(ValueOperand val, Operand dst); - void storeValue(ValueOperand val, Register base, Register index, int32_t shift = defaultShift); + void storeValue(ValueOperand val, const BaseIndex &dest); + void storeValue(JSValueType type, Register reg, BaseIndex dest) { + // Harder cases not handled yet. + JS_ASSERT(dest.offset == 0); + ma_alu(dest.base, lsl(dest.index, dest.scale), ScratchRegister, op_add); + storeValue(type, reg, Address(ScratchRegister, 0)); + } void storeValue(ValueOperand val, const Address &dest) { storeValue(val, Operand(dest)); } @@ -791,17 +797,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM ma_str(secondScratchReg_, Address(dest.base, dest.offset + 4)); ma_str(reg, dest); } - void storeValue(JSValueType type, Register reg, BaseIndex dest) { - // Harder cases not handled yet. - JS_ASSERT(dest.offset == 0); - ma_alu(dest.base, lsl(dest.index, dest.scale), ScratchRegister, op_add); - storeValue(type, reg, Address(ScratchRegister, 0)); - } - void storeValue(ValueOperand val, const BaseIndex &dest) { - // Harder cases not handled yet. - JS_ASSERT(dest.offset == 0); - storeValue(val, dest.base, dest.index); - } void storeValue(const Value &val, Address dest) { jsval_layout jv = JSVAL_TO_IMPL(val); ma_mov(Imm32(jv.s.tag), secondScratchReg_); @@ -823,10 +818,7 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void loadValue(Operand dest, ValueOperand val) { loadValue(dest.toAddress(), val); } - void loadValue(Register base, Register index, ValueOperand val, Imm32 of); - void loadValue(const BaseIndex &addr, ValueOperand val) { - loadValue(addr.base, addr.index, val, Imm32(addr.offset)); - } + void loadValue(const BaseIndex &addr, ValueOperand val); void tagValue(JSValueType type, Register payload, ValueOperand dest); void pushValue(ValueOperand val);