-
barraclough@apple.com authored
Refactor construction of simple strings to avoid string concatenation. Reviewed by Oliver Hunt. Building strings through concatenation has a memory and performance cost - a memory cost since we must over-allocate the buffer to leave space to append into, and performance in that the string may still require reallocation (and thus copying during construction). Instead move the full construction to within a single function call (makeString), so that the arguments' lengths can be calculated and an appropriate sized buffer allocated before copying any characters. ~No performance change (~2% progression on date tests). * bytecode/CodeBlock.cpp: (JSC::escapeQuotes): (JSC::valueToSourceString): (JSC::constantName): (JSC::idName): (JSC::CodeBlock::registerName): (JSC::regexpToSourceString): (JSC::regexpName): * bytecompiler/NodesCodegen.cpp: (JSC::substitute): * profiler/Profiler.cpp: (JSC::Profiler::createCallIdentifier): * runtime/DateConstructor.cpp: (JSC::callDate): * runtime/DateConversion.cpp: (JSC::formatDate): (JSC::formatDateUTCVariant): (JSC::formatTime): (JSC::formatTimeUTC): * runtime/DateConversion.h: (JSC::): * runtime/DatePrototype.cpp: (JSC::dateProtoFuncToString): (JSC::dateProtoFuncToUTCString): (JSC::dateProtoFuncToDateString): (JSC::dateProtoFuncToTimeString): (JSC::dateProtoFuncToGMTString): * runtime/ErrorPrototype.cpp: (JSC::errorProtoFuncToString): * runtime/ExceptionHelpers.cpp: (JSC::createUndefinedVariableError): (JSC::createErrorMessage): (JSC::createInvalidParamError): * runtime/FunctionPrototype.cpp: (JSC::insertSemicolonIfNeeded): (JSC::functionProtoFuncToString): * runtime/ObjectPrototype.cpp: (JSC::objectProtoFuncToString): * runtime/RegExpConstructor.cpp: (JSC::constructRegExp): * runtime/RegExpObject.cpp: (JSC::RegExpObject::match): * runtime/RegExpPrototype.cpp: (JSC::regExpProtoFuncCompile): (JSC::regExpProtoFuncToString): * runtime/StringPrototype.cpp: (JSC::stringProtoFuncBig): (JSC::stringProtoFuncSmall): (JSC::stringProtoFuncBlink): (JSC::stringProtoFuncBold): (JSC::stringProtoFuncFixed): (JSC::stringProtoFuncItalics): (JSC::stringProtoFuncStrike): (JSC::stringProtoFuncSub): (JSC::stringProtoFuncSup): (JSC::stringProtoFuncFontcolor): (JSC::stringProtoFuncFontsize): (JSC::stringProtoFuncAnchor): * runtime/UString.h: (JSC::): (JSC::makeString): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52028 268f45cc-cd09-0410-ab3c-d52691b4dbfc
e82d3905