diff options
author | Jocelyn Turcotte <jocelyn.turcotte@digia.com> | 2013-02-26 13:04:28 +0000 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2013-03-29 13:02:40 +0100 |
commit | fad1b063ed174a07392561c0323355115aa66992 (patch) | |
tree | e13e43fceb11e521a5c1e16ffb05144de1544d8a /Source/JavaScriptCore/yarr/YarrJIT.cpp | |
parent | f90b754393618f5eee1e44d30a7cefd5ace7e1c4 (diff) | |
download | qtwebkit-fad1b063ed174a07392561c0323355115aa66992.tar.gz |
Implement JIT on Windows 64 bits
https://bugs.webkit.org/show_bug.cgi?id=107965
Reviewed by Simon Hausmann.
Source/JavaScriptCore:
1. MSVC doesn't support inline assembly for 64 bits, implements the trampoline in a separate ASM file.
2. Windows 64 bits has a different calling convention than other OSes following the AMD64 ABI.
Differences that we have to handle here:
- Registers passed parameters are RCX, RDX, R8 and R9 instead of RDI, RSI, RDX, RCX, R8 and R9
- RDI and RSI must be preserved by callee
- Only return values <= 8 bytes can be returned by register (RDX can't be used to return a second word)
- There is no red-zone after RIP on the stack, but instead 4 reserved words before it
* Target.pri:
* jit/JITStubs.cpp:
* jit/JITStubs.h:
(JSC):
(JITStackFrame):
(JSC::JITStackFrame::returnAddressSlot):
* jit/JITStubsMSVC64.asm: Added.
* jit/JSInterfaceJIT.h:
(JSInterfaceJIT):
* jit/ThunkGenerators.cpp:
(JSC::nativeForGenerator):
* yarr/YarrJIT.cpp:
(YarrGenerator):
(JSC::Yarr::YarrGenerator::generateEnter):
(JSC::Yarr::YarrGenerator::generateReturn):
Source/WTF:
* wtf/Platform.h:
Change-Id: Ie1910350e36defcd427a95ceb9aa280fa61083e7
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@144043 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Reviewed-by: Jocelyn Turcotte <jocelyn.turcotte@digia.com>
Diffstat (limited to 'Source/JavaScriptCore/yarr/YarrJIT.cpp')
-rw-r--r-- | Source/JavaScriptCore/yarr/YarrJIT.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/Source/JavaScriptCore/yarr/YarrJIT.cpp b/Source/JavaScriptCore/yarr/YarrJIT.cpp index ce84e2c74..d5b215413 100644 --- a/Source/JavaScriptCore/yarr/YarrJIT.cpp +++ b/Source/JavaScriptCore/yarr/YarrJIT.cpp @@ -87,10 +87,20 @@ class YarrGenerator : private MacroAssembler { static const RegisterID returnRegister = X86Registers::eax; static const RegisterID returnRegister2 = X86Registers::edx; #elif CPU(X86_64) +#if !OS(WINDOWS) static const RegisterID input = X86Registers::edi; static const RegisterID index = X86Registers::esi; static const RegisterID length = X86Registers::edx; static const RegisterID output = X86Registers::ecx; +#else + // If the return value doesn't fit in 64bits, its destination is pointed by rcx and the parameters are shifted. + // http://msdn.microsoft.com/en-us/library/7572ztz4.aspx + COMPILE_ASSERT(sizeof(MatchResult) > sizeof(void*), MatchResult_does_not_fit_in_64bits); + static const RegisterID input = X86Registers::edx; + static const RegisterID index = X86Registers::r8; + static const RegisterID length = X86Registers::r9; + static const RegisterID output = X86Registers::r10; +#endif static const RegisterID regT0 = X86Registers::eax; static const RegisterID regT1 = X86Registers::ebx; @@ -2502,6 +2512,10 @@ class YarrGenerator : private MacroAssembler { push(X86Registers::ebp); move(stackPointerRegister, X86Registers::ebp); push(X86Registers::ebx); +#if OS(WINDOWS) + if (compileMode == IncludeSubpatterns) + loadPtr(Address(X86Registers::ebp, 6 * sizeof(void*)), output); +#endif #elif CPU(X86) push(X86Registers::ebp); move(stackPointerRegister, X86Registers::ebp); @@ -2540,6 +2554,12 @@ class YarrGenerator : private MacroAssembler { void generateReturn() { #if CPU(X86_64) +#if OS(WINDOWS) + // Store the return value in the allocated space pointed by rcx. + store64(returnRegister, Address(X86Registers::ecx)); + store64(returnRegister2, Address(X86Registers::ecx, sizeof(void*))); + move(X86Registers::ecx, returnRegister); +#endif pop(X86Registers::ebx); pop(X86Registers::ebp); #elif CPU(X86) |