-
-
Notifications
You must be signed in to change notification settings - Fork 161
fix(runtime): indexed writes and the generic array engine honour a custom prototype chain #9297
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
proggeramlug
wants to merge
8
commits into
PerryTS:main
from
proggeramlug:fix/9220-9221-array-proto-paths
Closed
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
de5f5f1
test(runtime): cover array prototype write and generic paths
fe73cdf
fix(runtime): honor inherited array indices across paths
e629f02
fix(runtime): preserve strict semantics in array store fallback
ee29441
fix(runtime): the [[Set]] owner walk takes the synthetic-class protot…
c6edaf9
perf(runtime): gate the strict lane's hole decline on the array-proto…
7faf69b
perf(runtime): the [[Set]] walk's guard leads with the array-prototyp…
1e635f4
docs(changelog): record the chain hop and the latch gating
c2bb795
refactor(runtime): split the spec prototype-chain block out of indexi…
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| ### fix(runtime): honor inherited array indices in writes and borrowed methods | ||
|
|
||
| Indexed assignment on an array with a recorded custom prototype now performs | ||
| the inherited descriptor walk before creating an own element. Prototype | ||
| setters therefore run with the array as their receiver, inherited non-writable | ||
| data properties reject the assignment, and inherited writable data properties | ||
| still allow the normal own-property creation. | ||
|
|
||
| The generic array-like engine used by `Array.prototype.<method>.call(array)` | ||
| now uses the same recorded-prototype classification for `Get` and | ||
| `HasProperty`. Prototype-filled holes are consequently visible to `join`, | ||
| `indexOf`, `map`, `forEach`, and the other generic methods. Default-chain | ||
| arrays retain their existing fast paths, while Proxy prototypes keep their | ||
| dedicated trap handling. Fixes #9220 and #9221. | ||
|
|
||
| The `[[Set]]` owner walk takes the same chain hops the `[[Get]]` walk takes: | ||
| `Object.create(p)` models its link with a synthetic class id rather than a | ||
| recorded prototype (#809), so without that hop an inherited accessor two links | ||
| up was still silently replaced by an own element. | ||
|
|
||
| Every one of the three new gates leads with the existing `array_static_proto_recorded` | ||
| process latch, so a program that never retargets an array keeps the previous | ||
| code path exactly — the strict store's number lane does not even read the slot | ||
| it is about to write, and the cold store tail performs no prototype-registry | ||
| probe. |
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
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win
Preserve Proxy prototype
hassemantics.When
array_custom_prototypesees a Proxy, it returnsNone. Thereforereal_array_uses_recorded_spec_pathis false, andal_hasreaches the fallback result for a hole without invoking the Proxyhastrap. ForArray(1)with a Proxy prototype that reports index0, generic methods skip index0. Add a dedicated Proxy-prototypehaspath before the fallback.Also applies to: 576-578
🤖 Prompt for AI Agents