Changeset 10265 in webkit for trunk/JavaScriptCore/kjs/identifier.cpp
- Timestamp:
- Aug 19, 2005, 1:24:17 PM (20 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/identifier.cpp
r9768 r10265 295 295 } 296 296 297 const Identifier &Identifier::null()298 {299 static Identifier null;300 return null;301 }302 303 297 // Global constants for property name strings. 304 298 … … 310 304 // Use an array of pointers instead of an array of char in case there is some alignment issue. 311 305 #define DEFINE_GLOBAL(name, string) \ 312 void * name ## PropertyName[(sizeof(Identifier) + sizeof(void *) - 1) / sizeof(void *)]; 313 #endif 314 315 #define CALL_DEFINE_GLOBAL(name) DEFINE_GLOBAL(name, #name) 316 KJS_IDENTIFIER_EACH_GLOBAL(CALL_DEFINE_GLOBAL) 317 DEFINE_GLOBAL(specialPrototype, "__proto__") 306 void * name[(sizeof(Identifier) + sizeof(void *) - 1) / sizeof(void *)]; 307 #endif 308 309 const char * const nullCString = 0; 310 311 DEFINE_GLOBAL(nullIdentifier, nullCString) 312 DEFINE_GLOBAL(specialPrototypePropertyName, "__proto__") 313 314 #define DEFINE_PROPERTY_NAME_GLOBAL(name) DEFINE_GLOBAL(name ## PropertyName, #name) 315 KJS_IDENTIFIER_EACH_PROPERTY_NAME_GLOBAL(DEFINE_PROPERTY_NAME_GLOBAL) 318 316 319 317 void Identifier::init() … … 323 321 if (!initialized) { 324 322 // Use placement new to initialize the globals. 325 #define PLACEMENT_NEW_GLOBAL(name, string) new (&name ## PropertyName) Identifier(string); 326 #define CALL_PLACEMENT_NEW_GLOBAL(name) PLACEMENT_NEW_GLOBAL(name, #name) 327 KJS_IDENTIFIER_EACH_GLOBAL(CALL_PLACEMENT_NEW_GLOBAL) 328 PLACEMENT_NEW_GLOBAL(specialPrototype, "__proto__") 323 324 new (&nullIdentifier) Identifier(nullCString); 325 new (&specialPrototypePropertyName) Identifier("__proto__"); 326 327 #define PLACEMENT_NEW_PROPERTY_NAME_GLOBAL(name) new(&name ## PropertyName) Identifier(#name); 328 KJS_IDENTIFIER_EACH_PROPERTY_NAME_GLOBAL(PLACEMENT_NEW_PROPERTY_NAME_GLOBAL) 329 329 330 initialized = true; 330 331 }
Note:
See TracChangeset
for help on using the changeset viewer.