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

Unified Diff: src/debug/debug.cc

Issue 1663113002: [debugger] Use code offsets from frame summary in FromFrame Function. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 years, 10 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/debug/debug.cc
diff --git a/src/debug/debug.cc b/src/debug/debug.cc
index 4bd5fa0cf0cd64b761d4bacb59195ac52b2ab28d..55bab373890ed733354780623f058675725d0047 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -149,13 +149,22 @@ BreakLocation BreakLocation::FromCodeOffset(Handle<DebugInfo> debug_info,
return it.GetBreakLocation();
}
+// Put GetFirstFrameSummary Declaration here as FromFrame use it.
+FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame);
Yang 2016/02/05 08:49:34 Can you simply move the function definition to her
BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info,
JavaScriptFrame* frame) {
// Code offset to the instruction after the current one, possibly a break
// location as well. So the "- 1" to exclude it from the search.
- Code* code = frame->LookupCode();
- int code_offset = static_cast<int>(frame->pc() - code->instruction_start());
- return FromCodeOffset(debug_info, code_offset - 1);
+ // Get code offset from the unoptimized code.
+ FrameSummary summary = GetFirstFrameSummary(frame);
+ Handle<JSFunction> function(summary.function());
Yang 2016/02/05 08:49:34 You don't need to refresh the frame summary here.
+ Handle<SharedFunctionInfo> shared(function->shared());
+ // Refresh frame summary if the code has been recompiled for debugging.
+ if (AbstractCode::cast(shared->code()) != *summary.abstract_code()) {
+ summary = GetFirstFrameSummary(frame);
+ }
+
+ return FromCodeOffset(debug_info, summary.code_offset() - 1);
}
// Find the break point at the supplied address, or the closest one before
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698