Ignore:
Timestamp:
Nov 20, 2002, 12:15:18 AM (23 years ago)
Author:
darin
Message:
  • atomic identifiers; gives another 6.5% in the iBench suite
  • kjs/identifier.h: Did the real thing.
  • kjs/identifier.cpp: Ditto.
  • kjs/property_map.h: _tableSizeHashMask -> _tableSizeMask
  • kjs/property_map.cpp: The above, plus take advantage of comparing by pointer instead of by comparing bytes.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/property_map.cpp

    r2769 r2776  
    3636PropertyMap::~PropertyMap()
    3737{
    38     //printf("key count is %d\n", _keyCount);
    3938    UString::Rep *key = _singleEntry.key;
    4039    if (key)
     
    6766inline int PropertyMap::hash(const UString::Rep *s) const
    6867{
    69     return s->hash() & _tableSizeHashMask;
    70 }
    71 
    72 bool PropertyMap::keysMatch(const UString::Rep *a, const UString::Rep *b)
    73 {
    74     if (a == b)
    75         return true;
    76    
    77     int len = a->len;
    78     if (len != b->len)
    79         return false;
    80    
    81     for (int i = 0; i != len; ++i)
    82         if (a->dat[i].unicode() != b->dat[i].unicode())
    83             return false;
    84    
    85     return true;
     68    return s->hash() & _tableSizeMask;
    8669}
    8770
     
    9073    if (!_table) {
    9174        UString::Rep *key = _singleEntry.key;
    92         if (key && keysMatch(name._ustring.rep, key)) {
     75        if (name._ustring.rep == key) {
    9376            attributes = _singleEntry.attributes;
    9477            return _singleEntry.value;
     
    9982    int i = hash(name._ustring.rep);
    10083    while (UString::Rep *key = _table[i].key) {
    101         if (keysMatch(name._ustring.rep, key)) {
     84        if (name._ustring.rep == key) {
    10285            attributes = _table[i].attributes;
    10386            return _table[i].value;
    10487        }
    105         i = (i + 1) & _tableSizeHashMask;
     88        i = (i + 1) & _tableSizeMask;
    10689    }
    10790    return 0;
     
    11295    if (!_table) {
    11396        UString::Rep *key = _singleEntry.key;
    114         if (key && keysMatch(name._ustring.rep, key))
     97        if (name._ustring.rep == key)
    11598            return _singleEntry.value;
    11699        return 0;
     
    119102    int i = hash(name._ustring.rep);
    120103    while (UString::Rep *key = _table[i].key) {
    121         if (keysMatch(name._ustring.rep, key))
     104        if (name._ustring.rep == key)
    122105            return _table[i].value;
    123         i = (i + 1) & _tableSizeHashMask;
     106        i = (i + 1) & _tableSizeMask;
    124107    }
    125108    return 0;
     
    131114        UString::Rep *key = _singleEntry.key;
    132115        if (key) {
    133             if (keysMatch(name._ustring.rep, key)) {
     116            if (name._ustring.rep == key) {
    134117                _singleEntry.value = value;
    135118                return;
     
    150133    int i = hash(name._ustring.rep);
    151134    while (UString::Rep *key = _table[i].key) {
    152         if (keysMatch(name._ustring.rep, key)) {
     135        if (name._ustring.rep == key) {
    153136            // Put a new value in an existing hash table entry.
    154137            _table[i].value = value;
     
    156139            return;
    157140        }
    158         i = (i + 1) & _tableSizeHashMask;
     141        i = (i + 1) & _tableSizeMask;
    159142    }
    160143   
     
    171154    int i = hash(key);
    172155    while (_table[i].key)
    173         i = (i + 1) & _tableSizeHashMask;
     156        i = (i + 1) & _tableSizeMask;
    174157   
    175158    _table[i].key = key;
     
    184167
    185168    _tableSize = oldTableSize ? oldTableSize * 2 : 16;
    186     _tableSizeHashMask = _tableSize - 1;
     169    _tableSizeMask = _tableSize - 1;
    187170    _table = (Entry *)calloc(_tableSize, sizeof(Entry));
    188171
     
    208191    if (!_table) {
    209192        key = _singleEntry.key;
    210         if (key && keysMatch(name._ustring.rep, key)) {
     193        if (name._ustring.rep == key) {
    211194            key->deref();
    212195            _singleEntry.key = 0;
     
    219202    int i = hash(name._ustring.rep);
    220203    while ((key = _table[i].key)) {
    221         if (keysMatch(name._ustring.rep, key))
     204        if (name._ustring.rep == key)
    222205            break;
    223         i = (i + 1) & _tableSizeHashMask;
     206        i = (i + 1) & _tableSizeMask;
    224207    }
    225208    if (!key)
     
    233216    // Reinsert all the items to the right in the same cluster.
    234217    while (1) {
    235         i = (i + 1) & _tableSizeHashMask;
     218        i = (i + 1) & _tableSizeMask;
    236219        key = _table[i].key;
    237220        if (!key)
Note: See TracChangeset for help on using the changeset viewer.