Bug 1149352 - Part 2: Move Shape marking to TraceEdge; r=jonco

This commit is contained in:
Terrence Cole 2015-03-30 15:14:23 -07:00
parent 7512eda786
commit e7e6976183
17 changed files with 47 additions and 49 deletions

View File

@ -1628,7 +1628,7 @@ OutlineTypedObject::obj_trace(JSTracer* trc, JSObject* object)
{
OutlineTypedObject& typedObj = object->as<OutlineTypedObject>();
MarkShape(trc, &typedObj.shape_, "OutlineTypedObject_shape");
TraceEdge(trc, &typedObj.shape_, "OutlineTypedObject_shape");
if (!typedObj.owner_)
return;
@ -2141,7 +2141,7 @@ InlineTypedObject::obj_trace(JSTracer* trc, JSObject* object)
{
InlineTypedObject& typedObj = object->as<InlineTypedObject>();
MarkShape(trc, &typedObj.shape_, "InlineTypedObject_shape");
TraceEdge(trc, &typedObj.shape_, "InlineTypedObject_shape");
// Inline transparent objects do not have references and do not need more
// tracing. If there is an entry in the compartment's LazyArrayBufferTable,

View File

@ -1114,7 +1114,6 @@ DeclMarkerImpl(Object, SharedArrayBufferObject)
DeclMarkerImpl(Object, SharedTypedArrayObject)
DeclMarkerImpl(Script, JSScript)
DeclMarkerImpl(LazyScript, LazyScript)
DeclMarkerImpl(Shape, Shape)
DeclMarkerImpl(String, JSAtom)
DeclMarkerImpl(String, JSString)
DeclMarkerImpl(String, JSFlatString)

View File

@ -162,7 +162,6 @@ DeclMarker(Object, SharedArrayBufferObject)
DeclMarker(Object, SharedTypedArrayObject)
DeclMarker(Script, JSScript)
DeclMarker(LazyScript, LazyScript)
DeclMarker(Shape, Shape)
DeclMarker(String, JSAtom)
DeclMarker(String, JSString)
DeclMarker(String, JSFlatString)

View File

@ -95,7 +95,7 @@ static void
MarkExactStackRootsAcrossTypes(T context, JSTracer* trc)
{
MarkExactStackRootList<JSObject*, MarkObjectRoot>(trc, context, "exact-object");
MarkExactStackRootList<Shape*, MarkShapeRoot>(trc, context, "exact-shape");
MarkExactStackRootList<Shape*, TraceRoot>(trc, context, "exact-shape");
MarkExactStackRootList<BaseShape*, TraceRoot>(trc, context, "exact-baseshape");
MarkExactStackRootList<ObjectGroup*, MarkObjectGroupRoot>(
trc, context, "exact-objectgroup");
@ -172,8 +172,8 @@ AutoGCRooter::trace(JSTracer* trc)
case SHAPEVECTOR: {
AutoShapeVector::VectorImpl& vector = static_cast<js::AutoShapeVector*>(this)->vector;
MarkShapeRootRange(trc, vector.length(), const_cast<Shape**>(vector.begin()),
"js::AutoShapeVector.vector");
TraceRootRange(trc, vector.length(), const_cast<Shape**>(vector.begin()),
"js::AutoShapeVector.vector");
return;
}

View File

@ -169,7 +169,7 @@ void
ReceiverGuard::trace(JSTracer* trc)
{
if (shape_)
MarkShape(trc, &shape_, "receiver_guard_shape");
TraceEdge(trc, &shape_, "receiver_guard_shape");
else
MarkObjectGroup(trc, &group_, "receiver_guard_group");
}
@ -228,42 +228,42 @@ ICStub::trace(JSTracer* trc)
}
case ICStub::GetElem_NativeSlot: {
ICGetElem_NativeSlot* getElemStub = toGetElem_NativeSlot();
MarkShape(trc, &getElemStub->shape(), "baseline-getelem-native-shape");
TraceEdge(trc, &getElemStub->shape(), "baseline-getelem-native-shape");
MarkString(trc, &getElemStub->name(), "baseline-getelem-native-name");
break;
}
case ICStub::GetElem_NativePrototypeSlot: {
ICGetElem_NativePrototypeSlot* getElemStub = toGetElem_NativePrototypeSlot();
MarkShape(trc, &getElemStub->shape(), "baseline-getelem-nativeproto-shape");
TraceEdge(trc, &getElemStub->shape(), "baseline-getelem-nativeproto-shape");
MarkString(trc, &getElemStub->name(), "baseline-getelem-nativeproto-name");
MarkObject(trc, &getElemStub->holder(), "baseline-getelem-nativeproto-holder");
MarkShape(trc, &getElemStub->holderShape(), "baseline-getelem-nativeproto-holdershape");
TraceEdge(trc, &getElemStub->holderShape(), "baseline-getelem-nativeproto-holdershape");
break;
}
case ICStub::GetElem_NativePrototypeCallNative:
case ICStub::GetElem_NativePrototypeCallScripted: {
ICGetElemNativePrototypeCallStub* callStub =
reinterpret_cast<ICGetElemNativePrototypeCallStub*>(this);
MarkShape(trc, &callStub->shape(), "baseline-getelem-nativeprotocall-shape");
TraceEdge(trc, &callStub->shape(), "baseline-getelem-nativeprotocall-shape");
MarkString(trc, &callStub->name(), "baseline-getelem-nativeprotocall-name");
MarkObject(trc, &callStub->getter(), "baseline-getelem-nativeprotocall-getter");
MarkObject(trc, &callStub->holder(), "baseline-getelem-nativeprotocall-holder");
MarkShape(trc, &callStub->holderShape(), "baseline-getelem-nativeprotocall-holdershape");
TraceEdge(trc, &callStub->holderShape(), "baseline-getelem-nativeprotocall-holdershape");
break;
}
case ICStub::GetElem_Dense: {
ICGetElem_Dense* getElemStub = toGetElem_Dense();
MarkShape(trc, &getElemStub->shape(), "baseline-getelem-dense-shape");
TraceEdge(trc, &getElemStub->shape(), "baseline-getelem-dense-shape");
break;
}
case ICStub::GetElem_TypedArray: {
ICGetElem_TypedArray* getElemStub = toGetElem_TypedArray();
MarkShape(trc, &getElemStub->shape(), "baseline-getelem-typedarray-shape");
TraceEdge(trc, &getElemStub->shape(), "baseline-getelem-typedarray-shape");
break;
}
case ICStub::SetElem_Dense: {
ICSetElem_Dense* setElemStub = toSetElem_Dense();
MarkShape(trc, &setElemStub->shape(), "baseline-getelem-dense-shape");
TraceEdge(trc, &setElemStub->shape(), "baseline-getelem-dense-shape");
MarkObjectGroup(trc, &setElemStub->group(), "baseline-setelem-dense-group");
break;
}
@ -285,7 +285,7 @@ ICStub::trace(JSTracer* trc)
}
case ICStub::SetElem_TypedArray: {
ICSetElem_TypedArray* setElemStub = toSetElem_TypedArray();
MarkShape(trc, &setElemStub->shape(), "baseline-setelem-typedarray-shape");
TraceEdge(trc, &setElemStub->shape(), "baseline-setelem-typedarray-shape");
break;
}
case ICStub::TypeMonitor_SingleObject: {
@ -310,7 +310,7 @@ ICStub::trace(JSTracer* trc)
}
case ICStub::GetName_Global: {
ICGetName_Global* globalStub = toGetName_Global();
MarkShape(trc, &globalStub->shape(), "baseline-global-stub-shape");
TraceEdge(trc, &globalStub->shape(), "baseline-global-stub-shape");
break;
}
case ICStub::GetName_Scope0:
@ -341,7 +341,7 @@ ICStub::trace(JSTracer* trc)
}
case ICStub::GetProp_Primitive: {
ICGetProp_Primitive* propStub = toGetProp_Primitive();
MarkShape(trc, &propStub->protoShape(), "baseline-getprop-primitive-stub-shape");
TraceEdge(trc, &propStub->protoShape(), "baseline-getprop-primitive-stub-shape");
break;
}
case ICStub::GetProp_Native: {
@ -353,7 +353,7 @@ ICStub::trace(JSTracer* trc)
ICGetProp_NativePrototype* propStub = toGetProp_NativePrototype();
propStub->receiverGuard().trace(trc);
MarkObject(trc, &propStub->holder(), "baseline-getpropnativeproto-stub-holder");
MarkShape(trc, &propStub->holderShape(), "baseline-getpropnativeproto-stub-holdershape");
TraceEdge(trc, &propStub->holderShape(), "baseline-getpropnativeproto-stub-holdershape");
break;
}
case ICStub::GetProp_NativeDoesNotExist: {
@ -381,7 +381,7 @@ ICStub::trace(JSTracer* trc)
}
case ICStub::GetProp_TypedObject: {
ICGetProp_TypedObject* propStub = toGetProp_TypedObject();
MarkShape(trc, &propStub->shape(), "baseline-getprop-typedobject-stub-shape");
TraceEdge(trc, &propStub->shape(), "baseline-getprop-typedobject-stub-shape");
break;
}
case ICStub::GetProp_CallDOMProxyNative:
@ -393,17 +393,17 @@ ICStub::trace(JSTracer* trc)
propStub = toGetProp_CallDOMProxyWithGenerationNative();
propStub->receiverGuard().trace(trc);
if (propStub->expandoShape()) {
MarkShape(trc, &propStub->expandoShape(),
TraceEdge(trc, &propStub->expandoShape(),
"baseline-getproplistbasenative-stub-expandoshape");
}
MarkObject(trc, &propStub->holder(), "baseline-getproplistbasenative-stub-holder");
MarkShape(trc, &propStub->holderShape(), "baseline-getproplistbasenative-stub-holdershape");
TraceEdge(trc, &propStub->holderShape(), "baseline-getproplistbasenative-stub-holdershape");
MarkObject(trc, &propStub->getter(), "baseline-getproplistbasenative-stub-getter");
break;
}
case ICStub::GetProp_DOMProxyShadowed: {
ICGetProp_DOMProxyShadowed* propStub = toGetProp_DOMProxyShadowed();
MarkShape(trc, &propStub->shape(), "baseline-getproplistbaseshadowed-stub-shape");
TraceEdge(trc, &propStub->shape(), "baseline-getproplistbaseshadowed-stub-shape");
MarkString(trc, &propStub->name(), "baseline-getproplistbaseshadowed-stub-name");
break;
}
@ -411,7 +411,7 @@ ICStub::trace(JSTracer* trc)
ICGetProp_CallScripted* callStub = toGetProp_CallScripted();
callStub->receiverGuard().trace(trc);
MarkObject(trc, &callStub->holder(), "baseline-getpropcallscripted-stub-holder");
MarkShape(trc, &callStub->holderShape(), "baseline-getpropcallscripted-stub-holdershape");
TraceEdge(trc, &callStub->holderShape(), "baseline-getpropcallscripted-stub-holdershape");
MarkObject(trc, &callStub->getter(), "baseline-getpropcallscripted-stub-getter");
break;
}
@ -419,20 +419,20 @@ ICStub::trace(JSTracer* trc)
ICGetProp_CallNative* callStub = toGetProp_CallNative();
callStub->receiverGuard().trace(trc);
MarkObject(trc, &callStub->holder(), "baseline-getpropcallnative-stub-holder");
MarkShape(trc, &callStub->holderShape(), "baseline-getpropcallnative-stub-holdershape");
TraceEdge(trc, &callStub->holderShape(), "baseline-getpropcallnative-stub-holdershape");
MarkObject(trc, &callStub->getter(), "baseline-getpropcallnative-stub-getter");
break;
}
case ICStub::SetProp_Native: {
ICSetProp_Native* propStub = toSetProp_Native();
MarkShape(trc, &propStub->shape(), "baseline-setpropnative-stub-shape");
TraceEdge(trc, &propStub->shape(), "baseline-setpropnative-stub-shape");
MarkObjectGroup(trc, &propStub->group(), "baseline-setpropnative-stub-group");
break;
}
case ICStub::SetProp_NativeAdd: {
ICSetProp_NativeAdd* propStub = toSetProp_NativeAdd();
MarkObjectGroup(trc, &propStub->group(), "baseline-setpropnativeadd-stub-group");
MarkShape(trc, &propStub->newShape(), "baseline-setpropnativeadd-stub-newshape");
TraceEdge(trc, &propStub->newShape(), "baseline-setpropnativeadd-stub-newshape");
if (propStub->newGroup())
MarkObjectGroup(trc, &propStub->newGroup(), "baseline-setpropnativeadd-stub-new-group");
JS_STATIC_ASSERT(ICSetProp_NativeAdd::MAX_PROTO_CHAIN_DEPTH == 4);
@ -453,7 +453,7 @@ ICStub::trace(JSTracer* trc)
}
case ICStub::SetProp_TypedObject: {
ICSetProp_TypedObject* propStub = toSetProp_TypedObject();
MarkShape(trc, &propStub->shape(), "baseline-setprop-typedobject-stub-shape");
TraceEdge(trc, &propStub->shape(), "baseline-setprop-typedobject-stub-shape");
MarkObjectGroup(trc, &propStub->group(), "baseline-setprop-typedobject-stub-group");
break;
}
@ -461,7 +461,7 @@ ICStub::trace(JSTracer* trc)
ICSetProp_CallScripted* callStub = toSetProp_CallScripted();
callStub->guard().trace(trc);
MarkObject(trc, &callStub->holder(), "baseline-setpropcallscripted-stub-holder");
MarkShape(trc, &callStub->holderShape(), "baseline-setpropcallscripted-stub-holdershape");
TraceEdge(trc, &callStub->holderShape(), "baseline-setpropcallscripted-stub-holdershape");
MarkObject(trc, &callStub->setter(), "baseline-setpropcallscripted-stub-setter");
break;
}
@ -469,13 +469,13 @@ ICStub::trace(JSTracer* trc)
ICSetProp_CallNative* callStub = toSetProp_CallNative();
callStub->guard().trace(trc);
MarkObject(trc, &callStub->holder(), "baseline-setpropcallnative-stub-holder");
MarkShape(trc, &callStub->holderShape(), "baseline-setpropcallnative-stub-holdershape");
TraceEdge(trc, &callStub->holderShape(), "baseline-setpropcallnative-stub-holdershape");
MarkObject(trc, &callStub->setter(), "baseline-setpropcallnative-stub-setter");
break;
}
case ICStub::InstanceOf_Function: {
ICInstanceOf_Function* instanceofStub = toInstanceOf_Function();
MarkShape(trc, &instanceofStub->shape(), "baseline-instanceof-fun-shape");
TraceEdge(trc, &instanceofStub->shape(), "baseline-instanceof-fun-shape");
MarkObject(trc, &instanceofStub->prototypeObject(), "baseline-instanceof-fun-prototype");
break;
}

