summaryrefslogtreecommitdiffstats
path: root/JavaScriptCore/profiler
diff options
context:
space:
mode:
authorFeng Qian <fqian@google.com>2009-06-17 12:12:20 -0700
committerFeng Qian <fqian@google.com>2009-06-17 12:12:20 -0700
commit5f1ab04193ad0130ca8204aadaceae083aca9881 (patch)
tree5a92cd389e2cfe7fb67197ce14b38469462379f8 /JavaScriptCore/profiler
parent194315e5a908cc8ed67d597010544803eef1ac59 (diff)
downloadexternal_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.zip
external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.gz
external_webkit-5f1ab04193ad0130ca8204aadaceae083aca9881.tar.bz2
Get WebKit r44544.
Diffstat (limited to 'JavaScriptCore/profiler')
-rw-r--r--JavaScriptCore/profiler/CallIdentifier.h34
-rw-r--r--JavaScriptCore/profiler/HeavyProfile.cpp115
-rw-r--r--JavaScriptCore/profiler/HeavyProfile.h63
-rw-r--r--JavaScriptCore/profiler/Profile.cpp3
-rw-r--r--JavaScriptCore/profiler/Profile.h11
-rw-r--r--JavaScriptCore/profiler/ProfileGenerator.cpp2
-rw-r--r--JavaScriptCore/profiler/ProfileGenerator.h1
-rw-r--r--JavaScriptCore/profiler/ProfileNode.cpp10
-rw-r--r--JavaScriptCore/profiler/ProfileNode.h10
-rw-r--r--JavaScriptCore/profiler/Profiler.cpp20
-rw-r--r--JavaScriptCore/profiler/Profiler.h8
-rw-r--r--JavaScriptCore/profiler/ProfilerServer.mm11
-rw-r--r--JavaScriptCore/profiler/TreeProfile.cpp51
-rw-r--r--JavaScriptCore/profiler/TreeProfile.h51
14 files changed, 49 insertions, 341 deletions
diff --git a/JavaScriptCore/profiler/CallIdentifier.h b/JavaScriptCore/profiler/CallIdentifier.h
index 6ceef13..c2c25d5 100644
--- a/JavaScriptCore/profiler/CallIdentifier.h
+++ b/JavaScriptCore/profiler/CallIdentifier.h
@@ -51,32 +51,34 @@ namespace JSC {
inline bool operator==(const CallIdentifier& ci) const { return ci.m_lineNumber == m_lineNumber && ci.m_name == m_name && ci.m_url == m_url; }
inline bool operator!=(const CallIdentifier& ci) const { return !(*this == ci); }
+ struct Hash {
+ static unsigned hash(const CallIdentifier& key)
+ {
+ unsigned hashCodes[3] = {
+ key.m_name.rep()->hash(),
+ key.m_url.rep()->hash(),
+ key.m_lineNumber
+ };
+ return UString::Rep::computeHash(reinterpret_cast<char*>(hashCodes), sizeof(hashCodes));
+ }
+
+ static bool equal(const CallIdentifier& a, const CallIdentifier& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+ };
+
+ unsigned hash() const { return Hash::hash(*this); }
+
#ifndef NDEBUG
operator const char*() const { return c_str(); }
const char* c_str() const { return m_name.UTF8String().c_str(); }
#endif
};
- struct CallIdentifierHash {
- static unsigned hash(const CallIdentifier& key)
- {
- unsigned hashCodes[3] = {
- key.m_name.rep()->hash(),
- key.m_url.rep()->hash(),
- key.m_lineNumber
- };
- return UString::Rep::computeHash(reinterpret_cast<char*>(hashCodes), sizeof(hashCodes));
- }
-
- static bool equal(const CallIdentifier& a, const CallIdentifier& b) { return a == b; }
- static const bool safeToCompareToEmptyOrDeleted = true;
- };
-
} // namespace JSC
namespace WTF {
- template<> struct DefaultHash<JSC::CallIdentifier> { typedef JSC::CallIdentifierHash Hash; };
+ template<> struct DefaultHash<JSC::CallIdentifier> { typedef JSC::CallIdentifier::Hash Hash; };
template<> struct HashTraits<JSC::CallIdentifier> : GenericHashTraits<JSC::CallIdentifier> {
static void constructDeletedValue(JSC::CallIdentifier& slot)
diff --git a/JavaScriptCore/profiler/HeavyProfile.cpp b/JavaScriptCore/profiler/HeavyProfile.cpp
index 5ea9d3b..e69de29 100644
--- a/JavaScriptCore/profiler/HeavyProfile.cpp
+++ b/JavaScriptCore/profiler/HeavyProfile.cpp
@@ -1,115 +0,0 @@
-/*
- * 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 "HeavyProfile.h"
-
-#include "TreeProfile.h"
-
-namespace JSC {
-
-HeavyProfile::HeavyProfile(TreeProfile* treeProfile)
- : Profile(treeProfile->title(), treeProfile->uid())
-{
- m_treeProfile = treeProfile;
- head()->setTotalTime(m_treeProfile->head()->actualTotalTime());
- head()->setSelfTime(m_treeProfile->head()->actualSelfTime());
- generateHeavyStructure();
-}
-
-void HeavyProfile::generateHeavyStructure()
-{
- ProfileNode* treeHead = m_treeProfile->head();
- ProfileNode* currentNode = treeHead->firstChild();
- for (ProfileNode* nextNode = currentNode; nextNode; nextNode = nextNode->firstChild())
- currentNode = nextNode;
-
- // For each node
- HashMap<CallIdentifier, ProfileNode*> foundChildren;
- while (currentNode && currentNode != treeHead) {
- ProfileNode* child = foundChildren.get(currentNode->callIdentifier());
- if (child) // currentNode is in the set already
- mergeProfiles(child, currentNode);
- else { // currentNode is not in the set
- child = addNode(currentNode);
- foundChildren.set(currentNode->callIdentifier(), child);
- }
-
- currentNode = currentNode->traverseNextNodePostOrder();
- }
-}
-
-ProfileNode* HeavyProfile::addNode(ProfileNode* currentNode)
-{
- RefPtr<ProfileNode> node = ProfileNode::create(head(), currentNode);
- head()->addChild(node);
-
- addAncestorsAsChildren(currentNode->parent(), node.get());
- return node.get();
-}
-
-void HeavyProfile::mergeProfiles(ProfileNode* heavyProfileHead, ProfileNode* treeProfileHead)
-{
- ASSERT_ARG(heavyProfileHead, heavyProfileHead);
- ASSERT_ARG(treeProfileHead, treeProfileHead);
-
- ProfileNode* currentTreeNode = treeProfileHead;
- ProfileNode* currentHeavyNode = heavyProfileHead;
- ProfileNode* previousHeavyNode = 0;
-
- while (currentHeavyNode) {
- previousHeavyNode = currentHeavyNode;
-
- currentHeavyNode->setTotalTime(currentHeavyNode->actualTotalTime() + currentTreeNode->actualTotalTime());
- currentHeavyNode->setSelfTime(currentHeavyNode->actualSelfTime() + currentTreeNode->actualSelfTime());
- currentHeavyNode->setNumberOfCalls(currentHeavyNode->numberOfCalls() + currentTreeNode->numberOfCalls());
-
- currentTreeNode = currentTreeNode->parent();
- currentHeavyNode = currentHeavyNode->findChild(currentTreeNode);
- }
-
- // If currentTreeNode is null then we already have the whole tree we wanted to copy.
- // If not we need to copy the subset of the tree that remains different between the two.
- if (currentTreeNode)
- addAncestorsAsChildren(currentTreeNode, previousHeavyNode);
-}
-
-void HeavyProfile::addAncestorsAsChildren(ProfileNode* getFrom, ProfileNode* addTo)
-{
- ASSERT_ARG(getFrom, getFrom);
- ASSERT_ARG(addTo, addTo);
-
- if (!getFrom->head())
- return;
-
- RefPtr<ProfileNode> currentNode = addTo;
- for (ProfileNode* treeAncestor = getFrom; treeAncestor && treeAncestor != getFrom->head(); treeAncestor = treeAncestor->parent()) {
- RefPtr<ProfileNode> newChild = ProfileNode::create(currentNode->head(), treeAncestor);
- currentNode->addChild(newChild);
- currentNode = newChild.release();
- }
-}
-
-} // namespace JSC
diff --git a/JavaScriptCore/profiler/HeavyProfile.h b/JavaScriptCore/profiler/HeavyProfile.h
index 903d091..e69de29 100644
--- a/JavaScriptCore/profiler/HeavyProfile.h
+++ b/JavaScriptCore/profiler/HeavyProfile.h
@@ -1,63 +0,0 @@
-/*
- * 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 HeavyProfile_h
-#define HeavyProfile_h
-
-#include "Profile.h"
-#include "ProfileNode.h"
-#include "TreeProfile.h"
-
-namespace JSC {
-
- class UString;
-
- class HeavyProfile : public Profile {
- public:
- static PassRefPtr<HeavyProfile> create(TreeProfile* treeProfile)
- {
- return adoptRef(new HeavyProfile(treeProfile));
- }
-
- virtual Profile* heavyProfile() { return this; }
- virtual Profile* treeProfile()
- {
- return m_treeProfile;
- }
-
-
- private:
- HeavyProfile(TreeProfile*);
- void generateHeavyStructure();
- ProfileNode* addNode(ProfileNode*);
- void mergeProfiles(ProfileNode* heavyProfileHead, ProfileNode* treeProfileHead);
- void addAncestorsAsChildren(ProfileNode* getFrom, ProfileNode* addTo);
-
- TreeProfile* m_treeProfile;
- };
-
-} // namespace JSC
-
-#endif // HeavyProfile_h
diff --git a/JavaScriptCore/profiler/Profile.cpp b/JavaScriptCore/profiler/Profile.cpp
index fd32e1c..0a290ce 100644
--- a/JavaScriptCore/profiler/Profile.cpp
+++ b/JavaScriptCore/profiler/Profile.cpp
@@ -27,7 +27,6 @@
#include "Profile.h"
#include "ProfileNode.h"
-#include "TreeProfile.h"
#include <stdio.h>
#if PLATFORM(ANDROID)
@@ -41,7 +40,7 @@ namespace JSC {
PassRefPtr<Profile> Profile::create(const UString& title, unsigned uid)
{
- return TreeProfile::create(title, uid);
+ return adoptRef(new Profile(title, uid));
}
Profile::Profile(const UString& title, unsigned uid)
diff --git a/JavaScriptCore/profiler/Profile.h b/JavaScriptCore/profiler/Profile.h
index dd96f77..6bf29f7 100644
--- a/JavaScriptCore/profiler/Profile.h
+++ b/JavaScriptCore/profiler/Profile.h
@@ -45,22 +45,11 @@ namespace JSC {
unsigned int uid() const { return m_uid; }
void forEach(void (ProfileNode::*)());
- void sortTotalTimeDescending() { forEach(&ProfileNode::sortTotalTimeDescending); }
- void sortTotalTimeAscending() { forEach(&ProfileNode::sortTotalTimeAscending); }
- void sortSelfTimeDescending() { forEach(&ProfileNode::sortSelfTimeDescending); }
- void sortSelfTimeAscending() { forEach(&ProfileNode::sortSelfTimeAscending); }
- void sortCallsDescending() { forEach(&ProfileNode::sortCallsDescending); }
- void sortCallsAscending() { forEach(&ProfileNode::sortCallsAscending); }
- void sortFunctionNameDescending() { forEach(&ProfileNode::sortFunctionNameDescending); }
- void sortFunctionNameAscending() { forEach(&ProfileNode::sortFunctionNameAscending); }
void focus(const ProfileNode*);
void exclude(const ProfileNode*);
void restoreAll();
- virtual Profile* heavyProfile() = 0;
- virtual Profile* treeProfile() = 0;
-
#ifndef NDEBUG
void debugPrintData() const;
void debugPrintDataSampleStyle() const;
diff --git a/JavaScriptCore/profiler/ProfileGenerator.cpp b/JavaScriptCore/profiler/ProfileGenerator.cpp
index b1d5d48..1a061cb 100644
--- a/JavaScriptCore/profiler/ProfileGenerator.cpp
+++ b/JavaScriptCore/profiler/ProfileGenerator.cpp
@@ -59,7 +59,7 @@ void ProfileGenerator::addParentForConsoleStart(ExecState* exec)
int lineNumber;
intptr_t sourceID;
UString sourceURL;
- JSValuePtr function;
+ JSValue function;
exec->interpreter()->retrieveLastCaller(exec, lineNumber, sourceID, sourceURL, function);
m_currentNode = ProfileNode::create(Profiler::createCallIdentifier(&exec->globalData(), function ? function.toThisObject(exec) : 0, sourceURL, lineNumber), m_head.get(), m_head.get());
diff --git a/JavaScriptCore/profiler/ProfileGenerator.h b/JavaScriptCore/profiler/ProfileGenerator.h
index 54d4565..cccb502 100644
--- a/JavaScriptCore/profiler/ProfileGenerator.h
+++ b/JavaScriptCore/profiler/ProfileGenerator.h
@@ -26,6 +26,7 @@
#ifndef ProfileGenerator_h
#define ProfileGenerator_h
+#include "Profile.h"
#include <wtf/PassRefPtr.h>
#include <wtf/RefCounted.h>
#include <wtf/RefPtr.h>
diff --git a/JavaScriptCore/profiler/ProfileNode.cpp b/JavaScriptCore/profiler/ProfileNode.cpp
index 3458902..19050aa 100644
--- a/JavaScriptCore/profiler/ProfileNode.cpp
+++ b/JavaScriptCore/profiler/ProfileNode.cpp
@@ -29,9 +29,9 @@
#include "config.h"
#include "ProfileNode.h"
-#include "DateMath.h"
#include "Profiler.h"
#include <stdio.h>
+#include <wtf/DateMath.h>
#if PLATFORM(WIN_OS)
#include <windows.h>
@@ -49,7 +49,7 @@ static double getCount()
QueryPerformanceCounter(&counter);
return static_cast<double>(counter.QuadPart) / frequency.QuadPart;
#else
- return getCurrentUTCTimeWithMicroseconds();
+ return WTF::getCurrentUTCTimeWithMicroseconds();
#endif
}
@@ -204,12 +204,6 @@ ProfileNode* ProfileNode::traverseNextNodePreOrder(bool processChildren) const
return next;
}
-void ProfileNode::sort(bool comparator(const RefPtr<ProfileNode>& , const RefPtr<ProfileNode>& ))
-{
- std::sort(childrenBegin(), childrenEnd(), comparator);
- resetChildrensSiblings();
-}
-
void ProfileNode::setTreeVisible(ProfileNode* node, bool visible)
{
ProfileNode* nodeParent = node->parent();
diff --git a/JavaScriptCore/profiler/ProfileNode.h b/JavaScriptCore/profiler/ProfileNode.h
index b416011..2b5a936 100644
--- a/JavaScriptCore/profiler/ProfileNode.h
+++ b/JavaScriptCore/profiler/ProfileNode.h
@@ -112,16 +112,6 @@ namespace JSC {
ProfileNode* traverseNextNodePostOrder() const;
ProfileNode* traverseNextNodePreOrder(bool processChildren = true) const;
- void sort(bool (*)(const RefPtr<ProfileNode>&, const RefPtr<ProfileNode>&));
- void sortTotalTimeDescending() { sort(totalTimeDescendingComparator); }
- void sortTotalTimeAscending() { sort(totalTimeAscendingComparator); }
- void sortSelfTimeDescending() { sort(selfTimeDescendingComparator); }
- void sortSelfTimeAscending() { sort(selfTimeAscendingComparator); }
- void sortCallsDescending() { sort(callsDescendingComparator); }
- void sortCallsAscending() { sort(callsAscendingComparator); }
- void sortFunctionNameDescending() { sort(functionNameDescendingComparator); }
- void sortFunctionNameAscending() { sort(functionNameAscendingComparator); }
-
// Views
void calculateVisibleTotalTime();
bool focus(const CallIdentifier&);
diff --git a/JavaScriptCore/profiler/Profiler.cpp b/JavaScriptCore/profiler/Profiler.cpp
index ace0a33..e103fd1 100644
--- a/JavaScriptCore/profiler/Profiler.cpp
+++ b/JavaScriptCore/profiler/Profiler.cpp
@@ -33,6 +33,7 @@
#include "CallFrame.h"
#include "JSFunction.h"
#include "JSGlobalObject.h"
+#include "Nodes.h"
#include "Profile.h"
#include "ProfileGenerator.h"
#include "ProfileNode.h"
@@ -103,7 +104,7 @@ static inline void dispatchFunctionToProfiles(const Vector<RefPtr<ProfileGenerat
}
}
-void Profiler::willExecute(ExecState* exec, JSValuePtr function)
+void Profiler::willExecute(ExecState* exec, JSValue function)
{
ASSERT(!m_currentProfiles.isEmpty());
@@ -114,12 +115,12 @@ void Profiler::willExecute(ExecState* exec, const UString& sourceURL, int starti
{
ASSERT(!m_currentProfiles.isEmpty());
- CallIdentifier callIdentifier = createCallIdentifier(&exec->globalData(), noValue(), sourceURL, startingLineNumber);
+ CallIdentifier callIdentifier = createCallIdentifier(&exec->globalData(), JSValue(), sourceURL, startingLineNumber);
dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::willExecute, callIdentifier, exec->lexicalGlobalObject()->profileGroup());
}
-void Profiler::didExecute(ExecState* exec, JSValuePtr function)
+void Profiler::didExecute(ExecState* exec, JSValue function)
{
ASSERT(!m_currentProfiles.isEmpty());
@@ -130,17 +131,20 @@ void Profiler::didExecute(ExecState* exec, const UString& sourceURL, int startin
{
ASSERT(!m_currentProfiles.isEmpty());
- dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(&exec->globalData(), noValue(), sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup());
+ dispatchFunctionToProfiles(m_currentProfiles, &ProfileGenerator::didExecute, createCallIdentifier(&exec->globalData(), JSValue(), sourceURL, startingLineNumber), exec->lexicalGlobalObject()->profileGroup());
}
-CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValuePtr function, const UString& defaultSourceURL, int defaultLineNumber)
+CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValue function, const UString& defaultSourceURL, int defaultLineNumber)
{
if (!function)
return CallIdentifier(GlobalCodeExecution, defaultSourceURL, defaultLineNumber);
if (!function.isObject())
return CallIdentifier("(unknown)", defaultSourceURL, defaultLineNumber);
- if (asObject(function)->inherits(&JSFunction::info))
- return createCallIdentifierFromFunctionImp(globalData, asFunction(function));
+ if (asObject(function)->inherits(&JSFunction::info)) {
+ JSFunction* func = asFunction(function);
+ if (!func->isHostFunction())
+ return createCallIdentifierFromFunctionImp(globalData, func);
+ }
if (asObject(function)->inherits(&InternalFunction::info))
return CallIdentifier(static_cast<InternalFunction*>(asObject(function))->name(globalData), defaultSourceURL, defaultLineNumber);
return CallIdentifier("(" + asObject(function)->className() + " object)", defaultSourceURL, defaultLineNumber);
@@ -148,7 +152,7 @@ CallIdentifier Profiler::createCallIdentifier(JSGlobalData* globalData, JSValueP
CallIdentifier createCallIdentifierFromFunctionImp(JSGlobalData* globalData, JSFunction* function)
{
- const UString& name = function->name(globalData);
+ const UString& name = function->calculatedDisplayName(globalData);
return CallIdentifier(name.isEmpty() ? AnonymousFunction : name, function->body()->sourceURL(), function->body()->lineNo());
}
diff --git a/JavaScriptCore/profiler/Profiler.h b/JavaScriptCore/profiler/Profiler.h
index d00bccf..b37f613 100644
--- a/JavaScriptCore/profiler/Profiler.h
+++ b/JavaScriptCore/profiler/Profiler.h
@@ -40,7 +40,7 @@ namespace JSC {
class ExecState;
class JSGlobalData;
class JSObject;
- class JSValuePtr;
+ class JSValue;
class ProfileGenerator;
class UString;
@@ -52,14 +52,14 @@ namespace JSC {
}
static Profiler* profiler();
- static CallIdentifier createCallIdentifier(JSGlobalData*, JSValuePtr, const UString& sourceURL, int lineNumber);
+ static CallIdentifier createCallIdentifier(JSGlobalData*, JSValue, const UString& sourceURL, int lineNumber);
void startProfiling(ExecState*, const UString& title);
PassRefPtr<Profile> stopProfiling(ExecState*, const UString& title);
- void willExecute(ExecState*, JSValuePtr function);
+ void willExecute(ExecState*, JSValue function);
void willExecute(ExecState*, const UString& sourceURL, int startingLineNumber);
- void didExecute(ExecState*, JSValuePtr function);
+ void didExecute(ExecState*, JSValue function);
void didExecute(ExecState*, const UString& sourceURL, int startingLineNumber);
const Vector<RefPtr<ProfileGenerator> >& currentProfiles() { return m_currentProfiles; };
diff --git a/JavaScriptCore/profiler/ProfilerServer.mm b/JavaScriptCore/profiler/ProfilerServer.mm
index ef16f4c..a3944de 100644
--- a/JavaScriptCore/profiler/ProfilerServer.mm
+++ b/JavaScriptCore/profiler/ProfilerServer.mm
@@ -28,9 +28,12 @@
#import "JSProfilerPrivate.h"
#import "JSRetainPtr.h"
-
#import <Foundation/Foundation.h>
+#if PLATFORM(IPHONE_SIMULATOR)
+#import <Foundation/NSDistributedNotificationCenter.h>
+#endif
+
@interface ProfilerServer : NSObject {
@private
NSString *_serverName;
@@ -62,16 +65,22 @@
if ([defaults boolForKey:@"EnableJSProfiling"])
[self startProfiling];
+#if !PLATFORM(IPHONE) || PLATFORM(IPHONE_SIMULATOR)
+ // FIXME: <rdar://problem/6546135>
// The catch-all notifications
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(startProfiling) name:@"ProfilerServerStartNotification" object:nil];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(stopProfiling) name:@"ProfilerServerStopNotification" object:nil];
+#endif
// The specific notifications
NSProcessInfo *processInfo = [NSProcessInfo processInfo];
_serverName = [[NSString alloc] initWithFormat:@"ProfilerServer-%d", [processInfo processIdentifier]];
+#if !PLATFORM(IPHONE) || PLATFORM(IPHONE_SIMULATOR)
+ // FIXME: <rdar://problem/6546135>
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(startProfiling) name:[_serverName stringByAppendingString:@"-Start"] object:nil];
[[NSDistributedNotificationCenter defaultCenter] addObserver:self selector:@selector(stopProfiling) name:[_serverName stringByAppendingString:@"-Stop"] object:nil];
+#endif
[pool drain];
diff --git a/JavaScriptCore/profiler/TreeProfile.cpp b/JavaScriptCore/profiler/TreeProfile.cpp
index 0c7fedb..e69de29 100644
--- a/JavaScriptCore/profiler/TreeProfile.cpp
+++ b/JavaScriptCore/profiler/TreeProfile.cpp
@@ -1,51 +0,0 @@
-/*
- * 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"
-
-#include "HeavyProfile.h"
-
-namespace JSC {
-
-PassRefPtr<TreeProfile> TreeProfile::create(const UString& title, unsigned uid)
-{
- return adoptRef(new TreeProfile(title, uid));
-}
-
-TreeProfile::TreeProfile(const UString& title, unsigned uid)
- : Profile(title, uid)
-{
-}
-
-Profile* TreeProfile::heavyProfile()
-{
- if (!m_heavyProfile)
- m_heavyProfile = HeavyProfile::create(this);
-
- return m_heavyProfile.get();
-}
-
-} // namespace JSC
diff --git a/JavaScriptCore/profiler/TreeProfile.h b/JavaScriptCore/profiler/TreeProfile.h
index ebef4d8..e69de29 100644
--- a/JavaScriptCore/profiler/TreeProfile.h
+++ b/JavaScriptCore/profiler/TreeProfile.h
@@ -1,51 +0,0 @@
-/*
- * 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 JSC {
-
- class ExecState;
- class HeavyProfile;
- class UString;
-
- class TreeProfile : public Profile {
- public:
- static PassRefPtr<TreeProfile> create(const UString& title, unsigned uid);
-
- virtual Profile* heavyProfile();
- virtual Profile* treeProfile() { return this; }
-
- private:
- TreeProfile(const UString& title, unsigned uid);
- RefPtr<HeavyProfile> m_heavyProfile;
- };
-
-} // namespace JSC
-
-#endif // TreeProfiler_h