Commit 835f53e4 authored by Jakob Gruber's avatar Jakob Gruber Committed by Commit Bot

[regexp] Add --trace-regexp-graph

Until now we've only exposed trace output for the parse- and assembly
stages of regexp codegen. Debug tracing of the graph was missing. The
new --trace-regexp-graph flag fills that hole.

Available regexp codegen tracing flags are now:

--trace-regexp-parser
--trace-regexp-graph
--trace-regexp-assembler

The output of --trace-regexp-graph can be formatted with `dot`, for
example:

 $ d8 --trace-regexp-graph [...] | dot -Tjpg -o regexp-graph.jpg

Change-Id: Ice593c34f7818c94e42d98e98a31533178bb538b
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2808945
Commit-Queue: Jakob Gruber <jgruber@chromium.org>
Auto-Submit: Jakob Gruber <jgruber@chromium.org>
Reviewed-by: 's avatarPatrick Thier <pthier@chromium.org>
Cr-Commit-Position: refs/heads/master@{#73825}
parent eafdc074
......@@ -1610,6 +1610,7 @@ DEFINE_BOOL(trace_regexp_assembler, false,
"trace regexp macro assembler calls.")
DEFINE_BOOL(trace_regexp_parser, false, "trace regexp parsing")
DEFINE_BOOL(trace_regexp_tier_up, false, "trace regexp tiering up execution")
DEFINE_BOOL(trace_regexp_graph, false, "trace the regexp graph")
DEFINE_BOOL(enable_experimental_regexp_engine, false,
"recognize regexps with 'l' flag, run them on experimental engine")
......
......@@ -13,8 +13,6 @@ namespace internal {
// -------------------------------------------------------------------
// Dot/dotty output
#ifdef DEBUG
class DotPrinterImpl : public NodeVisitor {
public:
explicit DotPrinterImpl(std::ostream& os) : os_(os) {}
......@@ -239,14 +237,10 @@ void DotPrinterImpl::VisitAction(ActionNode* that) {
Visit(successor);
}
#endif // DEBUG
void DotPrinter::DotPrint(const char* label, RegExpNode* node) {
#ifdef DEBUG
StdoutStream os;
DotPrinterImpl printer(os);
printer.PrintNode(label, node);
#endif // DEBUG
}
} // namespace internal
......
......@@ -821,6 +821,8 @@ bool RegExpImpl::Compile(Isolate* isolate, Zone* zone, RegExpCompileData* data,
return false;
}
if (FLAG_trace_regexp_graph) DotPrinter::DotPrint("Start", data->node);
// Create the correct assembler for the architecture.
std::unique_ptr<RegExpMacroAssembler> macro_assembler;
if (data->compilation_target == RegExpCompilationTarget::kNative) {
......
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