Changeset 39350 in webkit for trunk/JavaScriptCore/runtime/Identifier.cpp
- Timestamp:
- Dec 16, 2008, 6:23:02 PM (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Identifier.cpp
r38528 r39350 97 97 } 98 98 99 struct CStringTranslator 100 { 99 struct CStringTranslator { 101 100 static unsigned hash(const char* c) 102 101 { … … 117 116 118 117 UString::Rep* r = UString::Rep::create(d, static_cast<int>(length)).releaseRef(); 119 r->rc = 0;120 118 r->_hash = hash; 121 119 … … 144 142 return iter->second; 145 143 146 UString::Rep* addedString = *identifierTable.add<const char*, CStringTranslator>(c).first; 147 literalIdentifierTable.add(c, addedString); 148 149 return addedString; 144 pair<HashSet<UString::Rep*>::iterator, bool> addResult = identifierTable.add<const char*, CStringTranslator>(c); 145 146 // If the string is newly-translated, then we need to adopt it. 147 // The boolean in the pair tells us if that is so. 148 RefPtr<UString::Rep> addedString = addResult.second ? adoptRef(*addResult.first) : *addResult.first; 149 150 literalIdentifierTable.add(c, addedString.get()); 151 152 return addedString.release(); 150 153 } 151 154 … … 160 163 }; 161 164 162 struct UCharBufferTranslator 163 { 165 struct UCharBufferTranslator { 164 166 static unsigned hash(const UCharBuffer& buf) 165 167 { … … 179 181 180 182 UString::Rep* r = UString::Rep::create(d, buf.length).releaseRef(); 181 r->rc = 0;182 183 r->_hash = hash; 183 184 … … 198 199 } 199 200 UCharBuffer buf = {s, length}; 200 return *globalData->identifierTable->add<UCharBuffer, UCharBufferTranslator>(buf).first; 201 pair<HashSet<UString::Rep*>::iterator, bool> addResult = globalData->identifierTable->add<UCharBuffer, UCharBufferTranslator>(buf); 202 203 // If the string is newly-translated, then we need to adopt it. 204 // The boolean in the pair tells us if that is so. 205 return addResult.second ? adoptRef(*addResult.first) : *addResult.first; 201 206 } 202 207
Note:
See TracChangeset
for help on using the changeset viewer.