Changeset 44641 in webkit for trunk/JavaScriptCore
- Timestamp:
- Jun 12, 2009, 5:41:03 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r44633 r44641 1 2009-06-12 David Levin <[email protected]> 2 3 Reviewed by Darin Adler. 4 5 UString shouldn't create sharedBuffer for SmallStrings. 6 https://bugs.webkit.org/show_bug.cgi?id=26360 7 8 The methods changed are not used by JSC, so there is no JS perf impact. However, 9 there is a potential DOM perf impact, so I re-ran several of the tests that 10 I ran previously and ensured that the perf stay the same which caused me to 11 adjust the minLengthToShare. 12 13 * JavaScriptCore.exp: 14 * runtime/UString.cpp: 15 (JSC::UString::Rep::sharedBuffer): 16 Determines if the buffer being shared is big enough before doing so. 17 Previously, BaseString::sharedBuffer was called but it would only know 18 the length of the base string (BaseString::len) which may not be the same 19 as the string being shared (Rep::len). 20 (JSC::UString::BaseString::sharedBuffer): 21 This is now only be used by Rep::sharedBuffer. which does the length check. 22 * runtime/UString.h: 23 1 24 2009-06-12 Dimitri Glazkov <[email protected]> 2 25 -
trunk/JavaScriptCore/JavaScriptCore.exp
r44508 r44641 218 218 __ZN3JSC7Profile7excludeEPKNS_11ProfileNodeE 219 219 __ZN3JSC7Profile7forEachEMNS_11ProfileNodeEFvvE 220 __ZN3JSC7UString 10BaseString12sharedBufferEv220 __ZN3JSC7UString3Rep12sharedBufferEv 221 221 __ZN3JSC7UString3Rep11computeHashEPKci 222 222 __ZN3JSC7UString3Rep11computeHashEPKti -
trunk/JavaScriptCore/runtime/UString.cpp
r44325 r44641 64 64 65 65 // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. 66 static const int minLengthToShare = 30;66 static const int minLengthToShare = 10; 67 67 68 68 static inline size_t overflowIndicator() { return std::numeric_limits<size_t>::max(); } … … 244 244 } 245 245 246 UString::SharedUChar* UString::Rep::sharedBuffer() 247 { 248 UString::BaseString* base = baseString(); 249 if (len < minLengthToShare) 250 return 0; 251 252 return base->sharedBuffer(); 253 } 254 246 255 void UString::Rep::destroy() 247 256 { … … 386 395 UString::SharedUChar* UString::BaseString::sharedBuffer() 387 396 { 388 389 if (len < minLengthToShare)390 return 0;391 392 397 if (!m_sharedBuffer) 393 398 setSharedBuffer(SharedUChar::create(new OwnFastMallocPtr<UChar>(buf))); -
trunk/JavaScriptCore/runtime/UString.h
r44325 r44641 108 108 static PassRefPtr<Rep> create(UChar*, int, PassRefPtr<SharedUChar>); 109 109 110 SharedUChar* sharedBuffer(); 110 111 void destroy(); 111 112 … … 193 194 bool isShared() { return rc != 1 || isBufferReadOnly(); } 194 195 void setSharedBuffer(PassRefPtr<SharedUChar>); 195 SharedUChar* sharedBuffer();196 196 197 197 bool isBufferReadOnly() … … 225 225 } 226 226 227 SharedUChar* sharedBuffer(); 227 228 bool slowIsBufferReadOnly(); 228 229
Note:
See TracChangeset
for help on using the changeset viewer.