#include "src/wasm/module-decoder.h"
#include "src/logging/metrics.h"
#include "src/tracing/trace-event.h"
#include "src/wasm/constant-expression.h"
#include "src/wasm/decoder.h"
#include "src/wasm/module-decoder-impl.h"
#include "src/wasm/struct-types.h"
#include "src/wasm/wasm-constants.h"
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-limits.h"
#include "src/wasm/wasm-opcodes-inl.h"
namespace v8 {
namespace internal {
namespace wasm {
const char* SectionName(SectionCode code) { … }
ModuleResult DecodeWasmModule(
WasmEnabledFeatures enabled_features,
base::Vector<const uint8_t> wire_bytes, bool validate_functions,
ModuleOrigin origin, Counters* counters,
std::shared_ptr<metrics::Recorder> metrics_recorder,
v8::metrics::Recorder::ContextId context_id,
DecodingMethod decoding_method) { … }
ModuleResult DecodeWasmModule(WasmEnabledFeatures enabled_features,
base::Vector<const uint8_t> wire_bytes,
bool validate_functions, ModuleOrigin origin) { … }
ModuleResult DecodeWasmModuleForDisassembler(
base::Vector<const uint8_t> wire_bytes, ITracer* tracer) { … }
ModuleDecoder::ModuleDecoder(WasmEnabledFeatures enabled_features)
: … { … }
ModuleDecoder::~ModuleDecoder() = default;
const std::shared_ptr<WasmModule>& ModuleDecoder::shared_module() const { … }
void ModuleDecoder::DecodeModuleHeader(base::Vector<const uint8_t> bytes) { … }
void ModuleDecoder::DecodeSection(SectionCode section_code,
base::Vector<const uint8_t> bytes,
uint32_t offset) { … }
void ModuleDecoder::DecodeFunctionBody(uint32_t index, uint32_t length,
uint32_t offset) { … }
void ModuleDecoder::StartCodeSection(WireBytesRef section_bytes) { … }
bool ModuleDecoder::CheckFunctionsCount(uint32_t functions_count,
uint32_t error_offset) { … }
ModuleResult ModuleDecoder::FinishDecoding() { … }
size_t ModuleDecoder::IdentifyUnknownSection(ModuleDecoder* decoder,
base::Vector<const uint8_t> bytes,
uint32_t offset,
SectionCode* result) { … }
bool ModuleDecoder::ok() { … }
Result<const FunctionSig*> DecodeWasmSignatureForTesting(
WasmEnabledFeatures enabled_features, Zone* zone,
base::Vector<const uint8_t> bytes) { … }
ConstantExpression DecodeWasmInitExprForTesting(
WasmEnabledFeatures enabled_features, base::Vector<const uint8_t> bytes,
ValueType expected) { … }
FunctionResult DecodeWasmFunctionForTesting(
WasmEnabledFeatures enabled_features, Zone* zone,
ModuleWireBytes wire_bytes, const WasmModule* module,
base::Vector<const uint8_t> function_bytes) { … }
AsmJsOffsetsResult DecodeAsmJsOffsets(
base::Vector<const uint8_t> encoded_offsets) { … }
std::vector<CustomSectionOffset> DecodeCustomSections(
base::Vector<const uint8_t> bytes) { … }
namespace {
bool FindNameSection(Decoder* decoder) { … }
enum class EmptyNames : bool { … };
void DecodeNameMapInternal(NameMap& target, Decoder& decoder,
EmptyNames empty_names = EmptyNames::kSkip) { … }
void DecodeNameMap(NameMap& target, Decoder& decoder,
uint32_t subsection_payload_length,
EmptyNames empty_names = EmptyNames::kSkip) { … }
void DecodeIndirectNameMap(IndirectNameMap& target, Decoder& decoder,
uint32_t subsection_payload_length) { … }
}
void DecodeFunctionNames(base::Vector<const uint8_t> wire_bytes,
NameMap& names) { … }
namespace {
class ValidateFunctionsTask : public JobTask { … };
}
WasmError ValidateFunctions(const WasmModule* module,
WasmEnabledFeatures enabled_features,
base::Vector<const uint8_t> wire_bytes,
std::function<bool(int)> filter) { … }
WasmError GetWasmErrorWithName(base::Vector<const uint8_t> wire_bytes,
int func_index, const WasmModule* module,
WasmError error) { … }
DecodedNameSection::DecodedNameSection(base::Vector<const uint8_t> wire_bytes,
WireBytesRef name_section) { … }
#undef TRACE
}
}
}