Title: [157650] trunk/Source/_javascript_Core
Revision
157650
Author
[email protected]
Date
2013-10-18 15:57:15 -0700 (Fri, 18 Oct 2013)

Log Message

Remove excess reserved space in ctiTrampoline frames for X86 and X86_64.
https://bugs.webkit.org/show_bug.cgi?id=123037.

Reviewed by Geoffrey Garen.

* jit/JITStubsMSVC64.asm:
* jit/JITStubsX86.h:
* jit/JITStubsX86_64.h:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (157649 => 157650)


--- trunk/Source/_javascript_Core/ChangeLog	2013-10-18 21:41:51 UTC (rev 157649)
+++ trunk/Source/_javascript_Core/ChangeLog	2013-10-18 22:57:15 UTC (rev 157650)
@@ -1,3 +1,14 @@
+2013-10-18  Mark Lam  <[email protected]>
+
+        Remove excess reserved space in ctiTrampoline frames for X86 and X86_64.
+        https://bugs.webkit.org/show_bug.cgi?id=123037.
+
+        Reviewed by Geoffrey Garen.
+
+        * jit/JITStubsMSVC64.asm:
+        * jit/JITStubsX86.h:
+        * jit/JITStubsX86_64.h:
+
 2013-10-18  Filip Pizlo  <[email protected]>
 
         Frequent RELEASE_ASSERT crashes in Structure::checkOffsetConsistency on WebGL swizzler tests

Modified: trunk/Source/_javascript_Core/jit/JITStubsMSVC64.asm (157649 => 157650)


--- trunk/Source/_javascript_Core/jit/JITStubsMSVC64.asm	2013-10-18 21:41:51 UTC (rev 157649)
+++ trunk/Source/_javascript_Core/jit/JITStubsMSVC64.asm	2013-10-18 22:57:15 UTC (rev 157650)
@@ -46,14 +46,17 @@
     push r15
     push rbx
 
-    ; Decrease rsp to point to the start of our JITStackFrame
-    sub rsp, 58h
+    ; JIT operations can use up to 6 args (4 in registers and 2 on the stack).
+    ; In addition, X86_64 ABI specifies that the worse case stack alignment
+    ; requirement is 32 bytes. Based on these factors, we need to pad the stack
+    ; and additional 28h bytes.
+    sub rsp, 28h
     mov r12, 512
     mov r14, 0FFFF000000000000h
     mov r15, 0FFFF000000000002h
     mov r13, r8
     call rcx
-    add rsp, 58h
+    add rsp, 28h
     pop rbx
     pop r15
     pop r14
@@ -64,7 +67,7 @@
 ctiTrampoline ENDP
 
 ctiOpThrowNotCaught PROC
-    add rsp, 58h
+    add rsp, 28h
     pop rbx
     pop r15
     pop r14

Modified: trunk/Source/_javascript_Core/jit/JITStubsX86.h (157649 => 157650)


--- trunk/Source/_javascript_Core/jit/JITStubsX86.h	2013-10-18 21:41:51 UTC (rev 157649)
+++ trunk/Source/_javascript_Core/jit/JITStubsX86.h	2013-10-18 22:57:15 UTC (rev 157650)
@@ -55,10 +55,16 @@
     "pushl %esi" "\n"
     "pushl %edi" "\n"
     "pushl %ebx" "\n"
-    "subl $0x3c, %esp" "\n"
-    "movl 0x58(%esp), %edi" "\n"
-    "call *0x50(%esp)" "\n"
-    "addl $0x3c, %esp" "\n"
+
+    // JIT Operation can use up to 6 arguments right now. So, we need to
+    // reserve space in this stack frame for the out-going args. To ensure that
+    // the stack remains aligned on an 16 byte boundary, we round the padding up
+    // by 0x1c bytes.
+    "subl $0x1c, %esp" "\n"
+    "movl 0x38(%esp), %edi" "\n"
+    "call *0x30(%esp)" "\n"
+    "addl $0x1c, %esp" "\n"
+
     "popl %ebx" "\n"
     "popl %edi" "\n"
     "popl %esi" "\n"
@@ -73,7 +79,7 @@
 ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
 HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
 SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
-    "addl $0x3c, %esp" "\n"
+    "addl $0x1c, %esp" "\n"
     "popl %ebx" "\n"
     "popl %edi" "\n"
     "popl %esi" "\n"
@@ -248,11 +254,11 @@
             push esi;
             push edi;
             push ebx;
-            sub esp, 0x3c;
+            sub esp, 0x1c;
             mov ecx, esp;
-            mov edi, [esp + 0x58];
-            call [esp + 0x50];
-            add esp, 0x3c;
+            mov edi, [esp + 0x38];
+            call [esp + 0x30];
+            add esp, 0x1c;
             pop ebx;
             pop edi;
             pop esi;
@@ -264,7 +270,7 @@
     __declspec(naked) void ctiOpThrowNotCaught()
     {
         __asm {
-            add esp, 0x3c;
+            add esp, 0x1c;
             pop ebx;
             pop edi;
             pop esi;

Modified: trunk/Source/_javascript_Core/jit/JITStubsX86_64.h (157649 => 157650)


--- trunk/Source/_javascript_Core/jit/JITStubsX86_64.h	2013-10-18 21:41:51 UTC (rev 157649)
+++ trunk/Source/_javascript_Core/jit/JITStubsX86_64.h	2013-10-18 22:57:15 UTC (rev 157650)
@@ -57,20 +57,17 @@
     "pushq %r14" "\n"
     "pushq %r15" "\n"
     "pushq %rbx" "\n"
-    // Form the JIT stubs area
-    "pushq %r9" "\n"
-    "pushq %r8" "\n"
-    "pushq %rcx" "\n"
-    "pushq %rdx" "\n"
-    "pushq %rsi" "\n"
-    "pushq %rdi" "\n"
-    "subq $0x48, %rsp" "\n"
+
+    // The X86_64 ABI specifies that the worse case stack alignment requirement
+    // is 32 bytes.
+    "subq $0x8, %rsp" "\n"
+
     "movq $512, %r12" "\n"
     "movq $0xFFFF000000000000, %r14" "\n"
     "movq $0xFFFF000000000002, %r15" "\n"
     "movq %rdx, %r13" "\n"
     "call *%rdi" "\n"
-    "addq $0x78, %rsp" "\n"
+    "addq $0x8, %rsp" "\n"
     "popq %rbx" "\n"
     "popq %r15" "\n"
     "popq %r14" "\n"
@@ -87,7 +84,7 @@
 ".globl " SYMBOL_STRING(ctiOpThrowNotCaught) "\n"
 HIDE_SYMBOL(ctiOpThrowNotCaught) "\n"
 SYMBOL_STRING(ctiOpThrowNotCaught) ":" "\n"
-    "addq $0x78, %rsp" "\n"
+    "addq $0x8, %rsp" "\n"
     "popq %rbx" "\n"
     "popq %r15" "\n"
     "popq %r14" "\n"
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to