Changeset 101186 in webkit
- Timestamp:
- Nov 25, 2011, 10:01:06 PM (15 years ago)
- Location:
- trunk/Source/JavaScriptCore
- Files:
-
- 2 edited
-
ChangeLog (modified) (1 diff)
-
runtime/ArrayPrototype.cpp (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/ChangeLog
r101152 r101186 1 2011-11-25 Michael Saboff <msaboff@apple.com> 2 3 Array.toString always uses StringImpl::characters() 4 https://bugs.webkit.org/show_bug.cgi?id=72969 5 6 If all component strings are 8 bit, create an 8 bit result string for toString(). 7 8 This appears to be performance neutral to sunspider and v8. 9 10 Reviewed by Filip Pizlo. 11 12 * runtime/ArrayPrototype.cpp: 13 (JSC::arrayProtoFuncToString): 14 1 15 2011-11-24 Michael Saboff <msaboff@apple.com> 2 16 -
trunk/Source/JavaScriptCore/runtime/ArrayPrototype.cpp
r100006 r101186 186 186 unsigned totalSize = length ? length - 1 : 0; 187 187 Vector<RefPtr<StringImpl>, 256> strBuffer(length); 188 bool allStrings8Bit = true; 188 189 189 190 for (unsigned k = 0; k < length; k++) { … … 200 201 strBuffer[k] = str.impl(); 201 202 totalSize += str.length(); 203 allStrings8Bit = allStrings8Bit && str.is8Bit(); 202 204 203 205 if (!strBuffer.data()) { … … 210 212 if (!totalSize) 211 213 return JSValue::encode(jsEmptyString(exec)); 214 215 if (allStrings8Bit) { 216 Vector<LChar> buffer; 217 buffer.reserveCapacity(totalSize); 218 if (!buffer.data()) 219 return JSValue::encode(throwOutOfMemoryError(exec)); 220 221 for (unsigned i = 0; i < length; i++) { 222 if (i) 223 buffer.append(','); 224 if (RefPtr<StringImpl> rep = strBuffer[i]) 225 buffer.append(rep->characters8(), rep->length()); 226 } 227 ASSERT(buffer.size() == totalSize); 228 return JSValue::encode(jsString(exec, UString::adopt(buffer))); 229 } 230 212 231 Vector<UChar> buffer; 213 232 buffer.reserveCapacity(totalSize);
Note:
See TracChangeset
for help on using the changeset viewer.