Ignore:
Timestamp:
Apr 16, 2009, 11:20:32 PM (16 years ago)
Author:
Stephanie Lewis
Message:

2009-04-16 Stephanie Lewis <Stephanie Lewis>

Reviewed by Oliver Hunt.

<rdar://problem/6744652> 32-bit to 64-bit: Javascript hash tables double in size

Remove perfect hash optimization which removes 1 MB of overhead on 32-bit and almost 2 MB on 64-bit. Removing the optimization was not a regression on SunSpider and the acid 3 test still passes.

  • create_hash_table:
  • runtime/Lookup.cpp: (JSC::HashTable::createTable): (JSC::HashTable::deleteTable):
  • runtime/Lookup.h: (JSC::HashEntry::initialize): (JSC::HashEntry::next): (JSC::HashTable::entry):
  • runtime/Structure.cpp: (JSC::Structure::getEnumerableNamesFromClassInfoTable):
File:
1 edited

Legend:

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

    r39670 r42606  
    3131#include <wtf/Assertions.h>
    3232
    33 // Set ENABLE_PERFECT_HASH_SIZE to 0 to save memory at the
    34 // cost of speed.  Test your platform as results may vary.
    35 #define ENABLE_PERFECT_HASH_SIZE 1
    36 
    3733namespace JSC {
    3834
     
    5854            m_u.store.value1 = v1;
    5955            m_u.store.value2 = v2;
    60 #if !ENABLE(PERFECT_HASH_SIZE)
    6156            m_next = 0;
    62 #endif
    6357        }
    6458
     
    7670        intptr_t lexerValue() const { ASSERT(!m_attributes); return m_u.lexer.value; }
    7771
    78 #if !ENABLE(PERFECT_HASH_SIZE)
    7972        void setNext(HashEntry *next) { m_next = next; }
    8073        HashEntry* next() const { return m_next; }
    81 #endif
    8274
    8375    private:
     
    10496        } m_u;
    10597
    106 #if !ENABLE(PERFECT_HASH_SIZE)
    10798        HashEntry* m_next;
    108 #endif
    10999    };
    110100
    111101    struct HashTable {
    112 #if ENABLE(PERFECT_HASH_SIZE)
    113         int hashSizeMask; // Precomputed size for the hash table (minus 1).
    114 #else
     102
    115103        int compactSize;
    116104        int compactHashSizeMask;
    117 #endif
     105
    118106        const HashTableValue* values; // Fixed values generated by script.
    119107        mutable const HashEntry* table; // Table allocated at runtime.
     
    149137        ALWAYS_INLINE const HashEntry* entry(const Identifier& identifier) const
    150138        {
    151 #if ENABLE(PERFECT_HASH_SIZE)
    152             ASSERT(table);
    153             const HashEntry* entry = &table[identifier.ustring().rep()->computedHash() & hashSizeMask];
    154             if (entry->key() != identifier.ustring().rep())
    155                 return 0;
    156             return entry;
    157 #else
    158139            ASSERT(table);
    159140
     
    170151
    171152            return 0;
    172 #endif
    173153        }
    174154
Note: See TracChangeset for help on using the changeset viewer.