Bug 686117 - Port TI assembly changes to mingw-w64 variant [r=dvander, NPOTB, DONTBUILD]
authorJacek Caban <jacek@codeweavers.com>
Wed, 14 Sep 2011 16:12:15 +0200
changeset 76962 f29f86ffe8c415c55c3a72d2f5bd8ea739964a26
parent 76961 131496f18137900fa4531381381c2836becf3f75
child 76963 061b6c26a01920d722e39c46e76492ff0515c012
push id3
push userfelipc@gmail.com
push dateFri, 30 Sep 2011 20:09:13 +0000
reviewersdvander, NPOTB, DONTBUILD
bugs686117
milestone9.0a1
Bug 686117 - Port TI assembly changes to mingw-w64 variant [r=dvander, NPOTB, DONTBUILD]
js/src/methodjit/TrampolineMingwX64.s
--- a/js/src/methodjit/TrampolineMingwX64.s
+++ b/js/src/methodjit/TrampolineMingwX64.s
@@ -35,16 +35,17 @@
 #
 # ***** END LICENSE BLOCK *****
 
 
 .extern js_InternalThrow
 .extern SetVMFrameRegs
 .extern PushActiveVMFrame
 .extern PopActiveVMFrame
+.extern js_InternalInterpret
 
 .text
 .intel_syntax noprefix
 
 # JSBool JaegerTrampoline(JSContext *cx, StackFrame *fp, void *code,
 #                         Value *stackLimit, void *safePoint)#
 .globl JaegerTrampoline
 .def JaegerTrampoline
@@ -76,16 +77,18 @@ JaegerTrampoline:
     mov     r13, 0xffff800000000000
     mov     r14, 0x7fffffffffff
 
     # Build the JIT frame.
     # rcx = cx
     # rdx = fp
     # r9 = inlineCallCount
     # fp must go into rbx
+    push    0       # stubRejoin
+    push    rdx     # entryncode
     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
@@ -110,22 +113,22 @@ JaegerTrampoline:
 .globl JaegerTrampolineReturn
 .def JaegerTrampolineReturn
    .scl 3
    .type 46
 .endef
 JaegerTrampolineReturn:
     # .ENDPROLOG
     or      rsi, rdi
-    mov     qword ptr [rbx + 0x30], rcx
+    mov     qword ptr [rbx + 0x30], rsi
     sub     rsp, 0x20
     lea     rcx, [rsp+0x20]
     call    PopActiveVMFrame
 
-    add     rsp, 0x58+0x20
+    add     rsp, 0x68+0x20
     pop     rbx
     pop     rsi
     pop     rdi
     pop     r15
     pop     r14
     pop     r13
     pop     r12
     pop     rbp
@@ -148,21 +151,81 @@ JaegerThrowpoline:
     test    rax, rax
     je      throwpoline_exit
     add     rsp, 0x20
     jmp     rax
 
 throwpoline_exit:
     lea     rcx, [rsp+0x20]
     call    PopActiveVMFrame
-    add     rsp, 0x58+0x20
+    add     rsp, 0x68+0x20
     pop     rbx
     pop     rsi
     pop     rdi
     pop     r15
     pop     r14
     pop     r13
     pop     r12
     pop     rbp
     xor     rax, rax
     ret
 
 
+.globl JaegerInterpoline
+.def JaegerInterpoline
+   .scl 3
+   .type 46
+.endef
+JaegerInterpoline:
+    #.ENDPROLOG
+    mov     rcx, rdi
+    mov     rdx, rsi
+    lea     r9, [rsp+0x20]
+    mov     r8, rax
+    call    js_InternalInterpret
+    mov     rbx, qword ptr [rsp+0x38+0x20] # Load Frame
+    mov     rsi, qword ptr [rbx+0x30]      # Load rval payload
+    and     rsi, r14                       # Mask rval payload
+    mov     rdi, qword ptr [rbx+0x30]      # Load rval type
+    and     rdi, r13                       # Mask rval type
+    mov     rcx, qword ptr [rsp+0x18+0x20] # Load scratch -> argc
+    test    rax, rax
+    je      interpoline_exit
+    add     rsp, 0x20
+    jmp     rax
+
+interpoline_exit:
+    lea     rcx, [rsp+0x20]
+    call    PopActiveVMFrame
+    add     rsp, 0x68+0x20
+    pop     rbx
+    pop     rsi
+    pop     rdi
+    pop     r15
+    pop     r14
+    pop     r13
+    pop     r12
+    pop     rbp
+    xor     rax, rax
+    ret
+
+.globl JaegerInterpolineScripted
+.def JaegerInterpolineScripted
+   .scl 3
+   .type 46
+.endef
+JaegerInterpolineScripted:
+    #.ENDPROLOG
+    mov     rbx, qword ptr [rbx+0x20] # Load prev
+    mov     qword ptr [rsp+0x38], rbx # fp -> regs.fp
+    sub     rsp, 0x20
+    jmp     JaegerInterpoline
+
+.globl JaegerInterpolinePatched
+.def JaegerInterpolinePatched
+   .scl 3
+   .type 46
+.endef
+JaegerInterpolinePatched:
+    sub     rsp, 0x20
+    #.ALLOCSTACK 32
+    #.ENDPROLOG
+    jmp     JaegerInterpoline