From 944b86216e43961fdb7a65de2974d5076f69adfd Mon Sep 17 00:00:00 2001 From: "kmccullough@apple.com" Date: Thu, 15 May 2008 00:25:48 +0000 Subject: [PATCH] JavaScriptCore: 2008-05-14 Kevin McCullough Reviewed by Sam. JavaScript profiler (10928) - Rename FunctionCallProfile to ProfileNode. * GNUmakefile.am: * JavaScriptCore.exp: * JavaScriptCore.pri: * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: * JavaScriptCore.xcodeproj/project.pbxproj: * JavaScriptCoreSources.bkl: * profiler/FunctionCallProfile.cpp: Removed. * profiler/FunctionCallProfile.h: Removed. * profiler/Profile.cpp: (KJS::Profile::Profile): (KJS::Profile::willExecute): * profiler/Profile.h: (KJS::Profile::callTree): * profiler/ProfileNode.cpp: Copied from profiler/FunctionCallProfile.cpp. (KJS::ProfileNode::ProfileNode): (KJS::ProfileNode::willExecute): (KJS::ProfileNode::didExecute): (KJS::ProfileNode::addChild): (KJS::ProfileNode::findChild): (KJS::ProfileNode::stopProfiling): (KJS::ProfileNode::selfTime): (KJS::ProfileNode::printDataInspectorStyle): (KJS::ProfileNode::printDataSampleStyle): (KJS::ProfileNode::endAndRecordCall): * profiler/ProfileNode.h: Copied from profiler/FunctionCallProfile.h. (KJS::ProfileNode::create): (KJS::ProfileNode::children): * profiler/Profiler.cpp: WebCore: 2008-05-14 Kevin McCullough Reviewed by Sam. JavaScript profiler (10928) - Rename FunctionCallProfile to ProfileNode * ForwardingHeaders/profiler/FunctionCallProfile.h: Removed. * ForwardingHeaders/profiler/ProfileNode.h: Copied from ForwardingHeaders/profiler/FunctionCallProfile.h. * GNUmakefile.am: * WebCore.pro: * WebCore.vcproj/WebCore.vcproj: * WebCore.xcodeproj/project.pbxproj: * WebCoreSources.bkl: * page/JavaScriptFunctionCallProfile.cpp: Removed. * page/JavaScriptFunctionCallProfile.h: Removed. * page/JavaScriptProfile.cpp: * page/JavaScriptProfileNode.cpp: Copied from page/JavaScriptFunctionCallProfile.cpp. (WebCore::ProfileNodeCache): (WebCore::getFunctionName): (WebCore::getTotalTime): (WebCore::getSelfTime): (WebCore::getNumberOfCalls): (WebCore::getChildren): (WebCore::finalize): (WebCore::ProfileNodeClass): (WebCore::toJS): * page/JavaScriptProfileNode.h: Copied from page/JavaScriptFunctionCallProfile.h. git-svn-id: http://svn.webkit.org/repository/webkit/trunk@33466 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- JavaScriptCore/ChangeLog | 36 +++++++++ JavaScriptCore/GNUmakefile.am | 2 +- JavaScriptCore/JavaScriptCore.exp | 4 +- JavaScriptCore/JavaScriptCore.pri | 2 +- .../JavaScriptCore/JavaScriptCore.vcproj | 4 +- .../JavaScriptCore.xcodeproj/project.pbxproj | 16 ++-- JavaScriptCore/JavaScriptCoreSources.bkl | 2 +- JavaScriptCore/profiler/Profile.cpp | 12 +-- JavaScriptCore/profiler/Profile.h | 6 +- ...unctionCallProfile.cpp => ProfileNode.cpp} | 24 +++--- .../{FunctionCallProfile.h => ProfileNode.h} | 24 +++--- JavaScriptCore/profiler/Profiler.cpp | 2 +- WebCore/ChangeLog | 29 +++++++ .../profiler/FunctionCallProfile.h | 1 - .../ForwardingHeaders/profiler/ProfileNode.h | 1 + WebCore/GNUmakefile.am | 2 +- WebCore/WebCore.pro | 2 +- WebCore/WebCore.vcproj/WebCore.vcproj | 4 +- WebCore/WebCore.xcodeproj/project.pbxproj | 16 ++-- WebCore/WebCoreSources.bkl | 2 +- WebCore/page/JavaScriptProfile.cpp | 2 +- ...lProfile.cpp => JavaScriptProfileNode.cpp} | 78 +++++++++---------- ...nCallProfile.h => JavaScriptProfileNode.h} | 8 +- 23 files changed, 172 insertions(+), 107 deletions(-) rename JavaScriptCore/profiler/{FunctionCallProfile.cpp => ProfileNode.cpp} (87%) rename JavaScriptCore/profiler/{FunctionCallProfile.h => ProfileNode.h} (77%) delete mode 100644 WebCore/ForwardingHeaders/profiler/FunctionCallProfile.h create mode 100644 WebCore/ForwardingHeaders/profiler/ProfileNode.h rename WebCore/page/{JavaScriptFunctionCallProfile.cpp => JavaScriptProfileNode.cpp} (61%) rename WebCore/page/{JavaScriptFunctionCallProfile.h => JavaScriptProfileNode.h} (89%) diff --git a/JavaScriptCore/ChangeLog b/JavaScriptCore/ChangeLog index 43321d8dddc..400f15629fd 100644 --- a/JavaScriptCore/ChangeLog +++ b/JavaScriptCore/ChangeLog @@ -1,3 +1,39 @@ +2008-05-14 Kevin McCullough + + Reviewed by Sam. + + JavaScript profiler (10928) + - Rename FunctionCallProfile to ProfileNode. + + * GNUmakefile.am: + * JavaScriptCore.exp: + * JavaScriptCore.pri: + * JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj: + * JavaScriptCore.xcodeproj/project.pbxproj: + * JavaScriptCoreSources.bkl: + * profiler/FunctionCallProfile.cpp: Removed. + * profiler/FunctionCallProfile.h: Removed. + * profiler/Profile.cpp: + (KJS::Profile::Profile): + (KJS::Profile::willExecute): + * profiler/Profile.h: + (KJS::Profile::callTree): + * profiler/ProfileNode.cpp: Copied from profiler/FunctionCallProfile.cpp. + (KJS::ProfileNode::ProfileNode): + (KJS::ProfileNode::willExecute): + (KJS::ProfileNode::didExecute): + (KJS::ProfileNode::addChild): + (KJS::ProfileNode::findChild): + (KJS::ProfileNode::stopProfiling): + (KJS::ProfileNode::selfTime): + (KJS::ProfileNode::printDataInspectorStyle): + (KJS::ProfileNode::printDataSampleStyle): + (KJS::ProfileNode::endAndRecordCall): + * profiler/ProfileNode.h: Copied from profiler/FunctionCallProfile.h. + (KJS::ProfileNode::create): + (KJS::ProfileNode::children): + * profiler/Profiler.cpp: + 2008-05-14 Kevin McCullough Reviewed by John. diff --git a/JavaScriptCore/GNUmakefile.am b/JavaScriptCore/GNUmakefile.am index b08cf59f348..0c453f9a54c 100644 --- a/JavaScriptCore/GNUmakefile.am +++ b/JavaScriptCore/GNUmakefile.am @@ -43,7 +43,7 @@ javascriptcore_sources += \ JavaScriptCore/pcre/pcre_tables.cpp \ JavaScriptCore/pcre/pcre_ucp_searchfuncs.cpp \ JavaScriptCore/pcre/pcre_xclass.cpp \ - JavaScriptCore/profiler/FunctionCallProfile.cpp \ + JavaScriptCore/profiler/ProfileNode.cpp \ JavaScriptCore/profiler/Profile.cpp \ JavaScriptCore/profiler/Profiler.cpp \ JavaScriptCore/wtf/Assertions.cpp \ diff --git a/JavaScriptCore/JavaScriptCore.exp b/JavaScriptCore/JavaScriptCore.exp index 711ef44fd24..9f4d5e89101 100644 --- a/JavaScriptCore/JavaScriptCore.exp +++ b/JavaScriptCore/JavaScriptCore.exp @@ -219,7 +219,7 @@ __ZN3WTF15ThreadConditionC1Ev __ZN3WTF15ThreadConditionD1Ev __ZN3WTF16callOnMainThreadEPFvPvES0_ __ZN3WTF16fastZeroedMallocEm -__ZN3WTF19initializeThreadingEv +__ZN3WTF19initializeThreadingEv __ZN3WTF23waitForThreadCompletionEjPPv __ZN3WTF28setMainThreadCallbacksPausedEb __ZN3WTF32atomicallyInitializedStaticMutexE @@ -233,6 +233,7 @@ __ZN3WTF8Collator18setOrderLowerFirstEb __ZN3WTF8CollatorC1EPKc __ZN3WTF8CollatorD1Ev __ZN3WTF8fastFreeEPv +__ZNK3KJS11ProfileNode8selfTimeEv __ZNK3KJS11PropertyMap3getERKNS_10IdentifierE __ZNK3KJS12DateInstance7getTimeERdRi __ZNK3KJS13ArrayInstance7getItemEj @@ -240,7 +241,6 @@ __ZNK3KJS14JSGlobalObject14isDynamicScopeEv __ZNK3KJS14JSGlobalObject14toGlobalObjectEPNS_9ExecStateE __ZNK3KJS16JSVariableObject16isVariableObjectEv __ZNK3KJS16JSVariableObject21getPropertyAttributesEPNS_9ExecStateERKNS_10IdentifierERj -__ZNK3KJS19FunctionCallProfile8selfTimeEv __ZNK3KJS19InternalFunctionImp14implementsCallEv __ZNK3KJS19InternalFunctionImp21implementsHasInstanceEv __ZNK3KJS4List8getSliceEiRS0_ diff --git a/JavaScriptCore/JavaScriptCore.pri b/JavaScriptCore/JavaScriptCore.pri index 7c5e212af40..057fbb00d29 100644 --- a/JavaScriptCore/JavaScriptCore.pri +++ b/JavaScriptCore/JavaScriptCore.pri @@ -98,7 +98,7 @@ SOURCES += \ kjs/string_object.cpp \ kjs/ustring.cpp \ kjs/value.cpp \ - profiler/FunctionCallProfile.cpp \ + profiler/ProfileNode.cpp \ profiler/Profile.cpp \ profiler/Profiler.cpp \ wtf/FastMalloc.cpp diff --git a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj index f5359101896..88e133d8764 100644 --- a/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj +++ b/JavaScriptCore/JavaScriptCore.vcproj/JavaScriptCore/JavaScriptCore.vcproj @@ -882,11 +882,11 @@ Name="Profiler" > - profiler/FunctionCallProfile.cpp + profiler/ProfileNode.cpp profiler/Profile.cpp profiler/Profiler.cpp diff --git a/JavaScriptCore/profiler/Profile.cpp b/JavaScriptCore/profiler/Profile.cpp index 624209b74c9..9d5451e5772 100644 --- a/JavaScriptCore/profiler/Profile.cpp +++ b/JavaScriptCore/profiler/Profile.cpp @@ -26,7 +26,7 @@ #include "config.h" #include "Profile.h" -#include "FunctionCallProfile.h" +#include "ProfileNode.h" #include "JSGlobalObject.h" #include "ExecState.h" #include "function.h" @@ -42,13 +42,13 @@ Profile::Profile(const UString& title) { // 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_callTree = FunctionCallProfile::create("Thread_1"); + m_callTree = ProfileNode::create("Thread_1"); } void Profile::willExecute(const Vector& callStackNames) { - RefPtr callTreeInsertionPoint; - RefPtr foundNameInTree = m_callTree; + RefPtr callTreeInsertionPoint; + RefPtr foundNameInTree = m_callTree; NameIterator callStackLocation = callStackNames.begin(); while (callStackLocation != callStackNames.end() && foundNameInTree) { @@ -59,8 +59,8 @@ void Profile::willExecute(const Vector& callStackNames) if (!foundNameInTree) { // Insert remains of the stack into the call tree. --callStackLocation; - for (RefPtr next; callStackLocation != callStackNames.end(); ++callStackLocation) { - next = FunctionCallProfile::create(*callStackLocation); + for (RefPtr next; callStackLocation != callStackNames.end(); ++callStackLocation) { + next = ProfileNode::create(*callStackLocation); callTreeInsertionPoint->addChild(next); callTreeInsertionPoint = next; } diff --git a/JavaScriptCore/profiler/Profile.h b/JavaScriptCore/profiler/Profile.h index 8456579a32e..f155ddd8747 100644 --- a/JavaScriptCore/profiler/Profile.h +++ b/JavaScriptCore/profiler/Profile.h @@ -26,7 +26,7 @@ #ifndef Profile_h #define Profile_h -#include "FunctionCallProfile.h" +#include "ProfileNode.h" #include #include @@ -45,7 +45,7 @@ namespace KJS { void stopProfiling() { m_callTree->stopProfiling(); }; const UString& title() const { return m_title; }; - FunctionCallProfile* callTree() const { return m_callTree.get(); }; + ProfileNode* callTree() const { return m_callTree.get(); }; void printDataInspectorStyle() const; void printDataSampleStyle() const; @@ -57,7 +57,7 @@ namespace KJS { void insertStackNamesInTree(const Vector& callStackNames); - RefPtr m_callTree; + RefPtr m_callTree; }; } // namespace KJS diff --git a/JavaScriptCore/profiler/FunctionCallProfile.cpp b/JavaScriptCore/profiler/ProfileNode.cpp similarity index 87% rename from JavaScriptCore/profiler/FunctionCallProfile.cpp rename to JavaScriptCore/profiler/ProfileNode.cpp index f1cce1ffd95..8302e5635c6 100644 --- a/JavaScriptCore/profiler/FunctionCallProfile.cpp +++ b/JavaScriptCore/profiler/ProfileNode.cpp @@ -27,7 +27,7 @@ */ #include "config.h" -#include "FunctionCallProfile.h" +#include "ProfileNode.h" #include "Profiler.h" #include "DateMath.h" @@ -36,7 +36,7 @@ namespace KJS { -FunctionCallProfile::FunctionCallProfile(const UString& name) +ProfileNode::ProfileNode(const UString& name) : m_functionName(name) , m_timeSum(0) , m_numberOfCalls(0) @@ -44,12 +44,12 @@ FunctionCallProfile::FunctionCallProfile(const UString& name) m_startTime = getCurrentUTCTime(); } -void FunctionCallProfile::willExecute() +void ProfileNode::willExecute() { m_startTime = getCurrentUTCTime(); } -void FunctionCallProfile::didExecute(Vector stackNames, unsigned int stackIndex) +void ProfileNode::didExecute(Vector stackNames, unsigned int stackIndex) { if (stackIndex && stackIndex == stackNames.size()) { ASSERT(stackNames[stackIndex - 1] == m_functionName); @@ -65,11 +65,11 @@ void FunctionCallProfile::didExecute(Vector stackNames, unsigned int st } } -void FunctionCallProfile::addChild(PassRefPtr prpChild) +void ProfileNode::addChild(PassRefPtr prpChild) { ASSERT(prpChild); - RefPtr child = prpChild; + RefPtr child = prpChild; for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild) { if ((*currentChild)->functionName() == child->functionName()) return; @@ -78,7 +78,7 @@ void FunctionCallProfile::addChild(PassRefPtr prpChild) m_children.append(child.release()); } -FunctionCallProfile* FunctionCallProfile::findChild(const UString& name) +ProfileNode* ProfileNode::findChild(const UString& name) { for (StackIterator currentChild = m_children.begin(); currentChild != m_children.end(); ++currentChild) { if ((*currentChild)->functionName() == name) @@ -88,7 +88,7 @@ FunctionCallProfile* FunctionCallProfile::findChild(const UString& name) return 0; } -void FunctionCallProfile::stopProfiling() +void ProfileNode::stopProfiling() { if (m_startTime) endAndRecordCall(); @@ -98,7 +98,7 @@ void FunctionCallProfile::stopProfiling() (*it)->stopProfiling(); } -double FunctionCallProfile::selfTime() const +double ProfileNode::selfTime() const { double sumChildrenTime = 0.0; @@ -110,7 +110,7 @@ double FunctionCallProfile::selfTime() const return m_timeSum - sumChildrenTime; } -void FunctionCallProfile::printDataInspectorStyle(int indentLevel) const +void ProfileNode::printDataInspectorStyle(int indentLevel) const { // Print function names if (indentLevel) { @@ -129,7 +129,7 @@ void FunctionCallProfile::printDataInspectorStyle(int indentLevel) const } // print the profiled data in a format that matches the tool sample's output. -double FunctionCallProfile::printDataSampleStyle(int indentLevel, FunctionCallHashCount& countedFunctions) const +double ProfileNode::printDataSampleStyle(int indentLevel, FunctionCallHashCount& countedFunctions) const { printf(" "); @@ -166,7 +166,7 @@ double FunctionCallProfile::printDataSampleStyle(int indentLevel, FunctionCallHa return m_timeSum; } -void FunctionCallProfile::endAndRecordCall() +void ProfileNode::endAndRecordCall() { m_timeSum += getCurrentUTCTime() - m_startTime; m_startTime = 0.0; diff --git a/JavaScriptCore/profiler/FunctionCallProfile.h b/JavaScriptCore/profiler/ProfileNode.h similarity index 77% rename from JavaScriptCore/profiler/FunctionCallProfile.h rename to JavaScriptCore/profiler/ProfileNode.h index 90f523890cf..08d961f6527 100644 --- a/JavaScriptCore/profiler/FunctionCallProfile.h +++ b/JavaScriptCore/profiler/ProfileNode.h @@ -26,8 +26,8 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef FunctionCallProfile_h -#define FunctionCallProfile_h +#ifndef ProfileNode_h +#define ProfileNode_h #include #include @@ -37,20 +37,20 @@ namespace KJS { - class FunctionCallProfile; + class ProfileNode; - typedef Deque >::const_iterator StackIterator; + typedef Deque >::const_iterator StackIterator; typedef HashCountedSet FunctionCallHashCount; - class FunctionCallProfile : public RefCounted { + class ProfileNode : public RefCounted { public: - static PassRefPtr create(const UString& name) { return adoptRef(new FunctionCallProfile(name)); } + static PassRefPtr create(const UString& name) { return adoptRef(new ProfileNode(name)); } void willExecute(); void didExecute(Vector stackNames, unsigned int stackIndex); - void addChild(PassRefPtr prpChild); - FunctionCallProfile* findChild(const UString& name); + void addChild(PassRefPtr prpChild); + ProfileNode* findChild(const UString& name); void stopProfiling(); @@ -58,13 +58,13 @@ namespace KJS { double totalTime() const { return m_timeSum; } double selfTime() const; unsigned numberOfCalls() const { return m_numberOfCalls; } - const Deque >& children() { return m_children; } + const Deque >& children() { return m_children; } void printDataInspectorStyle(int indentLevel) const; double printDataSampleStyle(int indentLevel, FunctionCallHashCount&) const; private: - FunctionCallProfile(const UString& name); + ProfileNode(const UString& name); void endAndRecordCall(); @@ -73,9 +73,9 @@ namespace KJS { double m_startTime; unsigned m_numberOfCalls; - Deque > m_children; + Deque > m_children; }; } // namespace KJS -#endif // FunctionCallProfile_h +#endif // ProfileNode_h diff --git a/JavaScriptCore/profiler/Profiler.cpp b/JavaScriptCore/profiler/Profiler.cpp index 456e414cd73..de80ae910c6 100644 --- a/JavaScriptCore/profiler/Profiler.cpp +++ b/JavaScriptCore/profiler/Profiler.cpp @@ -31,7 +31,7 @@ #include "ExecState.h" #include "function.h" -#include "FunctionCallProfile.h" +#include "ProfileNode.h" #include "JSGlobalObject.h" #include "Profile.h" diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index 1415160b278..bb222696b96 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,32 @@ +2008-05-14 Kevin McCullough + + Reviewed by Sam. + + JavaScript profiler (10928) + - Rename FunctionCallProfile to ProfileNode + + * ForwardingHeaders/profiler/FunctionCallProfile.h: Removed. + * ForwardingHeaders/profiler/ProfileNode.h: Copied from ForwardingHeaders/profiler/FunctionCallProfile.h. + * GNUmakefile.am: + * WebCore.pro: + * WebCore.vcproj/WebCore.vcproj: + * WebCore.xcodeproj/project.pbxproj: + * WebCoreSources.bkl: + * page/JavaScriptFunctionCallProfile.cpp: Removed. + * page/JavaScriptFunctionCallProfile.h: Removed. + * page/JavaScriptProfile.cpp: + * page/JavaScriptProfileNode.cpp: Copied from page/JavaScriptFunctionCallProfile.cpp. + (WebCore::ProfileNodeCache): + (WebCore::getFunctionName): + (WebCore::getTotalTime): + (WebCore::getSelfTime): + (WebCore::getNumberOfCalls): + (WebCore::getChildren): + (WebCore::finalize): + (WebCore::ProfileNodeClass): + (WebCore::toJS): + * page/JavaScriptProfileNode.h: Copied from page/JavaScriptFunctionCallProfile.h. + 2008-05-13 Beth Dakin Reviewed by Brady. diff --git a/WebCore/ForwardingHeaders/profiler/FunctionCallProfile.h b/WebCore/ForwardingHeaders/profiler/FunctionCallProfile.h deleted file mode 100644 index 44f86c57b99..00000000000 --- a/WebCore/ForwardingHeaders/profiler/FunctionCallProfile.h +++ /dev/null @@ -1 +0,0 @@ -#include diff --git a/WebCore/ForwardingHeaders/profiler/ProfileNode.h b/WebCore/ForwardingHeaders/profiler/ProfileNode.h new file mode 100644 index 00000000000..488449fc4d1 --- /dev/null +++ b/WebCore/ForwardingHeaders/profiler/ProfileNode.h @@ -0,0 +1 @@ +#include diff --git a/WebCore/GNUmakefile.am b/WebCore/GNUmakefile.am index 16d53f72ea0..4bb9f7a7e7e 100644 --- a/WebCore/GNUmakefile.am +++ b/WebCore/GNUmakefile.am @@ -857,7 +857,7 @@ webcore_sources += \ WebCore/page/JavaScriptCallFrame.cpp \ WebCore/page/JavaScriptDebugServer.cpp \ WebCore/page/JavaScriptProfile.cpp \ - WebCore/page/JavaScriptFunctionCallProfile.cpp \ + WebCore/page/JavaScriptProfileNode.cpp \ WebCore/page/Location.cpp \ WebCore/page/MouseEventWithHitTestResults.cpp \ WebCore/page/Navigator.cpp \ diff --git a/WebCore/WebCore.pro b/WebCore/WebCore.pro index 7ca3044c874..3250118e3e7 100644 --- a/WebCore/WebCore.pro +++ b/WebCore/WebCore.pro @@ -792,7 +792,7 @@ SOURCES += \ page/JavaScriptCallFrame.cpp \ page/JavaScriptDebugServer.cpp \ page/JavaScriptProfile.cpp \ - page/JavaScriptFunctionCallProfile.cpp \ + page/JavaScriptProfileNode.cpp \ page/Location.cpp \ page/MouseEventWithHitTestResults.cpp \ page/Page.cpp \ diff --git a/WebCore/WebCore.vcproj/WebCore.vcproj b/WebCore/WebCore.vcproj/WebCore.vcproj index 0bbb1d3c664..0109fe076e3 100644 --- a/WebCore/WebCore.vcproj/WebCore.vcproj +++ b/WebCore/WebCore.vcproj/WebCore.vcproj @@ -3384,11 +3384,11 @@ > #include #include diff --git a/WebCore/page/JavaScriptFunctionCallProfile.cpp b/WebCore/page/JavaScriptProfileNode.cpp similarity index 61% rename from WebCore/page/JavaScriptFunctionCallProfile.cpp rename to WebCore/page/JavaScriptProfileNode.cpp index 015d763bf80..599053ed62f 100644 --- a/WebCore/page/JavaScriptFunctionCallProfile.cpp +++ b/WebCore/page/JavaScriptProfileNode.cpp @@ -24,10 +24,10 @@ */ #include "config.h" -#include "JavaScriptFunctionCallProfile.h" +#include "JavaScriptProfileNode.h" #include "kjs_binding.h" -#include +#include #include #include #include @@ -41,69 +41,69 @@ namespace WebCore { // Cache -typedef HashMap FunctionCallProfileMap; +typedef HashMap ProfileNodeMap; -static FunctionCallProfileMap& functionCallProfileCache() +static ProfileNodeMap& ProfileNodeCache() { - static FunctionCallProfileMap staticFunctionCallProfiles; - return staticFunctionCallProfiles; + static ProfileNodeMap staticProfileNodes; + return staticProfileNodes; } // Static Values -static JSClassRef functionCallProfileClass(); +static JSClassRef ProfileNodeClass(); static JSValueRef getFunctionName(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { - if (!JSValueIsObjectOfClass(ctx, thisObject, functionCallProfileClass())) + if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) return JSValueMakeUndefined(ctx); - FunctionCallProfile* functionCallProfile = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeString(ctx, JSStringCreateWithCharacters(functionCallProfile->functionName().data(), functionCallProfile->functionName().size())); + ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); + return JSValueMakeString(ctx, JSStringCreateWithCharacters(profileNode->functionName().data(), profileNode->functionName().size())); } static JSValueRef getTotalTime(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { KJS::JSLock lock; - if (!JSValueIsObjectOfClass(ctx, thisObject, functionCallProfileClass())) + if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) return JSValueMakeUndefined(ctx); - FunctionCallProfile* functionCallProfile = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, functionCallProfile->totalTime()); + ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); + return JSValueMakeNumber(ctx, profileNode->totalTime()); } static JSValueRef getSelfTime(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { KJS::JSLock lock; - if (!JSValueIsObjectOfClass(ctx, thisObject, functionCallProfileClass())) + if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) return JSValueMakeUndefined(ctx); - FunctionCallProfile* functionCallProfile = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, functionCallProfile->selfTime()); + ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); + return JSValueMakeNumber(ctx, profileNode->selfTime()); } static JSValueRef getNumberOfCalls(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { KJS::JSLock lock; - if (!JSValueIsObjectOfClass(ctx, thisObject, functionCallProfileClass())) + if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) return JSValueMakeUndefined(ctx); - FunctionCallProfile* functionCallProfile = static_cast(JSObjectGetPrivate(thisObject)); - return JSValueMakeNumber(ctx, functionCallProfile->numberOfCalls()); + ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); + return JSValueMakeNumber(ctx, profileNode->numberOfCalls()); } static JSValueRef getChildren(JSContextRef ctx, JSObjectRef thisObject, JSStringRef propertyName, JSValueRef* exception) { KJS::JSLock lock; - if (!JSValueIsObjectOfClass(ctx, thisObject, functionCallProfileClass())) + if (!JSValueIsObjectOfClass(ctx, thisObject, ProfileNodeClass())) return JSValueMakeUndefined(ctx); - FunctionCallProfile* functionCallProfile = static_cast(JSObjectGetPrivate(thisObject)); - const Deque >& children = functionCallProfile->children(); + ProfileNode* profileNode = static_cast(JSObjectGetPrivate(thisObject)); + const Deque >& children = profileNode->children(); JSObjectRef global = JSContextGetGlobalObject(ctx); @@ -131,7 +131,7 @@ static JSValueRef getChildren(JSContextRef ctx, JSObjectRef thisObject, JSString if (exception && *exception) return JSValueMakeUndefined(ctx); - for (Deque >::const_iterator it = children.begin(); it != children.end(); ++it) { + for (Deque >::const_iterator it = children.begin(); it != children.end(); ++it) { JSValueRef arg0 = toRef(toJS(toJS(ctx), (*it).get() )); JSObjectCallAsFunction(ctx, pushFunction, result, 1, &arg0, exception); if (exception && *exception) @@ -143,12 +143,12 @@ static JSValueRef getChildren(JSContextRef ctx, JSObjectRef thisObject, JSString static void finalize(JSObjectRef object) { - FunctionCallProfile* functionCallProfile = static_cast(JSObjectGetPrivate(object)); - functionCallProfileCache().remove(functionCallProfile); - functionCallProfile->deref(); + ProfileNode* profileNode = static_cast(JSObjectGetPrivate(object)); + ProfileNodeCache().remove(profileNode); + profileNode->deref(); } -JSClassRef functionCallProfileClass() +JSClassRef ProfileNodeClass() { static JSStaticValue staticValues[] = { { "functionName", getFunctionName, 0, kJSPropertyAttributeNone }, @@ -160,28 +160,28 @@ JSClassRef functionCallProfileClass() }; static JSClassDefinition classDefinition = { - 0, kJSClassAttributeNone, "FunctionCallProfile", 0, staticValues, 0, + 0, kJSClassAttributeNone, "ProfileNode", 0, staticValues, 0, 0, finalize, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; - static JSClassRef functionCallProfileClass = JSClassCreate(&classDefinition); - return functionCallProfileClass; + static JSClassRef ProfileNodeClass = JSClassCreate(&classDefinition); + return ProfileNodeClass; } -JSValue* toJS(ExecState* exec, FunctionCallProfile* functionCallProfile) +JSValue* toJS(ExecState* exec, ProfileNode* ProfileNode) { - if (!functionCallProfile) + if (!ProfileNode) return jsNull(); - JSValue* functionCallProfileWrapper = functionCallProfileCache().get(functionCallProfile); - if (functionCallProfileWrapper) - return functionCallProfileWrapper; + JSValue* ProfileNodeWrapper = ProfileNodeCache().get(ProfileNode); + if (ProfileNodeWrapper) + return ProfileNodeWrapper; - functionCallProfile->ref(); + ProfileNode->ref(); - functionCallProfileWrapper = toJS(JSObjectMake(toRef(exec), functionCallProfileClass(), static_cast(functionCallProfile))); - functionCallProfileCache().set(functionCallProfile, functionCallProfileWrapper); - return functionCallProfileWrapper; + ProfileNodeWrapper = toJS(JSObjectMake(toRef(exec), ProfileNodeClass(), static_cast(ProfileNode))); + ProfileNodeCache().set(ProfileNode, ProfileNodeWrapper); + return ProfileNodeWrapper; } diff --git a/WebCore/page/JavaScriptFunctionCallProfile.h b/WebCore/page/JavaScriptProfileNode.h similarity index 89% rename from WebCore/page/JavaScriptFunctionCallProfile.h rename to WebCore/page/JavaScriptProfileNode.h index 057a3d455de..8d4d101ece5 100644 --- a/WebCore/page/JavaScriptFunctionCallProfile.h +++ b/WebCore/page/JavaScriptProfileNode.h @@ -23,20 +23,20 @@ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -#ifndef JavaScriptFunctionCallProfile_h -#define JavaScriptFunctionCallProfile_h +#ifndef JavaScriptProfileNode_h +#define JavaScriptProfileNode_h #include namespace KJS { class ExecState; - class FunctionCallProfile; + class ProfileNode; class JSValue; } namespace WebCore { - KJS::JSValue* toJS(KJS::ExecState*, KJS::FunctionCallProfile*); + KJS::JSValue* toJS(KJS::ExecState*, KJS::ProfileNode*); } // namespace WebCore -- GitLab