Commit 3d48ae2d authored by Ng Zhi An's avatar Ng Zhi An Committed by Commit Bot

Add --print-wasm-code-function-index

This flag allows you to filter printing Wasm code to one particular
function index.

Bug: v8:10791
Change-Id: I400ccaadb8330e5e31e2faefdeddb169cdc85f71
Reviewed-on: https://chromium-review.googlesource.com/c/v8/v8/+/2459259
Commit-Queue: Zhi An Ng <zhin@chromium.org>
Reviewed-by: 's avatarClemens Backes <clemensb@chromium.org>
Cr-Commit-Position: refs/heads/master@{#70457}
parent 673be63e
......@@ -874,8 +874,10 @@ DEFINE_BOOL(wasm_trap_handler, true,
DEFINE_BOOL(wasm_fuzzer_gen_test, false,
"generate a test case when running a wasm fuzzer")
DEFINE_IMPLICATION(wasm_fuzzer_gen_test, single_threaded)
DEFINE_BOOL(print_wasm_code, false, "Print WebAssembly code")
DEFINE_BOOL(print_wasm_stub_code, false, "Print WebAssembly stub code")
DEFINE_BOOL(print_wasm_code, false, "print WebAssembly code")
DEFINE_INT(print_wasm_code_function_index, -1,
"print WebAssembly code for function at index")
DEFINE_BOOL(print_wasm_stub_code, false, "print WebAssembly stub code")
DEFINE_BOOL(asm_wasm_lazy_compilation, false,
"enable lazy compilation for asm-wasm modules")
DEFINE_IMPLICATION(validate_asm, asm_wasm_lazy_compilation)
......
......@@ -323,8 +323,12 @@ void WasmCode::Validate() const {
void WasmCode::MaybePrint(const char* name) const {
// Determines whether flags want this code to be printed.
if ((FLAG_print_wasm_code && kind() == kFunction) ||
(FLAG_print_wasm_stub_code && kind() != kFunction) || FLAG_print_code) {
bool function_index_matches =
(!IsAnonymous() &&
FLAG_print_wasm_code_function_index == static_cast<int>(index()));
if (FLAG_print_code ||
(kind() == kFunction ? (FLAG_print_wasm_code || function_index_matches)
: FLAG_print_wasm_stub_code)) {
Print(name);
}
}
......
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