Ejemplo n.º 1
0
void WeakSet::sweep()
{
    for (WeakBlock* block = m_blocks.head(); block; block = block->next())
        block->sweep();

    resetAllocator();
}
Ejemplo n.º 2
0
WeakSet::~WeakSet()
{
    WeakBlock* next = 0;
    for (WeakBlock* block = m_blocks.head(); block; block = next) {
        next = block->next();
        WeakBlock::destroy(block);
    }
    m_blocks.clear();
}
Ejemplo n.º 3
0
WeakSet::~WeakSet()
{
    WeakBlock* next = 0;
    for (WeakBlock* block = m_blocks.head(); block; block = next) {
        next = block->next();
        heap()->blockAllocator().deallocate(WeakBlock::destroy(block));
    }
    m_blocks.clear();
}
Ejemplo n.º 4
0
WeakSet::~WeakSet()
{
    if (isOnList())
        remove();
    
    Heap& heap = *this->heap();
    WeakBlock* next = 0;
    for (WeakBlock* block = m_blocks.head(); block; block = next) {
        next = block->next();
        WeakBlock::destroy(heap, block);
    }
    m_blocks.clear();
}
Ejemplo n.º 5
0
void WeakSet::sweep()
{
    WeakBlock* next;
    for (WeakBlock* block = m_blocks.head(); block; block = next) {
        next = block->next();

        // If a block is completely empty, a new sweep won't have any effect.
        if (block->isEmpty())
            continue;

        block->takeSweepResult(); // Force a new sweep by discarding the last sweep.
        block->sweep();
    }
}
Ejemplo n.º 6
0
void WeakSet::shrink()
{
    WeakBlock* next;
    for (WeakBlock* block = m_blocks.head(); block; block = next) {
        next = block->next();

        if (block->isEmpty())
            removeAllocator(block);
    }

    resetAllocator();
    
    if (m_blocks.isEmpty() && isOnList())
        remove();
}
Ejemplo n.º 7
0
void WeakSet::sweep()
{
    for (WeakBlock* block = m_blocks.head(); block;) {
        heap()->sweepNextLogicallyEmptyWeakBlock();

        WeakBlock* nextBlock = block->next();
        block->sweep();
        if (block->isLogicallyEmptyButNotFree()) {
            // If this WeakBlock is logically empty, but still has Weaks pointing into it,
            // we can't destroy it just yet. Detach it from the WeakSet and hand ownership
            // to the Heap so we don't pin down the entire MarkedBlock or LargeAllocation.
            m_blocks.remove(block);
            heap()->addLogicallyEmptyWeakBlock(block);
            block->disconnectContainer();
        }
        block = nextBlock;
    }

    resetAllocator();
}