Bug 836524 - Zone renaming part 1 (r=terrence)

This commit is contained in:
Bill McCloskey 2013-02-06 18:08:10 -08:00
parent fd7fb68530
commit 57509c61ee
5 changed files with 18 additions and 26 deletions

View File

@ -129,11 +129,11 @@ CheckMarkedThing(JSTracer *trc, T *thing)
JS_ASSERT_IF(rt->gcStrictCompartmentChecking, JS_ASSERT_IF(rt->gcStrictCompartmentChecking,
thing->zone()->isCollecting() || thing->zone()->isCollecting() ||
thing->compartment() == rt->atomsCompartment); thing->zone() == rt->atomsCompartment->zone());
JS_ASSERT_IF(IS_GC_MARKING_TRACER(trc) && ((GCMarker *)trc)->getMarkColor() == GRAY, JS_ASSERT_IF(IS_GC_MARKING_TRACER(trc) && ((GCMarker *)trc)->getMarkColor() == GRAY,
thing->zone()->isGCMarkingGray() || thing->zone()->isGCMarkingGray() ||
thing->compartment() == rt->atomsCompartment); thing->zone() == rt->atomsCompartment->zone());
/* /*
* Try to assert that the thing is allocated. This is complicated by the * Try to assert that the thing is allocated. This is complicated by the
@ -716,7 +716,7 @@ gc::IsCellAboutToBeFinalized(Cell **thingp)
#define JS_COMPARTMENT_ASSERT_STR(rt, thing) \ #define JS_COMPARTMENT_ASSERT_STR(rt, thing) \
JS_ASSERT((thing)->zone()->isGCMarking() || \ JS_ASSERT((thing)->zone()->isGCMarking() || \
(thing)->compartment() == (rt)->atomsCompartment); (thing)->zone() == (rt)->atomsCompartment->zone());
static void static void
PushMarkStack(GCMarker *gcmarker, JSObject *thing) PushMarkStack(GCMarker *gcmarker, JSObject *thing)
@ -1330,8 +1330,8 @@ GCMarker::processMarkStackTop(SliceBudget &budget)
if (v.isString()) { if (v.isString()) {
JSString *str = v.toString(); JSString *str = v.toString();
JS_COMPARTMENT_ASSERT_STR(runtime, str); JS_COMPARTMENT_ASSERT_STR(runtime, str);
JS_ASSERT(str->compartment() == runtime->atomsCompartment || JS_ASSERT(str->zone() == runtime->atomsCompartment->zone() ||
str->compartment() == obj->compartment()); str->zone() == obj->zone());
if (str->markIfUnmarked()) if (str->markIfUnmarked())
ScanString(this, str); ScanString(this, str);
} else if (v.isObject()) { } else if (v.isObject()) {
@ -1614,7 +1614,7 @@ JS::UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind)
UnmarkGrayGCThing(thing); UnmarkGrayGCThing(thing);
JSRuntime *rt = static_cast<Cell *>(thing)->compartment()->rt; JSRuntime *rt = static_cast<Cell *>(thing)->zone()->rt;
UnmarkGrayTracer trc(rt); UnmarkGrayTracer trc(rt);
JS_TraceChildren(&trc, thing, kind); JS_TraceChildren(&trc, thing, kind);
} }

View File

@ -270,12 +270,12 @@ JSCompartment::wrap(JSContext *cx, Value *vp, JSObject *existingArg)
JSString *str = vp->toString(); JSString *str = vp->toString();
/* If the string is already in this compartment, we are done. */ /* If the string is already in this compartment, we are done. */
if (str->compartment() == this) if (str->zone() == zone())
return true; return true;
/* If the string is an atom, we don't have to copy. */ /* If the string is an atom, we don't have to copy. */
if (str->isAtom()) { if (str->isAtom()) {
JS_ASSERT(str->compartment() == cx->runtime->atomsCompartment); JS_ASSERT(str->zone() == cx->runtime->atomsCompartment->zone());
return true; return true;
} }
} }

