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


C++ HeapRootVisitor类代码示例

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


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

示例1: visit

void WeakBlock::visit(HeapRootVisitor& heapRootVisitor)
{
    // If a block is completely empty, a visit won't have any effect.
    if (isEmpty())
        return;

    // If this WeakBlock doesn't belong to a MarkedBlock, we won't even be here.
    ASSERT(m_markedBlock);

    // We only visit after marking.
    ASSERT(m_markedBlock->isMarkedOrRetired());

    SlotVisitor& visitor = heapRootVisitor.visitor();

    for (size_t i = 0; i < weakImplCount(); ++i) {
        WeakImpl* weakImpl = &weakImpls()[i];
        if (weakImpl->state() != WeakImpl::Live)
            continue;

        WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner();
        if (!weakHandleOwner)
            continue;

        const JSValue& jsValue = weakImpl->jsValue();
        if (m_markedBlock->isMarkedOrNewlyAllocated(jsValue.asCell()))
            continue;

        if (!weakHandleOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(&const_cast<JSValue&>(jsValue)), weakImpl->context(), visitor))
            continue;

        heapRootVisitor.visit(&const_cast<JSValue&>(jsValue));
    }
}
开发者ID:Comcast,项目名称:WebKitForWayland,代码行数:33,代码来源:WeakBlock.cpp

示例2: visitChildren

void SmallStrings::visitChildren(HeapRootVisitor& heapRootMarker)
{
    /*
       Our hypothesis is that small strings are very common. So, we cache them
       to avoid GC churn. However, in cases where this hypothesis turns out to
       be false -- including the degenerate case where all JavaScript execution
       has terminated -- we don't want to waste memory.

       To test our hypothesis, we check if any small string has been marked. If
       so, it's probably reasonable to mark the rest. If not, we clear the cache.
     */

    bool isAnyStringMarked = isMarked(m_emptyString);
    for (unsigned i = 0; i < singleCharacterStringCount && !isAnyStringMarked; ++i)
        isAnyStringMarked = isMarked(m_singleCharacterStrings[i]);
    
    if (!isAnyStringMarked) {
        clear();
        return;
    }
    
    if (m_emptyString)
        heapRootMarker.mark(&m_emptyString);
    for (unsigned i = 0; i < singleCharacterStringCount; ++i) {
        if (m_singleCharacterStrings[i])
            heapRootMarker.mark(&m_singleCharacterStrings[i]);
    }
}
开发者ID:13W,项目名称:phantomjs,代码行数:28,代码来源:SmallStrings.cpp

示例3: specializedVisit

void WeakBlock::specializedVisit(ContainerType& container, HeapRootVisitor& heapRootVisitor)
{
    SlotVisitor& visitor = heapRootVisitor.visitor();
    
    HeapVersion markingVersion = visitor.markingVersion();

    for (size_t i = 0; i < weakImplCount(); ++i) {
        WeakImpl* weakImpl = &weakImpls()[i];
        if (weakImpl->state() != WeakImpl::Live)
            continue;

        WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner();
        if (!weakHandleOwner)
            continue;

        const JSValue& jsValue = weakImpl->jsValue();
        if (container.isMarkedConcurrently(markingVersion, jsValue.asCell()))
            continue;
        
        if (!weakHandleOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(&const_cast<JSValue&>(jsValue)), weakImpl->context(), visitor))
            continue;

        heapRootVisitor.visit(&const_cast<JSValue&>(jsValue));
    }
}
开发者ID:eocanha,项目名称:webkit,代码行数:25,代码来源:WeakBlock.cpp

示例4: visitLiveWeakImpls

void WeakBlock::visitLiveWeakImpls(HeapRootVisitor& heapRootVisitor)
{
    // If a block is completely empty, a visit won't have any effect.
    if (!m_sweepResult.isNull() && m_sweepResult.blockIsFree)
        return;

    SlotVisitor& visitor = heapRootVisitor.visitor();

    for (size_t i = 0; i < weakImplCount(); ++i) {
        WeakImpl* weakImpl = &weakImpls()[i];
        if (weakImpl->state() != WeakImpl::Live)
            continue;

        const JSValue& jsValue = weakImpl->jsValue();
        if (Heap::isMarked(jsValue.asCell()))
            continue;

        WeakHandleOwner* weakHandleOwner = weakImpl->weakHandleOwner();
        if (!weakHandleOwner)
            continue;

        if (!weakHandleOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(&const_cast<JSValue&>(jsValue)), weakImpl->context(), visitor))
            continue;

        heapRootVisitor.visit(&const_cast<JSValue&>(jsValue));
    }
}
开发者ID:Moondee,项目名称:Artemis,代码行数:27,代码来源:WeakBlock.cpp

示例5: visitException

void Heap::visitException(HeapRootVisitor& visitor)
{
    GCPHASE(MarkingException);
    if (!m_vm->exception() && !m_vm->lastException())
        return;

    visitor.visit(m_vm->addressOfException());
    visitor.visit(m_vm->addressOfLastException());

    if (Options::logGC() == GCLogging::Verbose)
        dataLog("Exceptions:\n", m_slotVisitor);

    m_slotVisitor.donateAndDrain();
}
开发者ID:allsmy,项目名称:webkit,代码行数:14,代码来源:Heap.cpp

示例6: markLists

void MarkedArgumentBuffer::markLists(HeapRootVisitor& heapRootVisitor, ListSet& markSet)
{
    ListSet::iterator end = markSet.end();
    for (ListSet::iterator it = markSet.begin(); it != end; ++it) {
        MarkedArgumentBuffer* list = *it;
        for (int i = 0; i < list->m_size; ++i)
            heapRootVisitor.visit(reinterpret_cast<JSValue*>(&list->slotFor(i)));
    }
}
开发者ID:604339917,项目名称:JavaScriptCore-iOS-1,代码行数:9,代码来源:ArgList.cpp

示例7: visitStrongHandles

void HandleSet::visitStrongHandles(HeapRootVisitor& heapRootVisitor)
{
    Node* end = m_strongList.end();
    for (Node* node = m_strongList.begin(); node != end; node = node->next()) {
#if ENABLE(GC_VALIDATION)
        RELEASE_ASSERT(isLiveNode(node));
#endif
        heapRootVisitor.visit(node->slot());
    }
}
开发者ID:AndriyKalashnykov,项目名称:webkit,代码行数:10,代码来源:HandleSet.cpp

示例8: visitProtectedObjects

void Heap::visitProtectedObjects(HeapRootVisitor& heapRootVisitor)
{
    GCPHASE(VisitProtectedObjects);

    for (auto& pair : m_protectedValues)
        heapRootVisitor.visit(&pair.key);

    if (Options::logGC() == GCLogging::Verbose)
        dataLog("Protected Objects:\n", m_slotVisitor);

    m_slotVisitor.donateAndDrain();
}
开发者ID:allsmy,项目名称:webkit,代码行数:12,代码来源:Heap.cpp

示例9: markWeakHandles

void HandleHeap::markWeakHandles(HeapRootVisitor& heapRootVisitor)
{
    SlotVisitor& visitor = heapRootVisitor.visitor();

    Node* end = m_weakList.end();
    for (Node* node = m_weakList.begin(); node != end; node = node->next()) {
        ASSERT(isValidWeakNode(node));
        JSCell* cell = node->slot()->asCell();
        if (Heap::isMarked(cell))
            continue;

        WeakHandleOwner* weakOwner = node->weakOwner();
        if (!weakOwner)
            continue;

        if (!weakOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(node->slot()), node->weakOwnerContext(), visitor))
            continue;

        heapRootVisitor.mark(node->slot());
    }
}
开发者ID:13W,项目名称:phantomjs,代码行数:21,代码来源:HandleHeap.cpp

示例10: visitWeakHandles

void HandleHeap::visitWeakHandles(HeapRootVisitor& heapRootVisitor)
{
    SlotVisitor& visitor = heapRootVisitor.visitor();

    Node* end = m_weakList.end();
    for (Node* node = m_weakList.begin(); node != end; node = node->next()) {
#if ENABLE(GC_VALIDATION)
        if (!isValidWeakNode(node))
            CRASH();
#endif
        JSCell* cell = node->slot()->asCell();
        if (Heap::isMarked(cell))
            continue;

        WeakHandleOwner* weakOwner = node->weakOwner();
        if (!weakOwner)
            continue;

        if (!weakOwner->isReachableFromOpaqueRoots(Handle<Unknown>::wrapSlot(node->slot()), node->weakOwnerContext(), visitor))
            continue;

        heapRootVisitor.visit(node->slot());
    }
}
开发者ID:1833183060,项目名称:wke,代码行数:24,代码来源:HandleHeap.cpp

示例11: markTempSortVectors

void Heap::markTempSortVectors(HeapRootVisitor& heapRootVisitor)
{
    typedef Vector<Vector<ValueStringPair>* > VectorOfValueStringVectors;

    VectorOfValueStringVectors::iterator end = m_tempSortingVectors.end();
    for (VectorOfValueStringVectors::iterator it = m_tempSortingVectors.begin(); it != end; ++it) {
        Vector<ValueStringPair>* tempSortingVector = *it;

        Vector<ValueStringPair>::iterator vectorEnd = tempSortingVector->end();
        for (Vector<ValueStringPair>::iterator vectorIt = tempSortingVector->begin(); vectorIt != vectorEnd; ++vectorIt) {
            if (vectorIt->first)
                heapRootVisitor.visit(&vectorIt->first);
        }
    }
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:15,代码来源:Heap.cpp

示例12: markProtectedObjects

void Heap::markProtectedObjects(HeapRootVisitor& heapRootVisitor)
{
    ProtectCountSet::iterator end = m_protectedValues.end();
    for (ProtectCountSet::iterator it = m_protectedValues.begin(); it != end; ++it)
        heapRootVisitor.visit(&it->first);
}
开发者ID:sysrqb,项目名称:chromium-src,代码行数:6,代码来源:Heap.cpp

示例13: markStrongHandles

void HandleHeap::markStrongHandles(HeapRootVisitor& heapRootMarker)
{
    Node* end = m_strongList.end();
    for (Node* node = m_strongList.begin(); node != end; node = node->next())
        heapRootMarker.mark(node->slot());
}
开发者ID:13W,项目名称:phantomjs,代码行数:6,代码来源:HandleHeap.cpp


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