[vm] Short-circuit disassembly instead of disassembling into the no-op log.

Avoids a bunch of work in the kernel and service isolates when running with --disassemble and the default --isolate-log-filter.

TEST=vm/dart/disassemble_determinism_test
Bug: https://github.com/dart-lang/sdk/issues/55421
Change-Id: Ic5da9b83ffaa3949074561aad8654ee11c041051
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/362164
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
This commit is contained in:
Ryan Macnak
2024-04-10 23:09:37 +00:00
committed by Commit Queue
parent e9b5a01663
commit 7b2c672c8a
@@ -456,6 +456,10 @@ void Disassembler::DisassembleCode(const Function& function,
if (code.IsUnknownDartCode()) {
return;
}
if (Log::Current() == Log::NoOpLog()) {
// Output for this isolate will be shallowed, so don't bother generating it.
return;
}
TextBuffer buffer(128);
const char* function_fullname = function.ToFullyQualifiedCString();
buffer.Printf("%s", Function::KindToCString(function.kind()));
@@ -470,6 +474,10 @@ void Disassembler::DisassembleCode(const Function& function,
}
void Disassembler::DisassembleStub(const char* name, const Code& code) {
if (Log::Current() == Log::NoOpLog()) {
// Output for this isolate will be shallowed, so don't bother generating it.
return;
}
LogBlock lb;
THR_Print("Code for stub '%s': {\n", name);
DisassembleToStdout formatter;