Ignore:
Timestamp:
May 10, 2009, 4:32:31 AM (16 years ago)
Author:
[email protected]
Message:

2009-05-10 Maciej Stachowiak <[email protected]>

Reviewed by Alexey Proskuryakov.


  • speedup dtoa/strtod


Added a bunch of inlining, and replaced malloc with stack allocation.


0.5% SunSpider speedup (7% on string-tagcloud).

  • runtime/NumberPrototype.cpp: (JSC::integerPartNoExp): (JSC::numberProtoFuncToExponential):
  • runtime/UString.cpp: (JSC::concatenate): (JSC::UString::from):
  • wtf/dtoa.cpp: (WTF::BigInt::BigInt): (WTF::BigInt::operator=): (WTF::Balloc): (WTF::Bfree): (WTF::multadd): (WTF::s2b): (WTF::i2b): (WTF::mult): (WTF::pow5mult): (WTF::lshift): (WTF::cmp): (WTF::diff): (WTF::b2d): (WTF::d2b): (WTF::ratio): (WTF::strtod): (WTF::quorem): (WTF::freedtoa): (WTF::dtoa):
  • wtf/dtoa.h:
File:
1 edited

Legend:

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

    r43383 r43457  
    799799    int sign;
    800800
    801     char* result = WTF::dtoa(d, 0, &decimalPoint, &sign, NULL);
     801    char result[80];
     802    WTF::dtoa(result, d, 0, &decimalPoint, &sign, NULL);
    802803    int length = static_cast<int>(strlen(result));
    803804 
     
    850851    }
    851852   
    852   WTF::freedtoa(result);
    853 
    854   return concatenate(rep, buf);
     853    return concatenate(rep, buf);
    855854}
    856855
     
    940939    int decimalPoint;
    941940    int sign;
    942 
    943     char* result = WTF::dtoa(d, 0, &decimalPoint, &sign, NULL);
     941   
     942    char result[80];
     943    WTF::dtoa(result, d, 0, &decimalPoint, &sign, NULL);
    944944    int length = static_cast<int>(strlen(result));
    945945 
     
    992992    }
    993993   
    994   WTF::freedtoa(result);
    995 
    996   return UString(buf);
     994    return UString(buf);
    997995}
    998996
Note: See TracChangeset for help on using the changeset viewer.