[webkit-changes] [WebKit/WebKit] 0b7790: Eliminate redundant reloading of registers when ca...

Commit Queue noreply at github.com
Wed May 3 11:06:58 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0b7790f1f183a9df21c5c67840bc2400d1c85f35
      https://github.com/WebKit/WebKit/commit/0b7790f1f183a9df21c5c67840bc2400d1c85f35
  Author: David Degazio <d_degazio at apple.com>
  Date:   2023-05-03 (Wed, 03 May 2023)

  Changed paths:
    M Source/JavaScriptCore/wasm/WasmBBQJIT.cpp

  Log Message:
  -----------
  Eliminate redundant reloading of registers when calling functions in BBQ JIT
https://bugs.webkit.org/show_bug.cgi?id=256235
rdar://108812140

Reviewed by Justin Michaud.

Unifies BBQJIT::saveValuesAcrossCall and BBQJIT::passParametersToCall, and
applies the following changes:

 - Tracks the original location of each argument before saving/flushing them,
   and use these when passing parameters. We can only do this because we don't
   assign any new registers or clobber any values between saving caller-saves
   and calling the function.

 - Consumes each argument before saving caller-saves instead of after. This means
   we don't redundantly save values whose lifetimes have obviously ended (WASM temps).

 - Emits a shuffle instead of naive moves when passing values via the calling
   convention. Because we now use the original argument locations, which may be
   registers, we need this in case of overlap with the calling convention registers.

Altogether, this means we save a bunch of redundant instructions in BBQ JIT calls
(in my experience, one load/store pair per argument for most arguments in most calls),
due to avoiding storing then reloading values unnecessarily. This should benefit
overall runtime performance for BBQ-compiled functions, as well as generated code
size.

* Source/JavaScriptCore/wasm/WasmBBQJIT.cpp:
(JSC::Wasm::BBQJIT::saveValuesAcrossCallAndPassArguments):
(JSC::Wasm::BBQJIT::emitCCall):
(JSC::Wasm::BBQJIT::addCall):
(JSC::Wasm::BBQJIT::emitIndirectCall):
(JSC::Wasm::BBQJIT::emitShuffle):
(JSC::Wasm::BBQJIT::saveValuesAcrossCall): Deleted.
(JSC::Wasm::BBQJIT::passParametersToCall): Deleted.

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




More information about the webkit-changes mailing list