Allocate Structures in a separate part of the Heap
authormhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jul 2012 23:27:53 +0000 (23:27 +0000)
committermhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 26 Jul 2012 23:27:53 +0000 (23:27 +0000)
commit983fc18ad359ff06c565203dd3734f36267cb4c8
tree0eb07de04a52be1c5ea938b91c739692a4c2883f
parent2b7be47f659cfab466f1648888a18d61c4cf2158
Allocate Structures in a separate part of the Heap
https://bugs.webkit.org/show_bug.cgi?id=92420

Reviewed by Filip Pizlo.

To fix our issue with destruction/finalization of Structures before their objects, we can move Structures to a separate
part of the Heap that will be swept after all other objects. This first patch will just be separating Structures
out into their own separate MarkedAllocator. Everything else will behave identically.

* heap/Heap.h: New function to allocate Structures in the Heap.
(Heap):
(JSC):
(JSC::Heap::allocateStructure):
* heap/MarkedAllocator.cpp: Pass whether or not we're allocated Structures to the MarkedBlock.
(JSC::MarkedAllocator::allocateBlock):
* heap/MarkedAllocator.h: Add tracking for whether or not we're allocating only Structures.
(JSC::MarkedAllocator::onlyContainsStructures):
(MarkedAllocator):
(JSC::MarkedAllocator::MarkedAllocator):
(JSC::MarkedAllocator::init):
* heap/MarkedBlock.cpp: Add tracking for whether or not we're allocating only Structures. We need this to be able to
distinguish the various MarkedBlock types in MarkedSpace::allocatorFor(MarkedBlock*).
(JSC::MarkedBlock::create):
(JSC::MarkedBlock::MarkedBlock):
* heap/MarkedBlock.h:
(MarkedBlock):
(JSC::MarkedBlock::onlyContainsStructures):
(JSC):
* heap/MarkedSpace.cpp: Include the new Structure allocator in all the places that all the other allocators are used/modified.
(JSC::MarkedSpace::MarkedSpace):
(JSC::MarkedSpace::resetAllocators):
(JSC::MarkedSpace::canonicalizeCellLivenessData):
(JSC::MarkedSpace::isPagedOut):
* heap/MarkedSpace.h: Add new MarkedAllocator just for Structures.
(MarkedSpace):
(JSC::MarkedSpace::allocatorFor):
(JSC::MarkedSpace::allocateStructure):
(JSC):
(JSC::MarkedSpace::forEachBlock):
* runtime/Structure.h: Move all of the functions that call allocateCell<Structure> down below the explicit template specialization
for allocateCell<Structure>. The new inline specialization for allocateCell directly calls the allocateStructure() function in the
Heap.
(Structure):
(JSC::Structure):
(JSC):
(JSC::Structure::create):
(JSC::Structure::createStructure):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@123813 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/Heap.h
Source/JavaScriptCore/heap/MarkedAllocator.cpp
Source/JavaScriptCore/heap/MarkedAllocator.h
Source/JavaScriptCore/heap/MarkedBlock.cpp
Source/JavaScriptCore/heap/MarkedBlock.h
Source/JavaScriptCore/heap/MarkedSpace.cpp
Source/JavaScriptCore/heap/MarkedSpace.h
Source/JavaScriptCore/runtime/Structure.h