#include "src/wasm/wasm-disassembler.h"
#include <iomanip>
#include "src/debug/debug-interface.h"
#include "src/numbers/conversions.h"
#include "src/wasm/module-decoder-impl.h"
#include "src/wasm/names-provider.h"
#include "src/wasm/wasm-disassembler-impl.h"
#include "src/wasm/wasm-opcodes-inl.h"
namespace v8 {
namespace internal {
namespace wasm {
void Disassemble(const WasmModule* module, ModuleWireBytes wire_bytes,
NamesProvider* names,
v8::debug::DisassemblyCollector* collector,
std::vector<int>* function_body_offsets) { … }
void Disassemble(base::Vector<const uint8_t> wire_bytes,
v8::debug::DisassemblyCollector* collector,
std::vector<int>* function_body_offsets) { … }
void MultiLineStringBuilder::ToDisassemblyCollector(
v8::debug::DisassemblyCollector* collector) { … }
void DisassembleFunctionImpl(const WasmModule* module, int func_index,
base::Vector<const uint8_t> function_body,
ModuleWireBytes module_bytes, NamesProvider* names,
std::ostream& os, std::vector<uint32_t>* offsets) { … }
void DisassembleFunction(const WasmModule* module, int func_index,
base::Vector<const uint8_t> wire_bytes,
NamesProvider* names, std::ostream& os) { … }
void DisassembleFunction(const WasmModule* module, int func_index,
base::Vector<const uint8_t> function_body,
base::Vector<const uint8_t> maybe_wire_bytes,
uint32_t function_body_offset, std::ostream& os,
std::vector<uint32_t>* offsets) { … }
static constexpr char kHexChars[] = …;
static constexpr char kUpperHexChars[] = …;
uint32_t GetDefaultAlignment(WasmOpcode opcode) { … }
void PrintSignatureOneLine(StringBuilder& out, const FunctionSig* sig,
uint32_t func_index, NamesProvider* names,
bool param_names,
IndexAsComment indices_as_comments) { … }
void PrintStringRaw(StringBuilder& out, const uint8_t* start,
const uint8_t* end) { … }
void FunctionBodyDisassembler::DecodeAsWat(MultiLineStringBuilder& out,
Indentation indentation,
FunctionHeader include_header,
uint32_t* first_instruction_offset) { … }
void FunctionBodyDisassembler::DecodeGlobalInitializer(StringBuilder& out) { … }
WasmOpcode FunctionBodyDisassembler::GetOpcode() { … }
void FunctionBodyDisassembler::PrintHexNumber(StringBuilder& out,
uint64_t number) { … }
template <typename ValidationTag>
class ImmediatesPrinter { … };
uint32_t FunctionBodyDisassembler::PrintImmediatesAndGetLength(
StringBuilder& out) { … }
void OffsetsProvider::CollectOffsets(const WasmModule* module,
base::Vector<const uint8_t> wire_bytes) { … }
ModuleDisassembler::ModuleDisassembler(
MultiLineStringBuilder& out, const WasmModule* module, NamesProvider* names,
const ModuleWireBytes wire_bytes, AccountingAllocator* allocator,
std::unique_ptr<OffsetsProvider> offsets_provider,
std::vector<int>* function_body_offsets)
: … { … }
ModuleDisassembler::~ModuleDisassembler() = default;
void ModuleDisassembler::PrintTypeDefinition(uint32_t type_index,
Indentation indentation,
IndexAsComment index_as_comment) { … }
void ModuleDisassembler::PrintModule(Indentation indentation, size_t max_mb) { … }
void ModuleDisassembler::PrintImportName(const WasmImport& import) { … }
void ModuleDisassembler::PrintExportName(ImportExportKindCode kind,
uint32_t index) { … }
void ModuleDisassembler::PrintMutableType(bool mutability, ValueType type) { … }
void ModuleDisassembler::PrintTable(const WasmTable& table) { … }
void ModuleDisassembler::PrintMemory(const WasmMemory& memory) { … }
void ModuleDisassembler::PrintGlobal(const WasmGlobal& global) { … }
void ModuleDisassembler::PrintInitExpression(const ConstantExpression& init,
ValueType expected_type) { … }
void ModuleDisassembler::PrintTagSignature(const FunctionSig* sig) { … }
void ModuleDisassembler::PrintString(WireBytesRef ref) { … }
void ModuleDisassembler::PrintStringAsJSON(WireBytesRef ref) { … }
void ModuleDisassembler::LineBreakOrSpace(bool break_lines,
Indentation indentation,
uint32_t byte_offset) { … }
}
}
}