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

Unified Diff: src/ic/ic.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.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ic/ic.cc
diff --git a/src/ic/ic.cc b/src/ic/ic.cc
index 0e751bd358167537daa697d4ae5904fb7b4cb26c..5c9e5ddc6f4428832c8eac45c3af240e467ae3c8 100644
--- a/src/ic/ic.cc
+++ b/src/ic/ic.cc
@@ -111,8 +111,15 @@ void IC::TraceIC(const char* type, Handle<Object> name, State old_state,
Memory::Object_at(fp_ + JavaScriptFrameConstants::kFunctionOffset);
if (maybe_function->IsJSFunction()) {
JSFunction* function = JSFunction::cast(maybe_function);
- JavaScriptFrame::PrintFunctionAndOffset(function, function->code(), pc(),
- stdout, true);
+ int code_offset = 0;
+ if (function->code()->is_interpreter_trampoline_builtin()) {
+ code_offset = InterpretedFrame::GetBytecodeOffset(fp());
+ } else {
+ code_offset =
+ static_cast<int>(pc() - function->code()->instruction_start());
+ }
+ JavaScriptFrame::PrintFunctionAndOffset(
+ function, function->abstract_code(), code_offset, stdout, true);
}
const char* modifier = "";
@@ -171,6 +178,16 @@ IC::IC(FrameDepth depth, Isolate* isolate, FeedbackNexus* nexus)
StackFrame* frame = it.frame();
DCHECK(fp == frame->fp() && pc_address == frame->pc_address());
#endif
+ // For interpreted functions, some bytecode handlers construct a
+ // frame. We have to skip the constructed frame to find the interpreted
+ // function's frame. Check if the there is an additional frame, and if there
+ // is skip this frame. However, the pc should not be updated. The call to
+ // ICs happen from bytecode handlers.
+ Object* frame_type =
+ Memory::Object_at(fp + TypedFrameConstants::kFrameTypeOffset);
+ if (frame_type == Smi::FromInt(StackFrame::STUB)) {
+ fp = Memory::Address_at(fp + TypedFrameConstants::kCallerFPOffset);
+ }
fp_ = fp;
if (FLAG_enable_embedded_constant_pool) {
constant_pool_address_ = constant_pool;
« no previous file with comments | « src/frames.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698