Title: [294768] trunk/Source/_javascript_Core/llint/LowLevelInterpreter.cpp
Revision
294768
Author
[email protected]
Date
2022-05-24 14:55:45 -0700 (Tue, 24 May 2022)

Log Message

Use the Clang .alt_entry directive to allow use of global labels in LLInt asm.
https://bugs.webkit.org/show_bug.cgi?id=240881

Reviewed by Geoffrey Garen.

With this, debugging LLInt code will be easier.  LLInt code will no longer all be at an
offset from vmEntryToJavaScript.  They will instead be broken up into different sections
under human readable labels.

Secondly, crash traces of LLInt crashes will now be able to give us the nearest label
for a crash site, as opposed to everything being an offset from vmEntryToJavaScript.

For example, instead of this:

    _javascript_Core`vmEntryToJavaScript:
        0x1026525b8 <+0>:   pacibsp
        0x1026525bc <+4>:   stp    x29, x30, [sp, #-0x10]!
        0x1026525c0 <+8>:   mov    x29, sp
        0x1026525c4 <+12>:  sub    sp, x29, #0xb0
        0x1026525c8 <+16>:  mov    x13, #0xc800
        0x1026525cc <+20>:  add    x17, x1, x13
        0x1026525d0 <+24>:  ldr    w4, [x17]
        0x1026525d4 <+28>:  cbnz   w4, 0x10265275c           ; vmEntryToJavaScriptGateAfter + 120
        0x1026525d8 <+32>:  str    x1, [sp]
        0x1026525dc <+36>:  mov    x17, #0x9e78
        0x1026525e0 <+40>:  add    x13, x1, x17
        0x1026525e4 <+44>:  ldr    x4, [x13]
        0x1026525e8 <+48>:  str    x4, [sp, #0x8]
        0x1026525ec <+52>:  mov    x13, #0x9e70
        0x1026525f0 <+56>:  add    x17, x1, x13
        0x1026525f4 <+60>:  ldr    x4, [x17]
        0x1026525f8 <+64>:  str    x4, [sp, #0x10]
        0x1026525fc <+68>:  ldr    x4, [x2, #0x8]
        0x102652600 <+72>:  str    x4, [sp, #0x18]
        0x102652604 <+76>:  ldr    w4, [x2, #0x20]
        0x102652608 <+80>:  add    x4, x4, #0x5
        0x10265260c <+84>:  lsl    x4, x4, #3
        0x102652610 <+88>:  sub    x3, sp, x4
        0x102652614 <+92>:  cmp    sp, x3
        0x102652618 <+96>:  b.ls   0x10265271c               ; vmEntryToJavaScriptGateAfter + 56
        0x10265261c <+100>: mov    x17, #0xca00
        0x102652620 <+104>: add    x13, x1, x17
        0x102652624 <+108>: ldr    x17, [x13]
        0x102652628 <+112>: cmp    x3, x17
        0x10265262c <+116>: b.lo   0x10265271c               ; vmEntryToJavaScriptGateAfter + 56
        0x102652630 <+120>: mov    sp, x3
        0x102652634 <+124>: mov    x3, #0x4
        0x102652638 <+128>: sub    w3, w3, #0x1
        0x10265263c <+132>: add    x17, x2, x3, lsl #3
        0x102652640 <+136>: ldr    x5, [x17]

We now get this:

    _javascript_Core`vmEntryToJavaScript:
        0x1028b5d90 <+0>:   pacibsp
        0x1028b5d94 <+4>:   stp    x29, x30, [sp, #-0x10]!
        0x1028b5d98 <+8>:   mov    x29, sp
        0x1028b5d9c <+12>:  sub    sp, x29, #0xb0
        0x1028b5da0 <+16>:  mov    x13, #0xc800
        0x1028b5da4 <+20>:  add    x17, x1, x13
        0x1028b5da8 <+24>:  ldr    w4, [x17]
        0x1028b5dac <+28>:  cbnz   w4, 0x1028b5f34           ; _offlineasm_doVMEntry__checkVMEntryPermission
        0x1028b5db0 <+32>:  str    x1, [sp]
        0x1028b5db4 <+36>:  mov    x17, #0x9e78
        0x1028b5db8 <+40>:  add    x13, x1, x17
        0x1028b5dbc <+44>:  ldr    x4, [x13]
        0x1028b5dc0 <+48>:  str    x4, [sp, #0x8]
        0x1028b5dc4 <+52>:  mov    x13, #0x9e70
        0x1028b5dc8 <+56>:  add    x17, x1, x13
        0x1028b5dcc <+60>:  ldr    x4, [x17]
        0x1028b5dd0 <+64>:  str    x4, [sp, #0x10]
        0x1028b5dd4 <+68>:  ldr    x4, [x2, #0x8]
        0x1028b5dd8 <+72>:  str    x4, [sp, #0x18]
        0x1028b5ddc <+76>:  ldr    w4, [x2, #0x20]
        0x1028b5de0 <+80>:  add    x4, x4, #0x5
        0x1028b5de4 <+84>:  lsl    x4, x4, #3
        0x1028b5de8 <+88>:  sub    x3, sp, x4
        0x1028b5dec <+92>:  cmp    sp, x3
        0x1028b5df0 <+96>:  b.ls   0x1028b5ef4               ; _offlineasm_doVMEntry__throwStackOverflow
        0x1028b5df4 <+100>: mov    x17, #0xca00
        0x1028b5df8 <+104>: add    x13, x1, x17
        0x1028b5dfc <+108>: ldr    x17, [x13]
        0x1028b5e00 <+112>: cmp    x3, x17
        0x1028b5e04 <+116>: b.lo   0x1028b5ef4               ; _offlineasm_doVMEntry__throwStackOverflow

    _javascript_Core`_offlineasm_doVMEntry__stackHeightOK:
        0x1028b5e08 <+0>:   mov    sp, x3
        0x1028b5e0c <+4>:   mov    x3, #0x4

    _javascript_Core`_offlineasm_doVMEntry__copyHeaderLoop:
        0x1028b5e10 <+0>:   sub    w3, w3, #0x1
        0x1028b5e14 <+4>:   add    x17, x2, x3, lsl #3
        0x1028b5e18 <+8>:   ldr    x5, [x17]

This feature is only available when COMPILER(CLANG) is true.

* Source/_javascript_Core/llint/LowLevelInterpreter.cpp:

Canonical link: https://commits.webkit.org/250933@main

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/llint/LowLevelInterpreter.cpp (294767 => 294768)


--- trunk/Source/_javascript_Core/llint/LowLevelInterpreter.cpp	2022-05-24 21:49:41 UTC (rev 294767)
+++ trunk/Source/_javascript_Core/llint/LowLevelInterpreter.cpp	2022-05-24 21:55:45 UTC (rev 294768)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2012-2020 Apple Inc. All rights reserved.
+ * Copyright (C) 2012-2022 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -521,8 +521,18 @@
     SYMBOL_STRING(label) ":\n"
 #endif
 
-#define OFFLINE_ASM_LOCAL_LABEL(label)   LOCAL_LABEL_STRING(label) ":\n"
+#if COMPILER(CLANG)
+#define OFFLINE_ASM_ALT_GLOBAL_LABEL(label) \
+    ".alt_entry " SYMBOL_STRING(label) "\n" \
+    OFFLINE_ASM_GLOBAL_LABEL(label)
+#else
+#define OFFLINE_ASM_ALT_GLOBAL_LABEL(label)
+#endif
 
+#define OFFLINE_ASM_LOCAL_LABEL(label) \
+    LOCAL_LABEL_STRING(label) ":\n" \
+    OFFLINE_ASM_ALT_GLOBAL_LABEL(label)
+
 #if OS(LINUX)
 #define OFFLINE_ASM_OPCODE_DEBUG_LABEL(label)  #label ":\n"
 #else
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to