Bug 1447391 - Early return for strings and symbols when tracing for CC, r=mccr8
This commit is contained in:
@@ -407,6 +407,12 @@ struct TraversalTracer : public JS::CallbackTracer
|
||||
void
|
||||
TraversalTracer::onChild(const JS::GCCellPtr& aThing)
|
||||
{
|
||||
// Checking strings and symbols for being gray is rather slow, and we don't
|
||||
// need either of them for the cycle collector.
|
||||
if (aThing.is<JSString>() || aThing.is<JS::Symbol>()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't traverse non-gray objects, unless we want all traces.
|
||||
if (!JS::GCThingIsMarkedGray(aThing) && !mCb.WantAllTraces()) {
|
||||
return;
|
||||
@@ -435,7 +441,7 @@ TraversalTracer::onChild(const JS::GCCellPtr& aThing)
|
||||
// due to information attached to the groups which can lead other groups to
|
||||
// be traced.
|
||||
JS_TraceObjectGroupCycleCollectorChildren(this, aThing);
|
||||
} else if (!aThing.is<JSString>()) {
|
||||
} else {
|
||||
JS::TraceChildren(this, aThing);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user