PerProcess<> should be safe by default
authorfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Mar 2018 17:45:49 +0000 (17:45 +0000)
committerfpizlo@apple.com <fpizlo@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 11 Mar 2018 17:45:49 +0000 (17:45 +0000)
commit17b65991bc64720cbff4d7512c1f5e7efdcf1cb1
tree02187fab0ca6eabdaf284d7a95f0d8bfa999b8d8
parentf2c62247d6e5c466c592e7b9621d4e7e78d5614d
PerProcess<> should be safe by default
https://bugs.webkit.org/show_bug.cgi?id=183545

Reviewed by Yusuke Suzuki.

This makes PerProcess<> safe by default, so we don't need SafePerProcess<>.

The new PerProcess<> design relies on a hash-consing mechanism for PerProcess<> storage based
on the __PRETTY_FUNCTION__ from inside PerProcess<>, which captures the instantiated type in
the string. Therefore, this can be used to runtime-coalesce PerProcess<> instances based on
type.

I expect this to be perf-neutral. It's an important prerequisite to more bmalloc work, since I
don't want to have more PerProcess<> vs SafePerProcess<> bugs, and SafePerProcess<> can't be
used for everything (I don't see how to use it for isoheaps).

* CMakeLists.txt:
* bmalloc.xcodeproj/project.pbxproj:
* bmalloc/Heap.cpp:
(bmalloc::Heap::Heap):
* bmalloc/IsoDirectoryInlines.h:
(bmalloc::passedNumPages>::takeFirstEligible):
(bmalloc::passedNumPages>::didBecome):
* bmalloc/PerProcess.cpp: Added.
(bmalloc::stringHash):
(bmalloc::allocate):
(bmalloc::getPerProcessData):
* bmalloc/PerProcess.h:
(bmalloc::PerProcess::mutex):
(bmalloc::PerProcess::coalesce):
(bmalloc::PerProcess::getSlowCase):
(): Deleted.
* bmalloc/Scavenger.cpp:
* bmalloc/Scavenger.h:
* bmalloc/bmalloc.cpp:
(bmalloc::api::scavenge):
(bmalloc::api::setScavengerThreadQOSClass):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@229516 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/bmalloc/CMakeLists.txt
Source/bmalloc/ChangeLog
Source/bmalloc/bmalloc.xcodeproj/project.pbxproj
Source/bmalloc/bmalloc/CryptoRandom.cpp
Source/bmalloc/bmalloc/Heap.cpp
Source/bmalloc/bmalloc/IsoDirectoryInlines.h
Source/bmalloc/bmalloc/PerProcess.cpp [new file with mode: 0644]
Source/bmalloc/bmalloc/PerProcess.h
Source/bmalloc/bmalloc/Scavenger.cpp
Source/bmalloc/bmalloc/Scavenger.h
Source/bmalloc/bmalloc/bmalloc.cpp