JavaScriptCore:
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Feb 2009 00:27:14 +0000 (00:27 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 3 Feb 2009 00:27:14 +0000 (00:27 +0000)
commit5292373e5d0ce9915374714c1c4fbe734eba7547
tree47f559cfa6b3c077f321aed3594e16957aa79d11
parentda81343e77e47dd4c60135e6e5524f57092ca598
JavaScriptCore:

2009-02-02  Darin Adler  <darin@apple.com>

        Reviewed by Dave Hyatt.

        Bug 23676: Speed up uses of reserveCapacity on new vectors by adding a new reserveInitialCapacity
        https://bugs.webkit.org/show_bug.cgi?id=23676

        * API/JSObjectRef.cpp:
        (JSObjectCopyPropertyNames): Use reserveInitialCapacity.
        * parser/Lexer.cpp:
        (JSC::Lexer::Lexer): Ditto.
        (JSC::Lexer::clear): Ditto.

        * wtf/Vector.h: Added reserveInitialCapacity, a more efficient version of
        reserveCapacity for use when the vector is brand new (still size 0 with no
        capacity other than the inline capacity).

WebCore:

2009-02-02  Darin Adler  <darin@apple.com>

        Reviewed by Dave Hyatt.

        Bug 23676: Speed up uses of reserveCapacity on new vectors by adding a new reserveInitialCapacity
        https://bugs.webkit.org/show_bug.cgi?id=23676

        * bindings/js/JSCSSStyleDeclarationCustom.cpp:
        (WebCore::cssPropertyName):
        * css/CSSMutableStyleDeclaration.cpp:
        (WebCore::CSSMutableStyleDeclaration::CSSMutableStyleDeclaration):
        (WebCore::CSSMutableStyleDeclaration::removePropertiesInSet):
        * css/CSSPrimitiveValue.cpp:
        (WebCore::CSSPrimitiveValue::cssText):
        * css/CSSStyleDeclaration.cpp:
        (WebCore::CSSStyleDeclaration::copyPropertiesInSet):
        * css/CSSStyleSelector.cpp:
        (WebCore::CSSStyleSelector::sortMatchedRules):
        * dom/Document.cpp:
        (WebCore::Document::formElementsState):
        * dom/NamedAttrMap.h:
        (WebCore::NamedAttrMap::reserveInitialCapacity):
        * editing/TextIterator.cpp:
        (WebCore::CharacterIterator::string):
        (WebCore::SearchBuffer::SearchBuffer):
        (WebCore::plainTextToMallocAllocatedBuffer):
        * editing/markup.cpp:
        (WebCore::joinMarkups):
        * history/HistoryItem.cpp:
        (WebCore::HistoryItem::HistoryItem):
        * html/HTMLTokenizer.cpp:
        (WebCore::Token::addAttribute):
        * loader/appcache/DOMApplicationCache.cpp:
        (WebCore::DOMApplicationCache::items):
        * page/SecurityOrigin.cpp:
        (WebCore::SecurityOrigin::toString):
        * page/mac/AccessibilityObjectWrapper.mm:
        (convertToVector):
        * platform/graphics/FontCache.cpp:
        (WebCore::FontCache::purgeInactiveFontData):
        (WebCore::FontCache::invalidate):
        * platform/network/FormData.cpp:
        (WebCore::FormData::deepCopy):
        * platform/network/HTTPHeaderMap.cpp:
        (WebCore::HTTPHeaderMap::copyData):
        * platform/network/ResourceRequestBase.cpp:
        (WebCore::ResourceRequestBase::copyData):
        * platform/network/mac/FormDataStreamMac.mm:
        (WebCore::formCreate):
        * xml/XPathNodeSet.cpp:
        (WebCore::XPath::NodeSet::sort):
        Use reserveInitialCapacity instead of of reserveCapacity in all these call sites,
        which are working on new vectors that are guaranteed not to be empty.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@40501 268f45cc-cd09-0410-ab3c-d52691b4dbfc
25 files changed:
JavaScriptCore/API/JSObjectRef.cpp
JavaScriptCore/ChangeLog
JavaScriptCore/parser/Lexer.cpp
JavaScriptCore/wtf/Vector.h
WebCore/ChangeLog
WebCore/bindings/js/JSCSSStyleDeclarationCustom.cpp
WebCore/css/CSSMutableStyleDeclaration.cpp
WebCore/css/CSSPrimitiveValue.cpp
WebCore/css/CSSStyleDeclaration.cpp
WebCore/css/CSSStyleSelector.cpp
WebCore/dom/Document.cpp
WebCore/dom/NamedAttrMap.h
WebCore/editing/TextIterator.cpp
WebCore/editing/markup.cpp
WebCore/history/HistoryItem.cpp
WebCore/html/HTMLTokenizer.cpp
WebCore/loader/appcache/DOMApplicationCache.cpp
WebCore/page/SecurityOrigin.cpp
WebCore/page/mac/AccessibilityObjectWrapper.mm
WebCore/platform/graphics/FontCache.cpp
WebCore/platform/network/FormData.cpp
WebCore/platform/network/HTTPHeaderMap.cpp
WebCore/platform/network/ResourceRequestBase.cpp
WebCore/platform/network/mac/FormDataStreamMac.mm
WebCore/xml/XPathNodeSet.cpp