Changeset 32760 in webkit for trunk/JavaScriptCore/kjs


Ignore:
Timestamp:
May 1, 2008, 9:32:32 AM (17 years ago)
Author:
[email protected]
Message:

2008-05-01 Kevin McCullough <[email protected]>

Reviewed by Darin.

<rdar://problem/5770054> JavaScript profiler (10928)

  • Fix "sample" output so that it can be imported into Instruments
  • Also keep track of number of times a function is profiled.
  • JavaScriptCore.xcodeproj/project.pbxproj: Add StrHash.h which needed to be pulled out of identifier.cpp so that it could be used by the profiler and identifiers.
  • kjs/identifier.cpp: Ditto.
  • profiler/FunctionCallProfile.cpp: (KJS::FunctionCallProfile::printDataInspectorStyle): Inspector style printing should show microseconds. (KJS::FunctionCallProfile::printDataSampleStyle): Sample style printing now counts the number of times a function is in the stack tree and does not print microseconds since that does not make sense for a sampler.
  • profiler/FunctionCallProfile.h: Keep track of number of times a function is profiled. (KJS::FunctionCallProfile::numberOfCalls):
  • profiler/Profiler.cpp: (KJS::functionNameCountPairComparator): Comparator for sort function in printDataSampleStyle. (KJS::Profiler::printDataSampleStyle): Print the number of times that a function is listed in the stack tree in order of most times listed.
  • wtf/HashCountedSet.h: Added copyToVector since it didn't exist and is a more standard way to copy a HashSet to a Vector. I added on variant that takes a pair as the Vector's type and so the HashCountedSet simply fills in that pair with its internal pair, and another variant that takes a Vector of the type of the HashCountedSet and only fills in the Vector with the first element of the pair. (WTF::copyToVector):
  • wtf/StrHash.h: Added. (WTF::):
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/JavaScriptCore/kjs/identifier.cpp

    r32222 r32760  
    2929#include <wtf/FastMalloc.h>
    3030#include <wtf/HashSet.h>
     31//#include <wtf/StrHash.h>
    3132#if USE(MULTIPLE_THREADS)
    3233#include <wtf/ThreadSpecific.h>
    3334using namespace WTF;
    3435#endif
    35 
    36 namespace WTF {
    37 
    38     template<typename T> struct DefaultHash;
    39     template<typename T> struct StrHash;
    40 
    41     template<> struct StrHash<KJS::UString::Rep *> {
    42         static unsigned hash(const KJS::UString::Rep *key) { return key->hash(); }
    43         static bool equal(const KJS::UString::Rep *a, const KJS::UString::Rep *b) { return KJS::Identifier::equal(a, b); }
    44         static const bool safeToCompareToEmptyOrDeleted = false;
    45     };
    46 
    47     template<> struct DefaultHash<KJS::UString::Rep *> {
    48         typedef StrHash<KJS::UString::Rep *> Hash;
    49     };
    50 
    51 }
    5236
    5337namespace KJS {
Note: See TracChangeset for help on using the changeset viewer.