Closed
Bug 820233
Opened 12 years ago
Closed 10 years ago
Eliminate calls to js::GCThingTraceKind from NoteJSHolder
Categories
(Core :: JavaScript Engine, defect)
Tracking
()
RESOLVED
DUPLICATE
of bug 1105069
People
(Reporter: smaug, Assigned: mccr8)
References
Details
Attachments
(4 obsolete files)
I was profiling base level CC and since FF UI has plenty of JS, lots of the time
is spent tracing JS, and there GCThingTraceKind shows up in the profiles a bit.
I wonder whether it could be possible to inline that function.
Updated•10 years ago
|
Assignee: general → nobody
Assignee | ||
Comment 1•10 years ago
|
||
In the first slice of the CC, we still spend a decent chunk of time running GCThingTraceKind. I think that almost every place that calls NoteJSRoot and NoteJSChild knows what kind it is dealing with, so once bug 1105069 has landed, it should be easy to just eliminate these calls and make the CC traverse interface strongly typed and just get rid of those calls. I'm not sure if bug 1105069 itself does that.
Depends on: 1105069
Summary: Inline js::GCThingTraceKind ? → js::GCThingTraceKind takes a lot of time in CheckParticipatesInCycleCollection
Assignee | ||
Updated•10 years ago
|
Summary: js::GCThingTraceKind takes a lot of time in CheckParticipatesInCycleCollection → Strongly type JS callbacks in nsCycleCollectionNoteRootCallback and nsCycleCollectionTraversalCallback
Assignee | ||
Comment 2•10 years ago
|
||
NoteJSRoot seems to only be called in XPCJSRuntime::SuspectWrappedNative, so the arg type could just be changed to JSObject*.
Assignee | ||
Updated•10 years ago
|
Assignee: nobody → continuation
Assignee | ||
Comment 3•10 years ago
|
||
It looks like this can be done locally by eliminating the indirection of TraceCallbackFunc.
Summary: Strongly type JS callbacks in nsCycleCollectionNoteRootCallback and nsCycleCollectionTraversalCallback → Eliminate calls to js::GCThingTraceKind from NoteJSHolder
Assignee | ||
Comment 4•10 years ago
|
||
Assignee | ||
Comment 5•10 years ago
|
||
Also need to filter out values that are strings. This passed a tiny bit of local testing.
Attachment #8532830 -
Attachment is obsolete: true
Assignee | ||
Comment 6•10 years ago
|
||
I did some testing, with 20 tabs of TechCrunch open, timing CycleCollectedJSRuntime::TraverseNativeRoots. Sometimes it doesn't take any time, but about half of the time it does take some time. Without this patch, the long ones were taking 3.9ms to 4.4ms. With the patch, they were taking 3.4ms to 3.6ms. That's a pretty decent improvement, around 10%, which is what smaug was seeing js::GCThingTraceKind take on his profile, though obviously it is still taking quite a while.
Assignee | ||
Comment 7•10 years ago
|
||
try run from a slightly earlier version of the patch:
https://treeherder.mozilla.org/ui/#/jobs?repo=try&revision=982a29c227ca
Attachment #8533353 -
Flags: review?(bugs)
Reporter | ||
Comment 8•10 years ago
|
||
(In reply to Andrew McCreight [:mccr8] from comment #5)
> Also need to filter out values that are strings.
Hmm, why
Assignee | ||
Comment 9•10 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #8)
> Hmm, why
Because I assert in JSHolderTraceImpl that we don't pass in any non-CCGCThings. I think they'll just get filtered out later if we do pass it in.
Reporter | ||
Comment 10•10 years ago
|
||
Comment on attachment 8533353 [details] [diff] [review]
Eliminate indirection in CheckParticipates.
Since CheckParticipatesInCycleCollection can deal with null-whatever,
I think we should add a check to NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK
that it is really used for JS::Values only.
Maybe
static_assert(sizeof(*(tmp->_field)) == sizeof(JS::Value));
?
(Doesn't matter too much what is put there, just something which ensures it is used for JS::Values only.)
With that, r+
Attachment #8533353 -
Flags: review?(bugs) → review+
Assignee | ||
Comment 11•10 years ago
|
||
(In reply to Olli Pettay [:smaug] from comment #10)
> Since CheckParticipatesInCycleCollection can deal with null-whatever,
> I think we should add a check to
> NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK
> that it is really used for JS::Values only.
> Maybe
> static_assert(sizeof(*(tmp->_field)) == sizeof(JS::Value));
> ?
> (Doesn't matter too much what is put there, just something which ensures it
> is used for JS::Values only.)
I don't understand how this is really related to this patch? I agree that sounds like a good idea, though I'd probably do it by making NS_IMPL_CYCLE_COLLECTION_TRACE_JSVAL_MEMBER_CALLBACK call a new method that takes an argument.
Flags: needinfo?(bugs)
Reporter | ||
Comment 12•10 years ago
|
||
Hmm, looks like I misread something since I thought the current implementation would just
return early if null was passed. But looks like we crash already. So nm.
Flags: needinfo?(bugs)
Assignee | ||
Updated•10 years ago
|
Attachment #8532831 -
Attachment is obsolete: true
Assignee | ||
Comment 13•10 years ago
|
||
This still needs some kind of conversion from jsid to GCCellPtr.
Assignee | ||
Comment 14•10 years ago
|
||
Bug 1105069 is going to eliminate the call to js::GCThingTraceKind in a slightly different way so I guess I didn't actually need to write this patch after all.
Assignee | ||
Updated•10 years ago
|
Attachment #8533353 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Attachment #8533938 -
Attachment is obsolete: true
Assignee | ||
Updated•10 years ago
|
Status: NEW → RESOLVED
Closed: 10 years ago
Resolution: --- → DUPLICATE
You need to log in
before you can comment on or make changes to this bug.
Description
•