JavaScriptCore: Bug 43515 - Fix small design issues with PageAllocation, split out...
authorGavin Barraclough <barraclough@apple.com>
Thu, 5 Aug 2010 00:18:58 +0000 (00:18 +0000)
committerSimon Hausmann <simon.hausmann@nokia.com>
Thu, 23 Sep 2010 19:04:18 +0000 (21:04 +0200)
commit1c5d1704957d43802da30763af3014b3ce5d1876
treea69506e340f29a44661e75d4a38ad59b6b1dd7b8
parent0ea3d0d1c0c1b5f23fb8ea6df65cd847b3ed4052
JavaScriptCore: Bug 43515 - Fix small design issues with PageAllocation, split out PageReservation.

Reviewed by Sam Weinig.

The PageAllocation class has a number of issues:
* Changes in bug #43269 accidentally switched SYMBIAN over to use malloc/free to allocate
  blocks of memory for the GC heap, instead of allocating RChunks.  Revert this change in
  behaviour.
* In order for PageAllocation to work correctly on WinCE we should be decommitting memory
  before deallocating.  In order to simplify understanding the expected state at deallocate,
  split behaviour out into PageAllocation and PageReservation classes.  Require that all
  memory be decommitted before calling deallocate on a PageReservation, add asserts to
  enforce this.
* add many missing asserts.
* inline more functions.
* remove ability to create sub-PageAllocations from an existing PageAllocations object -
  this presented an interface that would allow sub regions to be deallocated, which would
  not have provided expected behaviour.
* remove writable/executable arguments to commit, this value can be cached at the point
  the memory is reserved.
* remove writable/executable arguments to allocateAligned, protection other than RW is not
  supported.
* add missing checks for overflow & failed allocation to mmap path through allocateAligned.

* JavaScriptCore.xcodeproj/project.pbxproj:
* jit/ExecutableAllocator.cpp:
(JSC::ExecutableAllocator::intializePageSize):
* jit/ExecutableAllocator.h:
(JSC::ExecutablePool::Allocation::Allocation):
(JSC::ExecutablePool::Allocation::base):
(JSC::ExecutablePool::Allocation::size):
(JSC::ExecutablePool::Allocation::operator!):
* jit/ExecutableAllocatorFixedVMPool.cpp:
(JSC::FixedVMPoolAllocator::reuse):
(JSC::FixedVMPoolAllocator::coalesceFreeSpace):
(JSC::FixedVMPoolAllocator::FixedVMPoolAllocator):
(JSC::FixedVMPoolAllocator::alloc):
(JSC::FixedVMPoolAllocator::free):
(JSC::FixedVMPoolAllocator::allocInternal):
* runtime/AlignedMemoryAllocator.h:
(JSC::::allocate):
(JSC::::AlignedMemoryAllocator):
* runtime/Collector.cpp:
(JSC::Heap::allocateBlock):
* runtime/Collector.h:
* wtf/PageAllocation.cpp:
* wtf/PageAllocation.h:
(WTF::PageAllocation::operator!):
(WTF::PageAllocation::allocate):
(WTF::PageAllocation::allocateAt):
(WTF::PageAllocation::allocateAligned):
(WTF::PageAllocation::deallocate):
(WTF::PageAllocation::pageSize):
(WTF::PageAllocation::systemAllocate):
(WTF::PageAllocation::systemAllocateAt):
(WTF::PageAllocation::systemAllocateAligned):
(WTF::PageAllocation::systemDeallocate):
(WTF::PageAllocation::systemPageSize):
* wtf/PageReservation.h: Copied from JavaScriptCore/wtf/PageAllocation.h.
(WTF::PageReservation::PageReservation):
(WTF::PageReservation::commit):
(WTF::PageReservation::decommit):
(WTF::PageReservation::reserve):
(WTF::PageReservation::reserveAt):
(WTF::PageReservation::deallocate):
(WTF::PageReservation::systemCommit):
(WTF::PageReservation::systemDecommit):
(WTF::PageReservation::systemReserve):
(WTF::PageReservation::systemReserveAt):
* wtf/Platform.h:

JavaScriptGlue: Bug 43515 - Fix small design issues with PageAllocation, split out PageReservation.
(add forwarding headers)

Reviewed by Sam Weinig.

* ForwardingHeaders/wtf/Bitmap.h: Added.
* ForwardingHeaders/wtf/PageReservation.h: Added.

WebCore: Bug 43515 - Fix small design issues with PageAllocation, split out PageReservation.
(add forwarding headers)

Reviewed by Sam Weinig.

* ForwardingHeaders/wtf/Bitmap.h: Added.
* ForwardingHeaders/wtf/PageReservation.h: Added.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@64695 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/jit/ExecutableAllocator.cpp
JavaScriptCore/jit/ExecutableAllocator.h
JavaScriptCore/jit/ExecutableAllocatorFixedVMPool.cpp
JavaScriptCore/runtime/AlignedMemoryAllocator.h
JavaScriptCore/runtime/Collector.cpp
JavaScriptCore/runtime/Collector.h
JavaScriptCore/wtf/PageAllocation.cpp
JavaScriptCore/wtf/PageAllocation.h
JavaScriptCore/wtf/PageReservation.h [new file with mode: 0644]
JavaScriptCore/wtf/Platform.h
JavaScriptGlue/ChangeLog
JavaScriptGlue/ForwardingHeaders/wtf/PageReservation.h [new file with mode: 0644]
WebCore/ChangeLog
WebCore/ForwardingHeaders/wtf/PageReservation.h [new file with mode: 0644]