Ignore:
Timestamp:
May 23, 2012, 4:55:27 PM (13 years ago)
Author:
[email protected]
Message:

Refactored WeakBlock to use malloc, clarify behavior
https://bugs.webkit.org/show_bug.cgi?id=87318

Reviewed by Filip Pizlo.

We want to use malloc so we can make these smaller than 4KB,
since an individual MarkedBlock will usually have fewer than
4KB worth of weak pointers.

  • heap/Heap.cpp:

(JSC::Heap::markRoots): Renamed visitLiveWeakImpls to visit, since
we no longer need to distinguish from "visitDeadWeakImpls".

Renamed "visitDeadWeakImpls" to "reap" because we're not actually
doing any visiting -- we're just tagging things as dead.

  • heap/WeakBlock.cpp:

(JSC::WeakBlock::create):
(JSC::WeakBlock::destroy):
(JSC::WeakBlock::WeakBlock): Malloc!

(JSC::WeakBlock::visit):
(JSC::WeakBlock::reap): Renamed as above.

  • heap/WeakBlock.h:

(WeakBlock): Reduced to 3KB, as explained above.

  • heap/WeakSet.cpp:

(JSC::WeakSet::visit):
(JSC::WeakSet::reap):

  • heap/WeakSet.h:

(WeakSet): Updated for renames, and to match WebKit style.

File:
1 edited

Legend:

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

    r118238 r118269  
    3131#include "WeakImpl.h"
    3232#include <wtf/DoublyLinkedList.h>
    33 #include <wtf/PageAllocation.h>
    3433#include <wtf/StdLibExtras.h>
    3534
     
    4342public:
    4443    friend class WTF::DoublyLinkedListNode<WeakBlock>;
    45     static const size_t blockSize = 4 * KB;
     44    static const size_t blockSize = 3 * KB; // 5% of MarkedBlock size
    4645
    4746    struct FreeCell {
     
    6564
    6665    void sweep();
    67     const SweepResult& sweepResult();
    6866    SweepResult takeSweepResult();
    6967
    70     void visitLiveWeakImpls(HeapRootVisitor&);
    71     void visitDeadWeakImpls(HeapRootVisitor&);
     68    void visit(HeapRootVisitor&);
     69    void reap();
    7270
    7371    void lastChanceToFinalize();
     
    7674    static FreeCell* asFreeCell(WeakImpl*);
    7775
    78     WeakBlock(PageAllocation&);
     76    WeakBlock();
    7977    WeakImpl* firstWeakImpl();
    8078    void finalize(WeakImpl*);
     
    8381    void addToFreeList(FreeCell**, WeakImpl*);
    8482
    85     PageAllocation m_allocation;
    8683    WeakBlock* m_prev;
    8784    WeakBlock* m_next;
     
    112109    ASSERT(m_sweepResult.isNull());
    113110    return tmp;
    114 }
    115 
    116 inline const WeakBlock::SweepResult& WeakBlock::sweepResult()
    117 {
    118     return m_sweepResult;
    119111}
    120112
Note: See TracChangeset for help on using the changeset viewer.