GC copy phase spends needless cycles zero-filling blocks
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2012 04:35:21 +0000 (04:35 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 18 Jun 2012 04:35:21 +0000 (04:35 +0000)
commit53fd202c1ec6bf94d7e31a04984ef33b0cdb7c98
tree618f1989030837e218c3c76cc933f693054f540c
parent599c20384d17f8b3d8ed9e06719fb1847f4fd835
GC copy phase spends needless cycles zero-filling blocks
https://bugs.webkit.org/show_bug.cgi?id=89128

Reviewed by Gavin Barraclough.

We only need to zero-fill when we're allocating memory that might not
get fully initialized before GC.

* heap/CopiedBlock.h:
(JSC::CopiedBlock::createNoZeroFill):
(JSC::CopiedBlock::create): Added a way to create without zero-filling.
This is our optimization.

(JSC::CopiedBlock::zeroFillToEnd):
(JSC::CopiedBlock::CopiedBlock): Split zero-filling out from creation,
so we can sometimes create without zero-filling.

* heap/CopiedSpace.cpp:
(JSC::CopiedSpace::init):
(JSC::CopiedSpace::tryAllocateSlowCase):
(JSC::CopiedSpace::doneCopying): Renamed addNewBlock to allocateBlock()
to clarify that the new block is always newly-allocated.

(JSC::CopiedSpace::doneFillingBlock): Make sure to zero-fill to the end
of a block that might be used in the future for allocation. (Most of the
time, this is a no-op, since we've already filled the block completely.)

(JSC::CopiedSpace::getFreshBlock): Removed this function because the
abstraction of "allocation must succeed" is no longer useful.

* heap/CopiedSpace.h: Updated declarations to match.

* heap/CopiedSpaceInlineMethods.h:
(JSC::CopiedSpace::allocateBlockForCopyingPhase): New function, which
knows that it can skip zero-filling.

Added tighter scoping to our lock, to improve parallelism.

(JSC::CopiedSpace::allocateBlock): Folded getFreshBlock functionality
into this function, for simplicity.

* heap/MarkStack.cpp:
(JSC::SlotVisitor::startCopying):
(JSC::SlotVisitor::allocateNewSpace): Use our new zero-fill-free helper
function for great good.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@120568 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/CopiedBlock.h
Source/JavaScriptCore/heap/CopiedSpace.cpp
Source/JavaScriptCore/heap/CopiedSpace.h
Source/JavaScriptCore/heap/CopiedSpaceInlineMethods.h
Source/JavaScriptCore/heap/MarkStack.cpp