From 4e00e15636b2029d05181c3617e446f533c50866 Mon Sep 17 00:00:00 2001 From: Phil Ringnalda Date: Mon, 6 Feb 2017 20:29:57 -0800 Subject: [PATCH] Backed out changeset 4b8c006aff8d (bug 1334837) for Mac debug crashes [@ js::CurrentThreadIsIonCompiling()] CLOSED TREE --- js/src/gc/GCRuntime.h | 142 ++++++++++++++--------------- js/src/gc/Marking.h | 22 ++--- js/src/gc/Zone.h | 6 +- js/src/gc/ZoneGroup.cpp | 2 +- js/src/gc/ZoneGroup.h | 6 +- js/src/jit/JitCompartment.h | 6 +- js/src/jsgc.h | 6 +- js/src/threading/ProtectedData.cpp | 21 ----- js/src/threading/ProtectedData.h | 30 ++---- js/src/vm/HelperThreads.cpp | 2 +- js/src/vm/Runtime.cpp | 3 - js/src/vm/Runtime.h | 85 ++++++++--------- 12 files changed, 143 insertions(+), 188 deletions(-) diff --git a/js/src/gc/GCRuntime.h b/js/src/gc/GCRuntime.h index 6a40fcd8b0ca2..798d98047e89e 100644 --- a/js/src/gc/GCRuntime.h +++ b/js/src/gc/GCRuntime.h @@ -102,7 +102,7 @@ class BackgroundDecommitTask : public GCParallelTask void run() override; private: - ActiveThreadOrGCTaskData toDecommit; + UnprotectedData toDecommit; }; /* @@ -120,14 +120,14 @@ class GCSchedulingTunables UnprotectedData gcMaxBytes_; /* Maximum nursery size for each zone group. */ - ActiveThreadData gcMaxNurseryBytes_; + UnprotectedData gcMaxNurseryBytes_; /* * The base value used to compute zone->trigger.gcBytes(). When * usage.gcBytes() surpasses threshold.gcBytes() for a zone, the zone may * be scheduled for a GC, depending on the exact circumstances. */ - ActiveThreadOrGCTaskData gcZoneAllocThresholdBase_; + UnprotectedData gcZoneAllocThresholdBase_; /* Fraction of threshold.gcBytes() which triggers an incremental GC. */ UnprotectedData zoneAllocThresholdFactor_; @@ -142,38 +142,38 @@ class GCSchedulingTunables * Totally disables |highFrequencyGC|, the HeapGrowthFactor, and other * tunables that make GC non-deterministic. */ - ActiveThreadData dynamicHeapGrowthEnabled_; + UnprotectedData dynamicHeapGrowthEnabled_; /* * We enter high-frequency mode if we GC a twice within this many * microseconds. This value is stored directly in microseconds. */ - ActiveThreadData highFrequencyThresholdUsec_; + UnprotectedData highFrequencyThresholdUsec_; /* * When in the |highFrequencyGC| mode, these parameterize the per-zone * "HeapGrowthFactor" computation. */ - ActiveThreadData highFrequencyLowLimitBytes_; - ActiveThreadData highFrequencyHighLimitBytes_; - ActiveThreadData highFrequencyHeapGrowthMax_; - ActiveThreadData highFrequencyHeapGrowthMin_; + UnprotectedData highFrequencyLowLimitBytes_; + UnprotectedData highFrequencyHighLimitBytes_; + UnprotectedData highFrequencyHeapGrowthMax_; + UnprotectedData highFrequencyHeapGrowthMin_; /* * When not in |highFrequencyGC| mode, this is the global (stored per-zone) * "HeapGrowthFactor". */ - ActiveThreadData lowFrequencyHeapGrowth_; + UnprotectedData lowFrequencyHeapGrowth_; /* * Doubles the length of IGC slices when in the |highFrequencyGC| mode. */ - ActiveThreadData dynamicMarkSliceEnabled_; + UnprotectedData dynamicMarkSliceEnabled_; /* * Controls whether painting can trigger IGC slices. */ - ActiveThreadData refreshFrameSlicesEnabled_; + UnprotectedData refreshFrameSlicesEnabled_; /* * Controls the number of empty chunks reserved for future allocation. @@ -526,7 +526,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 inHighFrequencyGCMode_; + UnprotectedData inHighFrequencyGCMode_; public: GCSchedulingState() @@ -545,8 +545,8 @@ class GCSchedulingState template struct Callback { - ActiveThreadData op; - ActiveThreadData data; + UnprotectedData op; + UnprotectedData data; Callback() : op(nullptr), data(nullptr) @@ -557,7 +557,7 @@ struct Callback { }; template -using CallbackVector = ActiveThreadData, 4, SystemAllocPolicy>>; +using CallbackVector = UnprotectedData, 4, SystemAllocPolicy>>; template class ChainedIter @@ -979,7 +979,7 @@ class GCRuntime UnprotectedData systemZone; // List of all zone groups (protected by the GC lock). - ActiveThreadData groups; + UnprotectedData groups; // The unique atoms zone, which has no zone group. WriteOnceData atomsZone; @@ -1023,9 +1023,9 @@ class GCRuntime // so as to reduce the cost of operations on the available lists. UnprotectedData fullChunks_; - ActiveThreadData rootsHash; + UnprotectedData rootsHash; - ActiveThreadData maxMallocBytes; + UnprotectedData maxMallocBytes; // An incrementing id used to assign unique ids to cells that require one. mozilla::Atomic nextCellUniqueId_; @@ -1034,18 +1034,18 @@ class GCRuntime * Number of the committed arenas in all GC chunks including empty chunks. */ mozilla::Atomic numArenasFreeCommitted; - ActiveThreadData verifyPreData; + UnprotectedData verifyPreData; private: UnprotectedData chunkAllocationSinceLastGC; - ActiveThreadData lastGCTime; + UnprotectedData lastGCTime; - ActiveThreadData mode; + UnprotectedData mode; mozilla::Atomic numActiveZoneIters; /* During shutdown, the GC needs to clean up every possible object. */ - ActiveThreadData cleanUpEverything; + UnprotectedData cleanUpEverything; // Gray marking must be done after all black marking is complete. However, // we do not have write barriers on XPConnect roots. Therefore, XPConnect @@ -1058,7 +1058,7 @@ class GCRuntime Okay, Failed }; - ActiveThreadData grayBufferState; + UnprotectedData grayBufferState; bool hasBufferedGrayRoots() const { return grayBufferState == GrayBufferState::Okay; } // Clear each zone's gray buffers, but do not change the current state. @@ -1079,83 +1079,83 @@ class GCRuntime mozilla::Atomic majorGCTriggerReason; public: - ActiveThreadData minorGCTriggerReason; + UnprotectedData minorGCTriggerReason; private: /* Perform full GC if rt->keepAtoms() becomes false. */ - ActiveThreadData fullGCForAtomsRequested_; + UnprotectedData fullGCForAtomsRequested_; /* Incremented at the start of every minor GC. */ - ActiveThreadData minorGCNumber; + UnprotectedData minorGCNumber; /* Incremented at the start of every major GC. */ - ActiveThreadData majorGCNumber; + UnprotectedData majorGCNumber; /* The major GC number at which to release observed type information. */ - ActiveThreadData jitReleaseNumber; + UnprotectedData jitReleaseNumber; /* Incremented on every GC slice. */ - ActiveThreadData number; + UnprotectedData number; /* The number at the time of the most recent GC's first slice. */ - ActiveThreadData startNumber; + UnprotectedData startNumber; /* Whether the currently running GC can finish in multiple slices. */ - ActiveThreadData isIncremental; + UnprotectedData isIncremental; /* Whether all zones are being collected in first GC slice. */ - ActiveThreadData isFull; + UnprotectedData isFull; /* Whether the heap will be compacted at the end of GC. */ - ActiveThreadData isCompacting; + UnprotectedData isCompacting; /* The invocation kind of the current GC, taken from the first slice. */ - ActiveThreadData invocationKind; + UnprotectedData invocationKind; /* The initial GC reason, taken from the first slice. */ - ActiveThreadData initialReason; + UnprotectedData initialReason; /* * The current incremental GC phase. This is also used internally in * non-incremental GC. */ - ActiveThreadOrGCTaskData incrementalState; + UnprotectedData incrementalState; /* Indicates that the last incremental slice exhausted the mark stack. */ - ActiveThreadData lastMarkSlice; + UnprotectedData lastMarkSlice; /* Whether any sweeping will take place in the separate GC helper thread. */ - ActiveThreadData sweepOnBackgroundThread; + UnprotectedData sweepOnBackgroundThread; /* Whether observed type information is being released in the current GC. */ - ActiveThreadData releaseObservedTypes; + UnprotectedData releaseObservedTypes; /* Whether any black->gray edges were found during marking. */ - ActiveThreadData foundBlackGrayEdges; + UnprotectedData foundBlackGrayEdges; /* Singly linked list of zones to be swept in the background. */ - ActiveThreadOrGCTaskData backgroundSweepZones; + UnprotectedData backgroundSweepZones; /* * Free LIFO blocks are transferred to this allocator before being freed on * the background GC thread after sweeping. */ - ActiveThreadOrGCTaskData blocksToFreeAfterSweeping; + UnprotectedData blocksToFreeAfterSweeping; private: /* Index of current zone group (for stats). */ - ActiveThreadData zoneGroupIndex; + UnprotectedData zoneGroupIndex; /* * Incremental sweep state. */ - ActiveThreadData zoneGroups; - ActiveThreadOrGCTaskData currentZoneGroup; - ActiveThreadData sweepingTypes; - ActiveThreadData finalizePhase; - ActiveThreadData sweepZone; - ActiveThreadData sweepKind; - ActiveThreadData abortSweepAfterCurrentGroup; + UnprotectedData zoneGroups; + UnprotectedData currentZoneGroup; + UnprotectedData sweepingTypes; + UnprotectedData finalizePhase; + UnprotectedData sweepZone; + UnprotectedData sweepKind; + UnprotectedData abortSweepAfterCurrentGroup; /* * Concurrent sweep infrastructure. @@ -1166,17 +1166,17 @@ class GCRuntime /* * List head of arenas allocated during the sweep phase. */ - ActiveThreadData arenasAllocatedDuringSweep; + UnprotectedData arenasAllocatedDuringSweep; /* * Incremental compacting state. */ - ActiveThreadData startedCompacting; - ActiveThreadData zonesToMaybeCompact; - ActiveThreadData relocatedArenasToRelease; + UnprotectedData startedCompacting; + UnprotectedData zonesToMaybeCompact; + UnprotectedData relocatedArenasToRelease; #ifdef JS_GC_ZEAL - ActiveThreadData markingValidator; + UnprotectedData markingValidator; #endif /* @@ -1184,23 +1184,23 @@ class GCRuntime * frame, rather than at the beginning. In this case, the next slice will be * delayed so that we don't get back-to-back slices. */ - ActiveThreadData interFrameGC; + UnprotectedData interFrameGC; /* Default budget for incremental GC slice. See js/SliceBudget.h. */ - ActiveThreadData defaultTimeBudget_; + UnprotectedData defaultTimeBudget_; /* * We disable incremental GC if we encounter a Class with a trace hook * that does not implement write barriers. */ - ActiveThreadData incrementalAllowed; + UnprotectedData incrementalAllowed; /* * Whether compacting GC can is enabled globally. */ - ActiveThreadData compactingEnabled; + UnprotectedData compactingEnabled; - ActiveThreadData poked; + UnprotectedData poked; /* * These options control the zealousness of the GC. At every allocation, @@ -1227,16 +1227,16 @@ class GCRuntime * zeal_ value 14 performs periodic shrinking collections. */ #ifdef JS_GC_ZEAL - ActiveThreadData zealModeBits; - ActiveThreadData zealFrequency; - ActiveThreadData nextScheduled; - ActiveThreadData deterministicOnly; - ActiveThreadData incrementalLimit; + UnprotectedData zealModeBits; + UnprotectedData zealFrequency; + UnprotectedData nextScheduled; + UnprotectedData deterministicOnly; + UnprotectedData incrementalLimit; - ActiveThreadData> selectedForMarking; + UnprotectedData> selectedForMarking; #endif - ActiveThreadData fullCompartmentChecks; + UnprotectedData fullCompartmentChecks; Callback gcCallback; Callback gcDoCycleCollectionCallback; @@ -1267,10 +1267,10 @@ class GCRuntime Callback grayRootTracer; /* Always preserve JIT code during GCs, for testing. */ - ActiveThreadData alwaysPreserveCode; + UnprotectedData alwaysPreserveCode; #ifdef DEBUG - ActiveThreadData arenasEmptyAtShutdown; + UnprotectedData arenasEmptyAtShutdown; #endif /* Synchronize GC heap access among GC helper threads and main threads. */ @@ -1286,7 +1286,7 @@ class GCRuntime * During incremental sweeping, this field temporarily holds the arenas of * the current AllocKind being swept in order of increasing free space. */ - ActiveThreadData incrementalSweepList; + UnprotectedData incrementalSweepList; friend class js::GCHelperState; friend class MarkingValidator; diff --git a/js/src/gc/Marking.h b/js/src/gc/Marking.h index b128d99c9d2df..437b9b8a7ce88 100644 --- a/js/src/gc/Marking.h +++ b/js/src/gc/Marking.h @@ -57,13 +57,13 @@ class MarkStack { friend class GCMarker; - ActiveThreadData stack_; - ActiveThreadData tos_; - ActiveThreadData end_; + UnprotectedData stack_; + UnprotectedData tos_; + UnprotectedData end_; // The capacity we start with and reset() to. - ActiveThreadData baseCapacity_; - ActiveThreadData maxCapacity_; + UnprotectedData baseCapacity_; + UnprotectedData maxCapacity_; public: explicit MarkStack(size_t maxCapacity) @@ -336,29 +336,29 @@ class GCMarker : public JSTracer MarkStack stack; /* The color is only applied to objects and functions. */ - ActiveThreadData color; + UnprotectedData color; /* Pointer to the top of the stack of arenas we are delaying marking on. */ - ActiveThreadData unmarkedArenaStackTop; + UnprotectedData unmarkedArenaStackTop; /* * If the weakKeys table OOMs, disable the linear algorithm and fall back * to iterating until the next GC. */ - ActiveThreadData linearWeakMarkingDisabled_; + UnprotectedData linearWeakMarkingDisabled_; #ifdef DEBUG /* Count of arenas that are currently in the stack. */ - ActiveThreadData markLaterArenas; + UnprotectedData markLaterArenas; /* Assert that start and stop are called with correct ordering. */ - ActiveThreadData started; + UnprotectedData started; /* * If this is true, all marked objects must belong to a compartment being * GCed. This is used to look for compartment bugs. */ - ActiveThreadData strictCompartmentChecking; + UnprotectedData strictCompartmentChecking; #endif // DEBUG }; diff --git a/js/src/gc/Zone.h b/js/src/gc/Zone.h index e749c5e7a407a..f91906f319cf0 100644 --- a/js/src/gc/Zone.h +++ b/js/src/gc/Zone.h @@ -341,7 +341,7 @@ struct Zone : public JS::shadow::Zone, private: // The set of compartments in this zone. - js::ActiveThreadOrGCTaskData compartments_; + js::UnprotectedData compartments_; public: CompartmentVector& compartments() { return compartments_.ref(); } @@ -410,7 +410,7 @@ struct Zone : public JS::shadow::Zone, mozilla::Atomic gcMallocBytes; // GC trigger threshold for allocations on the C heap. - js::ActiveThreadData gcMaxMallocBytes; + js::UnprotectedData gcMaxMallocBytes; // Whether a GC has been triggered as a result of gcMallocBytes falling // below zero. @@ -582,7 +582,7 @@ struct Zone : public JS::shadow::Zone, js::ZoneGroupData jitZone_; js::UnprotectedData gcState_; - js::ActiveThreadData gcScheduled_; + js::UnprotectedData gcScheduled_; js::ZoneGroupData gcPreserveCode_; js::ZoneGroupData jitUsingBarriers_; js::ZoneGroupData keepShapeTables_; diff --git a/js/src/gc/ZoneGroup.cpp b/js/src/gc/ZoneGroup.cpp index d60e71eb1c60f..fd0254b806788 100644 --- a/js/src/gc/ZoneGroup.cpp +++ b/js/src/gc/ZoneGroup.cpp @@ -17,7 +17,7 @@ ZoneGroup::ZoneGroup(JSRuntime* runtime) context(TlsContext.get()), enterCount(this, 1), zones_(), - nursery_(this, this), + nursery_(this), storeBuffer_(this, runtime, nursery()), blocksToFreeAfterMinorGC((size_t) JSContext::TEMP_LIFO_ALLOC_PRIMARY_CHUNK_SIZE), caches_(this), diff --git a/js/src/gc/ZoneGroup.h b/js/src/gc/ZoneGroup.h index 27266339be074..f666a4b07927f 100644 --- a/js/src/gc/ZoneGroup.h +++ b/js/src/gc/ZoneGroup.h @@ -54,7 +54,7 @@ class ZoneGroup // All zones in the group. private: - ActiveThreadOrGCTaskData zones_; + UnprotectedData zones_; public: ZoneVector& zones() { return zones_.ref(); } @@ -64,7 +64,7 @@ class ZoneGroup bool init(size_t maxNurseryBytes); private: - ZoneGroupData nursery_; + UnprotectedData nursery_; ZoneGroupData storeBuffer_; public: Nursery& nursery() { return nursery_.ref(); } @@ -72,7 +72,7 @@ class ZoneGroup // Free LIFO blocks are transferred to this allocator before being freed // after minor GC. - ActiveThreadData blocksToFreeAfterMinorGC; + UnprotectedData blocksToFreeAfterMinorGC; void minorGC(JS::gcreason::Reason reason, gcstats::Phase phase = gcstats::PHASE_MINOR_GC) JS_HAZ_GC_CALL; diff --git a/js/src/jit/JitCompartment.h b/js/src/jit/JitCompartment.h index afbb49c1062b2..058f65e04ca7c 100644 --- a/js/src/jit/JitCompartment.h +++ b/js/src/jit/JitCompartment.h @@ -87,10 +87,10 @@ class JitRuntime // Executable allocator for all code except wasm code and Ion code with // patchable backedges (see below). - ActiveThreadData execAlloc_; + UnprotectedData execAlloc_; // Executable allocator for Ion scripts with patchable backedges. - ActiveThreadData backedgeExecAlloc_; + UnprotectedData backedgeExecAlloc_; // Shared exception-handler tail. ExclusiveAccessLockWriteOnceData exceptionTail_; @@ -152,7 +152,7 @@ class JitRuntime mozilla::Atomic preventBackedgePatching_; // Global table of jitcode native address => bytecode address mappings. - ActiveThreadData jitcodeGlobalTable_; + UnprotectedData jitcodeGlobalTable_; private: JitCode* generateLazyLinkStub(JSContext* cx); diff --git a/js/src/jsgc.h b/js/src/jsgc.h index 258a2b3e61222..6088eeb9aa722 100644 --- a/js/src/jsgc.h +++ b/js/src/jsgc.h @@ -651,7 +651,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> arenaListsToSweep_; + UnprotectedData> arenaListsToSweep_; Arena*& arenaListsToSweep(AllocKind i) { return arenaListsToSweep_.ref()[i]; } Arena* arenaListsToSweep(AllocKind i) const { return arenaListsToSweep_.ref()[i]; } @@ -877,7 +877,7 @@ class GCHelperState js::ConditionVariable done; // Activity for the helper to do, protected by the GC lock. - ActiveThreadOrGCTaskData state_; + UnprotectedData state_; // Whether work is being performed on some thread. GCLockData hasThread; @@ -949,7 +949,7 @@ class GCParallelTask UnprotectedData state; // Amount of time this task took to execute. - ActiveThreadOrGCTaskData duration_; + UnprotectedData duration_; explicit GCParallelTask(const GCParallelTask&) = delete; diff --git a/js/src/threading/ProtectedData.cpp b/js/src/threading/ProtectedData.cpp index c186f95356c03..ff0b1b0eb7563 100644 --- a/js/src/threading/ProtectedData.cpp +++ b/js/src/threading/ProtectedData.cpp @@ -34,27 +34,6 @@ OnBackgroundThread() return false; } -template -void -CheckActiveThread::check() const -{ - // When interrupting a thread on Windows, changes are made to the runtime - // and active thread's state from another thread while the active thread is - // suspended. We need a way to mark these accesses as being tantamount to - // accesses by the active thread. See bug 1323066. -#ifndef XP_WIN - if (OnBackgroundThread()) - return; - - JSContext* cx = TlsContext.get(); - MOZ_ASSERT(cx == cx->runtime()->activeContext); -#endif // XP_WIN -} - -template class CheckActiveThread; -template class CheckActiveThread; -template class CheckActiveThread; - template void CheckZoneGroup::check() const diff --git a/js/src/threading/ProtectedData.h b/js/src/threading/ProtectedData.h index 6644d40dc30ad..af31d912dac19 100644 --- a/js/src/threading/ProtectedData.h +++ b/js/src/threading/ProtectedData.h @@ -201,28 +201,6 @@ enum class AllowedBackgroundThread GCTaskOrIonCompile }; -template -class CheckActiveThread -{ - public: - void check() const; -}; - -// Data which may only be accessed by the runtime's cooperatively scheduled -// active thread. -template -using ActiveThreadData = - ProtectedDataNoCheckArgs, T>; - -// Data which may only be accessed by the runtime's cooperatively scheduled -// active thread, or by various helper thread tasks. -template -using ActiveThreadOrGCTaskData = - ProtectedDataNoCheckArgs, T>; -template -using ActiveThreadOrIonCompileData = - ProtectedDataNoCheckArgs, T>; - template class CheckZoneGroup { @@ -245,13 +223,19 @@ using ZoneGroupData = ProtectedDataZoneGroupArg, T>; // Data which may only be accessed by threads with exclusive access to the -// associated zone group, or by various helper thread tasks. +// associated zone group, or by GC helper thread tasks. template using ZoneGroupOrGCTaskData = ProtectedDataZoneGroupArg, T>; + +// Data which may only be accessed by threads with exclusive access to the +// associated zone group, or by Ion compilation helper thread tasks. template using ZoneGroupOrIonCompileData = ProtectedDataZoneGroupArg, T>; + +// Data which may only be accessed by threads with exclusive access to the +// associated zone group, or by either GC helper or Ion compilation tasks. template using ZoneGroupOrGCTaskOrIonCompileData = ProtectedDataZoneGroupArg, T>; diff --git a/js/src/vm/HelperThreads.cpp b/js/src/vm/HelperThreads.cpp index 371b474022e25..b500e160c82f9 100644 --- a/js/src/vm/HelperThreads.cpp +++ b/js/src/vm/HelperThreads.cpp @@ -1183,10 +1183,10 @@ void js::GCParallelTask::runFromHelperThread(AutoLockHelperThreadState& locked) { JSContext cx(runtime(), JS::ContextOptions()); - gc::AutoSetThreadIsPerformingGC performingGC; { AutoUnlockHelperThreadState parallelSection(locked); + gc::AutoSetThreadIsPerformingGC performingGC; mozilla::TimeStamp timeStart = mozilla::TimeStamp::Now(); cx.heapState = JS::HeapState::MajorCollecting; run(); diff --git a/js/src/vm/Runtime.cpp b/js/src/vm/Runtime.cpp index 0e8a1a3195256..db374b131faf4 100644 --- a/js/src/vm/Runtime.cpp +++ b/js/src/vm/Runtime.cpp @@ -95,7 +95,6 @@ JSRuntime::JSRuntime(JSRuntime* parentRuntime) #ifdef DEBUG updateChildRuntimeCount(parentRuntime), #endif - activeContext(nullptr), profilerSampleBufferGen_(0), profilerSampleBufferLapCount_(1), telemetryCallback(nullptr), @@ -192,8 +191,6 @@ JSRuntime::init(JSContext* cx, uint32_t maxbytes, uint32_t maxNurseryBytes) if (CanUseExtraThreads() && !EnsureHelperThreadsInitialized()) return false; - activeContext = cx; - singletonContext = cx; defaultFreeOp_ = js_new(this); diff --git a/js/src/vm/Runtime.h b/js/src/vm/Runtime.h index cf7a61ef8fed1..339445e9b7aab 100644 --- a/js/src/vm/Runtime.h +++ b/js/src/vm/Runtime.h @@ -297,11 +297,6 @@ struct JSRuntime : public js::MallocProvider AutoUpdateChildRuntimeCount updateChildRuntimeCount; #endif - // The context for the thread which currently has exclusive access to most - // contents of the runtime. When execution on the runtime is cooperatively - // scheduled, this is the thread which is currently running. - mozilla::Atomic activeContext; - /* * The profiler sampler generation after the latest sample. * @@ -359,7 +354,7 @@ struct JSRuntime : public js::MallocProvider } /* Call this to accumulate telemetry data. */ - js::ActiveThreadData telemetryCallback; + js::UnprotectedData telemetryCallback; public: // Accumulates data for Firefox telemetry. |id| is the ID of a JS_TELEMETRY_* // histogram. |key| provides an additional key to identify the histogram. @@ -369,14 +364,14 @@ struct JSRuntime : public js::MallocProvider void setTelemetryCallback(JSRuntime* rt, JSAccumulateTelemetryDataCallback callback); public: - js::ActiveThreadData getIncumbentGlobalCallback; - js::ActiveThreadData enqueuePromiseJobCallback; - js::ActiveThreadData enqueuePromiseJobCallbackData; + js::UnprotectedData getIncumbentGlobalCallback; + js::UnprotectedData enqueuePromiseJobCallback; + js::UnprotectedData enqueuePromiseJobCallbackData; - js::ActiveThreadData promiseRejectionTrackerCallback; - js::ActiveThreadData promiseRejectionTrackerCallbackData; + js::UnprotectedData promiseRejectionTrackerCallback; + js::UnprotectedData promiseRejectionTrackerCallbackData; - js::ActiveThreadData startAsyncTaskCallback; + js::UnprotectedData startAsyncTaskCallback; js::UnprotectedData finishAsyncTaskCallback; js::ExclusiveData promiseTasksToDestroy; @@ -393,35 +388,35 @@ struct JSRuntime : public js::MallocProvider * Allow relazifying functions in compartments that are active. This is * only used by the relazifyFunctions() testing function. */ - js::ActiveThreadData allowRelazificationForTesting; + js::UnprotectedData allowRelazificationForTesting; /* Compartment destroy callback. */ - js::ActiveThreadData destroyCompartmentCallback; + js::UnprotectedData destroyCompartmentCallback; /* Compartment memory reporting callback. */ - js::ActiveThreadData sizeOfIncludingThisCompartmentCallback; + js::UnprotectedData sizeOfIncludingThisCompartmentCallback; /* Zone destroy callback. */ - js::ActiveThreadData destroyZoneCallback; + js::UnprotectedData destroyZoneCallback; /* Zone sweep callback. */ - js::ActiveThreadData sweepZoneCallback; + js::UnprotectedData sweepZoneCallback; /* Call this to get the name of a compartment. */ - js::ActiveThreadData compartmentNameCallback; + js::UnprotectedData compartmentNameCallback; /* Callback for doing memory reporting on external strings. */ - js::ActiveThreadData externalStringSizeofCallback; + js::UnprotectedData externalStringSizeofCallback; - js::ActiveThreadData> sourceHook; + js::UnprotectedData> sourceHook; - js::ActiveThreadData securityCallbacks; - js::ActiveThreadData DOMcallbacks; - js::ActiveThreadData destroyPrincipals; - js::ActiveThreadData readPrincipals; + js::UnprotectedData securityCallbacks; + js::UnprotectedData DOMcallbacks; + js::UnprotectedData destroyPrincipals; + js::UnprotectedData readPrincipals; /* Optional warning reporter. */ - js::ActiveThreadData warningReporter; + js::UnprotectedData warningReporter; private: /* Gecko profiling metadata */ @@ -430,7 +425,7 @@ struct JSRuntime : public js::MallocProvider js::GeckoProfiler& geckoProfiler() { return geckoProfiler_.ref(); } // Heap GC roots for PersistentRooted pointers. - js::ActiveThreadData>>> heapRoots; void tracePersistentRoots(JSTracer* trc); @@ -450,15 +445,15 @@ struct JSRuntime : public js::MallocProvider void setTrustedPrincipals(const JSPrincipals* p) { trustedPrincipals_ = p; } const JSPrincipals* trustedPrincipals() const { return trustedPrincipals_; } - js::ActiveThreadData wrapObjectCallbacks; - js::ActiveThreadData preserveWrapperCallback; + js::UnprotectedData wrapObjectCallbacks; + js::UnprotectedData preserveWrapperCallback; - js::ActiveThreadData scriptEnvironmentPreparer; + js::UnprotectedData scriptEnvironmentPreparer; - js::ActiveThreadData ctypesActivityCallback; + js::UnprotectedData ctypesActivityCallback; private: - js::WriteOnceData windowProxyClass_; + js::UnprotectedData windowProxyClass_; public: const js::Class* maybeWindowProxyClass() const { @@ -473,7 +468,7 @@ struct JSRuntime : public js::MallocProvider * Head of circular list of all enabled Debuggers that have * onNewGlobalObject handler methods established. */ - js::ActiveThreadData onNewGlobalObjectWatchers_; + js::UnprotectedData onNewGlobalObjectWatchers_; public: JSCList& onNewGlobalObjectWatchers() { return onNewGlobalObjectWatchers_.ref(); } @@ -513,16 +508,16 @@ struct JSRuntime : public js::MallocProvider // How many compartments there are across all zones. This number includes // off main thread context compartments, so it isn't necessarily equal to the // number of compartments visited by CompartmentsIter. - js::ActiveThreadData numCompartments; + js::UnprotectedData numCompartments; /* Locale-specific callbacks for string conversion. */ - js::ActiveThreadData localeCallbacks; + js::UnprotectedData localeCallbacks; /* Default locale for Internationalization API */ - js::ActiveThreadData defaultLocale; + js::UnprotectedData defaultLocale; /* Default JSVersion. */ - js::ActiveThreadData defaultVersion_; + js::UnprotectedData defaultVersion_; private: /* Code coverage output. */ @@ -531,7 +526,7 @@ struct JSRuntime : public js::MallocProvider js::coverage::LCovRuntime& lcovOutput() { return lcovOutput_.ref(); } private: - js::ActiveThreadOrIonCompileData jitRuntime_; + js::UnprotectedData jitRuntime_; /* * Self-hosting state cloned on demand into other compartments. Shared with the parent @@ -785,7 +780,7 @@ struct JSRuntime : public js::MallocProvider js::WriteOnceData wellKnownSymbols; /* Shared Intl data for this runtime. */ - js::ActiveThreadData sharedIntlData; + js::UnprotectedData sharedIntlData; void traceSharedIntlData(JSTracer* trc); @@ -856,7 +851,7 @@ struct JSRuntime : public js::MallocProvider mozilla::Atomic offthreadIonCompilationEnabled_; mozilla::Atomic parallelParsingEnabled_; - js::ActiveThreadData autoWritableJitCodeActive_; + js::UnprotectedData autoWritableJitCodeActive_; public: @@ -881,12 +876,12 @@ struct JSRuntime : public js::MallocProvider } /* See comment for JS::SetLargeAllocationFailureCallback in jsapi.h. */ - js::ActiveThreadData largeAllocationFailureCallback; - js::ActiveThreadData largeAllocationFailureCallbackData; + js::UnprotectedData largeAllocationFailureCallback; + js::UnprotectedData largeAllocationFailureCallbackData; /* See comment for JS::SetOutOfMemoryCallback in jsapi.h. */ - js::ActiveThreadData oomCallback; - js::ActiveThreadData oomCallbackData; + js::UnprotectedData oomCallback; + js::UnprotectedData oomCallbackData; /* * These variations of malloc/calloc/realloc will call the @@ -924,13 +919,13 @@ struct JSRuntime : public js::MallocProvider * Debugger.Memory functions like takeCensus use this embedding-provided * function to assess the size of malloc'd blocks of memory. */ - js::ActiveThreadData debuggerMallocSizeOf; + js::UnprotectedData debuggerMallocSizeOf; /* Last time at which an animation was played for this runtime. */ mozilla::Atomic lastAnimationTime; private: - js::ActiveThreadData performanceMonitoring_; + js::UnprotectedData performanceMonitoring_; public: js::PerformanceMonitoring& performanceMonitoring() { return performanceMonitoring_.ref(); }