Changeset 55943 in webkit for trunk/JavaScriptCore/runtime/Identifier.cpp
- Timestamp:
- Mar 12, 2010, 3:49:05 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/Identifier.cpp
r55878 r55943 125 125 PassRefPtr<UString::Rep> Identifier::add(JSGlobalData* globalData, const char* c) 126 126 { 127 if (!c) { 128 UString::Rep* rep = UString::null().rep(); 129 rep->hash(); 130 return rep; 131 } 127 if (!c) 128 return UString::null().rep(); 132 129 if (!c[0]) 133 130 return UString::Rep::empty(); … … 210 207 { 211 208 ASSERT(!r->isIdentifier()); 209 // The empty & null strings are static singletons, and static strings are handled 210 // in ::add() in the header, so we should never get here with a zero length string. 211 ASSERT(r->length()); 212 212 213 if (r->length() == 1) { 213 214 UChar c = r->characters()[0]; 214 215 if (c <= 0xFF) 215 216 r = globalData->smallStrings.singleCharacterStringRep(c); 216 if (r->isIdentifier()) { 217 #ifndef NDEBUG 218 checkSameIdentifierTable(globalData, r); 219 #endif 217 if (r->isIdentifier()) 220 218 return r; 221 } 222 } 223 if (!r->length()) 224 return UString::Rep::empty(); 219 } 220 225 221 return *globalData->identifierTable->add(r).first; 226 222 } … … 253 249 #ifndef NDEBUG 254 250 255 void Identifier::checkSameIdentifierTable(ExecState* exec, UString::Rep*) 256 { 257 ASSERT_UNUSED(exec, exec->globalData().identifierTable == currentIdentifierTable()); 258 } 259 260 void Identifier::checkSameIdentifierTable(JSGlobalData* globalData, UString::Rep*) 261 { 251 void Identifier::checkCurrentIdentifierTable(JSGlobalData* globalData) 252 { 253 // Check the identifier table accessible through the threadspecific matches the 254 // globalData's identifier table. 262 255 ASSERT_UNUSED(globalData, globalData->identifierTable == currentIdentifierTable()); 263 256 } 264 257 258 void Identifier::checkCurrentIdentifierTable(ExecState* exec) 259 { 260 checkCurrentIdentifierTable(&exec->globalData()); 261 } 262 265 263 #else 266 264 267 void Identifier::checkSameIdentifierTable(ExecState*, UString::Rep*) 268 { 269 } 270 271 void Identifier::checkSameIdentifierTable(JSGlobalData*, UString::Rep*) 272 { 273 } 265 // These only exists so that our exports are the same for debug and release builds. 266 // This would be an ASSERT_NOT_REACHED(), but we're in NDEBUG only code here! 267 void Identifier::checkCurrentIdentifierTable(JSGlobalData*) { CRASH(); } 268 void Identifier::checkCurrentIdentifierTable(ExecState*) { CRASH(); } 274 269 275 270 #endif
Note:
See TracChangeset
for help on using the changeset viewer.