Closed Bug 827471 Opened 12 years ago Closed 12 years ago

Improve CanSkipWrappedJS

Categories

(Core :: XPConnect, defect)

x86_64
Linux
defect
Not set
normal

Tracking

()

RESOLVED FIXED
mozilla21

People

(Reporter: smaug, Assigned: smaug)

Details

Attachments

(1 file, 2 obsolete files)

Attached patch patch (obsolete) — Splinter Review
I have quite a few WrappedJS objects in my graph. They are objects holding root WrappedJS object alive, so they are are always in pair. We optimize out only root wrappedJS, but non-root wrappedJS brings back also the root. I don't expect this to speed up anything, but makes graphs easier to analyze. https://tbpl.mozilla.org/?tree=Try&rev=5487bf997839
Hmm, not quite that simple.
Attached patch faster (obsolete) — Splinter Review
Attachment #698813 - Attachment is obsolete: true
Attached patch v3Splinter Review
Attachment #698828 - Attachment is obsolete: true
Attachment #698910 - Flags: review?(continuation)
This should get rid of about 30% of objects in my current graph.
Comment on attachment 698910 [details] [diff] [review] v3 Review of attachment 698910 [details] [diff] [review]: ----------------------------------------------------------------- ::: js/xpconnect/src/XPCJSRuntime.cpp @@ +435,4 @@ > if (nsCCUncollectableMarker::sGeneration && > (!obj || !xpc_IsGrayGCThing(obj)) && > !wrappedJS->IsSubjectToFinalization() && > + (isRootWrappedJS || CanSkipWrappedJS(wrappedJS->GetRootWrapper()))) { Are these chains of root wrappers going to be fairly short? The time to visit them all is going to be quadratic in the length of these chains, which could get ugly. @@ +435,5 @@ > if (nsCCUncollectableMarker::sGeneration && > (!obj || !xpc_IsGrayGCThing(obj)) && > !wrappedJS->IsSubjectToFinalization() && > + (isRootWrappedJS || CanSkipWrappedJS(wrappedJS->GetRootWrapper()))) { > + if (!wrappedJS->IsAggregatedToNative() || !isRootWrappedJS) { The additional quick case here occurs when the wrapped JS IsAggregatedToNative(), but also CanSkipWrappedJS() on its root wrapper. Why is that okay to not look at the aggregated native object? I admit to not knowing what is going on in the else case here.
(In reply to Andrew McCreight [:mccr8] from comment #5) > Are these chains of root wrappers going to be fairly short? The time to > visit them all is going to be quadratic in the length of these chains, which > could get ugly. All the chains I've seen have been short. Just one wrappedjs under root > The additional quick case here occurs when the wrapped JS > IsAggregatedToNative(), but also CanSkipWrappedJS() on its root wrapper. Why > is that okay to not look at the aggregated native object? I admit to not > knowing what is going on in the else case here. Because aggregated native object hangs in the root
Comment on attachment 698910 [details] [diff] [review] v3 Great! Thanks for the explanations.
Attachment #698910 - Flags: review?(continuation) → review+
Status: NEW → RESOLVED
Closed: 12 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla21
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: