Index: src/debug/debug.cc |
diff --git a/src/debug/debug.cc b/src/debug/debug.cc |
index 09a04082cfcb8c3bf187bcdbf28c123c18fd81a3..7c76742bb973cb3fa6fc605ea1fe4316ad608fde 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); |
+ } |
} |
@@ -2266,7 +2287,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_); |