Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: b0ca3d39ab0b6cae0bde1400b5559e7b5fdd48a6
https://github.com/WebKit/WebKit/commit/b0ca3d39ab0b6cae0bde1400b5559e7b5fdd48a6
Author: Dan Hecht <[email protected]>
Date: 2026-04-03 (Fri, 03 Apr 2026)
Changed paths:
M Source/JavaScriptCore/b3/air/AirAllocateRegistersByGreedy.cpp
Log Message:
-----------
[JSC] GreedyRegAlloc: Fix trySplitAroundClobbers cost model and exit early
https://bugs.webkit.org/show_bug.cgi?id=311372
rdar://173970443
Reviewed by Keith Miller.
The cost comparison used spillCost() (which had become useDefCost
normalized by range size) instead of useDefCost directly. Since splitCost
is an absolute frequency-weighted instruction count, comparing it against
range-normalized spillCost always favored spilling. Changed to compare
against useDefCost so both sides are in the same units.
Handle Replaced stage in the main allocation loop since gap tmps whose
original was spilled can be in the queue and should be skipped.
Additionally, exit the search early if splitCost becomes too high such
that it's guaranteed it won't beat the best min so far, and initialize
the min to the value required to succeed the split.
Also remove an ASSERT in insertSplitIntraBlockFixupCode that is no longer
valid now that split types can compose. The code was doing the right
thing still, but rewrite it slightly to clarify.
Finally, renamed InsertionPhase values for clarity and added IntraBlockMoveFrom/
IntraBlockMoveTo phases to ensure correct ordering when clobber and
intra-block splits compose on the same tmp. Sharing the phase was okay
since the two split types wouldn't try to insert in the same slot, but
it's easier to reason about if they use distinct phases.
* Source/JavaScriptCore/b3/air/AirAllocateRegistersByGreedy.cpp:
(JSC::B3::Air::Greedy::GreedyAllocator::allocateRegisters):
(JSC::B3::Air::Greedy::GreedyAllocator::trySplitAroundClobbers):
(JSC::B3::Air::Greedy::GreedyAllocator::emitSpillCodeAndEnqueueNewTmps):
(JSC::B3::Air::Greedy::GreedyAllocator::insertSplitAroundClobbersFixupCode):
(JSC::B3::Air::Greedy::GreedyAllocator::insertSplitIntraBlockFixupCode):
Canonical link: https://commits.webkit.org/310551@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications