[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

ggaren at apple.com ggaren at apple.com
Thu Oct 29 20:42:13 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit a8930b7197520a198405fde79f3f21ecdbf64bd3
Author: ggaren at apple.com <ggaren at apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Oct 8 23:49:00 2009 +0000

    Rolled out 49331 because it still doesn't build on Windows
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@49335 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index bd8f419..7cf56bd 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,55 +1,3 @@
-2009-10-08  Geoffrey Garen  <ggaren at apple.com>
-
-        Windows build fix: added missing #include.
-
-        * interpreter/CallFrame.cpp:
-
-2009-10-08  Geoffrey Garen  <ggaren at apple.com>
-
-        Windows build fix: added missing #include.
-
-        * runtime/PropertyNameArray.h:
-
-2009-10-08  Geoffrey Garen  <ggaren at apple.com>
-
-        Windows build fix: added missing #include.
-
-        * runtime/NumberPrototype.cpp:
-
-2009-10-08  Geoffrey Garen  <ggaren at apple.com>
-
-        Reviewed by Sam Weinig.
-
-        Migrated some code that didn't belong out of Structure.
-        
-        SunSpider says maybe 1.03x faster.
-
-        * runtime/JSCell.h: Nixed Structure::markAggregate, and made marking of
-        a Structure's prototype the direct responsility of the object using it.
-        (Giving Structure a mark function was misleading because it implied that
-        all live structures get marked during GC, when they don't.)
-        
-        * runtime/JSGlobalObject.cpp:
-        (JSC::markIfNeeded):
-        (JSC::JSGlobalObject::markChildren): Added code to mark prototypes stored
-        on the global object. Maybe this wasn't necessary, but now we don't have
-        to wonder.
-
-        * runtime/JSObject.cpp:
-        (JSC::JSObject::getPropertyNames):
-        (JSC::JSObject::getOwnPropertyNames):
-        (JSC::JSObject::getEnumerableNamesFromClassInfoTable):
-        * runtime/JSObject.h:
-        (JSC::JSObject::markChildrenDirect):
-        * runtime/PropertyNameArray.h:
-        * runtime/Structure.cpp:
-        * runtime/Structure.h:
-        (JSC::Structure::setEnumerationCache):
-        (JSC::Structure::enumerationCache): Moved property name gathering code
-        from Structure to JSObject because having a Structure iterate its JSObject
-        was a layering violation. A JSObject is implemented using a Structure; not
-        the other way around.
-
 2009-10-08  Zoltan Herczeg  <zherczeg at inf.u-szeged.hu>
 
         Reviewed by Gavin Barraclough.
diff --git a/JavaScriptCore/interpreter/CallFrame.cpp b/JavaScriptCore/interpreter/CallFrame.cpp
index 7cdcc9b..9724875 100644
--- a/JavaScriptCore/interpreter/CallFrame.cpp
+++ b/JavaScriptCore/interpreter/CallFrame.cpp
@@ -28,7 +28,6 @@
 
 #include "CodeBlock.h"
 #include "Interpreter.h"
-#include "Structure.h"
 
 namespace JSC {
 
diff --git a/JavaScriptCore/runtime/JSCell.h b/JavaScriptCore/runtime/JSCell.h
index 79b7953..503c6c4 100644
--- a/JavaScriptCore/runtime/JSCell.h
+++ b/JavaScriptCore/runtime/JSCell.h
@@ -342,6 +342,11 @@ namespace JSC {
             append(value.asCell());
     }
 
+    inline void Structure::markAggregate(MarkStack& markStack)
+    {
+        markStack.append(m_prototype);
+    }
+
     inline Heap* Heap::heap(JSValue v)
     {
         if (!v.isCell())
diff --git a/JavaScriptCore/runtime/JSGlobalObject.cpp b/JavaScriptCore/runtime/JSGlobalObject.cpp
index 6b6e6d9..3bb281e 100644
--- a/JavaScriptCore/runtime/JSGlobalObject.cpp
+++ b/JavaScriptCore/runtime/JSGlobalObject.cpp
@@ -89,7 +89,7 @@ static inline void markIfNeeded(MarkStack& markStack, JSValue v)
 static inline void markIfNeeded(MarkStack& markStack, const RefPtr<Structure>& s)
 {
     if (s)
-        markIfNeeded(markStack, s->storedPrototype());
+        s->markAggregate(markStack);
 }
 
 JSGlobalObject::~JSGlobalObject()
@@ -394,21 +394,6 @@ void JSGlobalObject::markChildren(MarkStack& markStack)
     markIfNeeded(markStack, d()->methodCallDummy);
 
     markIfNeeded(markStack, d()->errorStructure);
-    markIfNeeded(markStack, d()->argumentsStructure);
-    markIfNeeded(markStack, d()->arrayStructure);
-    markIfNeeded(markStack, d()->booleanObjectStructure);
-    markIfNeeded(markStack, d()->callbackConstructorStructure);
-    markIfNeeded(markStack, d()->callbackFunctionStructure);
-    markIfNeeded(markStack, d()->callbackObjectStructure);
-    markIfNeeded(markStack, d()->dateStructure);
-    markIfNeeded(markStack, d()->emptyObjectStructure);
-    markIfNeeded(markStack, d()->errorStructure);
-    markIfNeeded(markStack, d()->functionStructure);
-    markIfNeeded(markStack, d()->numberObjectStructure);
-    markIfNeeded(markStack, d()->prototypeFunctionStructure);
-    markIfNeeded(markStack, d()->regExpMatchesArrayStructure);
-    markIfNeeded(markStack, d()->regExpStructure);
-    markIfNeeded(markStack, d()->stringObjectStructure);
 
     // No need to mark the other structures, because their prototypes are all
     // guaranteed to be referenced elsewhere.
diff --git a/JavaScriptCore/runtime/JSObject.cpp b/JavaScriptCore/runtime/JSObject.cpp
index 90c36aa..db2a9b2 100644
--- a/JavaScriptCore/runtime/JSObject.cpp
+++ b/JavaScriptCore/runtime/JSObject.cpp
@@ -42,25 +42,6 @@ namespace JSC {
 
 ASSERT_CLASS_FITS_IN_CELL(JSObject);
 
-static inline void getEnumerablePropertyNames(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames)
-{
-    // Add properties from the static hashtables of properties
-    for (; classInfo; classInfo = classInfo->parentClass) {
-        const HashTable* table = classInfo->propHashTable(exec);
-        if (!table)
-            continue;
-        table->initializeIfNeeded(exec);
-        ASSERT(table->table);
-
-        int hashSizeMask = table->compactSize - 1;
-        const HashEntry* entry = table->table;
-        for (int i = 0; i <= hashSizeMask; ++i, ++entry) {
-            if (entry->key() && !(entry->attributes() & DontEnum))
-                propertyNames.add(entry->key());
-        }
-    }
-}
-
 void JSObject::markChildren(MarkStack& markStack)
 {
 #ifndef NDEBUG
@@ -443,52 +424,12 @@ bool JSObject::getPropertySpecificValue(ExecState*, const Identifier& propertyNa
 
 void JSObject::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
 {
-    bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || m_structure->isDictionary());
-
-    if (shouldCache) {
-        if (PropertyNameArrayData* data = m_structure->enumerationCache()) {
-            if (data->cachedPrototypeChain() == m_structure->prototypeChain(exec)) {
-                propertyNames.setData(data);
-                return;
-            }
-
-            m_structure->clearEnumerationCache();
-        }
-    }
-
-    getOwnPropertyNames(exec, propertyNames);
-
-    if (prototype().isObject()) {
-        propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly.
-        JSObject* prototype = asObject(this->prototype());
-        while(1) {
-            if (!prototype->structure()->typeInfo().hasDefaultGetPropertyNames()) {
-                prototype->getPropertyNames(exec, propertyNames);
-                break;
-            }
-            prototype->getOwnPropertyNames(exec, propertyNames);
-            JSValue nextProto = prototype->prototype();
-            if (!nextProto.isObject())
-                break;
-            prototype = asObject(nextProto);
-        }
-    }
-
-    if (shouldCache) {
-        StructureChain* protoChain = m_structure->prototypeChain(exec);
-        if (!protoChain->isCacheable())
-            return;
-        RefPtr<PropertyNameArrayData> data = propertyNames.data();
-        data->setCachedPrototypeChain(protoChain);
-        data->setCachedStructure(m_structure);
-        m_structure->setEnumerationCache(data.release());
-    }
+    m_structure->getEnumerablePropertyNames(exec, propertyNames, this);
 }
 
 void JSObject::getOwnPropertyNames(ExecState* exec, PropertyNameArray& propertyNames)
 {
-    m_structure->getEnumerablePropertyNames(propertyNames);
-    getEnumerablePropertyNames(exec, classInfo(), propertyNames);
+    m_structure->getOwnEnumerablePropertyNames(exec, propertyNames, this);
 }
 
 bool JSObject::toBoolean(ExecState*) const
diff --git a/JavaScriptCore/runtime/JSObject.h b/JavaScriptCore/runtime/JSObject.h
index dc40a63..84b5f4b 100644
--- a/JavaScriptCore/runtime/JSObject.h
+++ b/JavaScriptCore/runtime/JSObject.h
@@ -682,7 +682,7 @@ ALWAYS_INLINE void JSObject::markChildrenDirect(MarkStack& markStack)
 {
     JSCell::markChildren(markStack);
 
-    markStack.append(prototype());
+    m_structure->markAggregate(markStack);
     
     PropertyStorage storage = propertyStorage();
     size_t storageSize = m_structure->propertyStorageSize();
diff --git a/JavaScriptCore/runtime/NumberPrototype.cpp b/JavaScriptCore/runtime/NumberPrototype.cpp
index 2e8c67d..df31404 100644
--- a/JavaScriptCore/runtime/NumberPrototype.cpp
+++ b/JavaScriptCore/runtime/NumberPrototype.cpp
@@ -28,7 +28,6 @@
 #include "PrototypeFunction.h"
 #include "dtoa.h"
 #include "Operations.h"
-#include "StructureChain.h"
 #include <wtf/Assertions.h>
 #include <wtf/MathExtras.h>
 #include <wtf/Vector.h>
diff --git a/JavaScriptCore/runtime/PropertyNameArray.h b/JavaScriptCore/runtime/PropertyNameArray.h
index ed5005d..afcc83f 100644
--- a/JavaScriptCore/runtime/PropertyNameArray.h
+++ b/JavaScriptCore/runtime/PropertyNameArray.h
@@ -23,14 +23,11 @@
 
 #include "CallFrame.h"
 #include "Identifier.h"
-#include "StructureChain.h"
+#include "Structure.h"
 #include <wtf/HashSet.h>
 #include <wtf/Vector.h>
 
 namespace JSC {
-    
-    class Structure;
-    class StructureChain;
 
     class PropertyNameArrayData : public RefCounted<PropertyNameArrayData> {
     public:
diff --git a/JavaScriptCore/runtime/Structure.cpp b/JavaScriptCore/runtime/Structure.cpp
index 643a49a..7209b5f 100644
--- a/JavaScriptCore/runtime/Structure.cpp
+++ b/JavaScriptCore/runtime/Structure.cpp
@@ -282,6 +282,52 @@ void Structure::materializePropertyMap()
     }
 }
 
+void Structure::getOwnEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
+{
+    getEnumerableNamesFromPropertyTable(propertyNames);
+    getEnumerableNamesFromClassInfoTable(exec, baseObject->classInfo(), propertyNames);
+}
+
+void Structure::getEnumerablePropertyNames(ExecState* exec, PropertyNameArray& propertyNames, JSObject* baseObject)
+{
+    bool shouldCache = propertyNames.shouldCache() && !(propertyNames.size() || isDictionary());
+
+    if (shouldCache && m_cachedPropertyNameArrayData) {
+        if (m_cachedPropertyNameArrayData->cachedPrototypeChain() == prototypeChain(exec)) {
+            propertyNames.setData(m_cachedPropertyNameArrayData);
+            return;
+        }
+        clearEnumerationCache();
+    }
+
+    baseObject->getOwnPropertyNames(exec, propertyNames);
+
+    if (m_prototype.isObject()) {
+        propertyNames.setShouldCache(false); // No need for our prototypes to waste memory on caching, since they're not being enumerated directly.
+        JSObject* prototype = asObject(m_prototype);
+        while(1) {
+            if (!prototype->structure()->typeInfo().hasDefaultGetPropertyNames()) {
+                prototype->getPropertyNames(exec, propertyNames);
+                break;
+            }
+            prototype->getOwnPropertyNames(exec, propertyNames);
+            JSValue nextProto = prototype->prototype();
+            if (!nextProto.isObject())
+                break;
+            prototype = asObject(nextProto);
+        }
+    }
+
+    if (shouldCache) {
+        StructureChain* protoChain = prototypeChain(exec);
+        m_cachedPropertyNameArrayData = propertyNames.data();
+        if (!protoChain->isCacheable())
+            return;
+        m_cachedPropertyNameArrayData->setCachedPrototypeChain(protoChain);
+        m_cachedPropertyNameArrayData->setCachedStructure(this);
+    }
+}
+
 void Structure::clearEnumerationCache()
 {
     if (m_cachedPropertyNameArrayData)
@@ -1011,7 +1057,7 @@ static int comparePropertyMapEntryIndices(const void* a, const void* b)
     return 0;
 }
 
-void Structure::getEnumerablePropertyNames(PropertyNameArray& propertyNames)
+void Structure::getEnumerableNamesFromPropertyTable(PropertyNameArray& propertyNames)
 {
     materializePropertyMapIfNecessary();
     if (!m_propertyTable)
@@ -1068,6 +1114,25 @@ void Structure::getEnumerablePropertyNames(PropertyNameArray& propertyNames)
     }
 }
 
+void Structure::getEnumerableNamesFromClassInfoTable(ExecState* exec, const ClassInfo* classInfo, PropertyNameArray& propertyNames)
+{
+    // Add properties from the static hashtables of properties
+    for (; classInfo; classInfo = classInfo->parentClass) {
+        const HashTable* table = classInfo->propHashTable(exec);
+        if (!table)
+            continue;
+        table->initializeIfNeeded(exec);
+        ASSERT(table->table);
+
+        int hashSizeMask = table->compactSize - 1;
+        const HashEntry* entry = table->table;
+        for (int i = 0; i <= hashSizeMask; ++i, ++entry) {
+            if (entry->key() && !(entry->attributes() & DontEnum))
+                propertyNames.add(entry->key());
+        }
+    }
+}
+
 #if DO_PROPERTYMAP_CONSTENCY_CHECK
 
 void Structure::checkConsistency()
diff --git a/JavaScriptCore/runtime/Structure.h b/JavaScriptCore/runtime/Structure.h
index a027b1a..ed9f6e5 100644
--- a/JavaScriptCore/runtime/Structure.h
+++ b/JavaScriptCore/runtime/Structure.h
@@ -30,7 +30,6 @@
 #include "JSType.h"
 #include "JSValue.h"
 #include "PropertyMapHashTable.h"
-#include "PropertyNameArray.h"
 #include "StructureChain.h"
 #include "StructureTransitionTable.h"
 #include "JSTypeInfo.h"
@@ -77,6 +76,8 @@ namespace JSC {
 
         ~Structure();
 
+        void markAggregate(MarkStack&);
+
         // These should be used with caution.  
         size_t addPropertyWithoutTransition(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
         size_t removePropertyWithoutTransition(const Identifier& propertyName);
@@ -115,6 +116,9 @@ namespace JSC {
             return hasTransition(propertyName._ustring.rep(), attributes);
         }
 
+        void getEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
+        void getOwnEnumerablePropertyNames(ExecState*, PropertyNameArray&, JSObject*);
+
         bool hasGetterSetterProperties() const { return m_hasGetterSetterProperties; }
         void setHasGetterSetterProperties(bool hasGetterSetterProperties) { m_hasGetterSetterProperties = hasGetterSetterProperties; }
 
@@ -123,11 +127,6 @@ namespace JSC {
         JSCell* specificValue() { return m_specificValueInPrevious; }
         void despecifyDictionaryFunction(const Identifier& propertyName);
 
-        void setEnumerationCache(PassRefPtr<PropertyNameArrayData> data) { m_cachedPropertyNameArrayData = data; }
-        PropertyNameArrayData* enumerationCache() { return m_cachedPropertyNameArrayData.get(); }
-        void clearEnumerationCache();
-        void getEnumerablePropertyNames(PropertyNameArray&);
-
     private:
         Structure(JSValue prototype, const TypeInfo&);
         
@@ -141,6 +140,8 @@ namespace JSC {
         size_t put(const Identifier& propertyName, unsigned attributes, JSCell* specificValue);
         size_t remove(const Identifier& propertyName);
         void addAnonymousSlots(unsigned slotCount);
+        void getEnumerableNamesFromPropertyTable(PropertyNameArray&);
+        void getEnumerableNamesFromClassInfoTable(ExecState*, const ClassInfo*, PropertyNameArray&);
 
         void expandPropertyMapHashTable();
         void rehashPropertyMapHashTable();
@@ -161,6 +162,8 @@ namespace JSC {
             materializePropertyMap();
         }
 
+        void clearEnumerationCache();
+
         signed char transitionCount() const
         {
             // Since the number of transitions is always the same as m_offset, we keep the size of Structure down by not storing both.

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list