Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 5e03b0c541d3895e5a12a6b032185901e5e4d738
https://github.com/WebKit/WebKit/commit/5e03b0c541d3895e5a12a6b032185901e5e4d738
Author: Yusuke Suzuki <[email protected]>
Date: 2026-09-11 (Fri, 11 Sep 2026)
Changed paths:
M Source/JavaScriptCore/b3/B3VariableLiveness.h
M Source/JavaScriptCore/b3/air/AirAllocateStackByGraphColoring.cpp
M Source/JavaScriptCore/b3/air/AirLiveness.h
M Source/JavaScriptCore/b3/air/AirLivenessAdapter.h
M Source/JavaScriptCore/b3/air/AirStackAllocatorStats.h
M Source/WTF/wtf/Liveness.h
Log Message:
-----------
[JSC] Make Air stack slot liveness sparse in instructions
https://bugs.webkit.org/show_bug.cgi?id=323526
rdar://186767924
Reviewed by Yijia Huang.
Normally Spill stack use is much limited even in very large program
compared to pure register / normal-stack / memory-location only instructions.
Even in very large function in sqlite3-wasm is having ~7% of
instructions using spill stack. However AirAllocateStackByGraphColoring
is walking over all Air instructions repeatedly while most of
instructions are meaningless since they do not have spills. In this
patch, we leverage this sparse characteristics to accelerate performance
of this phase. We first walk all Air instructions to collect actions,
kill-candidates, move-coalescable-sites in one forward pass. And we run
liveness analysis over this collected actions instead. This means that
overall graph size gets dramatically smaller (~10%) compared to
repeatedly scanning entire Air graph. Then, when building inference
graph, we step over spill action boundaries instead of instruction-index
step by step, this skips many non-interesting instructions automatically
and offers quick graph computation.
The analysis and achievement are exactly the same. And this is roughly
cutting 50% of time in this phase.
* Source/JavaScriptCore/b3/B3VariableLiveness.h:
(JSC::B3::VariableLivenessAdapter::forEachActionGroupDescending):
(JSC::B3::VariableLivenessAdapter::forEachUseInGroup):
(JSC::B3::VariableLivenessAdapter::forEachDefInGroup):
(JSC::B3::VariableLivenessAdapter::forEachUseAtTail):
* Source/JavaScriptCore/b3/air/AirAllocateStackByGraphColoring.cpp:
(JSC::B3::Air::allocateStackByGraphColoring):
* Source/JavaScriptCore/b3/air/AirLiveness.h:
(JSC::B3::Air::Liveness::Liveness):
* Source/JavaScriptCore/b3/air/AirLivenessAdapter.h:
(JSC::B3::Air::LivenessAdapter::forEachActionGroupDescending):
(JSC::B3::Air::LivenessAdapter::forEachUseInGroup):
(JSC::B3::Air::LivenessAdapter::forEachDefInGroup):
(JSC::B3::Air::LivenessAdapter::forEachUseAtTail):
(JSC::B3::Air::StackSlotLivenessAdapter::StackSlotLivenessAdapter): Deleted.
(JSC::B3::Air::StackSlotLivenessAdapter::numIndices): Deleted.
(JSC::B3::Air::StackSlotLivenessAdapter::acceptsBank): Deleted.
(JSC::B3::Air::StackSlotLivenessAdapter::acceptsRole): Deleted.
(JSC::B3::Air::StackSlotLivenessAdapter::valueToIndex): Deleted.
(JSC::B3::Air::StackSlotLivenessAdapter::indexToValue): Deleted.
* Source/JavaScriptCore/b3/air/AirStackAllocatorStats.h:
(JSC::B3::Air::AirStackAllocatorStats::AirStackAllocatorStats):
* Source/WTF/wtf/Liveness.h:
(WTF::Liveness::Workset::forEachSetBit const):
(WTF::Liveness::Workset::initialize):
(WTF::Liveness::Workset::clear):
(WTF::Liveness::makeWorkset):
(WTF::Liveness::copyLiveAtTailInto):
(WTF::Liveness::LocalCalc::LocalCalc):
(WTF::Liveness::computeDense):
(WTF::Liveness::computeSparse):
(WTF::Liveness::forEachInDense):
Canonical link: https://commits.webkit.org/320943@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications