Ignore:
Timestamp:
Apr 26, 2012, 5:51:47 PM (13 years ago)
Author:
[email protected]
Message:

Allocating WeakImpl should not trigger GC, as that makes the world very tricksy.
https://bugs.webkit.org/show_bug.cgi?id=85020

Reviewed by Gavin Barraclough.

Now in the event that we are unable to find an allocator for a new handle, just
add a new allocator rather than trying to recover "dead" handles through a GC.

Find allocator is now much simpler, and addAllocator directly reports the
increased memory usage to the heap without causing any GC to happen immediately.

  • heap/WeakSet.cpp:

(JSC::WeakSet::findAllocator):
(JSC::WeakSet::addAllocator):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/WeakSet.cpp

    r115092 r115391  
    9696        return allocator;
    9797
    98     // FIXME: This reporting of the amount allocated isn't quite accurate and
    99     // probably should be reworked eventually.
    100     m_heap->didAllocate(WeakBlock::blockSize);
    101     if (m_heap->shouldCollect()) {
    102         m_heap->collect(Heap::DoNotSweep);
    103 
    104         if (WeakBlock::FreeCell* allocator = tryFindAllocator())
    105             return allocator;
    106     }
    107 
    10898    return addAllocator();
    10999}
     
    127117{
    128118    WeakBlock* block = WeakBlock::create();
     119    m_heap->didAllocate(WeakBlock::blockSize);
    129120    m_blocks.append(block);
    130121    WeakBlock::SweepResult sweepResult = block->takeSweepResult();
Note: See TracChangeset for help on using the changeset viewer.