Bug 1107288 - Always build in incremental GC support; r=billm

--HG--
extra : rebase_source : e8137ea9c404fc6e658527c903e6867d6d9a4273
This commit is contained in:
Terrence Cole 2014-12-04 09:43:22 -08:00
parent 85f812e9de
commit a55ae14bd2
16 changed files with 5 additions and 63 deletions

View File

@ -66,6 +66,9 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
if (!JS_SetProperty(cx, info, "trace-jscalls-api", FalseHandleValue))
return false;
if (!JS_SetProperty(cx, info, "incremental-gc", TrueHandleValue))
return false;
RootedValue value(cx);
#ifdef DEBUG
value = BooleanValue(true);
@ -147,14 +150,6 @@ GetBuildConfiguration(JSContext *cx, unsigned argc, jsval *vp)
if (!JS_SetProperty(cx, info, "dtrace", value))
return false;
#ifdef JSGC_INCREMENTAL
value = BooleanValue(true);
#else
value = BooleanValue(false);
#endif
if (!JS_SetProperty(cx, info, "incremental-gc", value))
return false;
#ifdef JSGC_GENERATIONAL
value = BooleanValue(true);
#else

View File

@ -3132,17 +3132,6 @@ MOZ_ARG_WITH_STRING(wrap-malloc,
[ --with-wrap-malloc=DIR Location of malloc wrapper library],
WRAP_LDFLAGS="${WRAP_LDFLAGS} $withval")
dnl ========================================================
dnl = Use incremental GC
dnl ========================================================
JSGC_INCREMENTAL=1
MOZ_ARG_DISABLE_BOOL(gcincremental,
[ --disable-gcincremental Disable incremental GC],
JSGC_INCREMENTAL= )
if test -n "$JSGC_INCREMENTAL"; then
AC_DEFINE(JSGC_INCREMENTAL)
fi
dnl ========================================================
dnl = Use generational GC
dnl ========================================================

View File

@ -330,15 +330,12 @@ struct InternalGCMethods<Value>
static bool isMarkable(Value v) { return v.isMarkable(); }
static void preBarrier(Value v) {
#ifdef JSGC_INCREMENTAL
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
if (v.isMarkable() && shadowRuntimeFromAnyThread(v)->needsIncrementalBarrier())
preBarrier(ZoneOfValueFromAnyThread(v), v);
#endif
}
static void preBarrier(Zone *zone, Value v) {
#ifdef JSGC_INCREMENTAL
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
if (v.isString() && StringIsPermanentAtom(v.toString()))
return;
@ -349,7 +346,6 @@ struct InternalGCMethods<Value>
js::gc::MarkValueUnbarriered(shadowZone->barrierTracer(), &tmp, "write barrier");
MOZ_ASSERT(tmp == v);
}
#endif
}
static void postBarrier(Value *vp) {
@ -394,7 +390,6 @@ struct InternalGCMethods<jsid>
static bool isMarkable(jsid id) { return JSID_IS_STRING(id) || JSID_IS_SYMBOL(id); }
static void preBarrier(jsid id) {
#ifdef JSGC_INCREMENTAL
if (JSID_IS_STRING(id)) {
JSString *str = JSID_TO_STRING(id);
JS::shadow::Zone *shadowZone = ShadowZoneOfStringFromAnyThread(str);
@ -410,7 +405,6 @@ struct InternalGCMethods<jsid>
MOZ_ASSERT(sym == JSID_TO_SYMBOL(id));
}
}
#endif
}
static void preBarrier(Zone *zone, jsid id) { preBarrier(id); }

View File

