Skip to content

Commit

Permalink
Backed out changeset 4b8c006aff8d (bug 1334837) for Mac debug crashes…
Browse files Browse the repository at this point in the history
… [@ js::CurrentThreadIsIonCompiling()]

CLOSED TREE
  • Loading branch information
philor committed Feb 7, 2017
1 parent 339ee78 commit 4e00e15
Show file tree
Hide file tree
Showing 12 changed files with 143 additions and 188 deletions.
142 changes: 71 additions & 71 deletions js/src/gc/GCRuntime.h
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ class BackgroundDecommitTask : public GCParallelTask
void run() override;

private:
ActiveThreadOrGCTaskData<ChunkVector> toDecommit;
UnprotectedData<ChunkVector> toDecommit;
};

/*
Expand All @@ -120,14 +120,14 @@ class GCSchedulingTunables
UnprotectedData<size_t> gcMaxBytes_;

/* Maximum nursery size for each zone group. */
ActiveThreadData<size_t> gcMaxNurseryBytes_;
UnprotectedData<size_t> 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<size_t> gcZoneAllocThresholdBase_;
UnprotectedData<size_t> gcZoneAllocThresholdBase_;

/* Fraction of threshold.gcBytes() which triggers an incremental GC. */
UnprotectedData<double> zoneAllocThresholdFactor_;
Expand All @@ -142,38 +142,38 @@ class GCSchedulingTunables
* Totally disables |highFrequencyGC|, the HeapGrowthFactor, and other
* tunables that make GC non-deterministic.
*/
ActiveThreadData<bool> dynamicHeapGrowthEnabled_;
UnprotectedData<bool> dynamicHeapGrowthEnabled_;

/*
* 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_;
UnprotectedData<uint64_t> highFrequencyThresholdUsec_;

/*
* 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_;
UnprotectedData<uint64_t> highFrequencyLowLimitBytes_;
UnprotectedData<uint64_t> highFrequencyHighLimitBytes_;
UnprotectedData<double> highFrequencyHeapGrowthMax_;
UnprotectedData<double> highFrequencyHeapGrowthMin_;

/*
* When not in |highFrequencyGC| mode, this is the global (stored per-zone)
* "HeapGrowthFactor".
*/
ActiveThreadData<double> lowFrequencyHeapGrowth_;
UnprotectedData<double> lowFrequencyHeapGrowth_;

/*
* Doubles the length of IGC slices when in the |highFrequencyGC| mode.
*/
ActiveThreadData<bool> dynamicMarkSliceEnabled_;
UnprotectedData<bool> dynamicMarkSliceEnabled_;

/*
* Controls whether painting can trigger IGC slices.
*/
ActiveThreadData<bool> refreshFrameSlicesEnabled_;
UnprotectedData<bool> refreshFrameSlicesEnabled_;

/*
* Controls the number of empty chunks reserved for future allocation.
Expand Down Expand Up @@ -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<bool> inHighFrequencyGCMode_;
UnprotectedData<bool> inHighFrequencyGCMode_;

public:
GCSchedulingState()
Expand All @@ -545,8 +545,8 @@ class GCSchedulingState

template<typename F>
struct Callback {
ActiveThreadData<F> op;
ActiveThreadData<void*> data;
UnprotectedData<F> op;
UnprotectedData<void*> data;

Callback()
: op(nullptr), data(nullptr)
Expand All @@ -557,7 +557,7 @@ struct Callback {
};

template<typename F>
using CallbackVector = ActiveThreadData<Vector<Callback<F>, 4, SystemAllocPolicy>>;
using CallbackVector = UnprotectedData<Vector<Callback<F>, 4, SystemAllocPolicy>>;

template <typename T, typename Iter0, typename Iter1>
class ChainedIter
Expand Down Expand Up @@ -979,7 +979,7 @@ class GCRuntime
UnprotectedData<JS::Zone*> systemZone;

// List of all zone groups (protected by the GC lock).
ActiveThreadData<ZoneGroupVector> groups;
UnprotectedData<ZoneGroupVector> groups;

// The unique atoms zone, which has no zone group.
WriteOnceData<Zone*> atomsZone;
Expand Down Expand Up @@ -1023,9 +1023,9 @@ class GCRuntime
// so as to reduce the cost of operations on the available lists.
UnprotectedData<ChunkPool> fullChunks_;

ActiveThreadData<RootedValueMap> rootsHash;
UnprotectedData<RootedValueMap> rootsHash;

ActiveThreadData<size_t> maxMallocBytes;
UnprotectedData<size_t> maxMallocBytes;

// An incrementing id used to assign unique ids to cells that require one.
mozilla::Atomic<uint64_t, mozilla::ReleaseAcquire> nextCellUniqueId_;
Expand All @@ -1034,18 +1034,18 @@ class GCRuntime
* Number of the committed arenas in all GC chunks including empty chunks.
*/
mozilla::Atomic<uint32_t, mozilla::ReleaseAcquire> numArenasFreeCommitted;
ActiveThreadData<VerifyPreTracer*> verifyPreData;
UnprotectedData<VerifyPreTracer*> verifyPreData;

