Repository navigation
[JSC] Add OwnStructureMode fast path to for-in sites that saw multiple modes - #79357
Open
sosukesuzuki wants to merge 1 commit into
Conversation
…ple modes https://bugs.webkit.org/show_bug.cgi?id=329861 Reviewed by NOBODY (OOPS!). When a for-in site has seen more than one enumeration mode, Baseline, DFG and FTL call operationEnumeratorNextUpdateIndexAndMode for every key, even for objects that can be enumerated in OwnStructureMode. This patch adds a runtime check to such sites. If the enumerator starts with structure properties, the base still has the enumerator's cached StructureID, and the next index is still within the structure properties, we just increment the index. Otherwise we call the operation as before. This is the same condition that JSPropertyNameEnumerator::computeNext uses, and it is checked for every key, so changing the structure in the middle of the loop is handled by the operation. Baseline Patched for-in-object-with-own-named-at-site-with-generic-mode 121.1571+-7.1595 ^ 38.1534+-1.7732 ^ definitely 3.1755x faster Tests: JSTests/microbenchmarks/for-in-object-with-own-named-at-site-with-generic-mode.js JSTests/stress/for-in-own-structure-mode-at-site-with-all-modes.js JSTests/stress/for-in-own-structure-mode-at-site-with-multiple-modes-structure-change.js JSTests/stress/for-in-own-structure-mode-at-site-with-multiple-modes.js * JSTests/microbenchmarks/for-in-object-with-own-named-at-site-with-generic-mode.js: Added. (sum): * JSTests/stress/for-in-own-structure-mode-at-site-with-all-modes.js: Added. (shouldBe): (allModes): (ownThenOthers): * JSTests/stress/for-in-own-structure-mode-at-site-with-multiple-modes-structure-change.js: Added. (shouldBe): (plain): (withDeletedProperty): (withInheritedProperties): (deleteWhileEnumerating): (addWhileEnumerating): (addAndDeleteWhileEnumerating): (hideWhileEnumerating): * JSTests/stress/for-in-own-structure-mode-at-site-with-multiple-modes.js: Added. (shouldBe): (ownAndGeneric): (ownAndIndexed): (ownAndThrowing): (getOwnPropertyDescriptor): * Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp: (JSC::DFG::SpeculativeJIT::compileEnumeratorNextUpdateIndexAndMode): * Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp: (JSC::FTL::DFG::LowerDFGToB3::compileEnumeratorNextUpdateIndexAndMode): * Source/JavaScriptCore/jit/JITPropertyAccess.cpp: (JSC::JIT::emit_op_enumerator_next):
Collaborator
|
EWS run on current version of this PR (hash c99bd33) Details |
This was referenced Nov 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
c99bd33
c99bd33