[webkit-changes] [WebKit/WebKit] 95dcff: Remove unnecessary add when loading a JSCConfig fi...

EWS noreply at github.com
Tue Jan 31 08:05:30 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 95dcffb800f801ab71e757f034cc5ccbde53f61e
      https://github.com/WebKit/WebKit/commit/95dcffb800f801ab71e757f034cc5ccbde53f61e
  Author: Mark Lam <mark.lam at apple.com>
  Date:   2023-01-31 (Tue, 31 Jan 2023)

  Changed paths:
    M Source/JavaScriptCore/llint/LowLevelInterpreter.asm
    M Source/JavaScriptCore/llint/LowLevelInterpreter64.asm
    M Source/JavaScriptCore/llint/WebAssembly.asm

  Log Message:
  -----------
  Remove unnecessary add when loading a JSCConfig field.
https://bugs.webkit.org/show_bug.cgi?id=251421
rdar://104854843

Reviewed by Tadeu Zagallo.

Currently, to load a JSCConfig field, our LLInt asm does something like this:
```
    leap JSCConfig + constexpr JSC::offsetOfJSCConfigGateMap + (constexpr Gate::%opcodeName%) * PtrSize, ws1
    jmp [ws1], NativeToJITGatePtrTag # JSEntrySlowPathPtrTag
```
... and generates this:
```
                  #if OS(DARWIN)
".loc 1 1\n"          "Ljsc_llint_loh_adrp_1508: \n"       // LowLevelInterpreter.asm:1
                      "adrp x10, " LOCAL_REFERENCE(g_config) "@GOTPAGE \n"
                      "Ljsc_llint_loh_ldr_1508: \n"
                      "ldr x10, [x10, " LOCAL_REFERENCE(g_config) "@GOTPAGEOFF] \n"
                  #elif OS(LINUX)
                      ...
                  #endif
".loc 1 1\n"          "add x10, x10, #3592 \n"   // <---- this add can be applied as an offset to the ldr below.
".loc 6 1034\n"       "movz x13, #57366 \n"                // WebAssembly.asm:1034
                      "ldr x17, [x10] \n"
                      "brab x17, x13 \n"
```

This patch re-arranges the LLInt assembly to look like this instead:
```
    leap _g_config, ws1
    jmp JSCConfigGateMapOffset + (constexpr Gate::%opcodeName%) * PtrSize[ws1], NativeToJITGatePtrTag # JSEntrySlowPathPtrTag
```
... resulting in the removal of the unnecessary add instruction:
```
                  #if OS(DARWIN)
".loc 1 1\n"          "Ljsc_llint_loh_adrp_1508: \n"       // LowLevelInterpreter.asm:1
                      "adrp x10, " LOCAL_REFERENCE(g_config) "@GOTPAGE \n"
                      "Ljsc_llint_loh_ldr_1508: \n"
                      "ldr x10, [x10, " LOCAL_REFERENCE(g_config) "@GOTPAGEOFF] \n"
                  #elif OS(LINUX)
                      ...
                  #endif
".loc 6 1034\n"       "movz x13, #57366 \n"                // WebAssembly.asm:1034
                      "ldr x17, [x10, #3592] \n"
                      "brab x17, x13 \n"
```

* Source/JavaScriptCore/llint/LowLevelInterpreter.asm:
* Source/JavaScriptCore/llint/LowLevelInterpreter64.asm:
* Source/JavaScriptCore/llint/WebAssembly.asm:

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




More information about the webkit-changes mailing list