Skip to content
  • ggaren@apple.com's avatar
    Added a number => string cache. · a60d51b4
    ggaren@apple.com authored
            
    Patch by Geoffrey Garen <ggaren@apple.com> on 2009-08-20
    Reviewed by Maciej Stachowiak.
    
    1.07x faster on v8 (1.7x faster on v8-splay).
    1.004x faster on SunSpider.
    
    * runtime/JSCell.h: Moved JSValue::toString to JSString.h.
    * runtime/JSGlobalData.h: Holds the cache.
    * runtime/JSNumberCell.cpp:
    (JSC::JSNumberCell::toString):
    (JSC::JSNumberCell::toThisString): Removed -0 special case.
    UString handles this now, since too many clients were
    special-casing it.
    
    * runtime/JSString.h:
    (JSC::JSValue::toString): Use the cache when converting
    an int or double to string.
    
    * runtime/Operations.h:
    (JSC::concatenateStrings): Call toString to take advantage
    of the cache.
    
    * runtime/SmallStrings.h:
    (JSC::NumericStrings::add):
    (JSC::NumericStrings::lookup): The cache.
    
    * runtime/UString.cpp:
    (JSC::UString::from): Added -0 special case mentioned above.
    Removed appendNumeric because it's mutually exclusive with the
    cache.
    
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@47622 268f45cc-cd09-0410-ab3c-d52691b4dbfc
    a60d51b4