StackVisitor::Status operator()(StackVisitor& visitor) const { if (m_remainingCapacityForFrameCapture) { // If callee is unknown, but we've not added any frame yet, we should // still add the frame, because something called us, and gave us arguments. JSObject* callee = visitor->callee(); if (!callee && visitor->index()) return StackVisitor::Done; StringBuilder& builder = m_builder; if (!builder.isEmpty()) builder.append('\n'); builder.append('#'); builder.appendNumber(visitor->index()); builder.append(' '); builder.append(visitor->functionName()); builder.appendLiteral("() at "); builder.append(visitor->sourceURL()); if (visitor->isJSFrame()) { builder.append(':'); unsigned lineNumber; unsigned unusedColumn; visitor->computeLineAndColumn(lineNumber, unusedColumn); builder.appendNumber(lineNumber); } if (!callee) return StackVisitor::Done; m_remainingCapacityForFrameCapture--; return StackVisitor::Continue; } return StackVisitor::Done; }
StackVisitor::Status operator()(StackVisitor& visitor) { if (!m_hasSkippedFirstFrame) { m_hasSkippedFirstFrame = true; return StackVisitor::Continue; } unsigned line = 0; unsigned unusedColumn = 0; visitor->computeLineAndColumn(line, unusedColumn); m_line = line; m_url = visitor->sourceURL(); return StackVisitor::Done; }
StackVisitor::Status operator()(StackVisitor& visitor) { if (m_needToSkipAFrame) { m_needToSkipAFrame = false; return StackVisitor::Continue; } if (m_remainingCapacityForFrameCapture) { unsigned line; unsigned column; visitor->computeLineAndColumn(line, column); m_frames.append(ScriptCallFrame(visitor->functionName(), visitor->sourceURL(), line, column)); m_remainingCapacityForFrameCapture--; return StackVisitor::Continue; } return StackVisitor::Done; }
StackVisitor::Status operator()(StackVisitor& visitor) { if (!m_hasSkippedFirstFrame) { m_hasSkippedFirstFrame = true; return StackVisitor::Continue; } unsigned line = 0; unsigned column = 0; visitor->computeLineAndColumn(line, column); m_currentNode = ProfileNode::create(m_exec, LegacyProfiler::createCallIdentifier(m_exec, visitor->callee(), visitor->sourceURL(), line, column), m_rootNode.get()); // Assume that profile times are relative to when the |console.profile| command is evaluated. // This matches the logic in JSStartProfiling() and InspectorTimelineAgent::startFromConsole(). m_currentNode->appendCall(ProfileNode::Call(0.0)); m_rootNode->spliceNode(m_currentNode.get()); m_foundParent = true; return StackVisitor::Done; }
StackVisitor::Status operator()(StackVisitor& visitor) { if (!m_hasSkippedFirstFrame) { m_hasSkippedFirstFrame = true; return StackVisitor::Continue; } unsigned line = 0; unsigned column = 0; visitor->computeLineAndColumn(line, column); m_currentNode = ProfileNode::create(m_exec, LegacyProfiler::createCallIdentifier(m_exec, visitor->callee(), visitor->sourceURL(), line, column), m_head.get(), m_head.get()); m_head->insertNode(m_currentNode.get()); m_foundParent = true; return StackVisitor::Done; }