summaryrefslogtreecommitdiffstats
path: root/Source/JavaScriptCore/profiler/Profiler.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2011-05-25 19:08:45 +0100
committerSteve Block <steveblock@google.com>2011-06-08 13:51:31 +0100
commit2bde8e466a4451c7319e3a072d118917957d6554 (patch)
tree28f4a1b869a513e565c7760d0e6a06e7cf1fe95a /Source/JavaScriptCore/profiler/Profiler.cpp
parent6939c99b71d9372d14a0c74a772108052e8c48c8 (diff)
downloadexternal_webkit-2bde8e466a4451c7319e3a072d118917957d6554.zip
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.gz
external_webkit-2bde8e466a4451c7319e3a072d118917957d6554.tar.bz2
Merge WebKit at r82507: Initial merge by git
Change-Id: I60ce9d780725b58b45e54165733a8ffee23b683e
Diffstat (limited to 'Source/JavaScriptCore/profiler/Profiler.cpp')
-rw-r--r--Source/JavaScriptCore/profiler/Profiler.cpp25
1 files changed, 19 insertions, 6 deletions
diff --git a/Source/JavaScriptCore/profiler/Profiler.cpp b/Source/JavaScriptCore/profiler/Profiler.cpp
index 301dc0c..bcaaaac 100644
--- a/Source/JavaScriptCore/profiler/Profiler.cpp
+++ b/Source/JavaScriptCore/profiler/Profiler.cpp
@@ -66,25 +66,25 @@ void Profiler::startProfiling(ExecState* exec, const UString& title)
// Check if we currently have a Profile for this global ExecState and title.
// If so return early and don't create a new Profile.
- ExecState* globalExec = exec ? exec->lexicalGlobalObject()->globalExec() : 0;
+ JSGlobalObject* origin = exec ? exec->lexicalGlobalObject() : 0;
for (size_t i = 0; i < m_currentProfiles.size(); ++i) {
ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
- if (profileGenerator->originatingGlobalExec() == globalExec && profileGenerator->title() == title)
+ if (profileGenerator->origin() == origin && profileGenerator->title() == title)
return;
}
s_sharedEnabledProfilerReference = this;
- RefPtr<ProfileGenerator> profileGenerator = ProfileGenerator::create(title, exec, ++ProfilesUID);
+ RefPtr<ProfileGenerator> profileGenerator = ProfileGenerator::create(exec, title, ++ProfilesUID);
m_currentProfiles.append(profileGenerator);
}
PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const UString& title)
{
- ExecState* globalExec = exec ? exec->lexicalGlobalObject()->globalExec() : 0;
+ JSGlobalObject* origin = exec ? exec->lexicalGlobalObject() : 0;
for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
- if (profileGenerator->originatingGlobalExec() == globalExec && (title.isNull() || profileGenerator->title() == title)) {
+ if (profileGenerator->origin() == origin && (title.isNull() || profileGenerator->title() == title)) {
profileGenerator->stopProfiling();
RefPtr<Profile> returnProfile = profileGenerator->profile();
@@ -99,10 +99,23 @@ PassRefPtr<Profile> Profiler::stopProfiling(ExecState* exec, const UString& titl
return 0;
}
+void Profiler::stopProfiling(JSGlobalObject* origin)
+{
+ for (ptrdiff_t i = m_currentProfiles.size() - 1; i >= 0; --i) {
+ ProfileGenerator* profileGenerator = m_currentProfiles[i].get();
+ if (profileGenerator->origin() == origin) {
+ profileGenerator->stopProfiling();
+ m_currentProfiles.remove(i);
+ if (!m_currentProfiles.size())
+ s_sharedEnabledProfilerReference = 0;
+ }
+ }
+}
+
static inline void dispatchFunctionToProfiles(ExecState* callerOrHandlerCallFrame, const Vector<RefPtr<ProfileGenerator> >& profiles, ProfileGenerator::ProfileFunction function, const CallIdentifier& callIdentifier, unsigned currentProfileTargetGroup)
{
for (size_t i = 0; i < profiles.size(); ++i) {
- if (profiles[i]->profileGroup() == currentProfileTargetGroup || !profiles[i]->originatingGlobalExec())
+ if (profiles[i]->profileGroup() == currentProfileTargetGroup || !profiles[i]->origin())
(profiles[i].get()->*function)(callerOrHandlerCallFrame, callIdentifier);
}
}