This reverts commit ed098a6dfc.
Revert "Bug 2043789: Use MakeRefPtr to do allocation for various RefPtr variables in xpcom/{io,ioutils}/. r=xpcom-reviewers,emilio"
This reverts commit aa8e617fd8.
Revert "Bug 2043788: Use MakeRefPtr to do allocation for various RefPtr variables in xpcom/{base,ds}/. r=xpcom-reviewers,emilio"
This reverts commit 4f52fb1147.
This fixes the problem by clearing the targets of WeakRefs when those tagets
are found to be part of a gray cycle by the cycle collector. This is the same
thing that happens for nsWeakReferences which should be cleared when their
targets are unlinked.
This patch looks up all WeakRef targets in the cycle collector table to check
whether they are white. If so their corresponding WeakRefs are cleared. This
requires a hash table lookup for every weak ref.
Differential Revision: https://phabricator.services.mozilla.com/D293099
nsICycleCollectorHandler now exposes noteWeakMapEntry, allowing JS
consumers to receive weak map entries from the CC graph. This enables
ShutdownLeakPathFinder and CCAnalyzer to find retention paths that
pass through weak maps.
Differential Revision: https://phabricator.services.mozilla.com/D285345
Commit automatically generated through clang-tidy's
performance-use-std-move new pass.
- nsCOMPtr benefits from being moved
Differential Revision: https://phabricator.services.mozilla.com/D285675
Commit automatically generated through clang-tidy's
performance-use-std-move new pass.
- nsCOMPtr benefits from being moved
Differential Revision: https://phabricator.services.mozilla.com/D285675
This reserve call improves performance, but it is still possible that we can
complete a CC with a smaller graph, so we shouldn't give up immediately.
This matches the existing behavior when we fail to add things to mPtrInfoMap.
Differential Revision: https://phabricator.services.mozilla.com/D285078
The approved patch in bug 1477627 was not the one that landed. The landed
code fails to maintain the min-size of an internal GC pointer map (16K)
and, after the first GC, reduces it to the min (4... as in 4, not 4K). This
causes the GC to constantly do rehashes, which constitute over 20% of time
taken by GC in a profile with a very long (10 second) GC.
The patch in bug 1477627 also used HashSet::initialized in CCGraph::IsEmpty,
but that seems wrong and no longer exists anyway.
Differential Revision: https://phabricator.services.mozilla.com/D275109
We depend on GC marking to propagate gray umarking through zones that are being
marked incrementally. Aborting this raises the possibility of creating black to
gray edges as previously happened with this testcase.
Marking the gray bits as invalid will cause the CC to perform another GC to
redo the marking. Aborting GC is pretty rare in practice so I don't expect this
to have a performance impact.
Differential Revision: https://phabricator.services.mozilla.com/D270546
We depend on GC marking to propagate gray umarking through zones that are being
marked incrementally. Aborting this raises the possibility of creating black to
gray edges as previously happened with this testcase.
Marking the gray bits as invalid will cause the CC to perform another GC to
redo the marking. Aborting GC is pretty rare in practice so I don't expect this
to have a performance impact.
Differential Revision: https://phabricator.services.mozilla.com/D270546
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
It is replaced by a standard-conforming cast to (void) which is
understood the same by the compiler.
In some cases this could be replaced by `[[maybe_unused]]` but for
expression whose value is ignored, this requires storing to a temporary
variable first, so not going that way.
One notable change is that marking an object of type already_AddRefed as
unused used to implicitly leak memory. This is now made explicit.
Most of the heavy lifting was done through:
$ git grep -l '\<Unused\> <<' | xargs sed -i -e 's/Unused << /(void)/g'
$ git grep -l mozilla/Unused.h | xargs sed -i -e '/mozilla\/Unused.h/ d'
Differential Revision: https://phabricator.services.mozilla.com/D268706
Currently this can fix up the gray bits before doing a GC (which will calculate
them from scratch), as well as fix them up after a GC (which will do nothing).
Differential Revision: https://phabricator.services.mozilla.com/D268433
The main objective of this patch is to allow us to interact with DOM wrapper
preservation directly from the JIT, which it does by creating a deferred wrapper
preservation buffer which is consumed before any GC. The patch after this
handles writing to this buffer from the JIT where necessary.
Differential Revision: https://phabricator.services.mozilla.com/D255386
The main objective of this patch is to allow us to interact with DOM wrapper
preservation directly from the JIT, which it does by creating a deferred wrapper
preservation buffer which is consumed before any GC. The patch after this
handles writing to this buffer from the JIT where necessary.
Differential Revision: https://phabricator.services.mozilla.com/D255386
The goal of this is to make GetCurrentInnerOrOuterWindowCount()
more accurate. I was seeing regular cases where there was
a live window at the start of the CC but then it would
be freed by the shutdown GC before we actually start
traversing. This means that you need to disable GC logging
with MOZ_CC_DISABLE_GC_LOG=1 for this to fully work.
Differential Revision: https://phabricator.services.mozilla.com/D232740
This adds the MOZ_CC_LOG_WINDOW_ONLY option. This makes it so that
we never get a CC log on the main thread unless there is a window
that is alive. This will result in less irrelevant logs when you
are investigating a DOM window leak.
I also moved the comments on the non-logging CC options first.
Differential Revision: https://phabricator.services.mozilla.com/D232739
Unclear why the move operation fails at all (bug 1939902), but this will at least show the filename that actually has contents.
Differential Revision: https://phabricator.services.mozilla.com/D233188
The CCIntervalMarker marker accepts a CycleCollectorResults struct as one of it's parameters and emits each field individually during StreamJSONMarkerData. This is difficult to translate to a perfetto track event, so instead pass each field directly to profiler_add_marker so that the parameters line up with the PayloadFields descriptions.
Differential Revision: https://phabricator.services.mozilla.com/D217411