Use Vector::uncheckedAppend() in more places
authordbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Dec 2016 17:42:37 +0000 (17:42 +0000)
committerdbates@webkit.org <dbates@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 6 Dec 2016 17:42:37 +0000 (17:42 +0000)
commitd20fa7f6f3562ba105630bd7ef24671904e76eb3
treed4bd32c6c10968dcffce6e11d0135d265cd3c32b
parentd071f76012298b17327ca14981ca5ffdbd1621df
Use Vector::uncheckedAppend() in more places
https://bugs.webkit.org/show_bug.cgi?id=164952

Reviewed by Darin Adler.

We can use Vector::uncheckedAppend() whenever the number of items that will be appended
to a vector is equal to or less than its capacity. Using Vector::uncheckedAppend() is
more efficient than Vector::append() as it avoids checking the capacity of the vector
before appending a value to the end of it.

* bindings/js/SerializedScriptValue.cpp:
(WebCore::SerializedScriptValue::SerializedScriptValue):
* contentextensions/DFABytecodeCompiler.cpp:
(WebCore::ContentExtensions::DFABytecodeCompiler::extractJumpTable):
* contentextensions/DFAMinimizer.cpp:
* css/StyleProperties.cpp:
(WebCore::StyleProperties::copyPropertiesInSet): Use Vector::uncheckedAppend() and inline
the assignment of the temporary variable value into the if condition to limit its scope
as it is referenced exactly once in the loop body.
* css/StyleRule.cpp:
(WebCore::StyleRuleGroup::StyleRuleGroup): Use Vector::uncheckedAppend() and write for-loop
using a C++11 range-based for-loop.
* css/parser/CSSParserValues.cpp:
(WebCore::CSSParserSelector::setLangArgumentList):
* cssjit/SelectorCompiler.cpp:
(WebCore::SelectorCompiler::SelectorCodeGenerator::generateElementIsNthLastChildOf):
* dom/DocumentMarkerController.cpp:
(WebCore::updateRenderedRectsForMarker):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::convertToLayoutUnits):
* platform/audio/AudioBus.cpp:
(WebCore::AudioBus::AudioBus):
* platform/graphics/FontCache.cpp:
(WebCore::FontCache::purgeInactiveFontData):
* platform/graphics/PathUtilities.cpp:
(WebCore::polygonsForRect):
* platform/mediastream/CaptureDeviceManager.cpp:
(CaptureDeviceManager::bestSourcesForTypeAndConstraints):
* platform/mediastream/RealtimeMediaSource.cpp:
(WebCore::RealtimeMediaSource::fitnessDistance):
* platform/network/cf/FormDataStreamCFNet.cpp:
(WebCore::formCreate):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@209400 268f45cc-cd09-0410-ab3c-d52691b4dbfc
16 files changed:
Source/WebCore/ChangeLog
Source/WebCore/bindings/js/SerializedScriptValue.cpp
Source/WebCore/contentextensions/DFABytecodeCompiler.cpp
Source/WebCore/contentextensions/DFAMinimizer.cpp
Source/WebCore/css/StyleProperties.cpp
Source/WebCore/css/StyleRule.cpp
Source/WebCore/css/parser/CSSParserValues.cpp
Source/WebCore/cssjit/SelectorCompiler.cpp
Source/WebCore/dom/DocumentMarkerController.cpp
Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
Source/WebCore/platform/audio/AudioBus.cpp
Source/WebCore/platform/graphics/FontCache.cpp
Source/WebCore/platform/graphics/PathUtilities.cpp
Source/WebCore/platform/mediastream/CaptureDeviceManager.cpp
Source/WebCore/platform/mediastream/RealtimeMediaSource.cpp
Source/WebCore/platform/network/cf/FormDataStreamCFNet.cpp