Changeset 36285 in webkit for trunk/JavaScriptCore/kjs/JSObject.h
- Timestamp:
- Sep 8, 2008, 11:55:39 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSObject.h
r36263 r36285 75 75 StructureID* inheritorID(); 76 76 77 PropertyStorage& propertyStorage() { return m_propertyStorage; } 78 77 79 virtual UString className() const; 78 80 … … 121 123 122 124 // This get function only looks at the property map. 123 JSValue* getDirect(const Identifier& propertyName) const { return m_propertyMap.get(propertyName); } 124 JSValue** getDirectLocation(const Identifier& propertyName) { return m_propertyMap.getLocation(propertyName); } 125 JSValue** getDirectLocation(const Identifier& propertyName, bool& isWriteable) { return m_propertyMap.getLocation(propertyName, isWriteable); } 126 size_t offsetForLocation(JSValue** location) { return m_propertyMap.offsetForLocation(location); } 125 JSValue* getDirect(const Identifier& propertyName) const 126 { 127 return m_structureID->propertyMap().get(propertyName, m_propertyStorage); 128 } 129 130 JSValue** getDirectLocation(const Identifier& propertyName) 131 { 132 return m_structureID->propertyMap().getLocation(propertyName, m_propertyStorage); 133 } 134 135 JSValue** getDirectLocation(const Identifier& propertyName, bool& isWriteable) 136 { 137 return m_structureID->propertyMap().getLocation(propertyName, isWriteable, m_propertyStorage); 138 } 139 140 size_t offsetForLocation(JSValue** location) 141 { 142 return location - m_propertyStorage.get(); 143 } 144 127 145 void removeDirect(const Identifier& propertyName); 128 bool hasCustomProperties() { return !m_ propertyMap.isEmpty(); }129 bool hasGetterSetterProperties() { return m_ propertyMap.hasGetterSetterProperties(); }146 bool hasCustomProperties() { return !m_structureID->propertyMap().isEmpty(); } 147 bool hasGetterSetterProperties() { return m_structureID->propertyMap().hasGetterSetterProperties(); } 130 148 131 149 void putDirect(const Identifier& propertyName, JSValue* value, unsigned attr = 0); … … 134 152 135 153 // Fast access to known property offsets. 136 JSValue* getDirectOffset(size_t offset) { return m_property Map.getOffset(offset); }137 void putDirectOffset(size_t offset, JSValue* v ) { m_propertyMap.putOffset(offset, v); }154 JSValue* getDirectOffset(size_t offset) { return m_propertyStorage[offset]; } 155 void putDirectOffset(size_t offset, JSValue* value) { m_propertyStorage[offset] = value; } 138 156 139 157 void fillGetterPropertySlot(PropertySlot&, JSValue** location); … … 159 177 StructureID* createInheritorID(); 160 178 161 Property Map m_propertyMap;179 PropertyStorage m_propertyStorage; 162 180 RefPtr<StructureID> m_inheritorID; 163 181 }; … … 285 303 { 286 304 if (JSValue** location = getDirectLocation(propertyName, slotIsWriteable)) { 287 if (m_ propertyMap.hasGetterSetterProperties() && location[0]->isGetterSetter()) {305 if (m_structureID->propertyMap().hasGetterSetterProperties() && location[0]->isGetterSetter()) { 288 306 slotIsWriteable = false; 289 307 fillGetterPropertySlot(slot, location); … … 309 327 { 310 328 if (JSValue** location = getDirectLocation(propertyName)) { 311 if (m_ propertyMap.hasGetterSetterProperties() && location[0]->isGetterSetter())329 if (m_structureID->propertyMap().hasGetterSetterProperties() && location[0]->isGetterSetter()) 312 330 fillGetterPropertySlot(slot, location); 313 331 else … … 331 349 } 332 350 333 inline void JSObject::putDirect(const Identifier& propertyName, JSValue* value, unsigned attr , bool checkReadOnly, PutPropertySlot& slot)351 inline void JSObject::putDirect(const Identifier& propertyName, JSValue* value, unsigned attributes, bool checkReadOnly, PutPropertySlot& slot) 334 352 { 335 353 ASSERT(!Heap::heap(value) || Heap::heap(value) == Heap::heap(this)); 336 m_propertyMap.put(propertyName, value, attr, checkReadOnly, this, slot); 337 if (slot.type() == PutPropertySlot::NewProperty) { 338 if (!m_structureID->isDictionary()) { 339 RefPtr<StructureID> structureID = StructureID::addPropertyTransition(m_structureID, propertyName); 340 setStructureID(structureID.release()); 341 } 342 } 354 355 if (m_structureID->isDictionary()) { 356 m_structureID->propertyMap().put(propertyName, value, attributes, checkReadOnly, this, slot, m_propertyStorage); 357 return; 358 } 359 360 bool isWriteable; 361 size_t offset = m_structureID->propertyMap().getOffset(propertyName, isWriteable); 362 if (offset != WTF::notFound) { 363 if (checkReadOnly && !isWriteable) 364 return; 365 m_propertyStorage[offset] = value; 366 slot.setExistingProperty(this, offset); 367 return; 368 } 369 370 RefPtr<StructureID> structureID = StructureID::addPropertyTransition(m_structureID, propertyName, value, attributes, checkReadOnly, this, slot, m_propertyStorage); 371 setStructureID(structureID.release()); 343 372 } 344 373
Note:
See TracChangeset
for help on using the changeset viewer.