View File

@ -3291,7 +3291,7 @@ class ICSetElem_DenseAddImpl : public ICSetElem_DenseAdd
public:
void traceShapes(JSTracer* trc) {
for (size_t i = 0; i < NumShapes; i++)
MarkShape(trc, &shapes_[i], "baseline-setelem-denseadd-stub-shape");
TraceEdge(trc, &shapes_[i], "baseline-setelem-denseadd-stub-shape");
}
Shape* shape(size_t i) const {
MOZ_ASSERT(i < NumShapes);
@ -3521,7 +3521,7 @@ class ICGetName_Scope : public ICMonitoredStub
public:
void traceScopes(JSTracer* trc) {
for (size_t i = 0; i < NumHops + 1; i++)
MarkShape(trc, &shapes_[i], "baseline-scope-stub-shape");
TraceEdge(trc, &shapes_[i], "baseline-scope-stub-shape");
}
static size_t offsetOfShape(size_t index) {
@ -4145,7 +4145,7 @@ class ICGetProp_NativeDoesNotExistImpl : public ICGetProp_NativeDoesNotExist
void traceShapes(JSTracer* trc) {
// Note: using int32_t here to avoid gcc warning.
for (int32_t i = 0; i < int32_t(NumShapes); i++)
MarkShape(trc, &shapes_[i], "baseline-getpropnativedoesnotexist-stub-shape");
TraceEdge(trc, &shapes_[i], "baseline-getpropnativedoesnotexist-stub-shape");
}
static size_t offsetOfShape(size_t idx) {
@ -4890,7 +4890,7 @@ class ICSetProp_NativeAddImpl : public ICSetProp_NativeAdd
public:
void traceShapes(JSTracer* trc) {
for (size_t i = 0; i < NumShapes; i++)
MarkShape(trc, &shapes_[i], "baseline-setpropnativeadd-stub-shape");
TraceEdge(trc, &shapes_[i], "baseline-setpropnativeadd-stub-shape");
}
static size_t offsetOfShape(size_t idx) {

View File

@ -1265,7 +1265,7 @@ MarkObjectFromIon(JSRuntime* rt, JSObject** objp)
void
MarkShapeFromIon(JSRuntime* rt, Shape** shapep)
{
gc::MarkShapeUnbarriered(&rt->gc.marker, shapep, "write barrier");
TraceManuallyBarrieredEdge(&rt->gc.marker, shapep, "write barrier");
}
void

View File

@ -3969,7 +3969,7 @@ JSObject::markChildren(JSTracer* trc)
if (clasp->isNative()) {
NativeObject* nobj = &as<NativeObject>();
MarkShape(trc, &nobj->shape_, "shape");
TraceEdge(trc, &nobj->shape_, "shape");
MarkObjectSlots(trc, nobj, 0, nobj->slotSpan());

View File

@ -161,7 +161,7 @@ PropertyTree::getChild(ExclusiveContext* cx, Shape* parentArg, StackShape& unroo
* pointers.
*/
Shape* tmp = existingShape;
MarkShapeUnbarriered(zone->barrierTracer(), &tmp, "read barrier");
TraceManuallyBarrieredEdge(zone->barrierTracer(), &tmp, "read barrier");
MOZ_ASSERT(tmp == existingShape);
} else if (zone->isGCSweeping() && !existingShape->isMarked() &&
!existingShape->arenaHeader()->allocatedDuringIncremental)

View File

@ -310,7 +310,7 @@ void
Bindings::trace(JSTracer* trc)
{
if (callObjShape_)
MarkShape(trc, &callObjShape_, "callObjShape");
TraceEdge(trc, &callObjShape_, "callObjShape");
/*
* As the comment in Bindings explains, bindingsArray may point into freed

View File

@ -613,7 +613,7 @@ ProxyObject::trace(JSTracer* trc, JSObject* obj)
{
ProxyObject* proxy = &obj->as<ProxyObject>();
MarkShape(trc, &proxy->shape, "ProxyObject_shape");
TraceEdge(trc, &proxy->shape, "ProxyObject_shape");
#ifdef DEBUG
if (trc->runtime()->gc.isStrictProxyCheckingEnabled() && proxy->is<WrapperObject>()) {

View File

@ -1433,7 +1433,7 @@ ObjectGroupCompartment::sweep(FreeOp* fop)
bool remove = false;
if (IsObjectGroupAboutToBeFinalized(entry.group.unsafeGet()))
remove = true;
if (IsShapeAboutToBeFinalized(entry.shape.unsafeGet()))
if (IsAboutToBeFinalized(&entry.shape))
remove = true;
for (unsigned i = 0; !remove && i < key.nproperties; i++) {
if (JSID_IS_STRING(key.properties[i])) {

View File

@ -257,8 +257,8 @@ js::ForOfPIC::Chain::mark(JSTracer* trc)
gc::MarkObject(trc, &arrayProto_, "ForOfPIC Array.prototype.");
gc::MarkObject(trc, &arrayIteratorProto_, "ForOfPIC ArrayIterator.prototype.");
gc::MarkShape(trc, &arrayProtoShape_, "ForOfPIC Array.prototype shape.");
gc::MarkShape(trc, &arrayIteratorProtoShape_, "ForOfPIC ArrayIterator.prototype shape.");
TraceEdge(trc, &arrayProtoShape_, "ForOfPIC Array.prototype shape.");
TraceEdge(trc, &arrayIteratorProtoShape_, "ForOfPIC ArrayIterator.prototype shape.");
TraceEdge(trc, &canonicalIteratorFunc_, "ForOfPIC ArrayValues builtin.");
TraceEdge(trc, &canonicalNextFunc_, "ForOfPIC ArrayIterator.prototype.next builtin.");

View File

@ -1537,7 +1537,7 @@ JSCompartment::sweepInitialShapeTable()
const InitialShapeEntry& entry = e.front();
Shape* shape = entry.shape.unbarrieredGet();
JSObject* proto = entry.proto.raw();
if (IsShapeAboutToBeFinalized(&shape) ||
if (IsAboutToBeFinalizedUnbarriered(&shape) ||
(entry.proto.isObject() && IsObjectAboutToBeFinalized(&proto)))
{
e.removeFront();

View File

@ -1363,7 +1363,7 @@ Shape::markChildren(JSTracer* trc)
TraceEdge(trc, &base_, "base");
TraceEdge(trc, &propidRef(), "propid");
if (parent)
MarkShape(trc, &parent, "parent");
TraceEdge(trc, &parent, "parent");
if (hasGetterObject())
gc::MarkObjectUnbarriered(trc, &asAccessorShape().getterObj, "getter");

View File

@ -3337,7 +3337,7 @@ PreliminaryObjectArray::sweep()
void
PreliminaryObjectArrayWithTemplate::trace(JSTracer* trc)
{
MarkShape(trc, &shape_, "PreliminaryObjectArrayWithTemplate_shape");
TraceEdge(trc, &shape_, "PreliminaryObjectArrayWithTemplate_shape");
}
/* static */ void
@ -3886,7 +3886,7 @@ TypeNewScript::trace(JSTracer* trc)
MarkObject(trc, &templateObject_, "TypeNewScript_templateObject");
if (initializedShape_)
MarkShape(trc, &initializedShape_, "TypeNewScript_initializedShape");
TraceEdge(trc, &initializedShape_, "TypeNewScript_initializedShape");
if (initializedGroup_)
MarkObjectGroup(trc, &initializedGroup_, "TypeNewScript_initializedGroup");

View File

@ -37,7 +37,7 @@ UnboxedLayout::trace(JSTracer* trc)
MarkObjectGroup(trc, &nativeGroup_, "unboxed_layout_nativeGroup");
if (nativeShape_)
MarkShape(trc, &nativeShape_, "unboxed_layout_nativeShape");
TraceEdge(trc, &nativeShape_, "unboxed_layout_nativeShape");
if (replacementNewGroup_)
MarkObjectGroup(trc, &replacementNewGroup_, "unboxed_layout_replacementNewGroup");