-
benjamin@webkit.org authored
https://bugs.webkit.org/show_bug.cgi?id=83180 Patch by Benjamin Poulain <bpoulain@apple.com> on 2012-04-05 Reviewed by Geoffrey Garen. This patch add the class JSStringJoiner optimized for join() operations. This class makes stricter constraints than JSStringBuilder in order avoid memory allocations. In the best case, the class allocate memory only twice: -Allocate an array to keep a list of UString to join. -Allocate the final string. We also avoid the conversion from 8bits strings to 16bits strings since they are costly and unlikly to help for subsequent calls. * CMakeLists.txt: * GNUmakefile.list.am: * JavaScriptCore.gypi: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * Target.pri: * runtime/ArrayPrototype.cpp: (JSC::arrayProtoFuncToLocaleString): (JSC::arrayProtoFuncJoin): * runtime/JSStringJoiner.cpp: Added. (JSC): (JSC::appendStringToData): (JSC::joinStrings): (JSC::JSStringJoiner::build): * runtime/JSStringJoiner.h: Added. (JSC): (JSStringJoiner): (JSC::JSStringJoiner::JSStringJoiner): (JSC::JSStringJoiner::append): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@113355 268f45cc-cd09-0410-ab3c-d52691b4dbfc
7be398bf