示例#1
0
void
SavedStacks::sweep(JSRuntime *rt)
{
    if (frames.initialized()) {
        for (SavedFrame::Set::Enum e(frames); !e.empty(); e.popFront()) {
            JSObject *obj = e.front().unbarrieredGet();
            JSObject *temp = obj;

            if (IsObjectAboutToBeFinalizedFromAnyThread(&obj)) {
                e.removeFront();
            } else {
                SavedFrame *frame = &obj->as<SavedFrame>();
                bool parentMoved = frame->parentMoved();

                if (parentMoved) {
                    frame->updatePrivateParent();
                }

                if (obj != temp || parentMoved) {
                    e.rekeyFront(SavedFrame::Lookup(frame->getSource(),
                                                    frame->getLine(),
                                                    frame->getColumn(),
                                                    frame->getFunctionDisplayName(),
                                                    frame->getParent(),
                                                    frame->getPrincipals()),
                                 ReadBarriered<SavedFrame *>(frame));
                }
            }
        }
    }

    sweepPCLocationMap();

    if (savedFrameProto.unbarrieredGet() &&
        IsObjectAboutToBeFinalizedFromAnyThread(savedFrameProto.unsafeGet()))
    {
        savedFrameProto.set(nullptr);
    }
}
示例#2
0
void
SavedStacks::sweep(JSRuntime *rt)
{
    if (frames.initialized()) {
        for (SavedFrame::Set::Enum e(frames); !e.empty(); e.popFront()) {
            JSObject *obj = static_cast<JSObject *>(e.front());
            JSObject *temp = obj;

            if (IsObjectAboutToBeFinalized(&obj)) {
                e.removeFront();
            } else {
                SavedFrame *frame = &obj->as<SavedFrame>();
                bool parentMoved = frame->parentMoved();

                if (parentMoved) {
                    frame->updatePrivateParent();
                }

                if (obj != temp || parentMoved) {
                    Rooted<SavedFrame*> parent(rt, frame->getParent());
                    e.rekeyFront(SavedFrame::Lookup(frame->getSource(),
                                                    frame->getLine(),
                                                    frame->getColumn(),
                                                    frame->getFunctionDisplayName(),
                                                    parent,
                                                    frame->getPrincipals()),
                                 frame);
                }
            }
        }
    }

    if (savedFrameProto && IsObjectAboutToBeFinalized(&savedFrameProto)) {
        savedFrameProto = nullptr;
    }
}