Ignore:
Timestamp:
Jan 14, 2010, 11:48:03 PM (15 years ago)
Author:
[email protected]
Message:

https://bugs.webkit.org/show_bug.cgi?id=33705
UStringImpl::create() should use internal storage

Reviewed by Oliver Hunt.

When creating a UStringImpl copying of a UChar*, we can use an internal buffer,
by calling UStringImpl::tryCreateUninitialized().

Also, remove duplicate of copyChars from JSString, call UStringImpl's version.

Small (max 0.5%) progression on Sunspidey.

  • runtime/JSString.cpp:

(JSC::JSString::resolveRope):

  • runtime/UStringImpl.h:

(JSC::UStringImpl::create):

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/JSString.cpp

    r53320 r53323  
    6565{
    6666    destructNonRecursive();
    67 }
    68 
    69 #define ROPE_COPY_CHARS_INLINE_CUTOFF 20
    70 
    71 static inline void copyChars(UChar* destination, const UChar* source, unsigned numCharacters)
    72 {
    73 #ifdef ROPE_COPY_CHARS_INLINE_CUTOFF
    74     if (numCharacters <= ROPE_COPY_CHARS_INLINE_CUTOFF) {
    75         for (unsigned i = 0; i < numCharacters; ++i)
    76             destination[i] = source[i];
    77         return;
    78     }
    79 #endif
    80     memcpy(destination, source, numCharacters * sizeof(UChar));
    8167}
    8268
     
    129115            unsigned length = string->size();
    130116            position -= length;
    131             copyChars(position, string->data(), length);
     117            UStringImpl::copyChars(position, string->data(), length);
    132118
    133119            // Was this the last item in the work queue?
Note: See TracChangeset for help on using the changeset viewer.