Changeset 42606 in webkit for trunk/JavaScriptCore/runtime/Lookup.h
- Timestamp:
- Apr 16, 2009, 11:20:32 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Lookup.h
r39670 r42606 31 31 #include <wtf/Assertions.h> 32 32 33 // Set ENABLE_PERFECT_HASH_SIZE to 0 to save memory at the34 // cost of speed. Test your platform as results may vary.35 #define ENABLE_PERFECT_HASH_SIZE 136 37 33 namespace JSC { 38 34 … … 58 54 m_u.store.value1 = v1; 59 55 m_u.store.value2 = v2; 60 #if !ENABLE(PERFECT_HASH_SIZE)61 56 m_next = 0; 62 #endif63 57 } 64 58 … … 76 70 intptr_t lexerValue() const { ASSERT(!m_attributes); return m_u.lexer.value; } 77 71 78 #if !ENABLE(PERFECT_HASH_SIZE)79 72 void setNext(HashEntry *next) { m_next = next; } 80 73 HashEntry* next() const { return m_next; } 81 #endif82 74 83 75 private: … … 104 96 } m_u; 105 97 106 #if !ENABLE(PERFECT_HASH_SIZE)107 98 HashEntry* m_next; 108 #endif109 99 }; 110 100 111 101 struct HashTable { 112 #if ENABLE(PERFECT_HASH_SIZE) 113 int hashSizeMask; // Precomputed size for the hash table (minus 1). 114 #else 102 115 103 int compactSize; 116 104 int compactHashSizeMask; 117 #endif 105 118 106 const HashTableValue* values; // Fixed values generated by script. 119 107 mutable const HashEntry* table; // Table allocated at runtime. … … 149 137 ALWAYS_INLINE const HashEntry* entry(const Identifier& identifier) const 150 138 { 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 #else158 139 ASSERT(table); 159 140 … … 170 151 171 152 return 0; 172 #endif173 153 } 174 154
Note:
See TracChangeset
for help on using the changeset viewer.