GC allocation fast path has too many operations.
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jul 2011 01:40:25 +0000 (01:40 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 15 Jul 2011 01:40:25 +0000 (01:40 +0000)
commit65186dd3227c2c18bedd34950cbba50b606809a9
treec2da2d5bb9c2d1c87c87e00bda7c55c370f14fff
parentbd36b51fdbab54a4f4748ebffa062b1ff3f44591
GC allocation fast path has too many operations.
https://bugs.webkit.org/show_bug.cgi?id=64493

Patch by Filip Pizlo <fpizlo@apple.com> on 2011-07-14
Reviewed by Darin Adler.

Changed the timing of the lazy sweep so that it occurs when we land on
a previously-unsweeped block, rather than whenever we land on an unsweeped
cell.  After the per-block lazy sweep occurs, the block is turned into a
singly linked list of free cells.  The allocation fast path is now just a
load-branch-store to remove a cell from the head of the list.

Additionally, this changes the way new blocks are allocated.  Previously,
they would be populated with dummy cells.  With this patch, they are
turned into a free list, which means that there will never be destructor
calls for allocations in fresh blocks.

These changes result in a 1.9% speed-up on V8, and a 0.6% speed-up on
SunSpider.  There are no observed statistically significant slow-downs
on any individual benchmark.

* JavaScriptCore.exp:
* heap/Heap.cpp:
(JSC::Heap::allocateSlowCase):
(JSC::Heap::collect):
(JSC::Heap::canonicalizeBlocks):
(JSC::Heap::resetAllocator):
* heap/Heap.h:
(JSC::Heap::forEachProtectedCell):
(JSC::Heap::forEachCell):
(JSC::Heap::forEachBlock):
(JSC::Heap::allocate):
* heap/MarkedBlock.cpp:
(JSC::MarkedBlock::MarkedBlock):
(JSC::MarkedBlock::lazySweep):
(JSC::MarkedBlock::blessNewBlockForFastPath):
(JSC::MarkedBlock::blessNewBlockForSlowPath):
(JSC::MarkedBlock::canonicalizeBlock):
* heap/MarkedBlock.h:
* heap/NewSpace.cpp:
(JSC::NewSpace::addBlock):
(JSC::NewSpace::canonicalizeBlocks):
* heap/NewSpace.h:
(JSC::NewSpace::allocate):
(JSC::NewSpace::SizeClass::SizeClass):
(JSC::NewSpace::SizeClass::canonicalizeBlock):
* heap/OldSpace.cpp:
(JSC::OldSpace::addBlock):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@91039 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.exp
Source/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.def
Source/JavaScriptCore/heap/Heap.cpp
Source/JavaScriptCore/heap/Heap.h
Source/JavaScriptCore/heap/MarkedBlock.cpp
Source/JavaScriptCore/heap/MarkedBlock.h
Source/JavaScriptCore/heap/MarkedBlockSet.h
Source/JavaScriptCore/heap/NewSpace.cpp
Source/JavaScriptCore/heap/NewSpace.h
Source/JavaScriptCore/heap/OldSpace.cpp