-
-
Notifications
You must be signed in to change notification settings - Fork 166
classes: statics live on the class function object; delete the static attr, deleted-key and name tables (step 3f) #11667
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
17 commits
Select commit
Hold shift + click to select a range
ec2d22c
fix(runtime): a builtin parent id never gets a class function object
2d66968
feat(runtime): class static attributes live with their keys (3f, part 1)
8295075
feat(runtime): class static methods are own properties of the class f…
2b50982
perf(codegen): a static call's guard hit is one shape read and compar…
91324d3
fix(codegen): register each class by its identity, not its name
960eb83
perf(runtime): build Object and Object.prototype without the global o…
b991360
test: an inherited static call sees a store to the parent static
fe94296
perf(runtime): class static member names hash with ahash, not SipHash
6df4067
fix(runtime): a static accessor entry is never called with the receiv…
e4ded6b
changelog: name the fragments after #11667
185d5dc
Merge branch 'main' into perf-class-tables-3f
proggeramlug 9750692
Merge branch 'main' into perf-class-tables-3f
proggeramlug 67d63ec
test: #336 namespace classes keep their own identity (expected output…
be47b5d
Merge branch main into perf-class-tables-3f
23a62e3
Merge remote-tracking branch 'origin/main' into HEAD
c3eb826
Merge remote-tracking branch 'origin/main' into HEAD
80b4a0f
Merge origin/main (#11672) into perf-class-tables-3f
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,4 @@ | ||
| `Object.getPrototypeOf` of a class, a static `super` parent lookup and a | ||
| static `super[k] = v` no longer create a class function object for a builtin | ||
| parent id (`class E extends Error`): the builtin constructor is the class's | ||
| dynamic parent value, and a class without one is a root. |
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,3 @@ | ||
| Fixed class registration being keyed by class name: two classes with the same | ||
| name in one module each register their own methods, static methods, accessors | ||
| and constructors under their own class id. |
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,4 @@ | ||
| Fixed a class static setter receiving the class instead of the assigned value | ||
| on the generic property path (`C.x = v`, directly, through a variable or on a | ||
| subclass, and `Reflect.set`) and through the reflected setter function | ||
| (`Object.getOwnPropertyDescriptor(C, "x").set`), string- and symbol-keyed. |
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,6 @@ | ||
| A class static's attributes (`writable`/`enumerable`/`configurable`, set by | ||
| `Object.defineProperty`, `Object.freeze` or a class's intrinsic `name` and | ||
| `length`) are now the key attributes of the class function object's own | ||
| properties, as for any ordinary object, instead of a separate per-class table. | ||
| Deleting such a static and assigning it again yields an ordinary writable, | ||
| enumerable property (the old table kept the deleted key's attributes). |
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,4 @@ | ||
| Made a compiled `C.m()` static call cheaper: the check that the class still | ||
| holds the declared method is now one shape-word read and compare per class | ||
| the call reads (a direct call costs 6 instructions more than an unguarded | ||
| call, down from 17). | ||
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,9 @@ | ||
| Fixed class static methods not being ordinary own properties of the class. | ||
| A static method, named or computed, is now a writable, non-enumerable, | ||
| configurable data property of the class function object, whose value is the | ||
| method's own function object: `Object.getOwnPropertyDescriptor(C, "m").value | ||
| === C.m`, `C.m === Sub.m`, and replacing, redefining (`Object.defineProperty`, | ||
| `Reflect.set`, `Object.assign`) or deleting it is seen by every later call, | ||
| including `C.m()` call sites compiled before the change. A deleted static or | ||
| prototype method no longer reappears on read, and `getOwnPropertyNames` lists | ||
| a class's keys in creation order. |
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,3 @@ | ||
| Class static method and accessor lookups by name hash with ahash instead of | ||
| SipHash, so a static call that misses its site guard probes each class on the | ||
| parent chain faster. |
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,4 @@ | ||
| Made the first use of a class cheaper: `Object` and `Object.prototype` are | ||
| built on their own (about 1M instructions) instead of by building the whole | ||
| global object (about 50M instructions, several hundred builtins); the global | ||
| object adopts the same two objects when it is built. |
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.
📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win
Describe the shipped behavior instead of this PR's internal history.
The fragment says the static call became "cheaper", with a guard cost "down from 17" instructions. The 17-instruction guard was introduced earlier in this same PR. The last release had no guard at all. Compared with that release, a compiled
C.m()call now costs 6 more instructions, so "Made … cheaper" misleads release-note readers.Merge this fragment into
11667-class-static-methods-own-properties.md, or reword it against the released baseline. For example: "compiledC.m()call sites check with one shape-word compare per class that the method was not replaced."Based on learnings: changelog fragments must "describe the final shipped behavior as one coherent release-note entry" and must not include "separate development-slice narratives."
🤖 Prompt for AI Agents
Source: Learnings