[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

darin darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 07:05:23 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 57017199b314cded8378c0ca5ce1e78737e3945f
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Nov 21 01:28:08 2002 +0000

    	- added a feature for Richard to use in his back/forward cache
    
            * kjs/object.h: Added save/restoreProperties.
            * kjs/property_map.h: Here too.
            * kjs/property_map.cpp: Here too.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2794 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog
index 61bf872..7fe7305 100644
--- a/JavaScriptCore/ChangeLog
+++ b/JavaScriptCore/ChangeLog
@@ -1,5 +1,13 @@
 2002-11-20  Darin Adler  <darin at apple.com>
 
+	- added a feature for Richard to use in his back/forward cache
+
+        * kjs/object.h: Added save/restoreProperties.
+        * kjs/property_map.h: Here too.
+        * kjs/property_map.cpp: Here too.
+
+2002-11-20  Darin Adler  <darin at apple.com>
+
 	- created argument list objects only on demand for a 7.5% speedup
 
         * kjs/function.h: Change ActivationImp around.
diff --git a/JavaScriptCore/ChangeLog-2002-12-03 b/JavaScriptCore/ChangeLog-2002-12-03
index 61bf872..7fe7305 100644
--- a/JavaScriptCore/ChangeLog-2002-12-03
+++ b/JavaScriptCore/ChangeLog-2002-12-03
@@ -1,5 +1,13 @@
 2002-11-20  Darin Adler  <darin at apple.com>
 
+	- added a feature for Richard to use in his back/forward cache
+
+        * kjs/object.h: Added save/restoreProperties.
+        * kjs/property_map.h: Here too.
+        * kjs/property_map.cpp: Here too.
+
+2002-11-20  Darin Adler  <darin at apple.com>
+
 	- created argument list objects only on demand for a 7.5% speedup
 
         * kjs/function.h: Change ActivationImp around.
diff --git a/JavaScriptCore/ChangeLog-2003-10-25 b/JavaScriptCore/ChangeLog-2003-10-25
index 61bf872..7fe7305 100644
--- a/JavaScriptCore/ChangeLog-2003-10-25
+++ b/JavaScriptCore/ChangeLog-2003-10-25
@@ -1,5 +1,13 @@
 2002-11-20  Darin Adler  <darin at apple.com>
 
+	- added a feature for Richard to use in his back/forward cache
+
+        * kjs/object.h: Added save/restoreProperties.
+        * kjs/property_map.h: Here too.
+        * kjs/property_map.cpp: Here too.
+
+2002-11-20  Darin Adler  <darin at apple.com>
+
 	- created argument list objects only on demand for a 7.5% speedup
 
         * kjs/function.h: Change ActivationImp around.
diff --git a/JavaScriptCore/kjs/object.h b/JavaScriptCore/kjs/object.h
index 058fe6c..0ed63ea 100644
--- a/JavaScriptCore/kjs/object.h
+++ b/JavaScriptCore/kjs/object.h
@@ -80,7 +80,7 @@ namespace KJS {
      */
     void *dummy;
   };
-
+  
   /**
    * Represents an Object. This is a wrapper for ObjectImp
    */
@@ -357,6 +357,9 @@ namespace KJS {
      * @param v The new internal value
      */
     void setInternalValue(const Value &v);
+
+    void saveProperties(SavedProperties &p) const;
+    void restoreProperties(const SavedProperties &p);
   };
 
   inline Object Value::toObject(ExecState *exec) const { return rep->dispatchToObject(exec); }
@@ -589,6 +592,9 @@ namespace KJS {
         { return _prop.get(propertyName); }
     void putDirect(const Identifier &propertyName, ValueImp *value, int attr = 0);
     void putDirect(const Identifier &propertyName, int value, int attr = 0);
+    
+    void saveProperties(SavedProperties &p) const { _prop.save(p); }
+    void restoreProperties(const SavedProperties &p) { _prop.restore(p); }
 
   private:
     const HashEntry* findPropertyHashEntry( const Identifier& propertyName ) const;
@@ -713,6 +719,11 @@ namespace KJS {
   inline void Object::setInternalValue(const Value &v)
     { imp()->setInternalValue(v); }
 
+  inline void Object::saveProperties(SavedProperties &p) const
+    { imp()->saveProperties(p); }
+  inline void Object::restoreProperties(const SavedProperties &p)
+    { imp()->restoreProperties(p); }
+
 }; // namespace
 
 #endif // _KJS_OBJECT_H_
diff --git a/JavaScriptCore/kjs/property_map.cpp b/JavaScriptCore/kjs/property_map.cpp
index 77c7d5b..ebff3c6 100644
--- a/JavaScriptCore/kjs/property_map.cpp
+++ b/JavaScriptCore/kjs/property_map.cpp
@@ -25,11 +25,17 @@
 #include "object.h"
 #include "reference_list.h"
 
-// At the time I added this, the optimization still gave a 1.5% performance boost.
+// At the time I added this switch, the optimization still gave a 1.5% performance boost so I couldn't remove it.
 #define USE_SINGLE_ENTRY 1
 
 namespace KJS {
 
+class SavedProperty {
+public:
+    Identifier key;
+    Value value;
+};
+
 // Algorithm concepts from Algorithms in C++, Sedgewick.
 
 PropertyMap::PropertyMap() : _tableSize(0), _table(0), _keyCount(0)
@@ -281,4 +287,45 @@ void PropertyMap::addEnumerablesToReferenceList(ReferenceList &list, const Objec
     }
 }
 
+void PropertyMap::save(SavedProperties &p) const
+{
+    int count = 0;
+
+#if USE_SINGLE_ENTRY
+    if (_singleEntry.key)
+        ++count;
+#endif
+    for (int i = 0; i != _tableSize; ++i)
+        if (_table[i].key && _table[i].attributes == 0)
+            ++count;
+
+    delete [] p._properties;
+    if (count == 0) {
+        p._properties = 0;
+        return;
+    }
+    p._properties = new SavedProperty [count];
+    
+    SavedProperty *prop = p._properties;
+    
+#if USE_SINGLE_ENTRY
+    if (_singleEntry.key) {
+        prop->key = Identifier(_singleEntry.key);
+        prop->value = Value(_singleEntry.value);
+        ++prop;
+    }
+#endif
+    for (int i = 0; i != _tableSize; ++i)
+        if (_table[i].key && _table[i].attributes == 0) {
+            prop->key = Identifier(_table[i].key);
+            prop->value = Value(_table[i].value);
+        }
+}
+
+void PropertyMap::restore(const SavedProperties &p)
+{
+    for (int i = 0; i != p._count; ++i)
+        put(p._properties[i].key, p._properties[i].value.imp(), 0);
+}
+
 } // namespace KJS
diff --git a/JavaScriptCore/kjs/property_map.h b/JavaScriptCore/kjs/property_map.h
index ab2d391..7145e14 100644
--- a/JavaScriptCore/kjs/property_map.h
+++ b/JavaScriptCore/kjs/property_map.h
@@ -31,6 +31,22 @@ namespace KJS {
     class ReferenceList;
     class ValueImp;
     
+    class SavedProperty;
+    
+    class SavedProperties {
+    friend class PropertyMap;
+    public:
+        SavedProperties() : _count(0), _properties(0) { }
+        ~SavedProperties();
+        
+    private:
+        int _count;
+        SavedProperty *_properties;
+        
+        SavedProperties(const SavedProperties&);
+        SavedProperties& operator=(const SavedProperties&);
+    };
+    
     struct PropertyMapHashTableEntry
     {
         PropertyMapHashTableEntry() : key(0) { }
@@ -54,6 +70,9 @@ namespace KJS {
         void mark() const;
         void addEnumerablesToReferenceList(ReferenceList &, const Object &) const;
 
+        void save(SavedProperties &) const;
+        void restore(const SavedProperties &p);
+
     private:
         int hash(const UString::Rep *) const;
         static bool keysMatch(const UString::Rep *, const UString::Rep *);

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list