Commit 51cc7679 authored by kmccullough@apple.com's avatar kmccullough@apple.com

2008-07-02 Kevin McCullough <kmccullough@apple.com>

        Reviewed by Darin.

        <rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
        - Subclass TreeProfile as I prepare for a HeavyProfile to be comming
        later.

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * profiler/Profile.cpp: By default we create a TreeProfile.
        (KJS::Profile::create):
        * profiler/Profile.h: Changes to the Profile class to make it amenable
        to be inherited from.
        (KJS::Profile::~Profile):
        * profiler/TreeProfile.cpp: Added.
        (KJS::TreeProfile::create):
        (KJS::TreeProfile::TreeProfile):
        (KJS::TreeProfile::heavyProfile):
        * profiler/TreeProfile.h: Added.
        (KJS::TreeProfile::treeProfile):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@34960 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 48341929
2008-07-02 Kevin McCullough <kmccullough@apple.com>
Reviewed by Darin.
<rdar://problem/5951532> JSProfiler: Implement Bottom-Up view (19228)
- Subclass TreeProfile as I prepare for a HeavyProfile to be comming
later.
* JavaScriptCore.xcodeproj/project.pbxproj:
* profiler/Profile.cpp: By default we create a TreeProfile.
(KJS::Profile::create):
* profiler/Profile.h: Changes to the Profile class to make it amenable
to be inherited from.
(KJS::Profile::~Profile):
* profiler/TreeProfile.cpp: Added.
(KJS::TreeProfile::create):
(KJS::TreeProfile::TreeProfile):
(KJS::TreeProfile::heavyProfile):
* profiler/TreeProfile.h: Added.
(KJS::TreeProfile::treeProfile):
2008-07-02 Kevin McCullough <kmccullough@apple.com>
Reviewed by Dan.
......@@ -86,6 +86,8 @@
95742F650DD11F5A000917FB /* Profile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95742F630DD11F5A000917FB /* Profile.cpp */; };
95AB83420DA4322500BC83F3 /* Profiler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB832E0DA42CAD00BC83F3 /* Profiler.cpp */; };
95AB83560DA43C3000BC83F3 /* ProfileNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95AB83540DA43B4400BC83F3 /* ProfileNode.cpp */; };
95CD41B30E1BF6560085358E /* TreeProfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 95CD41B10E1BF6560085358E /* TreeProfile.cpp */; };
95CD41B40E1BF6560085358E /* TreeProfile.h in Headers */ = {isa = PBXBuildFile; fileRef = 95CD41B20E1BF6560085358E /* TreeProfile.h */; };
95E3BC050E1AE68200B2D1C1 /* CallIdentifier.h in Headers */ = {isa = PBXBuildFile; fileRef = 95E3BC040E1AE68200B2D1C1 /* CallIdentifier.h */; settings = {ATTRIBUTES = (Private, ); }; };
A72700900DAC6BBC00E548D7 /* JSNotAnObject.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72700780DAC605600E548D7 /* JSNotAnObject.cpp */; };
A72701B60DADE94900E548D7 /* ExceptionHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = A72701B40DADE94900E548D7 /* ExceptionHelpers.cpp */; };
......@@ -577,6 +579,8 @@
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>"; };
95CD41B10E1BF6560085358E /* TreeProfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = TreeProfile.cpp; path = profiler/TreeProfile.cpp; sourceTree = "<group>"; };
95CD41B20E1BF6560085358E /* TreeProfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = TreeProfile.h; path = profiler/TreeProfile.h; sourceTree = "<group>"; };
95E3BC040E1AE68200B2D1C1 /* CallIdentifier.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CallIdentifier.h; path = profiler/CallIdentifier.h; sourceTree = "<group>"; };
A72700770DAC605600E548D7 /* JSNotAnObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSNotAnObject.h; sourceTree = "<group>"; };
A72700780DAC605600E548D7 /* JSNotAnObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSNotAnObject.cpp; sourceTree = "<group>"; };
......@@ -1207,6 +1211,8 @@
95AB831A0DA42C6900BC83F3 /* profiler */ = {
isa = PBXGroup;
children = (
95CD41B10E1BF6560085358E /* TreeProfile.cpp */,
95CD41B20E1BF6560085358E /* TreeProfile.h */,
95E3BC040E1AE68200B2D1C1 /* CallIdentifier.h */,
95AB83540DA43B4400BC83F3 /* ProfileNode.cpp */,
95AB83550DA43B4400BC83F3 /* ProfileNode.h */,
......@@ -1425,6 +1431,7 @@
BC11667B0E199C05008066DD /* InternalFunction.h in Headers */,
BC1167DA0E19BCC9008066DD /* JSCell.h in Headers */,
BC7F8FB90E19D1C3008632C0 /* JSNumberCell.h in Headers */,
95CD41B40E1BF6560085358E /* TreeProfile.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......@@ -1708,6 +1715,7 @@
A72701B60DADE94900E548D7 /* ExceptionHelpers.cpp in Sources */,
149559EE0DDCDDF700648087 /* DebuggerCallFrame.cpp in Sources */,
E18E3A590DF9278C00D90B34 /* JSGlobalData.cpp in Sources */,
95CD41B30E1BF6560085358E /* TreeProfile.cpp in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
......
......@@ -26,10 +26,11 @@
#include "config.h"
#include "Profile.h"
#include "ProfileNode.h"
#include "JSGlobalObject.h"
#include "ExecState.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
#include "ProfileNode.h"
#include "TreeProfile.h"
#include <stdio.h>
......@@ -39,7 +40,7 @@ static const char* NonJSExecution = "(idle)";
PassRefPtr<Profile> Profile::create(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient* client)
{
return adoptRef(new Profile(title, originatingGlobalExec, pageGroupIdentifier, client));
return TreeProfile::create(title, originatingGlobalExec, pageGroupIdentifier, client);
}
Profile::Profile(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient* client)
......@@ -56,6 +57,10 @@ Profile::Profile(const UString& title, ExecState* originatingGlobalExec, unsigne
m_currentNode = m_head;
}
Profile::~Profile()
{
}
void Profile::stopProfiling()
{
forEach(&ProfileNode::stopProfiling);
......
......@@ -38,6 +38,7 @@ namespace KJS {
class Profile : public RefCounted<Profile> {
public:
static PassRefPtr<Profile> create(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient*);
virtual ~Profile();
void willExecute(const CallIdentifier&);
void didExecute(const CallIdentifier&);
......@@ -69,15 +70,19 @@ namespace KJS {
bool stoppedProfiling() { return m_stoppedProfiling; }
virtual Profile* heavyProfile() = 0;
virtual Profile* treeProfile() = 0;
#ifndef NDEBUG
void debugPrintData() const;
void debugPrintDataSampleStyle() const;
#endif
typedef void (Profile::*ProfileFunction)(const CallIdentifier& callIdentifier);
private:
protected:
Profile(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient*);
private:
void removeProfileStart();
void removeProfileEnd();
......
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#include "config.h"
#include "TreeProfile.h"
namespace KJS {
PassRefPtr<TreeProfile> TreeProfile::create(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient* client)
{
return adoptRef(new TreeProfile(title, originatingGlobalExec, pageGroupIdentifier, client));
}
TreeProfile::TreeProfile(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient* client)
: Profile(title, originatingGlobalExec, pageGroupIdentifier, client)
{
}
Profile* TreeProfile::heavyProfile()
{
return this; // FIXME: When you've implemented heavy profiles replace this.
}
} // namespace KJS
/*
* Copyright (C) 2008 Apple Inc. All Rights Reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
* EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
* EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
* OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef TreeProfile_h
#define TreeProfile_h
#include "Profile.h"
namespace KJS {
class ExecState;
class ProfilerClient;
class UString;
class TreeProfile : public Profile {
public:
static PassRefPtr<TreeProfile> create(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient*);
virtual Profile* heavyProfile();
virtual Profile* treeProfile() { return this; }
private:
TreeProfile(const UString& title, ExecState* originatingGlobalExec, unsigned pageGroupIdentifier, ProfilerClient*);
};
} // namespace KJS
#endif // TreeProfiler_h
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment