Bug 1741246 - Pass JS::GCCellPtr in nsCycleCollectionTraversalCallback::NoteJSChild(). r=jonco

This is a pointer-sized value, so there's no need to pass it by
value. All of the SpiderMonkey places that pass GCCellPtr are doing
it by value, so this is aligning with that.

In addition, I removed a NoteJSChild() overload that is no longer
used.

Differential Revision: https://phabricator.services.mozilla.com/D131163
This commit is contained in:
Andrew McCreight 2021-11-16 14:52:54 +00:00
parent d226afc848
commit 8648653dd1
3 changed files with 6 additions and 8 deletions

View file

@ -73,7 +73,7 @@ class DebugWrapperTraversalCallback
DescribeGCedNode(bool aIsMarked, const char* aObjName, DescribeGCedNode(bool aIsMarked, const char* aObjName,
uint64_t aCompartmentAddress) override {} uint64_t aCompartmentAddress) override {}
NS_IMETHOD_(void) NoteJSChild(const JS::GCCellPtr& aChild) override { NS_IMETHOD_(void) NoteJSChild(JS::GCCellPtr aChild) override {
if (aChild == mWrapper) { if (aChild == mWrapper) {
mFound = true; mFound = true;
} }

View file

@ -31,7 +31,7 @@ class NS_NO_VTABLE nsCycleCollectionTraversalCallback {
uint64_t aCompartmentAddress = 0) = 0; uint64_t aCompartmentAddress = 0) = 0;
NS_IMETHOD_(void) NoteXPCOMChild(nsISupports* aChild) = 0; NS_IMETHOD_(void) NoteXPCOMChild(nsISupports* aChild) = 0;
NS_IMETHOD_(void) NoteJSChild(const JS::GCCellPtr& aThing) = 0; NS_IMETHOD_(void) NoteJSChild(JS::GCCellPtr aThing) = 0;
NS_IMETHOD_(void) NS_IMETHOD_(void)
NoteNativeChild(void* aChild, nsCycleCollectionParticipant* aHelper) = 0; NoteNativeChild(void* aChild, nsCycleCollectionParticipant* aHelper) = 0;

View file

@ -1887,15 +1887,13 @@ class CCGraphBuilder final : public nsCycleCollectionTraversalCallback,
uint64_t aCompartmentAddress) override; uint64_t aCompartmentAddress) override;
NS_IMETHOD_(void) NoteXPCOMChild(nsISupports* aChild) override; NS_IMETHOD_(void) NoteXPCOMChild(nsISupports* aChild) override;
NS_IMETHOD_(void) NoteJSChild(const JS::GCCellPtr& aThing) override; NS_IMETHOD_(void) NoteJSChild(JS::GCCellPtr aThing) override;
NS_IMETHOD_(void) NS_IMETHOD_(void)
NoteNativeChild(void* aChild, NoteNativeChild(void* aChild,
nsCycleCollectionParticipant* aParticipant) override; nsCycleCollectionParticipant* aParticipant) override;
NS_IMETHOD_(void) NoteNextEdgeName(const char* aName) override; NS_IMETHOD_(void) NoteNextEdgeName(const char* aName) override;
private: private:
void NoteJSChild(JS::GCCellPtr aChild);
NS_IMETHOD_(void) NS_IMETHOD_(void)
NoteRoot(void* aRoot, nsCycleCollectionParticipant* aParticipant) { NoteRoot(void* aRoot, nsCycleCollectionParticipant* aParticipant) {
MOZ_ASSERT(aRoot); MOZ_ASSERT(aRoot);
@ -2178,7 +2176,7 @@ CCGraphBuilder::NoteNativeChild(void* aChild,
} }
NS_IMETHODIMP_(void) NS_IMETHODIMP_(void)
CCGraphBuilder::NoteJSChild(const JS::GCCellPtr& aChild) { CCGraphBuilder::NoteJSChild(JS::GCCellPtr aChild) {
if (!aChild) { if (!aChild) {
return; return;
} }
@ -2259,7 +2257,7 @@ class ChildFinder : public nsCycleCollectionTraversalCallback {
NS_IMETHOD_(void) NoteXPCOMChild(nsISupports* aChild) override; NS_IMETHOD_(void) NoteXPCOMChild(nsISupports* aChild) override;
NS_IMETHOD_(void) NS_IMETHOD_(void)
NoteNativeChild(void* aChild, nsCycleCollectionParticipant* aHelper) override; NoteNativeChild(void* aChild, nsCycleCollectionParticipant* aHelper) override;
NS_IMETHOD_(void) NoteJSChild(const JS::GCCellPtr& aThing) override; NS_IMETHOD_(void) NoteJSChild(JS::GCCellPtr aThing) override;
NS_IMETHOD_(void) NS_IMETHOD_(void)
DescribeRefCountedNode(nsrefcnt aRefcount, const char* aObjname) override {} DescribeRefCountedNode(nsrefcnt aRefcount, const char* aObjname) override {}
@ -2298,7 +2296,7 @@ ChildFinder::NoteNativeChild(void* aChild,
} }
NS_IMETHODIMP_(void) NS_IMETHODIMP_(void)
ChildFinder::NoteJSChild(const JS::GCCellPtr& aChild) { ChildFinder::NoteJSChild(JS::GCCellPtr aChild) {
if (aChild && JS::GCThingIsMarkedGray(aChild)) { if (aChild && JS::GCThingIsMarkedGray(aChild)) {
mMayHaveChild = true; mMayHaveChild = true;
} }