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


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.h

    r1799 r1825  
    279279    static UString from(unsigned int u);
    280280    /**
     281     * Constructs a string from a long.
     282     */
     283    static UString from(long l);
     284    /**
    281285     * Constructs a string from a double.
    282286     */
Note: See TracChangeset for help on using the changeset viewer.