Changeset 1825 in webkit for trunk/JavaScriptCore/kjs/ustring.cpp


Ignore:
Timestamp:
Aug 15, 2002, 5:02:07 AM (23 years ago)
Author:
mjs
Message:

Phase 2 of fixnum optimization. Store any integral number that
will fit in two bits less than a long inside the ValueImp *
itself, thus avoiding the need to deal with the garbage collector
at all for these types. Such numbers comprised .5 million of the
1.7 million ValueImps created during the cvs-js-performance test,
so traffic through the garbage collector should be

20% improvement on cvs-js-performance. This may also show up on
cvs-base, but I did not compare and I am too lazy to make clean in
WebCore yet again.

This also significantly reduces memory footprint on
JavaScript-heavy pages. Size after going through
cvs-js-performance suite is now down from 22 MB to 17.5 MB.

  • JavaScriptCore.pbproj/project.pbxproj:
  • kjs/simple_number.h: Added. Some inline static methods for handling simple numbers that are stored in the pointer.
  • kjs/ustring.h:
  • kjs/ustring.cpp: (UString::from): Added new overload for long.
  • kjs/value.cpp: (ValueImp::marked): Add special case for simple numbers. (ValueImp::setGcAllowed): Likewise. (ValueImp::toInteger): Call dispatch version of toUInt32(unsigned&), not the real method. (ValueImp::toInt32): Likewise. (ValueImp::toUInt32): Likewise. (ValueImp::toUInt16): Likewise. (ValueImp::dispatchType): Add special case for simple numbers. (ValueImp::dispatchToPrimitive): Likewise. (ValueImp::dispatchToBoolean): Likewise. (ValueImp::dispatchToNumber): Likewise. (ValueImp::dispatchToString): Likewise. (ValueImp::dispatchToObject): Likewise. (ValueImp::dispatchToUInt32): Likewise. (ValueImp::dispatchGetBase): Likewise. (ValueImp::dispatchGetPropertyName): Likewise. (ValueImp::dispatchPutValue): Likewise. (ValueImp::dispatchDeleteValue): Likewise. (Number::Number): Create a simple number instead of a full-blown ValueImp when possible. (Number::value): Likewise.
  • kjs/value.h:
File:
1 edited

Legend:

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

    r1799 r1825  
    260260  char buf[40];
    261261  sprintf(buf, "%u", u);
     262
     263  return UString(buf);
     264}
     265
     266UString UString::from(long l)
     267{
     268  char buf[40];
     269  sprintf(buf, "%ld", l);
    262270
    263271  return UString(buf);
Note: See TracChangeset for help on using the changeset viewer.