Changeset 44171 in webkit for trunk/JavaScriptCore
- Timestamp:
- May 26, 2009, 7:47:35 PM (16 years ago)
- Location:
- trunk/JavaScriptCore
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r44169 r44171 1 2009-05-26 Gavin Barraclough <[email protected]> 2 3 Reviewed by Oliver Hunt. 4 5 Fix for: <rdar://problem/6918095> REGRESSION: jQuery load() issue (25981), 6 and also an ASSERT failure on http://ihasahotdog.com/. 7 8 When overwriting a property on a dictionary with a cached specific value, 9 clear the cache if new value being written is different. 10 11 * JavaScriptCore.exp: 12 Export the new symbols. 13 * jit/JITStubs.cpp: 14 (JSC::JITStubs::cti_op_get_by_id_method_check_second): 15 Close dictionary prototypes upon caching a method access, as would happen when caching 16 a regular get_by_id. 17 * runtime/JSObject.h: 18 (JSC::JSObject::propertyStorage): 19 (JSC::JSObject::locationForOffset): 20 Make these methods private. 21 (JSC::JSObject::putDirectInternal): 22 When overwriting a property on a dictionary with a cached specific value, 23 clear the cache if new value being written is different. 24 * runtime/Structure.cpp: 25 (JSC::Structure::despecifyDictionaryFunction): 26 Reset the specific value field for a given property in a dictionary. 27 (JSC::Structure::despecifyFunctionTransition): 28 Rename of 'changeFunctionTransition' (this was already internally refered to as a despecification). 29 * runtime/Structure.h: 30 Declare new method. 31 1 32 2009-05-26 Gavin Barraclough <[email protected]> 2 33 -
trunk/JavaScriptCore/JavaScriptCore.exp
r44076 r44171 265 265 __ZN3JSC9Structure21addPropertyTransitionEPS0_RKNS_10IdentifierEjPNS_6JSCellERm 266 266 __ZN3JSC9Structure22materializePropertyMapEv 267 __ZN3JSC9Structure24changeFunctionTransitionEPS0_RKNS_10IdentifierE268 267 __ZN3JSC9Structure25changePrototypeTransitionEPS0_NS_7JSValueE 268 __ZN3JSC9Structure27despecifyDictionaryFunctionERKNS_10IdentifierE 269 __ZN3JSC9Structure27despecifyFunctionTransitionEPS0_RKNS_10IdentifierE 269 270 __ZN3JSC9Structure28addPropertyWithoutTransitionERKNS_10IdentifierEjPNS_6JSCellE 270 271 __ZN3JSC9Structure3getEPKNS_7UString3RepERjRPNS_6JSCellE -
trunk/JavaScriptCore/jit/JITStubs.cpp
r44131 r44171 733 733 Structure* structure; 734 734 JSCell* specific; 735 JSObject* slotBaseObject; 735 736 if (baseValue.isCell() 736 737 && slot.isCacheable() 737 738 && !(structure = asCell(baseValue)->structure())->isDictionary() 738 && asObject(slot.slotBase())->getPropertySpecificValue(callFrame, ident, specific)739 && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific) 739 740 && specific 740 741 ) { 741 742 742 743 JSFunction* callee = (JSFunction*)specific; 744 745 // Since we're accessing a prototype in a loop, it's a good bet that it 746 // should not be treated as a dictionary. 747 if (slotBaseObject->structure()->isDictionary()) 748 slotBaseObject->setStructure(Structure::fromDictionaryTransition(slotBaseObject->structure())); 743 749 744 750 // The result fetched should always be the callee! … … 748 754 // Check to see if the function is on the object's prototype. Patch up the code to optimize. 749 755 if (slot.slotBase() == structure->prototypeForLookup(callFrame)) 750 JIT::patchMethodCallProto(methodCallLinkInfo, callee, structure, asObject(slot.slotBase()));756 JIT::patchMethodCallProto(methodCallLinkInfo, callee, structure, slotBaseObject); 751 757 // Check to see if the function is on the object itself. 752 758 // Since we generate the method-check to check both the structure and a prototype-structure (since this -
trunk/JavaScriptCore/runtime/JSObject.h
r44076 r44171 85 85 Structure* inheritorID(); 86 86 87 ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }88 PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }89 90 87 virtual UString className() const; 91 88 … … 141 138 } 142 139 143 size_t getOffset(const Identifier& propertyName)144 {145 return m_structure->get(propertyName);146 }147 148 140 JSValue* getDirectLocation(const Identifier& propertyName) 149 141 { … … 164 156 } 165 157 166 const JSValue* locationForOffset(size_t offset) const167 {168 return reinterpret_cast<const JSValue*>(&propertyStorage()[offset]);169 }170 171 JSValue* locationForOffset(size_t offset)172 {173 return reinterpret_cast<JSValue*>(&propertyStorage()[offset]);174 }175 176 158 void transitionTo(Structure*); 177 159 … … 224 206 225 207 private: 208 ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); } 209 PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); } 210 211 const JSValue* locationForOffset(size_t offset) const 212 { 213 return reinterpret_cast<const JSValue*>(&propertyStorage()[offset]); 214 } 215 216 JSValue* locationForOffset(size_t offset) 217 { 218 return reinterpret_cast<JSValue*>(&propertyStorage()[offset]); 219 } 220 226 221 void putDirectInternal(const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot, JSCell*); 227 222 void putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot); … … 427 422 size_t offset = m_structure->get(propertyName, currentAttributes, currentSpecificFunction); 428 423 if (offset != WTF::notFound) { 424 if (currentSpecificFunction && (specificFunction != currentSpecificFunction)) 425 m_structure->despecifyDictionaryFunction(propertyName); 429 426 if (checkReadOnly && currentAttributes & ReadOnly) 430 427 return; 431 428 putDirectOffset(offset, value); 432 slot.setExistingProperty(this, offset); 429 if (!specificFunction && !currentSpecificFunction) 430 slot.setExistingProperty(this, offset); 433 431 return; 434 432 } … … 470 468 471 469 if (currentSpecificFunction && (specificFunction != currentSpecificFunction)) { 472 setStructure(Structure:: changeFunctionTransition(m_structure, propertyName));470 setStructure(Structure::despecifyFunctionTransition(m_structure, propertyName)); 473 471 putDirectOffset(offset, value); 474 472 // Function transitions are not currently cachable, so leave the slot in an uncachable state. -
trunk/JavaScriptCore/runtime/Structure.cpp
r44076 r44171 328 328 } 329 329 330 void Structure::despecifyDictionaryFunction(const Identifier& propertyName) 331 { 332 const UString::Rep* rep = propertyName._ustring.rep(); 333 334 materializePropertyMapIfNecessary(); 335 336 ASSERT(m_isDictionary); 337 ASSERT(m_propertyTable); 338 339 unsigned i = rep->computedHash(); 340 341 #if DUMP_PROPERTYMAP_STATS 342 ++numProbes; 343 #endif 344 345 unsigned entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask]; 346 ASSERT(entryIndex != emptyEntryIndex); 347 348 if (rep == m_propertyTable->entries()[entryIndex - 1].key) { 349 m_propertyTable->entries()[entryIndex - 1].specificValue = 0; 350 return; 351 } 352 353 #if DUMP_PROPERTYMAP_STATS 354 ++numCollisions; 355 #endif 356 357 unsigned k = 1 | doubleHash(rep->computedHash()); 358 359 while (1) { 360 i += k; 361 362 #if DUMP_PROPERTYMAP_STATS 363 ++numRehashes; 364 #endif 365 366 entryIndex = m_propertyTable->entryIndices[i & m_propertyTable->sizeMask]; 367 ASSERT(entryIndex != emptyEntryIndex); 368 369 if (rep == m_propertyTable->entries()[entryIndex - 1].key) { 370 m_propertyTable->entries()[entryIndex - 1].specificValue = 0; 371 return; 372 } 373 } 374 } 375 330 376 PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset) 331 377 { … … 441 487 } 442 488 443 PassRefPtr<Structure> Structure:: changeFunctionTransition(Structure* structure, const Identifier& replaceFunction)489 PassRefPtr<Structure> Structure::despecifyFunctionTransition(Structure* structure, const Identifier& replaceFunction) 444 490 { 445 491 RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo()); -
trunk/JavaScriptCore/runtime/Structure.h
r44076 r44171 66 66 static PassRefPtr<Structure> removePropertyTransition(Structure*, const Identifier& propertyName, size_t& offset); 67 67 static PassRefPtr<Structure> changePrototypeTransition(Structure*, JSValue prototype); 68 static PassRefPtr<Structure> changeFunctionTransition(Structure*, const Identifier&);68 static PassRefPtr<Structure> despecifyFunctionTransition(Structure*, const Identifier&); 69 69 static PassRefPtr<Structure> getterSetterTransition(Structure*); 70 70 static PassRefPtr<Structure> toDictionaryTransition(Structure*); … … 115 115 116 116 JSCell* specificValue() { return m_specificValueInPrevious; } 117 void despecifyDictionaryFunction(const Identifier& propertyName); 117 118 118 119 private:
Note:
See TracChangeset
for help on using the changeset viewer.