[webkit-changes] [WebKit/WebKit] 363226: [JSC] Add Air OptimizePairedLoadStore phase

Yusuke Suzuki noreply at github.com
Wed Jun 28 11:57:44 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 3632268ff8926089279b8c844d3d92a2cee78e69
      https://github.com/WebKit/WebKit/commit/3632268ff8926089279b8c844d3d92a2cee78e69
  Author: Yusuke Suzuki <ysuzuki at apple.com>
  Date:   2023-06-28 (Wed, 28 Jun 2023)

  Changed paths:
    M Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
    M Source/JavaScriptCore/Sources.txt
    M Source/JavaScriptCore/assembler/MacroAssemblerARM64.h
    M Source/JavaScriptCore/b3/B3LowerToAir.cpp
    M Source/JavaScriptCore/b3/air/AirGenerate.cpp
    M Source/JavaScriptCore/b3/air/AirInst.h
    M Source/JavaScriptCore/b3/air/AirInstInlines.h
    M Source/JavaScriptCore/b3/air/AirKind.h
    M Source/JavaScriptCore/b3/air/AirLowerStackArgs.cpp
    M Source/JavaScriptCore/b3/air/AirOpcode.opcodes
    A Source/JavaScriptCore/b3/air/AirOptimizePairedLoadStore.cpp
    A Source/JavaScriptCore/b3/air/AirOptimizePairedLoadStore.h
    M Source/JavaScriptCore/b3/air/testair.cpp
    M Source/JavaScriptCore/runtime/OptionsList.h

  Log Message:
  -----------
  [JSC] Add Air OptimizePairedLoadStore phase
https://bugs.webkit.org/show_bug.cgi?id=258293
rdar://111026259

Reviewed by Keith Miller.

This patch attempts to fuse multiple stores into StorePair when possible.
We do this optimization very lately: one of the major target of this optimization is stack spills with %fp base.
We would like to perform this optimization *after* register allocation is done. Also since this is block-local analysis,
we would like to perform it after Air SimplifyCFG phase is done.

We currently do not attempt to merge multiple loads into LoadPair. The reason is that we observed 20% regression
in particular tests (JetStream3/async-fs / JetStream3/sync-fs) because it is repeatedly performing `ldp`
against recently `stur`-ed address, which causes much longer latency than just doing `ldur`. Until we find a good way to
determine when we merge multiple loads into LoadPair, we only do StorePair merging.

For StorePair merging, we observed very specific regression in JetStream2/crypto-md5-SP only when perfoming stp ongoing call-args.
As a conservative first step, we do not perform merging when the base is %sp or %fp and when they are not spills. To make it work,
we annotate `spill` infomration in AirKind.

This offers 2~% progression in JetStream2/tsf-wasm's Runtime.

* Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj:
* Source/JavaScriptCore/Sources.txt:
* Source/JavaScriptCore/assembler/MacroAssemblerARM64.h:
(JSC::MacroAssemblerARM64::loadPair32):
(JSC::MacroAssemblerARM64::loadPair64):
(JSC::MacroAssemblerARM64::storePair32):
(JSC::MacroAssemblerARM64::storePair64):
* Source/JavaScriptCore/b3/air/AirGenerate.cpp:
(JSC::B3::Air::prepareForGeneration):
* Source/JavaScriptCore/b3/air/AirLowerStackArgs.cpp:
(JSC::B3::Air::lowerStackArgs):
* Source/JavaScriptCore/b3/air/AirOpcode.opcodes:
* Source/JavaScriptCore/b3/air/AirOptimizePairedLoadStore.cpp: Added.
(JSC::B3::Air::tryLoadPair):
(JSC::B3::Air::optimizePairedLoadStore):
* Source/JavaScriptCore/b3/air/AirOptimizePairedLoadStore.h: Added.

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




More information about the webkit-changes mailing list