Changeset 1791 in webkit for trunk/JavaScriptCore/kjs/regexp.cpp


Ignore:
Timestamp:
Aug 9, 2002, 9:31:50 PM (23 years ago)
Author:
darin
Message:

JavaScriptCore:

Some string speedups. Makes sony.com cached 11% faster.

  • kjs/ustring.h: Made it possible for UChar objects to be uninitialized, which gives a speed boost. Inlined CString's +=, UString's destructor, +=, and +.
  • kjs/ustring.cpp: (UString::UString): Optimize const char * version, which showed up heavily in performance analysis. Added new two-UString version, which makes the + operator fast. (UString::ascii): Remove thread safety changes. Change static buffer to remember its size, and to always be at least 4096 bytes long; that way we never have to reallocate unless it's for a long string. Also make code to extract the characters significantly faster by getting rid of two pointer dereferences per character. (UString::is8Bit): Avoid one pointer dereference per character. (UString::toDouble): Use ascii() instead of cstring() to avoid copying the string.
  • kjs/collector.cpp: Remove unneeded APPLE_CHANGES.
  • kjs/regexp.cpp: Remove ifdefs around some APPLE_CHANGES that we want to keep, because they just fix warnings.
  • kjs/value.h: Remove obsolete APPLE_CHANGES comment.
  • JavaScriptCore.pbproj/project.pbxproj: Project Builder decided to move a line around in the file.

WebCore:

  • force-clean-timestamp: JavaScriptCore headers changed that require a full build here.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/regexp.cpp

    r1623 r1791  
    115115    return UString::null; // don't rely on the return value if you pass ovector==0
    116116#else
    117 #ifdef APPLE_CHANGES
    118117  const uint maxMatch = 10;
    119 #else
    120   const int maxMatch = 10;
    121 #endif
    122118  regmatch_t rmatch[maxMatch];
    123119
     
    136132  // map rmatch array to ovector used in PCRE case
    137133  nrSubPatterns = 0;
    138 #ifdef APPLE_CHANGES
    139134  for(uint j = 1; j < maxMatch && rmatch[j].rm_so >= 0 ; j++)
    140 #else
    141   for(int j = 1; j < maxMatch && rmatch[j].rm_so >= 0 ; j++)
    142 #endif
    143135      nrSubPatterns++;
    144136  int ovecsize = (nrSubPatterns+1)*3; // see above
    145137  *ovector = new int[ovecsize];
    146 #ifdef APPLE_CHANGES
    147138  for (uint j = 0; j < nrSubPatterns + 1; j++) {
    148 #else
    149   for (int j = 0; j < nrSubPatterns + 1; j++) {
    150 #endif
    151139    if (j>maxMatch)
    152140      break;
    153141    (*ovector)[2*j] = rmatch[j].rm_so + i;
    154142    (*ovector)[2*j+1] = rmatch[j].rm_eo + i;
    155 #ifdef APPLE_CHANGES
    156   } // balance extra { so we don't confuse prepare-ChangeLog
    157 #else
    158143  }
    159 #endif
    160144#endif
    161145
Note: See TracChangeset for help on using the changeset viewer.