Changeset 36325 in webkit for trunk/JavaScriptCore/kjs/JSObject.h
- Timestamp:
- Sep 10, 2008, 7:42:18 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSObject.h
r36316 r36325 143 143 size_t offsetForLocation(JSValue** location) 144 144 { 145 return location - m_propertyStorage .get();145 return location - m_propertyStorage; 146 146 } 147 147 … … 176 176 virtual bool isNotAnObjectErrorStub() const { return false; } 177 177 178 void allocatePropertyStorage(size_t oldSize, size_t newSize); 179 bool usingInlineStorage() const { return m_propertyStorage == m_inlineStorage; } 180 178 181 protected: 179 182 bool getOwnPropertySlotForWrite(ExecState*, const Identifier&, PropertySlot&, bool& slotIsWriteable); … … 185 188 StructureID* createInheritorID(); 186 189 187 PropertyStorage m_propertyStorage; 190 static const size_t inlineStorageCapacity = 2; 191 188 192 RefPtr<StructureID> m_inheritorID; 193 194 PropertyStorage m_propertyStorage; 195 JSValue* m_inlineStorage[inlineStorageCapacity]; 189 196 }; 190 197 … … 193 200 inline JSObject::JSObject(JSObject* prototype) 194 201 : JSCell(prototype->inheritorID()) 202 , m_propertyStorage(m_inlineStorage) 195 203 { 196 204 ASSERT(m_structureID); … … 202 210 inline JSObject::JSObject(PassRefPtr<StructureID> structureID) 203 211 : JSCell(structureID.releaseRef()) // ~JSObject balances this ref() 212 , m_propertyStorage(m_inlineStorage) 204 213 { 205 214 ASSERT(m_structureID); … … 209 218 { 210 219 ASSERT(m_structureID); 220 if (m_propertyStorage != m_inlineStorage) 221 delete [] m_propertyStorage; 211 222 m_structureID->deref(); 212 223 } … … 365 376 366 377 if (m_structureID->isDictionary()) { 378 unsigned currentAttributes; 379 size_t offset = m_structureID->propertyMap().getOffset(propertyName, currentAttributes); 380 if (offset != WTF::notFound) { 381 if (checkReadOnly && currentAttributes & ReadOnly) 382 return; 383 m_propertyStorage[offset] = value; 384 slot.setExistingProperty(this, offset); 385 return; 386 } 387 388 if (m_structureID->propertyMap().storageSize() == inlineStorageCapacity) 389 allocatePropertyStorage(m_structureID->propertyMap().storageSize(), m_structureID->propertyMap().size()); 367 390 m_structureID->propertyMap().put(propertyName, value, attributes, checkReadOnly, this, slot, m_propertyStorage); 368 391 return; … … 379 402 } 380 403 381 RefPtr<StructureID> structureID = StructureID::addPropertyTransition(m_structureID, propertyName, value, attributes, checkReadOnly, this, slot, m_propertyStorage); 404 if (m_structureID->propertyMap().storageSize() == inlineStorageCapacity) 405 allocatePropertyStorage(m_structureID->propertyMap().storageSize(), m_structureID->propertyMap().size()); 406 407 RefPtr<StructureID> structureID = StructureID::addPropertyTransition(m_structureID, propertyName, value, attributes, this, slot, m_propertyStorage); 382 408 setStructureID(structureID.release()); 383 409 }
Note:
See TracChangeset
for help on using the changeset viewer.