chromium/v8/tools/wasm/mjsunit-module-disassembler-impl.h

// Copyright 2024 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_TOOLS_WASM_MJSUNIT_MODULE_DISASSEMBLER_IMPL_H_
#define V8_TOOLS_WASM_MJSUNIT_MODULE_DISASSEMBLER_IMPL_H_

#include <ctime>

#include "src/numbers/conversions.h"
#include "src/wasm/function-body-decoder-impl.h"
#include "src/wasm/module-decoder-impl.h"
#include "src/wasm/string-builder-multiline.h"
#include "src/wasm/wasm-disassembler-impl.h"
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-opcodes-inl.h"

namespace v8::internal::wasm {

// Provides an implementation of a module disassembler that can produce
// test cases in "mjsunit format", i.e. using the WasmModuleBuilder from
// test/mjsunit/wasm/wasm-module-builder.js to define the module.
//
// The one relevant public method is MjsunitModuleDis::PrintModule().

static constexpr char kHexChars[] =;

StringBuilder& operator<<(StringBuilder& sb, base::Vector<const char> chars) {}

enum OutputContext : bool {};

// Helper to surround a value by an optional ...wasmUnsignedLeb() call.
class MaybeLebScope {};

class MjsunitNamesProvider {};

namespace {
const char* RawOpcodeName(WasmOpcode opcode) {}
const char* PrefixName(WasmOpcode prefix_opcode) {}
}  // namespace

template <typename ValidationTag>
class MjsunitImmediatesPrinter;
class MjsunitFunctionDis : public WasmDecoder<Decoder::FullValidationTag> {};

void MjsunitFunctionDis::WriteMjsunit(MultiLineStringBuilder& out) {}

void PrintF32Const(StringBuilder& out, ImmF32Immediate& imm) {}

void PrintF64Const(StringBuilder& out, ImmF64Immediate& imm) {}

void PrintI64Const(StringBuilder& out, ImmI64Immediate& imm) {}

void MjsunitFunctionDis::DecodeGlobalInitializer(StringBuilder& out) {}

template <typename ValidationTag>
class MjsunitImmediatesPrinter {};

// For opcodes that produce constants (such as `kExprI32Const`), this prints
// more than just the immediate: it also decides whether to use
// "kExprI32Const, 0," or "...wasmI32Const(1234567)".
uint32_t MjsunitFunctionDis::PrintMjsunitImmediatesAndGetLength(
    StringBuilder& out) {}

class MjsunitModuleDis {};

}  // namespace v8::internal::wasm

#endif  // V8_TOOLS_WASM_MJSUNIT_MODULE_DISASSEMBLER_IMPL_H_