Backout 49ca6a3ef0b6 (bug 850922), 1ff4af81172a (bug 849453), 5e0347b9a4e4:085337fa9658 (bug 841059) and 88942e6ce28d (bug 850749) for busting the build

CLOSED TREE
This commit is contained in:
Phil Ringnalda 2013-03-18 18:24:25 -07:00
Родитель c0f2c5d7d1
Коммит a49e312add
26 изменённых файлов: 49 добавлений и 116 удалений

Просмотреть файл

@ -71,8 +71,10 @@ inline void
EncapsulatedValue::writeBarrierPre(const Value &value)
{
#ifdef JSGC_INCREMENTAL
if (value.isMarkable())
writeBarrierPre(ZoneOfValue(value), value);
if (value.isMarkable()) {
js::gc::Cell *cell = (js::gc::Cell *)value.toGCThing();
writeBarrierPre(cell->zone(), value);
}
#endif
}
@ -170,8 +172,9 @@ HeapValue::set(Zone *zone, const Value &v)
{
#ifdef DEBUG
if (value.isMarkable()) {
JS_ASSERT(ZoneOfValue(value) == zone ||
ZoneOfValue(value) == zone->rt->atomsCompartment->zone());
js::gc::Cell *cell = (js::gc::Cell *)value.toGCThing();
JS_ASSERT(cell->zone() == zone ||
cell->zone() == zone->rt->atomsCompartment->zone());
}
#endif

Просмотреть файл

@ -85,13 +85,13 @@ static const size_t MAX_BACKGROUND_FINALIZE_KINDS = FINALIZE_LIMIT - FINALIZE_OB
struct Cell
{
inline ArenaHeader *arenaHeader() const;
inline AllocKind tenuredGetAllocKind() const;
inline AllocKind getAllocKind() const;
MOZ_ALWAYS_INLINE bool isMarked(uint32_t color = BLACK) const;
MOZ_ALWAYS_INLINE bool markIfUnmarked(uint32_t color = BLACK) const;
MOZ_ALWAYS_INLINE void unmark(uint32_t color) const;
inline JSRuntime *runtime() const;
inline Zone *tenuredZone() const;
inline Zone *zone() const;
#ifdef DEBUG
inline bool isAligned() const;
@ -950,7 +950,7 @@ Cell::runtime() const
}
AllocKind
Cell::tenuredGetAllocKind() const
Cell::getAllocKind() const
{
return arenaHeader()->getAllocKind();
}
@ -981,7 +981,7 @@ Cell::unmark(uint32_t color) const
}
Zone *
Cell::tenuredZone() const
Cell::zone() const
{
JS_ASSERT(isTenured());
return arenaHeader()->zone;

Просмотреть файл

@ -251,7 +251,7 @@ IsMarked(T **thingp)
{
JS_ASSERT(thingp);
JS_ASSERT(*thingp);
Zone *zone = (*thingp)->tenuredZone();
Zone *zone = (*thingp)->zone();
if (!zone->isCollecting() || zone->isGCFinished())
return true;
return (*thingp)->isMarked();
@ -263,7 +263,7 @@ IsAboutToBeFinalized(T **thingp)
{
JS_ASSERT(thingp);
JS_ASSERT(*thingp);
if (!(*thingp)->tenuredZone()->isGCSweeping())
if (!(*thingp)->zone()->isGCSweeping())
return false;
return !(*thingp)->isMarked();
}
@ -629,7 +629,7 @@ ShouldMarkCrossCompartment(JSTracer *trc, RawObject src, Cell *cell)
if (!IS_GC_MARKING_TRACER(trc))
return true;
JS::Zone *zone = cell->tenuredZone();
JS::Zone *zone = cell->zone();
uint32_t color = AsGCMarker(trc)->getMarkColor();
JS_ASSERT(color == BLACK || color == GRAY);
@ -1619,7 +1619,7 @@ JS::UnmarkGrayGCThingRecursively(void *thing, JSGCTraceKind kind)
UnmarkGrayGCThing(thing);
JSRuntime *rt = static_cast<Cell *>(thing)->runtime();
JSRuntime *rt = static_cast<Cell *>(thing)->zone()->rt;
UnmarkGrayTracer trc(rt);
JS_TraceChildren(&trc, thing, kind);
}

Просмотреть файл

@ -754,14 +754,15 @@ js::gc::EndVerifyPostBarriers(JSRuntime *rt)
goto oom;
/* Walk the heap. */
for (GCZoneGroupIter zone(rt); !zone.done(); zone.next()) {
for (CompartmentsIter comp(rt); !comp.done(); comp.next()) {
if (comp->watchpointMap)
comp->watchpointMap->markAll(trc);
}
for (CompartmentsIter c(rt); !c.done(); c.next()) {
if (IsAtomsCompartment(c))
continue;
if (c->watchpointMap)
c->watchpointMap->markAll(trc);
for (size_t kind = 0; kind < FINALIZE_LIMIT; ++kind) {
for (CellIterUnderGC cells(zone, AllocKind(kind)); !cells.done(); cells.next()) {
for (CellIterUnderGC cells(c, AllocKind(kind)); !cells.done(); cells.next()) {
Cell *src = cells.getCell();
if (!rt->gcVerifierNursery.isInside(src))
JS_TraceChildren(trc, src, MapAllocToTraceKind(AllocKind(kind)));

Просмотреть файл

@ -30,7 +30,7 @@ JS::Zone::Zone(JSRuntime *rt)
hold(false),
#ifdef JSGC_GENERATIONAL
gcNursery(),
gcStoreBuffer(rt),
gcStoreBuffer(&gcNursery),
#endif
ionUsingBarriers_(false),
active(false),

Просмотреть файл

@ -67,7 +67,7 @@ struct Zone : private JS::shadow::Zone, public js::gc::GraphNodeBase<JS::Zone>
bool hold;
#ifdef JSGC_GENERATIONAL
js::gc::VerifierNursery gcNursery;
js::gc::Nursery gcNursery;
js::gc::StoreBuffer gcStoreBuffer;
#endif

Просмотреть файл

@ -131,7 +131,6 @@ class IonCode : public gc::Cell
static IonCode *New(JSContext *cx, uint8_t *code, uint32_t bufferSize, JSC::ExecutablePool *pool);
public:
JS::Zone *zone() const { return tenuredZone(); }
static void readBarrier(IonCode *code);
static void writeBarrierPre(IonCode *code);
static void writeBarrierPost(IonCode *code, void *addr);

Просмотреть файл

@ -22,7 +22,7 @@ struct OuterWrapper : js::Wrapper
return true;
}
virtual bool finalizeInBackground(JS::Value priv) {
virtual bool finalizeInBackground(JS::HandleValue priv) {
return false;
}

Просмотреть файл

@ -264,7 +264,7 @@ JSCompartment::sweepCallsiteClones()
for (CallsiteCloneTable::Enum e(callsiteClones); !e.empty(); e.popFront()) {
CallsiteCloneKey key = e.front().key;
JSFunction *fun = e.front().value;
if (!IsScriptMarked(&key.script) || !IsObjectMarked(&fun))
if (!key.script->isMarked() || !fun->isMarked())
e.removeFront();
}
}

Просмотреть файл

@ -73,7 +73,7 @@ NewObjectCache::fill(EntryIndex entry_, Class *clasp, gc::Cell *key, gc::AllocKi
entry->key = key;
entry->kind = kind;
entry->nbytes = gc::Arena::thingSize(kind);
entry->nbytes = obj->sizeOfThis();
js_memcpy(&entry->templateObject, obj, entry->nbytes);
}

Просмотреть файл

@ -903,9 +903,7 @@ JS::IncrementalReferenceBarrier(void *ptr, JSGCTraceKind kind)
return;
gc::Cell *cell = static_cast<gc::Cell *>(ptr);
Zone *zone = kind == JSTRACE_OBJECT
? static_cast<JSObject *>(cell)->zone()
: cell->tenuredZone();
Zone *zone = cell->zone();
JS_ASSERT(!zone->rt->isHeapBusy());

Просмотреть файл

@ -273,7 +273,7 @@ class JSFunction : public JSObject
inline bool isExtended() const {
JS_STATIC_ASSERT(FinalizeKind != ExtendedFinalizeKind);
JS_ASSERT_IF(isTenured(), !!(flags & EXTENDED) == (tenuredGetAllocKind() == ExtendedFinalizeKind));
JS_ASSERT(!!(flags & EXTENDED) == (getAllocKind() == ExtendedFinalizeKind));
return !!(flags & EXTENDED);
}
@ -287,15 +287,6 @@ class JSFunction : public JSObject
static bool setTypeForScriptedFunction(JSContext *cx, js::HandleFunction fun,
bool singleton = false);
/* GC support. */
js::gc::AllocKind getAllocKind() const {
js::gc::AllocKind kind = FinalizeKind;
if (isExtended())
kind = ExtendedFinalizeKind;
JS_ASSERT_IF(isTenured(), kind == tenuredGetAllocKind());
return kind;
}
private:
/*
* These member functions are inherited from JSObject, but should never be applied to

Просмотреть файл

@ -286,7 +286,7 @@ ArenaHeader::checkSynchronizedWithFreeList() const
bool
js::gc::Cell::isTenured() const
{
return !IsInsideNursery(runtime(), this);
return true;
}
#endif
@ -1843,7 +1843,7 @@ void
GCMarker::checkZone(void *p)
{
JS_ASSERT(started);
JS_ASSERT(static_cast<Cell *>(p)->tenuredZone()->isCollecting());
JS_ASSERT(static_cast<Cell *>(p)->zone()->isCollecting());
}
#endif
@ -1915,7 +1915,7 @@ GCMarker::appendGrayRoot(void *thing, JSGCTraceKind kind)
root.debugPrintIndex = debugPrintIndex;
#endif
Zone *zone = static_cast<Cell *>(thing)->tenuredZone();
Zone *zone = static_cast<Cell *>(thing)->zone();
if (zone->isCollecting()) {
zone->maybeAlive = true;
if (!zone->gcGrayRoots.append(root)) {
@ -2726,8 +2726,8 @@ CheckCompartmentCallback(JSTracer *trcArg, void **thingp, JSGCTraceKind kind)
if (comp && trc->compartment) {
CheckCompartment(trc, comp, thing, kind);
} else {
JS_ASSERT(thing->tenuredZone() == trc->zone ||
thing->tenuredZone() == trc->runtime->atomsCompartment->zone());
JS_ASSERT(thing->zone() == trc->zone ||
thing->zone() == trc->runtime->atomsCompartment->zone());
}
}
@ -2907,7 +2907,7 @@ BeginMarkPhase(JSRuntime *rt)
for (CompartmentsIter c(rt); !c.done(); c.next()) {
for (JSCompartment::WrapperEnum e(c); !e.empty(); e.popFront()) {
Cell *dst = e.front().key.wrapped;
dst->tenuredZone()->maybeAlive = true;
dst->zone()->maybeAlive = true;
}
}
@ -3284,7 +3284,7 @@ JSCompartment::findOutgoingEdges(ComponentFinder<JS::Zone> &finder)
* after wrapped compartment.
*/
if (!other->isMarked(BLACK) || other->isMarked(GRAY)) {
JS::Zone *w = other->tenuredZone();
JS::Zone *w = other->zone();
if (w->isGCMarking())
finder.addEdgeTo(w);
}
@ -3297,7 +3297,7 @@ JSCompartment::findOutgoingEdges(ComponentFinder<JS::Zone> &finder)
* with call to Debugger::findCompartmentEdges below) that debugger
* and debuggee objects are always swept in the same group.
*/
JS::Zone *w = other->tenuredZone();
JS::Zone *w = other->zone();
if (w->isGCMarking())
finder.addEdgeTo(w);
}

Просмотреть файл

@ -203,7 +203,7 @@ GetGCThingTraceKind(const void *thing)
if (IsInsideNursery(cell->runtime(), cell))
return JSTRACE_OBJECT;
#endif
return MapAllocToTraceKind(cell->tenuredGetAllocKind());
return MapAllocToTraceKind(cell->getAllocKind());
}
static inline void

Просмотреть файл

@ -1082,8 +1082,6 @@ struct TypeObject : gc::Cell
*/
void finalize(FreeOp *fop) {}
JS::Zone *zone() const { return tenuredZone(); }
static inline void writeBarrierPre(TypeObject *type);
static inline void writeBarrierPost(TypeObject *type, void *addr);
static inline void readBarrier(TypeObject *type);

Просмотреть файл

@ -235,7 +235,7 @@ JSObject::finalize(js::FreeOp *fop)
js::Probes::finalizeObject(this);
#ifdef DEBUG
if (isTenured() && !IsBackgroundFinalized(tenuredGetAllocKind())) {
if (!IsBackgroundFinalized(getAllocKind())) {
/* Assert we're on the main thread. */
fop->runtime()->assertValidThread();
}
@ -1085,7 +1085,7 @@ JSObject::hasShapeTable() const
inline size_t
JSObject::computedSizeOfThisSlotsElements() const
{
size_t n = js::gc::Arena::thingSize(js::gc::GetGCObjectFixedSlotsKind(numFixedSlots()));
size_t n = sizeOfThis();
if (hasDynamicSlots())
n += numDynamicSlots() * sizeof(js::Value);
@ -1721,7 +1721,7 @@ CopyInitializerObject(JSContext *cx, HandleObject baseobj, NewObjectKind newKind
gc::AllocKind allocKind = gc::GetGCObjectFixedSlotsKind(baseobj->numFixedSlots());
allocKind = gc::GetBackgroundAllocKind(allocKind);
JS_ASSERT_IF(baseobj->isTenured(), allocKind == baseobj->getAllocKind());
JS_ASSERT(allocKind == baseobj->getAllocKind());
RootedObject obj(cx);
obj = NewBuiltinClassInstance(cx, &ObjectClass, allocKind, newKind);
if (!obj)

Просмотреть файл

@ -77,7 +77,7 @@ class JS_FRIEND_API(BaseProxyHandler) {
return false;
}
virtual bool finalizeInBackground(Value priv) {
virtual bool finalizeInBackground(HandleValue priv) {
/*
* Called on creation of a proxy to determine whether its finalize
* method can be finalized on the background thread.

Просмотреть файл

@ -952,8 +952,6 @@ class JSScript : public js::gc::Cell
void finalize(js::FreeOp *fop);
JS::Zone *zone() const { return tenuredZone(); }
static inline void writeBarrierPre(js::RawScript script);
static inline void writeBarrierPost(js::RawScript script, void *addr);

Просмотреть файл

@ -206,7 +206,7 @@ CrossCompartmentWrapper::~CrossCompartmentWrapper()
{
}
bool CrossCompartmentWrapper::finalizeInBackground(Value priv)
bool CrossCompartmentWrapper::finalizeInBackground(HandleValue priv)
{
if (!priv.isObject())
return true;
@ -215,9 +215,7 @@ bool CrossCompartmentWrapper::finalizeInBackground(Value priv)
* Make the 'background-finalized-ness' of the wrapper the same as the
* wrapped object, to allow transplanting between them.
*/
if (IsInsideNursery(priv.toObject().runtime(), &priv.toObject()))
return false;
return IsBackgroundFinalized(priv.toObject().tenuredGetAllocKind());
return IsBackgroundFinalized(priv.toObject().getAllocKind());
}
#define PIERCE(cx, wrapper, pre, op, post) \
@ -849,8 +847,8 @@ NukeSlot(JSObject *wrapper, uint32_t slot, Value v)
{
Value old = wrapper->getSlot(slot);
if (old.isMarkable()) {
Zone *zone = ZoneOfValue(old);
AutoMarkInDeadZone amd(zone);
Cell *cell = static_cast<Cell *>(old.toGCThing());
AutoMarkInDeadZone amd(cell->zone());
wrapper->setReservedSlot(slot, v);
} else {
wrapper->setReservedSlot(slot, v);

Просмотреть файл

@ -83,7 +83,7 @@ class JS_FRIEND_API(CrossCompartmentWrapper) : public Wrapper
virtual ~CrossCompartmentWrapper();
virtual bool finalizeInBackground(Value priv) MOZ_OVERRIDE;
virtual bool finalizeInBackground(HandleValue priv) MOZ_OVERRIDE;
/* ES5 Harmony fundamental wrapper traps. */
virtual bool getPropertyDescriptor(JSContext *cx, JSObject *wrapper, jsid id,

Просмотреть файл

@ -317,21 +317,6 @@ js::ObjectImpl::sizeOfThis() const
return js::gc::Arena::thingSize(getAllocKind());
}
JS_ALWAYS_INLINE JS::Zone *
js::ObjectImpl::zone() const
{
return shape_->zone();
}
JS_ALWAYS_INLINE JS::Zone *
ZoneOfValue(const JS::Value &value)
{
JS_ASSERT(value.isMarkable());
if (value.isObject())
return value.toObject().zone();
return static_cast<js::gc::Cell *>(value.toGCThing())->tenuredZone();
}
/* static */ inline void
js::ObjectImpl::readBarrier(ObjectImpl *obj)
{

Просмотреть файл

@ -325,33 +325,6 @@ js::ObjectImpl::markChildren(JSTracer *trc)
}
}
gc::AllocKind
js::ObjectImpl::getAllocKind() const
{
gc::AllocKind allocKind;
if (asObjectPtr()->isArray()) {
JS_ASSERT(isTenured());
allocKind = tenuredGetAllocKind();
} else if (asObjectPtr()->isFunction()) {
allocKind = asObjectPtr()->toFunction()->getAllocKind();
} else if (asObjectPtr()->isProxy()) {
BaseProxyHandler *handler =
static_cast<BaseProxyHandler *>(getSlot(JSSLOT_PROXY_HANDLER).toPrivate());
Value priv = getSlot(JSSLOT_PROXY_PRIVATE);
allocKind = gc::GetGCObjectKind(getClass());
if (handler->finalizeInBackground(priv))
allocKind = GetBackgroundAllocKind(allocKind);
} else {
Class *clasp = getClass();
allocKind = gc::GetGCObjectFixedSlotsKind(numFixedSlots());
JS_ASSERT(!IsBackgroundFinalized(allocKind));
if (CanBeFinalizedInBackground(allocKind, clasp))
allocKind = GetBackgroundAllocKind(allocKind);
}
JS_ASSERT_IF(isTenured(), allocKind == tenuredGetAllocKind());
return allocKind;
}
bool
DenseElementsHeader::getOwnElement(JSContext *cx, Handle<ObjectImpl*> obj, uint32_t index,
unsigned resolveFlags, PropDesc *desc)

Просмотреть файл

@ -1094,7 +1094,6 @@ class ObjectImpl : public gc::Cell
}
JSObject * asObjectPtr() { return reinterpret_cast<JSObject *>(this); }
const JSObject * asObjectPtr() const { return reinterpret_cast<const JSObject *>(this); }
friend inline Value ObjectValue(ObjectImpl &obj);
@ -1371,8 +1370,6 @@ class ObjectImpl : public gc::Cell
}
/* GC support. */
JS_ALWAYS_INLINE Zone *zone() const;
gc::AllocKind getAllocKind() const;
static inline ThingRootKind rootKind() { return THING_ROOT_OBJECT; }
static inline void readBarrier(ObjectImpl *obj);
static inline void writeBarrierPre(ObjectImpl *obj);

Просмотреть файл

@ -106,17 +106,15 @@ BaseShape::operator=(const BaseShape &other)
getterObj = other.getterObj;
GetterSetterWriteBarrierPost(runtime(), &getterObj);
} else {
if (rawGetter)
GetterSetterWriteBarrierPostRemove(runtime(), &getterObj);
rawGetter = other.rawGetter;
GetterSetterWriteBarrierPostRemove(runtime(), &getterObj);
}
if (flags & HAS_SETTER_OBJECT) {
setterObj = other.setterObj;
GetterSetterWriteBarrierPost(runtime(), &setterObj);
} else {
if (rawSetter)
GetterSetterWriteBarrierPostRemove(runtime(), &setterObj);
rawSetter = other.rawSetter;
GetterSetterWriteBarrierPostRemove(runtime(), &setterObj);
}
compartment_ = other.compartment_;
return *this;

Просмотреть файл

@ -333,7 +333,6 @@ class BaseShape : public js::gc::Cell
void setSlotSpan(uint32_t slotSpan) { JS_ASSERT(isOwned()); slotSpan_ = slotSpan; }
JSCompartment *compartment() const { return compartment_; }
JS::Zone *zone() const { return tenuredZone(); }
/* Lookup base shapes from the compartment's baseShapes table. */
static UnownedBaseShape* getUnowned(JSContext *cx, const StackBaseShape &base);
@ -817,8 +816,6 @@ class Shape : public js::gc::Cell
void finalize(FreeOp *fop);
void removeChild(RawShape child);
JS::Zone *zone() const { return tenuredZone(); }
static inline void writeBarrierPre(RawShape shape);
static inline void writeBarrierPost(RawShape shape, void *addr);

Просмотреть файл

@ -414,9 +414,6 @@ class JSString : public js::gc::Cell
return offsetof(JSString, d.u1.chars);
}
JS::Zone *zone() const { return tenuredZone(); }
js::gc::AllocKind getAllocKind() const { return tenuredGetAllocKind(); }
static inline void writeBarrierPre(JSString *str);
static inline void writeBarrierPost(JSString *str, void *addr);
static inline bool needWriteBarrierPre(JS::Zone *zone);