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

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
Index: src/inspector/v8-debugger.cc
diff --git a/src/inspector/v8-debugger.cc b/src/inspector/v8-debugger.cc
index f90403eeb1d3afeb3abbce1f0abaccabb610b648..61700a828b4010470dc60b2b17e37be668ceb35f 100644
--- a/src/inspector/v8-debugger.cc
+++ b/src/inspector/v8-debugger.cc
@@ -979,6 +979,7 @@ void V8Debugger::allAsyncTasksCanceled() {
m_parentTask.clear();
m_asyncTaskCreationStacks.clear();
+ m_framesCache.clear();
m_allAsyncStacks.clear();
m_asyncStacksCount = 0;
}
@@ -1036,6 +1037,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) {
@@ -1046,6 +1052,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) {
dgozman 2017/04/20 16:38:21 Choose one...
kozy 2017/04/20 17:05:37 Done.
+ frameId = v8::debug::GetStackFrameId(v8Frame);
+ it = m_framesCache.find(frameId);
+ }
+ if (it != m_framesCache.end()) return it->second.lock();
dgozman 2017/04/20 16:38:21 This can return empty shared_ptr.
kozy 2017/04/20 17:05:37 Done.
+ 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_maxAsyncCallStacks) {
dgozman 2017/04/20 16:38:21 ...or another.
kozy 2017/04/20 17:05:37 Done.
+ m_framesCache[frameId] = frame;
+ }
+ return frame;
+}
+
void V8Debugger::setMaxAsyncTaskStacksForTest(int limit) {
m_maxAsyncCallStacks = 0;
collectOldAsyncStacksIfNeeded();

Powered by Google App Engine
This is Rietveld 408576698