Closed Bug 1744036 Opened 2 years ago Closed 2 years ago

Stop using pinned atoms in a few places

Categories

(Core :: JavaScript Engine, task, P2)

task

Tracking

()

RESOLVED FIXED
97 Branch
Tracking Status
firefox97 --- fixed

People

(Reporter: jandem, Assigned: jandem)

References

Details

Attachments

(6 files)

There are some places where we use pinned atoms that we can change to non-pinned atoms. This improves memory usage and fixes part of the regression in bug 1743423.

This also implements a copy constructor for XPCNativeMember to balance ctor/dtor counts.

Depends on D132689

This patch ensures that tracing XPCNativeInterface through the map in XPCJSRuntime
(implemented in a later patch) is sufficient to trace every live XPCNativeInterface.

Depends on D132690

Pinned atoms are marked implicitly, so if we stop pinning these atoms we need to
mark them explicitly for the current zone.

Depends on D132691

Replace the use of pinned atoms with code to trace all atoms stored in live
XPCNativeInterface instances. This means we stop 'leaking' those atoms after
releasing the XPCNativeInterface using them.

Depends on D132692

Some random food for thought: these jsids are the only parts of XPCNativeInterface and XPCNativeMember that are dynamically allocated, so if there was some way to compile those into the binary I think we could statically generate IID2NativeInterfaceMap and not use any dynamic memory for it.

(In reply to Andrew McCreight [:mccr8] from comment #7)

Some random food for thought: these jsids are the only parts of XPCNativeInterface and XPCNativeMember that are dynamically allocated, so if there was some way to compile those into the binary I think we could statically generate IID2NativeInterfaceMap and not use any dynamic memory for it.

Yeah, that would be ideal. We've talked a few times about replacing pinned atoms with statically allocated atoms/jsids, probably worth investigating more.

Pushed by jdemooij@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/9553a8b296a6
part 1 - Don't use a pinned atom in ReportCantConvert. r=jonco
https://hg.mozilla.org/integration/autoland/rev/39ce51389a5c
part 2 - Don't use pinned atoms in a few places in DOM bindings. r=jonco,peterv
https://hg.mozilla.org/integration/autoland/rev/2a2dbb384a2b
part 3 - Use a Vector for the list of members in XPCNativeInterface::NewInstance. r=mccr8
https://hg.mozilla.org/integration/autoland/rev/9441b1f8bd3e
part 4 - Add the new XPCNativeInterface to the map in XPCNativeInterface::NewInstance. r=mccr8,jonco
https://hg.mozilla.org/integration/autoland/rev/a5fe1d14598a
part 5 - Fix atom marking for XPCNativeMember names. r=mccr8,jonco
https://hg.mozilla.org/integration/autoland/rev/b40a7a2cf1c8
part 6 - Stop pinning atoms for XPCNativeInterface. r=mccr8,jonco

== Change summary for alert #32664 (as of Thu, 09 Dec 2021 19:20:24 GMT) ==

Improvements:

Ratio Test Platform Options Absolute values (old vs new)
1% Base Content JS linux1804-64-shippable-qr 1,828,142.33 -> 1,818,424.00
1% Base Content JS windows10-64-2004-shippable-qr 1,833,592.00 -> 1,823,864.00
1% Base Content JS macosx1015-64-shippable-qr 1,860,424.00 -> 1,850,696.00

For up to date results, see: https://treeherder.mozilla.org/perfherder/alerts?id=32664

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: