diff options
Diffstat (limited to 'JavaScriptCore/profiler/ProfileGenerator.cpp')
-rw-r--r-- | JavaScriptCore/profiler/ProfileGenerator.cpp | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/JavaScriptCore/profiler/ProfileGenerator.cpp b/JavaScriptCore/profiler/ProfileGenerator.cpp index 1d916ea..68d1733 100644 --- a/JavaScriptCore/profiler/ProfileGenerator.cpp +++ b/JavaScriptCore/profiler/ProfileGenerator.cpp @@ -63,7 +63,7 @@ void ProfileGenerator::addParentForConsoleStart(ExecState* exec) JSValue function; exec->interpreter()->retrieveLastCaller(exec, lineNumber, sourceID, sourceURL, function); - m_currentNode = ProfileNode::create(Profiler::createCallIdentifier(exec, function ? function.toThisObject(exec) : 0, sourceURL, lineNumber), m_head.get(), m_head.get()); + m_currentNode = ProfileNode::create(exec, Profiler::createCallIdentifier(exec, function ? function.toThisObject(exec) : 0, sourceURL, lineNumber), m_head.get(), m_head.get()); m_head->insertNode(m_currentNode.get()); } @@ -72,7 +72,7 @@ const UString& ProfileGenerator::title() const return m_profile->title(); } -void ProfileGenerator::willExecute(const CallIdentifier& callIdentifier) +void ProfileGenerator::willExecute(ExecState* callerCallFrame, const CallIdentifier& callIdentifier) { if (JAVASCRIPTCORE_PROFILE_WILL_EXECUTE_ENABLED()) { CString name = callIdentifier.m_name.utf8(); @@ -83,11 +83,11 @@ void ProfileGenerator::willExecute(const CallIdentifier& callIdentifier) if (!m_originatingGlobalExec) return; - ASSERT_ARG(m_currentNode, m_currentNode); - m_currentNode = m_currentNode->willExecute(callIdentifier); + ASSERT(m_currentNode); + m_currentNode = m_currentNode->willExecute(callerCallFrame, callIdentifier); } -void ProfileGenerator::didExecute(const CallIdentifier& callIdentifier) +void ProfileGenerator::didExecute(ExecState* callerCallFrame, const CallIdentifier& callIdentifier) { if (JAVASCRIPTCORE_PROFILE_DID_EXECUTE_ENABLED()) { CString name = callIdentifier.m_name.utf8(); @@ -98,9 +98,9 @@ void ProfileGenerator::didExecute(const CallIdentifier& callIdentifier) if (!m_originatingGlobalExec) return; - ASSERT_ARG(m_currentNode, m_currentNode); + ASSERT(m_currentNode); if (m_currentNode->callIdentifier() != callIdentifier) { - RefPtr<ProfileNode> returningNode = ProfileNode::create(callIdentifier, m_head.get(), m_currentNode.get()); + RefPtr<ProfileNode> returningNode = ProfileNode::create(callerCallFrame, callIdentifier, m_head.get(), m_currentNode.get()); returningNode->setStartTime(m_currentNode->startTime()); returningNode->didExecute(); m_currentNode->insertNode(returningNode.release()); @@ -110,6 +110,17 @@ void ProfileGenerator::didExecute(const CallIdentifier& callIdentifier) m_currentNode = m_currentNode->didExecute(); } +void ProfileGenerator::exceptionUnwind(ExecState* handlerCallFrame, const CallIdentifier&) +{ + // If the current node was called by the handler (==) or any + // more nested function (>) the we have exited early from it. + ASSERT(m_currentNode); + while (m_currentNode->callerCallFrame() >= handlerCallFrame) { + didExecute(m_currentNode->callerCallFrame(), m_currentNode->callIdentifier()); + ASSERT(m_currentNode); + } +} + void ProfileGenerator::stopProfiling() { m_profile->forEach(&ProfileNode::stopProfiling); @@ -117,14 +128,14 @@ void ProfileGenerator::stopProfiling() removeProfileStart(); removeProfileEnd(); - ASSERT_ARG(m_currentNode, m_currentNode); + ASSERT(m_currentNode); // Set the current node to the parent, because we are in a call that // will not get didExecute call. m_currentNode = m_currentNode->parent(); if (double headSelfTime = m_head->selfTime()) { - RefPtr<ProfileNode> idleNode = ProfileNode::create(CallIdentifier(NonJSExecution, UString(), 0), m_head.get(), m_head.get()); + RefPtr<ProfileNode> idleNode = ProfileNode::create(0, CallIdentifier(NonJSExecution, UString(), 0), m_head.get(), m_head.get()); idleNode->setTotalTime(headSelfTime); idleNode->setSelfTime(headSelfTime); |