There is no good reason for WeakBlock to care about newly allocated objects
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2016 17:17:07 +0000 (17:17 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 15 Sep 2016 17:17:07 +0000 (17:17 +0000)
commit7c99df1dbd4f2902cd774070828e25b132adad08
tree02514fa82e48dd5ed2b7ba9ba808fe3f3decf89a
parent04ed7d09c38b3f76a746befda18091b3b6f17e87
There is no good reason for WeakBlock to care about newly allocated objects
https://bugs.webkit.org/show_bug.cgi?id=162006

Reviewed by Geoffrey Garen.

WeakBlock scans itself in two modes:

visit: if a Weak in the block belongs to an unmarked object, ask the Weak to consider whether
    it should do things.

reap: if a Weak in a block belongs to an unmarked object, delete the Weak.

Except that "unmarked" has a peculiar meaning: WeakBlock defines it as
!markedOrNewlyAllocated. So, a newly allocated object will never be consulted about anything.
That sounds scary until you realize that newlyAllocated must have been cleared before we even
got here.

So, we were paying the price of checking newlyAllocated for no reason. This switches the code
to using isMarked(). I don't know why the code previously checked newlyAllocated, but I do
trust my reasoning.

* heap/LargeAllocation.h:
(JSC::LargeAllocation::isMarkedDuringWeakVisiting):
(JSC::LargeAllocation::isMarkedOrNewlyAllocatedDuringWeakVisiting): Deleted.
* heap/MarkedBlock.h:
(JSC::MarkedBlock::isMarkedDuringWeakVisiting):
(JSC::MarkedBlock::isMarkedOrNewlyAllocatedDuringWeakVisiting): Deleted.
* heap/WeakBlock.cpp:
(JSC::WeakBlock::specializedVisit):
(JSC::WeakBlock::reap):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@205979 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/heap/LargeAllocation.h
Source/JavaScriptCore/heap/MarkedBlock.h
Source/JavaScriptCore/heap/WeakBlock.cpp