Changeset 164981 in webkit


Ignore:
Timestamp:
Mar 3, 2014 2:17:55 AM (10 years ago)
Author:
lvidacs.u-szeged@partner.samsung.com
Message:

Move function calls outside loop in dom
https://bugs.webkit.org/show_bug.cgi?id=126525

Reviewed by Csaba Osztrogonác.

Store the result of length() in a local variable and use it in each iteration.

  • dom/DOMImplementation.cpp:

(WebCore::DOMImplementation::isXMLMIMEType):

  • dom/ElementData.cpp:

(WebCore::UniqueElementData::UniqueElementData):

  • dom/EventContext.cpp:

(WebCore::TouchEventContext::checkReachability):

Location:
trunk/Source/WebCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r164980 r164981  
     12014-03-03  Laszlo Vidacs  <lvidacs.u-szeged@partner.samsung.com>
     2
     3        Move function calls outside loop in dom
     4        https://bugs.webkit.org/show_bug.cgi?id=126525
     5
     6        Reviewed by Csaba Osztrogonác.
     7
     8        Store the result of length() in a local variable and use it in each iteration.
     9
     10        * dom/DOMImplementation.cpp:
     11        (WebCore::DOMImplementation::isXMLMIMEType):
     12        * dom/ElementData.cpp:
     13        (WebCore::UniqueElementData::UniqueElementData):
     14        * dom/EventContext.cpp:
     15        (WebCore::TouchEventContext::checkReachability):
     16
    1172014-03-03  Tomas Popela  <tpopela@redhat.com>
    218
  • trunk/Source/WebCore/dom/DOMImplementation.cpp

    r164254 r164981  
    270270
    271271    // Again, mimeType ends with '+xml', no need to check the validity of that substring.
    272     for (size_t i = 0; i < mimeType.length() - 4; ++i) {
     272    size_t mimeLength = mimeType.length();
     273    for (size_t i = 0; i < mimeLength - 4; ++i) {
    273274        if (!isValidXMLMIMETypeChar(mimeType[i]) && i != slashPosition)
    274275            return false;
  • trunk/Source/WebCore/dom/ElementData.cpp

    r162394 r164981  
    141141    m_inlineStyle = other.m_inlineStyle;
    142142
    143     m_attributeVector.reserveCapacity(other.length());
    144     for (unsigned i = 0; i < other.length(); ++i)
     143    unsigned otherLength = other.length();
     144    m_attributeVector.reserveCapacity(otherLength);
     145    for (unsigned i = 0; i < otherLength; ++i)
    145146        m_attributeVector.uncheckedAppend(other.m_attributeArray[i]);
    146147}
  • trunk/Source/WebCore/dom/EventContext.cpp

    r160679 r164981  
    128128void TouchEventContext::checkReachability(TouchList* touchList) const
    129129{
    130     for (size_t i = 0; i < touchList->length(); ++i)
     130    size_t length = touchList->length();
     131    for (size_t i = 0; i < length; ++i)
    131132        ASSERT(isReachable(touchList->item(i)->target()->toNode()));
    132133}
Note: See TracChangeset for help on using the changeset viewer.