[JSC] Use fastMalloc / fastFree for STL containers
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Jul 2017 12:22:58 +0000 (12:22 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 9 Jul 2017 12:22:58 +0000 (12:22 +0000)
commita36ff6f5005a2f8d6b2e64fa4f996caab1e08ca1
tree7b1c697cd578440b050c4dcbc75448d3945d5272
parent99f29ca3bac4189efe4691107da309def9463bab
[JSC] Use fastMalloc / fastFree for STL containers
https://bugs.webkit.org/show_bug.cgi?id=174297

Reviewed by Sam Weinig.

Source/JavaScriptCore:

In some places, we intentionally use STL containers over WTF containers.
For example, we sometimes use std::unordered_{set,map} instead of WTF::Hash{Set,Map}
because we do not have effective empty / deleted representations in the space of key's value.
But just using STL container means using libc's malloc instead of our fast malloc (bmalloc if it is enabled).

We introduce WTF::FastAllocator. This is C++ allocator implementation using fastMalloc and fastFree.
We specify this allocator to STL containers' template parameter to allocate memory from fastMalloc.

This WTF::FastAllocator gives us a chance to use STL containers if it is necessary
without compromising memory allocation throughput.

* dfg/DFGGraph.h:
* dfg/DFGIntegerCheckCombiningPhase.cpp:
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::switchStringSlow):
* runtime/FunctionHasExecutedCache.h:
* runtime/TypeLocationCache.h:

Source/WTF:

* wtf/FastMalloc.h:
(WTF::FastAllocator::FastAllocator):
(WTF::FastAllocator::allocate):
(WTF::FastAllocator::deallocate):
(WTF::FastAllocator::operator==):
(WTF::FastAllocator::operator!=):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@219281 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/dfg/DFGGraph.h
Source/JavaScriptCore/dfg/DFGIntegerCheckCombiningPhase.cpp
Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp
Source/JavaScriptCore/runtime/FunctionHasExecutedCache.h
Source/JavaScriptCore/runtime/TypeLocationCache.h
Source/WTF/ChangeLog
Source/WTF/wtf/FastMalloc.h