Changeset 10265 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Aug 19, 2005, 1:24:17 PM (20 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 4 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 } -
trunk/JavaScriptCore/kjs/identifier.h
r9768 r10265 94 94 }; 95 95 96 #if !KJS_IDENTIFIER_HIDE_GLOBALS 97 extern const Identifier nullIdentifier; 98 99 inline const Identifier &Identifier::null() 100 { return nullIdentifier; } 101 #endif 102 96 103 inline bool operator==(const Identifier &a, const Identifier &b) 97 104 { return Identifier::equal(a, b); } … … 105 112 // List of property names, passed to a macro so we can do set them up various 106 113 // ways without repeating the list. 107 #define KJS_IDENTIFIER_EACH_ GLOBAL(macro) \114 #define KJS_IDENTIFIER_EACH_PROPERTY_NAME_GLOBAL(macro) \ 108 115 macro(arguments) \ 109 116 macro(callee) \ … … 122 129 // Define external global variables for all property names above (and one more). 123 130 #if !KJS_IDENTIFIER_HIDE_GLOBALS 124 #define KJS_IDENTIFIER_DECLARE_GLOBAL(name) extern const Identifier name ## PropertyName; 125 KJS_IDENTIFIER_EACH_GLOBAL(KJS_IDENTIFIER_DECLARE_GLOBAL) 126 KJS_IDENTIFIER_DECLARE_GLOBAL(specialPrototype) 127 #undef KJS_IDENTIFIER_DECLARE_GLOBAL 131 extern const Identifier specialPrototypePropertyName; 132 133 #define KJS_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL(name) extern const Identifier name ## PropertyName; 134 KJS_IDENTIFIER_EACH_PROPERTY_NAME_GLOBAL(KJS_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL) 135 #undef KJS_IDENTIFIER_DECLARE_PROPERTY_NAME_GLOBAL 128 136 #endif 129 137 -
trunk/JavaScriptCore/kjs/ustring.cpp
r9992 r10265 389 389 } 390 390 391 392 UString::UString()393 {394 attach(&Rep::null);395 }396 391 397 392 UString::UString(char c) … … 1127 1122 return *this; 1128 1123 1129 UString::Rep *newRep = Rep::create(rep, pos, len);1124 Rep *newRep = Rep::create(rep, pos, len); 1130 1125 UString result(newRep); 1131 1126 newRep->deref(); -
trunk/JavaScriptCore/kjs/ustring.h
r9768 r10265 205 205 */ 206 206 struct Rep { 207 friend class UString;208 friend bool operator==(const UString&, const UString&);209 210 207 static Rep *create(UChar *d, int l); 211 208 static Rep *createCopying(const UChar *d, int l); … … 518 515 int decodeUTF8Sequence(const char *); 519 516 517 inline UString::UString() 518 { 519 attach(&Rep::null); 520 } 521 520 522 } // namespace 521 523
Note:
See TracChangeset
for help on using the changeset viewer.