Commit 07cff327 authored by Michael Starzinger's avatar Michael Starzinger Committed by Commit Bot

[wasm] Make --print-wasm-code skip runtime stubs.

This changes the existing --print-wasm-code to no longer print code for
runtime stubs (or any other stub code). The new --print-wasm-stub-code
can be used to specifically print such stubs. This does not affect the
existing --print-code behavior.

R=ahaas@chromium.org

Change-Id: I7a00722bf6e7cfbc210245cfd00dac16905f8902
Reviewed-on: https://chromium-review.googlesource.com/c/1411883Reviewed-by: 's avatarAndreas Haas <ahaas@chromium.org>
Commit-Queue: Michael Starzinger <mstarzinger@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58857}
parent ec0bf86c
......@@ -638,6 +638,7 @@ 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(wasm_interpret_all, false,
"Execute all wasm code in the wasm interpreter")
DEFINE_BOOL(asm_wasm_lazy_compilation, false,
......
......@@ -244,6 +244,14 @@ void WasmCode::Validate() const {
#endif
}
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) {
Print(name);
}
}
void WasmCode::Print(const char* name) const {
StdoutStream os;
os << "--- WebAssembly code ---\n";
......@@ -564,7 +572,7 @@ WasmCode* NativeModule::AddAnonymousCode(Handle<Code> code, WasmCode::Kind kind,
// made while iterating over the RelocInfo above.
Assembler::FlushICache(ret->instructions().start(),
ret->instructions().size());
if (FLAG_print_code || FLAG_print_wasm_code) ret->Print(name);
ret->MaybePrint(name);
ret->Validate();
return ret;
}
......@@ -615,7 +623,7 @@ WasmCode* NativeModule::AddCode(
// made while iterating over the RelocInfo above.
Assembler::FlushICache(ret->instructions().start(),
ret->instructions().size());
if (FLAG_print_code || FLAG_print_wasm_code) ret->Print();
ret->MaybePrint();
ret->Validate();
return ret;
}
......
......@@ -136,6 +136,7 @@ class V8_EXPORT_PRIVATE WasmCode final {
void Validate() const;
void Print(const char* name = nullptr) const;
void MaybePrint(const char* name = nullptr) const;
void Disassemble(const char* name, std::ostream& os,
Address current_pc = kNullAddress) const;
......
......@@ -564,7 +564,7 @@ bool NativeModuleDeserializer::ReadCode(uint32_t fn_index, Reader* reader) {
}
}
if (FLAG_print_code || FLAG_print_wasm_code) code->Print();
code->MaybePrint();
code->Validate();
// Finally, flush the icache for that code.
......
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