From bb6e2b2e1a299fe1f7ddb8ed2713bc879b45962a Mon Sep 17 00:00:00 2001 From: Tooru Fujisawa Date: Sun, 13 Sep 2015 07:33:35 +0900 Subject: [PATCH] Bug 1203964 - Part 4: Move MacroAssembler::lshiftPtr into generic macro assembler. r=nbp --HG-- extra : rebase_source : 5f74ff1b2ea0cc5f6869119b8beb19f07c5cfd59 --- js/src/jit/MacroAssembler.h | 2 ++ js/src/jit/arm/MacroAssembler-arm-inl.h | 6 ++++++ js/src/jit/arm/MacroAssembler-arm.h | 3 --- js/src/jit/arm64/MacroAssembler-arm64-inl.h | 12 ++++++++++++ js/src/jit/arm64/MacroAssembler-arm64.cpp | 7 +++++++ js/src/jit/arm64/MacroAssembler-arm64.h | 12 ++---------- js/src/jit/mips32/MacroAssembler-mips32-inl.h | 6 ++++++ js/src/jit/mips32/MacroAssembler-mips32.h | 3 --- js/src/jit/none/MacroAssembler-none.h | 1 - js/src/jit/x64/MacroAssembler-x64-inl.h | 6 ++++++ js/src/jit/x64/MacroAssembler-x64.h | 3 --- js/src/jit/x86/MacroAssembler-x86-inl.h | 6 ++++++ js/src/jit/x86/MacroAssembler-x86.h | 3 --- 13 files changed, 47 insertions(+), 23 deletions(-) diff --git a/js/src/jit/MacroAssembler.h b/js/src/jit/MacroAssembler.h index 2d116c09ee85..66d733ec3820 100644 --- a/js/src/jit/MacroAssembler.h +++ b/js/src/jit/MacroAssembler.h @@ -700,6 +700,8 @@ class MacroAssembler : public MacroAssemblerSpecific // =============================================================== // Shift functions + inline void lshiftPtr(Imm32 imm, Register dest) PER_ARCH; + inline void rshiftPtr(Imm32 imm, Register dest) PER_ARCH; inline void rshiftPtr(Imm32 imm, Register src, Register dest) DEFINED_ON(arm64); diff --git a/js/src/jit/arm/MacroAssembler-arm-inl.h b/js/src/jit/arm/MacroAssembler-arm-inl.h index ae48272d53df..063f2210f21a 100644 --- a/js/src/jit/arm/MacroAssembler-arm-inl.h +++ b/js/src/jit/arm/MacroAssembler-arm-inl.h @@ -131,6 +131,12 @@ MacroAssembler::xorPtr(Imm32 imm, Register dest) // =============================================================== // Shift functions +void +MacroAssembler::lshiftPtr(Imm32 imm, Register dest) +{ + ma_lsl(imm, dest, dest); +} + void MacroAssembler::rshiftPtr(Imm32 imm, Register dest) { diff --git a/js/src/jit/arm/MacroAssembler-arm.h b/js/src/jit/arm/MacroAssembler-arm.h index 532b168f81b6..b49699a5ee03 100644 --- a/js/src/jit/arm/MacroAssembler-arm.h +++ b/js/src/jit/arm/MacroAssembler-arm.h @@ -1716,9 +1716,6 @@ class MacroAssemblerARMCompat : public MacroAssemblerARM void checkStackAlignment(); - void lshiftPtr(Imm32 imm, Register dest) { - ma_lsl(imm, dest, dest); - } void lshift64(Imm32 imm, Register64 dest) { as_mov(dest.high, lsl(dest.high, imm.value)); as_orr(dest.high, dest.high, lsr(dest.low, 32 - imm.value)); diff --git a/js/src/jit/arm64/MacroAssembler-arm64-inl.h b/js/src/jit/arm64/MacroAssembler-arm64-inl.h index 44f5b7132f58..c4718155d282 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64-inl.h +++ b/js/src/jit/arm64/MacroAssembler-arm64-inl.h @@ -144,6 +144,12 @@ MacroAssembler::xorPtr(Imm32 imm, Register dest) // =============================================================== // Shift functions +void +MacroAssembler::lshiftPtr(Imm32 imm, Register dest) +{ + Lsl(ARMRegister(dest, 64), ARMRegister(dest, 64), imm.value); +} + void MacroAssembler::rshiftPtr(Imm32 imm, Register dest) { @@ -171,6 +177,12 @@ MacroAssembler::rshift64(Imm32 imm, Register64 dest) //}}} check_macroassembler_style // =============================================================== +void +MacroAssemblerCompat::lshift64(Imm32 imm, Register64 dest) +{ + asMasm().lshiftPtr(imm, dest.reg); +} + template void MacroAssemblerCompat::andToStackPtr(T t) diff --git a/js/src/jit/arm64/MacroAssembler-arm64.cpp b/js/src/jit/arm64/MacroAssembler-arm64.cpp index c53d348aac81..b564dea8322a 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.cpp +++ b/js/src/jit/arm64/MacroAssembler-arm64.cpp @@ -124,6 +124,13 @@ MacroAssemblerCompat::movePatchablePtr(ImmWord ptr, Register dest) (uint8_t*)&instructionScratch, literalAddr); } +void +MacroAssemblerCompat::loadPrivate(const Address& src, Register dest) +{ + loadPtr(src, dest); + asMasm().lshiftPtr(Imm32(1), dest); +} + void MacroAssemblerCompat::handleFailureWithHandlerTail(void* handler) { diff --git a/js/src/jit/arm64/MacroAssembler-arm64.h b/js/src/jit/arm64/MacroAssembler-arm64.h index e24c92cf2561..c6dc7cd457d4 100644 --- a/js/src/jit/arm64/MacroAssembler-arm64.h +++ b/js/src/jit/arm64/MacroAssembler-arm64.h @@ -853,10 +853,7 @@ class MacroAssemblerCompat : public vixl::MacroAssembler Ldr(dest64, MemOperand(ARMRegister(base, 64), index64, vixl::LSL, scale)); } - void loadPrivate(const Address& src, Register dest) { - loadPtr(src, dest); - lshiftPtr(Imm32(1), dest); - } + void loadPrivate(const Address& src, Register dest); void store8(Register src, const Address& address) { Strb(ARMRegister(src, 32), MemOperand(ARMRegister(address.base, 64), address.offset)); @@ -1069,12 +1066,7 @@ class MacroAssemblerCompat : public vixl::MacroAssembler branchPtr(cond, lhs, getStackPointer(), label); } - void lshiftPtr(Imm32 imm, Register dest) { - Lsl(ARMRegister(dest, 64), ARMRegister(dest, 64), imm.value); - } - void lshift64(Imm32 imm, Register64 dest) { - lshiftPtr(imm, dest.reg); - } + inline void lshift64(Imm32 imm, Register64 dest); void testPtr(Register lhs, Register rhs) { Tst(ARMRegister(lhs, 64), Operand(ARMRegister(rhs, 64))); diff --git a/js/src/jit/mips32/MacroAssembler-mips32-inl.h b/js/src/jit/mips32/MacroAssembler-mips32-inl.h index 093e4ac700fd..0419a195fb9f 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32-inl.h +++ b/js/src/jit/mips32/MacroAssembler-mips32-inl.h @@ -128,6 +128,12 @@ MacroAssembler::xorPtr(Imm32 imm, Register dest) // =============================================================== // Shift functions +void +MacroAssembler::lshiftPtr(Imm32 imm, Register dest) +{ + ma_sll(dest, dest, imm); +} + void MacroAssembler::rshiftPtr(Imm32 imm, Register dest) { diff --git a/js/src/jit/mips32/MacroAssembler-mips32.h b/js/src/jit/mips32/MacroAssembler-mips32.h index f758f052f43b..e9815da9fa90 100644 --- a/js/src/jit/mips32/MacroAssembler-mips32.h +++ b/js/src/jit/mips32/MacroAssembler-mips32.h @@ -1349,9 +1349,6 @@ class MacroAssemblerMIPSCompat : public MacroAssemblerMIPS void restoreStackPointer(); static void calculateAlignedStackPointer(void** stackPointer); - void lshiftPtr(Imm32 imm, Register dest) { - ma_sll(dest, dest, imm); - } void lshift64(Imm32 imm, Register64 dest) { as_sll(dest.high, dest.high, imm.value); as_srl(ScratchRegister, dest.low, 32 - imm.value); diff --git a/js/src/jit/none/MacroAssembler-none.h b/js/src/jit/none/MacroAssembler-none.h index 22203e6abf1f..eedecbca0219 100644 --- a/js/src/jit/none/MacroAssembler-none.h +++ b/js/src/jit/none/MacroAssembler-none.h @@ -422,7 +422,6 @@ class MacroAssemblerNone : public Assembler template void storeUnboxedValue(ConstantOrRegister, MIRType, T, MIRType) { MOZ_CRASH(); } template void storeUnboxedPayload(ValueOperand value, T, size_t) { MOZ_CRASH(); } - void lshiftPtr(Imm32, Register) { MOZ_CRASH(); } void convertUInt32ToDouble(Register, FloatRegister) { MOZ_CRASH(); } void convertUInt32ToFloat32(Register, FloatRegister) { MOZ_CRASH(); } void inc64(AbsoluteAddress) { MOZ_CRASH(); } diff --git a/js/src/jit/x64/MacroAssembler-x64-inl.h b/js/src/jit/x64/MacroAssembler-x64-inl.h index c4f8e248a94d..8b9cf2685096 100644 --- a/js/src/jit/x64/MacroAssembler-x64-inl.h +++ b/js/src/jit/x64/MacroAssembler-x64-inl.h @@ -69,6 +69,12 @@ MacroAssembler::xorPtr(Imm32 imm, Register dest) // =============================================================== // Shift functions +void +MacroAssembler::lshiftPtr(Imm32 imm, Register dest) +{ + shlq(imm, dest); +} + void MacroAssembler::rshiftPtr(Imm32 imm, Register dest) { diff --git a/js/src/jit/x64/MacroAssembler-x64.h b/js/src/jit/x64/MacroAssembler-x64.h index 48d1e3770892..3d2148e649f3 100644 --- a/js/src/jit/x64/MacroAssembler-x64.h +++ b/js/src/jit/x64/MacroAssembler-x64.h @@ -850,9 +850,6 @@ class MacroAssemblerX64 : public MacroAssemblerX86Shared void store64(Register64 src, Address address) { movq(src.reg, Operand(address)); } - void lshiftPtr(Imm32 imm, Register dest) { - shlq(imm, dest); - } void lshift64(Imm32 imm, Register64 dest) { shlq(imm, dest.reg); } diff --git a/js/src/jit/x86/MacroAssembler-x86-inl.h b/js/src/jit/x86/MacroAssembler-x86-inl.h index 22a05ce9c6be..27c59a517ab5 100644 --- a/js/src/jit/x86/MacroAssembler-x86-inl.h +++ b/js/src/jit/x86/MacroAssembler-x86-inl.h @@ -70,6 +70,12 @@ MacroAssembler::xorPtr(Imm32 imm, Register dest) // =============================================================== // Shift functions +void +MacroAssembler::lshiftPtr(Imm32 imm, Register dest) +{ + shll(imm, dest); +} + void MacroAssembler::rshiftPtr(Imm32 imm, Register dest) { diff --git a/js/src/jit/x86/MacroAssembler-x86.h b/js/src/jit/x86/MacroAssembler-x86.h index 3892faac9cab..5f0aeb590e18 100644 --- a/js/src/jit/x86/MacroAssembler-x86.h +++ b/js/src/jit/x86/MacroAssembler-x86.h @@ -1122,9 +1122,6 @@ class MacroAssemblerX86 : public MacroAssemblerX86Shared } } - void lshiftPtr(Imm32 imm, Register dest) { - shll(imm, dest); - } void lshift64(Imm32 imm, Register64 dest) { shldl(imm, dest.low, dest.high); shll(imm, dest.low);