mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 633924 - MethodGIT broken on mingw-w64 win64 build r=dvander
This commit is contained in:
parent
9f2ea56274
commit
183c92c817
@ -336,6 +336,11 @@ ifeq (x86_64, $(TARGET_CPU))
|
||||
ifdef _MSC_VER
|
||||
ASFILES += TrampolineMasmX64.asm
|
||||
endif
|
||||
ifeq ($(OS_ARCH),WINNT)
|
||||
ifdef GNU_CC
|
||||
ASFILES += TrampolineMingwX64.s
|
||||
endif
|
||||
endif
|
||||
ifdef SOLARIS_SUNPRO_CXX
|
||||
ASFILES += TrampolineSUNWX64.s
|
||||
endif
|
||||
|
@ -71,7 +71,7 @@ struct Registers {
|
||||
|
||||
#if defined(JS_CPU_X86) || defined(JS_CPU_X64)
|
||||
static const RegisterID ReturnReg = JSC::X86Registers::eax;
|
||||
# if defined(JS_CPU_X86) || defined(_MSC_VER)
|
||||
# if defined(JS_CPU_X86) || defined(_WIN64)
|
||||
static const RegisterID ArgReg0 = JSC::X86Registers::ecx;
|
||||
static const RegisterID ArgReg1 = JSC::X86Registers::edx;
|
||||
# if defined(JS_CPU_X64)
|
||||
@ -111,7 +111,7 @@ struct Registers {
|
||||
# if defined(JS_CPU_X64)
|
||||
| (1 << JSC::X86Registers::r8)
|
||||
| (1 << JSC::X86Registers::r9)
|
||||
# if !defined(_MSC_VER)
|
||||
# if !defined(_WIN64)
|
||||
| (1 << JSC::X86Registers::esi)
|
||||
| (1 << JSC::X86Registers::edi)
|
||||
# endif
|
||||
@ -125,7 +125,7 @@ struct Registers {
|
||||
// r13 is TypeMaskReg.
|
||||
// r14 is PayloadMaskReg.
|
||||
| (1 << JSC::X86Registers::r15)
|
||||
# if defined(_MSC_VER)
|
||||
# if defined(_WIN64)
|
||||
| (1 << JSC::X86Registers::esi)
|
||||
| (1 << JSC::X86Registers::edi)
|
||||
# endif
|
||||
|
@ -167,7 +167,7 @@ JS_STATIC_ASSERT(offsetof(JSFrameRegs, sp) == 0);
|
||||
# define HIDE_SYMBOL(name)
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__)
|
||||
#if defined(__GNUC__) && !defined(_WIN64)
|
||||
|
||||
/* If this assert fails, you need to realign VMFrame to 16 bytes. */
|
||||
#ifdef JS_CPU_ARM
|
||||
@ -558,9 +558,7 @@ SYMBOL_STRING(JaegerStubVeneer) ":" "\n"
|
||||
# else
|
||||
# error "Unsupported CPU!"
|
||||
# endif
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#if defined(JS_CPU_X86)
|
||||
#elif defined(_MSC_VER) && defined(JS_CPU_X86)
|
||||
|
||||
/*
|
||||
* *** DANGER ***
|
||||
@ -666,7 +664,9 @@ extern "C" {
|
||||
}
|
||||
}
|
||||
|
||||
#elif defined(JS_CPU_X64)
|
||||
// Windows x64 uses assembler version since compiler doesn't support
|
||||
// inline assembler
|
||||
#elif defined(_WIN64)
|
||||
|
||||
/*
|
||||
* *** DANGER ***
|
||||
@ -678,13 +678,7 @@ JS_STATIC_ASSERT(offsetof(VMFrame, regs.fp) == 0x38);
|
||||
JS_STATIC_ASSERT(JSVAL_TAG_MASK == 0xFFFF800000000000LL);
|
||||
JS_STATIC_ASSERT(JSVAL_PAYLOAD_MASK == 0x00007FFFFFFFFFFFLL);
|
||||
|
||||
// Windows x64 uses assembler version since compiler doesn't support
|
||||
// inline assembler
|
||||
#else
|
||||
# error "Unsupported CPU!"
|
||||
#endif
|
||||
|
||||
#endif /* _MSC_VER */
|
||||
#endif /* _WIN64 */
|
||||
|
||||
bool
|
||||
JaegerCompartment::Initialize()
|
||||
|
@ -485,7 +485,7 @@ JSScript::nativeCodeForPC(bool constructing, jsbytecode *pc)
|
||||
return native;
|
||||
}
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#if defined(_MSC_VER) || defined(_WIN64)
|
||||
extern "C" void *JaegerThrowpoline(js::VMFrame *vmFrame);
|
||||
#else
|
||||
extern "C" void JaegerThrowpoline();
|
||||
|
190
js/src/methodjit/TrampolineMingwX64.s
Normal file
190
js/src/methodjit/TrampolineMingwX64.s
Normal file
@ -0,0 +1,190 @@
|
||||
# -*- Mode: C++# tab-width: 4# indent-tabs-mode: nil# c-basic-offset: 4 -*-
|
||||
# ***** BEGIN LICENSE BLOCK *****
|
||||
# Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
#
|
||||
# The contents of this file are subject to the Mozilla Public License Version
|
||||
# 1.1 (the "License")# you may not use this file except in compliance with
|
||||
# the License. You may obtain a copy of the License at
|
||||
# http://www.mozilla.org/MPL/
|
||||
#
|
||||
# Software distributed under the License is distributed on an "AS IS" basis,
|
||||
# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
# for the specific language governing rights and limitations under the
|
||||
# License.
|
||||
#
|
||||
# The Original Code is mozilla.org code.
|
||||
#
|
||||
# The Initial Developer of the Original Code is Mozilla Japan.
|
||||
# Portions created by the Initial Developer are Copyright (C) 2010
|
||||
# the Initial Developer. All Rights Reserved.
|
||||
#
|
||||
# Contributor(s):
|
||||
# Makoto Kato <m_kato@ga2.so-net.ne.jp>
|
||||
#
|
||||
# Alternatively, the contents of this file may be used under the terms of
|
||||
# either the GNU General Public License Version 2 or later (the "GPL"), or
|
||||
# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
# in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
# of those above. If you wish to allow use of your version of this file only
|
||||
# under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
# use your version of this file under the terms of the MPL, indicate your
|
||||
# decision by deleting the provisions above and replace them with the notice
|
||||
# and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
# the provisions above, a recipient may use your version of this file under
|
||||
# the terms of any one of the MPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
|
||||
|
||||
.extern js_InternalThrow
|
||||
.extern SetVMFrameRegs
|
||||
.extern PushActiveVMFrame
|
||||
.extern PopActiveVMFrame
|
||||
|
||||
.text
|
||||
.intel_syntax noprefix
|
||||
|
||||
# JSBool JaegerTrampoline(JSContext *cx, JSStackFrame *fp, void *code,
|
||||
# Value *stackLimit, void *safePoint)#
|
||||
.globl JaegerTrampoline
|
||||
.def JaegerTrampoline
|
||||
.scl 3
|
||||
.type 46
|
||||
.endef
|
||||
JaegerTrampoline:
|
||||
push rbp
|
||||
# .PUSHREG rbp
|
||||
mov rbp, rsp
|
||||
# .SETFRAME rbp, 0
|
||||
push r12
|
||||
# .PUSHREG r12
|
||||
push r13
|
||||
# .PUSHREG r13
|
||||
push r14
|
||||
# .PUSHREG r14
|
||||
push r15
|
||||
# .PUSHREG r15
|
||||
push rdi
|
||||
# .PUSHREG rdi
|
||||
push rsi
|
||||
# .PUSHREG rsi
|
||||
push rbx
|
||||
# .PUSHREG rbx
|
||||
# .ENDPROLOG
|
||||
|
||||
# Load mask registers
|
||||
mov r13, 0xffff800000000000
|
||||
mov r14, 0x7fffffffffff
|
||||
|
||||
# Build the JIT frame.
|
||||
# rcx = cx
|
||||
# rdx = fp
|
||||
# r9 = inlineCallCount
|
||||
# fp must go into rbx
|
||||
push rdx # entryFp
|
||||
push r9 # inlineCallCount
|
||||
push rcx # cx
|
||||
push rdx # fp
|
||||
mov rbx, rdx
|
||||
|
||||
# Space for the rest of the VMFrame.
|
||||
sub rsp, 0x28
|
||||
|
||||
# This is actually part of the VMFrame.
|
||||
mov r10, [rbp+8*5+8]
|
||||
push r10
|
||||
|
||||
# Set cx->regs and set the active frame. Save r8 and align frame in one
|
||||
push r8
|
||||
mov rcx, rsp
|
||||
sub rsp, 0x20
|
||||
call SetVMFrameRegs
|
||||
lea rcx, [rsp+0x20]
|
||||
call PushActiveVMFrame
|
||||
add rsp, 0x20
|
||||
|
||||
# Jump into the JIT code.
|
||||
jmp qword ptr [rsp]
|
||||
|
||||
# void JaegerTrampolineReturn()#
|
||||
.globl JaegerTrampolineReturn
|
||||
.def JaegerTrampolineReturn
|
||||
.scl 3
|
||||
.type 46
|
||||
.endef
|
||||
JaegerTrampolineReturn:
|
||||
# .ENDPROLOG
|
||||
or rcx, rdx
|
||||
mov qword ptr [rbx + 0x30], rcx
|
||||
sub rsp, 0x20
|
||||
lea rcx, [rsp+0x20]
|
||||
call PopActiveVMFrame
|
||||
|
||||
add rsp, 0x58+0x20
|
||||
pop rbx
|
||||
pop rsi
|
||||
pop rdi
|
||||
pop r15
|
||||
pop r14
|
||||
pop r13
|
||||
pop r12
|
||||
pop rbp
|
||||
mov rax, 1
|
||||
ret
|
||||
|
||||
|
||||
# void JaegerThrowpoline()
|
||||
.globl JaegerThrowpoline
|
||||
.def JaegerTrampoline
|
||||
.scl 3
|
||||
.type 46
|
||||
.endef
|
||||
JaegerThrowpoline:
|
||||
# .ENDPROLOG
|
||||
# For Windows x64 stub calls, we pad the stack by 32 before
|
||||
# calling, so we must account for that here. See doStubCall.
|
||||
lea rcx, [rsp+0x20]
|
||||
call js_InternalThrow
|
||||
test rax, rax
|
||||
je throwpoline_exit
|
||||
add rsp, 0x20
|
||||
jmp rax
|
||||
|
||||
throwpoline_exit:
|
||||
lea rcx, [rsp+0x20]
|
||||
call PopActiveVMFrame
|
||||
add rsp, 0x58+0x20
|
||||
pop rbx
|
||||
pop rsi
|
||||
pop rdi
|
||||
pop r15
|
||||
pop r14
|
||||
pop r13
|
||||
pop r12
|
||||
pop rbp
|
||||
xor rax, rax
|
||||
ret
|
||||
|
||||
|
||||
|
||||
# void InjectJaegerReturn()#
|
||||
.globl InjectJaegerReturn
|
||||
.def InjectJaegerReturn
|
||||
.scl 3
|
||||
.type 46
|
||||
.endef
|
||||
InjectJaegerReturn:
|
||||
# .ENDPROLOG
|
||||
mov rcx, qword ptr [rbx+0x30] # load fp->rval_ into typeReg
|
||||
mov rax, qword ptr [rbx+0x28] # fp->ncode_
|
||||
|
||||
# Reimplementation of PunboxAssembler::loadValueAsComponents()
|
||||
mov rdx, r14
|
||||
and rdx, rcx
|
||||
xor rcx, rdx
|
||||
|
||||
# For Windows x64 stub calls, we pad the stack by 32 before
|
||||
# calling, so we must account for that here. See doStubCall.
|
||||
mov rbx, qword ptr [rsp+0x38+0x20] # f.fp
|
||||
add rsp, 0x20
|
||||
jmp rax # return
|
Loading…
Reference in New Issue
Block a user