private:
UnprotectedData<bool> chunkAllocationSinceLastGC;
ActiveThreadData<int64_t> lastGCTime;
UnprotectedData<int64_t> lastGCTime;

ActiveThreadData<JSGCMode> mode;
UnprotectedData<JSGCMode> mode;

mozilla::Atomic<size_t, mozilla::ReleaseAcquire> numActiveZoneIters;

/* During shutdown, the GC needs to clean up every possible object. */
ActiveThreadData<bool> cleanUpEverything;
UnprotectedData<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
Expand All @@ -1058,7 +1058,7 @@ class GCRuntime
Okay,
Failed
};
ActiveThreadData<GrayBufferState> grayBufferState;
UnprotectedData<GrayBufferState> grayBufferState;
bool hasBufferedGrayRoots() const { return grayBufferState == GrayBufferState::Okay; }

// Clear each zone's gray buffers, but do not change the current state.
Expand All @@ -1079,83 +1079,83 @@ class GCRuntime
mozilla::Atomic<JS::gcreason::Reason, mozilla::Relaxed> majorGCTriggerReason;

public:
ActiveThreadData<JS::gcreason::Reason> minorGCTriggerReason;
UnprotectedData<JS::gcreason::Reason> minorGCTriggerReason;

private:
/* Perform full GC if rt->keepAtoms() becomes false. */
ActiveThreadData<bool> fullGCForAtomsRequested_;
UnprotectedData<bool> fullGCForAtomsRequested_;

/* Incremented at the start of every minor GC. */
ActiveThreadData<uint64_t> minorGCNumber;
UnprotectedData<uint64_t> minorGCNumber;

/* Incremented at the start of every major GC. */
ActiveThreadData<uint64_t> majorGCNumber;
UnprotectedData<uint64_t> majorGCNumber;

/* The major GC number at which to release observed type information. */
ActiveThreadData<uint64_t> jitReleaseNumber;
UnprotectedData<uint64_t> jitReleaseNumber;

/* Incremented on every GC slice. */
ActiveThreadData<uint64_t> number;
UnprotectedData<uint64_t> number;

/* The number at the time of the most recent GC's first slice. */
ActiveThreadData<uint64_t> startNumber;
UnprotectedData<uint64_t> startNumber;

/* Whether the currently running GC can finish in multiple slices. */
ActiveThreadData<bool> isIncremental;
UnprotectedData<bool> isIncremental;

/* Whether all zones are being collected in first GC slice. */
ActiveThreadData<bool> isFull;
UnprotectedData<bool> isFull;

/* Whether the heap will be compacted at the end of GC. */
ActiveThreadData<bool> isCompacting;
UnprotectedData<bool> isCompacting;

/* The invocation kind of the current GC, taken from the first slice. */
ActiveThreadData<JSGCInvocationKind> invocationKind;
UnprotectedData<JSGCInvocationKind> invocationKind;

/* The initial GC reason, taken from the first slice. */
ActiveThreadData<JS::gcreason::Reason> initialReason;
UnprotectedData<JS::gcreason::Reason> initialReason;

/*
* The current incremental GC phase. This is also used internally in
* non-incremental GC.
*/
ActiveThreadOrGCTaskData<State> incrementalState;
UnprotectedData<State> incrementalState;

/* Indicates that the last incremental slice exhausted the mark stack. */
ActiveThreadData<bool> lastMarkSlice;
UnprotectedData<bool> lastMarkSlice;

/* Whether any sweeping will take place in the separate GC helper thread. */
ActiveThreadData<bool> sweepOnBackgroundThread;
UnprotectedData<bool> sweepOnBackgroundThread;

/* Whether observed type information is being released in the current GC. */
ActiveThreadData<bool> releaseObservedTypes;
UnprotectedData<bool> releaseObservedTypes;

/* Whether any black->gray edges were found during marking. */
ActiveThreadData<BlackGrayEdgeVector> foundBlackGrayEdges;
UnprotectedData<BlackGrayEdgeVector> foundBlackGrayEdges;

/* Singly linked list of zones to be swept in the background. */
ActiveThreadOrGCTaskData<ZoneList> backgroundSweepZones;
UnprotectedData<ZoneList> backgroundSweepZones;

/*
* Free LIFO blocks are transferred to this allocator before being freed on
* the background GC thread after sweeping.
*/
ActiveThreadOrGCTaskData<LifoAlloc> blocksToFreeAfterSweeping;
UnprotectedData<LifoAlloc> blocksToFreeAfterSweeping;

