[webkit-changes] [WebKit/WebKit] fdb483: Improve same-register moves in AirAllocateRegister...

jjgriego noreply at github.com
Wed Dec 7 15:16:07 PST 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: fdb483c0938270803e4374715b55d0c52b8e27de
      https://github.com/WebKit/WebKit/commit/fdb483c0938270803e4374715b55d0c52b8e27de
  Author: Joseph Griego <jgriego at igalia.com>
  Date:   2022-12-07 (Wed, 07 Dec 2022)

  Changed paths:
    M Source/JavaScriptCore/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp

  Log Message:
  -----------
  Improve same-register moves in AirAllocateRegistersAndStackAndGenerateCode
https://bugs.webkit.org/show_bug.cgi?id=242816.

Reviewed by Saam Barati.

When we are emitting a `Move` from a Tmp to a named-register Tmp that matches
its current allocation, we currently generate code that spills the source tmp to
the stack, allocates a new (distinct) register for it, restores it there, and
then moves it; this seems wasteful and, although this kind of situation in Air
is not common on x86_64, we do generate it on 32-bit ARM targets:

For example, this pattern is quite common before patchpoints:
               ...
    Move %tmpN, %r0
               <addr>: str r0, [r7, #-0x50]
    -          <addr>: ldr r3, [r7, #-0x50]
    -          <addr>: mov r0, r3
    <patchpoint that clobbers most of the register file>
               <addr>: str r0, [r7, #-0x70]
               <addr>: str r1, [r7, #-0x58]
               <addr>: str r2, [r7, #-0x60]
    -          <addr>: str r3, [r7, #-0x50]
               <addr>: ldr r0, [r7, #-0x70]
               <addr>: ldr r1, [r7, #-0x60]
               ...

(This is a before- and after-this-patch diff of disassembly output, with code
addresses elided: that is, this patch causes the lines prefixed with `-` to be
removed)

* Source/JavaScriptCore/b3/air/AirAllocateRegistersAndStackAndGenerateCode.cpp:
(JSC::B3::Air::GenerateAndAllocateRegisters::generate):

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




More information about the webkit-changes mailing list