зеркало из https://github.com/mozilla/gecko-dev.git
Bug 906001 - Improve tests and asserts around starting off thread parses while GC is active in the atoms zone, r=billm.
This commit is contained in:
Родитель
d546e19260
Коммит
58194c732e
|
@ -76,6 +76,7 @@ Zone::setNeedsBarrier(bool needs, ShouldUpdateIon updateIon)
|
|||
if (needs && runtimeFromMainThread()->isAtomsZone(this))
|
||||
JS_ASSERT(!runtimeFromMainThread()->exclusiveThreadsPresent());
|
||||
|
||||
JS_ASSERT_IF(needs, canCollect());
|
||||
needsBarrier_ = needs;
|
||||
}
|
||||
|
||||
|
|
|
@ -189,20 +189,16 @@ struct Zone : private JS::shadow::Zone,
|
|||
|
||||
void setGCState(CompartmentGCState state) {
|
||||
JS_ASSERT(runtimeFromMainThread()->isHeapBusy());
|
||||
JS_ASSERT_IF(state != NoGC, canCollect());
|
||||
gcState = state;
|
||||
}
|
||||
|
||||
void scheduleGC() {
|
||||
JSRuntime *rt = runtimeFromMainThread();
|
||||
JS_ASSERT(!rt->isHeapBusy());
|
||||
JS_ASSERT(!runtimeFromMainThread()->isHeapBusy());
|
||||
|
||||
/* Note: zones cannot be collected while in use by other threads. */
|
||||
if (usedByExclusiveThread)
|
||||
return;
|
||||
if (rt->isAtomsZone(this) && rt->exclusiveThreadsPresent())
|
||||
return;
|
||||
|
||||
gcScheduled = true;
|
||||
// Ignore attempts to schedule GCs on zones which can't be collected.
|
||||
if (canCollect())
|
||||
gcScheduled = true;
|
||||
}
|
||||
|
||||
void unscheduleGC() {
|
||||
|
@ -217,6 +213,16 @@ struct Zone : private JS::shadow::Zone,
|
|||
gcPreserveCode = preserving;
|
||||
}
|
||||
|
||||
bool canCollect() {
|
||||
// Zones cannot be collected while in use by other threads.
|
||||
if (usedByExclusiveThread)
|
||||
return false;
|
||||
JSRuntime *rt = runtimeFromMainThread();
|
||||
if (rt->isAtomsZone(this) && rt->exclusiveThreadsPresent())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool wasGCStarted() const {
|
||||
return gcState != NoGC;
|
||||
}
|
||||
|
|
|
@ -4847,7 +4847,7 @@ JS::CanCompileOffThread(JSContext *cx, const CompileOptions &options)
|
|||
// atoms compartment, to avoid triggering barriers. Outside the atoms
|
||||
// compartment, the compilation will use a new zone which doesn't require
|
||||
// barriers itself.
|
||||
if (cx->runtime()->atomsZoneNeedsBarrier())
|
||||
if (cx->runtime()->activeGCInAtomsZone())
|
||||
return false;
|
||||
|
||||
// Blacklist filenames which cause mysterious assertion failures in
|
||||
|
|
|
@ -401,12 +401,6 @@ JSRuntime::isAtomsZone(JS::Zone *zone)
|
|||
return zone == atomsCompartment_->zone();
|
||||
}
|
||||
|
||||
inline bool
|
||||
JSRuntime::atomsZoneNeedsBarrier()
|
||||
{
|
||||
return atomsCompartment_->zone()->needsBarrier();
|
||||
}
|
||||
|
||||
// For use when changing the debug mode flag on one or more compartments.
|
||||
// Do not run scripts in any compartment that is scheduled for GC using this
|
||||
// object. See comment in updateForDebugMode.
|
||||
|
|
|
@ -716,6 +716,13 @@ JSRuntime::onOutOfMemory(void *p, size_t nbytes, JSContext *cx)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
JSRuntime::activeGCInAtomsZone()
|
||||
{
|
||||
Zone *zone = atomsCompartment_->zone();
|
||||
return zone->needsBarrier() || zone->isGCScheduled() || zone->wasGCStarted();
|
||||
}
|
||||
|
||||
#ifdef JS_THREADSAFE
|
||||
|
||||
void
|
||||
|
|
|
@ -1415,7 +1415,7 @@ struct JSRuntime : public JS::shadow::Runtime,
|
|||
// The atoms compartment is the only one in its zone.
|
||||
inline bool isAtomsZone(JS::Zone *zone);
|
||||
|
||||
inline bool atomsZoneNeedsBarrier();
|
||||
bool activeGCInAtomsZone();
|
||||
|
||||
union {
|
||||
/*
|
||||
|
|
Загрузка…
Ссылка в новой задаче