Ignore:
Timestamp:
Nov 7, 2012, 3:34:30 PM (13 years ago)
Author:
[email protected]
Message:

WeakBlocks should be HeapBlocks
https://bugs.webkit.org/show_bug.cgi?id=101411

Reviewed by Oliver Hunt.

Currently WeakBlocks use fastMalloc memory. They are very similar to the other HeapBlocks, however,
so we should change them to being allocated with the BlockAllocator.

  • heap/BlockAllocator.cpp:

(JSC::BlockAllocator::BlockAllocator):

  • heap/BlockAllocator.h: Added a new RegionSet for WeakBlocks.

(JSC):
(BlockAllocator):
(JSC::WeakBlock):

  • heap/Heap.h: Friended WeakSet to allow access to the BlockAllocator.

(Heap):

  • heap/WeakBlock.cpp:

(JSC::WeakBlock::create): Refactored to use HeapBlocks rather than fastMalloc.
(JSC::WeakBlock::WeakBlock):

  • heap/WeakBlock.h: Changed the WeakBlock size to 4 KB so that it divides evenly into the Region size.

(JSC):
(WeakBlock):

  • heap/WeakSet.cpp:

(JSC::WeakSet::~WeakSet):
(JSC::WeakSet::addAllocator):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/WeakBlock.h

    r118616 r133812  
    3535namespace JSC {
    3636
     37class DeadBlock;
    3738class HeapRootVisitor;
    3839class JSValue;
    3940class WeakHandleOwner;
    4041
    41 class WeakBlock : public DoublyLinkedListNode<WeakBlock> {
     42class WeakBlock : public HeapBlock<WeakBlock> {
    4243public:
    4344    friend class WTF::DoublyLinkedListNode<WeakBlock>;
    44     static const size_t blockSize = 3 * KB; // 5% of MarkedBlock size
     45    static const size_t blockSize = 4 * KB; // 5% of MarkedBlock size
    4546
    4647    struct FreeCell {
     
    5657    };
    5758
    58     static WeakBlock* create();
    59     static void destroy(WeakBlock*);
     59    static WeakBlock* create(DeadBlock*);
    6060
    6161    static WeakImpl* asWeakImpl(FreeCell*);
     
    7474    static FreeCell* asFreeCell(WeakImpl*);
    7575
    76     WeakBlock();
     76    WeakBlock(Region*);
    7777    WeakImpl* firstWeakImpl();
    7878    void finalize(WeakImpl*);
     
    8181    void addToFreeList(FreeCell**, WeakImpl*);
    8282
    83     WeakBlock* m_prev;
    84     WeakBlock* m_next;
    8583    SweepResult m_sweepResult;
    8684};
Note: See TracChangeset for help on using the changeset viewer.