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

Unified Diff: src/frames.cc

Issue 2405173007: [Interpreter] Print information about interpreted functions when tracing ics. (Closed)
Patch Set: Created 4 years, 2 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/frames.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/frames.cc
diff --git a/src/frames.cc b/src/frames.cc
index c67fdc2d94fdd5e524890be41c56a6c377471d47..1c404dbecafe008f007fe47d2e8dc1bdc73a427d 100644
--- a/src/frames.cc
+++ b/src/frames.cc
@@ -985,16 +985,16 @@ int JavaScriptFrame::LookupExceptionHandlerInTable(
return code->LookupRangeInHandlerTable(pc_offset, stack_depth, prediction);
}
-void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function, Code* code,
- Address pc, FILE* file,
+void JavaScriptFrame::PrintFunctionAndOffset(JSFunction* function,
+ AbstractCode* code,
+ int code_offset, FILE* file,
bool print_line_number) {
PrintF(file, "%s", function->IsOptimized() ? "*" : "~");
function->PrintName(file);
- int code_offset = static_cast<int>(pc - code->instruction_start());
PrintF(file, "+%d", code_offset);
if (print_line_number) {
SharedFunctionInfo* shared = function->shared();
- int source_pos = AbstractCode::cast(code)->SourcePosition(code_offset);
+ int source_pos = code->SourcePosition(code_offset);
Object* maybe_script = shared->script();
if (maybe_script->IsScript()) {
Script* script = Script::cast(maybe_script);
@@ -1024,8 +1024,17 @@ void JavaScriptFrame::PrintTop(Isolate* isolate, FILE* file, bool print_args,
if (it.frame()->is_java_script()) {
JavaScriptFrame* frame = it.frame();
if (frame->IsConstructor()) PrintF(file, "new ");
- PrintFunctionAndOffset(frame->function(), frame->unchecked_code(),
- frame->pc(), file, print_line_number);
+ JSFunction* function = frame->function();
+ int code_offset = 0;
+ if (frame->is_interpreted()) {
+ InterpretedFrame* iframe = reinterpret_cast<InterpretedFrame*>(frame);
+ code_offset = iframe->GetBytecodeOffset();
+ } else {
+ Code* code = frame->unchecked_code();
+ code_offset = static_cast<int>(frame->pc() - code->instruction_start());
+ }
+ PrintFunctionAndOffset(function, function->abstract_code(), code_offset,
+ file, print_line_number);
if (print_args) {
// function arguments
// (we are intentionally only printing the actually
@@ -1351,6 +1360,17 @@ int InterpretedFrame::GetBytecodeOffset() const {
return raw_offset - BytecodeArray::kHeaderSize + kHeapObjectTag;
}
+int InterpretedFrame::GetBytecodeOffset(Address fp) {
+ const int offset = InterpreterFrameConstants::kExpressionsOffset;
+ const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex;
+ DCHECK_EQ(
+ InterpreterFrameConstants::kBytecodeOffsetFromFp,
+ InterpreterFrameConstants::kExpressionsOffset - index * kPointerSize);
+ Address expression_offset = fp + offset - index * kPointerSize;
+ int raw_offset = Smi::cast(Memory::Object_at(expression_offset))->value();
+ return raw_offset - BytecodeArray::kHeaderSize + kHeapObjectTag;
+}
+
void InterpretedFrame::PatchBytecodeOffset(int new_offset) {
const int index = InterpreterFrameConstants::kBytecodeOffsetExpressionIndex;
DCHECK_EQ(
« no previous file with comments | « src/frames.h ('k') | src/ic/ic.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698