Changeset 51801 in webkit for trunk/JavaScriptCore/runtime/JSString.h
- Timestamp:
- Dec 7, 2009, 3:14:04 PM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/runtime/JSString.h
r51671 r51801 87 87 // Creates a Rope comprising of 'ropeLength' Fibers. 88 88 // The Rope is constructed in an uninitialized state - initialize must be called for each Fiber in the Rope. 89 static PassRefPtr<Rope> create(unsigned ropeLength) { return adoptRef(new (ropeLength) Rope(ropeLength)); } 89 static PassRefPtr<Rope> createOrNull(unsigned ropeLength) 90 { 91 void* allocation; 92 if (tryFastMalloc(sizeof(Rope) + (ropeLength - 1) * sizeof(Fiber)).getValue(allocation)) 93 return adoptRef(new (allocation) Rope(ropeLength)); 94 return 0; 95 } 90 96 91 97 ~Rope(); … … 117 123 private: 118 124 Rope(unsigned ropeLength) : m_ropeLength(ropeLength), m_stringLength(0) {} 119 void* operator new(size_t, unsigned ropeLength) { return fastMalloc(sizeof(Rope) + (ropeLength - 1) * sizeof(UString::Rep*)); }125 void* operator new(size_t, void* inPlace) { return inPlace; } 120 126 121 127 unsigned m_ropeLength; … … 151 157 { 152 158 } 153 154 const UString& value( ) const159 160 const UString& value(ExecState* exec) const 155 161 { 156 162 if (m_rope) 157 resolveRope(); 163 resolveRope(exec); 164 return m_value; 165 } 166 const UString tryGetValue() const 167 { 168 if (m_rope) 169 UString(); 158 170 return m_value; 159 171 } … … 169 181 170 182 bool canGetIndex(unsigned i) { return i < m_length; } 171 JSString* getIndex( JSGlobalData*, unsigned);183 JSString* getIndex(ExecState*, unsigned); 172 184 173 185 static PassRefPtr<Structure> createStructure(JSValue proto) { return Structure::create(proto, TypeInfo(StringType, OverridesGetOwnPropertySlot | NeedsThisConversion)); } … … 180 192 } 181 193 182 void resolveRope( ) const;194 void resolveRope(ExecState*) const; 183 195 184 196 virtual JSValue toPrimitive(ExecState*, PreferredPrimitiveType) const; … … 247 259 } 248 260 249 inline JSString* JSString::getIndex( JSGlobalData* globalData, unsigned i)261 inline JSString* JSString::getIndex(ExecState* exec, unsigned i) 250 262 { 251 263 ASSERT(canGetIndex(i)); 252 return jsSingleCharacterSubstring( globalData, value(), i);264 return jsSingleCharacterSubstring(&exec->globalData(), value(exec), i); 253 265 } 254 266 … … 313 325 unsigned i = propertyName.toStrictUInt32(&isStrictUInt32); 314 326 if (isStrictUInt32 && i < m_length) { 315 slot.setValue(jsSingleCharacterSubstring(exec, value( ), i));327 slot.setValue(jsSingleCharacterSubstring(exec, value(exec), i)); 316 328 return true; 317 329 } … … 323 335 { 324 336 if (propertyName < m_length) { 325 slot.setValue(jsSingleCharacterSubstring(exec, value( ), propertyName));337 slot.setValue(jsSingleCharacterSubstring(exec, value(exec), propertyName)); 326 338 return true; 327 339 } … … 342 354 { 343 355 if (isString()) 344 return static_cast<JSString*>(asCell())->value( );356 return static_cast<JSString*>(asCell())->value(exec); 345 357 if (isInt32()) 346 358 return exec->globalData().numericStrings.add(asInt32());
Note:
See TracChangeset
for help on using the changeset viewer.