Changeset 163808 in webkit for trunk/Source/JavaScriptCore/runtime/Identifier.h
- Timestamp:
- Feb 10, 2014, 12:39:12 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/JavaScriptCore/runtime/Identifier.h
r162784 r163808 96 96 97 97 // Only to be used with string literals. 98 static PassRef Ptr<StringImpl> add(VM*, const char*);99 JS_EXPORT_PRIVATE static PassRef Ptr<StringImpl> add(ExecState*, const char*);98 static PassRef<StringImpl> add(VM*, const char*); 99 JS_EXPORT_PRIVATE static PassRef<StringImpl> add(ExecState*, const char*); 100 100 101 101 private: … … 108 108 static bool equal(const Identifier& a, const LChar* b) { return equal(a.m_string.impl(), b); } 109 109 110 template <typename T> static PassRef Ptr<StringImpl> add(VM*, const T*, int length);111 static PassRef Ptr<StringImpl> add8(VM*, const UChar*, int length);110 template <typename T> static PassRef<StringImpl> add(VM*, const T*, int length); 111 static PassRef<StringImpl> add8(VM*, const UChar*, int length); 112 112 template <typename T> ALWAYS_INLINE static bool canUseSingleCharacterString(T); 113 113 114 static PassRef Ptr<StringImpl> add(ExecState* exec, StringImpl* r)114 static PassRef<StringImpl> add(ExecState* exec, StringImpl* r) 115 115 { 116 116 #ifndef NDEBUG … … 118 118 #endif 119 119 if (r->isIdentifier()) 120 return r;120 return *r; 121 121 return addSlowCase(exec, r); 122 122 } 123 static PassRef Ptr<StringImpl> add(VM* vm, StringImpl* r)123 static PassRef<StringImpl> add(VM* vm, StringImpl* r) 124 124 { 125 125 #ifndef NDEBUG … … 127 127 #endif 128 128 if (r->isIdentifier()) 129 return r;129 return *r; 130 130 return addSlowCase(vm, r); 131 131 } 132 132 133 JS_EXPORT_PRIVATE static PassRef Ptr<StringImpl> addSlowCase(ExecState*, StringImpl* r);134 JS_EXPORT_PRIVATE static PassRef Ptr<StringImpl> addSlowCase(VM*, StringImpl* r);133 JS_EXPORT_PRIVATE static PassRef<StringImpl> addSlowCase(ExecState*, StringImpl* r); 134 JS_EXPORT_PRIVATE static PassRef<StringImpl> addSlowCase(VM*, StringImpl* r); 135 135 136 136 JS_EXPORT_PRIVATE static void checkCurrentIdentifierTable(ExecState*); … … 179 179 180 180 template <typename T> 181 PassRef Ptr<StringImpl> Identifier::add(VM* vm, const T* s, int length)181 PassRef<StringImpl> Identifier::add(VM* vm, const T* s, int length) 182 182 { 183 183 if (length == 1) { … … 188 188 189 189 if (!length) 190 return StringImpl::empty();190 return *StringImpl::empty(); 191 191 CharBuffer<T> buf = { s, static_cast<unsigned>(length) }; 192 192 HashSet<StringImpl*>::AddResult addResult = vm->identifierTable->add<CharBuffer<T>, IdentifierCharBufferTranslator<T>>(buf); … … 194 194 // If the string is newly-translated, then we need to adopt it. 195 195 // The boolean in the pair tells us if that is so. 196 return addResult.isNewEntry ? adoptRef(* addResult.iterator) :*addResult.iterator;196 return addResult.isNewEntry ? adoptRef(**addResult.iterator) : **addResult.iterator; 197 197 } 198 198
Note:
See TracChangeset
for help on using the changeset viewer.