mirror of
https://repo.dactyloidae.xyz/Dactyloidae/UXP.git
synced 2026-09-24 01:17:34 +09:00
Allow incremental GC when keepAtoms is set
This is a port of BZ 1213977 that should improve performance when parsing large web-sites by reducing the amount of non-incremental (large) GCing.
This commit is contained in:
parent
029ac1042b
commit
37f37bd489
2 changed files with 20 additions and 8 deletions
|
|
@ -3642,14 +3642,22 @@ GCRuntime::beginMarkPhase(JS::gcreason::Reason reason, AutoLockForExclusiveAcces
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Atoms are not in the cross-compartment map. So if there are any
|
* Atoms are not in the cross-compartment map. If there are any zones that
|
||||||
* zones that are not being collected, we are not allowed to collect
|
* are not being collected then we cannot collect the atoms zone, otherwise
|
||||||
* atoms. Otherwise, the non-collected zones could contain pointers
|
* the non-collected zones could contain pointers to atoms that we would
|
||||||
* to atoms that we would miss.
|
* miss.
|
||||||
*
|
*
|
||||||
* keepAtoms() will only change on the main thread, which we are currently
|
* If keepAtoms() is true then either an instance of AutoKeepAtoms is
|
||||||
* on. If the value of keepAtoms() changes between GC slices, then we'll
|
* currently on the stack or parsing is currently happening on another
|
||||||
* cancel the incremental GC. See IsIncrementalGCSafe.
|
* thread. In either case we don't have information about which atoms are
|
||||||
|
* roots, so we must skip collecting atoms.
|
||||||
|
*
|
||||||
|
* Note that only affects the first slice of an incremental GC since root
|
||||||
|
* marking is completed before we return to the mutator.
|
||||||
|
*
|
||||||
|
* Off-main-thread parsing is inhibited after the start of GC which prevents
|
||||||
|
* races between creating atoms during parsing and sweeping atoms on the
|
||||||
|
* main thread.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (isFull && !rt->keepAtoms()) {
|
if (isFull && !rt->keepAtoms()) {
|
||||||
|
|
@ -5732,6 +5740,10 @@ GCRuntime::gcCycle(bool nonincrementalByAPI, SliceBudget& budget, JS::gcreason::
|
||||||
|
|
||||||
State prevState = incrementalState;
|
State prevState = incrementalState;
|
||||||
|
|
||||||
|
// We don't allow off-main-thread parsing to start while we're doing an
|
||||||
|
// incremental GC.
|
||||||
|
MOZ_ASSERT_IF(rt->activeGCInAtomsZone(), !rt->exclusiveThreadsPresent());
|
||||||
|
|
||||||
if (nonincrementalByAPI) {
|
if (nonincrementalByAPI) {
|
||||||
// Reset any in progress incremental GC if this was triggered via the
|
// Reset any in progress incremental GC if this was triggered via the
|
||||||
// API. This isn't required for correctness, but sometimes during tests
|
// API. This isn't required for correctness, but sometimes during tests
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@ enum class State {
|
||||||
D(None) \
|
D(None) \
|
||||||
D(NonIncrementalRequested) \
|
D(NonIncrementalRequested) \
|
||||||
D(AbortRequested) \
|
D(AbortRequested) \
|
||||||
D(KeepAtomsSet) \
|
D(Unused1) \
|
||||||
D(IncrementalDisabled) \
|
D(IncrementalDisabled) \
|
||||||
D(ModeChange) \
|
D(ModeChange) \
|
||||||
D(MallocBytesTrigger) \
|
D(MallocBytesTrigger) \
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue