Ignore:
Timestamp:
Mar 26, 2008, 10:44:59 AM (17 years ago)
Author:
[email protected]
Message:

Reviewed by Darin.

Cache C string identifiers by address, not value, assuming that C strings can only
be literals.

1% speedup on Acid3 test 26.

  • kjs/identifier.cpp: (KJS::literalIdentifierTable): (KJS::Identifier::add): Added a new table to cache UString::Reps created from C strings by address. Elements are never removed from this cache, as only predefined identifiers can get there.
  • kjs/identifier.h: (KJS::Identifier::Identifier): Added a warning.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/identifier.h

    r31147 r31319  
    3030    public:
    3131        Identifier() { }
    32         Identifier(const char* s) : _ustring(add(s)) { }
     32        Identifier(const char* s) : _ustring(add(s)) { } // Only to be used with string literals.
    3333        Identifier(const UChar* s, int length) : _ustring(add(s, length)) { }
    3434        explicit Identifier(UString::Rep* rep) : _ustring(add(rep)) { }
Note: See TracChangeset for help on using the changeset viewer.