@ -1249,11 +1249,7 @@ InFreeList(ArenaHeader *aheader, void *thing)
/* static */ MOZ_ALWAYS_INLINE bool
Cell::needWriteBarrierPre(JS::Zone *zone) {
#ifdef JSGC_INCREMENTAL
return JS::shadow::Zone::asShadowZone(zone)->needsIncrementalBarrier();
#else
return false;
#endif
}
/* static */ MOZ_ALWAYS_INLINE TenuredCell *
@ -1339,7 +1335,6 @@ TenuredCell::isInsideZone(JS::Zone *zone) const
/* static */ MOZ_ALWAYS_INLINE void
TenuredCell::readBarrier(TenuredCell *thing)
{
#ifdef JSGC_INCREMENTAL
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
MOZ_ASSERT(!isNullLike(thing));
JS::shadow::Zone *shadowZone = thing->shadowZoneFromAnyThread();
@ -1353,12 +1348,11 @@ TenuredCell::readBarrier(TenuredCell *thing)
}
if (JS::GCThingIsMarkedGray(thing))
JS::UnmarkGrayGCThingRecursively(thing, MapAllocToTraceKind(thing->getAllocKind()));
#endif
}
/* static */ MOZ_ALWAYS_INLINE void
TenuredCell::writeBarrierPre(TenuredCell *thing) {
#ifdef JSGC_INCREMENTAL
TenuredCell::writeBarrierPre(TenuredCell *thing)
{
MOZ_ASSERT(!CurrentThreadIsIonCompiling());
if (isNullLike(thing) || !thing->shadowRuntimeFromAnyThread()->needsIncrementalBarrier())
return;
@ -1372,7 +1366,6 @@ TenuredCell::writeBarrierPre(TenuredCell *thing) {
MapAllocToTraceKind(thing->getAllocKind()));
MOZ_ASSERT(tmp == thing);
}
#endif
}
static MOZ_ALWAYS_INLINE void

View File

@ -156,9 +156,7 @@ void
ICStub::updateCode(JitCode *code)
{
// Write barrier on the old code.
#ifdef JSGC_INCREMENTAL
JitCode::writeBarrierPre(jitCode());
#endif
stubCode_ = code->raw();
}

View File

@ -416,10 +416,8 @@ BaselineScript::trace(JSTracer *trc)
void
BaselineScript::writeBarrierPre(Zone *zone, BaselineScript *script)
{
#ifdef JSGC_INCREMENTAL
if (zone->needsIncrementalBarrier())
script->trace(zone->barrierTracer());
#endif
}
void

View File

@ -974,10 +974,8 @@ IonScript::trace(JSTracer *trc)
/* static */ void
IonScript::writeBarrierPre(Zone *zone, IonScript *ionScript)
{
#ifdef JSGC_INCREMENTAL
if (zone->needsIncrementalBarrier())
ionScript->trace(zone->barrierTracer());
#endif
}
void

View File

@ -31,9 +31,6 @@
/* Define to 1 if SpiderMonkey should use small chunks. */
#undef JS_GC_SMALL_CHUNK_SIZE
/* Define to 1 if SpiderMonkey should use Incremental GC. */
#undef JSGC_INCREMENTAL
/* Define to 1 if SpiderMonkey should use Generational GC. */
#undef JSGC_GENERATIONAL

View File

@ -6271,8 +6271,6 @@ GCRuntime::collect(bool incremental, SliceBudget &budget, JSGCInvocationKind gck
return;
#endif
MOZ_ASSERT_IF(!incremental || !budget.isUnlimited(), JSGC_INCREMENTAL);
AutoStopVerifyingBarriers av(rt, reason == JS::gcreason::SHUTDOWN_CC ||
reason == JS::gcreason::DESTROY_RUNTIME);

View File

@ -1303,14 +1303,12 @@ TypeObject::getProperty(unsigned i)
inline void
TypeNewScript::writeBarrierPre(TypeNewScript *newScript)
{
#ifdef JSGC_INCREMENTAL
if (!newScript || !newScript->fun->runtimeFromAnyThread()->needsIncrementalBarrier())
return;
JS::Zone *zone = newScript->fun->zoneFromAnyThread();
if (zone->needsIncrementalBarrier())
newScript->trace(zone->barrierTracer());
#endif
}
} } /* namespace js::types */

View File

