X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/1df5f87f1309a8daa30dabdee855f48ae40d14ab..6fe7ccc865dc7d7541b93c5bcaf6368d2c98a174:/assembler/MacroAssemblerX86.h diff --git a/assembler/MacroAssemblerX86.h b/assembler/MacroAssemblerX86.h index a1657e6..088fe19 100644 --- a/assembler/MacroAssemblerX86.h +++ b/assembler/MacroAssemblerX86.h @@ -34,22 +34,22 @@ namespace JSC { class MacroAssemblerX86 : public MacroAssemblerX86Common { public: - MacroAssemblerX86() - : m_isSSE2Present(isSSE2Present()) - { - } - static const Scale ScalePtr = TimesFour; using MacroAssemblerX86Common::add32; using MacroAssemblerX86Common::and32; + using MacroAssemblerX86Common::branchAdd32; + using MacroAssemblerX86Common::branchSub32; using MacroAssemblerX86Common::sub32; using MacroAssemblerX86Common::or32; using MacroAssemblerX86Common::load32; using MacroAssemblerX86Common::store32; using MacroAssemblerX86Common::branch32; using MacroAssemblerX86Common::call; + using MacroAssemblerX86Common::jump; + using MacroAssemblerX86Common::addDouble; using MacroAssemblerX86Common::loadDouble; + using MacroAssemblerX86Common::storeDouble; using MacroAssemblerX86Common::convertInt32ToDouble; void add32(TrustedImm32 imm, RegisterID src, RegisterID dest) @@ -62,11 +62,12 @@ public: m_assembler.addl_im(imm.m_value, address.m_ptr); } - void addWithCarry32(TrustedImm32 imm, AbsoluteAddress address) + void add64(TrustedImm32 imm, AbsoluteAddress address) { - m_assembler.adcl_im(imm.m_value, address.m_ptr); + m_assembler.addl_im(imm.m_value, address.m_ptr); + m_assembler.adcl_im(imm.m_value >> 31, reinterpret_cast(address.m_ptr) + sizeof(int32_t)); } - + void and32(TrustedImm32 imm, AbsoluteAddress address) { m_assembler.andl_im(imm.m_value, address.m_ptr); @@ -82,15 +83,20 @@ public: m_assembler.subl_im(imm.m_value, address.m_ptr); } - void load32(void* address, RegisterID dest) + void load32(const void* address, RegisterID dest) { m_assembler.movl_mr(address, dest); } - void loadDouble(const void* address, FPRegisterID dest) + void addDouble(AbsoluteAddress address, FPRegisterID dest) + { + m_assembler.addsd_mr(address.m_ptr, dest); + } + + void storeDouble(FPRegisterID src, const void* address) { ASSERT(isSSE2Present()); - m_assembler.movsd_mr(address, dest); + m_assembler.movsd_rm(src, address); } void convertInt32ToDouble(AbsoluteAddress src, FPRegisterID dest) @@ -108,6 +114,18 @@ public: m_assembler.movl_rm(src, address); } + Jump branchAdd32(ResultCondition cond, TrustedImm32 imm, AbsoluteAddress dest) + { + m_assembler.addl_im(imm.m_value, dest.m_ptr); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + + Jump branchSub32(ResultCondition cond, TrustedImm32 imm, AbsoluteAddress dest) + { + m_assembler.subl_im(imm.m_value, dest.m_ptr); + return Jump(m_assembler.jCC(x86Condition(cond))); + } + Jump branch32(RelationalCondition cond, AbsoluteAddress left, RegisterID right) { m_assembler.cmpl_rm(right, left.m_ptr); @@ -125,6 +143,12 @@ public: return Call(m_assembler.call(), Call::Linkable); } + // Address is a memory location containing the address to jump to + void jump(AbsoluteAddress address) + { + m_assembler.jmp_m(address.m_ptr); + } + Call tailRecursiveCall() { return Call::fromTailJump(jump()); @@ -162,20 +186,25 @@ public: return DataLabelPtr(this); } - bool supportsFloatingPoint() const { return m_isSSE2Present; } + static bool supportsFloatingPoint() { return isSSE2Present(); } // See comment on MacroAssemblerARMv7::supportsFloatingPointTruncate() - bool supportsFloatingPointTruncate() const { return m_isSSE2Present; } - bool supportsFloatingPointSqrt() const { return m_isSSE2Present; } + static bool supportsFloatingPointTruncate() { return isSSE2Present(); } + static bool supportsFloatingPointSqrt() { return isSSE2Present(); } + static bool supportsFloatingPointAbs() { return isSSE2Present(); } + + static FunctionPtr readCallTarget(CodeLocationCall call) + { + intptr_t offset = reinterpret_cast(call.dataLocation())[-1]; + return FunctionPtr(reinterpret_cast(reinterpret_cast(call.dataLocation()) + offset)); + } private: - const bool m_isSSE2Present; - friend class LinkBuffer; friend class RepatchBuffer; static void linkCall(void* code, Call call, FunctionPtr function) { - X86Assembler::linkCall(code, call.m_jmp, function.value()); + X86Assembler::linkCall(code, call.m_label, function.value()); } static void repatchCall(CodeLocationCall call, CodeLocationLabel destination)