diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-09-10 19:10:20 +0200 |
commit | 284837daa07b29d6a63a748544a90b1f5842ac5c (patch) | |
tree | ecd258180bde91fe741e0cfd2638beb3c6da7e8e /Source/JavaScriptCore/profiler | |
parent | 2e2ba8ff45915f40ed3e014101269c175f2a89a0 (diff) | |
download | qtwebkit-284837daa07b29d6a63a748544a90b1f5842ac5c.tar.gz |
Imported WebKit commit 68645295d2e3e09af2c942f092556f06aa5f8b0d (http://svn.webkit.org/repository/webkit/trunk@128073)
New snapshot
Diffstat (limited to 'Source/JavaScriptCore/profiler')
-rw-r--r-- | Source/JavaScriptCore/profiler/CallIdentifier.h | 10 | ||||
-rw-r--r-- | Source/JavaScriptCore/profiler/Profile.cpp | 8 | ||||
-rw-r--r-- | Source/JavaScriptCore/profiler/Profile.h | 10 | ||||
-rw-r--r-- | Source/JavaScriptCore/profiler/ProfileGenerator.cpp | 10 | ||||
-rw-r--r-- | Source/JavaScriptCore/profiler/ProfileGenerator.h | 7 | ||||
-rw-r--r-- | Source/JavaScriptCore/profiler/ProfileNode.h | 8 | ||||
-rw-r--r-- | Source/JavaScriptCore/profiler/Profiler.cpp | 19 | ||||
-rw-r--r-- | Source/JavaScriptCore/profiler/Profiler.h | 13 |
8 files changed, 41 insertions, 44 deletions
diff --git a/Source/JavaScriptCore/profiler/CallIdentifier.h b/Source/JavaScriptCore/profiler/CallIdentifier.h index 2da8a2ff1..bf9f904b0 100644 --- a/Source/JavaScriptCore/profiler/CallIdentifier.h +++ b/Source/JavaScriptCore/profiler/CallIdentifier.h @@ -27,17 +27,17 @@ #ifndef CallIdentifier_h #define CallIdentifier_h -#include <runtime/UString.h> #include <wtf/text/CString.h> #include <wtf/text/StringHash.h> +#include <wtf/text/WTFString.h> namespace JSC { struct CallIdentifier { WTF_MAKE_FAST_ALLOCATED; public: - UString m_name; - UString m_url; + String m_name; + String m_url; unsigned m_lineNumber; CallIdentifier() @@ -45,7 +45,7 @@ namespace JSC { { } - CallIdentifier(const UString& name, const UString& url, int lineNumber) + CallIdentifier(const String& name, const String& url, int lineNumber) : m_name(name) , m_url(!url.isNull() ? url : "") , m_lineNumber(lineNumber) @@ -87,7 +87,7 @@ namespace WTF { template<> struct HashTraits<JSC::CallIdentifier> : GenericHashTraits<JSC::CallIdentifier> { static void constructDeletedValue(JSC::CallIdentifier& slot) { - new (NotNull, &slot) JSC::CallIdentifier(JSC::UString(), JSC::UString(), std::numeric_limits<unsigned>::max()); + new (NotNull, &slot) JSC::CallIdentifier(String(), String(), std::numeric_limits<unsigned>::max()); } static bool isDeletedValue(const JSC::CallIdentifier& value) { diff --git a/Source/JavaScriptCore/profiler/Profile.cpp b/Source/JavaScriptCore/profiler/Profile.cpp index 92e32c4ba..51f871898 100644 --- a/Source/JavaScriptCore/profiler/Profile.cpp +++ b/Source/JavaScriptCore/profiler/Profile.cpp @@ -32,18 +32,18 @@ namespace JSC { -PassRefPtr<Profile> Profile::create(const UString& title, unsigned uid) +PassRefPtr<Profile> Profile::create(const String& title, unsigned uid) { return adoptRef(new Profile(title, uid)); } -Profile::Profile(const UString& title, unsigned uid) +Profile::Profile(const String& title, unsigned uid) : m_title(title) , m_uid(uid) { // FIXME: When multi-threading is supported this will be a vector and calls // into the profiler will need to know which thread it is executing on. - m_head = ProfileNode::create(0, CallIdentifier("Thread_1", UString(), 0), 0, 0); + m_head = ProfileNode::create(0, CallIdentifier("Thread_1", String(), 0), 0, 0); } Profile::~Profile() @@ -128,7 +128,7 @@ void Profile::debugPrintDataSampleStyle() const std::sort(sortedFunctions.begin(), sortedFunctions.end(), functionNameCountPairComparator); for (NameCountPairVector::iterator it = sortedFunctions.begin(); it != sortedFunctions.end(); ++it) - dataLog(" %-12d%s\n", (*it).second, UString((*it).first).utf8().data()); + dataLog(" %-12d%s\n", (*it).second, String((*it).first).utf8().data()); dataLog("\nSort by top of stack, same collapsed (when >= 5):\n"); } diff --git a/Source/JavaScriptCore/profiler/Profile.h b/Source/JavaScriptCore/profiler/Profile.h index 9455e3595..c1c69193c 100644 --- a/Source/JavaScriptCore/profiler/Profile.h +++ b/Source/JavaScriptCore/profiler/Profile.h @@ -27,18 +27,18 @@ #define Profile_h #include "ProfileNode.h" -#include <runtime/UString.h> #include <wtf/RefCounted.h> #include <wtf/RefPtr.h> +#include <wtf/text/WTFString.h> namespace JSC { class Profile : public RefCounted<Profile> { public: - static PassRefPtr<Profile> create(const UString& title, unsigned uid); + static PassRefPtr<Profile> create(const String& title, unsigned uid); virtual ~Profile(); - const UString& title() const { return m_title; } + const String& title() const { return m_title; } ProfileNode* head() const { return m_head.get(); } void setHead(PassRefPtr<ProfileNode> head) { m_head = head; } double totalTime() const { return m_head->totalTime(); } @@ -56,13 +56,13 @@ namespace JSC { #endif protected: - Profile(const UString& title, unsigned uid); + Profile(const String& title, unsigned uid); private: void removeProfileStart(); void removeProfileEnd(); - UString m_title; + String m_title; RefPtr<ProfileNode> m_head; unsigned int m_uid; }; diff --git a/Source/JavaScriptCore/profiler/ProfileGenerator.cpp b/Source/JavaScriptCore/profiler/ProfileGenerator.cpp index 5db38bca8..09877d3c8 100644 --- a/Source/JavaScriptCore/profiler/ProfileGenerator.cpp +++ b/Source/JavaScriptCore/profiler/ProfileGenerator.cpp @@ -40,12 +40,12 @@ namespace JSC { static const char* NonJSExecution = "(idle)"; -PassRefPtr<ProfileGenerator> ProfileGenerator::create(ExecState* exec, const UString& title, unsigned uid) +PassRefPtr<ProfileGenerator> ProfileGenerator::create(ExecState* exec, const String& title, unsigned uid) { return adoptRef(new ProfileGenerator(exec, title, uid)); } -ProfileGenerator::ProfileGenerator(ExecState* exec, const UString& title, unsigned uid) +ProfileGenerator::ProfileGenerator(ExecState* exec, const String& title, unsigned uid) : m_origin(exec ? exec->lexicalGlobalObject() : 0) , m_profileGroup(exec ? exec->lexicalGlobalObject()->profileGroup() : 0) { @@ -59,7 +59,7 @@ void ProfileGenerator::addParentForConsoleStart(ExecState* exec) { int lineNumber; intptr_t sourceID; - UString sourceURL; + String sourceURL; JSValue function; exec->interpreter()->retrieveLastCaller(exec, lineNumber, sourceID, sourceURL, function); @@ -67,7 +67,7 @@ void ProfileGenerator::addParentForConsoleStart(ExecState* exec) m_head->insertNode(m_currentNode.get()); } -const UString& ProfileGenerator::title() const +const String& ProfileGenerator::title() const { return m_profile->title(); } @@ -135,7 +135,7 @@ void ProfileGenerator::stopProfiling() m_currentNode = m_currentNode->parent(); if (double headSelfTime = m_head->selfTime()) { - RefPtr<ProfileNode> idleNode = ProfileNode::create(0, CallIdentifier(NonJSExecution, UString(), 0), m_head.get(), m_head.get()); + RefPtr<ProfileNode> idleNode = ProfileNode::create(0, CallIdentifier(NonJSExecution, String(), 0), m_head.get(), m_head.get()); idleNode->setTotalTime(headSelfTime); idleNode->setSelfTime(headSelfTime); diff --git a/Source/JavaScriptCore/profiler/ProfileGenerator.h b/Source/JavaScriptCore/profiler/ProfileGenerator.h index 8c8b81731..40cc8de01 100644 --- a/Source/JavaScriptCore/profiler/ProfileGenerator.h +++ b/Source/JavaScriptCore/profiler/ProfileGenerator.h @@ -37,15 +37,14 @@ namespace JSC { class JSGlobalObject; class Profile; class ProfileNode; - class UString; struct CallIdentifier; class ProfileGenerator : public RefCounted<ProfileGenerator> { public: - static PassRefPtr<ProfileGenerator> create(ExecState*, const UString& title, unsigned uid); + static PassRefPtr<ProfileGenerator> create(ExecState*, const WTF::String& title, unsigned uid); // Members - const UString& title() const; + const WTF::String& title() const; PassRefPtr<Profile> profile() const { return m_profile; } JSGlobalObject* origin() const { return m_origin; } unsigned profileGroup() const { return m_profileGroup; } @@ -62,7 +61,7 @@ namespace JSC { typedef void (ProfileGenerator::*ProfileFunction)(ExecState* callerOrHandlerCallFrame, const CallIdentifier& callIdentifier); private: - ProfileGenerator(ExecState*, const UString& title, unsigned uid); + ProfileGenerator(ExecState*, const WTF::String& title, unsigned uid); void addParentForConsoleStart(ExecState*); void removeProfileStart(); diff --git a/Source/JavaScriptCore/profiler/ProfileNode.h b/Source/JavaScriptCore/profiler/ProfileNode.h index ffe7b6f9d..26000a827 100644 --- a/Source/JavaScriptCore/profiler/ProfileNode.h +++ b/Source/JavaScriptCore/profiler/ProfileNode.h @@ -64,8 +64,8 @@ namespace JSC { // CallIdentifier members ExecState* callerCallFrame() const { return m_callerCallFrame; } const CallIdentifier& callIdentifier() const { return m_callIdentifier; } - const UString& functionName() const { return m_callIdentifier.m_name; } - const UString& url() const { return m_callIdentifier.m_url; } + const String& functionName() const { return m_callIdentifier.m_name; } + const String& url() const { return m_callIdentifier.m_url; } unsigned lineNumber() const { return m_callIdentifier.m_lineNumber; } // Relationships @@ -146,8 +146,8 @@ namespace JSC { static inline bool selfTimeAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->selfTime() < b->selfTime(); } static inline bool callsDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->numberOfCalls() > b->numberOfCalls(); } static inline bool callsAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->numberOfCalls() < b->numberOfCalls(); } - static inline bool functionNameDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->functionName() > b->functionName(); } - static inline bool functionNameAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return a->functionName() < b->functionName(); } + static inline bool functionNameDescendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return codePointCompareLessThan(b->functionName(), a->functionName()); } + static inline bool functionNameAscendingComparator(const RefPtr<ProfileNode>& a, const RefPtr<ProfileNode>& b) { return codePointCompareLessThan(a->functionName(), b->functionName()); } ExecState* m_callerCallFrame; CallIdentifier m_callIdentifier; diff --git a/Source/JavaScriptCore/profiler/Profiler.cpp b/Source/JavaScriptCore/profiler/Profiler.cpp index 723393b5c..9642a0684 100644 --- a/Source/JavaScriptCore/profiler/Profiler.cpp +++ b/Source/JavaScriptCore/profiler/Profiler.cpp @@ -39,7 +39,6 @@ #include "Profile.h" #include "ProfileGenerator.h" #include "ProfileNode.h" -#include "UStringConcatenate.h" #include <stdio.h> namespace JSC { @@ -48,7 +47,7 @@ static const char* GlobalCodeExecution = "(program)"; static const char* AnonymousFunction = "(anonymous function)"; static unsigned ProfilesUID = 0; -static CallIdentifier createCallIdentifierFromFunctionImp(ExecState*, JSObject*, const UString& defaultSourceURL, int defaultLineNumber); +static CallIdentifier createCallIdentifierFromFunctionImp(ExecState*, JSObject*, const String& defaultSourceURL, int defaultLineNumber); Profiler* Profiler::s_sharedProfiler = 0; @@ -59,7 +58,7 @@ Profiler* Profiler::profiler() return s_sharedProfiler; } -void Profiler::startProfiling(ExecState* exec, const UString& title) +void Profiler::startProfiling(ExecState* exec, const String& title) { ASSERT_ARG(title, !title.isNull()); @@ -78,7 +77,7 @@ void Profiler::startProfiling(ExecState* exec, const UString& title) m_currentProfiles.append(profileGenerator); } -PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const UString& title) +PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const String& title) { JSGlobalObject* origin = exec ? exec->lexicalGlobalObject() : 0; for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) { @@ -126,7 +125,7 @@ void Profiler::willExecute(ExecState* callerCallFrame, JSValue function) dispatchFunctionToProfiles(callerCallFrame, m_currentProfiles, &ProfileGenerator::willExecute, createCallIdentifier(callerCallFrame, function, "", 0), callerCallFrame->lexicalGlobalObject()->profileGroup()); } -void Profiler::willExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber) +void Profiler::willExecute(ExecState* callerCallFrame, const String& sourceURL, int startingLineNumber) { ASSERT(!m_currentProfiles.isEmpty()); @@ -142,7 +141,7 @@ void Profiler::didExecute(ExecState* callerCallFrame, JSValue function) dispatchFunctionToProfiles(callerCallFrame, m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(callerCallFrame, function, "", 0), callerCallFrame->lexicalGlobalObject()->profileGroup()); } -void Profiler::didExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber) +void Profiler::didExecute(ExecState* callerCallFrame, const String& sourceURL, int startingLineNumber) { ASSERT(!m_currentProfiles.isEmpty()); @@ -156,7 +155,7 @@ void Profiler::exceptionUnwind(ExecState* handlerCallFrame) dispatchFunctionToProfiles(handlerCallFrame, m_currentProfiles, &ProfileGenerator::exceptionUnwind, createCallIdentifier(handlerCallFrame, JSValue(), "", 0), handlerCallFrame->lexicalGlobalObject()->profileGroup()); } -CallIdentifier Profiler::createCallIdentifier(ExecState* exec, JSValue functionValue, const UString& defaultSourceURL, int defaultLineNumber) +CallIdentifier Profiler::createCallIdentifier(ExecState* exec, JSValue functionValue, const String& defaultSourceURL, int defaultLineNumber) { if (!functionValue) return CallIdentifier(GlobalCodeExecution, defaultSourceURL, defaultLineNumber); @@ -164,12 +163,12 @@ CallIdentifier Profiler::createCallIdentifier(ExecState* exec, JSValue functionV return CallIdentifier("(unknown)", defaultSourceURL, defaultLineNumber); if (asObject(functionValue)->inherits(&JSFunction::s_info) || asObject(functionValue)->inherits(&InternalFunction::s_info)) return createCallIdentifierFromFunctionImp(exec, asObject(functionValue), defaultSourceURL, defaultLineNumber); - return CallIdentifier(makeUString("(", asObject(functionValue)->methodTable()->className(asObject(functionValue)), " object)"), defaultSourceURL, defaultLineNumber); + return CallIdentifier(makeString("(", asObject(functionValue)->methodTable()->className(asObject(functionValue)), " object)"), defaultSourceURL, defaultLineNumber); } -CallIdentifier createCallIdentifierFromFunctionImp(ExecState* exec, JSObject* function, const UString& defaultSourceURL, int defaultLineNumber) +CallIdentifier createCallIdentifierFromFunctionImp(ExecState* exec, JSObject* function, const String& defaultSourceURL, int defaultLineNumber) { - const UString& name = getCalculatedDisplayName(exec, function); + const String& name = getCalculatedDisplayName(exec, function); JSFunction* jsFunction = jsDynamicCast<JSFunction*>(function); if (jsFunction && !jsFunction->isHostFunction()) return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, jsFunction->jsExecutable()->sourceURL(), jsFunction->jsExecutable()->lineNo()); diff --git a/Source/JavaScriptCore/profiler/Profiler.h b/Source/JavaScriptCore/profiler/Profiler.h index 877065eca..6852457c7 100644 --- a/Source/JavaScriptCore/profiler/Profiler.h +++ b/Source/JavaScriptCore/profiler/Profiler.h @@ -42,23 +42,22 @@ namespace JSC { class JSObject; class JSValue; class ProfileGenerator; - class UString; - struct CallIdentifier; + struct CallIdentifier; class Profiler { WTF_MAKE_FAST_ALLOCATED; public: JS_EXPORT_PRIVATE static Profiler* profiler(); - static CallIdentifier createCallIdentifier(ExecState* exec, JSValue, const UString& sourceURL, int lineNumber); + static CallIdentifier createCallIdentifier(ExecState*, JSValue, const WTF::String& sourceURL, int lineNumber); - JS_EXPORT_PRIVATE void startProfiling(ExecState*, const UString& title); - JS_EXPORT_PRIVATE PassRefPtr<Profile> stopProfiling(ExecState*, const UString& title); + JS_EXPORT_PRIVATE void startProfiling(ExecState*, const WTF::String& title); + JS_EXPORT_PRIVATE PassRefPtr<Profile> stopProfiling(ExecState*, const WTF::String& title); void stopProfiling(JSGlobalObject*); void willExecute(ExecState* callerCallFrame, JSValue function); - void willExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber); + void willExecute(ExecState* callerCallFrame, const WTF::String& sourceURL, int startingLineNumber); void didExecute(ExecState* callerCallFrame, JSValue function); - void didExecute(ExecState* callerCallFrame, const UString& sourceURL, int startingLineNumber); + void didExecute(ExecState* callerCallFrame, const WTF::String& sourceURL, int startingLineNumber); void exceptionUnwind(ExecState* handlerCallFrame); |