+2014-03-10 Andreas Kling <akling@apple.com>
+
+ [X86_64] Smaller code for store64(imm, address) when imm fits in 32 bits.
+ <https://webkit.org/b/130002>
+
+ Generate this:
+
+ mov [address], imm32
+
+ Instead of this:
+
+ mov scratchRegister, imm32
+ mov [address], scratchRegister
+
+ For store64(imm, address) where the 64-bit immediate can be passed as
+ a sign-extended 32-bit value.
+
+ Reviewed by Benjamin Poulain.
+
+ * assembler/MacroAssemblerX86_64.h:
+ (CAN_SIGN_EXTEND_32_64):
+ (JSC::MacroAssemblerX86_64::store64):
+
2014-03-10 Andreas Kling <akling@apple.com>
[X86_64] Smaller code for xchg_rr when one register is accumulator.
#define REPTACH_OFFSET_CALL_R11 3
+inline bool CAN_SIGN_EXTEND_32_64(int64_t value) { return value == (int64_t)(int32_t)value; }
+
namespace JSC {
class MacroAssemblerX86_64 : public MacroAssemblerX86Common {
void store64(TrustedImm64 imm, ImplicitAddress address)
{
- move(imm, scratchRegister);
- store64(scratchRegister, address);
+ if (CAN_SIGN_EXTEND_32_64(imm.m_value))
+ m_assembler.movq_i32m(static_cast<int>(imm.m_value), address.offset, address.base);
+ else {
+ move(imm, scratchRegister);
+ store64(scratchRegister, address);
+ }
}
void store64(TrustedImm64 imm, BaseIndex address)