Closed Bug 1990842 Opened 11 months ago Closed 10 months ago

Wrap Gecko MicroTasks in a JSObject wrapper with finalizer

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
146 Branch
Tracking Status
firefox146 --- fixed

People

(Reporter: mgaudet, Assigned: mgaudet)

References

Details

Attachments

(2 files, 1 obsolete file)

This was requested as a reliability measure by Olli to avoid ever being in a situation where a MicroTask is leaked.

The general idea is that Gecko MicroTasks will be put into the JS microtask queue wrapped inside a JSObject, which will ensure that if the MicroTask was never processed for any reason, at least when the JSObject finalizer is run we'll ensure that we do ->Release on the pointer decreasing its refcount.

There's a chance this will actually make the story around the SuppressedMicroTask list nicer too.

Severity: -- → N/A
Priority: -- → P2
Assignee: nobody → mgaudet
Attachment #9518831 - Attachment description: WIP: Bug 1990842 - Create JS::UncopyableValue and use as JS::UncopyableMicroTask → Bug 1990842 - Create JS::UncopyableValue and use as JS::UncopyableMicroTask r?iain!,smaug!
Status: NEW → ASSIGNED
Attachment #9518831 - Attachment description: Bug 1990842 - Create JS::UncopyableValue and use as JS::UncopyableMicroTask r?iain!,smaug! → Bug 1990842 - Enforce copying restrictions in Gecko.
Attachment #9518831 - Attachment description: Bug 1990842 - Enforce copying restrictions in Gecko. → Bug 1990842 - Create JS::UncopyableValue and use as JS::UncopyableMicroTask r?iain!,smaug!
Attachment #9520060 - Attachment description: WIP: Bug 1990842 - Enforce copying restrictions in Gecko. → Bug 1990842 - Enforce copying restrictions in Gecko r?smaug
Status: ASSIGNED → RESOLVED
Closed: 10 months ago
Resolution: --- → FIXED
Target Milestone: --- → 146 Branch
QA Whiteboard: [qa-triage-done-c147/b146]

Foolish Matthew.

This turns out to be a huge performance regression for the JS microtask queue, which has turned an expected performance win by enabling the JS micro task queue into a performance loss. See Bug 2001092.

Yet again, a recurring theme. In an attempt to make things better now the code pays an enormous amount of barrier costs.

My preference would be to revert this patch, but I'm travelling right now so I can't really investigate in too much detail until next week.

In the interim I will get the enablement patch reverted.

(In reply to Matthew Gaudet (he/him) [:mgaudet] from comment #6)
Creating an object per microtask sounds like the thing we are trying to avoid with moving the queue into the JS engine. Hopefully we can ensure we are leak free without doing this and rely on existing leak checking during testing to catch any problems.

Attachment #9518831 - Attachment is obsolete: true
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: