Пример #1
0
void SlotVisitor::drain()
{
    StackStats::probe();
    ASSERT(m_isInParallelMode);
   
#if ENABLE(PARALLEL_GC)
    if (Options::numberOfGCMarkers() > 1) {
        while (!m_stack.isEmpty()) {
            m_stack.refill();
            for (unsigned countdown = Options::minimumNumberOfScansBetweenRebalance(); m_stack.canRemoveLast() && countdown--;)
                visitChildren(*this, m_stack.removeLast());
            donateKnownParallel();
        }
        
        mergeOpaqueRootsIfNecessary();
        return;
    }
#endif
    
    while (!m_stack.isEmpty()) {
        m_stack.refill();
        while (m_stack.canRemoveLast())
            visitChildren(*this, m_stack.removeLast());
    }
}
Пример #2
0
void SlotVisitor::drain()
{
    ASSERT(m_isInParallelMode);
   
    while (!m_stack.isEmpty()) {
        m_stack.refill();
        for (unsigned countdown = Options::minimumNumberOfScansBetweenRebalance(); m_stack.canRemoveLast() && countdown--;)
            visitChildren(m_stack.removeLast());
        donateKnownParallel();
    }
    
    mergeOpaqueRootsIfNecessary();
}
Пример #3
0
void SlotVisitor::drain(MonotonicTime timeout)
{
    ASSERT(m_isInParallelMode);
   
    while ((!m_collectorStack.isEmpty() || !m_mutatorStack.isEmpty()) && !hasElapsed(timeout)) {
        if (!m_collectorStack.isEmpty()) {
            m_collectorStack.refill();
            m_isVisitingMutatorStack = false;
            for (unsigned countdown = Options::minimumNumberOfScansBetweenRebalance(); m_collectorStack.canRemoveLast() && countdown--;)
                visitChildren(m_collectorStack.removeLast());
        } else if (!m_mutatorStack.isEmpty()) {
            m_mutatorStack.refill();
            // We know for sure that we are visiting objects because of the barrier, not because of
            // marking. Marking will visit an object exactly once. The barrier will visit it
            // possibly many times, and always after it was already marked.
            m_isVisitingMutatorStack = true;
            for (unsigned countdown = Options::minimumNumberOfScansBetweenRebalance(); m_mutatorStack.canRemoveLast() && countdown--;)
                visitChildren(m_mutatorStack.removeLast());
        }
        donateKnownParallel();
    }
    
    mergeOpaqueRootsIfNecessary();
}