LLInt: reserve 16 bytes of stack on MIPS for native calls
authorguijemont@igalia.com <guijemont@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Dec 2017 18:40:29 +0000 (18:40 +0000)
committerguijemont@igalia.com <guijemont@igalia.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 12 Dec 2017 18:40:29 +0000 (18:40 +0000)
https://bugs.webkit.org/show_bug.cgi?id=180653

Reviewed by Carlos Alberto Lopez Perez.

* llint/LowLevelInterpreter32_64.asm:
On MIPS, substract 24 from the stack pointer (16 for calling
convention + 8 to be 16-aligned) instead of the 8 on other platforms
(for alignment).

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@225788 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/llint/LowLevelInterpreter32_64.asm

index 820ee99..2a169c9 100644 (file)
@@ -1,3 +1,15 @@
+2017-12-12  Guillaume Emont  <guijemont@igalia.com>
+
+        LLInt: reserve 16 bytes of stack on MIPS for native calls
+        https://bugs.webkit.org/show_bug.cgi?id=180653
+
+        Reviewed by Carlos Alberto Lopez Perez.
+
+        * llint/LowLevelInterpreter32_64.asm:
+        On MIPS, substract 24 from the stack pointer (16 for calling
+        convention + 8 to be 16-aligned) instead of the 8 on other platforms
+        (for alignment).
+
 2017-12-12  Yusuke Suzuki  <utatane.tea@gmail.com>
 
         [WTF] Thread::create should have Thread::tryCreate
index 7d6269c..a7a457c 100644 (file)
@@ -2082,7 +2082,14 @@ macro nativeCallTrampoline(executableOffsetToFunction)
         loadp MarkedBlock::m_vm[t3], t3
         addp 8, sp
     elsif ARM or ARMv7 or ARMv7_TRADITIONAL or C_LOOP or MIPS
-        subp 8, sp # align stack pointer
+        if MIPS
+        # calling convention says to save stack space for 4 first registers in
+        # all cases. To match our 16-byte alignment, that means we need to
+        # take 24 bytes
+            subp 24, sp
+        else
+            subp 8, sp # align stack pointer
+        end
         # t1 already contains the Callee.
         andp MarkedBlockMask, t1
         loadp MarkedBlock::m_vm[t1], t1
@@ -2099,7 +2106,11 @@ macro nativeCallTrampoline(executableOffsetToFunction)
         loadp Callee + PayloadOffset[cfr], t3
         andp MarkedBlockMask, t3
         loadp MarkedBlock::m_vm[t3], t3
-        addp 8, sp
+        if MIPS
+            addp 24, sp
+        else
+            addp 8, sp
+        end
     else
         error
     end