Closed Bug 1828144 Opened 2 years ago Closed 2 years ago

Implement the WeakMap/WeakSet changes from the Symbols as WeakMap keys proposal

Categories

(Core :: JavaScript Engine, enhancement, P3)

enhancement

Tracking

()

RESOLVED FIXED
121 Branch
Tracking Status
firefox121 --- fixed

People

(Reporter: jon4t4n, Assigned: allstars.chh)

References

(Depends on 1 open bug, Blocks 1 open bug)

Details

Attachments

(5 files, 4 obsolete files)

48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
48 bytes, text/x-phabricator-request
Details | Review
No description provided.
Blocks: 1710433
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3

To be able to use an object or a symbol as the weak map key, we need to change
the underlying type from JSObject* to Value.

Attachment #9328882 - Attachment description: Bug 1828144 - Part 1: Change ObjectValueWeakMap key from JSObject* to Value → WIP: Bug 1828144 - Part 1: Change ObjectValueWeakMap to ValueValueWeakMap

Depends on D175672

I don't currently have the time to complete this implementation, and I don't want to be the blocker on a stage 4 proposal. Thus, feel free to take my patches as a starting point!

Part 1 should compile and pass all existing tests. Part 2 is still very WIP.

(Let me know if I should abandon the patches instead of leaving them as planned changes.)

Assignee: nobody → allstars.chh
Attachment #9328882 - Attachment description: WIP: Bug 1828144 - Part 1: Change ObjectValueWeakMap to ValueValueWeakMap → Bug 1828144 - Part 2: Change ObjectValueWeakMap to ValueValueWeakMap
Attachment #9330683 - Attachment description: WIP: Bug 1828144 - Part 2: Implement symbols as weakkap keys proposal → Bug 1828144 - Part 3: Implement symbols as weakmap keys proposal

Originally I reuse the patches from jon4t4n, but I cannot change the state of the patches because I am not the author.
I'll create a new patch stack for these.

Add a WeakMap whose key is of type JS::Value, so we can store an object or a
symbol as the weak map key.

Attachment #9330683 - Attachment is obsolete: true
Attachment #9330685 - Attachment is obsolete: true
Attachment #9330686 - Attachment is obsolete: true
Attachment #9328882 - Attachment is obsolete: true

Thanks for picking this up.
(I abandoned my patches to make the bug look less messy.)

Attachment #9356801 - Attachment description: Bug 1828144 - Part 2: Add ValueValueWeakMap → Bug 1828144 - Part 2: Add ValueValueWeakMap and use it in WeakMapObject and WeakSetObject.
Attachment #9356802 - Attachment description: Bug 1828144 - Part 3: Implement symbols as weakmap keys proposal → Bug 1828144 - Part 4: Allow using symbols as WeakMap/WeakSet keys
Attachment #9356726 - Attachment description: Bug 1828144 - Part 4: test262-update for symbols-as-weakmap-keys. → Bug 1828144 - Part 5: test262-update for symbols-as-weakmap-keys.
Attachment #9359128 - Attachment description: Bug 1828144 - Part 3: Implement KeyForSymbol and CanBeHeldWeakly → Bug 1828144 - Part 3: Implement KeyForSymbol and CanBeHeldWeakly.
Attachment #9356802 - Attachment description: Bug 1828144 - Part 4: Allow using symbols as WeakMap/WeakSet keys → Bug 1828144 - Part 4: Allow using symbols as WeakMap/WeakSet keys.

As Jonco suggested, the use case for Symbols as WeakRef/FinalizationRegistry targets are Shadow-Realms, and Record-Tuples, which are demoted stage 2, so in this bug I will only implement the WeakMap/WeakSet changes

Summary: Implement the Symbols as WeakMap keys proposal → Implement the WeakMap/WeakSet changes from the Symbols as WeakMap keys proposal
Depends on: 1862459
Attachment #9359128 - Attachment description: Bug 1828144 - Part 3: Implement KeyForSymbol and CanBeHeldWeakly. → Bug 1828144 - Part 3: Implement CanBeHeldWeakly.
Pushed by allstars.chh@gmail.com: https://hg.mozilla.org/integration/autoland/rev/453a7000485e Part 1: add pref symbols-as-weakmap-keys. r=jonco,sfink https://hg.mozilla.org/integration/autoland/rev/6bebd6afcc29 Part 2: Add ValueValueWeakMap and use it in WeakMapObject and WeakSetObject. r=jonco,sfink https://hg.mozilla.org/integration/autoland/rev/197dca60966e Part 3: Implement CanBeHeldWeakly. r=jonco,sfink https://hg.mozilla.org/integration/autoland/rev/da0e12436a83 Part 4: Allow using symbols as WeakMap/WeakSet keys. r=jonco,sfink https://hg.mozilla.org/integration/autoland/rev/c6ceb6c0817b Part 5: test262-update for symbols-as-weakmap-keys. r=jonco,sfink https://hg.mozilla.org/integration/autoland/rev/782ceca184bc apply code formatting via Lando
Regressions: 1863391
Regressions: 1866636
Depends on: 1869005
Regressions: 1890670
Regressions: 1902260
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: