Index: src/frames.cc |
diff --git a/src/frames.cc b/src/frames.cc |
index c031971d5aff69f4339783a3ac00b5e243a05505..c6b04f7081fc1f9bd6c81cadc7ffc8a8ac11e7b2 100644 |
--- a/src/frames.cc |
+++ b/src/frames.cc |
@@ -1120,6 +1120,24 @@ void StackFrame::PrintIndex(StringStream* accumulator, |
} |
+namespace { |
+ |
+ |
+void PrintFunctionSource(StringStream* accumulator, SharedFunctionInfo* shared, |
+ Code* code) { |
+ if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
+ std::ostringstream os; |
+ os << "--------- s o u r c e c o d e ---------\n" |
+ << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
+ << "\n-----------------------------------------\n"; |
+ accumulator->Add(os.str().c_str()); |
+ } |
+} |
+ |
+ |
+} // namespace |
+ |
+ |
void JavaScriptFrame::Print(StringStream* accumulator, |
PrintMode mode, |
int index) const { |
@@ -1157,7 +1175,7 @@ void JavaScriptFrame::Print(StringStream* accumulator, |
accumulator->Add(":~%d", line); |
} |
- accumulator->Add("] "); |
+ accumulator->Add("] [pc=%p] ", pc); |
} |
accumulator->Add("(this=%o", receiver); |
@@ -1182,7 +1200,9 @@ void JavaScriptFrame::Print(StringStream* accumulator, |
return; |
} |
if (is_optimized()) { |
- accumulator->Add(" {\n// optimized frame\n}\n"); |
+ accumulator->Add(" {\n// optimized frame\n"); |
+ PrintFunctionSource(accumulator, shared, code); |
+ accumulator->Add("}\n"); |
return; |
} |
accumulator->Add(" {\n"); |
@@ -1249,15 +1269,7 @@ void JavaScriptFrame::Print(StringStream* accumulator, |
accumulator->Add(" [%02d] : %o\n", i, GetExpression(i)); |
} |
- // Print details about the function. |
- if (FLAG_max_stack_trace_source_length != 0 && code != NULL) { |
- std::ostringstream os; |
- SharedFunctionInfo* shared = function->shared(); |
- os << "--------- s o u r c e c o d e ---------\n" |
- << SourceCodeOf(shared, FLAG_max_stack_trace_source_length) |
- << "\n-----------------------------------------\n"; |
- accumulator->Add(os.str().c_str()); |
- } |
+ PrintFunctionSource(accumulator, shared, code); |
accumulator->Add("}\n\n"); |
} |