本文整理汇总了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());
}
}
}
示例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();
}
}
示例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);
}
示例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();
}
}
示例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;
}
示例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;
}