From 909ad1bb84e80ade5d7e82a1bf153390d7f2e5f6 Mon Sep 17 00:00:00 2001 From: "rgabor@webkit.org" Date: Wed, 5 Sep 2012 07:51:46 +0000 Subject: [PATCH] DFG JIT doesn't work properly on ARM hardfp https://bugs.webkit.org/show_bug.cgi?id=95684 Reviewed by Filip Pizlo. Add hardfp support to DFG JIT. The patch is created with the help of Zoltan Herczeg. Source/JavaScriptCore: * dfg/DFGCCallHelpers.h: (CCallHelpers): (JSC::DFG::CCallHelpers::setupArguments): * dfg/DFGFPRInfo.h: (FPRInfo): * dfg/DFGSpeculativeJIT.h: (SpeculativeJIT): (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheckSetResult): (JSC::DFG::SpeculativeJIT::appendCallSetResult): Source/WTF: * wtf/Platform.h: git-svn-id: http://svn.webkit.org/repository/webkit/trunk@127561 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/JavaScriptCore/ChangeLog | 20 ++++++++++++++++ Source/JavaScriptCore/dfg/DFGCCallHelpers.h | 23 +++++++++++++++++++ Source/JavaScriptCore/dfg/DFGFPRInfo.h | 5 ++++ Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h | 15 ++++++++++++ Source/WTF/ChangeLog | 12 ++++++++++ Source/WTF/wtf/Platform.h | 4 ++++ 6 files changed, 79 insertions(+) diff --git a/Source/JavaScriptCore/ChangeLog b/Source/JavaScriptCore/ChangeLog index 1630cb969b2..73b6df17d88 100644 --- a/Source/JavaScriptCore/ChangeLog +++ b/Source/JavaScriptCore/ChangeLog @@ -1,3 +1,23 @@ +2012-09-05 Gabor Rapcsanyi + + DFG JIT doesn't work properly on ARM hardfp + https://bugs.webkit.org/show_bug.cgi?id=95684 + + Reviewed by Filip Pizlo. + + Add hardfp support to DFG JIT. The patch is created with the + help of Zoltan Herczeg. + + * dfg/DFGCCallHelpers.h: + (CCallHelpers): + (JSC::DFG::CCallHelpers::setupArguments): + * dfg/DFGFPRInfo.h: + (FPRInfo): + * dfg/DFGSpeculativeJIT.h: + (SpeculativeJIT): + (JSC::DFG::SpeculativeJIT::appendCallWithExceptionCheckSetResult): + (JSC::DFG::SpeculativeJIT::appendCallSetResult): + 2012-09-04 Mark Lam Allow the YarrJIT to use the assembler even when useJIT() is false. diff --git a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h index fd4e1cae052..5cd0baab22a 100644 --- a/Source/JavaScriptCore/dfg/DFGCCallHelpers.h +++ b/Source/JavaScriptCore/dfg/DFGCCallHelpers.h @@ -456,6 +456,28 @@ public: setupTwoStubArgs(arg1, arg2); } #elif CPU(ARM) +#if CPU(ARM_HARDFP) + ALWAYS_INLINE void setupArguments(FPRReg arg1) + { + moveDouble(arg1, FPRInfo::argumentFPR0); + } + + ALWAYS_INLINE void setupArguments(FPRReg arg1, FPRReg arg2) + { + if (arg2 != FPRInfo::argumentFPR0) { + moveDouble(arg1, FPRInfo::argumentFPR0); + moveDouble(arg2, FPRInfo::argumentFPR1); + } else if (arg1 != FPRInfo::argumentFPR1) { + moveDouble(arg2, FPRInfo::argumentFPR1); + moveDouble(arg1, FPRInfo::argumentFPR0); + } else { + // Swap arg1, arg2. + moveDouble(FPRInfo::argumentFPR0, ARMRegisters::d2); + moveDouble(FPRInfo::argumentFPR1, FPRInfo::argumentFPR0); + moveDouble(ARMRegisters::d2, FPRInfo::argumentFPR1); + } + } +#else ALWAYS_INLINE void setupArguments(FPRReg arg1) { assembler().vmov(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1, arg1); @@ -466,6 +488,7 @@ public: assembler().vmov(GPRInfo::argumentGPR0, GPRInfo::argumentGPR1, arg1); assembler().vmov(GPRInfo::argumentGPR2, GPRInfo::argumentGPR3, arg2); } +#endif // CPU(ARM_HARDFP) #else #error "DFG JIT not supported on this platform." #endif diff --git a/Source/JavaScriptCore/dfg/DFGFPRInfo.h b/Source/JavaScriptCore/dfg/DFGFPRInfo.h index e817ed39695..5ee87bce14d 100644 --- a/Source/JavaScriptCore/dfg/DFGFPRInfo.h +++ b/Source/JavaScriptCore/dfg/DFGFPRInfo.h @@ -122,6 +122,11 @@ public: // we'll return in d0 for simplicity. static const FPRReg returnValueFPR = ARMRegisters::d0; // fpRegT0 +#if CPU(ARM_HARDFP) + static const FPRReg argumentFPR0 = ARMRegisters::d0; // fpRegT0 + static const FPRReg argumentFPR1 = ARMRegisters::d1; // fpRegT1 +#endif + // FPRReg mapping is direct, the machine regsiter numbers can // be used directly as indices into the FPR RegisterBank. COMPILE_ASSERT(ARMRegisters::d0 == 0, d0_is_0); diff --git a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h index c5e49f70cc7..f7b125e1b57 100644 --- a/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h +++ b/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h @@ -1835,7 +1835,21 @@ public: return call; } #elif CPU(ARM) +#if CPU(ARM_HARDFP) JITCompiler::Call appendCallWithExceptionCheckSetResult(const FunctionPtr& function, FPRReg result) + { + JITCompiler::Call call = appendCallWithExceptionCheck(function); + m_jit.moveDouble(result, FPRInfo::argumentFPR0); + return call; + } + JITCompiler::Call appendCallSetResult(const FunctionPtr& function, FPRReg result) + { + JITCompiler::Call call = m_jit.appendCall(function); + m_jit.moveDouble(result, FPRInfo::argumentFPR0); + return call; + } +#else + JITCompiler::Call appendCallWithExceptionCheckSetResult(const FunctionPtr& function, FPRReg result) { JITCompiler::Call call = appendCallWithExceptionCheck(function); m_jit.assembler().vmov(result, GPRInfo::returnValueGPR, GPRInfo::returnValueGPR2); @@ -1847,6 +1861,7 @@ public: m_jit.assembler().vmov(result, GPRInfo::returnValueGPR, GPRInfo::returnValueGPR2); return call; } +#endif // CPU(ARM_HARDFP) #else JITCompiler::Call appendCallWithExceptionCheckSetResult(const FunctionPtr& function, FPRReg result) { diff --git a/Source/WTF/ChangeLog b/Source/WTF/ChangeLog index c97b32dab65..7e5eabe3e05 100644 --- a/Source/WTF/ChangeLog +++ b/Source/WTF/ChangeLog @@ -1,3 +1,15 @@ +2012-09-05 Gabor Rapcsanyi + + DFG JIT doesn't work properly on ARM hardfp + https://bugs.webkit.org/show_bug.cgi?id=95684 + + Reviewed by Filip Pizlo. + + Add hardfp support to DFG JIT. The patch is created with the + help of Zoltan Herczeg. + + * wtf/Platform.h: + 2012-09-04 Zoltan Horvath Extend the coverage of the Custom Allocation Framework in WTF and in JavaScriptCore diff --git a/Source/WTF/wtf/Platform.h b/Source/WTF/wtf/Platform.h index b24850b6ef5..51c898fae91 100644 --- a/Source/WTF/wtf/Platform.h +++ b/Source/WTF/wtf/Platform.h @@ -169,6 +169,10 @@ || defined(_ARM_) #define WTF_CPU_ARM 1 +#if defined(__ARM_PCS_VFP) +#define WTF_CPU_ARM_HARDFP 1 +#endif + #if defined(__ARMEB__) || (COMPILER(RVCT) && defined(__BIG_ENDIAN)) #define WTF_CPU_BIG_ENDIAN 1 -- GitLab