Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2945)

Unified Diff: src/inspector/v8-debugger.cc

Issue 2825903002: [inspector] deduplicate stack frames (Closed)
Patch Set: addressed comments Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | src/inspector/v8-stack-trace-impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/inspector/v8-debugger.cc
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
index 6a6ae48f2fa46b906820430739677266e02c19d7..7e5653890dfe2764ff104e1b7c58e781e719ef0f 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -975,6 +975,7 @@ void V8Debugger::allAsyncTasksCanceled() {
m_parentTask.clear();
m_asyncTaskCreationStacks.clear();
+ m_framesCache.clear();
m_allAsyncStacks.clear();
m_asyncStacksCount = 0;
}
@@ -1033,6 +1034,11 @@ void V8Debugger::collectOldAsyncStacksIfNeeded() {
parentLeft.insert(it);
}
m_parentTask.swap(parentLeft);
+ std::map<int, std::weak_ptr<StackFrame>> framesCache;
+ for (auto it : m_framesCache) {
+ if (!it.second.expired()) framesCache.insert(it);
+ }
+ m_framesCache.swap(framesCache);
}
void V8Debugger::removeOldAsyncTasks(AsyncTaskToStackTrace& map) {
@@ -1043,6 +1049,25 @@ void V8Debugger::removeOldAsyncTasks(AsyncTaskToStackTrace& map) {
map.swap(cleanCopy);
}
+std::shared_ptr<StackFrame> V8Debugger::symbolize(
+ v8::Local<v8::StackFrame> v8Frame) {
+ auto it = m_framesCache.end();
+ int frameId = 0;
+ if (m_maxAsyncCallStackDepth) {
+ frameId = v8::debug::GetStackFrameId(v8Frame);
+ it = m_framesCache.find(frameId);
+ }
+ if (it != m_framesCache.end() && it->second.lock()) return it->second.lock();
+ std::shared_ptr<StackFrame> frame(new StackFrame(v8Frame));
+ // TODO(clemensh): Figure out a way to do this translation only right before
+ // sending the stack trace over wire.
+ if (v8Frame->IsWasm()) frame->translate(&m_wasmTranslation);
+ if (m_maxAsyncCallStackDepth) {
+ m_framesCache[frameId] = frame;
+ }
+ return frame;
+}
+
void V8Debugger::setMaxAsyncTaskStacksForTest(int limit) {
m_maxAsyncCallStacks = 0;
collectOldAsyncStacksIfNeeded();
« no previous file with comments | « src/inspector/v8-debugger.h ('k') | src/inspector/v8-stack-trace-impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698