示例#1
0
void
Shape::fixupShapeTreeAfterMovingGC()
{
    if (kids.isNull())
        return;

    if (kids.isShape()) {
        if (gc::IsForwarded(kids.toShape()))
            kids.setShape(gc::Forwarded(kids.toShape()));
        return;
    }

    JS_ASSERT(kids.isHash());
    KidsHash *kh = kids.toHash();
    for (KidsHash::Enum e(*kh); !e.empty(); e.popFront()) {
        Shape *key = e.front();
        if (!IsForwarded(key))
            continue;

        key = Forwarded(key);
        BaseShape *base = key->base();
        if (IsForwarded(base))
            base = Forwarded(base);
        UnownedBaseShape *unowned = base->unowned();
        if (IsForwarded(unowned))
            unowned = Forwarded(unowned);
        StackShape lookup(unowned,
                          const_cast<Shape *>(key)->propidRef(),
                          key->slotInfo & Shape::SLOT_MASK,
                          key->attrs,
                          key->flags);
        e.rekeyFront(lookup, key);
    }
}
示例#2
0
void
Shape::fixupShapeTreeAfterMovingGC()
{
    if (kids.isNull())
        return;

    if (kids.isShape()) {
        if (gc::IsForwarded(kids.toShape()))
            kids.setShape(gc::Forwarded(kids.toShape()));
        return;
    }

    MOZ_ASSERT(kids.isHash());
    KidsHash *kh = kids.toHash();
    for (KidsHash::Enum e(*kh); !e.empty(); e.popFront()) {
        Shape *key = e.front();
        if (IsForwarded(key))
            key = Forwarded(key);

        BaseShape *base = key->base();
        if (IsForwarded(base))
            base = Forwarded(base);
        UnownedBaseShape *unowned = base->unowned();
        if (IsForwarded(unowned))
            unowned = Forwarded(unowned);

        PropertyOp getter = key->getter();
        if (key->hasGetterObject())
            getter = PropertyOp(MaybeForwarded(key->getterObject()));

        StrictPropertyOp setter = key->setter();
        if (key->hasSetterObject())
            setter = StrictPropertyOp(MaybeForwarded(key->setterObject()));

        StackShape lookup(unowned,
                          const_cast<Shape *>(key)->propidRef(),
                          key->slotInfo & Shape::SLOT_MASK,
                          key->attrs,
                          key->flags);
        lookup.updateGetterSetter(getter, setter);
        e.rekeyFront(lookup, key);
    }
}