Backed out changeset e554fdb83c5f (bug 1163810) on a CLOSED TREE

This commit is contained in:
Terrence Cole 2015-05-18 13:30:43 -07:00
parent d8070e1a5e
commit 717bb9556f
3 changed files with 29 additions and 13 deletions

View File

@ -1266,7 +1266,7 @@ GCMarker::processMarkStackTop(SliceBudget& budget)
JSObject* obj2 = &v.toObject();
MOZ_ASSERT(obj->compartment() == obj2->compartment());
if (mark(obj2)) {
// Save the rest of this value array for later and start scanning obj2's children.
// Save the rest of this value array for later and start scanning obj2's children.N
pushValueArray(obj, vp, end);
obj = obj2;
goto scan_obj;

View File

@ -7162,19 +7162,40 @@ JS::IsIncrementalBarrierNeeded(JSContext* cx)
return IsIncrementalBarrierNeeded(cx->runtime());
}
struct IncrementalReferenceBarrierFunctor {
template <typename T> void operator()(gc::Cell* cell) {
T::writeBarrierPre(static_cast<T*>(cell));
}
};
JS_PUBLIC_API(void)
JS::IncrementalReferenceBarrier(GCCellPtr thing)
{
if (!thing)
return;
CallTyped(IncrementalReferenceBarrierFunctor(), thing.kind(), thing.asCell());
if (thing.isString() && thing.toString()->isPermanentAtom())
return;
#ifdef DEBUG
Zone* zone = thing.isObject()
? thing.toObject()->zone()
: thing.asCell()->asTenured().zone();
MOZ_ASSERT(!zone->runtimeFromMainThread()->isHeapMajorCollecting());
#endif
switch(thing.kind()) {
case JSTRACE_OBJECT: return JSObject::writeBarrierPre(thing.toObject());
case JSTRACE_STRING: return JSString::writeBarrierPre(thing.toString());
case JSTRACE_SCRIPT: return JSScript::writeBarrierPre(thing.toScript());
case JSTRACE_SYMBOL: return JS::Symbol::writeBarrierPre(thing.toSymbol());
case JSTRACE_LAZY_SCRIPT:
return LazyScript::writeBarrierPre(static_cast<LazyScript*>(thing.asCell()));
case JSTRACE_JITCODE:
return jit::JitCode::writeBarrierPre(static_cast<jit::JitCode*>(thing.asCell()));
case JSTRACE_SHAPE:
return Shape::writeBarrierPre(static_cast<Shape*>(thing.asCell()));
case JSTRACE_BASE_SHAPE:
return BaseShape::writeBarrierPre(static_cast<BaseShape*>(thing.asCell()));
case JSTRACE_OBJECT_GROUP:
return ObjectGroup::writeBarrierPre(static_cast<ObjectGroup*>(thing.asCell()));
default:
MOZ_CRASH("Invalid trace kind in IncrementalReferenceBarrier.");
}
}
JS_PUBLIC_API(void)

View File

@ -62,11 +62,6 @@ class Symbol : public js::gc::TenuredCell
}
inline void finalize(js::FreeOp*) {}
static MOZ_ALWAYS_INLINE void writeBarrierPre(Symbol* thing) {
if (thing && !thing->isWellKnownSymbol())
thing->asTenured().writeBarrierPre(thing);
}
#ifdef DEBUG
void dump(FILE* fp = stderr);
#endif