private:
/* Index of current zone group (for stats). */
ActiveThreadData<unsigned> zoneGroupIndex;
UnprotectedData<unsigned> zoneGroupIndex;

/*
* Incremental sweep state.
*/
ActiveThreadData<JS::Zone*> zoneGroups;
ActiveThreadOrGCTaskData<JS::Zone*> currentZoneGroup;
ActiveThreadData<bool> sweepingTypes;
ActiveThreadData<unsigned> finalizePhase;
ActiveThreadData<JS::Zone*> sweepZone;
ActiveThreadData<AllocKind> sweepKind;
ActiveThreadData<bool> abortSweepAfterCurrentGroup;
UnprotectedData<JS::Zone*> zoneGroups;
UnprotectedData<JS::Zone*> currentZoneGroup;
UnprotectedData<bool> sweepingTypes;
UnprotectedData<unsigned> finalizePhase;
UnprotectedData<JS::Zone*> sweepZone;
UnprotectedData<AllocKind> sweepKind;
UnprotectedData<bool> abortSweepAfterCurrentGroup;

/*
* Concurrent sweep infrastructure.
Expand All @@ -1166,41 +1166,41 @@ class GCRuntime
/*
* List head of arenas allocated during the sweep phase.
*/
ActiveThreadData<Arena*> arenasAllocatedDuringSweep;
UnprotectedData<Arena*> arenasAllocatedDuringSweep;

/*
* Incremental compacting state.
*/
ActiveThreadData<bool> startedCompacting;
ActiveThreadData<ZoneList> zonesToMaybeCompact;
ActiveThreadData<Arena*> relocatedArenasToRelease;
UnprotectedData<bool> startedCompacting;
UnprotectedData<ZoneList> zonesToMaybeCompact;
UnprotectedData<Arena*> relocatedArenasToRelease;

#ifdef JS_GC_ZEAL
ActiveThreadData<MarkingValidator*> markingValidator;
UnprotectedData<MarkingValidator*> markingValidator;
#endif

/*
* Indicates that a GC slice has taken place in the middle of an animation
* 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<bool> interFrameGC;
UnprotectedData<bool> interFrameGC;

/* Default budget for incremental GC slice. See js/SliceBudget.h. */
ActiveThreadData<int64_t> defaultTimeBudget_;
UnprotectedData<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;
UnprotectedData<bool> incrementalAllowed;

/*
* Whether compacting GC can is enabled globally.
*/
ActiveThreadData<bool> compactingEnabled;
UnprotectedData<bool> compactingEnabled;

ActiveThreadData<bool> poked;
UnprotectedData<bool> poked;

/*
* These options control the zealousness of the GC. At every allocation,
Expand All @@ -1227,16 +1227,16 @@ class GCRuntime
* zeal_ value 14 performs periodic shrinking collections.
*/
#ifdef JS_GC_ZEAL
ActiveThreadData<uint32_t> zealModeBits;
ActiveThreadData<int> zealFrequency;
ActiveThreadData<int> nextScheduled;
ActiveThreadData<bool> deterministicOnly;
ActiveThreadData<int> incrementalLimit;
UnprotectedData<uint32_t> zealModeBits;
UnprotectedData<int> zealFrequency;
UnprotectedData<int> nextScheduled;
UnprotectedData<bool> deterministicOnly;
UnprotectedData<int> incrementalLimit;

ActiveThreadData<Vector<JSObject*, 0, SystemAllocPolicy>> selectedForMarking;
UnprotectedData<Vector<JSObject*, 0, SystemAllocPolicy>> selectedForMarking;
#endif

ActiveThreadData<bool> fullCompartmentChecks;
UnprotectedData<bool> fullCompartmentChecks;

Callback<JSGCCallback> gcCallback;
Callback<JS::DoCycleCollectionCallback> gcDoCycleCollectionCallback;
Expand Down Expand Up @@ -1267,10 +1267,10 @@ class GCRuntime
Callback<JSTraceDataOp> grayRootTracer;

/* Always preserve JIT code during GCs, for testing. */
ActiveThreadData<bool> alwaysPreserveCode;
UnprotectedData<bool> alwaysPreserveCode;

#ifdef DEBUG
ActiveThreadData<bool> arenasEmptyAtShutdown;
UnprotectedData<bool> arenasEmptyAtShutdown;
#endif

/* Synchronize GC heap access among GC helper threads and main threads. */
Expand All @@ -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<SortedArenaList> incrementalSweepList;
UnprotectedData<SortedArenaList> incrementalSweepList;

friend class js::GCHelperState;
friend class MarkingValidator;
Expand Down
Loading

0 comments on commit 4e00e15

Please sign in to comment.