@ -2382,7 +2382,6 @@ JSObject::swap(JSContext *cx, HandleObject a, HandleObject b)
MarkTypeObjectUnknownProperties(cx, a->type(), !a->hasSingletonType());
MarkTypeObjectUnknownProperties(cx, b->type(), !b->hasSingletonType());
#ifdef JSGC_INCREMENTAL
/*
* We need a write barrier here. If |a| was marked and |b| was not, then
* after the swap, |b|'s guts would never be marked. The write barrier
@ -2396,7 +2395,6 @@ JSObject::swap(JSContext *cx, HandleObject a, HandleObject b)
MarkChildren(zone->barrierTracer(), a);
MarkChildren(zone->barrierTracer(), b);
}
#endif
NotifyGCPostSwap(a, b, r);
return true;

View File

@ -151,7 +151,6 @@ PropertyTree::getChild(ExclusiveContext *cx, Shape *parentArg, StackShape &unroo
/* If kidp->isNull(), we always insert. */
}
#ifdef JSGC_INCREMENTAL
if (existingShape) {
JS::Zone *zone = existingShape->zone();
if (zone->needsIncrementalBarrier()) {
@ -176,7 +175,6 @@ PropertyTree::getChild(ExclusiveContext *cx, Shape *parentArg, StackShape &unroo
JS::UnmarkGrayGCThingRecursively(existingShape, JSTRACE_SHAPE);
}
}
#endif
if (existingShape)
return existingShape;
@ -211,14 +209,12 @@ PropertyTree::lookupChild(ThreadSafeContext *cx, Shape *parent, const StackShape
return nullptr;
}
#if defined(JSGC_INCREMENTAL) && defined(DEBUG)
if (shape) {
JS::Zone *zone = shape->arenaHeader()->zone;
MOZ_ASSERT(!zone->needsIncrementalBarrier());
MOZ_ASSERT(!(zone->isGCSweeping() && !shape->isMarked() &&
!shape->arenaHeader()->allocatedDuringIncremental));
}
#endif
return shape;
}

View File

@ -2183,7 +2183,6 @@ SaveSharedScriptData(ExclusiveContext *cx, Handle<JSScript *> script, SharedScri
}
}
#ifdef JSGC_INCREMENTAL
/*
* During the IGC we need to ensure that bytecode is marked whenever it is
* accessed even if the bytecode was already in the table: at this point
@ -2195,7 +2194,6 @@ SaveSharedScriptData(ExclusiveContext *cx, Handle<JSScript *> script, SharedScri
if (JS::IsIncrementalGCInProgress(rt) && rt->gc.isFullGc())
ssd->marked = true;
}
#endif
script->setCode(ssd->data);
script->atoms = ssd->atoms();

View File

@ -1248,13 +1248,11 @@ class PlainObject : public NativeObject
inline void
NativeObject::privateWriteBarrierPre(void **oldval)
{
#ifdef JSGC_INCREMENTAL
JS::shadow::Zone *shadowZone = this->shadowZoneFromAnyThread();
if (shadowZone->needsIncrementalBarrier()) {
if (*oldval && getClass()->trace)
getClass()->trace(shadowZone->barrierTracer(), this);
}
#endif
}
#ifdef DEBUG

View File

@ -454,10 +454,8 @@ JSRope::flattenInternal(ExclusiveContext *maybecx)
JSFlatString *
JSRope::flatten(ExclusiveContext *maybecx)
{
#ifdef JSGC_INCREMENTAL
if (zone()->needsIncrementalBarrier())
return flattenInternal<WithIncrementalBarrier>(maybecx);
#endif
return flattenInternal<NoBarrier>(maybecx);
}

View File

@ -494,21 +494,17 @@ class JSString : public js::gc::TenuredCell
#endif
static MOZ_ALWAYS_INLINE void readBarrier(JSString *thing) {
#ifdef JSGC_INCREMENTAL
if (thing->isPermanentAtom())
return;
TenuredCell::readBarrier(thing);
#endif
}
static MOZ_ALWAYS_INLINE void writeBarrierPre(JSString *thing) {
#ifdef JSGC_INCREMENTAL
if (isNullLike(thing) || thing->isPermanentAtom())
return;
TenuredCell::writeBarrierPre(thing);
#endif
}
private: