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/JavaScriptCore.pbproj/project.pbxproj

    r1791 r1825  
    218218                                F68EBB8E0255D4C601FF60F7,
    219219                                F5C290E70284F98E018635CA,
     220                                F50888B7030BB74C012A967E,
    220221                        );
    221222                        isa = PBXHeadersBuildPhase;
     
    369370                                F692A8870255597D01FF60F7,
    370371                                F692A8880255597D01FF60F7,
     372                                F50888B6030BB74C012A967E,
    371373                        );
    372374                        isa = PBXGroup;
     
    423425//F53
    424426//F54
     427                F50888B6030BB74C012A967E = {
     428                        isa = PBXFileReference;
     429                        name = simple_number.h;
     430                        path = kjs/simple_number.h;
     431                        refType = 4;
     432                };
     433                F50888B7030BB74C012A967E = {
     434                        fileRef = F50888B6030BB74C012A967E;
     435                        isa = PBXBuildFile;
     436                        settings = {
     437                                ATTRIBUTES = (
     438                                        Private,
     439                                );
     440                        };
     441                };
    425442                F531DDEB02F0C2DD018635CA = {
    426443                        buildRules = (
Note: See TracChangeset for help on using the changeset viewer.