[INFER] Spot fix for shapes not being marked when a child is held by AutoShapeRooter, bug 642209.

This commit is contained in:
Brian Hackett 2011-03-16 18:24:20 -07:00
parent 293ec73b3d
commit f5e8d2edbd
9 changed files with 27 additions and 27 deletions

View File

@ -4103,7 +4103,7 @@ prop_iter_trace(JSTracer *trc, JSObject *obj)
if (obj->getSlot(JSSLOT_ITER_INDEX).toInt32() < 0) { if (obj->getSlot(JSSLOT_ITER_INDEX).toInt32() < 0) {
/* Native case: just mark the next property to visit. */ /* Native case: just mark the next property to visit. */
((Shape *) pdata)->trace(trc); Shape::trace(trc, (Shape *) pdata);
} else { } else {
/* Non-native case: mark each id in the JSIdArray private. */ /* Non-native case: mark each id in the JSIdArray private. */
JSIdArray *ida = (JSIdArray *) pdata; JSIdArray *ida = (JSIdArray *) pdata;

View File

@ -651,7 +651,7 @@ js_TraceWatchPoints(JSTracer *trc)
if (wp->object->isMarked()) { if (wp->object->isMarked()) {
if (!wp->shape->marked()) { if (!wp->shape->marked()) {
modified = true; modified = true;
wp->shape->trace(trc); Shape::trace(trc, wp->shape);
} }
if (wp->shape->hasSetterValue() && wp->setter) { if (wp->shape->hasSetterValue() && wp->setter) {
if (!CastAsObject(wp->setter)->isMarked()) { if (!CastAsObject(wp->setter)->isMarked()) {

View File

@ -1517,7 +1517,7 @@ AutoGCRooter::trace(JSTracer *trc)
return; return;
case SHAPE: case SHAPE:
static_cast<AutoShapeRooter *>(this)->shape->trace(trc); Shape::trace(trc, static_cast<AutoShapeRooter *>(this)->shape);
return; return;
case PARSER: case PARSER:

View File

@ -641,7 +641,7 @@ MarkShapeRange(JSTracer *trc, const Shape **beg, const Shape **end, const char *
{ {
for (const Shape **sp = beg; sp < end; ++sp) { for (const Shape **sp = beg; sp < end; ++sp) {
JS_SET_TRACING_INDEX(trc, name, sp - beg); JS_SET_TRACING_INDEX(trc, name, sp - beg);
(*sp)->trace(trc); Shape::trace(trc, *sp);
} }
} }

View File

@ -4196,7 +4196,7 @@ types::TypeObject::trace(JSTracer *trc)
int count = gc::FINALIZE_OBJECT_LAST - gc::FINALIZE_OBJECT0 + 1; int count = gc::FINALIZE_OBJECT_LAST - gc::FINALIZE_OBJECT0 + 1;
for (int i = 0; i < count; i++) { for (int i = 0; i < count; i++) {
if (emptyShapes[i]) if (emptyShapes[i])
emptyShapes[i]->trace(trc); Shape::trace(trc, emptyShapes[i]);
} }
} }

View File

@ -1423,26 +1423,28 @@ PrintPropertyMethod(JSTracer *trc, char *buf, size_t bufsize)
#endif #endif
void void
Shape::trace(JSTracer *trc) const Shape::trace(JSTracer *trc, const Shape *shape)
{ {
do {
if (IS_GC_MARKING_TRACER(trc)) if (IS_GC_MARKING_TRACER(trc))
mark(); shape->mark();
MarkId(trc, id, "id"); MarkId(trc, shape->id, "id");
if (attrs & (JSPROP_GETTER | JSPROP_SETTER)) { if (shape->attrs & (JSPROP_GETTER | JSPROP_SETTER)) {
if ((attrs & JSPROP_GETTER) && rawGetter) { if ((shape->attrs & JSPROP_GETTER) && shape->rawGetter) {
JS_SET_TRACING_DETAILS(trc, PrintPropertyGetterOrSetter, this, 0); JS_SET_TRACING_DETAILS(trc, PrintPropertyGetterOrSetter, shape, 0);
Mark(trc, getterObject()); Mark(trc, shape->getterObject());
} }
if ((attrs & JSPROP_SETTER) && rawSetter) { if ((shape->attrs & JSPROP_SETTER) && shape->rawSetter) {
JS_SET_TRACING_DETAILS(trc, PrintPropertyGetterOrSetter, this, 1); JS_SET_TRACING_DETAILS(trc, PrintPropertyGetterOrSetter, shape, 1);
Mark(trc, setterObject()); Mark(trc, shape->setterObject());
} }
} }
if (isMethod()) { if (shape->isMethod()) {
JS_SET_TRACING_DETAILS(trc, PrintPropertyMethod, this, 0); JS_SET_TRACING_DETAILS(trc, PrintPropertyMethod, shape, 0);
Mark(trc, &methodObject()); Mark(trc, &shape->methodObject());
} }
} while ((shape = shape->parent) != NULL && !shape->marked());
} }

View File

@ -592,7 +592,7 @@ struct Shape : public JSObjectMap
inline bool isSharedPermanent() const; inline bool isSharedPermanent() const;
void trace(JSTracer *trc) const; static void trace(JSTracer *trc, const Shape *shape);
bool hasSlot() const { return (attrs & JSPROP_SHARED) == 0; } bool hasSlot() const { return (attrs & JSPROP_SHARED) == 0; }

View File

@ -159,9 +159,7 @@ JSObject::trace(JSTracer *trc)
} }
/* Trace our property tree or dictionary ancestor line. */ /* Trace our property tree or dictionary ancestor line. */
do { js::Shape::trace(trc, shape);
shape->trace(trc);
} while ((shape = shape->parent) != NULL && !shape->marked());
} }
namespace js { namespace js {

View File

@ -294,7 +294,7 @@ void
Bindings::trace(JSTracer *trc) Bindings::trace(JSTracer *trc)
{ {
for (const Shape *shape = lastBinding; shape; shape = shape->previous()) for (const Shape *shape = lastBinding; shape; shape = shape->previous())
shape->trace(trc); Shape::trace(trc, shape);
} }
} /* namespace js */ } /* namespace js */