Title: [224277] trunk/Source
Revision
224277
Author
[email protected]
Date
2017-11-01 06:31:36 -0700 (Wed, 01 Nov 2017)

Log Message

Use LazyNeverDestroyed instead of DEFINE_GLOBAL
https://bugs.webkit.org/show_bug.cgi?id=174979

Patch by Fujii Hironori <[email protected]> on 2017-11-01
Reviewed by Yusuke Suzuki.

Source/_javascript_Core:

* config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.

Source/WebCore:

No new tests since there should be no behavioral change.

* DerivedSources.cpp: Remove the warning of StaticConstructors.h.
* WebCore.order: Removed
* config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
* dom/QualifiedName.cpp:
(WebCore::createQualifiedName): Deleted.
* dom/QualifiedName.h: Removed createQualifiedName.
* dom/make_names.pl:
(printCppHead): Do not include StaticConstructors.h.

Source/WTF:

DEFINE_GLOBAL is not used anymore. Remove it.

* WTF.xcodeproj/project.pbxproj: Removed StaticConstructors.h
* config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
* wtf/CMakeLists.txt: Removed StaticConstructors.h
* wtf/StaticConstructors.h: Removed.

Modified Paths

Removed Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (224276 => 224277)


--- trunk/Source/_javascript_Core/ChangeLog	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/_javascript_Core/ChangeLog	2017-11-01 13:31:36 UTC (rev 224277)
@@ -1,3 +1,12 @@
+2017-11-01  Fujii Hironori  <[email protected]>
+
+        Use LazyNeverDestroyed instead of DEFINE_GLOBAL
+        https://bugs.webkit.org/show_bug.cgi?id=174979
+
+        Reviewed by Yusuke Suzuki.
+
+        * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
+
 2017-10-27  Yusuke Suzuki  <[email protected]>
 
         [DFG][FTL] Introduce StringSlice

Modified: trunk/Source/_javascript_Core/config.h (224276 => 224277)


--- trunk/Source/_javascript_Core/config.h	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/_javascript_Core/config.h	2017-11-01 13:31:36 UTC (rev 224277)
@@ -32,9 +32,3 @@
 #endif
 
 #include <wtf/DisallowCType.h>
-
-#if COMPILER(MSVC)
-#define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
-#else
-#define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
-#endif

Modified: trunk/Source/WTF/ChangeLog (224276 => 224277)


--- trunk/Source/WTF/ChangeLog	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WTF/ChangeLog	2017-11-01 13:31:36 UTC (rev 224277)
@@ -1,3 +1,17 @@
+2017-11-01  Fujii Hironori  <[email protected]>
+
+        Use LazyNeverDestroyed instead of DEFINE_GLOBAL
+        https://bugs.webkit.org/show_bug.cgi?id=174979
+
+        Reviewed by Yusuke Suzuki.
+
+        DEFINE_GLOBAL is not used anymore. Remove it.
+
+        * WTF.xcodeproj/project.pbxproj: Removed StaticConstructors.h
+        * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
+        * wtf/CMakeLists.txt: Removed StaticConstructors.h
+        * wtf/StaticConstructors.h: Removed.
+
 2017-10-30  Michael Catanzaro  <[email protected]>
 
         [WPE] Fix build warnings

Modified: trunk/Source/WTF/WTF.xcodeproj/project.pbxproj (224276 => 224277)


--- trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WTF/WTF.xcodeproj/project.pbxproj	2017-11-01 13:31:36 UTC (rev 224277)
@@ -502,7 +502,6 @@
 		A8A4730D151A825B004123FF /* Spectrum.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Spectrum.h; sourceTree = "<group>"; };
 		A8A4730E151A825B004123FF /* StackBounds.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = StackBounds.cpp; sourceTree = "<group>"; };
 		A8A4730F151A825B004123FF /* StackBounds.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StackBounds.h; sourceTree = "<group>"; };
-		A8A47310151A825B004123FF /* StaticConstructors.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StaticConstructors.h; sourceTree = "<group>"; };
 		A8A47311151A825B004123FF /* StdLibExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StdLibExtras.h; sourceTree = "<group>"; };
 		A8A47313151A825B004123FF /* StringExtras.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StringExtras.h; sourceTree = "<group>"; };
 		A8A47314151A825B004123FF /* Hasher.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Hasher.h; sourceTree = "<group>"; };
@@ -989,7 +988,6 @@
 				FEDACD3C1630F83F00C69634 /* StackStats.h */,
 				313EDEC9778E49C9BEA91CFC /* StackTrace.cpp */,
 				EF7D6CD59D8642A8A0DA86AD /* StackTrace.h */,
