Changeset 293757 in webkit
- Timestamp:
- May 3, 2022, 7:27:25 PM (4 years ago)
- Location:
- trunk/Source
- Files:
-
- 9 edited
-
WTF/ChangeLog (modified) (1 diff)
-
WTF/wtf/Threading.cpp (modified) (1 diff)
-
WTF/wtf/text/AtomString.cpp (modified) (2 diffs)
-
WTF/wtf/text/AtomString.h (modified) (2 diffs)
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/dom/QualifiedName.cpp (modified) (1 diff)
-
WebCore/dom/make_names.pl (modified) (1 diff)
-
WebKit/ChangeLog (modified) (1 diff)
-
WebKit/WebAuthnProcess/WebAuthnProcess.cpp (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r293735 r293757 1 2022-05-03 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Initialize empty and null AtomString at compile time 4 https://bugs.webkit.org/show_bug.cgi?id=240031 5 6 Reviewed by Mark Lam. 7 8 Because they are initialized from static data, we can just initialize them 9 at compile time, and we do not need to have `AtomString::init`. 10 11 * wtf/Threading.cpp: 12 (WTF::initialize): 13 * wtf/text/AtomString.cpp: 14 (WTF::AtomString::init): Deleted. 15 * wtf/text/AtomString.h: 16 (WTF::StaticAtomString::StaticAtomString): 17 (WTF::nullAtom): 18 (WTF::emptyAtom): 19 1 20 2022-05-03 Chris Dumez <cdumez@apple.com> 2 21 -
trunk/Source/WTF/wtf/Threading.cpp
r293735 r293757 476 476 SignalHandlers::initialize(); 477 477 #endif 478 AtomString::init();479 478 }); 480 479 } -
trunk/Source/WTF/wtf/text/AtomString.cpp
r293735 r293757 32 32 33 33 namespace WTF { 34 35 WTF_EXPORT_PRIVATE const StaticAtomString nullAtomData { nullptr }; 36 WTF_EXPORT_PRIVATE const StaticAtomString emptyAtomData { &StringImpl::s_emptyAtomString }; 34 37 35 38 template<AtomString::CaseConvertType type> … … 135 138 #endif 136 139 137 WTF_EXPORT_PRIVATE LazyNeverDestroyed<const AtomString> nullAtomData;138 WTF_EXPORT_PRIVATE LazyNeverDestroyed<const AtomString> emptyAtomData;139 140 void AtomString::init()141 {142 static std::once_flag initializeKey;143 std::call_once(initializeKey, [] {144 nullAtomData.construct();145 emptyAtomData.construct(AtomString::fromLatin1(""));146 });147 }148 149 140 static inline StringBuilder replaceUnpairedSurrogatesWithReplacementCharacterInternal(StringView view) 150 141 { -
trunk/Source/WTF/wtf/text/AtomString.h
r293703 r293757 36 36 WTF_MAKE_FAST_ALLOCATED; 37 37 public: 38 WTF_EXPORT_PRIVATE static void init();39 40 38 AtomString(); 41 39 AtomString(const LChar*, unsigned length); … … 280 278 #endif 281 279 282 // nullAtom and emptyAtom are special AtomString. They can be used from any threads since their StringImpls are not actually registered into AtomStringTable. 283 extern WTF_EXPORT_PRIVATE LazyNeverDestroyed<const AtomString> nullAtomData; 284 extern WTF_EXPORT_PRIVATE LazyNeverDestroyed<const AtomString> emptyAtomData; 285 286 inline const AtomString& nullAtom() { return nullAtomData.get(); } 287 inline const AtomString& emptyAtom() { return emptyAtomData.get(); } 280 struct StaticAtomString { 281 constexpr StaticAtomString(StringImpl::StaticStringImpl* pointer) 282 : m_pointer(pointer) 283 { 284 } 285 286 StringImpl::StaticStringImpl* m_pointer; 287 }; 288 static_assert(sizeof(AtomString) == sizeof(StaticAtomString), "AtomString and StaticAtomString must be the same size!"); 289 extern WTF_EXPORT_PRIVATE const StaticAtomString nullAtomData; 290 extern WTF_EXPORT_PRIVATE const StaticAtomString emptyAtomData; 291 292 inline const AtomString& nullAtom() { return *reinterpret_cast<const AtomString*>(&nullAtomData); } 293 inline const AtomString& emptyAtom() { return *reinterpret_cast<const AtomString*>(&emptyAtomData); } 288 294 289 295 inline AtomString::AtomString(ASCIILiteral literal) -
trunk/Source/WebCore/ChangeLog
r293736 r293757 1 2022-05-03 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Initialize empty and null AtomString at compile time 4 https://bugs.webkit.org/show_bug.cgi?id=240031 5 6 Reviewed by Mark Lam. 7 8 * dom/QualifiedName.cpp: 9 (WebCore::QualifiedName::init): 10 * dom/make_names.pl: 11 (printInit): 12 1 13 2022-05-03 Sihui Liu <sihui_liu@apple.com> 2 14 -
trunk/Source/WebCore/dom/QualifiedName.cpp
r293701 r293757 50 50 return; 51 51 52 ASSERT_WITH_MESSAGE(WTF::nullAtomData.isConstructed(), "AtomString::init should have been called");53 52 anyName.construct(nullAtom(), starAtom(), starAtom()); 54 53 initialized = true; -
trunk/Source/WebCore/dom/make_names.pl
r293548 r293757 603 603 604 604 // Use placement new to initialize the globals. 605 606 AtomString::init();607 605 "; 608 606 } -
trunk/Source/WebKit/ChangeLog
r293744 r293757 1 2022-05-03 Yusuke Suzuki <ysuzuki@apple.com> 2 3 [JSC] Initialize empty and null AtomString at compile time 4 https://bugs.webkit.org/show_bug.cgi?id=240031 5 6 Reviewed by Mark Lam. 7 8 * WebAuthnProcess/WebAuthnProcess.cpp: 9 (WebKit::WebAuthnProcess::initializeWebAuthnProcess): 10 1 11 2022-05-03 Commit Queue <commit-queue@webkit.org> 2 12 -
trunk/Source/WebKit/WebAuthnProcess/WebAuthnProcess.cpp
r293266 r293757 95 95 applyProcessCreationParameters(parameters.auxiliaryProcessParameters); 96 96 WTF::Thread::setCurrentThreadIsUserInitiated(); 97 AtomString::init();98 97 } 99 98
Note:
See TracChangeset
for help on using the changeset viewer.