This adds an optional second argument to DropJSObjects to allow skipping
clearing of JS references in cases where that has already happened. In debug
builds it asserts that such references have already been cleared.
This is then used in CallbackObject::Reset.
Differential Revision: https://phabricator.services.mozilla.com/D215493
This adds js::gc::InCollectedNurseryRegion which is fully inlinable and makes
JSObjectsTenured call the finalizers directly.
I don't think this makes a massive difference but it's still probably worth
doing.
Differential Revision: https://phabricator.services.mozilla.com/D212290
Inline Create() and Realloc() so that we don't get negative leaks, since
were that code end up in mozglue, it wouldn't have access to the logging
machinery.
Differential Revision: https://phabricator.services.mozilla.com/D209663
This filters CycleCollectedRuntime::mNurseryObjects so that only objects that
have died are finalized, and objects promoted to the second nursery generation
remain. Also a post barrier is added when updating a wrapper cache object.
I'll ask Andrew for review on this too when it gets closer to landing.
Differential Revision: https://phabricator.services.mozilla.com/D196451
This changes comes with several different refactorings all rolled into one,
unfotunately I couldn't find a way to pull them apart:
- First of all annotations now can either recorded (that is, we copy the value
and have the crash reporting code own the copy) or registered. Several
annotations are changed to use this functionality so that we don't need to
update them as their value change.
- The code in the exception handler is modified to read the annotations from
the mozannotation_client crate. This has the unfortunate side-effect that
we need three different bits of code to serialize them: one for annotations
read from a child process, one for reading annotations from the main process
outside of the exception handler and one for reading annotations from the
main process within the exception handler. As we move to fully
out-of-process crash reporting the last two methods will go away.
- The mozannotation_client crate now doesn't record annotation types anymore.
I realized as I was working on this that storing types at runtime has two
issues: the first one is that buggy code might change the type of an
annotation (that is record it under two different types at two different
moments), the second issue is that types might become corrupt during a
crash, so better enforce them at annotation-writing time. The end result is
that the mozannotation_* crates now only store byte buffers, track the
format the data is stored in (null-terminated string, fixed size buffer,
etc...) but not the type of data each annotation is supposed to contain.
- Which brings us to the next change: concrete types for annotations are now
enforced when they're written out. If an annotation doesn't match the
expected type it's skipped. Storing an annotation with the wrong type will
also trigger an assertion in debug builds.
Differential Revision: https://phabricator.services.mozilla.com/D195248
The patch forces a budget check when we start marking or sweeping unless we
have just started a GC slice in the current state.
This turned out more complicated than expected because the change caused a test
that called gcslice(1) in a loop to not make any progress. This was because the
original stepAndForceCheck() method ate the single unit of work budget. The fix
was to remove the step part of this method. I don't think any of the callers
need it to step the budget as well.
Differential Revision: https://phabricator.services.mozilla.com/D193925
I'm guessing that it got moved into the wrong file for the Quantum DOM
split into CCJSContext and CCJSRuntime. The only use is in the latter
so it makes sense to have it there.
Differential Revision: https://phabricator.services.mozilla.com/D192638
For accessors with FunctionFlags::LAZY_ACCESSOR_NAME, JSFunction::AtomSlot
contains unprefixed name.
This patch also split existing methods and APIs for function name into 3:
1. infallible, and can return unprefixed name
2. fallible, and returns correct name
3. (internal only) infallibe, and returns correct name (only for functions known to not have FunctionFlags::LAZY_ACCESSOR_NAME)
If the result doesn't have to be exactly correct name, for example if it's for
debug logging or profiler marker, the 1st infallible functions are used.
Differential Revision: https://phabricator.services.mozilla.com/D191457
This patch removes the old docshell timeline and timeline markers codebase and replaces them with equivalent Gecko profiler marker. This patch also fixes Bug 1834143, which is a subset of 1421651.
Differential Revision: https://phabricator.services.mozilla.com/D184217
This patch removes the old docshell timeline and timeline markers codebase and replaces them with equivalent Gecko profiler marker. This patch also fixes Bug 1834143, which is a subset of 1421651.
Differential Revision: https://phabricator.services.mozilla.com/D184217
This adds the data parameter to the remove API and only removes when both
callback and data argument match, allowing the same callback to be registered
more than once with different data pointers. This also asserts that the
callback is found when removal is requestd.
Differential Revision: https://phabricator.services.mozilla.com/D185306
This extends the nursery collection callback mechanism in line with the other
GC callbacks. It also moves the location the callback is stored to GCRuntime
like the other callbacks, rather than Statistics.
Differential Revision: https://phabricator.services.mozilla.com/D184000
Ideally, we don't want to continue running a child process if it fails to
handle a message from the parent, since that could mean child and parent state
could get out of sync. But since this assertion is only a diagnostic assert,
it isn't guaranteeing that in release builds anyway. And since the vast
majority of the crashes we are seeing in builds with diagnostic asserts
enabled appear to be OOMs, we can't really use crash reports to diagnose other
issues.
Ideally (again), we'd determine if the failure was caused by an OOM based on
the failure code returned by the structured clone decode call. Unfortunately,
though, since the spec requires that we return a generic `DataCloneError` on
failure, the structured clone code intentionally hides the specifics of
failure from callers. Propagating out more specific failure reasons for use by
privileged callers is nontrivial. So this patch essentially does the same
thing as crash reports do, and checks whether an OOM was reported recently,
and hasn't been recovered from by a successful GC.
Differential Revision: https://phabricator.services.mozilla.com/D176288
One point of difference between the DoMarking fast path and other tracers is
handling the edge name. Passing this through to the concrete tracer and
handling it there removes this differemce.
Eventually we should be able to inline some of these these calls at which point
it should get optimsed away for tracers that ignore it.
Depends on D156559
Differential Revision: https://phabricator.services.mozilla.com/D156560
One point of difference between the DoMarking fast path and other tracers is
handling the edge name. Passing this through to the concrete tracer and
handling it there removes this differemce.
Eventually we should be able to inline some of these these calls at which point
it should get optimsed away for tracers that ignore it.
Depends on D156559
Differential Revision: https://phabricator.services.mozilla.com/D156560
The current implementation of TimelineConsumers contains some unnecessary
complexity due to how it is initialized as a singleton, and the need for it to
be initialized and used in a threadsafe way. This patch attempts to simplify it
by making all members static, and removing the need to explicitly observe
shutdown for cleanup.
In addition, this approach avoids the risk of the type being accessed from
off-main-thread during initialization or shutdown.
Depends on D150442
Differential Revision: https://phabricator.services.mozilla.com/D150443
Previously this was optimized to trace only gray roots in collecting zones, but
there was a bug in that it also skipped clearing roots because this happens
before the start of GC when zones are selected for collection.
Instead, make sure we only perform this optimziation when marking.
Differential Revision: https://phabricator.services.mozilla.com/D146585
HeapObjectPostWriteBarrier adds or removes a store buffer entry for a change in
the GC graph entry based on the second and third arguments which are the target
of the edge before and after the change.
This patch also removes the store buffer entry in
nsWrapperCache::ReleaseWrapper which didn't happen before. This should help
keep less garbage alive unnecessarily.
Differential Revision: https://phabricator.services.mozilla.com/D143736
This splits the API into two, one that does a bunch of checks and calls into
the JS engine, and one for use by the CC where all preconditions are assumed to
be satisfied and can be inlined entirely.
Depends on D140865
Differential Revision: https://phabricator.services.mozilla.com/D140866
`profiler_thread_is_being_profiled` is used a lot for markers, so it makes sense to have a specialized version, which is a bit shorter, and lives in ProfilerMarkers.h.
Differential Revision: https://phabricator.services.mozilla.com/D130009
`profiler_thread_is_being_profiled` is used a lot for markers, so it makes sense to have a specialized version, which is a bit shorter, and lives in ProfilerMarkers.h.
Differential Revision: https://phabricator.services.mozilla.com/D130009