#if !V8_ENABLE_WEBASSEMBLY
#error This header should only be included if WebAssembly is enabled.
#endif
#ifndef V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_
#define V8_WASM_FUNCTION_BODY_DECODER_IMPL_H_
#include <inttypes.h>
#include <optional>
#include "src/base/bounds.h"
#include "src/base/small-vector.h"
#include "src/base/strings.h"
#include "src/base/vector.h"
#include "src/strings/unicode.h"
#include "src/utils/bit-vector.h"
#include "src/wasm/decoder.h"
#include "src/wasm/function-body-decoder.h"
#include "src/wasm/value-type.h"
#include "src/wasm/wasm-features.h"
#include "src/wasm/wasm-limits.h"
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-opcodes.h"
#include "src/wasm/wasm-subtyping.h"
namespace v8::internal::wasm {
struct WasmGlobal;
struct WasmTag;
#define TRACE …
#define TRACE_INST_FORMAT …
#ifdef DEBUG
#define VALIDATE …
V8_INLINE bool ValidateAssumeTrue(bool condition, const char* message) { … }
#else
#define VALIDATE …
#endif
#define CHECK_PROTOTYPE_OPCODE …
static constexpr LoadType GetLoadType(WasmOpcode opcode) { … }
static constexpr StoreType GetStoreType(WasmOpcode opcode) { … }
#define ATOMIC_OP_LIST(V) …
#define ATOMIC_STORE_OP_LIST(V) …
template <typename ValidationTag, typename... Args>
V8_INLINE void DecodeError(Decoder* decoder, const uint8_t* pc, const char* str,
Args&&... args) { … }
template <typename ValidationTag, typename... Args>
V8_INLINE void DecodeError(Decoder* decoder, const char* str, Args&&... args) { … }
namespace value_type_reader {
template <typename ValidationTag>
std::pair<HeapType, uint32_t> read_heap_type(Decoder* decoder,
const uint8_t* pc,
WasmEnabledFeatures enabled) { … }
template <typename ValidationTag>
std::pair<ValueType, uint32_t> read_value_type(Decoder* decoder,
const uint8_t* pc,
WasmEnabledFeatures enabled) { … }
template <typename ValidationTag>
bool ValidateHeapType(Decoder* decoder, const uint8_t* pc,
const WasmModule* module, HeapType type) { … }
template <typename ValidationTag>
bool ValidateValueType(Decoder* decoder, const uint8_t* pc,
const WasmModule* module, ValueType type) { … }
}
enum DecodingMode { … };
struct ImmI32Immediate { … };
struct ImmI64Immediate { … };
struct ImmF32Immediate { … };
struct ImmF64Immediate { … };
struct BrOnCastFlags { … };
struct BrOnCastImmediate { … };
struct IndexImmediate { … };
struct MemoryIndexImmediate : public IndexImmediate { … };
struct TableIndexImmediate : public IndexImmediate { … };
struct TagIndexImmediate : public IndexImmediate { … };
struct GlobalIndexImmediate : public IndexImmediate { … };
struct SigIndexImmediate : public IndexImmediate { … };
struct StructIndexImmediate : public IndexImmediate { … };
struct ArrayIndexImmediate : public IndexImmediate { … };
struct CallFunctionImmediate : public IndexImmediate { … };
struct SelectTypeImmediate { … };
static constexpr uint32_t kInlineSignatureSentinel = …;
struct BlockTypeImmediate { … };
struct BranchDepthImmediate { … };
struct FieldImmediate { … };
struct CallIndirectImmediate { … };
struct BranchTableImmediate { … };
TryTableImmediate;
template <typename ValidationTag>
class BranchTableIterator { … };
struct CatchCase { … };
template <typename ValidationTag>
class TryTableIterator { … };
struct MemoryAccessImmediate { … };
struct SimdLaneImmediate { … };
struct Simd128Immediate { … };
struct MemoryInitImmediate { … };
struct MemoryCopyImmediate { … };
struct TableInitImmediate { … };
struct TableCopyImmediate { … };
struct HeapTypeImmediate { … };
struct StringConstImmediate { … };
template <bool validate>
struct PcForErrors { … };
template <>
struct PcForErrors<true> { … };
template <typename ValidationTag>
struct ValueBase : public PcForErrors<ValidationTag::validate> { … };
template <typename Value>
struct Merge { … };
enum ControlKind : uint8_t { … };
enum Reachability : uint8_t { … };
template <typename Value, typename ValidationTag>
struct ControlBase : public PcForErrors<ValidationTag::validate> { … };
#define INTERFACE_FUNCTIONS(F) …
#define INTERFACE_META_FUNCTIONS(F) …
#define INTERFACE_CONSTANT_FUNCTIONS(F) …
#define INTERFACE_NON_CONSTANT_FUNCTIONS(F) …
const std::pair<uint32_t, uint32_t> invalid_instruction_trace = {0, 0};
template <typename T>
class FastZoneVector { … };
template <typename ValidationTag, DecodingMode decoding_mode = kFunctionBody>
class WasmDecoder : public Decoder { … };
#define CALL_INTERFACE(name, ...) …
#define CALL_INTERFACE_IF_OK_AND_REACHABLE …
#define CALL_INTERFACE_IF_OK_AND_PARENT_REACHABLE …
class NoVector { … };
template <typename ValidationTag, typename Interface,
DecodingMode decoding_mode = kFunctionBody>
class WasmFullDecoder : public WasmDecoder<ValidationTag, decoding_mode> { … };
class EmptyInterface { … };
#undef CALL_INTERFACE_IF_OK_AND_REACHABLE
#undef CALL_INTERFACE_IF_OK_AND_PARENT_REACHABLE
#undef TRACE
#undef TRACE_INST_FORMAT
#undef VALIDATE
#undef CHECK_PROTOTYPE_OPCODE
}
#endif