-
-
Notifications
You must be signed in to change notification settings - Fork 163
perf(runtime): [[Prototype]] is part of shape identity; store sites prove their chain once #11342
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
Merged
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
d17ddf5
feat(runtime): [[Prototype]] is a shape fact
b8df1e5
perf(runtime): a store site proves its key-add is not intercepted by …
1d3da4d
perf(codegen): this.m reads the class's canonical method, not a new s…
da6e96e
fix(runtime): a store plan names the receiver's prototype, not only i…
13e4efc
test(runtime): the chain-store traps run on one primed site each
4cc36ce
feat(runtime): the shape census splits descriptors by prototype identity
32e6c33
docs(changelog): one fragment for prototype-in-shape and the store-si…
79cd942
fix(runtime): the static-key store miss entry runs the chain verdict
84ddbe6
fix(runtime): a typed ShapeId is keyed on the prototype it was minted…
dcde543
chore(gc): re-pin PASS1_MARKED after the chain-store scanner and reco…
f0999a5
changelog: name the fragment after PR #11342
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,26 @@ | ||
| **[[Prototype]] is part of shape identity.** A shape is canonical per | ||
| (prototype, ordered keys): `setPrototypeOf`, `__proto__`, `new F()` after | ||
| `F.prototype` is replaced, `Object.create(p)` and class evaluation each move | ||
| the object to the shape naming its new prototype, and two objects with the | ||
| same keys but different prototypes never share a shape. The shape generation | ||
| now tracks only descriptor, delete and freeze changes. | ||
|
|
||
| Key-adding and shadowing stores on class instances (`this.x = …` in a | ||
| constructor with no field declarations, `this.m = this.m.bind(this)`) no | ||
| longer run the full `[[Set]]` each time: the store site keeps the verdict | ||
| that the prototype chain does not intercept the key, keyed by the prototype | ||
| identity the receiver's shape records, and appends through the shape | ||
| transition. Also fixes a stale store plan that skipped an inherited setter | ||
| after `F.prototype` was replaced. | ||
|
|
||
| **Behaviour change: a method read off `this` is the class's method, not a | ||
| receiver snapshot.** `const f = this.m` now answers the same canonical | ||
| function as `obj.m` and `C.prototype.m` (`this.m === C.prototype.m` holds), | ||
| and the value binds no receiver — calling it bare runs with `this` | ||
| undefined, as in Node. This retires the #4548 snapshot contract, under | ||
| which every `this.m` read built and named a fresh bound closure and a | ||
| captured `this.m` kept its receiver after an own-property replacement. The | ||
| constructor self-rebind `this.m = this.m.bind(this)` that #4548 fixed keeps | ||
| working. | ||
|
|
||
| zod: −32.7% instructions and −30% peak RSS; tsc transpile: −3.1% instructions (one run). |
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
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
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
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
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
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
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
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
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.
🚀 Performance & Scalability | 🟡 Minor | ⚡ Quick win
🔎 Supported by static analysis
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 11158
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 12891
🏁 Script executed:
Repository: PerryTS/perry
Length of output: 43192
Register generic origins before minting class birth shapes.
For a specialized class,
class_proto_idusesclass_generic_originthroughvtable_class. The class-keys loop mints the ShapeId beforejs_register_class_generic_originruns. A newborn then resolves to the generic prototype identity, sotry_birth_stamp_preinstalled_shaperejects the preinstalled descriptor. The fallback ShapeId differs from the compiled guard ShapeId, which can make the inline field guard miss for every such allocation.Move the
origin_pairsconstruction and registration before the class-keys loop. The origin registration does not depend on the keys arrays.🤖 Prompt for AI Agents