зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1668825 - Remove unused onChild return value r=sfink
This isn't used anywhere so we can make onChild void. Differential Revision: https://phabricator.services.mozilla.com/D92257
This commit is contained in:
Родитель
1d5db9bf4c
Коммит
6550bf91b1
|
@ -612,10 +612,9 @@ struct VerifyTraceProtoAndIfaceCacheCalledTracer : public JS::CallbackTracer {
|
|||
: JS::CallbackTracer(cx, JS::TracerKind::VerifyTraceProtoAndIface),
|
||||
ok(false) {}
|
||||
|
||||
bool onChild(const JS::GCCellPtr&) override {
|
||||
void onChild(const JS::GCCellPtr&) override {
|
||||
// We don't do anything here, we only want to verify that
|
||||
// TraceProtoAndIfaceCache was called.
|
||||
return true;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -295,44 +295,53 @@ class JS_PUBLIC_API CallbackTracer : public js::GenericTracer {
|
|||
|
||||
// Override this method to receive notification when a node in the GC
|
||||
// heap graph is visited.
|
||||
// This method should return whether the edge still exists, i.e. return false
|
||||
// if 'thing' is cleared by the CallbackTracer, return true otherwise.
|
||||
virtual bool onChild(const JS::GCCellPtr& thing) = 0;
|
||||
virtual void onChild(const JS::GCCellPtr& thing) = 0;
|
||||
|
||||
private:
|
||||
// This class implements the GenericTracer interface to dispatches to onChild.
|
||||
virtual bool onObjectEdge(JSObject** objp) {
|
||||
return onChild(JS::GCCellPtr(*objp));
|
||||
onChild(JS::GCCellPtr(*objp));
|
||||
return true;
|
||||
}
|
||||
virtual bool onStringEdge(JSString** strp) {
|
||||
return onChild(JS::GCCellPtr(*strp));
|
||||
onChild(JS::GCCellPtr(*strp));
|
||||
return true;
|
||||
}
|
||||
virtual bool onSymbolEdge(JS::Symbol** symp) {
|
||||
return onChild(JS::GCCellPtr(*symp));
|
||||
onChild(JS::GCCellPtr(*symp));
|
||||
return true;
|
||||
}
|
||||
virtual bool onBigIntEdge(JS::BigInt** bip) {
|
||||
return onChild(JS::GCCellPtr(*bip));
|
||||
onChild(JS::GCCellPtr(*bip));
|
||||
return true;
|
||||
}
|
||||
virtual bool onScriptEdge(js::BaseScript** scriptp) {
|
||||
return onChild(JS::GCCellPtr(*scriptp));
|
||||
onChild(JS::GCCellPtr(*scriptp));
|
||||
return true;
|
||||
}
|
||||
virtual bool onShapeEdge(js::Shape** shapep) {
|
||||
return onChild(JS::GCCellPtr(*shapep, JS::TraceKind::Shape));
|
||||
onChild(JS::GCCellPtr(*shapep, JS::TraceKind::Shape));
|
||||
return true;
|
||||
}
|
||||
virtual bool onObjectGroupEdge(js::ObjectGroup** groupp) {
|
||||
return onChild(JS::GCCellPtr(*groupp, JS::TraceKind::ObjectGroup));
|
||||
onChild(JS::GCCellPtr(*groupp, JS::TraceKind::ObjectGroup));
|
||||
return true;
|
||||
}
|
||||
virtual bool onBaseShapeEdge(js::BaseShape** basep) {
|
||||
return onChild(JS::GCCellPtr(*basep, JS::TraceKind::BaseShape));
|
||||
onChild(JS::GCCellPtr(*basep, JS::TraceKind::BaseShape));
|
||||
return true;
|
||||
}
|
||||
virtual bool onJitCodeEdge(js::jit::JitCode** codep) {
|
||||
return onChild(JS::GCCellPtr(*codep, JS::TraceKind::JitCode));
|
||||
onChild(JS::GCCellPtr(*codep, JS::TraceKind::JitCode));
|
||||
return true;
|
||||
}
|
||||
virtual bool onScopeEdge(js::Scope** scopep) {
|
||||
return onChild(JS::GCCellPtr(*scopep, JS::TraceKind::Scope));
|
||||
onChild(JS::GCCellPtr(*scopep, JS::TraceKind::Scope));
|
||||
return true;
|
||||
}
|
||||
virtual bool onRegExpSharedEdge(js::RegExpShared** sharedp) {
|
||||
return onChild(JS::GCCellPtr(*sharedp, JS::TraceKind::RegExpShared));
|
||||
onChild(JS::GCCellPtr(*sharedp, JS::TraceKind::RegExpShared));
|
||||
return true;
|
||||
}
|
||||
|
||||
TracingContext context_;
|
||||
|
|
|
@ -1873,11 +1873,10 @@ class HasChildTracer final : public JS::CallbackTracer {
|
|||
RootedValue child_;
|
||||
bool found_;
|
||||
|
||||
bool onChild(const JS::GCCellPtr& thing) override {
|
||||
void onChild(const JS::GCCellPtr& thing) override {
|
||||
if (thing.asCell() == child_.toGCThing()) {
|
||||
found_ = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -3846,7 +3846,7 @@ bool GCRuntime::shouldPreserveJITCode(Realm* realm,
|
|||
|
||||
#ifdef DEBUG
|
||||
class CompartmentCheckTracer final : public JS::CallbackTracer {
|
||||
bool onChild(const JS::GCCellPtr& thing) override;
|
||||
void onChild(const JS::GCCellPtr& thing) override;
|
||||
|
||||
public:
|
||||
explicit CompartmentCheckTracer(JSRuntime* rt)
|
||||
|
@ -3885,7 +3885,7 @@ static bool InCrossCompartmentMap(JSRuntime* rt, JSObject* src,
|
|||
return false;
|
||||
}
|
||||
|
||||
bool CompartmentCheckTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
void CompartmentCheckTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
Compartment* comp =
|
||||
MapGCThingTyped(thing, [](auto t) { return t->maybeCompartment(); });
|
||||
if (comp && compartment) {
|
||||
|
@ -3898,7 +3898,6 @@ bool CompartmentCheckTracer::onChild(const JS::GCCellPtr& thing) {
|
|||
Zone* thingZone = tenured->zoneFromAnyThread();
|
||||
MOZ_ASSERT(thingZone == zone || thingZone->isAtomsZone());
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void GCRuntime::checkForCompartmentMismatches() {
|
||||
|
|
|
@ -4042,9 +4042,8 @@ struct AssertNonGrayTracer final : public JS::CallbackTracer {
|
|||
// context without making this more generic.
|
||||
explicit AssertNonGrayTracer(JSRuntime* rt)
|
||||
: JS::CallbackTracer(rt, JS::TracerKind::UnmarkGray) {}
|
||||
bool onChild(const JS::GCCellPtr& thing) override {
|
||||
void onChild(const JS::GCCellPtr& thing) override {
|
||||
MOZ_ASSERT(!thing.asCell()->isMarkedGray());
|
||||
return true;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
@ -4072,10 +4071,10 @@ class UnmarkGrayTracer final : public JS::CallbackTracer {
|
|||
// Stack of cells to traverse.
|
||||
Vector<JS::GCCellPtr, 0, SystemAllocPolicy>& stack;
|
||||
|
||||
bool onChild(const JS::GCCellPtr& thing) override;
|
||||
void onChild(const JS::GCCellPtr& thing) override;
|
||||
};
|
||||
|
||||
bool UnmarkGrayTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
void UnmarkGrayTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
Cell* cell = thing.asCell();
|
||||
|
||||
// Cells in the nursery cannot be gray, and nor can certain kinds of tenured
|
||||
|
@ -4087,7 +4086,7 @@ bool UnmarkGrayTracer::onChild(const JS::GCCellPtr& thing) {
|
|||
AssertNonGrayTracer nongray(runtime());
|
||||
TraceChildren(&nongray, cell, thing.kind());
|
||||
#endif
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
TenuredCell& tenured = cell->asTenured();
|
||||
|
@ -4105,11 +4104,11 @@ bool UnmarkGrayTracer::onChild(const JS::GCCellPtr& thing) {
|
|||
MOZ_ASSERT(tmp == cell);
|
||||
unmarkedAny = true;
|
||||
}
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!tenured.isMarkedGray()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
tenured.markBlack();
|
||||
|
@ -4118,7 +4117,6 @@ bool UnmarkGrayTracer::onChild(const JS::GCCellPtr& thing) {
|
|||
if (!stack.append(thing)) {
|
||||
oom = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void UnmarkGrayTracer::unmark(JS::GCCellPtr cell) {
|
||||
|
|
|
@ -441,9 +441,8 @@ void GCRuntime::traceEmbeddingGrayRoots(JSTracer* trc) {
|
|||
|
||||
#ifdef DEBUG
|
||||
class AssertNoRootsTracer final : public JS::CallbackTracer {
|
||||
bool onChild(const JS::GCCellPtr& thing) override {
|
||||
void onChild(const JS::GCCellPtr& thing) override {
|
||||
MOZ_CRASH("There should not be any roots during runtime shutdown");
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -89,7 +89,7 @@ typedef HashMap<Cell*, VerifyNode*, DefaultHasher<Cell*>, SystemAllocPolicy>
|
|||
class js::VerifyPreTracer final : public JS::CallbackTracer {
|
||||
JS::AutoDisableGenerationalGC noggc;
|
||||
|
||||
bool onChild(const JS::GCCellPtr& thing) override;
|
||||
void onChild(const JS::GCCellPtr& thing) override;
|
||||
|
||||
public:
|
||||
/* The gcNumber when the verification began. */
|
||||
|
@ -126,18 +126,18 @@ class js::VerifyPreTracer final : public JS::CallbackTracer {
|
|||
* This function builds up the heap snapshot by adding edges to the current
|
||||
* node.
|
||||
*/
|
||||
bool VerifyPreTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
void VerifyPreTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
MOZ_ASSERT(!IsInsideNursery(thing.asCell()));
|
||||
|
||||
// Skip things in other runtimes.
|
||||
if (thing.asCell()->asTenured().runtimeFromAnyThread() != runtime()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
edgeptr += sizeof(EdgeValue);
|
||||
if (edgeptr >= term) {
|
||||
edgeptr = term;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
VerifyNode* node = curnode;
|
||||
|
@ -146,7 +146,6 @@ bool VerifyPreTracer::onChild(const JS::GCCellPtr& thing) {
|
|||
node->edges[i].thing = thing;
|
||||
node->edges[i].label = context().name();
|
||||
node->count++;
|
||||
return true;
|
||||
}
|
||||
|
||||
static VerifyNode* MakeNode(VerifyPreTracer* trc, JS::GCCellPtr thing) {
|
||||
|
@ -276,7 +275,7 @@ struct CheckEdgeTracer final : public JS::CallbackTracer {
|
|||
VerifyNode* node;
|
||||
explicit CheckEdgeTracer(JSRuntime* rt)
|
||||
: JS::CallbackTracer(rt), node(nullptr) {}
|
||||
bool onChild(const JS::GCCellPtr& thing) override;
|
||||
void onChild(const JS::GCCellPtr& thing) override;
|
||||
};
|
||||
|
||||
static const uint32_t MAX_VERIFIER_EDGES = 1000;
|
||||
|
@ -288,24 +287,23 @@ static const uint32_t MAX_VERIFIER_EDGES = 1000;
|
|||
* non-nullptr edges (i.e., the ones from the original snapshot that must have
|
||||
* been modified) must point to marked objects.
|
||||
*/
|
||||
bool CheckEdgeTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
void CheckEdgeTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
// Skip things in other runtimes.
|
||||
if (thing.asCell()->asTenured().runtimeFromAnyThread() != runtime()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Avoid n^2 behavior. */
|
||||
if (node->count > MAX_VERIFIER_EDGES) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < node->count; i++) {
|
||||
if (node->edges[i].thing == thing) {
|
||||
node->edges[i].thing = JS::GCCellPtr();
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
void js::gc::AssertSafeToSkipPreWriteBarrier(TenuredCell* thing) {
|
||||
|
@ -776,7 +774,7 @@ class HeapCheckTracerBase : public JS::CallbackTracer {
|
|||
size_t failures;
|
||||
|
||||
private:
|
||||
bool onChild(const JS::GCCellPtr& thing) override;
|
||||
void onChild(const JS::GCCellPtr& thing) override;
|
||||
|
||||
struct WorkItem {
|
||||
WorkItem(JS::GCCellPtr thing, const char* name, int parentIndex)
|
||||
|
@ -810,36 +808,34 @@ HeapCheckTracerBase::HeapCheckTracerBase(JSRuntime* rt,
|
|||
# endif
|
||||
}
|
||||
|
||||
bool HeapCheckTracerBase::onChild(const JS::GCCellPtr& thing) {
|
||||
void HeapCheckTracerBase::onChild(const JS::GCCellPtr& thing) {
|
||||
Cell* cell = thing.asCell();
|
||||
checkCell(cell);
|
||||
|
||||
if (visited.lookup(cell)) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!visited.put(cell)) {
|
||||
oom = true;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't trace into GC things owned by another runtime.
|
||||
if (cell->runtimeFromAnyThread() != rt) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't trace into GC in zones being used by helper threads.
|
||||
Zone* zone = thing.asCell()->zone();
|
||||
if (zone->usedByHelperThread()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
WorkItem item(thing, context().name(), parentIndex);
|
||||
if (!stack.append(item)) {
|
||||
oom = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool HeapCheckTracerBase::traceHeap(AutoTraceSession& session) {
|
||||
|
|
|
@ -72,7 +72,7 @@ static bool ConstructCCW(JSContext* cx, const JSClass* globalClasp,
|
|||
}
|
||||
|
||||
class CCWTestTracer final : public JS::CallbackTracer {
|
||||
bool onChild(const JS::GCCellPtr& thing) override {
|
||||
void onChild(const JS::GCCellPtr& thing) override {
|
||||
numberOfThingsTraced++;
|
||||
|
||||
printf("*thingp = %p\n", thing.asCell());
|
||||
|
@ -84,7 +84,6 @@ class CCWTestTracer final : public JS::CallbackTracer {
|
|||
if (thing.asCell() != *expectedThingp || thing.kind() != expectedKind) {
|
||||
okay = false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
#include "jsapi-tests/tests.h"
|
||||
|
||||
class TestTracer final : public JS::CallbackTracer {
|
||||
bool onChild(const JS::GCCellPtr& thing) override {
|
||||
void onChild(const JS::GCCellPtr& thing) override {
|
||||
if (thing.asCell() == expectedCell && thing.kind() == expectedKind) {
|
||||
found = true;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -519,7 +519,7 @@ struct DumpHeapTracer final : public JS::CallbackTracer, public WeakMapTracer {
|
|||
key.asCell(), kdelegate, value.asCell());
|
||||
}
|
||||
|
||||
bool onChild(const JS::GCCellPtr& thing) override;
|
||||
void onChild(const JS::GCCellPtr& thing) override;
|
||||
};
|
||||
|
||||
static char MarkDescriptor(js::gc::Cell* thing) {
|
||||
|
@ -585,16 +585,15 @@ static void DumpHeapVisitCell(JSRuntime* rt, void* data, JS::GCCellPtr cellptr,
|
|||
js::TraceChildren(dtrc, cellptr.asCell(), cellptr.kind());
|
||||
}
|
||||
|
||||
bool DumpHeapTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
void DumpHeapTracer::onChild(const JS::GCCellPtr& thing) {
|
||||
if (js::gc::IsInsideNursery(thing.asCell())) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
char buffer[1024];
|
||||
context().getEdgeName(buffer, sizeof(buffer));
|
||||
fprintf(output, "%s%p %c %s\n", prefix, thing.asCell(),
|
||||
MarkDescriptor(thing.asCell()), buffer);
|
||||
return true;
|
||||
}
|
||||
|
||||
void js::DumpHeap(JSContext* cx, FILE* fp,
|
||||
|
|
|
@ -196,18 +196,18 @@ class EdgeVectorTracer final : public JS::CallbackTracer {
|
|||
// True if we should populate the edge's names.
|
||||
bool wantNames;
|
||||
|
||||
bool onChild(const JS::GCCellPtr& thing) override {
|
||||
void onChild(const JS::GCCellPtr& thing) override {
|
||||
if (!okay) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't trace permanent atoms and well-known symbols that are owned by
|
||||
// a parent JSRuntime.
|
||||
if (thing.is<JSString>() && thing.as<JSString>().isPermanentAtom()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
if (thing.is<JS::Symbol>() && thing.as<JS::Symbol>().isWellKnownSymbol()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
char16_t* name16 = nullptr;
|
||||
|
@ -221,7 +221,7 @@ class EdgeVectorTracer final : public JS::CallbackTracer {
|
|||
name16 = js_pod_malloc<char16_t>(strlen(name) + 1);
|
||||
if (!name16) {
|
||||
okay = false;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
size_t i;
|
||||
|
@ -237,10 +237,8 @@ class EdgeVectorTracer final : public JS::CallbackTracer {
|
|||
// retains it, and its destructor will free it.
|
||||
if (!vec->append(Edge(name16, Node(thing)))) {
|
||||
okay = false;
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public:
|
||||
|
|
|
@ -156,7 +156,7 @@ struct NoteWeakMapChildrenTracer : public JS::CallbackTracer {
|
|||
mKeyDelegate(nullptr) {
|
||||
setCanSkipJsids(true);
|
||||
}
|
||||
bool onChild(const JS::GCCellPtr& aThing) override;
|
||||
void onChild(const JS::GCCellPtr& aThing) override;
|
||||
nsCycleCollectionNoteRootCallback& mCb;
|
||||
bool mTracedAny;
|
||||
JSObject* mMap;
|
||||
|
@ -164,13 +164,13 @@ struct NoteWeakMapChildrenTracer : public JS::CallbackTracer {
|
|||
JSObject* mKeyDelegate;
|
||||
};
|
||||
|
||||
bool NoteWeakMapChildrenTracer::onChild(const JS::GCCellPtr& aThing) {
|
||||
void NoteWeakMapChildrenTracer::onChild(const JS::GCCellPtr& aThing) {
|
||||
if (aThing.is<JSString>()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (!JS::GCThingIsMarkedGray(aThing) && !mCb.WantAllTraces()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
if (JS::IsCCTraceKind(aThing.kind())) {
|
||||
|
@ -179,7 +179,6 @@ bool NoteWeakMapChildrenTracer::onChild(const JS::GCCellPtr& aThing) {
|
|||
} else {
|
||||
JS::TraceChildren(this, aThing);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
struct NoteWeakMapsTracer : public js::WeakMapTracer {
|
||||
|
@ -395,20 +394,20 @@ struct TraversalTracer : public JS::CallbackTracer {
|
|||
mCb(aCb) {
|
||||
setCanSkipJsids(true);
|
||||
}
|
||||
bool onChild(const JS::GCCellPtr& aThing) override;
|
||||
void onChild(const JS::GCCellPtr& aThing) override;
|
||||
nsCycleCollectionTraversalCallback& mCb;
|
||||
};
|
||||
|
||||
bool TraversalTracer::onChild(const JS::GCCellPtr& aThing) {
|
||||
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 true;
|
||||
return;
|
||||
}
|
||||
|
||||
// Don't traverse non-gray objects, unless we want all traces.
|
||||
if (!JS::GCThingIsMarkedGray(aThing) && !mCb.WantAllTraces()) {
|
||||
return true;
|
||||
return;
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -437,7 +436,6 @@ bool TraversalTracer::onChild(const JS::GCCellPtr& aThing) {
|
|||
} else {
|
||||
JS::TraceChildren(this, aThing);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void NoteJSChildGrayWrapperShim(void* aData, JS::GCCellPtr aThing,
|
||||
|
@ -719,11 +717,10 @@ class JSLeakTracer : public JS::CallbackTracer {
|
|||
JS::WeakMapTraceAction::TraceKeysAndValues) {}
|
||||
|
||||
private:
|
||||
bool onChild(const JS::GCCellPtr& thing) override {
|
||||
void onChild(const JS::GCCellPtr& thing) override {
|
||||
const char* kindName = JS::GCTraceKindToAscii(thing.kind());
|
||||
size_t size = JS::GCTraceKindSize(thing.kind());
|
||||
MOZ_LOG_CTOR(thing.asCell(), kindName, size);
|
||||
return true;
|
||||
}
|
||||
};
|
||||
#endif
|
||||
|
|
Загрузка…
Ссылка в новой задаче