Changeset 54789 in webkit for trunk/JavaScriptCore/runtime/UStringImpl.h
- Timestamp:
- Feb 15, 2010, 1:03:45 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/UStringImpl.h
r54743 r54789 54 54 55 55 static PassRefPtr<UStringImpl> create(const char* c); 56 static PassRefPtr<UStringImpl> create(const char* c, intlength);57 static PassRefPtr<UStringImpl> create(const UChar* buffer, intlength);58 59 static PassRefPtr<UStringImpl> create(PassRefPtr<UStringImpl> rep, int offset, intlength)56 static PassRefPtr<UStringImpl> create(const char* c, unsigned length); 57 static PassRefPtr<UStringImpl> create(const UChar* buffer, unsigned length); 58 59 static PassRefPtr<UStringImpl> create(PassRefPtr<UStringImpl> rep, unsigned offset, unsigned length) 60 60 { 61 61 ASSERT(rep); … … 64 64 } 65 65 66 static PassRefPtr<UStringImpl> create(PassRefPtr<SharedUChar> sharedBuffer, UChar* buffer, intlength)66 static PassRefPtr<UStringImpl> create(PassRefPtr<SharedUChar> sharedBuffer, UChar* buffer, unsigned length) 67 67 { 68 68 return adoptRef(new UStringImpl(buffer, length, sharedBuffer)); … … 101 101 SharedUChar* sharedBuffer(); 102 102 UChar* data() const { return m_data; } 103 intsize() const { return m_length; }103 unsigned size() const { return m_length; } 104 104 size_t cost() 105 105 { … … 137 137 } 138 138 139 static unsigned computeHash(const UChar* s, int length) { ASSERT(length >= 0);return WTF::stringHash(s, length); }140 static unsigned computeHash(const char* s, int length) { ASSERT(length >= 0);return WTF::stringHash(s, length); }139 static unsigned computeHash(const UChar* s, unsigned length) { return WTF::stringHash(s, length); } 140 static unsigned computeHash(const char* s, unsigned length) { return WTF::stringHash(s, length); } 141 141 static unsigned computeHash(const char* s) { return WTF::stringHash(s); } 142 142 … … 163 163 164 164 // Used to construct normal strings with an internal or external buffer. 165 UStringImpl(UChar* data, intlength, BufferOwnership ownership)165 UStringImpl(UChar* data, unsigned length, BufferOwnership ownership) 166 166 : m_data(data) 167 167 , m_buffer(0) … … 178 178 // static strings will be shared across threads & ref-counted in a non-threadsafe manner. 179 179 enum StaticStringConstructType { ConstructStaticString }; 180 UStringImpl(UChar* data, intlength, StaticStringConstructType)180 UStringImpl(UChar* data, unsigned length, StaticStringConstructType) 181 181 : m_data(data) 182 182 , m_buffer(0) … … 189 189 190 190 // Used to create new strings that are a substring of an existing string. 191 UStringImpl(UChar* data, intlength, PassRefPtr<UStringImpl> base)191 UStringImpl(UChar* data, unsigned length, PassRefPtr<UStringImpl> base) 192 192 : m_data(data) 193 193 , m_bufferSubstring(base.releaseRef()) … … 205 205 206 206 // Used to construct new strings sharing an existing shared buffer. 207 UStringImpl(UChar* data, intlength, PassRefPtr<SharedUChar> sharedBuffer)207 UStringImpl(UChar* data, unsigned length, PassRefPtr<SharedUChar> sharedBuffer) 208 208 : m_data(data) 209 209 , m_bufferShared(sharedBuffer.releaseRef()) … … 221 221 222 222 // This number must be at least 2 to avoid sharing empty, null as well as 1 character strings from SmallStrings. 223 static const ints_minLengthToShare = 10;223 static const unsigned s_minLengthToShare = 10; 224 224 static const unsigned s_copyCharsInlineCutOff = 20; 225 225 // We initialize and increment/decrement the refCount for all normal (non-static) strings by the value 2. 226 226 // We initialize static strings with an odd number (specifically, 1), such that the refCount cannot reach zero. 227 227 static const unsigned s_refCountMask = 0xFFFFFFF0; 228 static const ints_refCountIncrement = 0x20;229 static const ints_refCountFlagStatic = 0x10;228 static const unsigned s_refCountIncrement = 0x20; 229 static const unsigned s_refCountFlagStatic = 0x10; 230 230 static const unsigned s_refCountFlagHasReportedCost = 0x8; 231 231 static const unsigned s_refCountFlagIsIdentifier = 0x4; … … 245 245 SharedUChar* m_bufferShared; 246 246 }; 247 intm_length;247 unsigned m_length; 248 248 unsigned m_refCountAndFlags; 249 249 mutable unsigned m_hash;
Note:
See TracChangeset
for help on using the changeset viewer.