Title: [161913] branches/jsCStack/Source/_javascript_Core
Revision
161913
Author
msab...@apple.com
Date
2014-01-13 15:23:52 -0800 (Mon, 13 Jan 2014)

Log Message

CStack Branch: Fix unwind on branch for X86-64
https://bugs.webkit.org/show_bug.cgi?id=126932

Reviewed by Geoffrey Garen.

Added code to push bp ; move sp, bp as the first instructions in callToJavaScript.
This complies with what happens at the top of most functions.  This added push
is used to restore bp in the prologue.  The values for the return PC and save BP in 
the sentinel frame are only used for unwinding.  Made similar mods to other platforms.
Added eh_frame directives to LLInt global labels to get unwinding through them working
as well.

* llint/LowLevelInterpreter.asm:
* llint/LowLevelInterpreter.cpp:
* llint/LowLevelInterpreter64.asm:

Modified Paths

Diff

Modified: branches/jsCStack/Source/_javascript_Core/ChangeLog (161912 => 161913)


--- branches/jsCStack/Source/_javascript_Core/ChangeLog	2014-01-13 23:03:47 UTC (rev 161912)
+++ branches/jsCStack/Source/_javascript_Core/ChangeLog	2014-01-13 23:23:52 UTC (rev 161913)
@@ -1,3 +1,21 @@
+2014-01-13  Michael Saboff  <msab...@apple.com>
+
+        CStack Branch: Fix unwind on branch for X86-64
+        https://bugs.webkit.org/show_bug.cgi?id=126932
+
+        Reviewed by Geoffrey Garen.
+
+        Added code to push bp ; move sp, bp as the first instructions in callToJavaScript.
+        This complies with what happens at the top of most functions.  This added push
+        is used to restore bp in the prologue.  The values for the return PC and save BP in 
+        the sentinel frame are only used for unwinding.  Made similar mods to other platforms.
+        Added eh_frame directives to LLInt global labels to get unwinding through them working
+        as well.
+
+        * llint/LowLevelInterpreter.asm:
+        * llint/LowLevelInterpreter.cpp:
+        * llint/LowLevelInterpreter64.asm:
+
 2014-01-12  Filip Pizlo  <fpi...@apple.com>
 
         internal-js-tests.yaml/Octane/mandreel.js.default-ftl fails about 1/30 times with "TypeError: undefined is not an object"

Modified: branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm (161912 => 161913)


--- branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2014-01-13 23:03:47 UTC (rev 161912)
+++ branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.asm	2014-01-13 23:23:52 UTC (rev 161913)
@@ -305,11 +305,14 @@
 
 macro callToJavaScriptPrologue()
     if X86 or X86_64
+        push cfr
+        move sp, cfr
+        push t0
     elsif ARM64
         pushLRAndFP
     elsif ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS
+        push lr
         push cfr
-        push lr
     end
     pushCalleeSaves
 end
@@ -320,11 +323,13 @@
 
     popCalleeSaves
     if X86 or X86_64
+        pop t6
+        pop cfr
     elsif ARM64
         popLRAndFP
     elsif ARM or ARMv7 or ARMv7_TRADITIONAL or MIPS
+        pop cfr
         pop lr
-        pop cfr
     end
 end
 

Modified: branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.cpp (161912 => 161913)


--- branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.cpp	2014-01-13 23:03:47 UTC (rev 161912)
+++ branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter.cpp	2014-01-13 23:23:52 UTC (rev 161913)
@@ -513,8 +513,17 @@
 //
 
 // These are for building an interpreter from generated assembly code:
+#if CPU(X86_64)
+#define OFFLINE_ASM_BEGIN   asm (                \
+    ".cfi_startproc\n"
+
+#define OFFLINE_ASM_END                          \
+    ".cfi_endproc\n"                             \
+                            );
+#else
 #define OFFLINE_ASM_BEGIN   asm (
 #define OFFLINE_ASM_END     );
+#endif
 
 #define OFFLINE_ASM_OPCODE_LABEL(__opcode) OFFLINE_ASM_GLOBAL_LABEL(llint_##__opcode)
 #define OFFLINE_ASM_GLUE_LABEL(__opcode)   OFFLINE_ASM_GLOBAL_LABEL(__opcode)
@@ -527,6 +536,15 @@
     ".thumb\n"                                   \
     ".thumb_func " THUMB_FUNC_PARAM(label) "\n"  \
     SYMBOL_STRING(label) ":\n"
+#elif CPU(X86_64)
+#define OFFLINE_ASM_GLOBAL_LABEL(label)         \
+    ".text\n"                                   \
+    ".globl " SYMBOL_STRING(label) "\n"         \
+    HIDE_SYMBOL(label) "\n"                     \
+    SYMBOL_STRING(label) ":\n"                  \
+    ".cfi_def_cfa_offset 16\n"                  \
+    ".cfi_offset %rbp, -16\n"                   \
+    ".cfi_def_cfa_register rbp\n"
 #else
 #define OFFLINE_ASM_GLOBAL_LABEL(label)         \
     ".text\n"                                   \

Modified: branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm (161912 => 161913)


--- branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2014-01-13 23:03:47 UTC (rev 161912)
+++ branches/jsCStack/Source/_javascript_Core/llint/LowLevelInterpreter64.asm	2014-01-13 23:23:52 UTC (rev 161913)
@@ -113,11 +113,14 @@
         const temp3 = t6
     end
 
+    callToJavaScriptPrologue()
+
     if X86_64
-        loadp [sp], previousPC
+        loadp 7*8[sp], previousPC
+        move 6*8[sp], previousCFR
+    elsif ARM64
+        move cfr, previousCFR
     end
-    move cfr, previousCFR
-    callToJavaScriptPrologue()
 
     checkStackPointerAlignment(temp2, 0xbad0dc01)
 
@@ -211,7 +214,11 @@
 
     checkStackPointerAlignment(temp3, 0xbad0dc04)
 
+    if X86_64
+        pop t5
+    end
     callToJavaScriptEpilogue()
+
     ret
 end
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to