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/JSObject.h

    r44076 r44171  
    8585        Structure* inheritorID();
    8686
    87         ConstPropertyStorage propertyStorage() const { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
    88         PropertyStorage propertyStorage() { return (isUsingInlineStorage() ? m_inlineStorage : m_externalStorage); }
    89 
    9087        virtual UString className() const;
    9188
     
    141138        }
    142139
    143         size_t getOffset(const Identifier& propertyName)
    144         {
    145             return m_structure->get(propertyName);
    146         }
    147 
    148140        JSValue* getDirectLocation(const Identifier& propertyName)
    149141        {
     
    164156        }
    165157
    166         const JSValue* locationForOffset(size_t offset) const
    167         {
    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 
    176158        void transitionTo(Structure*);
    177159
     
    224206
    225207    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
    226221        void putDirectInternal(const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot, JSCell*);
    227222        void putDirectInternal(JSGlobalData&, const Identifier& propertyName, JSValue value, unsigned attr, bool checkReadOnly, PutPropertySlot& slot);
     
    427422        size_t offset = m_structure->get(propertyName, currentAttributes, currentSpecificFunction);
    428423        if (offset != WTF::notFound) {
     424            if (currentSpecificFunction && (specificFunction != currentSpecificFunction))
     425                m_structure->despecifyDictionaryFunction(propertyName);
    429426            if (checkReadOnly && currentAttributes & ReadOnly)
    430427                return;
    431428            putDirectOffset(offset, value);
    432             slot.setExistingProperty(this, offset);
     429            if (!specificFunction && !currentSpecificFunction)
     430                slot.setExistingProperty(this, offset);
    433431            return;
    434432        }
     
    470468
    471469        if (currentSpecificFunction && (specificFunction != currentSpecificFunction)) {
    472             setStructure(Structure::changeFunctionTransition(m_structure, propertyName));
     470            setStructure(Structure::despecifyFunctionTransition(m_structure, propertyName));
    473471            putDirectOffset(offset, value);
    474472            // Function transitions are not currently cachable, so leave the slot in an uncachable state.
Note: See TracChangeset for help on using the changeset viewer.