Changeset 36285 in webkit for trunk/JavaScriptCore/kjs/JSObject.cpp
- Timestamp:
- Sep 8, 2008, 11:55:39 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSObject.cpp
r36263 r36285 70 70 JSCell::mark(); 71 71 m_structureID->mark(); 72 m_propertyMap.mark(); 72 73 unsigned storageSize = m_structureID->propertyMap().makingCount(); 74 if (storageSize) { 75 for (unsigned i = 1; i <= storageSize; ++i) { 76 JSValue* v = m_propertyStorage[i]; 77 if (!v->marked()) 78 v->mark(); 79 } 80 } 73 81 74 82 JSOBJECT_MARK_END(); … … 120 128 // Check if there are any setters or getters in the prototype chain 121 129 JSValue* prototype; 122 for (JSObject* obj = this; !obj-> m_propertyMap.hasGetterSetterProperties(); obj = static_cast<JSObject*>(prototype)) {130 for (JSObject* obj = this; !obj->structureID()->propertyMap().hasGetterSetterProperties(); obj = static_cast<JSObject*>(prototype)) { 123 131 prototype = obj->prototype(); 124 132 if (prototype->isNull()) { … … 129 137 130 138 unsigned attributes; 131 if (m_ propertyMap.get(propertyName, attributes) && attributes & ReadOnly)139 if (m_structureID->propertyMap().get(propertyName, attributes, m_propertyStorage) && attributes & ReadOnly) 132 140 return; 133 141 134 142 for (JSObject* obj = this; ; obj = static_cast<JSObject*>(prototype)) { 135 if (JSValue* gs = obj-> m_propertyMap.get(propertyName)) {143 if (JSValue* gs = obj->structureID()->propertyMap().get(propertyName, obj->propertyStorage())) { 136 144 if (gs->isGetterSetter()) { 137 145 JSObject* setterFunc = static_cast<GetterSetter*>(gs)->setter(); … … 195 203 { 196 204 unsigned attributes; 197 JSValue* v = m_ propertyMap.get(propertyName, attributes);205 JSValue* v = m_structureID->propertyMap().get(propertyName, attributes, m_propertyStorage); 198 206 if (v) { 199 207 if ((attributes & DontDelete)) … … 286 294 void JSObject::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) 287 295 { 288 GetterSetter* getterSetter; 296 JSValue* object = getDirect(propertyName); 297 if (object && object->isGetterSetter()) { 298 ASSERT(m_structureID->propertyMap().hasGetterSetterProperties()); 299 GetterSetter* getterSetter = static_cast<GetterSetter*>(object); 300 getterSetter->setGetter(getterFunction); 301 return; 302 } 303 289 304 PutPropertySlot slot; 290 291 JSValue* object = getDirect(propertyName); 292 if (object && object->isGetterSetter()) 293 getterSetter = static_cast<GetterSetter*>(object); 294 else { 295 getterSetter = new (exec) GetterSetter; 296 putDirect(propertyName, getterSetter, None, true, slot); 297 } 305 GetterSetter* getterSetter = new (exec) GetterSetter; 306 putDirect(propertyName, getterSetter, None, true, slot); 298 307 299 308 // putDirect will change our StructureID if we add a new property. For … … 307 316 } 308 317 309 m_ propertyMap.setHasGetterSetterProperties(true);318 m_structureID->propertyMap().setHasGetterSetterProperties(true); 310 319 getterSetter->setGetter(getterFunction); 311 320 } … … 313 322 void JSObject::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction) 314 323 { 315 GetterSetter* getterSetter; 324 JSValue* object = getDirect(propertyName); 325 if (object && object->isGetterSetter()) { 326 ASSERT(m_structureID->propertyMap().hasGetterSetterProperties()); 327 GetterSetter* getterSetter = static_cast<GetterSetter*>(object); 328 getterSetter->setSetter(setterFunction); 329 return; 330 } 331 316 332 PutPropertySlot slot; 317 318 JSValue* object = getDirect(propertyName); 319 if (object && object->isGetterSetter()) 320 getterSetter = static_cast<GetterSetter*>(object); 321 else { 322 getterSetter = new (exec) GetterSetter; 323 putDirect(propertyName, getterSetter, None, true, slot); 324 } 333 GetterSetter* getterSetter = new (exec) GetterSetter; 334 putDirect(propertyName, getterSetter, None, true, slot); 325 335 326 336 // putDirect will change our StructureID if we add a new property. For … … 334 344 } 335 345 336 m_ propertyMap.setHasGetterSetterProperties(true);346 m_structureID->propertyMap().setHasGetterSetterProperties(true); 337 347 getterSetter->setSetter(setterFunction); 338 348 } … … 412 422 bool JSObject::getPropertyAttributes(ExecState* exec, const Identifier& propertyName, unsigned& attributes) const 413 423 { 414 if (m_ propertyMap.get(propertyName, attributes))424 if (m_structureID->propertyMap().get(propertyName, attributes, m_propertyStorage)) 415 425 return true; 416 426 … … 427 437 void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) 428 438 { 429 m_ propertyMap.getEnumerablePropertyNames(propertyNames);439 m_structureID->propertyMap().getEnumerablePropertyNames(propertyNames); 430 440 431 441 // Add properties from the static hashtables of properties … … 486 496 void JSObject::removeDirect(const Identifier& propertyName) 487 497 { 488 m_propertyMap.remove(propertyName); 489 if (!m_structureID->isDictionary()) { 490 RefPtr<StructureID> structureID = StructureID::toDictionaryTransition(m_structureID); 491 setStructureID(structureID.release()); 492 } 498 if (m_structureID->isDictionary()) { 499 m_structureID->propertyMap().remove(propertyName, m_propertyStorage); 500 return; 501 } 502 503 RefPtr<StructureID> structureID = StructureID::toDictionaryTransition(m_structureID); 504 structureID->propertyMap().remove(propertyName, m_propertyStorage); 505 setStructureID(structureID.release()); 493 506 } 494 507
Note:
See TracChangeset
for help on using the changeset viewer.