Changeset 34962 in webkit for trunk/JavaScriptCore


Ignore:
Timestamp:
Jul 2, 2008, 5:05:26 PM (17 years ago)
Author:
[email protected]
Message:

2008-07-02 Kevin McCullough <[email protected]>

Reviewed by Darin.

-Small cleanup in preparation for implementing Bottom-up.

  • profiler/CallIdentifier.h: Rename debug function to make it clear of its output and intention to be debug only. (KJS::CallIdentifier::operator const char* ): Implement in terms of c_str. (KJS::CallIdentifier::c_str):
  • profiler/ProfileNode.cpp: Impelment findChild() which will be needed by the bottom-up implementation. (KJS::ProfileNode::findChild):
  • profiler/ProfileNode.h: Added comments to make the collections of functions more clear. (KJS::ProfileNode::operator==): (KJS::ProfileNode::c_str):
Location:
trunk/JavaScriptCore
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/ChangeLog

    r34961 r34962  
     12008-07-02  Kevin McCullough  <[email protected]>
     2
     3        Reviewed by Darin.
     4
     5        -Small cleanup in preparation for implementing Bottom-up.
     6
     7        * profiler/CallIdentifier.h: Rename debug function to make it clear of
     8        its output and intention to be debug only.
     9        (KJS::CallIdentifier::operator const char* ): Implement in terms of
     10        c_str.
     11        (KJS::CallIdentifier::c_str):
     12        * profiler/ProfileNode.cpp: Impelment findChild() which will be needed
     13        by the bottom-up implementation.
     14        (KJS::ProfileNode::findChild):
     15        * profiler/ProfileNode.h: Added comments to make the collections of
     16        functions more clear.
     17        (KJS::ProfileNode::operator==):
     18        (KJS::ProfileNode::c_str):
     19
    1202008-07-02  Cameron Zwarich  <[email protected]>
    221
  • trunk/JavaScriptCore/profiler/CallIdentifier.h

    r34957 r34962  
    5555
    5656#ifndef NDEBUG
    57         operator const char* () const { return m_name.UTF8String().c_str(); }
    58         const char* toString() const { return *this; }
     57        operator const char* () const { return c_str(); }
     58        const char* c_str() const { return m_name.UTF8String().c_str(); }
    5959#endif
    6060    };
  • trunk/JavaScriptCore/profiler/ProfileNode.cpp

    r34778 r34962  
    101101    m_children.append(child.release());
    102102}
    103        
     103
     104ProfileNode* ProfileNode::findChild(ProfileNode* node) const
     105{
     106    for (size_t i = 0; i < m_children.size(); ++i) {
     107        if (*node == m_children[i].get())
     108            return m_children[i].get();
     109    }
     110
     111    return 0;
     112}
     113
    104114void ProfileNode::insertNode(PassRefPtr<ProfileNode> prpNode)
    105115{
  • trunk/JavaScriptCore/profiler/ProfileNode.h

    r34957 r34962  
    4848            return adoptRef(new ProfileNode(callIdentifier, headNode, parentNode)); }
    4949
     50        bool operator==(ProfileNode* node) { return m_callIdentifier == node->callIdentifier(); }
     51
    5052        ProfileNode* willExecute(const CallIdentifier&);
    5153        ProfileNode* didExecute();
     
    5355        void stopProfiling();
    5456
     57        // CallIdentifier members
    5558        const CallIdentifier& callIdentifier() const { return m_callIdentifier; }
    5659        ProfileNode* parent() const { return m_parent; }
     
    6265        unsigned lineNumber() const { return m_callIdentifier.m_lineNumber; }
    6366
     67        // Time members
    6468        double startTime() const { return m_startTime; }
    6569        void setStartTime(double startTime) { m_startTime = startTime; }
     
    7983        void setNumberOfCalls(unsigned number) { m_numberOfCalls = number; }
    8084
     85        // Children members
    8186        const Vector<RefPtr<ProfileNode> >& children() const { return m_children; }
    8287        ProfileNode* firstChild() const { return m_children.size() ? m_children.first().get() : 0; }
    8388        ProfileNode* lastChild() const { return m_children.size() ? m_children.last().get() : 0; }
     89        ProfileNode* findChild(ProfileNode*) const;
    8490        void removeChild(unsigned index) { m_children.remove(index); resetChildrensSiblings(); }
    8591        void addChild(PassRefPtr<ProfileNode> prpChild);
    8692        void insertNode(PassRefPtr<ProfileNode> prpNode);
    8793
     94        // Visiblity
    8895        bool visible() const { return m_visible; }
    8996        void setVisible(bool visible) { m_visible = visible; }
     
    9198        static void setTreeVisible(ProfileNode*, bool visible);
    9299
     100        // Sorting
    93101        ProfileNode* traverseNextNodePostOrder() const;
    94102        ProfileNode* traverseNextNodePreOrder(bool processChildren = true) const;
    95        
     103
    96104        void sort(bool (*)(const RefPtr<ProfileNode>&, const RefPtr<ProfileNode>&));
    97105        void sortTotalTimeDescending() { sort(totalTimeDescendingComparator); }
     
    104112        void sortFunctionNameAscending() { sort(functionNameAscendingComparator); }
    105113
     114        // Views
    106115        void calculateVisibleTotalTime();
    107116        bool focus(const CallIdentifier&);
     
    112121
    113122#ifndef NDEBUG
    114         const char* toString() const { return m_callIdentifier; }
     123        const char* c_str() const { return m_callIdentifier; }
    115124        void debugPrintData(int indentLevel) const;
    116125        double debugPrintDataSampleStyle(int indentLevel, FunctionCallHashCount&) const;
    117126#endif
     127
    118128    private:
    119129        ProfileNode(const CallIdentifier&, ProfileNode* headNode, ProfileNode* parentNode);
Note: See TracChangeset for help on using the changeset viewer.