-				A8A47310151A825B004123FF /* StaticConstructors.h */,
 				A8A47311151A825B004123FF /* StdLibExtras.h */,
 				C4F8A93619C65EB400B2B15D /* Stopwatch.h */,
 				1A6BB768162F300500DD16DB /* StreamBuffer.h */,

Modified: trunk/Source/WTF/config.h (224276 => 224277)


--- trunk/Source/WTF/config.h	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WTF/config.h	2017-11-01 13:31:36 UTC (rev 224277)
@@ -32,9 +32,3 @@
 #endif
 
 #include <wtf/DisallowCType.h>
-
-#if COMPILER(MSVC)
-#define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
-#else
-#define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
-#endif

Modified: trunk/Source/WTF/wtf/CMakeLists.txt (224276 => 224277)


--- trunk/Source/WTF/wtf/CMakeLists.txt	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WTF/wtf/CMakeLists.txt	2017-11-01 13:31:36 UTC (rev 224277)
@@ -132,7 +132,6 @@
     StackBounds.h
     StackStats.h
     StackTrace.h
-    StaticConstructors.h
     StdLibExtras.h
     Stopwatch.h
     StringExtras.h

Deleted: trunk/Source/WTF/wtf/StaticConstructors.h (224276 => 224277)


--- trunk/Source/WTF/wtf/StaticConstructors.h	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WTF/wtf/StaticConstructors.h	2017-11-01 13:31:36 UTC (rev 224277)
@@ -1,64 +0,0 @@
-/*
- * Copyright (C) 2006 Apple Inc.
- *
- * This library is free software; you can redistribute it and/or
- * modify it under the terms of the GNU Library General Public
- * License as published by the Free Software Foundation; either
- * version 2 of the License, or (at your option) any later version.
- *
- * This library is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * Library General Public License for more details.
- *
- * You should have received a copy of the GNU Library General Public License
- * along with this library; see the file COPYING.LIB.  If not, write to
- * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- * Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef StaticConstructors_h
-#define StaticConstructors_h
-
-// We need to avoid having static constructors. We achieve this
-// with two separate methods for GCC and MSVC. Both methods prevent the static
-// initializers from being registered and called on program startup. On GCC, we
-// declare the global objects with a different type that can be POD default
-// initialized by the linker/loader. On MSVC we use a special compiler feature
-// to have the CRT ignore our static initializers. The constructors will never
-// be called and the objects will be left uninitialized.
-//
-// With both of these approaches, we must define and explicitly call an init
-// routine that uses placement new to create the objects and overwrite the
-// uninitialized placeholders.
-//
-// This is not completely portable, but is what we have for now without
-// changing how a lot of code accesses these global objects.
-
-#ifdef SKIP_STATIC_CONSTRUCTORS_ON_MSVC
-// - Assume that all includes of this header want ALL of their static
-//   initializers ignored. This is currently the case. This means that if
-//   a .cc includes this header (or it somehow gets included), all static
-//   initializers after the include will not be executed.
-// - We do this with a pragma, so that all of the static initializer pointers
-//   go into our own section, and the CRT won't call them. Eventually it would
-//   be nice if the section was discarded, because we don't want the pointers.
-//   See: http://msdn.microsoft.com/en-us/library/7977wcck(VS.80).aspx
-#pragma warning(disable:4075)
-#pragma init_seg(".unwantedstaticinits")
-#endif
-
-#ifndef SKIP_STATIC_CONSTRUCTORS_ON_GCC
-    // Define an global in the normal way.
-#define DEFINE_GLOBAL(type, name, ...) \
-    const type name;
-
-#else
-// Define an correctly-sized array of pointers to avoid static initialization.
-// Use an array of pointers instead of an array of char in case there is some alignment issue.
-#define DEFINE_GLOBAL(type, name, ...) \
-    void * name[(sizeof(type) + sizeof(void *) - 1) / sizeof(void *)];
-#endif
-
-#endif // StaticConstructors_h

Modified: trunk/Source/WebCore/ChangeLog (224276 => 224277)


--- trunk/Source/WebCore/ChangeLog	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WebCore/ChangeLog	2017-11-01 13:31:36 UTC (rev 224277)
@@ -1,3 +1,21 @@
+2017-11-01  Fujii Hironori  <[email protected]>
+
+        Use LazyNeverDestroyed instead of DEFINE_GLOBAL
+        https://bugs.webkit.org/show_bug.cgi?id=174979
+
+        Reviewed by Yusuke Suzuki.
+
+        No new tests since there should be no behavioral change.
+
+        * DerivedSources.cpp: Remove the warning of StaticConstructors.h.
+        * WebCore.order: Removed
+        * config.h: Removed definitions of SKIP_STATIC_CONSTRUCTORS_ON_MSVC and SKIP_STATIC_CONSTRUCTORS_ON_GCC.
+        * dom/QualifiedName.cpp:
+        (WebCore::createQualifiedName): Deleted.
+        * dom/QualifiedName.h: Removed createQualifiedName.
+        * dom/make_names.pl:
+        (printCppHead): Do not include StaticConstructors.h.
+
 2017-11-01  Michael Catanzaro  <[email protected]>
 
         [GTK] Always include TextureMapper.cmake

Modified: trunk/Source/WebCore/DerivedSources.cpp (224276 => 224277)


--- trunk/Source/WebCore/DerivedSources.cpp	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WebCore/DerivedSources.cpp	2017-11-01 13:31:36 UTC (rev 224277)
@@ -648,12 +648,3 @@
 #include "JSXPathNSResolver.cpp"
 #include "JSXPathResult.cpp"
 #include "JSXSLTProcessor.cpp"
-
-// On MSVC, including StaticConstructors.h causes all global objects not to be
-// automatically initialized by the C runtime. This is useful in some specific
-// cases (e.g., the *Names.cpp files), but can be dangerous in others. We don't
-// want StaticConstructors.h to "pollute" all the source files we #include here
-// accidentally, so we'll throw an error whenever any file includes it.
-#ifdef StaticConstructors_h
-#error Do not include any file in DerivedSources.cpp that includes StaticConstructors.h
-#endif

Modified: trunk/Source/WebCore/WebCore.order (224276 => 224277)


--- trunk/Source/WebCore/WebCore.order	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WebCore/WebCore.order	2017-11-01 13:31:36 UTC (rev 224277)
@@ -885,7 +885,6 @@
 __ZN7WebCore19AnimationControllerC1EPNS_5FrameE
 __ZNK7WebCore9FrameTree6parentEv
 __ZN7WebCore9HTMLNames4initEv
-__ZN7WebCore19createQualifiedNameEPvPN3WTF10StringImplERKNS1_12AtomicStringE
 __ZN3WTF9HashTableIPN7WebCore13QualifiedName17QualifiedNameImplES4_NS_17IdentityExtractorENS1_17QualifiedNameHashENS1_23QualifiedNameHashTraitsES7_E16lookupForWritingINS_22IdentityHashTranslatorIS6_EES4_EENSt3__14pairIPS4_bEERKT0_
 __ZN3WTF9HashTableIPN7WebCore13QualifiedName17QualifiedNameImplES4_NS_17IdentityExtractorENS1_17QualifiedNameHashENS1_23QualifiedNameHashTraitsES7_E18addPassingHashCodeINS_24HashSetTranslatorAdapterINS1_25QNameComponentsTranslatorEEENS1_23QualifiedNameComponentsESD_EENS_18HashTableAddResultINS_17HashTableIteratorIS4_S4_S5_S6_S7_S7_EEEERKT0_RKT1_
 __ZN3WTF9HashTableIPN7WebCore13QualifiedName17QualifiedNameImplES4_NS_17IdentityExtractorENS1_17QualifiedNameHashENS1_23QualifiedNameHashTraitsES7_E20fullLookupForWritingINS_24HashSetTranslatorAdapterINS1_25QNameComponentsTranslatorEEENS1_23QualifiedNameComponentsEEENSt3__14pairINSF_IPS4_bEEjEERKT0_
@@ -893,7 +892,6 @@
 __ZN3WTF9HashTableIPN7WebCore13QualifiedName17QualifiedNameImplES4_NS_17IdentityExtractorENS1_17QualifiedNameHashENS1_23QualifiedNameHashTraitsES7_E6rehashEi
 __ZN3WTF12StringHasher10hashMemoryILm24EEEjPKv
 __ZN7WebCore25QNameComponentsTranslator9translateERPNS_13QualifiedName17QualifiedNameImplERKNS_23QualifiedNameComponentsEj
-__ZN7WebCore19createQualifiedNameEPvPN3WTF10StringImplE
 __ZN7WebCore13QualifiedName4initEv
 __ZN7WebCore17MediaFeatureNames4initEv
 __ZN7WebCore8SVGNames4initEv

Modified: trunk/Source/WebCore/config.h (224276 => 224277)


--- trunk/Source/WebCore/config.h	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WebCore/config.h	2017-11-01 13:31:36 UTC (rev 224277)
@@ -71,12 +71,6 @@
 
 #include <wtf/DisallowCType.h>
 
-#if COMPILER(MSVC)
-#define SKIP_STATIC_CONSTRUCTORS_ON_MSVC 1
-#else
-#define SKIP_STATIC_CONSTRUCTORS_ON_GCC 1
-#endif
-
 #if PLATFORM(WIN)
 #if PLATFORM(WIN_CAIRO)
 #undef USE_CG

Modified: trunk/Source/WebCore/dom/QualifiedName.cpp (224276 => 224277)


--- trunk/Source/WebCore/dom/QualifiedName.cpp	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WebCore/dom/QualifiedName.cpp	2017-11-01 13:31:36 UTC (rev 224277)
@@ -69,14 +69,4 @@
     return hashComponents(components);
 }
 
-void createQualifiedName(void* targetAddress, const StaticStringImpl* name, const AtomicString& nameNamespace)
-{
-    new (NotNull, reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom(), AtomicString(name), nameNamespace);
 }
-
-void createQualifiedName(void* targetAddress, const StaticStringImpl* name)
-{
-    new (NotNull, reinterpret_cast<void*>(targetAddress)) QualifiedName(nullAtom(), AtomicString(name), nullAtom());
-}
-
-}

Modified: trunk/Source/WebCore/dom/QualifiedName.h (224276 => 224277)


--- trunk/Source/WebCore/dom/QualifiedName.h	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WebCore/dom/QualifiedName.h	2017-11-01 13:31:36 UTC (rev 224277)
@@ -136,9 +136,6 @@
     static const bool safeToCompareToEmptyOrDeleted = false;
 };
 
-void createQualifiedName(void* targetAddress, const StaticStringImpl* name);
-void createQualifiedName(void* targetAddress, const StaticStringImpl* name, const AtomicString& nameNamespace);
-
 inline String QualifiedName::toString() const
 {
     if (!hasPrefix())

Modified: trunk/Source/WebCore/dom/make_names.pl (224276 => 224277)


--- trunk/Source/WebCore/dom/make_names.pl	2017-11-01 13:25:21 UTC (rev 224276)
+++ trunk/Source/WebCore/dom/make_names.pl	2017-11-01 13:31:36 UTC (rev 224277)
@@ -136,9 +136,6 @@
     print F StaticString::GenerateStringAsserts(\%parameters);
 
     for my $name (sort keys %parameters) {
-        # FIXME: Would like to use static_cast here, but there are differences in const
-        # depending on whether SKIP_STATIC_CONSTRUCTORS_ON_GCC is used, so stick with a
-        # C-style cast for now.
         print F "    ${name}.construct(&${name}Data);\n";
     }
 
@@ -572,7 +569,6 @@
     print F "#endif\n\n";
 
     print F "#include \"${namespace}Names.h\"\n\n";
-    print F "#include <wtf/StaticConstructors.h>\n";
 
     print F "namespace WebCore {\n\n";
     print F "namespace ${namespace}Names {\n\n";
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to