Commit 13e5c7bd authored by Leszek Swirski's avatar Leszek Swirski Committed by V8 LUCI CQ

[maglev] Print feedback vector when doing other prints

Print the function, bytecode and feedback vector of any function we
attempt to compile with maglev while any of the printing flags are
enabled.

Bug: v8:7700
Change-Id: I92831fbd6c687e10afee7e0698ef2c42d11c63ee
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/3663085
Commit-Queue: Toon Verwaest <verwaest@chromium.org>
Auto-Submit: Leszek Swirski <leszeks@chromium.org>
Reviewed-by: 's avatarToon Verwaest <verwaest@chromium.org>
Cr-Commit-Position: refs/heads/main@{#80715}
parent 4e48c700
......@@ -1257,6 +1257,11 @@ void FeedbackNexus::Print(std::ostream& os) {
case FeedbackSlotKind::kSetNamedStrict:
case FeedbackSlotKind::kDefineNamedOwn: {
os << InlineCacheState2String(ic_state());
if (kind() == FeedbackSlotKind::kLoadProperty &&
ic_state() == InlineCacheState::MONOMORPHIC) {
os << "\n ";
LoadHandler::PrintHandler(GetFeedbackExtra().GetHeapObjectOrSmi(), os);
}
break;
}
case FeedbackSlotKind::kBinaryOp: {
......@@ -2852,7 +2857,7 @@ V8_EXPORT_PRIVATE extern void _v8_internal_Print_LoadHandler(void* object) {
#ifdef OBJECT_PRINT
i::StdoutStream os;
i::LoadHandler::PrintHandler(GetObjectFromRaw(object), os);
os << std::flush;
os << std::endl << std::flush;
#endif
}
......
......@@ -514,7 +514,7 @@ void LoadHandler::PrintHandler(Object handler, std::ostream& os) {
int raw_handler = handler.ToSmi().value();
os << "LoadHandler(Smi)(";
PrintSmiLoadHandler(raw_handler, os);
os << ")" << std::endl;
os << ")";
} else {
LoadHandler load_handler = LoadHandler::cast(handler);
int raw_handler = load_handler.smi_handler().ToSmi().value();
......@@ -536,7 +536,7 @@ void LoadHandler::PrintHandler(Object handler, std::ostream& os) {
}
os << ", validity cell = ";
load_handler.validity_cell().ShortPrint(os);
os << ")" << std::endl;
os << ")";
}
}
......
......@@ -159,6 +159,16 @@ void MaglevCompiler::Compile(LocalIsolate* local_isolate,
compilation_info->set_graph_labeller(new MaglevGraphLabeller());
}
if (FLAG_print_maglev_code || FLAG_print_maglev_graph ||
FLAG_trace_maglev_regalloc) {
MaglevCompilationUnit* top_level_unit =
compilation_info->toplevel_compilation_unit();
std::cout << "Compiling " << Brief(*top_level_unit->function().object())
<< " with Maglev\n";
top_level_unit->bytecode().object()->Disassemble(std::cout);
top_level_unit->feedback().object()->Print(std::cout);
}
// TODO(v8:7700): Support exceptions in maglev. We currently bail if exception
// handler table is non-empty.
if (compilation_info->toplevel_compilation_unit()
......@@ -180,11 +190,6 @@ void MaglevCompiler::Compile(LocalIsolate* local_isolate,
}
if (FLAG_print_maglev_graph) {
MaglevCompilationUnit* top_level_unit =
compilation_info->toplevel_compilation_unit();
std::cout << "Compiling " << Brief(*top_level_unit->function().object())
<< " with Maglev\n";
top_level_unit->bytecode().object()->Disassemble(std::cout);
std::cout << "\nAfter graph buiding" << std::endl;
PrintGraph(std::cout, compilation_info, graph_builder.graph());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment