Bug 1452982 part 11 - Rename ActiveThread to MainThread. r=jonco

This commit is contained in:
Jan de Mooij 2018-04-17 10:47:33 +02:00
Родитель fd7a2a8cc5
Коммит 050bda2db5
11 изменённых файлов: 145 добавлений и 146 удалений

Просмотреть файл

@ -251,7 +251,7 @@ class ArenaLists
const BackgroundFinalizeState& backgroundFinalizeState(AllocKind i) const { return backgroundFinalizeState_.ref()[i]; }
/* For each arena kind, a list of arenas remaining to be swept. */
ActiveThreadOrGCTaskData<AllAllocKindArray<Arena*>> arenaListsToSweep_;
MainThreadOrGCTaskData<AllAllocKindArray<Arena*>> arenaListsToSweep_;
Arena*& arenaListsToSweep(AllocKind i) { return arenaListsToSweep_.ref()[i]; }
Arena* arenaListsToSweep(AllocKind i) const { return arenaListsToSweep_.ref()[i]; }

Просмотреть файл

@ -42,7 +42,7 @@ class GCHelperState
ConditionVariable done;
// Activity for the helper to do, protected by the GC lock.
ActiveThreadOrGCTaskData<State> state_;
MainThreadOrGCTaskData<State> state_;
// Whether work is being performed on some thread.
GCLockData<bool> hasThread;

Просмотреть файл

@ -174,13 +174,13 @@ class MarkStack
const TaggedPtr& peekPtr() const;
MOZ_MUST_USE bool pushTaggedPtr(Tag tag, Cell* ptr);
ActiveThreadData<TaggedPtr*> stack_;
ActiveThreadData<TaggedPtr*> tos_;
ActiveThreadData<TaggedPtr*> end_;
MainThreadData<TaggedPtr*> stack_;
MainThreadData<TaggedPtr*> tos_;
MainThreadData<TaggedPtr*> end_;
// The capacity we start with and reset() to.
ActiveThreadData<size_t> baseCapacity_;
ActiveThreadData<size_t> maxCapacity_;
MainThreadData<size_t> baseCapacity_;
MainThreadData<size_t> maxCapacity_;
#ifdef DEBUG
mutable size_t iteratorCount_;
@ -349,29 +349,29 @@ class GCMarker : public JSTracer
gc::MarkStack stack;
/* The color is only applied to objects and functions. */
ActiveThreadData<gc::MarkColor> color;
MainThreadData<gc::MarkColor> color;
/* Pointer to the top of the stack of arenas we are delaying marking on. */
ActiveThreadData<js::gc::Arena*> unmarkedArenaStackTop;
MainThreadData<js::gc::Arena*> unmarkedArenaStackTop;
/*
* If the weakKeys table OOMs, disable the linear algorithm and fall back
* to iterating until the next GC.
*/
ActiveThreadData<bool> linearWeakMarkingDisabled_;
MainThreadData<bool> linearWeakMarkingDisabled_;
#ifdef DEBUG
/* Count of arenas that are currently in the stack. */
ActiveThreadData<size_t> markLaterArenas;
MainThreadData<size_t> markLaterArenas;
/* Assert that start and stop are called with correct ordering. */
ActiveThreadData<bool> started;
MainThreadData<bool> started;
/*
* If this is true, all marked objects must belong to a compartment being
* GCed. This is used to look for compartment bugs.
*/
ActiveThreadData<bool> strictCompartmentChecking;
MainThreadData<bool> strictCompartmentChecking;
#endif // DEBUG
};

Просмотреть файл

@ -28,7 +28,7 @@ class GCParallelTask
UnprotectedData<TaskState> state;
// Amount of time this task took to execute.
ActiveThreadOrGCTaskData<mozilla::TimeDuration> duration_;
MainThreadOrGCTaskData<mozilla::TimeDuration> duration_;
explicit GCParallelTask(const GCParallelTask&) = delete;

Просмотреть файл

