Changeset 90813 in webkit
- Timestamp:
- Jul 12, 2011 6:35:57 AM (13 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r90812 r90813 1 2011-07-12 Adam Roben <aroben@apple.com> 2 3 Ensure no intermediate WTF::Strings are created when concatenating with string literals 4 5 Fixes <http://webkit.org/b/63330> Concatenating string literals and WTF::Strings using 6 operator+ is suboptimal 7 8 Reviewed by Darin Adler. 9 10 * wtf/text/StringConcatenate.h: 11 (WTF::StringTypeAdapter<String>::writeTo): Added a macro that can be used for testing how 12 many WTF::Strings get copied while evaluating an operator+ expression. 13 14 * wtf/text/StringOperators.h: 15 (WTF::operator+): Changed the overload that takes a StringAppend to take it on the left-hand 16 side, since operator+ is left-associative. Having the StringAppend on the right-hand side 17 was causing us to make intermediate WTF::Strings when evaluating expressions that contained 18 multiple calls to operator+. Added some more overloads for that take a left-hand side of 19 const char* to resolve overload ambiguity for certain expressions. Added overloads that take 20 a left-hand side of const UChar* (matching the const char* overloads) so that wide string 21 literals don't first have to be converted to a WTF::String in operator+ expressions. 22 1 23 2011-07-12 Adam Roben <aroben@apple.com> 2 24 -
trunk/Source/JavaScriptCore/wtf/text/StringConcatenate.h
r86330 r90813 31 31 #endif 32 32 33 // This macro is helpful for testing how many intermediate Strings are created while evaluating an 34 // expression containing operator+. 35 #ifndef WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING 36 #define WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING() ((void)0) 37 #endif 38 33 39 namespace WTF { 34 40 … … 181 187 for (unsigned i = 0; i < length; ++i) 182 188 destination[i] = data[i]; 189 190 WTF_STRINGTYPEADAPTER_COPIED_WTF_STRING(); 183 191 } 184 192 -
trunk/Source/JavaScriptCore/wtf/text/StringOperators.h
r86330 r90813 92 92 } 93 93 94 template<typename U, typename V> 95 StringAppend<const char*, StringAppend<U, V> > operator+(const char* string1, const StringAppend<U, V>& string2) 96 { 97 return StringAppend<const char*, StringAppend<U, V> >(string1, string2); 98 } 99 100 inline StringAppend<const UChar*, String> operator+(const UChar* string1, const String& string2) 101 { 102 return StringAppend<const UChar*, String>(string1, string2); 103 } 104 105 inline StringAppend<const UChar*, AtomicString> operator+(const UChar* string1, const AtomicString& string2) 106 { 107 return StringAppend<const UChar*, AtomicString>(string1, string2); 108 } 109 110 template<typename U, typename V> 111 StringAppend<const UChar*, StringAppend<U, V> > operator+(const UChar* string1, const StringAppend<U, V>& string2) 112 { 113 return StringAppend<const UChar*, StringAppend<U, V> >(string1, string2); 114 } 115 94 116 template<typename T> 95 117 StringAppend<String, T> operator+(const String& string1, T string2) … … 99 121 100 122 template<typename U, typename V, typename W> 101 StringAppend< U, StringAppend<V, W> > operator+(U string1, const StringAppend<V, W>&string2)123 StringAppend<StringAppend<U, V>, W> operator+(const StringAppend<U, V>& string1, W string2) 102 124 { 103 return StringAppend< U, StringAppend<V, W>>(string1, string2);125 return StringAppend<StringAppend<U, V>, W>(string1, string2); 104 126 } 105 127 -
trunk/Source/WebKit2/ChangeLog
r90806 r90813 1 2011-07-12 Adam Roben <aroben@apple.com> 2 3 Export some symbols needed by TestWebKitAPI 4 5 Part of <http://webkit.org/b/63330> Concatenating string literals and WTF::Strings using 6 operator+ is suboptimal 7 8 Reviewed by Darin Adler. 9 10 * win/WebKit2.def: 11 1 12 2011-07-11 Hironori Bono <hbono@chromium.org> 2 13 -
trunk/Source/WebKit2/win/WebKit2.def
r90389 r90813 135 135 ?createThread@WTF@@YAIP6APAXPAX@Z0@Z 136 136 137 ; Re-exports from WebCore for WebCoreTestSupport 137 ; Re-exports from WebCore for test harnesses 138 ??0String@WTF@@QAE@PBD@Z 139 ??0String@WTF@@QAE@PB_W@Z 140 ?add@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PBD@Z 138 141 ?addSlowCase@AtomicString@WTF@@CA?AV?$PassRefPtr@VStringImpl@WTF@@@2@PAVStringImpl@2@@Z 139 142 ?cacheDOMStructure@WebCore@@YAPAVStructure@JSC@@PAVJSDOMGlobalObject@1@PAV23@PBUClassInfo@3@@Z -
trunk/Tools/ChangeLog
r90810 r90813 1 2011-07-12 Adam Roben <aroben@apple.com> 2 3 Test that no intermediate WTF::Strings are created when concatenating with string literals 4 5 Test for <http://webkit.org/b/63330> Concatenating string literals and WTF::Strings using 6 operator+ is suboptimal 7 8 Reviewed by Darin Adler. 9 10 * TestWebKitAPI/Tests/WTF/StringOperators.cpp: Added. 11 (TestWebKitAPI::TEST): Test that a bunch of different string concatenation expressions don't 12 create any intermediate WTF::Strings while they're being evaluated. 13 14 * TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj: 15 * TestWebKitAPI/win/TestWebKitAPI.vcproj: 16 Added new file. 17 1 18 2011-07-12 Eric Seidel <eric@webkit.org> 2 19 -
trunk/Tools/TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj
r89515 r90813 54 54 BCBD3761125ABCFE00D2C29F /* FrameMIMETypePNG.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCBD3760125ABCFE00D2C29F /* FrameMIMETypePNG.cpp */; }; 55 55 BCC8B95B12611F4700DE46A4 /* FailedLoad.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */; }; 56 C01363C813C3997300EF3964 /* StringOperators.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C01363C713C3997300EF3964 /* StringOperators.cpp */; }; 56 57 C01A23F21266156700C9ED55 /* spacebar-scrolling.html in Copy Resources */ = {isa = PBXBuildFile; fileRef = C02B7882126615410026BF0F /* spacebar-scrolling.html */; }; 57 58 C02B77F2126612140026BF0F /* SpacebarScrolling.cpp in Sources */ = {isa = PBXBuildFile; fileRef = C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */; }; … … 164 165 BCC8B95A12611F4700DE46A4 /* FailedLoad.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = FailedLoad.cpp; sourceTree = "<group>"; }; 165 166 BCF0F9391381C25B008361AC /* CompilerVersion.xcconfig */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xcconfig; path = CompilerVersion.xcconfig; sourceTree = "<group>"; }; 167 C01363C713C3997300EF3964 /* StringOperators.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StringOperators.cpp; path = WTF/StringOperators.cpp; sourceTree = "<group>"; }; 166 168 C02B77F1126612140026BF0F /* SpacebarScrolling.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SpacebarScrolling.cpp; sourceTree = "<group>"; }; 167 169 C02B7853126613AE0026BF0F /* Carbon.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; name = Carbon.framework; sourceTree = SDKROOT; }; … … 320 322 isa = PBXGroup; 321 323 children = ( 324 C01363C713C3997300EF3964 /* StringOperators.cpp */, 322 325 BC90964B125561BF00083756 /* VectorBasic.cpp */, 323 326 37200B9113A16230007A4FAD /* VectorReverse.cpp */, … … 472 475 C045F9451385C2EA00C0F3CD /* DownloadDecideDestinationCrash.cpp in Sources */, 473 476 37200B9213A16230007A4FAD /* VectorReverse.cpp in Sources */, 477 C01363C813C3997300EF3964 /* StringOperators.cpp in Sources */, 474 478 ); 475 479 runOnlyForDeploymentPostprocessing = 0; -
trunk/Tools/TestWebKitAPI/win/TestWebKitAPI.vcproj
r88477 r90813 589 589 > 590 590 <File 591 RelativePath="..\Tests\WTF\StringOperators.cpp" 592 > 593 </File> 594 <File 591 595 RelativePath="..\Tests\WTF\VectorBasic.cpp" 592 596 >
Note: See TracChangeset
for help on using the changeset viewer.