Fix for-in missing inherited enumerable index properties placed on Array.prototype#2655
Merged
lahma merged 1 commit intoJul 13, 2026
Conversation
lahma
enabled auto-merge (squash)
July 13, 2026 07:47
…ray.prototype Array.prototype is itself array-backed, so script-placed elements (Array.prototype[5] = x) live in its dense element store. The for-in key-collection shortcut for builtin-shaped hosts handed out the shared builtin name list, which only covers shape slots - the own index keys were invisible, so `for (var k in [1, 2])` never yielded the inherited enumerable index. The shortcut now steps aside when an array-backed host carries any own index-keyed element (a present dense element or a materialized per-index descriptor); the fallback path collects indices and builtin names correctly. The extra cost for pristine prototypes is one type test plus a scan of an empty backing store. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
lahma
force-pushed
the
fix-forin-inherited-array-prototype-index
branch
from
July 13, 2026 07:49
9be1d4f to
e282536
Compare
This was referenced Jul 15, 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.
Bug
Array.prototypeis itself array-backed, so script-placed elements live in its dense element store. The for-in key-collection shortcut for builtin-shaped hosts (GetForInStringKeys) handed out the shared builtin name list, which only covers shape slots — own index keys on the prototype were invisible to enumeration. Verified against pristinemain.Fix
The shortcut steps aside when an array-backed host carries any own index-keyed element (new
ArrayInstance.HasAnyOwnIndex(): a present dense element or a materialized per-index descriptor); the fallback path collects indices and builtin names correctly. For pristine prototypes — the overwhelmingly common case — the added cost is one type test plus a scan of an empty backing store, and the shared-name-list shortcut still applies.Found by a new enumeration test written while working on the for-in array fast path (follow-up PR); regression test included.
Gate
Jint.Tests, PublicInterface, CommonScripts all green; Test262 full run green except the four known load-dependent
annexB RegExp *-escape-BMPslow tests, which pass in 5s when run in isolation (they time out at 30s only under full-suite CPU starvation — flake hardening for those is coming separately).🤖 Generated with Claude Code