@ -134,13 +134,13 @@ class BackgroundDecommitTask : public GCParallelTask
void run() override;
private:
ActiveThreadOrGCTaskData<ChunkVector> toDecommit;
MainThreadOrGCTaskData<ChunkVector> toDecommit;
};
template<typename F>
struct Callback {
ActiveThreadOrGCTaskData<F> op;
ActiveThreadOrGCTaskData<void*> data;
MainThreadOrGCTaskData<F> op;
MainThreadOrGCTaskData<void*> data;
Callback()
: op(nullptr), data(nullptr)
@ -151,7 +151,7 @@ struct Callback {
};
template<typename F>
using CallbackVector = ActiveThreadData<Vector<Callback<F>, 4, SystemAllocPolicy>>;
using CallbackVector = MainThreadData<Vector<Callback<F>, 4, SystemAllocPolicy>>;
template <typename T, typename Iter0, typename Iter1>
class ChainedIter
@ -645,7 +645,7 @@ class GCRuntime
// All zones in the runtime, except the atoms zone.
private:
ActiveThreadOrGCTaskData<ZoneVector> zones_;
MainThreadOrGCTaskData<ZoneVector> zones_;
public:
ZoneVector& zones() { return zones_.ref(); }
@ -692,7 +692,7 @@ class GCRuntime
// so as to reduce the cost of operations on the available lists.
GCLockData<ChunkPool> fullChunks_;
ActiveThreadData<RootedValueMap> rootsHash;
MainThreadData<RootedValueMap> rootsHash;
// An incrementing id used to assign unique ids to cells that require one.
mozilla::Atomic<uint64_t, mozilla::ReleaseAcquire> nextCellUniqueId_;
@ -701,23 +701,23 @@ class GCRuntime
* Number of the committed arenas in all GC chunks including empty chunks.
*/
mozilla::Atomic<uint32_t, mozilla::ReleaseAcquire> numArenasFreeCommitted;
ActiveThreadData<VerifyPreTracer*> verifyPreData;
MainThreadData<VerifyPreTracer*> verifyPreData;
private:
UnprotectedData<bool> chunkAllocationSinceLastGC;
ActiveThreadData<int64_t> lastGCTime;
MainThreadData<int64_t> lastGCTime;
/*
* JSGC_MODE
* prefs: javascript.options.mem.gc_per_zone and
* javascript.options.mem.gc_incremental.
*/
ActiveThreadData<JSGCMode> mode;
MainThreadData<JSGCMode> mode;
mozilla::Atomic<size_t, mozilla::ReleaseAcquire> numActiveZoneIters;
/* During shutdown, the GC needs to clean up every possible object. */
ActiveThreadData<bool> cleanUpEverything;
MainThreadData<bool> cleanUpEverything;
// Gray marking must be done after all black marking is complete. However,
// we do not have write barriers on XPConnect roots. Therefore, XPConnect
@ -730,7 +730,7 @@ class GCRuntime
Okay,
Failed
};
ActiveThreadOrGCTaskData<GrayBufferState> grayBufferState;
MainThreadOrGCTaskData<GrayBufferState> grayBufferState;
bool hasValidGrayRootsBuffer() const { return grayBufferState == GrayBufferState::Okay; }
// Clear each zone's gray buffers, but do not change the current state.
@ -752,85 +752,85 @@ class GCRuntime
private:
/* Perform full GC if rt->keepAtoms() becomes false. */
ActiveThreadData<bool> fullGCForAtomsRequested_;
MainThreadData<bool> fullGCForAtomsRequested_;
/* Incremented at the start of every minor GC. */
ActiveThreadData<uint64_t> minorGCNumber;
MainThreadData<uint64_t> minorGCNumber;
/* Incremented at the start of every major GC. */
ActiveThreadData<uint64_t> majorGCNumber;
MainThreadData<uint64_t> majorGCNumber;
/* The major GC number at which to release observed type information. */
ActiveThreadData<uint64_t> jitReleaseNumber;
MainThreadData<uint64_t> jitReleaseNumber;
/* Incremented on every GC slice. */
ActiveThreadData<uint64_t> number;
MainThreadData<uint64_t> number;
/* Whether the currently running GC can finish in multiple slices. */
ActiveThreadData<bool> isIncremental;
MainThreadData<bool> isIncremental;
/* Whether all zones are being collected in first GC slice. */
ActiveThreadData<bool> isFull;
MainThreadData<bool> isFull;
/* Whether the heap will be compacted at the end of GC. */
ActiveThreadData<bool> isCompacting;
MainThreadData<bool> isCompacting;
/* The invocation kind of the current GC, taken from the first slice. */
ActiveThreadData<JSGCInvocationKind> invocationKind;
MainThreadData<JSGCInvocationKind> invocationKind;
/* The initial GC reason, taken from the first slice. */
ActiveThreadData<JS::gcreason::Reason> initialReason;
MainThreadData<JS::gcreason::Reason> initialReason;
/*
* The current incremental GC phase. This is also used internally in
* non-incremental GC.
*/
ActiveThreadOrGCTaskData<State> incrementalState;
MainThreadOrGCTaskData<State> incrementalState;
/* The incremental state at the start of this slice. */
ActiveThreadData<State> initialState;
MainThreadData<State> initialState;
#ifdef JS_GC_ZEAL
/* Whether to pay attention the zeal settings in this incremental slice. */
ActiveThreadData<bool> useZeal;
MainThreadData<bool> useZeal;
#endif
/* Indicates that the last incremental slice exhausted the mark stack. */
ActiveThreadData<bool> lastMarkSlice;
MainThreadData<bool> lastMarkSlice;
/* Whether it's currently safe to yield to the mutator in an incremental GC. */
ActiveThreadData<bool> safeToYield;
MainThreadData<bool> safeToYield;
/* Whether any sweeping will take place in the separate GC helper thread. */
ActiveThreadData<bool> sweepOnBackgroundThread;
MainThreadData<bool> sweepOnBackgroundThread;
/* Whether observed type information is being released in the current GC. */
ActiveThreadData<bool> releaseObservedTypes;
MainThreadData<bool> releaseObservedTypes;
/* Singly linked list of zones to be swept in the background. */
ActiveThreadOrGCTaskData<ZoneList> backgroundSweepZones;
MainThreadOrGCTaskData<ZoneList> backgroundSweepZones;
/*
* Free LIFO blocks are transferred to this allocator before being freed on
* the background GC thread after sweeping.
*/
ActiveThreadOrGCTaskData<LifoAlloc> blocksToFreeAfterSweeping;
MainThreadOrGCTaskData<LifoAlloc> blocksToFreeAfterSweeping;
private:
/* Index of current sweep group (for stats). */
ActiveThreadData<unsigned> sweepGroupIndex;
MainThreadData<unsigned> sweepGroupIndex;
/*
* Incremental sweep state.
*/
ActiveThreadData<JS::Zone*> sweepGroups;
ActiveThreadOrGCTaskData<JS::Zone*> currentSweepGroup;
ActiveThreadData<UniquePtr<SweepAction<GCRuntime*, FreeOp*, SliceBudget&>>> sweepActions;
ActiveThreadOrGCTaskData<JS::Zone*> sweepZone;
ActiveThreadData<mozilla::Maybe<AtomSet::Enum>> maybeAtomsToSweep;
ActiveThreadOrGCTaskData<JS::detail::WeakCacheBase*> sweepCache;
ActiveThreadData<bool> abortSweepAfterCurrentGroup;
MainThreadData<JS::Zone*> sweepGroups;
MainThreadOrGCTaskData<JS::Zone*> currentSweepGroup;
MainThreadData<UniquePtr<SweepAction<GCRuntime*, FreeOp*, SliceBudget&>>> sweepActions;
MainThreadOrGCTaskData<JS::Zone*> sweepZone;
MainThreadData<mozilla::Maybe<AtomSet::Enum>> maybeAtomsToSweep;
MainThreadOrGCTaskData<JS::detail::WeakCacheBase*> sweepCache;
MainThreadData<bool> abortSweepAfterCurrentGroup;
friend class SweepGroupsIter;
friend class WeakCacheSweepIterator;
@ -838,12 +838,12 @@ class GCRuntime
/*
* Incremental compacting state.
*/
ActiveThreadData<bool> startedCompacting;
ActiveThreadData<ZoneList> zonesToMaybeCompact;
ActiveThreadData<Arena*> relocatedArenasToRelease;
MainThreadData<bool> startedCompacting;
MainThreadData<ZoneList> zonesToMaybeCompact;
MainThreadData<Arena*> relocatedArenasToRelease;
#ifdef JS_GC_ZEAL
ActiveThreadData<MarkingValidator*> markingValidator;
MainThreadData<MarkingValidator*> markingValidator;
#endif
/*
@ -852,13 +852,13 @@ class GCRuntime
* JSGC_SLICE_TIME_BUDGET
* pref: javascript.options.mem.gc_incremental_slice_ms,
*/
ActiveThreadData<int64_t> defaultTimeBudget_;
MainThreadData<int64_t> defaultTimeBudget_;
/*
* We disable incremental GC if we encounter a Class with a trace hook
* that does not implement write barriers.
*/
ActiveThreadData<bool> incrementalAllowed;
MainThreadData<bool> incrementalAllowed;
/*
* Whether compacting GC can is enabled globally.
@ -866,9 +866,9 @@ class GCRuntime
* JSGC_COMPACTING_ENABLED
* pref: javascript.options.mem.gc_compacting
*/
ActiveThreadData<bool> compactingEnabled;
MainThreadData<bool> compactingEnabled;
ActiveThreadData<bool> rootsRemoved;
MainThreadData<bool> rootsRemoved;
/*
* These options control the zealousness of the GC. At every allocation,
@ -898,18 +898,18 @@ class GCRuntime
#ifdef JS_GC_ZEAL
static_assert(size_t(ZealMode::Count) <= 32,
"Too many zeal modes to store in a uint32_t");
ActiveThreadData<uint32_t> zealModeBits;
ActiveThreadData<int> zealFrequency;
ActiveThreadData<int> nextScheduled;
ActiveThreadData<bool> deterministicOnly;
ActiveThreadData<int> incrementalLimit;
MainThreadData<uint32_t> zealModeBits;
MainThreadData<int> zealFrequency;
MainThreadData<int> nextScheduled;
MainThreadData<bool> deterministicOnly;
MainThreadData<int> incrementalLimit;
ActiveThreadData<Vector<JSObject*, 0, SystemAllocPolicy>> selectedForMarking;
MainThreadData<Vector<JSObject*, 0, SystemAllocPolicy>> selectedForMarking;
#endif
ActiveThreadData<bool> fullCompartmentChecks;
MainThreadData<bool> fullCompartmentChecks;
ActiveThreadData<uint32_t> gcCallbackDepth;
MainThreadData<uint32_t> gcCallbackDepth;
Callback<JSGCCallback> gcCallback;
Callback<JS::DoCycleCollectionCallback> gcDoCycleCollectionCallback;
@ -930,10 +930,10 @@ class GCRuntime
Callback<JSTraceDataOp> grayRootTracer;
/* Always preserve JIT code during GCs, for testing. */
ActiveThreadData<bool> alwaysPreserveCode;
MainThreadData<bool> alwaysPreserveCode;
#ifdef DEBUG
ActiveThreadData<bool> arenasEmptyAtShutdown;
MainThreadData<bool> arenasEmptyAtShutdown;
#endif
/* Synchronize GC heap access among GC helper threads and active threads. */
@ -950,18 +950,18 @@ class GCRuntime
* During incremental sweeping, this field temporarily holds the arenas of
* the current AllocKind being swept in order of increasing free space.
*/
ActiveThreadData<SortedArenaList> incrementalSweepList;
MainThreadData<SortedArenaList> incrementalSweepList;
private:
ActiveThreadData<Nursery> nursery_;
ActiveThreadData<gc::StoreBuffer> storeBuffer_;
MainThreadData<Nursery> nursery_;
MainThreadData<gc::StoreBuffer> storeBuffer_;
public:
Nursery& nursery() { return nursery_.ref(); }
gc::StoreBuffer& storeBuffer() { return storeBuffer_.ref(); }
// Free LIFO blocks are transferred to this allocator before being freed
// after minor GC.
ActiveThreadData<LifoAlloc> blocksToFreeAfterMinorGC;
MainThreadData<LifoAlloc> blocksToFreeAfterMinorGC;
const void* addressOfNurseryPosition() {
return nursery_.refNoCheck().addressOfPosition();

Просмотреть файл

@ -342,7 +342,7 @@ class GCSchedulingTunables
*
* Maximum nursery size for each runtime.
*/
ActiveThreadData<size_t> gcMaxNurseryBytes_;
MainThreadData<size_t> gcMaxNurseryBytes_;
/*
* JSGC_ALLOCATION_THRESHOLD
@ -351,7 +351,7 @@ class GCSchedulingTunables
* usage.gcBytes() surpasses threshold.gcTriggerBytes() for a zone, the
* zone may be scheduled for a GC, depending on the exact circumstances.
*/
ActiveThreadOrGCTaskData<size_t> gcZoneAllocThresholdBase_;
MainThreadOrGCTaskData<size_t> gcZoneAllocThresholdBase_;
/*
* JSGC_ALLOCATION_THRESHOLD_FACTOR
@ -381,7 +381,7 @@ class GCSchedulingTunables
* Totally disables |highFrequencyGC|, the HeapGrowthFactor, and other
* tunables that make GC non-deterministic.
*/
ActiveThreadData<bool> dynamicHeapGrowthEnabled_;
MainThreadData<bool> dynamicHeapGrowthEnabled_;
/*
* JSGC_HIGH_FREQUENCY_TIME_LIMIT
@ -389,7 +389,7 @@ class GCSchedulingTunables
* We enter high-frequency mode if we GC a twice within this many
* microseconds. This value is stored directly in microseconds.
*/
ActiveThreadData<uint64_t> highFrequencyThresholdUsec_;
MainThreadData<uint64_t> highFrequencyThresholdUsec_;
/*
* JSGC_HIGH_FREQUENCY_LOW_LIMIT
@ -400,10 +400,10 @@ class GCSchedulingTunables
* When in the |highFrequencyGC| mode, these parameterize the per-zone
* "HeapGrowthFactor" computation.
*/
ActiveThreadData<uint64_t> highFrequencyLowLimitBytes_;
ActiveThreadData<uint64_t> highFrequencyHighLimitBytes_;
ActiveThreadData<double> highFrequencyHeapGrowthMax_;
ActiveThreadData<double> highFrequencyHeapGrowthMin_;
MainThreadData<uint64_t> highFrequencyLowLimitBytes_;
MainThreadData<uint64_t> highFrequencyHighLimitBytes_;
MainThreadData<double> highFrequencyHeapGrowthMax_;
MainThreadData<double> highFrequencyHeapGrowthMin_;
/*
* JSGC_LOW_FREQUENCY_HEAP_GROWTH
@ -411,14 +411,14 @@ class GCSchedulingTunables
* When not in |highFrequencyGC| mode, this is the global (stored per-zone)
* "HeapGrowthFactor".
*/
ActiveThreadData<double> lowFrequencyHeapGrowth_;
MainThreadData<double> lowFrequencyHeapGrowth_;
/*
* JSGC_DYNAMIC_MARK_SLICE
*
* Doubles the length of IGC slices when in the |highFrequencyGC| mode.
*/
ActiveThreadData<bool> dynamicMarkSliceEnabled_;
MainThreadData<bool> dynamicMarkSliceEnabled_;
/*
* JSGC_MIN_EMPTY_CHUNK_COUNT
@ -473,7 +473,7 @@ class GCSchedulingState
* growth factor is a measure of how large (as a percentage of the last GC)
* the heap is allowed to grow before we try to schedule another GC.
*/
ActiveThreadData<bool> inHighFrequencyGCMode_;
MainThreadData<bool> inHighFrequencyGCMode_;
public:
GCSchedulingState()
@ -500,7 +500,7 @@ class MemoryCounter
size_t maxBytes_;
// The counter value at the start of a GC.
ActiveThreadData<size_t> bytesAtStartOfGC_;
MainThreadData<size_t> bytesAtStartOfGC_;
// Which kind of GC has been triggered if any.
mozilla::Atomic<TriggerKind, mozilla::ReleaseAcquire> triggered_;

Просмотреть файл

@ -307,7 +307,7 @@ struct Zone : public JS::shadow::Zone,
private:
// The set of compartments in this zone.
js::ActiveThreadOrGCTaskData<CompartmentVector> compartments_;
js::MainThreadOrGCTaskData<CompartmentVector> compartments_;
public:
CompartmentVector& compartments() { return compartments_.ref(); }
@ -349,7 +349,7 @@ struct Zone : public JS::shadow::Zone,
//
// This is used during GC while calculating sweep groups to record edges
// that can't be determined by examining this zone by itself.
js::ActiveThreadData<ZoneSet> gcSweepGroupEdges_;
js::MainThreadData<ZoneSet> gcSweepGroupEdges_;
public:
ZoneSet& gcSweepGroupEdges() { return gcSweepGroupEdges_.ref(); }
@ -705,15 +705,15 @@ struct Zone : public JS::shadow::Zone,
private:
js::ZoneData<js::jit::JitZone*> jitZone_;
js::ActiveThreadData<bool> gcScheduled_;
js::ActiveThreadData<bool> gcScheduledSaved_;
js::MainThreadData<bool> gcScheduled_;
js::MainThreadData<bool> gcScheduledSaved_;
js::ZoneData<bool> gcPreserveCode_;
js::ZoneData<bool> keepShapeTables_;
// Allow zones to be linked into a list
friend class js::gc::ZoneList;
static Zone * const NotOnList;
js::ActiveThreadOrGCTaskData<Zone*> listNext_;
js::MainThreadOrGCTaskData<Zone*> listNext_;
bool isOnList() const;
Zone* nextZone() const;

Просмотреть файл

@ -62,9 +62,9 @@ class JitRuntime
friend class JitCompartment;
// Executable allocator for all code except wasm code.
ActiveThreadData<ExecutableAllocator> execAlloc_;
MainThreadData<ExecutableAllocator> execAlloc_;
ActiveThreadData<uint64_t> nextCompilationId_;
MainThreadData<uint64_t> nextCompilationId_;
// Shared exception-handler tail.
ExclusiveAccessLockWriteOnceData<uint32_t> exceptionTailOffset_;
@ -138,7 +138,7 @@ class JitRuntime
#ifdef DEBUG
// The number of possible bailing places encounters before forcefully bailing
// in that place. Zero means inactive.
ActiveThreadData<uint32_t> ionBailAfter_;
MainThreadData<uint32_t> ionBailAfter_;
#endif
// Number of Ion compilations which were finished off thread and are
@ -148,8 +148,8 @@ class JitRuntime
// List of Ion compilation waiting to get linked.
using IonBuilderList = mozilla::LinkedList<js::jit::IonBuilder>;
ActiveThreadData<IonBuilderList> ionLazyLinkList_;
ActiveThreadData<size_t> ionLazyLinkListSize_;
MainThreadData<IonBuilderList> ionLazyLinkList_;
MainThreadData<size_t> ionLazyLinkListSize_;
private:
void generateLazyLinkStub(MacroAssembler& masm);

Просмотреть файл

@ -50,7 +50,7 @@ CheckThreadLocal::check() const
template <AllowedHelperThread Helper>
void
CheckActiveThread<Helper>::check() const
CheckMainThread<Helper>::check() const
{
if (OnHelperThread<Helper>())
return;
@ -59,9 +59,9 @@ CheckActiveThread<Helper>::check() const
MOZ_ASSERT(CurrentThreadCanAccessRuntime(cx->runtime()));
}
template class CheckActiveThread<AllowedHelperThread::None>;
template class CheckActiveThread<AllowedHelperThread::GCTask>;
template class CheckActiveThread<AllowedHelperThread::IonCompile>;
template class CheckMainThread<AllowedHelperThread::None>;
template class CheckMainThread<AllowedHelperThread::GCTask>;
template class CheckMainThread<AllowedHelperThread::IonCompile>;
template <AllowedHelperThread Helper>
void

Просмотреть файл

@ -202,26 +202,25 @@ enum class AllowedHelperThread
};
template <AllowedHelperThread Helper>
class CheckActiveThread
class CheckMainThread
{
public:
void check() const;
};
// Data which may only be accessed by the runtime's cooperatively scheduled
// active thread.
// Data which may only be accessed by the runtime's main thread.
template <typename T>
using ActiveThreadData =
ProtectedDataNoCheckArgs<CheckActiveThread<AllowedHelperThread::None>, T>;
using MainThreadData =
ProtectedDataNoCheckArgs<CheckMainThread<AllowedHelperThread::None>, T>;
// Data which may only be accessed by the runtime's cooperatively scheduled
// active thread, or by various helper thread tasks.
// Data which may only be accessed by the runtime's main thread or by various
// helper thread tasks.
template <typename T>
using ActiveThreadOrGCTaskData =
ProtectedDataNoCheckArgs<CheckActiveThread<AllowedHelperThread::GCTask>, T>;
using MainThreadOrGCTaskData =
ProtectedDataNoCheckArgs<CheckMainThread<AllowedHelperThread::GCTask>, T>;
template <typename T>
using ActiveThreadOrIonCompileData =
ProtectedDataNoCheckArgs<CheckActiveThread<AllowedHelperThread::IonCompile>, T>;
using MainThreadOrIonCompileData =
ProtectedDataNoCheckArgs<CheckMainThread<AllowedHelperThread::IonCompile>, T>;
template <AllowedHelperThread Helper>
class CheckZone

Просмотреть файл

@ -301,10 +301,10 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
}
/* Call this to accumulate telemetry data. */
js::ActiveThreadData<JSAccumulateTelemetryDataCallback> telemetryCallback;
js::MainThreadData<JSAccumulateTelemetryDataCallback> telemetryCallback;
/* Call this to accumulate use counter data. */
js::ActiveThreadData<JSSetUseCounterCallback> useCounterCallback;
js::MainThreadData<JSSetUseCounterCallback> useCounterCallback;
public:
// Accumulates data for Firefox telemetry. |id| is the ID of a JS_TELEMETRY_*
@ -345,35 +345,35 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
* Allow relazifying functions in compartments that are active. This is
* only used by the relazifyFunctions() testing function.
*/
js::ActiveThreadData<bool> allowRelazificationForTesting;
js::MainThreadData<bool> allowRelazificationForTesting;
/* Compartment destroy callback. */
js::ActiveThreadData<JSDestroyCompartmentCallback> destroyCompartmentCallback;
js::MainThreadData<JSDestroyCompartmentCallback> destroyCompartmentCallback;
/* Compartment memory reporting callback. */
js::ActiveThreadData<JSSizeOfIncludingThisCompartmentCallback> sizeOfIncludingThisCompartmentCallback;
js::MainThreadData<JSSizeOfIncludingThisCompartmentCallback> sizeOfIncludingThisCompartmentCallback;
/* Call this to get the name of a compartment. */
js::ActiveThreadData<JSCompartmentNameCallback> compartmentNameCallback;
js::MainThreadData<JSCompartmentNameCallback> compartmentNameCallback;
/* Realm destroy callback. */
js::ActiveThreadData<JS::DestroyRealmCallback> destroyRealmCallback;
js::MainThreadData<JS::DestroyRealmCallback> destroyRealmCallback;
/* Call this to get the name of a realm. */
js::ActiveThreadData<JS::RealmNameCallback> realmNameCallback;
js::MainThreadData<JS::RealmNameCallback> realmNameCallback;
/* Callback for doing memory reporting on external strings. */
js::ActiveThreadData<JSExternalStringSizeofCallback> externalStringSizeofCallback;
js::MainThreadData<JSExternalStringSizeofCallback> externalStringSizeofCallback;
js::ActiveThreadData<mozilla::UniquePtr<js::SourceHook>> sourceHook;
js::MainThreadData<mozilla::UniquePtr<js::SourceHook>> sourceHook;
js::ActiveThreadData<const JSSecurityCallbacks*> securityCallbacks;
js::ActiveThreadData<const js::DOMCallbacks*> DOMcallbacks;
js::ActiveThreadData<JSDestroyPrincipalsOp> destroyPrincipals;
js::ActiveThreadData<JSReadPrincipalsOp> readPrincipals;
js::MainThreadData<const JSSecurityCallbacks*> securityCallbacks;
js::MainThreadData<const js::DOMCallbacks*> DOMcallbacks;
js::MainThreadData<JSDestroyPrincipalsOp> destroyPrincipals;
js::MainThreadData<JSReadPrincipalsOp> readPrincipals;
/* Optional warning reporter. */
js::ActiveThreadData<JS::WarningReporter> warningReporter;
js::MainThreadData<JS::WarningReporter> warningReporter;
private:
/* Gecko profiling metadata */
@ -382,7 +382,7 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
js::GeckoProfilerRuntime& geckoProfiler() { return geckoProfiler_.ref(); }
// Heap GC roots for PersistentRooted pointers.
js::ActiveThreadData<mozilla::EnumeratedArray<JS::RootKind, JS::RootKind::Limit,
js::MainThreadData<mozilla::EnumeratedArray<JS::RootKind, JS::RootKind::Limit,
mozilla::LinkedList<JS::PersistentRooted<void*>>>> heapRoots;
void tracePersistentRoots(JSTracer* trc);
@ -402,12 +402,12 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
void setTrustedPrincipals(const JSPrincipals* p) { trustedPrincipals_ = p; }
const JSPrincipals* trustedPrincipals() const { return trustedPrincipals_; }
js::ActiveThreadData<const JSWrapObjectCallbacks*> wrapObjectCallbacks;
js::ActiveThreadData<js::PreserveWrapperCallback> preserveWrapperCallback;
js::MainThreadData<const JSWrapObjectCallbacks*> wrapObjectCallbacks;
js::MainThreadData<js::PreserveWrapperCallback> preserveWrapperCallback;
js::ActiveThreadData<js::ScriptEnvironmentPreparer*> scriptEnvironmentPreparer;
js::MainThreadData<js::ScriptEnvironmentPreparer*> scriptEnvironmentPreparer;
js::ActiveThreadData<js::CTypesActivityCallback> ctypesActivityCallback;
js::MainThreadData<js::CTypesActivityCallback> ctypesActivityCallback;
private:
js::WriteOnceData<const js::Class*> windowProxyClass_;
@ -422,7 +422,7 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
private:
// List of non-ephemeron weak containers to sweep during beginSweepingSweepGroup.
js::ActiveThreadData<mozilla::LinkedList<JS::detail::WeakCacheBase>> weakCaches_;
js::MainThreadData<mozilla::LinkedList<JS::detail::WeakCacheBase>> weakCaches_;
public:
mozilla::LinkedList<JS::detail::WeakCacheBase>& weakCaches() { return weakCaches_.ref(); }
void registerWeakCache(JS::detail::WeakCacheBase* cachep) {
@ -444,14 +444,14 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
* List of all enabled Debuggers that have onNewGlobalObject handler
* methods established.
*/
js::ActiveThreadData<WatchersList> onNewGlobalObjectWatchers_;
js::MainThreadData<WatchersList> onNewGlobalObjectWatchers_;
public:
WatchersList& onNewGlobalObjectWatchers() { return onNewGlobalObjectWatchers_.ref(); }
private:
/* Linked list of all Debugger objects in the runtime. */
js::ActiveThreadData<mozilla::LinkedList<js::Debugger>> debuggerList_;
js::MainThreadData<mozilla::LinkedList<js::Debugger>> debuggerList_;
public:
mozilla::LinkedList<js::Debugger>& debuggerList() { return debuggerList_.ref(); }
@ -516,19 +516,19 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
// How many compartments there are across all zones. This number includes
// off thread context compartments, so it isn't necessarily equal to the
// number of compartments visited by CompartmentsIter.
js::ActiveThreadData<size_t> numCompartments;
js::MainThreadData<size_t> numCompartments;
/* Locale-specific callbacks for string conversion. */
js::ActiveThreadData<const JSLocaleCallbacks*> localeCallbacks;
js::MainThreadData<const JSLocaleCallbacks*> localeCallbacks;
/* Default locale for Internationalization API */
js::ActiveThreadData<char*> defaultLocale;
js::MainThreadData<char*> defaultLocale;
/* If true, new scripts must be created with PC counter information. */
js::ActiveThreadOrIonCompileData<bool> profilingScripts;
js::MainThreadOrIonCompileData<bool> profilingScripts;
/* Strong references on scripts held for PCCount profiling API. */
js::ActiveThreadData<JS::PersistentRooted<js::ScriptAndCountsVector>*> scriptAndCountsVector;
js::MainThreadData<JS::PersistentRooted<js::ScriptAndCountsVector>*> scriptAndCountsVector;
private:
/* Code coverage output. */
@ -789,7 +789,7 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
js::WriteOnceData<js::WellKnownSymbols*> wellKnownSymbols;
/* Shared Intl data for this runtime. */
js::ActiveThreadData<js::intl::SharedIntlData> sharedIntlData;
js::MainThreadData<js::intl::SharedIntlData> sharedIntlData;
void traceSharedIntlData(JSTracer* trc);
@ -862,7 +862,7 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
mozilla::Atomic<bool> offthreadIonCompilationEnabled_;
mozilla::Atomic<bool> parallelParsingEnabled_;
js::ActiveThreadData<bool> autoWritableJitCodeActive_;
js::MainThreadData<bool> autoWritableJitCodeActive_;
public:
@ -887,20 +887,20 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
}
/* See comment for JS::SetOutOfMemoryCallback in jsapi.h. */
js::ActiveThreadData<JS::OutOfMemoryCallback> oomCallback;
js::ActiveThreadData<void*> oomCallbackData;
js::MainThreadData<JS::OutOfMemoryCallback> oomCallback;
js::MainThreadData<void*> oomCallbackData;
/*
* Debugger.Memory functions like takeCensus use this embedding-provided
* function to assess the size of malloc'd blocks of memory.
*/
js::ActiveThreadData<mozilla::MallocSizeOf> debuggerMallocSizeOf;
js::MainThreadData<mozilla::MallocSizeOf> debuggerMallocSizeOf;
/* Last time at which an animation was played for this runtime. */
mozilla::Atomic<int64_t> lastAnimationTime;
private:
js::ActiveThreadData<js::PerformanceMonitoring> performanceMonitoring_;
js::MainThreadData<js::PerformanceMonitoring> performanceMonitoring_;
public:
js::PerformanceMonitoring& performanceMonitoring() { return performanceMonitoring_.ref(); }
@ -930,7 +930,7 @@ struct JSRuntime : public js::MallocProvider<JSRuntime>
friend class JS::AutoEnterCycleCollection;
private:
js::ActiveThreadData<js::RuntimeCaches> caches_;
js::MainThreadData<js::RuntimeCaches> caches_;
public:
js::RuntimeCaches& caches() { return caches_.ref(); }