Commit 944b8621 authored by kmccullough@apple.com's avatar kmccullough@apple.com

JavaScriptCore:

2008-05-14  Kevin McCullough  <kmccullough@apple.com>

        Reviewed by Sam.

        <rdar://problem/5770054> 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  <kmccullough@apple.com>

        Reviewed by Sam.

        <rdar://problem/5770054> 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
parent 7c100313
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
<rdar://problem/5770054> 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 <kmccullough@apple.com>
Reviewed by John.
......
......@@ -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 \
......
......@@ -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_
......
......@@ -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
......
......@@ -882,11 +882,11 @@
Name="Profiler"
>
<File
RelativePath="..\..\profiler\FunctionCallProfile.cpp"
RelativePath="..\..\profiler\ProfileNode.cpp"
>
</File>
<File
RelativePath="..\..\profiler\FunctionCallProfile.h"
RelativePath="..\..\profiler\ProfileNode.h"
>
</File>
<File
......
......@@ -191,8 +191,8 @@
958D85830DC93230008ABF27 /* StrHash.h in Headers */ = {isa = PBXBuildFile; fileRef = 958D85820DC93230008ABF27 /* StrHash.h */; settings = {ATTRIBUTES = (Private, ); }; };
95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */; };
95AB83480DA432EB00BC83F3 /* Profiler.h in Headers */ = {isa = PBXBuildFile; fileRef = 95AB832F0DA42CAD00BC83F3 /* Profiler.h */; settings = {ATTRIBUTES = (Private, ); }; };
95AB83560DA43C3000BC83F3 /* FunctionCallProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB83540DA43B4400BC83F3 /* FunctionCallProfile.cpp */; };
95AB83570DA43C3000BC83F3 /* FunctionCallProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 95AB83550DA43B4400BC83F3 /* FunctionCallProfile.h */; settings = {ATTRIBUTES = (Private, ); }; };
95AB83560DA43C3000BC83F3 /* ProfileNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB83540DA43B4400BC83F3 /* ProfileNode.cpp */; };
95AB83570DA43C3000BC83F3 /* ProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 95AB83550DA43B4400BC83F3 /* ProfileNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
95C18D490C90E82600E72F73 /* JSRetainPtr.h in Headers */ = {isa = PBXBuildFile; fileRef = 95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */; settings = {ATTRIBUTES = (Private, ); }; };
A8E894320CD0602400367179 /* JSCallbackObjectFunctions.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */; };
A8E894340CD0603F00367179 /* JSGlobalObject.h in Headers */ = {isa = PBXBuildFile; fileRef = A8E894330CD0603F00367179 /* JSGlobalObject.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -502,8 +502,8 @@
958D85820DC93230008ABF27 /* StrHash.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = StrHash.h; sourceTree = "<group>"; };
95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Profiler.cpp; path = profiler/Profiler.cpp; sourceTree = "<group>"; };
95AB832F0DA42CAD00BC83F3 /* Profiler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Profiler.h; path = profiler/Profiler.h; sourceTree = "<group>"; };
95AB83540DA43B4400BC83F3 /* FunctionCallProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = FunctionCallProfile.cpp; path = profiler/FunctionCallProfile.cpp; sourceTree = "<group>"; };
95AB83550DA43B4400BC83F3 /* FunctionCallProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FunctionCallProfile.h; path = profiler/FunctionCallProfile.h; sourceTree = "<group>"; };
95AB83540DA43B4400BC83F3 /* ProfileNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProfileNode.cpp; path = profiler/ProfileNode.cpp; sourceTree = "<group>"; };
95AB83550DA43B4400BC83F3 /* ProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProfileNode.h; path = profiler/ProfileNode.h; sourceTree = "<group>"; };
95C18D3E0C90E7EF00E72F73 /* JSRetainPtr.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSRetainPtr.h; sourceTree = "<group>"; };
A785E3030D9341AB00953772 /* ExecStateInlines.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExecStateInlines.h; sourceTree = "<group>"; };
A8E894310CD0602400367179 /* JSCallbackObjectFunctions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCallbackObjectFunctions.h; sourceTree = "<group>"; };
......@@ -976,8 +976,8 @@
95AB831A0DA42C6900BC83F3 /* profiler */ = {
isa = PBXGroup;
children = (
95AB83540DA43B4400BC83F3 /* FunctionCallProfile.cpp */,
95AB83550DA43B4400BC83F3 /* FunctionCallProfile.h */,
95AB83540DA43B4400BC83F3 /* ProfileNode.cpp */,
95AB83550DA43B4400BC83F3 /* ProfileNode.h */,
95742F630DD11F5A000917FB /* Profile.cpp */,
95742F640DD11F5A000917FB /* Profile.h */,
95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */,
......@@ -1149,7 +1149,7 @@
E1A862AB0D7EBB7D001EC6AA /* Collator.h in Headers */,
E17863400D9BEC0000D74E75 /* InitializeThreading.h in Headers */,
95AB83480DA432EB00BC83F3 /* Profiler.h in Headers */,
95AB83570DA43C3000BC83F3 /* FunctionCallProfile.h in Headers */,
95AB83570DA43C3000BC83F3 /* ProfileNode.h in Headers */,
E1B7C8BE0DA3A3360074B0DC /* ThreadSpecific.h in Headers */,
06D358B20DAADA93003B174E /* MainThread.h in Headers */,
958D85830DC93230008ABF27 /* StrHash.h in Headers */,
......@@ -1409,7 +1409,7 @@
E1A862D60D7F2B5C001EC6AA /* CollatorDefault.cpp in Sources */,
E178636D0D9BEEC300D74E75 /* InitializeThreading.cpp in Sources */,
95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */,
95AB83560DA43C3000BC83F3 /* FunctionCallProfile.cpp in Sources */,
95AB83560DA43C3000BC83F3 /* ProfileNode.cpp in Sources */,
06D358B30DAADAA4003B174E /* MainThread.cpp in Sources */,
06D358B40DAADAAA003B174E /* MainThreadMac.mm in Sources */,
95742F650DD11F5A000917FB /* Profile.cpp in Sources */,
......
......@@ -95,7 +95,7 @@ Source files for JSCore.
pcre/pcre_xclass.cpp
</set>
<set append="1" var="PROFILER_SOURCES">
profiler/FunctionCallProfile.cpp
profiler/ProfileNode.cpp
profiler/Profile.cpp
profiler/Profiler.cpp
</set>
......
......@@ -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<UString>& callStackNames)
{
RefPtr<FunctionCallProfile> callTreeInsertionPoint;
RefPtr<FunctionCallProfile> foundNameInTree = m_callTree;
RefPtr<ProfileNode> callTreeInsertionPoint;
RefPtr<ProfileNode> foundNameInTree = m_callTree;
NameIterator callStackLocation = callStackNames.begin();
while (callStackLocation != callStackNames.end() && foundNameInTree) {
......@@ -59,8 +59,8 @@ void Profile::willExecute(const Vector<UString>& callStackNames)
if (!foundNameInTree) { // Insert remains of the stack into the call tree.
--callStackLocation;
for (RefPtr<FunctionCallProfile> next; callStackLocation != callStackNames.end(); ++callStackLocation) {
next = FunctionCallProfile::create(*callStackLocation);
for (RefPtr<ProfileNode> next; callStackLocation != callStackNames.end(); ++callStackLocation) {
next = ProfileNode::create(*callStackLocation);
callTreeInsertionPoint->addChild(next);
callTreeInsertionPoint = next;
}
......
......@@ -26,7 +26,7 @@
#ifndef Profile_h
#define Profile_h
#include "FunctionCallProfile.h"
#include "ProfileNode.h"
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
......@@ -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<UString>& callStackNames);
RefPtr<FunctionCallProfile> m_callTree;
RefPtr<ProfileNode> m_callTree;
};
} // namespace KJS
......
......@@ -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<UString> stackNames, unsigned int stackIndex)
void ProfileNode::didExecute(Vector<UString> stackNames, unsigned int stackIndex)
{
if (stackIndex && stackIndex == stackNames.size()) {
ASSERT(stackNames[stackIndex - 1] == m_functionName);
......@@ -65,11 +65,11 @@ void FunctionCallProfile::didExecute(Vector<UString> stackNames, unsigned int st
}
}
void FunctionCallProfile::addChild(PassRefPtr<FunctionCallProfile> prpChild)
void ProfileNode::addChild(PassRefPtr<ProfileNode> prpChild)
{
ASSERT(prpChild);
RefPtr<FunctionCallProfile> child = prpChild;
RefPtr<ProfileNode> 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<FunctionCallProfile> 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;
......
......@@ -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 <kjs/ustring.h>
#include <wtf/Deque.h>
......@@ -37,20 +37,20 @@
namespace KJS {
class FunctionCallProfile;
class ProfileNode;
typedef Deque<RefPtr<FunctionCallProfile> >::const_iterator StackIterator;
typedef Deque<RefPtr<ProfileNode> >::const_iterator StackIterator;
typedef HashCountedSet<UString::Rep*> FunctionCallHashCount;
class FunctionCallProfile : public RefCounted<FunctionCallProfile> {
class ProfileNode : public RefCounted<ProfileNode> {
public:
static PassRefPtr<FunctionCallProfile> create(const UString& name) { return adoptRef(new FunctionCallProfile(name)); }
static PassRefPtr<ProfileNode> create(const UString& name) { return adoptRef(new ProfileNode(name)); }
void willExecute();
void didExecute(Vector<UString> stackNames, unsigned int stackIndex);
void addChild(PassRefPtr<FunctionCallProfile> prpChild);
FunctionCallProfile* findChild(const UString& name);
void addChild(PassRefPtr<ProfileNode> 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<RefPtr<FunctionCallProfile> >& children() { return m_children; }
const Deque<RefPtr<ProfileNode> >& 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<RefPtr<FunctionCallProfile> > m_children;
Deque<RefPtr<ProfileNode> > m_children;
};
} // namespace KJS
#endif // FunctionCallProfile_h
#endif // ProfileNode_h
......@@ -31,7 +31,7 @@
#include "ExecState.h"
#include "function.h"
#include "FunctionCallProfile.h"
#include "ProfileNode.h"
#include "JSGlobalObject.h"
#include "Profile.h"
......
2008-05-14 Kevin McCullough <kmccullough@apple.com>
Reviewed by Sam.
<rdar://problem/5770054> 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 <bdakin@apple.com>
Reviewed by Brady.
#include <JavaScriptCore/FunctionCallProfile.h>
#include <JavaScriptCore/ProfileNode.h>
......@@ -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 \
......
......@@ -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 \
......
......@@ -3384,11 +3384,11 @@
>
</File>
<File
RelativePath="..\page\JavaScriptFunctionCallProfile.cpp"
RelativePath="..\page\JavaScriptProfileNode.cpp"
>
</File>
<File
RelativePath="..\page\JavaScriptFunctionCallProfile.h"
RelativePath="..\page\JavaScriptProfileNode.h"
>
</File>
<File
......
......@@ -1812,8 +1812,8 @@
93F9B7A00BA6032600854064 /* JSCDATASection.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93F9B79E0BA6032600854064 /* JSCDATASection.cpp */; };
93F9B7A10BA6032600854064 /* JSCDATASection.h in Headers */ = {isa = PBXBuildFile; fileRef = 93F9B79F0BA6032600854064 /* JSCDATASection.h */; };
93FDAFCA0B11307400E2746F /* EditorInsertAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 93FDAFC90B11307400E2746F /* EditorInsertAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
95969B470DD8D21B00F653EE /* JavaScriptFunctionCallProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95969B430DD8D21B00F653EE /* JavaScriptFunctionCallProfile.cpp */; };
95969B480DD8D21B00F653EE /* JavaScriptFunctionCallProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 95969B440DD8D21B00F653EE /* JavaScriptFunctionCallProfile.h */; };
95969B470DD8D21B00F653EE /* JavaScriptProfileNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95969B430DD8D21B00F653EE /* JavaScriptProfileNode.cpp */; };
95969B480DD8D21B00F653EE /* JavaScriptProfileNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 95969B440DD8D21B00F653EE /* JavaScriptProfileNode.h */; };
95969B490DD8D21B00F653EE /* JavaScriptProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95969B450DD8D21B00F653EE /* JavaScriptProfile.cpp */; };
95969B4A0DD8D21B00F653EE /* JavaScriptProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 95969B460DD8D21B00F653EE /* JavaScriptProfile.h */; };
A718760E0B2A120100A16ECE /* DragActions.h in Headers */ = {isa = PBXBuildFile; fileRef = A718760D0B2A120100A16ECE /* DragActions.h */; settings = {ATTRIBUTES = (Private, ); }; };
......@@ -6237,8 +6237,8 @@
93F9B79E0BA6032600854064 /* JSCDATASection.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCDATASection.cpp; sourceTree = "<group>"; };
93F9B79F0BA6032600854064 /* JSCDATASection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCDATASection.h; sourceTree = "<group>"; };
93FDAFC90B11307400E2746F /* EditorInsertAction.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = EditorInsertAction.h; sourceTree = "<group>"; };
95969B430DD8D21B00F653EE /* JavaScriptFunctionCallProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptFunctionCallProfile.cpp; sourceTree = "<group>"; };
95969B440DD8D21B00F653EE /* JavaScriptFunctionCallProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptFunctionCallProfile.h; sourceTree = "<group>"; };
95969B430DD8D21B00F653EE /* JavaScriptProfileNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptProfileNode.cpp; sourceTree = "<group>"; };
95969B440DD8D21B00F653EE /* JavaScriptProfileNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptProfileNode.h; sourceTree = "<group>"; };
95969B450DD8D21B00F653EE /* JavaScriptProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JavaScriptProfile.cpp; sourceTree = "<group>"; };
95969B460DD8D21B00F653EE /* JavaScriptProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JavaScriptProfile.h; sourceTree = "<group>"; };
A718760D0B2A120100A16ECE /* DragActions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DragActions.h; sourceTree = "<group>"; };
......@@ -9076,8 +9076,8 @@
C02B14BF0D81E02A00D8A970 /* JavaScriptDebugListener.h */,
C02B14C00D81E02A00D8A970 /* JavaScriptDebugServer.cpp */,
C02B14C10D81E02A00D8A970 /* JavaScriptDebugServer.h */,
95969B430DD8D21B00F653EE /* JavaScriptFunctionCallProfile.cpp */,
95969B440DD8D21B00F653EE /* JavaScriptFunctionCallProfile.h */,
95969B430DD8D21B00F653EE /* JavaScriptProfileNode.cpp */,
95969B440DD8D21B00F653EE /* JavaScriptProfileNode.h */,
95969B450DD8D21B00F653EE /* JavaScriptProfile.cpp */,
95969B460DD8D21B00F653EE /* JavaScriptProfile.h */,
BCE1C41A0D982980003B02F2 /* Location.cpp */,
......@@ -15104,7 +15104,7 @@
BC34C33D0DD607DE00090123 /* AccessItem.h in Headers */,
BC34C33F0DD607DE00090123 /* AccessItemRule.h in Headers */,
BC76AC130DD7AD5C00415F34 /* ParserUtilities.h in Headers */,
95969B480DD8D21B00F653EE /* JavaScriptFunctionCallProfile.h in Headers */,
95969B480DD8D21B00F653EE /* JavaScriptProfileNode.h in Headers */,
95969B4A0DD8D21B00F653EE /* JavaScriptProfile.h in Headers */,
1A7FA6190DDA3B3A0028F8A5 /* NetworkStateNotifier.h in Headers */,
);
......@@ -16821,7 +16821,7 @@
BC34C33A0DD607DE00090123 /* AccessControlList.cpp in Sources */,
BC34C33C0DD607DE00090123 /* AccessItem.cpp in Sources */,
BC34C33E0DD607DE00090123 /* AccessItemRule.cpp in Sources */,
95969B470DD8D21B00F653EE /* JavaScriptFunctionCallProfile.cpp in Sources */,
95969B470DD8D21B00F653EE /* JavaScriptProfileNode.cpp in Sources */,
95969B490DD8D21B00F653EE /* JavaScriptProfile.cpp in Sources */,
1A7FA61B0DDA3BBE0028F8A5 /* NetworkStateNotifier.cpp in Sources */,
1A7FA6490DDA3CBA0028F8A5 /* NetworkStateNotifierMac.cpp in Sources */,
......@@ -612,7 +612,7 @@ This file contains the list of files needed to build WebCore.
page/InspectorController.cpp
page/JavaScriptDebugServer.cpp
page/JavaScriptProfile.cpp
page/JavaScriptFunctionCallProfile.cpp
page/JavaScriptProfileNode.cpp
page/Location.cpp
page/MouseEventWithHitTestResults.cpp
page/Navigator.cpp
......
......@@ -26,7 +26,7 @@
#include "config.h"
#include "JavaScriptProfile.h"
#include "JavaScriptFunctionCallProfile.h"
#include "JavaScriptProfileNode.h"
#include <profiler/Profile.h>
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/JSObjectRef.h>
......
......@@ -24,10 +24,10 @@
*/
#include "config.h"
#include "JavaScriptFunctionCallProfile.h"
#include "JavaScriptProfileNode.h"
#include "kjs_binding.h"
#include <profiler/FunctionCallProfile.h>
#include <profiler/ProfileNode.h>
#include <JavaScriptCore/APICast.h>
#include <JavaScriptCore/JSObjectRef.h>
#include <JavaScriptCore/JSContextRef.h>
......@@ -41,69 +41,69 @@ namespace WebCore {
// Cache
typedef HashMap<FunctionCallProfile*, JSValue*> FunctionCallProfileMap;
typedef HashMap<ProfileNode*, JSValue*> 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<FunctionCallProfile*>(JSObjectGetPrivate(thisObject));
return JSValueMakeString(ctx, JSStringCreateWithCharacters(functionCallProfile->functionName().data(), functionCallProfile->functionName().size()));
ProfileNode* profileNode = static_cast<ProfileNode*>(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<FunctionCallProfile*>(JSObjectGetPrivate(thisObject));
return JSValueMakeNumber(ctx, functionCallProfile->totalTime());
ProfileNode* profileNode = static_cast<ProfileNode*>(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<FunctionCallProfile*>(JSObjectGetPrivate(thisObject));
return JSValueMakeNumber(ctx, functionCallProfile->selfTime());
ProfileNode* profileNode = static_cast<ProfileNode*>(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);