[JSC] Introduce static symbols
authorutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2017 16:41:34 +0000 (16:41 +0000)
committerutatane.tea@gmail.com <utatane.tea@gmail.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 21 Jul 2017 16:41:34 +0000 (16:41 +0000)
commit49de98e70eba29dcceb1d878589d511037c5336d
tree8b957284fe1e6c49f156f7521b712ef81cc4d351
parent0cf0a769e8b9c2dd1dfd74c8a6f8277f94c69953
[JSC] Introduce static symbols
https://bugs.webkit.org/show_bug.cgi?id=158863

Reviewed by Darin Adler.

Source/JavaScriptCore:

We use StaticSymbolImpl to initialize PrivateNames and builtin Symbols.
As a result, we can share the same Symbol values between VMs and threads.
And we do not need to allocate Ref<SymbolImpl> for these symbols at runtime.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* builtins/BuiltinNames.cpp: Added.
Suppress warning C4307, integral constant overflow. It is intentional in constexpr hash value calculation.

* builtins/BuiltinNames.h:
(JSC::BuiltinNames::BuiltinNames):
* builtins/BuiltinUtils.h:

Source/WTF:

We add a new class StaticSymbolImpl. StaticSymbolImpl can offer
the way to create static SymbolImpl. It can be shared between
multiple VMs and multiple threads.

* wtf/text/SymbolImpl.h:
(WTF::SymbolImpl::StaticSymbolImpl::StaticSymbolImpl):
(WTF::SymbolImpl::StaticSymbolImpl::operator SymbolImpl&):
For StaticSymbolImpl's hashForSymbol, we use usual string hash value.
Since all the SymbolImpls are unique, basically, any value is OK here.
Non-confilicting to the other SymbolImpls is ideal.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@219731 268f45cc-cd09-0410-ab3c-d52691b4dbfc
13 files changed:
Source/JavaScriptCore/CMakeLists.txt
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/builtins/BuiltinNames.cpp [new file with mode: 0644]
Source/JavaScriptCore/builtins/BuiltinNames.h
Source/JavaScriptCore/builtins/BuiltinUtils.h
Source/WTF/ChangeLog
Source/WTF/wtf/Hasher.h
Source/WTF/wtf/text/AtomicString.h
Source/WTF/wtf/text/StringBuilder.h
Source/WTF/wtf/text/StringImpl.h
Source/WTF/wtf/text/SymbolImpl.h
Source/WTF/wtf/text/WTFString.h