Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable
https://bugs.webkit.org/show_bug.cgi?id=174660
Reviewed by Geoffrey Garen.
Replace calls to Vector::resize() with calls to more efficient shrink() / grow() when applicable.
This essentially replaces a branch to figure out if the new size is less or greater than the
current size by an assertion.
Source/bmalloc:
(bmalloc::Hash>::rehash):
Source/JavaScriptCore:
(JSC::B3::clearPredecessors):
- b3/B3InferSwitches.cpp:
- b3/B3LowerToAir.cpp:
(JSC::B3::Air::LowerToAir::finishAppendingInstructions):
- b3/B3ReduceStrength.cpp:
- b3/B3SparseCollection.h:
(JSC::B3::SparseCollection::packIndices):
(JSC::B3::UseCounts::UseCounts):
- b3/air/AirAllocateRegistersAndStackByLinearScan.cpp:
- b3/air/AirEmitShuffle.cpp:
(JSC::B3::Air::emitShuffle):
- b3/air/AirLowerAfterRegAlloc.cpp:
(JSC::B3::Air::lowerAfterRegAlloc):
- b3/air/AirOptimizeBlockOrder.cpp:
(JSC::B3::Air::optimizeBlockOrder):
(JSC::Operands::ensureLocals):
- bytecode/PreciseJumpTargets.cpp:
(JSC::computePreciseJumpTargetsInternal):
- dfg/DFGBlockInsertionSet.cpp:
(JSC::DFG::BlockInsertionSet::execute):
- dfg/DFGBlockMapInlines.h:
(JSC::DFG::BlockMap<T>::BlockMap):
- dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::processSetLocalQueue):
(JSC::DFG::ByteCodeParser::clearCaches):
(JSC::DFG::Disassembler::Disassembler):
(JSC::DFG::FlowIndexing::recompute):
(JSC::DFG::Graph::registerFrozenValues):
- dfg/DFGInPlaceAbstractState.cpp:
(JSC::DFG::setLiveValues):
(JSC::DFG::LICMPhase::run):
- dfg/DFGLivenessAnalysisPhase.cpp:
- dfg/DFGNaturalLoops.cpp:
(JSC::DFG::NaturalLoops::NaturalLoops):
- dfg/DFGStoreBarrierClusteringPhase.cpp:
- ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::compileNode):
(JSC::CodeBlockSet::deleteUnmarkedAndUnreferenced):
(JSC::MarkedSpace::sweepLargeAllocations):
- inspector/ContentSearchUtilities.cpp:
(Inspector::ContentSearchUtilities::findMagicComment):
- interpreter/ShadowChicken.cpp:
(JSC::ShadowChicken::update):
(JSC::ASTBuilder::shrinkOperandStackBy):
(JSC::Lexer::setOffset):
(JSC::RegExp::matchInline):
- runtime/RegExpPrototype.cpp:
(JSC::genericSplit):
- yarr/RegularExpression.cpp:
(JSC::Yarr::RegularExpression::match):
Source/WebCore:
- Modules/gamepad/Gamepad.cpp:
(WebCore::Gamepad::Gamepad):
- Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::addReaction):
- Modules/websockets/WebSocketChannel.cpp:
(WebCore::WebSocketChannel::skipBuffer):
- Modules/websockets/WebSocketDeflater.cpp:
(WebCore::WebSocketDeflater::finish):
- contentextensions/ContentExtensionCompiler.cpp:
(WebCore::ContentExtensions::serializeSelector):
- contentextensions/DFABytecodeCompiler.cpp:
(WebCore::ContentExtensions::append):
- crypto/gcrypt/CryptoAlgorithmAES_CBCGCrypt.cpp:
(WebCore::gcryptEncrypt):
(WebCore::gcryptDecrypt):
- crypto/gcrypt/CryptoAlgorithmECDHGCrypt.cpp:
(WebCore::gcryptDerive):
- platform/gamepad/cocoa/GameControllerGamepadProvider.mm:
(WebCore::GameControllerGamepadProvider::controllerDidConnect):
- platform/gamepad/mac/HIDGamepadProvider.cpp:
(WebCore::HIDGamepadProvider::deviceAdded):
- platform/graphics/ImageBackingStore.h:
(WebCore::ImageBackingStore::setSize):
- platform/graphics/WOFFFileFormat.cpp:
- platform/graphics/avfoundation/InbandMetadataTextTrackPrivateAVF.cpp:
(WebCore::InbandMetadataTextTrackPrivateAVF::updatePendingCueEndTimes):
(WebCore::InbandMetadataTextTrackPrivateAVF::flushPartialCues):
- platform/graphics/avfoundation/InbandTextTrackPrivateAVF.cpp:
(WebCore::InbandTextTrackPrivateAVF::resetCueValues):
(WebCore::InbandTextTrackPrivateAVF::readNativeSampleBuffer):
- platform/graphics/avfoundation/cf/InbandTextTrackPrivateAVCF.cpp:
(WebCore::InbandTextTrackPrivateAVCF::readNativeSampleBuffer):
- platform/graphics/cg/ImageBufferCG.cpp:
(WebCore::cfData):
- platform/image-decoders/bmp/BMPImageDecoder.cpp:
(WebCore::BMPImageDecoder::frameBufferAtIndex):
- platform/image-decoders/ico/ICOImageDecoder.cpp:
(WebCore::ICOImageDecoder::decode):
- platform/image-decoders/jpeg/JPEGImageDecoder.cpp:
(WebCore::JPEGImageDecoder::frameBufferAtIndex):
- platform/image-decoders/png/PNGImageDecoder.cpp:
(WebCore::PNGImageDecoder::frameBufferAtIndex):
(WebCore::PNGImageDecoder::readChunks):
- platform/image-decoders/webp/WEBPImageDecoder.cpp:
(WebCore::WEBPImageDecoder::frameBufferAtIndex):
- platform/image-encoders/JPEGImageEncoder.cpp:
(WebCore::compressRGBABigEndianToJPEG):
- platform/text/DecodeEscapeSequences.h:
(WebCore::URLEscapeSequence::decodeRun):
- platform/text/SuffixTree.h:
(WebCore::SuffixTree::Node::Node):
(WebCore::Grid::setNeedsItemsPlacement):
- rendering/RenderTable.cpp:
(WebCore::RenderTable::invalidateCachedColumns):
Source/WebKit:
- Platform/IPC/ArgumentCoders.h:
- UIProcess/Gamepad/UIGamepadProvider.cpp:
(WebKit::UIGamepadProvider::platformGamepadConnected):
- UIProcess/WebProcessPool.cpp:
(WebKit::WebProcessPool::setInitialConnectedGamepads):
- WebProcess/Network/WebLoaderStrategy.cpp:
(WebKit::WebLoaderStrategy::loadResourceSynchronously):
- WebProcess/WebCoreSupport/WebPasteboardOverrides.cpp:
(WebKit::WebPasteboardOverrides::getDataForOverride):
- WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::requestAutocorrectionData):
Source/WebKitLegacy/mac:
- Plugins/WebNetscapePluginView.mm:
(-[WebNetscapePluginView saveAndSetNewPortStateForUpdate:]):
Source/WTF:
(WTF::OverflowHandler>::IndexSparseSet):
(WTF::OverflowHandler>::clear):
(WTF::executeInsertions):
(WTF::RangeSet::compact):
(WTF::removeRepeatedElements):
- wtf/persistence/Coders.h: