Factor out allocation in CopySpace into a separate CopyAllocator
authormhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Feb 2012 23:42:11 +0000 (23:42 +0000)
committermhahnenberg@apple.com <mhahnenberg@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 20 Feb 2012 23:42:11 +0000 (23:42 +0000)
commit9daa324ef9768b09545d2f6073ac0963b6ed86d6
tree3f346014b5dcec5049d34b96abb0d9b73df460dd
parentf990c2571463f37229b8a1bc0c11453b897b2665
Factor out allocation in CopySpace into a separate CopyAllocator
https://bugs.webkit.org/show_bug.cgi?id=78610

Reviewed by Oliver Hunt.

Added a new CopyAllocator class, which allows us to do allocations without
having to load the current offset and store the current offset in the current
block. This change will allow us to easily do inline assembly in the JIT for
array allocations.

* GNUmakefile.list.am:
* JavaScriptCore.gypi:
* JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj:
* JavaScriptCore.xcodeproj/project.pbxproj:
* heap/CopiedAllocator.h: Added.
(JSC):
(CopiedAllocator):
(JSC::CopiedAllocator::currentBlock):
(JSC::CopiedAllocator::CopiedAllocator):
(JSC::CopiedAllocator::allocate):
(JSC::CopiedAllocator::fitsInCurrentBlock):
(JSC::CopiedAllocator::wasLastAllocation):
(JSC::CopiedAllocator::startedCopying):
(JSC::CopiedAllocator::resetCurrentBlock):
(JSC::CopiedAllocator::currentUtilization):
(JSC::CopiedAllocator::resetLastAllocation):
* heap/CopiedBlock.h:
(CopiedBlock):
* heap/CopiedSpace.cpp: Moved some stuff from CopiedSpaceInlineMethods to here because we
weren't really getting any benefits from having such big functions in a header file.
(JSC::CopiedSpace::CopiedSpace):
(JSC):
(JSC::CopiedSpace::init):
(JSC::CopiedSpace::tryAllocateSlowCase):
(JSC::CopiedSpace::tryAllocateOversize):
(JSC::CopiedSpace::tryReallocate):
(JSC::CopiedSpace::tryReallocateOversize):
(JSC::CopiedSpace::doneFillingBlock):
(JSC::CopiedSpace::doneCopying):
(JSC::CopiedSpace::getFreshBlock):
* heap/CopiedSpace.h:
(CopiedSpace):
* heap/CopiedSpaceInlineMethods.h:
(JSC):
(JSC::CopiedSpace::startedCopying):
(JSC::CopiedSpace::addNewBlock):
(JSC::CopiedSpace::allocateNewBlock):
(JSC::CopiedSpace::fitsInBlock):
(JSC::CopiedSpace::tryAllocate):
(JSC::CopiedSpace::allocateFromBlock):
* heap/Heap.cpp:
(JSC::Heap::collectAllGarbage):
* heap/HeapBlock.h:
(HeapBlock):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@108267 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/GNUmakefile.list.am
Source/JavaScriptCore/JavaScriptCore.gypi
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/heap/CopiedAllocator.h [new file with mode: 0644]
Source/JavaScriptCore/heap/CopiedBlock.h
Source/JavaScriptCore/heap/CopiedSpace.cpp
Source/JavaScriptCore/heap/CopiedSpace.h
Source/JavaScriptCore/heap/CopiedSpaceInlineMethods.h
Source/JavaScriptCore/heap/Heap.cpp
Source/JavaScriptCore/heap/HeapBlock.h