View File

@ -875,11 +875,11 @@ JS::IncrementalReferenceBarrier(void *ptr, JSGCTraceKind kind)
return; return;
gc::Cell *cell = static_cast<gc::Cell *>(ptr); gc::Cell *cell = static_cast<gc::Cell *>(ptr);
JSCompartment *comp = cell->compartment(); Zone *zone = cell->zone();
JS_ASSERT(!comp->rt->isHeapBusy()); JS_ASSERT(!zone->rt->isHeapBusy());
AutoMarkInDeadCompartment amn(comp); AutoMarkInDeadCompartment amn(zone);
if (kind == JSTRACE_OBJECT) if (kind == JSTRACE_OBJECT)
JSObject::writeBarrierPre(static_cast<JSObject*>(cell)); JSObject::writeBarrierPre(static_cast<JSObject*>(cell));

View File

@ -191,21 +191,13 @@ js::ObjectImpl::nativeGetSlot(uint32_t slot) const
return getSlot(slot); return getSlot(slot);
} }
static JS_ALWAYS_INLINE JSCompartment *
ValueCompartment(const js::Value &value)
{
JS_ASSERT(value.isMarkable());
return static_cast<js::gc::Cell *>(value.toGCThing())->compartment();
}
#ifdef DEBUG #ifdef DEBUG
inline bool inline bool
IsValueInCompartment(js::Value v, JSCompartment *comp) IsObjectValueInCompartment(js::Value v, JSCompartment *comp)
{ {
if (!v.isMarkable()) if (!v.isObject())
return true; return true;
JSCompartment *vcomp = ValueCompartment(v); return v.toObject().compartment() == comp;
return vcomp == comp->rt->atomsCompartment || vcomp == comp;
} }
#endif #endif
@ -213,7 +205,7 @@ inline void
js::ObjectImpl::setSlot(uint32_t slot, const js::Value &value) js::ObjectImpl::setSlot(uint32_t slot, const js::Value &value)
{ {
MOZ_ASSERT(slotInRange(slot)); MOZ_ASSERT(slotInRange(slot));
MOZ_ASSERT(IsValueInCompartment(value, compartment())); MOZ_ASSERT(IsObjectValueInCompartment(value, compartment()));
getSlotRef(slot).set(this->asObjectPtr(), HeapSlot::Slot, slot, value); getSlotRef(slot).set(this->asObjectPtr(), HeapSlot::Slot, slot, value);
} }
@ -229,7 +221,7 @@ js::ObjectImpl::initSlot(uint32_t slot, const js::Value &value)
{ {
MOZ_ASSERT(getSlot(slot).isUndefined()); MOZ_ASSERT(getSlot(slot).isUndefined());
MOZ_ASSERT(slotInRange(slot)); MOZ_ASSERT(slotInRange(slot));
MOZ_ASSERT(IsValueInCompartment(value, compartment())); MOZ_ASSERT(IsObjectValueInCompartment(value, asObjectPtr()->compartment()));
initSlotUnchecked(slot, value); initSlotUnchecked(slot, value);
} }

View File

@ -302,8 +302,8 @@ js::ConcatStrings(JSContext *cx,
typename MaybeRooted<JSString*, allowGC>::HandleType left, typename MaybeRooted<JSString*, allowGC>::HandleType left,
typename MaybeRooted<JSString*, allowGC>::HandleType right) typename MaybeRooted<JSString*, allowGC>::HandleType right)
{ {
JS_ASSERT_IF(!left->isAtom(), left->compartment() == cx->compartment); JS_ASSERT_IF(!left->isAtom(), left->zone() == cx->zone());
JS_ASSERT_IF(!right->isAtom(), right->compartment() == cx->compartment); JS_ASSERT_IF(!right->isAtom(), right->zone() == cx->zone());
size_t leftLen = left->length(); size_t leftLen = left->length();
if (leftLen == 0) if (leftLen == 0)