Changeset 53221 in webkit for trunk/JavaScriptCore/runtime/UStringImpl.h
- Timestamp:
- Jan 13, 2010, 5:20:52 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/UStringImpl.h
r52856 r53221 129 129 size_t cost() 130 130 { 131 UStringImpl* base = bufferOwnerString(); 131 // For substrings, return the cost of the base string. 132 if (bufferOwnership() == BufferSubstring) 133 return m_dataBuffer.asPtr<UStringImpl*>()->cost(); 134 132 135 if (m_dataBuffer & s_reportedCostBit) 133 136 return 0; 134 137 m_dataBuffer |= s_reportedCostBit; 135 return base->m_length;138 return m_length; 136 139 } 137 140 unsigned hash() const { if (!m_hash) m_hash = computeHash(data(), m_length); return m_hash; } … … 142 145 143 146 UStringImpl* ref() { m_refCount += s_refCountIncrement; return this; } 144 ALWAYS_INLINE void deref() { if (!(m_refCount -= s_refCountIncrement)) de stroy(); }147 ALWAYS_INLINE void deref() { if (!(m_refCount -= s_refCountIncrement)) delete this; } 145 148 146 149 static WTF::PossiblyNull<UChar*> allocChars(size_t length) … … 244 247 } 245 248 246 void* operator new(size_t size) { return fastMalloc(size); }249 using Noncopyable::operator new; 247 250 void* operator new(size_t, void* inPlace) { return inPlace; } 251 252 ~UStringImpl(); 248 253 249 254 // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. … … 257 262 static const int s_staticRefCountInitialValue = 1; 258 263 259 void destroy();260 264 UStringImpl* bufferOwnerString() { return (bufferOwnership() == BufferSubstring) ? m_dataBuffer.asPtr<UStringImpl*>() : this; } 261 265 const UStringImpl* bufferOwnerString() const { return (bufferOwnership() == BufferSubstring) ? m_dataBuffer.asPtr<UStringImpl*>() : this; }
Note:
See TracChangeset
for help on using the changeset viewer.