Changeset 204061 in webkit


Ignore:
Timestamp:
Aug 2, 2016 7:20:40 PM (8 years ago)
Author:
commit-queue@webkit.org
Message:

Clean up some useless AtomicString atoms
https://bugs.webkit.org/show_bug.cgi?id=160471

Patch by Benjamin Poulain <bpoulain@apple.com> on 2016-08-02
Reviewed by Geoffrey Garen.

Source/WebCore:

The only uses of "commentAtom" and "textAtom" where for their
respective overload of Node::nodeName().
Those methods return a string, we should not keep them in the atomic
string table just to hold a small String alive. They were also the only
two nodes to behave that way.

The atom xlinkAtom was only used by createForeignAttributesMap(), which
is itself only invoked once. There is no need for the symbol xlinkAtom.

  • dom/CDATASection.cpp:

(WebCore::CDATASection::nodeName):

  • dom/Comment.cpp:

(WebCore::Comment::nodeName):

  • dom/Document.cpp:

(WebCore::Document::nodeName):

  • dom/Text.cpp:

(WebCore::Text::nodeName):

  • html/parser/HTMLTreeBuilder.cpp:

(WebCore::createForeignAttributesMap):

Source/WTF:

  • wtf/text/AtomicString.h:
  • wtf/text/StringStatics.cpp:

(WTF::AtomicString::init): Deleted.

