Changeset 37388 in webkit for trunk/JavaScriptCore/kjs/JSObject.h
- Timestamp:
- Oct 7, 2008, 1:49:36 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSObject.h
r37381 r37388 123 123 JSValue* getDirect(const Identifier& propertyName) const 124 124 { 125 size_t offset = m_structureID->propertyMap().get Offset(propertyName);125 size_t offset = m_structureID->propertyMap().get(propertyName); 126 126 return offset != WTF::notFound ? m_propertyStorage[offset] : 0; 127 127 } … … 129 129 JSValue** getDirectLocation(const Identifier& propertyName) 130 130 { 131 size_t offset = m_structureID->propertyMap().get Offset(propertyName);131 size_t offset = m_structureID->propertyMap().get(propertyName); 132 132 return offset != WTF::notFound ? locationForOffset(offset) : 0; 133 133 } … … 135 135 JSValue** getDirectLocation(const Identifier& propertyName, unsigned& attributes) 136 136 { 137 size_t offset = m_structureID->propertyMap().get Offset(propertyName, attributes);137 size_t offset = m_structureID->propertyMap().get(propertyName, attributes); 138 138 return offset != WTF::notFound ? locationForOffset(offset) : 0; 139 139 } … … 179 179 180 180 static const size_t inlineStorageCapacity = 2; 181 static const size_t nonInlineBaseStorageCapacity = 16; 181 182 182 183 static PassRefPtr<StructureID> createStructureID(JSValue* proto) { return StructureID::create(proto, TypeInfo(ObjectType)); } … … 365 366 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); 366 367 367 if (m_structureID->isDictionary()) { 368 unsigned currentAttributes; 369 size_t offset = m_structureID->propertyMap().getOffset(propertyName, currentAttributes); 370 if (offset != WTF::notFound) { 371 if (checkReadOnly && currentAttributes & ReadOnly) 372 return; 373 m_propertyStorage[offset] = value; 374 slot.setExistingProperty(this, offset); 375 return; 376 } 377 378 if (m_structureID->propertyMap().storageSize() == inlineStorageCapacity) 379 allocatePropertyStorage(m_structureID->propertyMap().storageSize(), m_structureID->propertyMap().size()); 380 m_structureID->propertyMap().put(propertyName, value, attributes, checkReadOnly, this, slot, m_propertyStorage); 381 m_structureID->clearEnumerationCache(); 382 return; 383 } 368 if (m_structureID->isDictionary()) { 369 unsigned currentAttributes; 370 size_t offset = m_structureID->propertyMap().get(propertyName, currentAttributes); 371 if (offset != WTF::notFound) { 372 if (checkReadOnly && currentAttributes & ReadOnly) 373 return; 374 m_propertyStorage[offset] = value; 375 slot.setExistingProperty(this, offset); 376 return; 377 } 378 379 size_t currentCapacity = m_structureID->propertyStorageCapacity(); 380 offset = m_structureID->propertyMap().put(propertyName, attributes); 381 if (m_structureID->propertyMap().storageSize() > m_structureID->propertyStorageCapacity()) { 382 m_structureID->growPropertyStorageCapacity(); 383 allocatePropertyStorage(currentCapacity, m_structureID->propertyStorageCapacity()); 384 } 385 386 m_propertyStorage[offset] = value; 387 slot.setNewProperty(this, offset); 388 m_structureID->clearEnumerationCache(); 389 return; 390 } 384 391 385 392 unsigned currentAttributes; 386 size_t offset = m_structureID->propertyMap().get Offset(propertyName, currentAttributes);393 size_t offset = m_structureID->propertyMap().get(propertyName, currentAttributes); 387 394 if (offset != WTF::notFound) { 388 395 if (checkReadOnly && currentAttributes & ReadOnly) … … 393 400 } 394 401 395 if (m_structureID->propertyMap().storageSize() == inlineStorageCapacity) 396 allocatePropertyStorage(m_structureID->propertyMap().storageSize(), m_structureID->propertyMap().size()); 397 398 RefPtr<StructureID> structureID = StructureID::addPropertyTransition(m_structureID, propertyName, value, attributes, this, slot, m_propertyStorage); 399 slot.setWasTransition(true); 400 setStructureID(structureID.release()); 402 size_t currentCapacity = m_structureID->propertyStorageCapacity(); 403 RefPtr<StructureID> structureID = StructureID::addPropertyTransition(m_structureID, propertyName, attributes, offset); 404 if (currentCapacity != structureID->propertyStorageCapacity()) 405 allocatePropertyStorage(currentCapacity, structureID->propertyStorageCapacity()); 406 407 ASSERT(offset < structureID->propertyStorageCapacity()); 408 m_propertyStorage[offset] = value; 409 slot.setNewProperty(this, offset); 410 slot.setWasTransition(true); 411 setStructureID(structureID.release()); 401 412 } 402 413 403 414 inline void JSObject::transitionTo(StructureID* newStructureID) 404 415 { 405 StructureID::transitionTo(m_structureID, newStructureID, this); 416 if (m_structureID->propertyStorageCapacity() != newStructureID->propertyStorageCapacity()) 417 allocatePropertyStorage(m_structureID->propertyStorageCapacity(), newStructureID->propertyStorageCapacity()); 406 418 setStructureID(newStructureID); 407 419 }
Note:
See TracChangeset
for help on using the changeset viewer.