Ignore:
Timestamp:
Mar 5, 2010, 3:29:13 PM (15 years ago)
Author:
[email protected]
Message:

2010-03-05 Oliver Hunt <[email protected]>

Reviewed by Gavin Barraclough.

JSC should cache int to Identifier conversion as it does for ordinary strings
https://bugs.webkit.org/show_bug.cgi?id=35814

Make the NumericStrings cache cache unsigned ints in addition to signed.
We keep them separate from the int cache as it both simplifies code, and
also because the unsigned path is exclusive to property access and therefore
seems to have different usage patterns.

The primary trigger for the unsigned to Identifier propertyName conversion
is the construction of array-like objects out of normal objects. Given these
tend to be relative small numbers, and the array-like behaviour lends itself
to sequential values this patch also adds a non-colliding cache for all small
numbers.

  • JavaScriptCore.exp:
  • runtime/Identifier.cpp: (JSC::Identifier::from):
  • runtime/Identifier.h:
  • runtime/NumericStrings.h: (JSC::NumericStrings::add): (JSC::NumericStrings::lookup): (JSC::NumericStrings::lookupSmallString):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/runtime/Identifier.h

    r54789 r55599  
    5555        const char* ascii() const { return _ustring.ascii(); }
    5656       
    57         static Identifier from(ExecState* exec, unsigned y) { return Identifier(exec, UString::from(y)); }
    58         static Identifier from(ExecState* exec, int y) { return Identifier(exec, UString::from(y)); }
    59         static Identifier from(ExecState* exec, double y) { return Identifier(exec, UString::from(y)); }
     57        static Identifier from(ExecState* exec, unsigned y);
     58        static Identifier from(ExecState* exec, int y);
     59        static Identifier from(ExecState* exec, double y);
    6060       
    6161        bool isNull() const { return _ustring.isNull(); }
Note: See TracChangeset for help on using the changeset viewer.