Skip to content

[JSC] VarargsLength and LoadVarargs on Spread should not clobber the world - #79993

Merged
webkit-commit-queue merged 1 commit into
WebKit:mainfrom
sosukesuzuki:eng/JSC-VarargsLength-and-LoadVarargs-on-Spread-should-not-clobber-the-world
Nov 13, 2026
Merged

webkit-commit-queue merged 1 commit into
WebKit:mainfrom
sosukesuzuki:eng/JSC-VarargsLength-and-LoadVarargs-on-Spread-should-not-clobber-the-world

Conversation

@sosukesuzuki

@sosukesuzuki sosukesuzuki commented Nov 7, 2026 •

Copy link
Copy Markdown
Member

40c45df

[JSC] `VarargsLength` and `LoadVarargs` on `Spread` should not clobber the world
https://bugs.webkit.org/show_bug.cgi?id=330526

Reviewed by Yusuke Suzuki.

When the argument is the result of Spread (KnownCellUse), VarargsLength and LoadVarargs
do not call operations since 325863@main. They only load the length and copy the elements.
But the abstract interpreter and clobberize() still say that they clobber the world, so
structures proven before an inlined f(...array) are forgotten.

This patch makes them precise for KnownCellUse. VarargsLength reads Butterfly_publicLength,
and LoadVarargs reads IndexedContiguousProperties and writes only its stack slots. Since
the effects now depend on it, DFG::validate() checks that KnownCellUse is only used for
Spread without an offset.

Spread itself does not clobber the world in the abstract interpreter only when the array
iterator protocol is proven from the structure of the array, so this is when it helps.
clobberize() for Spread is unchanged.

Test: JSTests/stress/spread-call-inlined-callee-does-not-clobber-world.js

* JSTests/stress/spread-call-inlined-callee-does-not-clobber-world.js: Added.
(shouldBe):
(add):
(count):
(checkAroundCall):
(checkAroundCallWithArray):
(change):
(changeStructureInCallee):
(opaque):
(callOpaque):
(changeStructureInNestedCall):
(mutateBetweenCalls):
(truncate):
(mutateInCallee):
(checkAroundIterable):
(loop):
(forwardRest):
(callForwardRest):
(forwardRestTwice):
(callForwardRestTwice):
(sloppyArguments):
(functionArguments):
(readCallerArguments):
(Base):
(Derived):
(construct):
(catchThrow):
(callThrow):
(exits):
(locals):
(readConstant):
(callReadConstant):
(changeConstant):
(generate):
(arrayIteratorPrototype.next):
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* Source/JavaScriptCore/dfg/DFGValidate.cpp:

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

971d46b

Misc iOS, visionOS, tvOS & watchOS macOS Linux Windows
✅ 🧪 style ✅ 🛠 ios ✅ 🛠 mac ✅ 🛠 wpe ✅ 🛠 win
⏳ 🛠 ios-sim-cmake ✅ 🛠 mac-cmake-debug ✅ 🧪 wpe-wk2 ✅ 🧪 win-tests
✅ 🧪 webkitperl ⏳ 🧪 ios-cmake-wk2 ✅ 🧪 api-mac ✅ 🧪 api-wpe
⏳ 🧪 ios-cmake-wk2-wpt ✅ 🧪 api-mac-cmake-debug ✅ 🧪 jsc-wpe
✅ 🧪 jsc-x86-64 ⏳ 🧪 api-ios-cmake ✅ 🧪 mac-wk2 ✅ 🛠 gtk3-gcc
✅ 🛠 🧪 jsc-debug-arm64 ✅ 🛠 ios-safer-cpp ✅ 🧪 mac-cmake-debug-wk2 ✅ 🛠 gtk
✅ 🛠 vision ✅ 🧪 gtk-wk2
✅ 🛠 🧪 merge ❌ 🛠 vision-sim ✅ 🧪 mac-intel-wk2 ✅ 🧪 api-gtk
❌ 🧪 vision-wk2 ✅ 🛠 mac-safer-cpp ✅ 🛠 playstation
✅ 🛠 tv ✅ 🧪 mac-site-isolation
✅ 🛠 tv-sim ⏳ 🧪 mac-webdriver
✅ 🛠 watch
✅ 🛠 watch-sim

@sosukesuzuki sosukesuzuki self-assigned this Nov 7, 2026
@sosukesuzuki sosukesuzuki added the JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues. label Nov 7, 2026
@sosukesuzuki
sosukesuzuki marked this pull request as ready for review November 7, 2026 01:05
@sosukesuzuki
sosukesuzuki requested a review from a team as a code owner November 7, 2026 01:05
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Nov 7, 2026
@sosukesuzuki sosukesuzuki added merge-queue Applied to send a pull request to merge-queue and removed merging-blocked Applied to prevent a change from being merged labels Nov 13, 2026
…r the world

https://bugs.webkit.org/show_bug.cgi?id=330526

Reviewed by Yusuke Suzuki.

When the argument is the result of Spread (KnownCellUse), VarargsLength and LoadVarargs
do not call operations since 325863@main. They only load the length and copy the elements.
But the abstract interpreter and clobberize() still say that they clobber the world, so
structures proven before an inlined f(...array) are forgotten.

This patch makes them precise for KnownCellUse. VarargsLength reads Butterfly_publicLength,
and LoadVarargs reads IndexedContiguousProperties and writes only its stack slots. Since
the effects now depend on it, DFG::validate() checks that KnownCellUse is only used for
Spread without an offset.

Spread itself does not clobber the world in the abstract interpreter only when the array
iterator protocol is proven from the structure of the array, so this is when it helps.
clobberize() for Spread is unchanged.

Test: JSTests/stress/spread-call-inlined-callee-does-not-clobber-world.js

* JSTests/stress/spread-call-inlined-callee-does-not-clobber-world.js: Added.
(shouldBe):
(add):
(count):
(checkAroundCall):
(checkAroundCallWithArray):
(change):
(changeStructureInCallee):
(opaque):
(callOpaque):
(changeStructureInNestedCall):
(mutateBetweenCalls):
(truncate):
(mutateInCallee):
(checkAroundIterable):
(loop):
(forwardRest):
(callForwardRest):
(forwardRestTwice):
(callForwardRestTwice):
(sloppyArguments):
(functionArguments):
(readCallerArguments):
(Base):
(Derived):
(construct):
(catchThrow):
(callThrow):
(exits):
(locals):
(readConstant):
(callReadConstant):
(changeConstant):
(generate):
(arrayIteratorPrototype.next):
* Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter<AbstractStateType>::executeEffects):
* Source/JavaScriptCore/dfg/DFGClobberize.h:
(JSC::DFG::clobberize):
* Source/JavaScriptCore/dfg/DFGValidate.cpp:

Canonical link: https://commits.webkit.org/326606@main
@webkit-commit-queue
webkit-commit-queue force-pushed the eng/JSC-VarargsLength-and-LoadVarargs-on-Spread-should-not-clobber-the-world branch from 971d46b to 40c45df Compare November 13, 2026 02:45
@webkit-commit-queue

Copy link
Copy Markdown
Collaborator

Committed 326606@main (40c45df): https://commits.webkit.org/326606@main

Reviewed commits have been landed. Closing PR #79993 and removing active labels.

@webkit-commit-queue
webkit-commit-queue merged commit 40c45df into WebKit:main Nov 13, 2026
@webkit-commit-queue webkit-commit-queue removed the merge-queue Applied to send a pull request to merge-queue label Nov 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JavaScriptCore For bugs in JavaScriptCore, the JS engine used by WebKit, other than kxmlcore issues.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants