#include "src/wasm/names-provider.h"
#include "src/strings/unicode-decoder.h"
#include "src/wasm/module-decoder.h"
#include "src/wasm/std-object-sizes.h"
#include "src/wasm/string-builder.h"
namespace v8 {
namespace internal {
namespace wasm {
NamesProvider::NamesProvider(const WasmModule* module,
base::Vector<const uint8_t> wire_bytes)
: … { … }
NamesProvider::~NamesProvider() = default;
void NamesProvider::DecodeNamesIfNotYetDone() { … }
void NamesProvider::ComputeFunctionNamesFromImportsExports() { … }
void NamesProvider::ComputeNamesFromImportsExports() { … }
namespace {
static constexpr char kIdentifierChar[] = …;
void SanitizeUnicodeName(StringBuilder& out, const uint8_t* utf8_src,
size_t length) { … }
}
void NamesProvider::ComputeImportName(const WasmImport& import,
std::map<uint32_t, std::string>& target) { … }
void NamesProvider::ComputeExportName(const WasmExport& ex,
std::map<uint32_t, std::string>& target) { … }
namespace {
V8_INLINE void MaybeAddComment(StringBuilder& out, uint32_t index,
bool add_comment) { … }
}
void NamesProvider::WriteRef(StringBuilder& out, WireBytesRef ref) { … }
void NamesProvider::PrintFunctionName(StringBuilder& out,
uint32_t function_index,
FunctionNamesBehavior behavior,
IndexAsComment index_as_comment) { … }
WireBytesRef Get(const NameMap& map, uint32_t index) { … }
WireBytesRef Get(const IndirectNameMap& map, uint32_t outer_index,
uint32_t inner_index) { … }
void NamesProvider::PrintLocalName(StringBuilder& out, uint32_t function_index,
uint32_t local_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintLabelName(StringBuilder& out, uint32_t function_index,
uint32_t label_index,
uint32_t fallback_index) { … }
void NamesProvider::PrintTypeName(StringBuilder& out, uint32_t type_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintTableName(StringBuilder& out, uint32_t table_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintMemoryName(StringBuilder& out, uint32_t memory_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintGlobalName(StringBuilder& out, uint32_t global_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintElementSegmentName(StringBuilder& out,
uint32_t element_segment_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintDataSegmentName(StringBuilder& out,
uint32_t data_segment_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintFieldName(StringBuilder& out, uint32_t struct_index,
uint32_t field_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintTagName(StringBuilder& out, uint32_t tag_index,
IndexAsComment index_as_comment) { … }
void NamesProvider::PrintHeapType(StringBuilder& out, HeapType type) { … }
void NamesProvider::PrintValueType(StringBuilder& out, ValueType type) { … }
namespace {
size_t StringMapSize(const std::map<uint32_t, std::string>& map) { … }
}
size_t NamesProvider::EstimateCurrentMemoryConsumption() const { … }
}
}
}