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


C++ GCCellPtr::asCell方法代码示例

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


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

示例1: trace

    void trace(JSObject* map, JS::GCCellPtr key, JS::GCCellPtr value) override {
        JSObject* kdelegate = nullptr;
        if (key.is<JSObject>())
            kdelegate = js::GetWeakmapKeyDelegate(&key.as<JSObject>());

        fprintf(output, "WeakMapEntry map=%p key=%p keyDelegate=%p value=%p\n",
                map, key.asCell(), kdelegate, value.asCell());
    }
开发者ID:luke-chang,项目名称:gecko-1,代码行数:8,代码来源:jsfriendapi.cpp

示例2: getTracingEdgeName

void
DumpHeapTracer::onChild(const JS::GCCellPtr& thing)
{
    if (gc::IsInsideNursery(thing.asCell()))
        return;

    char buffer[1024];
    getTracingEdgeName(buffer, sizeof(buffer));
    fprintf(output, "%s%p %c %s\n", prefix, thing.asCell(), MarkDescriptor(thing.asCell()), buffer);
}
开发者ID:luke-chang,项目名称:gecko-1,代码行数:10,代码来源:jsfriendapi.cpp

示例3: TraceChildren

void
ObjectGroupCycleCollectorTracer::onChild(const JS::GCCellPtr& thing)
{
    if (thing.is<JSObject>() || thing.is<JSScript>()) {
        // Invoke the inner cycle collector callback on this child. It will not
        // recurse back into TraceChildren.
        innerTracer->onChild(thing);
        return;
    }

    if (thing.is<ObjectGroup>()) {
        // If this group is required to be in an ObjectGroup chain, trace it
        // via the provided worklist rather than continuing to recurse.
        ObjectGroup& group = thing.as<ObjectGroup>();
        if (group.maybeUnboxedLayout()) {
            for (size_t i = 0; i < seen.length(); i++) {
                if (seen[i] == &group)
                    return;
            }
            if (seen.append(&group) && worklist.append(&group)) {
                return;
            } else {
                // If append fails, keep tracing normally. The worst that will
                // happen is we end up overrecursing.
            }
        }
    }

    TraceChildren(this, thing.asCell(), thing.kind());
}
开发者ID:ChineseDr,项目名称:mongo,代码行数:30,代码来源:Tracer.cpp

示例4: item

void
CheckHeapTracer::onChild(const JS::GCCellPtr& thing)
{
    Cell* cell = thing.asCell();
    if (visited.lookup(cell))
        return;

    if (!visited.put(cell)) {
        oom = true;
        return;
    }

    if (!IsGCThingValidAfterMovingGC(cell)) {
        failures++;
        fprintf(stderr, "Stale pointer %p\n", cell);
        const char* name = contextName();
        for (int index = parentIndex; index != -1; index = stack[index].parentIndex) {
            const WorkItem& parent = stack[index];
            cell = parent.thing.asCell();
            fprintf(stderr, "  from %s %p %s edge\n",
                    GCTraceKindToAscii(cell->getTraceKind()), cell, name);
            name = parent.name;
        }
        fprintf(stderr, "  from root %s\n", name);
        return;
    }

    WorkItem item(thing, contextName(), parentIndex);
    if (!stack.append(item))
        oom = true;
}
开发者ID:cliqz-oss,项目名称:browser-f,代码行数:31,代码来源:Verifier.cpp

示例5: sizeof

/*
 * This function builds up the heap snapshot by adding edges to the current
 * node.
 */
void
VerifyPreTracer::onChild(const JS::GCCellPtr& thing)
{
    MOZ_ASSERT(!IsInsideNursery(thing.asCell()));

    edgeptr += sizeof(EdgeValue);
    if (edgeptr >= term) {
        edgeptr = term;
        return;
    }

    VerifyNode* node = curnode;
    uint32_t i = node->count;

    node->edges[i].thing = thing.asCell();
    node->edges[i].kind = thing.kind();
    node->edges[i].label = contextName();
    node->count++;
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:23,代码来源:Verifier.cpp

示例6:

/*
 * This function is called by EndVerifyBarriers for every heap edge. If the edge
 * already existed in the original snapshot, we "cancel it out" by overwriting
 * it with nullptr. EndVerifyBarriers later asserts that the remaining
 * non-nullptr edges (i.e., the ones from the original snapshot that must have
 * been modified) must point to marked objects.
 */
void
CheckEdgeTracer::onChild(const JS::GCCellPtr& thing)
{
    /* Avoid n^2 behavior. */
    if (node->count > MAX_VERIFIER_EDGES)
        return;

    for (uint32_t i = 0; i < node->count; i++) {
        if (node->edges[i].thing == thing.asCell()) {
            MOZ_ASSERT(node->edges[i].kind == thing.kind());
            node->edges[i].thing = nullptr;
            return;
        }
    }
}
开发者ID:Nazi-Nigger,项目名称:gecko-dev,代码行数:22,代码来源:Verifier.cpp

示例7: DispatchTraceKindTyped

Node::Node(const JS::GCCellPtr &thing)
{
    DispatchTraceKindTyped(ConstructFunctor(), thing.asCell(), thing.kind(), this);
}
开发者ID:Jar-win,项目名称:Waterfox,代码行数:4,代码来源:UbiNode.cpp

示例8:

Node::Node(const JS::GCCellPtr &thing)
{
    js::gc::CallTyped(ConstructFunctor(), thing.asCell(), thing.kind(), this);
}
开发者ID:ShakoHo,项目名称:gecko-dev,代码行数:4,代码来源:UbiNode.cpp


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