Closed Bug 1903034 Opened 2 years ago Closed 1 year ago

Drop JS objects sooner for promise callbacks

Categories

(Core :: DOM: Bindings (WebIDL), enhancement)

enhancement

Tracking

()

RESOLVED DUPLICATE of bug 1953167

People

(Reporter: jonco, Assigned: jonco)

References

(Blocks 1 open bug)

Details

Attachments

(1 obsolete file)

For promise callback objects, we clear their references to JS GC things after the callback has happened so as to not keep these alive longer than necessary. This is possible because these callbacks can only be run once.

This happens here: https://searchfox.org/mozilla-central/source/xpcom/base/CycleCollectedJSContext.cpp#212-217

Currently we leave the callback object in the JS holders table until it is destroyed. Removing it earlier would help with cases where frequent uses of promises results in this table growing large and increasing GC time.

For promise callbacks we call CallbackObject::Reset after the callback has been
called to clear JS references and avoid keeping JS GC things around longer than
necessary (promise callbacks can only be called once).

We don't need to keep the callback object in the JS holders table after this
point.

Pushed by jcoppeard@mozilla.com: https://hg.mozilla.org/integration/autoland/rev/f342fbf7ef65 Call DropJSObjects after a promise callback has been called r=mccr8
Status: NEW → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED
Target Milestone: --- → 129 Branch

(In reply to Mayank Bansal from comment #4)
Looks like that subtest makes heavy uses of promises, so I'd say yes.

Regressions: 1904810

Reopening since this was backed out on request for causing Bug 1904810
Backout link: https://hg.mozilla.org/integration/autoland/rev/9663399d8f74eedee18666f60b7325fc8d1f3d26

Status: RESOLVED → REOPENED
Flags: needinfo?(jcoppeard)
Resolution: FIXED → ---
Target Milestone: 129 Branch → ---

Backout merged to beta: hg.mozilla.org/releases/mozilla-beta/rev/23e67191d0da0174665ab3a58f9ebf134f274f8a

There is an r+ patch which didn't land and no activity in this bug for 2 weeks.
:jonco, could you have a look please?
If you still have some work to do, you can add an action "Plan Changes" in Phabricator.
For more information, please visit BugBot documentation.

Flags: needinfo?(jcoppeard)
Flags: needinfo?(continuation)
Flags: needinfo?(continuation)
Attachment #9407860 - Attachment is obsolete: true
Flags: needinfo?(jcoppeard)
Depends on: 1953167

This change has happened as part of bug 1953167.

Status: REOPENED → RESOLVED
Closed: 2 years ago1 year ago
No longer depends on: 1953167
Duplicate of bug: 1953167
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: