Ignore:
Timestamp:
May 26, 2009, 7:47:35 PM (16 years ago)
Author:
[email protected]
Message:

2009-05-26 Gavin Barraclough <[email protected]>

Reviewed by Oliver Hunt.

Fix for: <rdar://problem/6918095> REGRESSION: jQuery load() issue (25981),
and also an ASSERT failure on http://ihasahotdog.com/.

When overwriting a property on a dictionary with a cached specific value,
clear the cache if new value being written is different.

Export the new symbols.

  • jit/JITStubs.cpp: (JSC::JITStubs::cti_op_get_by_id_method_check_second):

Close dictionary prototypes upon caching a method access, as would happen when caching
a regular get_by_id.

  • runtime/JSObject.h: (JSC::JSObject::propertyStorage): (JSC::JSObject::locationForOffset):

Make these methods private.

(JSC::JSObject::putDirectInternal):

When overwriting a property on a dictionary with a cached specific value,
clear the cache if new value being written is different.

  • runtime/Structure.cpp: (JSC::Structure::despecifyDictionaryFunction):

Reset the specific value field for a given property in a dictionary.

(JSC::Structure::despecifyFunctionTransition):

Rename of 'changeFunctionTransition' (this was already internally refered to as a despecification).

  • runtime/Structure.h:

Declare new method.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/jit/JITStubs.cpp

    r44131 r44171  
    733733    Structure* structure;
    734734    JSCell* specific;
     735    JSObject* slotBaseObject;
    735736    if (baseValue.isCell()
    736737        && slot.isCacheable()
    737738        && !(structure = asCell(baseValue)->structure())->isDictionary()
    738         && asObject(slot.slotBase())->getPropertySpecificValue(callFrame, ident, specific)
     739        && (slotBaseObject = asObject(slot.slotBase()))->getPropertySpecificValue(callFrame, ident, specific)
    739740        && specific
    740741        ) {
    741742
    742743        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()));
    743749
    744750        // The result fetched should always be the callee!
     
    748754        // Check to see if the function is on the object's prototype.  Patch up the code to optimize.
    749755        if (slot.slotBase() == structure->prototypeForLookup(callFrame))
    750             JIT::patchMethodCallProto(methodCallLinkInfo, callee, structure, asObject(slot.slotBase()));
     756            JIT::patchMethodCallProto(methodCallLinkInfo, callee, structure, slotBaseObject);
    751757        // Check to see if the function is on the object itself.
    752758        // Since we generate the method-check to check both the structure and a prototype-structure (since this
Note: See TracChangeset for help on using the changeset viewer.