Location:
trunk/Source
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WTF/ChangeLog

    r204009 r204061  
     12016-08-02  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        Clean up some useless AtomicString atoms
     4        https://bugs.webkit.org/show_bug.cgi?id=160471
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        * wtf/text/AtomicString.h:
     9        * wtf/text/StringStatics.cpp:
     10        (WTF::AtomicString::init): Deleted.
     11
    1122016-08-01  Benjamin Poulain  <bpoulain@apple.com>
    213
  • trunk/Source/WTF/wtf/text/AtomicString.h

    r203147 r204061  
    307307extern const WTF_EXPORTDATA AtomicString nullAtom;
    308308extern const WTF_EXPORTDATA AtomicString emptyAtom;
    309 extern const WTF_EXPORTDATA AtomicString textAtom;
    310 extern const WTF_EXPORTDATA AtomicString commentAtom;
    311309extern const WTF_EXPORTDATA AtomicString starAtom;
    312310extern const WTF_EXPORTDATA AtomicString xmlAtom;
    313311extern const WTF_EXPORTDATA AtomicString xmlnsAtom;
    314 extern const WTF_EXPORTDATA AtomicString xlinkAtom;
    315312
    316313inline AtomicString AtomicString::fromUTF8(const char* characters, size_t length)
     
    370367using WTF::nullAtom;
    371368using WTF::emptyAtom;
    372 using WTF::textAtom;
    373 using WTF::commentAtom;
    374369using WTF::starAtom;
    375370using WTF::xmlAtom;
    376371using WTF::xmlnsAtom;
    377 using WTF::xlinkAtom;
    378372#endif
    379373
  • trunk/Source/WTF/wtf/text/StringStatics.cpp

    r198168 r204061  
    7070WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, nullAtom)
    7171WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, emptyAtom)
    72 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, textAtom)
    73 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, commentAtom)
    7472WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, starAtom)
    7573WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlAtom)
    7674WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xmlnsAtom)
    77 WTF_EXPORTDATA DEFINE_GLOBAL(AtomicString, xlinkAtom)
    7875
    7976NEVER_INLINE unsigned StringImpl::hashSlowCase() const
     
    9693        new (NotNull, (void*)&nullAtom) AtomicString;
    9794        new (NotNull, (void*)&emptyAtom) AtomicString("");
    98         new (NotNull, (void*)&textAtom) AtomicString("#text", AtomicString::ConstructFromLiteral);
    99         new (NotNull, (void*)&commentAtom) AtomicString("#comment", AtomicString::ConstructFromLiteral);
    10095        new (NotNull, (void*)&starAtom) AtomicString("*", AtomicString::ConstructFromLiteral);
    10196        new (NotNull, (void*)&xmlAtom) AtomicString("xml", AtomicString::ConstructFromLiteral);
    10297        new (NotNull, (void*)&xmlnsAtom) AtomicString("xmlns", AtomicString::ConstructFromLiteral);
    103         new (NotNull, (void*)&xlinkAtom) AtomicString("xlink", AtomicString::ConstructFromLiteral);
    10498
    10599        initialized = true;
  • trunk/Source/WebCore/ChangeLog

    r204054 r204061  
     12016-08-02  Benjamin Poulain  <bpoulain@apple.com>
     2
     3        Clean up some useless AtomicString atoms
     4        https://bugs.webkit.org/show_bug.cgi?id=160471
     5
     6        Reviewed by Geoffrey Garen.
     7
     8        The only uses of "commentAtom" and "textAtom" where for their
     9        respective overload of Node::nodeName().
     10        Those methods return a string, we should not keep them in the atomic
     11        string table just to hold a small String alive. They were also the only
     12        two nodes to behave that way.
     13
     14        The atom xlinkAtom was only used by createForeignAttributesMap(), which
     15        is itself only invoked once. There is no need for the symbol xlinkAtom.
     16
     17        * dom/CDATASection.cpp:
     18        (WebCore::CDATASection::nodeName):
     19        * dom/Comment.cpp:
     20        (WebCore::Comment::nodeName):
     21        * dom/Document.cpp:
     22        (WebCore::Document::nodeName):
     23        * dom/Text.cpp:
     24        (WebCore::Text::nodeName):
     25        * html/parser/HTMLTreeBuilder.cpp:
     26        (WebCore::createForeignAttributesMap):
     27
    1282016-08-02  Anders Carlsson  <andersca@apple.com>
    229
  • trunk/Source/WebCore/dom/CDATASection.cpp

    r189576 r204061  
    3939String CDATASection::nodeName() const
    4040{
    41     return "#cdata-section";
     41    return ASCIILiteral("#cdata-section");
    4242}
    4343
  • trunk/Source/WebCore/dom/Comment.cpp

    r189576 r204061  
    3939String Comment::nodeName() const
    4040{
    41     return commentAtom.string();
     41    return ASCIILiteral("#comment");
    4242}
    4343
  • trunk/Source/WebCore/dom/Document.cpp

    r203971 r204061  
    17501750String Document::nodeName() const
    17511751{
    1752     return "#document";
     1752    return ASCIILiteral("#document");
    17531753}
    17541754
  • trunk/Source/WebCore/dom/Text.cpp

    r200696 r204061  
    161161String Text::nodeName() const
    162162{
    163     return textAtom.string();
     163    return ASCIILiteral("#text");
    164164}
    165165
  • trunk/Source/WebCore/html/parser/HTMLTreeBuilder.cpp

    r203302 r204061  
    576576    HashMap<AtomicString, QualifiedName> map;
    577577
    578     addNamesWithPrefix(map, xlinkAtom, XLinkNames::getXLinkAttrs(), XLinkNames::XLinkAttrsCount);
     578    AtomicString xlinkName("xlink", AtomicString::ConstructFromLiteral);
     579    addNamesWithPrefix(map, xlinkName, XLinkNames::getXLinkAttrs(), XLinkNames::XLinkAttrsCount);
    579580    addNamesWithPrefix(map, xmlAtom, XMLNames::getXMLAttrs(), XMLNames::XMLAttrsCount);
    580581
    581582    map.add(WTF::xmlnsAtom, XMLNSNames::xmlnsAttr);
    582     map.add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkAtom, XMLNSNames::xmlnsNamespaceURI));
     583    map.add("xmlns:xlink", QualifiedName(xmlnsAtom, xlinkName, XMLNSNames::xmlnsNamespaceURI));
    583584
    584585    return map;
Note: See TracChangeset for help on using the changeset viewer.