Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 0b7790f1f183a9df21c5c67840bc2400d1c85f35
      
https://github.com/WebKit/WebKit/commit/0b7790f1f183a9df21c5c67840bc2400d1c85f35
  Author: David Degazio <[email protected]>
  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


_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to