2008-09-15 Maciej Stachowiak <mjs@apple.com>
authormjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Sep 2008 10:20:59 +0000 (10:20 +0000)
committermjs@apple.com <mjs@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 15 Sep 2008 10:20:59 +0000 (10:20 +0000)
        Reviewed by Cameron Zwarich.

        - fix layout test failure introduced by fix for 20849

        (The failing test was fast/js/delete-then-put.html)

        * kjs/JSObject.cpp:
        (JSC::JSObject::removeDirect): Clear enumeration cache
        in the dictionary case.
        * kjs/JSObject.h:
        (JSC::JSObject::putDirect): Ditto.
        * kjs/StructureID.h:
        (JSC::StructureID::clearEnumerationCache): Inline to handle the
        clear.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@36436 268f45cc-cd09-0410-ab3c-d52691b4dbfc

JavaScriptCore/ChangeLog
JavaScriptCore/kjs/JSObject.cpp
JavaScriptCore/kjs/JSObject.h
JavaScriptCore/kjs/StructureID.h

index 2fe2fee4f817ab3bdcad48c4f9e509cdf7370ecb..16809a3de8823dc69461dc697f86e0339906080f 100644 (file)
@@ -1,3 +1,20 @@
+2008-09-15  Maciej Stachowiak  <mjs@apple.com>
+
+        Reviewed by Cameron Zwarich.
+        
+        - fix layout test failure introduced by fix for 20849
+        
+        (The failing test was fast/js/delete-then-put.html)
+
+        * kjs/JSObject.cpp:
+        (JSC::JSObject::removeDirect): Clear enumeration cache
+        in the dictionary case.
+        * kjs/JSObject.h:
+        (JSC::JSObject::putDirect): Ditto.
+        * kjs/StructureID.h:
+        (JSC::StructureID::clearEnumerationCache): Inline to handle the
+        clear.
+
 2008-09-15  Maciej Stachowiak  <mjs@apple.com>
 
         Reviewed by Cameron Zwarich.
index 4500e2c63652c92a577b29228799e1b8bacd6c44..a2bd69b991b7119ffe1095209a98c0580449d216 100644 (file)
@@ -493,6 +493,7 @@ void JSObject::removeDirect(const Identifier& propertyName)
 {
     if (m_structureID->isDictionary()) {
         m_structureID->propertyMap().remove(propertyName, m_propertyStorage);
+        m_structureID->clearEnumerationCache();
         return;
     }
 
index 4efadbb8ea32bd03efd5640c5af63a8adc0ca8ea..e3e6085707f1bb2229f854a141240975c6c16a3e 100644 (file)
@@ -388,6 +388,7 @@ inline void JSObject::putDirect(const Identifier& propertyName, JSValue* value,
          if (m_structureID->propertyMap().storageSize() == inlineStorageCapacity)
              allocatePropertyStorage(m_structureID->propertyMap().storageSize(), m_structureID->propertyMap().size());
          m_structureID->propertyMap().put(propertyName, value, attributes, checkReadOnly, this, slot, m_propertyStorage);
+         m_structureID->clearEnumerationCache();
          return;
      }
 
index 9e770c6dad7da9ddaf4f4dc1494aeba166ab8e36..5e2d0ff5920488a98b363a56a278530c6e8e7368 100644 (file)
@@ -112,6 +112,8 @@ namespace JSC {
 
         static void transitionTo(StructureID* oldStructureID, StructureID* newStructureID, JSObject* slotBase);
 
+        void clearEnumerationCache() { m_cachedPropertyNameArray.clear(); }
+
     private:
         typedef std::pair<RefPtr<UString::Rep>, unsigned> TransitionTableKey;
         typedef HashMap<TransitionTableKey, StructureID*, TransitionTableHash, TransitionTableHashTraits> TransitionTable;