Title: [125797] trunk/Source/WTF
Revision
125797
Author
[email protected]
Date
2012-08-16 12:28:28 -0700 (Thu, 16 Aug 2012)

Log Message

Use initialization from literals for StringStatics
https://bugs.webkit.org/show_bug.cgi?id=94185

Patch by Benjamin Poulain <[email protected]> on 2012-08-16
Reviewed by Geoffrey Garen.

* wtf/text/StringStatics.cpp:
Remove the arguments for DEFINE_GLOBAL. They are no longer used by the macro.
(WTF::AtomicString::init):
Use ConstructFromLiteral to initialize the strings faster and to save memory.

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (125796 => 125797)


--- trunk/Source/WTF/ChangeLog	2012-08-16 18:46:58 UTC (rev 125796)
+++ trunk/Source/WTF/ChangeLog	2012-08-16 19:28:28 UTC (rev 125797)
@@ -1,3 +1,15 @@
+2012-08-16  Benjamin Poulain  <[email protected]>
+
+        Use initialization from literals for StringStatics
+        https://bugs.webkit.org/show_bug.cgi?id=94185
+
+        Reviewed by Geoffrey Garen.
+
+        * wtf/text/StringStatics.cpp:
+        Remove the arguments for DEFINE_GLOBAL. They are no longer used by the macro.
+        (WTF::AtomicString::init):
+        Use ConstructFromLiteral to initialize the strings faster and to save memory.
+
 2012-08-14  Milian Wolff  <[email protected]>
 
         [Qt] QNX build fails due to reference to MADV_FREE_REUSE and MADV_FREE_REUSABLE

Modified: trunk/Source/WTF/wtf/text/StringStatics.cpp (125796 => 125797)


--- trunk/Source/WTF/wtf/text/StringStatics.cpp	2012-08-16 18:46:58 UTC (rev 125796)
+++ trunk/Source/WTF/wtf/text/StringStatics.cpp	2012-08-16 19:28:28 UTC (rev 125797)
@@ -53,13 +53,13 @@
 }
 
 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, nullAtom)
-WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, emptyAtom, "")
-WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, textAtom, "#text")
-WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, commentAtom, "#comment")
-WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, starAtom, "*")
-WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlAtom, "xml")
-WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlnsAtom, "xmlns")
-WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xlinkAtom, "xlink")
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, emptyAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, textAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, commentAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, starAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlnsAtom)
+WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xlinkAtom)
 
 NEVER_INLINE unsigned StringImpl::hashSlowCase() const
 {
@@ -80,12 +80,12 @@
         // Use placement new to initialize the globals.
         new (NotNull, (void*)&nullAtom) AtomicString;
         new (NotNull, (void*)&emptyAtom) AtomicString("");
-        new (NotNull, (void*)&textAtom) AtomicString("#text");
-        new (NotNull, (void*)&commentAtom) AtomicString("#comment");
-        new (NotNull, (void*)&starAtom) AtomicString("*");
-        new (NotNull, (void*)&xmlAtom) AtomicString("xml");
-        new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns");
-        new (NotNull, (void*)&xlinkAtom) AtomicString("xlink");
+        new (NotNull, (void*)&textAtom) AtomicString("#text", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&commentAtom) AtomicString("#comment", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&starAtom) AtomicString("*", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&xmlAtom) AtomicString("xml", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns", AtomicString::ConstructFromLiteral);
+        new (NotNull, (void*)&xlinkAtom) AtomicString("xlink", AtomicString::ConstructFromLiteral);
 
         initialized = true;
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to