当前位置: 首页>>代码示例>>C++>>正文


C++ AtomStateEntry::asPtr方法代码示例

本文整理汇总了C++中AtomStateEntry::asPtr方法的典型用法代码示例。如果您正苦于以下问题:C++ AtomStateEntry::asPtr方法的具体用法?C++ AtomStateEntry::asPtr怎么用?C++ AtomStateEntry::asPtr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AtomStateEntry的用法示例。


在下文中一共展示了AtomStateEntry::asPtr方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: MarkString

void
js_TraceAtomState(JSTracer *trc)
{
    JSRuntime *rt = trc->context->runtime;
    JSAtomState *state = &rt->atomState;

#ifdef DEBUG
    size_t number = 0;
#endif

    if (rt->gcKeepAtoms) {
        for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) {
            JS_SET_TRACING_INDEX(trc, "locked_atom", number++);
            MarkString(trc, r.front().asPtr());
        }
    } else {
        for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) {
            AtomStateEntry entry = r.front();
            if (!entry.isTagged())
                continue;

            JS_SET_TRACING_INDEX(trc, "interned_atom", number++);
            MarkString(trc, entry.asPtr());
        }
    }
}
开发者ID:mozilla,项目名称:mozilla-history,代码行数:26,代码来源:jsatom.cpp

示例2:

void
js_SweepAtomState(JSContext *cx)
{
    JSAtomState *state = &cx->runtime->atomState;

    for (AtomSet::Enum e(state->atoms); !e.empty(); e.popFront()) {
        AtomStateEntry entry = e.front();

        if (entry.isTagged()) {
            /* Pinned or interned key cannot be finalized. */
            JS_ASSERT(!IsAboutToBeFinalized(cx, entry.asPtr()));
            continue;
        }
        
        if (IsAboutToBeFinalized(cx, entry.asPtr()))
            e.removeFront();
    }
}
开发者ID:mozilla,项目名称:mozilla-history,代码行数:18,代码来源:jsatom.cpp

示例3: fprintf

js_DumpAtoms(JSContext *cx, FILE *fp)
{
    JSAtomState *state = &cx->runtime->atomState;

    fprintf(fp, "atoms table contents:\n");
    unsigned number = 0;
    for (AtomSet::Range r = state->atoms.all(); !r.empty(); r.popFront()) {
        AtomStateEntry entry = r.front();
        fprintf(fp, "%3u ", number++);
        JSAtom *key = entry.asPtr();
        FileEscapedString(fp, key, '"');
        if (entry.isTagged())
            fputs(" interned", fp);
        putc('\n', fp);
    }
    putc('\n', fp);
}
开发者ID:mozilla,项目名称:mozilla-history,代码行数:17,代码来源:jsatom.cpp

示例4: IsStringAboutToBeFinalizedFromAnyThread

void
JSRuntime::sweepAtoms()
{
    if (!atoms_)
        return;

    for (AtomSet::Enum e(*atoms_); !e.empty(); e.popFront()) {
        AtomStateEntry entry = e.front();
        JSAtom *atom = entry.asPtr();
        bool isDying = IsStringAboutToBeFinalizedFromAnyThread(&atom);

        /* Pinned or interned key cannot be finalized. */
        MOZ_ASSERT_IF(hasContexts() && entry.isTagged(), !isDying);

        if (isDying)
            e.removeFront();
    }
}
开发者ID:mmatyas,项目名称:mozjs,代码行数:18,代码来源:jsatom.cpp

示例5:

bool
JSRuntime::transformToPermanentAtoms()
{
    JS_ASSERT(!parentRuntime);

    // All static strings were created as permanent atoms, now move the contents
    // of the atoms table into permanentAtoms and mark each as permanent.

    JS_ASSERT(permanentAtoms && permanentAtoms->empty());

    AtomSet *temp = atoms_;
    atoms_ = permanentAtoms;
    permanentAtoms = temp;

    for (AtomSet::Enum e(*permanentAtoms); !e.empty(); e.popFront()) {
        AtomStateEntry entry = e.front();
        JSAtom *atom = entry.asPtr();
        atom->morphIntoPermanentAtom();
    }

    return true;
}
开发者ID:JuannyWang,项目名称:gecko-dev,代码行数:22,代码来源:jsatom.cpp

示例6:

bool
JSRuntime::transformToPermanentAtoms(JSContext *cx)
{
    MOZ_ASSERT(!parentRuntime);

    // All static strings were created as permanent atoms, now move the contents
    // of the atoms table into permanentAtoms and mark each as permanent.

    MOZ_ASSERT(!permanentAtoms);
    permanentAtoms = cx->new_<FrozenAtomSet>(atoms_);   // takes ownership of atoms_

    atoms_ = cx->new_<AtomSet>();
    if (!atoms_ || !atoms_->init(JS_STRING_HASH_COUNT))
        return false;

    for (FrozenAtomSet::Range r(permanentAtoms->all()); !r.empty(); r.popFront()) {
        AtomStateEntry entry = r.front();
        JSAtom *atom = entry.asPtr();
        atom->morphIntoPermanentAtom();
    }

    return true;
}
开发者ID:mmatyas,项目名称:mozjs,代码行数:23,代码来源:jsatom.cpp


注:本文中的AtomStateEntry::asPtr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。