Changeset 171005 in webkit
- Timestamp:
- Jul 11, 2014 11:53:19 AM (10 years ago)
- Location:
- trunk/Source
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r170950 r171005 1 2014-07-11 peavo@outlook.com <peavo@outlook.com> 2 3 [Win] Enable DFG JIT. 4 https://bugs.webkit.org/show_bug.cgi?id=123615 5 6 Reviewed by Mark Lam. 7 8 When the return type of a JIT generated function call is larger than 64-bit (e.g. SlowPathReturnType), 9 the normal call() implementation cannot be used on 64-bit Windows, because the 64-bit Windows ABI is different in this case. 10 Also, when generating calls with double arguments, we need to make sure the arguments are put in the correct registers, 11 since the register allocation differs on 64-bit Windows. 12 13 * assembler/MacroAssemblerX86_64.h: 14 (JSC::MacroAssemblerX86_64::callWithSlowPathReturnType): Added method to handle function calls where the return value type size is larger than 64-bit. 15 * jit/CCallHelpers.h: 16 (JSC::CCallHelpers::setupArgumentsWithExecState): Move arguments to correct registers when there are floating point arguments. 17 (JSC::CCallHelpers::setupArgumentsWithExecStateForCallWithSlowPathReturnType): Added method. 18 * jit/JIT.h: 19 (JSC::JIT::appendCallWithSlowPathReturnType): Added method. 20 * jit/JITInlines.h: 21 (JSC::JIT::appendCallWithExceptionCheckAndSlowPathReturnType): Added method. 22 (JSC::JIT::callOperation): Call new method. 23 1 24 2014-07-09 Benjamin Poulain <benjamin@webkit.org> 2 25 -
trunk/Source/JavaScriptCore/assembler/MacroAssemblerX86_64.h
r170428 r171005 152 152 } 153 153 154 #if OS(WINDOWS) 155 Call callWithSlowPathReturnType() 156 { 157 // On Win64, when the return type is larger than 8 bytes, we need to allocate space on the stack for the return value. 158 // On entry, rcx should contain a pointer to this stack space. The other parameters are shifted to the right, 159 // rdx should contain the first argument, r8 should contain the second argument, and r9 should contain the third argument. 160 // On return, rax contains a pointer to this stack value. See http://msdn.microsoft.com/en-us/library/7572ztz4.aspx. 161 // We then need to copy the 16 byte return value into rax and rdx, since JIT expects the return value to be split between the two. 162 // It is assumed that the parameters are already shifted to the right, when entering this method. 163 // Note: this implementation supports up to 3 parameters. 164 165 // JIT relies on the CallerFrame (frame pointer) being put on the stack, 166 // On Win64 we need to manually copy the frame pointer to the stack, since MSVC may not maintain a frame pointer on 64-bit. 167 // See http://msdn.microsoft.com/en-us/library/9z1stfyw.aspx where it's stated that rbp MAY be used as a frame pointer. 168 store64(X86Registers::ebp, Address(X86Registers::esp, -16)); 169 170 // We also need to allocate the shadow space on the stack for the 4 parameter registers. 171 // In addition, we need to allocate 16 bytes for the return value. 172 // Also, we should allocate 16 bytes for the frame pointer, and return address (not populated). 173 sub64(TrustedImm32(8 * sizeof(int64_t)), X86Registers::esp); 174 175 // The first parameter register should contain a pointer to the stack allocated space for the return value. 176 move(X86Registers::esp, X86Registers::ecx); 177 add64(TrustedImm32(4 * sizeof(int64_t)), X86Registers::ecx); 178 179 DataLabelPtr label = moveWithPatch(TrustedImmPtr(0), scratchRegister); 180 Call result = Call(m_assembler.call(scratchRegister), Call::Linkable); 181 182 add64(TrustedImm32(8 * sizeof(int64_t)), X86Registers::esp); 183 184 // Copy the return value into rax and rdx. 185 load64(Address(X86Registers::eax, sizeof(int64_t)), X86Registers::edx); 186 load64(Address(X86Registers::eax), X86Registers::eax); 187 188 ASSERT_UNUSED(label, differenceBetween(label, result) == REPTACH_OFFSET_CALL_R11); 189 return result; 190 } 191 #endif 192 154 193 Call call() 155 194 { -
trunk/Source/JavaScriptCore/jit/CCallHelpers.h
r166908 r171005 799 799 ALWAYS_INLINE void setupArgumentsWithExecState(FPRReg arg1, GPRReg arg2) 800 800 { 801 #if OS(WINDOWS) && CPU(X86_64) 802 // On Windows, arguments map to designated registers based on the argument positions, even when there are interlaced scalar and floating point arguments. 803 // See http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx 804 moveDouble(arg1, FPRInfo::argumentFPR1); 805 move(arg2, GPRInfo::argumentGPR2); 806 #else 801 807 moveDouble(arg1, FPRInfo::argumentFPR0); 802 808 move(arg2, GPRInfo::argumentGPR1); 809 #endif 803 810 move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 804 811 } … … 806 813 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2, FPRReg arg3) 807 814 { 815 #if OS(WINDOWS) && CPU(X86_64) 816 // On Windows, arguments map to designated registers based on the argument positions, even when there are interlaced scalar and floating point arguments. 817 // See http://msdn.microsoft.com/en-us/library/zthk2dkh.aspx 818 moveDouble(arg3, FPRInfo::argumentFPR3); 819 #else 808 820 moveDouble(arg3, FPRInfo::argumentFPR0); 821 #endif 809 822 setupStubArguments(arg1, arg2); 810 823 move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); … … 1061 1074 move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR0); 1062 1075 } 1076 1077 #if OS(WINDOWS) && CPU(X86_64) 1078 ALWAYS_INLINE void setupArgumentsWithExecStateForCallWithSlowPathReturnType(TrustedImm32 arg1) 1079 { 1080 move(arg1, GPRInfo::argumentGPR2); 1081 move(GPRInfo::callFrameRegister, GPRInfo::argumentGPR1); 1082 } 1083 #endif 1063 1084 1064 1085 ALWAYS_INLINE void setupArgumentsWithExecState(GPRReg arg1, GPRReg arg2) -
trunk/Source/JavaScriptCore/jit/JIT.h
r170147 r171005 264 264 return functionCall; 265 265 } 266 267 #if OS(WINDOWS) && CPU(X86_64) 268 Call appendCallWithSlowPathReturnType(const FunctionPtr& function) 269 { 270 Call functionCall = callWithSlowPathReturnType(); 271 m_calls.append(CallRecord(functionCall, m_bytecodeOffset, function.value())); 272 return functionCall; 273 } 274 #endif 266 275 267 276 void exceptionCheck(Jump jumpToHandler) … … 649 658 650 659 MacroAssembler::Call appendCallWithExceptionCheck(const FunctionPtr&); 660 #if OS(WINDOWS) && CPU(X86_64) 661 MacroAssembler::Call appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr&); 662 #endif 651 663 MacroAssembler::Call appendCallWithCallFrameRollbackOnException(const FunctionPtr&); 652 664 MacroAssembler::Call appendCallWithExceptionCheckSetJSValueResult(const FunctionPtr&, int); -
trunk/Source/JavaScriptCore/jit/JITInlines.h
r168729 r171005 119 119 } 120 120 121 #if OS(WINDOWS) && CPU(X86_64) 122 ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithExceptionCheckAndSlowPathReturnType(const FunctionPtr& function) 123 { 124 updateTopCallFrame(); 125 MacroAssembler::Call call = appendCallWithSlowPathReturnType(function); 126 exceptionCheck(); 127 return call; 128 } 129 #endif 130 121 131 ALWAYS_INLINE MacroAssembler::Call JIT::appendCallWithCallFrameRollbackOnException(const FunctionPtr& function) 122 132 { … … 236 246 ALWAYS_INLINE MacroAssembler::Call JIT::callOperation(Sprt_JITOperation_EZ operation, int32_t op) 237 247 { 248 #if OS(WINDOWS) && CPU(X86_64) 249 setupArgumentsWithExecStateForCallWithSlowPathReturnType(TrustedImm32(op)); 250 return appendCallWithExceptionCheckAndSlowPathReturnType(operation); 251 #else 238 252 setupArgumentsWithExecState(TrustedImm32(op)); 239 253 return appendCallWithExceptionCheck(operation); 254 #endif 240 255 } 241 256 -
trunk/Source/WTF/ChangeLog
r170999 r171005 1 2014-07-11 peavo@outlook.com <peavo@outlook.com> 2 3 [Win] Enable DFG JIT. 4 https://bugs.webkit.org/show_bug.cgi?id=123615 5 6 Reviewed by Mark Lam. 7 8 * wtf/Platform.h: 9 1 10 2014-07-11 Commit Queue <commit-queue@webkit.org> 2 11 -
trunk/Source/WTF/wtf/Platform.h
r170968 r171005 696 696 #endif 697 697 698 #if !defined(ENABLE_DFG_JIT) && ENABLE(JIT) && !COMPILER(MSVC)699 /* Enable the DFG JIT on X86 and X86_64. Only tested on Mac, GNU/Linux and FreeBSD.*/700 #if (CPU(X86) || CPU(X86_64)) && (OS(DARWIN) || OS(LINUX) || OS(FREEBSD) )698 #if !defined(ENABLE_DFG_JIT) && ENABLE(JIT) 699 /* Enable the DFG JIT on X86 and X86_64. */ 700 #if (CPU(X86) || CPU(X86_64)) && (OS(DARWIN) || OS(LINUX) || OS(FREEBSD) || OS(WINDOWS)) 701 701 #define ENABLE_DFG_JIT 1 702 702 #endif
Note: See TracChangeset
for help on using the changeset viewer.