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/runtime/Structure.cpp

    r44076 r44171  
    328328}
    329329
     330void 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
    330376PassRefPtr<Structure> Structure::addPropertyTransitionToExistingStructure(Structure* structure, const Identifier& propertyName, unsigned attributes, JSCell* specificValue, size_t& offset)
    331377{
     
    441487}
    442488
    443 PassRefPtr<Structure> Structure::changeFunctionTransition(Structure* structure, const Identifier& replaceFunction)
     489PassRefPtr<Structure> Structure::despecifyFunctionTransition(Structure* structure, const Identifier& replaceFunction)
    444490{
    445491    RefPtr<Structure> transition = create(structure->storedPrototype(), structure->typeInfo());
Note: See TracChangeset for help on using the changeset viewer.