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

Unified Diff: src/debug/debug.cc

Issue 1888013002: Revert of Correctly annotate eval origin. (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Created 4 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/debug/debug.h ('k') | src/debug/debug-evaluate.cc » ('j') | 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 acd911a137fa3d7d6a106feefe2f0f456e69bfee..6e9401257967cd0f4bcb64385c87213085275bd9 100644
--- a/src/debug/debug.cc
+++ b/src/debug/debug.cc
@@ -260,6 +260,12 @@
return it->GetBreakLocation();
}
+FrameSummary GetFirstFrameSummary(JavaScriptFrame* frame) {
+ List<FrameSummary> frames(FLAG_max_inlining_levels + 1);
+ frame->Summarize(&frames);
+ return frames.first();
+}
+
int CallOffsetFromCodeOffset(int code_offset, bool is_interpreted) {
// Code offset points to the instruction after the call. Subtract 1 to
// exclude that instruction from the search. For bytecode, the code offset
@@ -269,7 +275,7 @@
BreakLocation BreakLocation::FromFrame(Handle<DebugInfo> debug_info,
JavaScriptFrame* frame) {
- FrameSummary summary = FrameSummary::GetFirst(frame);
+ FrameSummary summary = GetFirstFrameSummary(frame);
int call_offset =
CallOffsetFromCodeOffset(summary.code_offset(), frame->is_interpreted());
return FromCodeOffset(debug_info, call_offset);
@@ -625,7 +631,7 @@
step_break = location.IsTailCall();
// Fall through.
case StepIn: {
- FrameSummary summary = FrameSummary::GetFirst(frame);
+ FrameSummary summary = GetFirstFrameSummary(frame);
int offset = summary.code_offset();
step_break = step_break || location.IsReturn() ||
(current_fp != last_fp) ||
@@ -1005,7 +1011,7 @@
}
// Get the debug info (create it if it does not exist).
- FrameSummary summary = FrameSummary::GetFirst(frame);
+ FrameSummary summary = GetFirstFrameSummary(frame);
Handle<JSFunction> function(summary.function());
Handle<SharedFunctionInfo> shared(function->shared());
if (!EnsureDebugInfo(shared, function)) {
@@ -1016,7 +1022,7 @@
Handle<DebugInfo> debug_info(shared->GetDebugInfo());
// Refresh frame summary if the code has been recompiled for debugging.
if (AbstractCode::cast(shared->code()) != *summary.abstract_code()) {
- summary = FrameSummary::GetFirst(frame);
+ summary = GetFirstFrameSummary(frame);
}
int call_offset =
@@ -1598,7 +1604,7 @@
if (!shared->HasDebugInfo()) return false;
DCHECK(!frame->is_optimized());
- FrameSummary summary = FrameSummary::GetFirst(frame);
+ FrameSummary summary = GetFirstFrameSummary(frame);
Handle<DebugInfo> debug_info(shared->GetDebugInfo());
BreakLocation location =
@@ -1647,6 +1653,21 @@
}
results->Shrink(length);
return results;
+}
+
+
+void Debug::RecordEvalCaller(Handle<Script> script) {
+ script->set_compilation_type(Script::COMPILATION_TYPE_EVAL);
+ // For eval scripts add information on the function from which eval was
+ // called.
+ StackTraceFrameIterator it(script->GetIsolate());
+ if (!it.done()) {
+ script->set_eval_from_shared(it.frame()->function()->shared());
+ Code* code = it.frame()->LookupCode();
+ int offset = static_cast<int>(
+ it.frame()->pc() - code->instruction_start());
+ script->set_eval_from_instructions_offset(offset);
+ }
}
@@ -2239,7 +2260,7 @@
JavaScriptFrameIterator iterator(isolate_);
if (iterator.done()) return;
JavaScriptFrame* frame = iterator.frame();
- FrameSummary summary = FrameSummary::GetFirst(frame);
+ FrameSummary summary = GetFirstFrameSummary(frame);
int source_position =
summary.abstract_code()->SourcePosition(summary.code_offset());
Handle<Object> script_obj(summary.function()->shared()->script(), isolate_);
« no previous file with comments | « src/debug/debug.h ('k') | src/debug/debug-evaluate.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698