2008-04-18 Kevin McCullough <kmccullough@apple.com>
authorkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Apr 2008 22:41:49 +0000 (22:41 +0000)
committerkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 18 Apr 2008 22:41:49 +0000 (22:41 +0000)
        Reviewed by Sam.

        -<rdar://problem/5770054> JavaScript profiler (10928)
        - Use Deque instead of Vector since the profiler uses prepend a lot
        and deque is faster at that.

        * profiler/FunctionCallProfile.h:
        (KJS::FunctionCallProfile::milliSecs): Corrected the name to match
        its output.
        * wtf/Deque.h:
        (WTF::deleteAllValues):

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

JavaScriptCore/ChangeLog
JavaScriptCore/profiler/FunctionCallProfile.h
JavaScriptCore/wtf/Deque.h

index f548905..7901752 100644 (file)
@@ -1,5 +1,19 @@
 2008-04-18  Kevin McCullough  <kmccullough@apple.com>
 
+        Reviewed by Sam.
+
+        -<rdar://problem/5770054> JavaScript profiler (10928)
+        - Use Deque instead of Vector since the profiler uses prepend a lot
+        and deque is faster at that.
+
+        * profiler/FunctionCallProfile.h:
+        (KJS::FunctionCallProfile::milliSecs): Corrected the name to match
+        its output.
+        * wtf/Deque.h:
+        (WTF::deleteAllValues):
+
+2008-04-18  Kevin McCullough  <kmccullough@apple.com>
+
         Reviewed by Sam and Adam.
 
         -<rdar://problem/5770054> JavaScript profiler (10928)
index c3ae367..1b57135 100644 (file)
 #define FunctionCallProfile_h
 
 #include <kjs/ustring.h>
+#include <wtf/Deque.h>
 
 namespace KJS {
 
     class FunctionCallProfile;
 
-    typedef Vector<FunctionCallProfile*>::const_iterator StackIterator;
+    typedef Deque<FunctionCallProfile*>::const_iterator StackIterator;
 
     class FunctionCallProfile {
     public:
@@ -49,7 +50,7 @@ namespace KJS {
         FunctionCallProfile* findChild(const UString& name);
 
         UString functionName() const { return m_functionName; }
-        double microSecs() const { return m_timeSum; }
+        double milliSecs() const { return m_timeSum; }
 
         void printDataInspectorStyle(int indentLevel) const;
         double printDataSampleStyle(int indentLevel) const;
@@ -59,7 +60,7 @@ namespace KJS {
         double m_timeSum;
         double m_startTime;
 
-        Vector<FunctionCallProfile*> m_children;
+        Deque<FunctionCallProfile*> m_children;
     };
 
 } // namespace KJS
index f8cf4fe..70c546b 100644 (file)
@@ -313,6 +313,15 @@ namespace WTF {
     }
 
     template<typename T>
+    void deleteAllValues(const Deque<T>& collection)
+    {
+        typedef typename Deque<T>::const_iterator iterator;
+        iterator end = collection.end();
+        for (iterator it = collection.begin(); it != end; ++it)
+            delete *it;
+    }
+
+    template<typename T>
     inline Deque<T>& Deque<T>::operator=(const Deque<T>& other)
     {
         Deque<T> copy(other);