mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
Backed out changeset e5edc899d2b2 (bug 988486) for rooting analysis failures; CLOSED TREE
This commit is contained in:
parent
b0941539c4
commit
6b4473abbe
@ -43,7 +43,6 @@ namespace gc {
|
||||
typedef Vector<JS::Zone *, 4, SystemAllocPolicy> ZoneVector;
|
||||
|
||||
class MarkingValidator;
|
||||
class AutoPrepareForTracing;
|
||||
|
||||
struct ConservativeGCData
|
||||
{
|
||||
@ -89,77 +88,8 @@ class GCRuntime
|
||||
{
|
||||
public:
|
||||
GCRuntime(JSRuntime *rt);
|
||||
bool init(uint32_t maxbytes);
|
||||
void finish();
|
||||
|
||||
void setGCZeal(uint8_t zeal, uint32_t frequency);
|
||||
template <typename T> bool addRoot(T *rp, const char *name, JSGCRootType rootType);
|
||||
void removeRoot(void *rp);
|
||||
void setMarkStackLimit(size_t limit);
|
||||
|
||||
bool isHeapBusy() { return heapState != js::Idle; }
|
||||
bool isHeapMajorCollecting() { return heapState == js::MajorCollecting; }
|
||||
bool isHeapMinorCollecting() { return heapState == js::MinorCollecting; }
|
||||
bool isHeapCollecting() { return isHeapMajorCollecting() || isHeapMinorCollecting(); }
|
||||
|
||||
bool triggerGC(JS::gcreason::Reason reason);
|
||||
bool triggerZoneGC(Zone *zone, JS::gcreason::Reason reason);
|
||||
void maybeGC(Zone *zone);
|
||||
void minorGC(JS::gcreason::Reason reason);
|
||||
void minorGC(JSContext *cx, JS::gcreason::Reason reason);
|
||||
void gcIfNeeded(JSContext *cx);
|
||||
void collect(bool incremental, int64_t budget, JSGCInvocationKind gckind,
|
||||
JS::gcreason::Reason reason);
|
||||
void gcSlice(JSGCInvocationKind gckind, JS::gcreason::Reason reason, int64_t millis);
|
||||
void runDebugGC();
|
||||
|
||||
private:
|
||||
// For ArenaLists::allocateFromArenaInline()
|
||||
friend class ArenaLists;
|
||||
Chunk *pickChunk(Zone *zone);
|
||||
|
||||
inline bool wantBackgroundAllocation() const;
|
||||
|
||||
bool initGCZeal();
|
||||
void recordNativeStackTopForGC();
|
||||
void requestInterrupt(JS::gcreason::Reason reason);
|
||||
bool gcCycle(bool incremental, int64_t budget, JSGCInvocationKind gckind,
|
||||
JS::gcreason::Reason reason);
|
||||
void budgetIncrementalGC(int64_t *budget);
|
||||
void resetIncrementalGC(const char *reason);
|
||||
void incrementalCollectSlice(int64_t budget, JS::gcreason::Reason reason,
|
||||
JSGCInvocationKind gckind);
|
||||
void pushZealSelectedObjects();
|
||||
bool beginMarkPhase();
|
||||
bool shouldPreserveJITCode(JSCompartment *comp, int64_t currentTime);
|
||||
bool drainMarkStack(SliceBudget &sliceBudget, gcstats::Phase phase);
|
||||
template <class CompartmentIterT> void markWeakReferences(gcstats::Phase phase);
|
||||
void markWeakReferencesInCurrentGroup(gcstats::Phase phase);
|
||||
template <class ZoneIterT, class CompartmentIterT> void markGrayReferences();
|
||||
void markGrayReferencesInCurrentGroup();
|
||||
void beginSweepPhase(bool lastGC);
|
||||
void findZoneGroups();
|
||||
void getNextZoneGroup();
|
||||
void endMarkingZoneGroup();
|
||||
void beginSweepingZoneGroup();
|
||||
bool releaseObservedTypes();
|
||||
void endSweepingZoneGroup();
|
||||
bool sweepPhase(SliceBudget &sliceBudget);
|
||||
void endSweepPhase(JSGCInvocationKind gckind, bool lastGC);
|
||||
void sweepZones(FreeOp *fop, bool lastGC);
|
||||
|
||||
void computeNonIncrementalMarkingForValidation();
|
||||
void validateIncrementalMarking();
|
||||
void finishMarkingValidation();
|
||||
|
||||
#ifdef DEBUG
|
||||
void checkForCompartmentMismatches();
|
||||
void markAllWeakReferences(gcstats::Phase phase);
|
||||
void markAllGrayReferences();
|
||||
#endif
|
||||
|
||||
public: // Internal state, public for now
|
||||
JSRuntime *rt;
|
||||
|
||||
/* Embedders can use this zone however they wish. */
|
||||
JS::Zone *systemZone;
|
||||
@ -298,7 +228,7 @@ class GCRuntime
|
||||
*/
|
||||
JS::Zone *zoneGroups;
|
||||
JS::Zone *currentZoneGroup;
|
||||
int finalizePhase;
|
||||
int sweepPhase;
|
||||
JS::Zone *sweepZone;
|
||||
int sweepKindIndex;
|
||||
bool abortSweepAfterCurrentGroup;
|
||||
@ -396,11 +326,11 @@ class GCRuntime
|
||||
bool validate;
|
||||
bool fullCompartmentChecks;
|
||||
|
||||
JSGCCallback gcCallback;
|
||||
JSGCCallback callback;
|
||||
JS::GCSliceCallback sliceCallback;
|
||||
JSFinalizeCallback finalizeCallback;
|
||||
|
||||
void *gcCallbackData;
|
||||
void *callbackData;
|
||||
|
||||
/*
|
||||
* Malloc counter to measure memory pressure for GC scheduling. It runs
|
||||
@ -447,13 +377,11 @@ class GCRuntime
|
||||
PRLock *lock;
|
||||
mozilla::DebugOnly<PRThread *> lockOwner;
|
||||
|
||||
js::GCHelperThread helperThread;
|
||||
|
||||
ConservativeGCData conservativeGC;
|
||||
|
||||
friend class js::GCHelperThread;
|
||||
friend class js::gc::AutoPrepareForTracing; /* For recordNativeStackTopForGC(). */
|
||||
friend class js::gc::MarkingValidator;
|
||||
|
||||
js::GCHelperThread helperThread;
|
||||
|
||||
ConservativeGCData conservativeGC;
|
||||
};
|
||||
|
||||
} /* namespace gc */
|
||||
|
@ -34,7 +34,6 @@ void SetGCZeal(JSRuntime *, uint8_t, uint32_t);
|
||||
|
||||
namespace gc {
|
||||
class Cell;
|
||||
class Collector;
|
||||
class MinorCollectionTracer;
|
||||
} /* namespace gc */
|
||||
|
||||
@ -151,27 +150,6 @@ class Nursery
|
||||
return ((JS::shadow::Runtime *)runtime_)->gcNurseryEnd_;
|
||||
}
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
/*
|
||||
* In debug and zeal builds, these bytes indicate the state of an unused
|
||||
* segment of nursery-allocated memory.
|
||||
*/
|
||||
void enterZealMode() {
|
||||
if (isEnabled())
|
||||
numActiveChunks_ = NumNurseryChunks;
|
||||
}
|
||||
void leaveZealMode() {
|
||||
if (isEnabled()) {
|
||||
JS_ASSERT(isEmpty());
|
||||
setCurrentChunk(0);
|
||||
currentStart_ = start();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void enterZealMode() {}
|
||||
void leaveZealMode() {}
|
||||
#endif
|
||||
|
||||
private:
|
||||
/*
|
||||
* The start and end pointers are stored under the runtime so that we can
|
||||
@ -311,8 +289,30 @@ class Nursery
|
||||
|
||||
static void MinorGCCallback(JSTracer *trc, void **thingp, JSGCTraceKind kind);
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
/*
|
||||
* In debug and zeal builds, these bytes indicate the state of an unused
|
||||
* segment of nursery-allocated memory.
|
||||
*/
|
||||
void enterZealMode() {
|
||||
if (isEnabled())
|
||||
numActiveChunks_ = NumNurseryChunks;
|
||||
}
|
||||
void leaveZealMode() {
|
||||
if (isEnabled()) {
|
||||
JS_ASSERT(isEmpty());
|
||||
setCurrentChunk(0);
|
||||
currentStart_ = start();
|
||||
}
|
||||
}
|
||||
#else
|
||||
void enterZealMode() {}
|
||||
void leaveZealMode() {}
|
||||
#endif
|
||||
|
||||
friend class gc::MinorCollectionTracer;
|
||||
friend class jit::MacroAssembler;
|
||||
friend void SetGCZeal(JSRuntime *, uint8_t, uint32_t);
|
||||
};
|
||||
|
||||
} /* namespace js */
|
||||
|
@ -102,7 +102,6 @@ struct Zone : public JS::shadow::Zone,
|
||||
{
|
||||
private:
|
||||
friend bool js::CurrentThreadCanAccessZone(Zone *zone);
|
||||
friend class js::gc::GCRuntime;
|
||||
|
||||
public:
|
||||
js::Allocator allocator;
|
||||
@ -322,7 +321,6 @@ struct Zone : public JS::shadow::Zone,
|
||||
|
||||
private:
|
||||
void sweepBreakpoints(js::FreeOp *fop);
|
||||
void sweepCompartments(js::FreeOp *fop, bool keepAtleastOne, bool lastGC);
|
||||
|
||||
#ifdef JS_ION
|
||||
js::jit::JitZone *jitZone_;
|
||||
|
@ -1907,8 +1907,8 @@ JS_PUBLIC_API(void)
|
||||
JS_SetGCCallback(JSRuntime *rt, JSGCCallback cb, void *data)
|
||||
{
|
||||
AssertHeapIsIdle(rt);
|
||||
rt->gc.gcCallback = cb;
|
||||
rt->gc.gcCallbackData = data;
|
||||
rt->gc.callback = cb;
|
||||
rt->gc.callbackData = data;
|
||||
}
|
||||
|
||||
JS_PUBLIC_API(void)
|
||||
|
1105
js/src/jsgc.cpp
1105
js/src/jsgc.cpp
File diff suppressed because it is too large
Load Diff
@ -89,6 +89,8 @@ class ChunkPool {
|
||||
return emptyCount;
|
||||
}
|
||||
|
||||
inline bool wantBackgroundAllocation(JSRuntime *rt) const;
|
||||
|
||||
/* Must be called with the GC lock taken. */
|
||||
inline Chunk *get(JSRuntime *rt);
|
||||
|
||||
|
@ -159,7 +159,6 @@ namespace js {
|
||||
namespace gc {
|
||||
class StoreBuffer;
|
||||
void MarkPersistentRootedChains(JSTracer *);
|
||||
void FinishPersistentRootedChains(JSRuntime *);
|
||||
}
|
||||
}
|
||||
|
||||
@ -213,7 +212,7 @@ struct Runtime
|
||||
private:
|
||||
template <typename Referent> friend class JS::PersistentRooted;
|
||||
friend void js::gc::MarkPersistentRootedChains(JSTracer *);
|
||||
friend void js::gc::FinishPersistentRootedChains(JSRuntime *rt);
|
||||
friend void ::js_FinishGC(JSRuntime *rt);
|
||||
|
||||
mozilla::LinkedList<PersistentRootedFunction> functionPersistentRooteds;
|
||||
mozilla::LinkedList<PersistentRootedId> idPersistentRooteds;
|
||||
|
@ -279,7 +279,10 @@ JSRuntime::init(uint32_t maxbytes)
|
||||
if (!threadPool.init())
|
||||
return false;
|
||||
|
||||
if (!gc.init(maxbytes))
|
||||
if (!js_InitGC(this, maxbytes))
|
||||
return false;
|
||||
|
||||
if (!gc.marker.init(gcMode()))
|
||||
return false;
|
||||
|
||||
const char *size = getenv("JSGC_MARK_STACK_LIMIT");
|
||||
@ -426,7 +429,7 @@ JSRuntime::~JSRuntime()
|
||||
FinishRuntimeNumberState(this);
|
||||
#endif
|
||||
|
||||
gc.finish();
|
||||
js_FinishGC(this);
|
||||
atomsCompartment_ = nullptr;
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
@ -925,10 +925,10 @@ struct JSRuntime : public JS::shadow::Runtime,
|
||||
gc.marker.setGCMode(mode);
|
||||
}
|
||||
|
||||
bool isHeapBusy() { return gc.isHeapBusy(); }
|
||||
bool isHeapMajorCollecting() { return gc.isHeapMajorCollecting(); }
|
||||
bool isHeapMinorCollecting() { return gc.isHeapMinorCollecting(); }
|
||||
bool isHeapCollecting() { return gc.isHeapCollecting(); }
|
||||
bool isHeapBusy() { return gc.heapState != js::Idle; }
|
||||
bool isHeapMajorCollecting() { return gc.heapState == js::MajorCollecting; }
|
||||
bool isHeapMinorCollecting() { return gc.heapState == js::MinorCollecting; }
|
||||
bool isHeapCollecting() { return isHeapMajorCollecting() || isHeapMinorCollecting(); }
|
||||
|
||||
#ifdef JS_GC_ZEAL
|
||||
int gcZeal() { return gc.zealMode; }
|
||||
|
Loading…
Reference in New Issue
Block a user