Ignore:
Timestamp:
Feb 3, 2012, 11:21:28 AM (13 years ago)
Author:
[email protected]
Message:

Refactor MarkedBlock::SizeClass into a separate class
https://bugs.webkit.org/show_bug.cgi?id=77600

Reviewed by Geoffrey Garen.

We pulled SizeClass out into its own class, named MarkedAllocator, and gave it
the responsibility of allocating objects from the collection of MarkedBlocks
that it manages. Also limited the amount of coupling to internal data fields
from other places, although it's mostly unavoidable in the JIT code.

Eventually MarkedAllocator will implement various policies to do with object
management, e.g. whether or not to run destructors on objects that it manages.
MarkedSpace will manage a collection of MarkedAllocators with varying policies,
as it does now but to a larger extent.

  • CMakeLists.txt:
  • GNUmakefile.list.am:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def:
  • JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
  • JavaScriptCore.xcodeproj/project.pbxproj:
  • Target.pri:
  • dfg/DFGSpeculativeJIT.h:

(JSC::DFG::SpeculativeJIT::emitAllocateJSFinalObject):

  • heap/Heap.cpp:

(JSC::Heap::collect):
(JSC::Heap::resetAllocators):

  • heap/Heap.h:

(JSC::Heap::allocatorForObject):
(Heap):

  • heap/MarkedAllocator.cpp: Added.

(JSC):
(JSC::MarkedAllocator::tryAllocateHelper):
(JSC::MarkedAllocator::tryAllocate):
(JSC::MarkedAllocator::allocateSlowCase):
(JSC::MarkedAllocator::allocateBlock):
(JSC::MarkedAllocator::addBlock):
(JSC::MarkedAllocator::removeBlock):

  • heap/MarkedAllocator.h: Added.

(JSC):
(DFG):
(MarkedAllocator):
(JSC::MarkedAllocator::cellSize):
(JSC::MarkedAllocator::heap):
(JSC::MarkedAllocator::setHeap):
(JSC::MarkedAllocator::setCellSize):
(JSC::MarkedAllocator::setMarkedSpace):
(JSC::MarkedAllocator::MarkedAllocator):
(JSC::MarkedAllocator::allocate):
(JSC::MarkedAllocator::reset):
(JSC::MarkedAllocator::zapFreeList):
(JSC::MarkedAllocator::forEachBlock):

  • heap/MarkedSpace.cpp:

(JSC::MarkedSpace::MarkedSpace):
(JSC::MarkedSpace::resetAllocators):
(JSC::MarkedSpace::canonicalizeCellLivenessData):
(JSC::TakeIfUnmarked::operator()):

  • heap/MarkedSpace.h:

(MarkedSpace):
(JSC::MarkedSpace::allocatorFor):
(JSC::MarkedSpace::allocate):
(JSC::MarkedSpace::forEachBlock):
(JSC::MarkedSpace::didAddBlock):
(JSC::MarkedSpace::didConsumeFreeList):

  • jit/JITInlineMethods.h:

(JSC::JIT::emitAllocateBasicJSObject):

File:
1 edited

Legend:

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

    r106078 r106676  
    2626#include "HandleHeap.h"
    2727#include "HandleStack.h"
     28#include "MarkedAllocator.h"
    2829#include "MarkedBlock.h"
    2930#include "MarkedBlockSet.h"
     
    9596        inline bool isBusy();
    9697       
    97         MarkedSpace::SizeClass& sizeClassForObject(size_t bytes) { return m_objectSpace.sizeClassFor(bytes); }
     98        MarkedAllocator& allocatorForObject(size_t bytes) { return m_objectSpace.allocatorFor(bytes); }
    9899        void* allocate(size_t);
    99100        CheckedBoolean tryAllocateStorage(size_t, void**);
     
    137138    private:
    138139        friend class MarkedSpace;
     140        friend class MarkedAllocator;
    139141        friend class MarkedBlock;
    140142        friend class BumpSpace;
     
    161163        void canonicalizeCellLivenessData();
    162164
    163         void resetAllocator();
     165        void resetAllocators();
    164166        void freeBlocks(MarkedBlock*);
    165167
Note: See TracChangeset for help on using the changeset viewer.