chromium/v8/src/wasm/wasm-serialization.cc

// Copyright 2017 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.

#include "src/wasm/wasm-serialization.h"

#include "src/codegen/assembler-arch.h"
#include "src/codegen/assembler-inl.h"
#include "src/debug/debug.h"
#include "src/runtime/runtime.h"
#include "src/snapshot/snapshot-data.h"
#include "src/utils/ostreams.h"
#include "src/utils/version.h"
#include "src/wasm/code-space-access.h"
#include "src/wasm/function-compiler.h"
#include "src/wasm/module-compiler.h"
#include "src/wasm/module-decoder.h"
#include "src/wasm/wasm-code-manager.h"
#include "src/wasm/wasm-engine.h"
#include "src/wasm/wasm-module.h"
#include "src/wasm/wasm-objects-inl.h"
#include "src/wasm/wasm-objects.h"
#include "src/wasm/wasm-result.h"
#include "src/wasm/well-known-imports.h"

namespace v8 {
namespace internal {
namespace wasm {

namespace {
constexpr uint8_t kLazyFunction =;
constexpr uint8_t kEagerFunction =;
constexpr uint8_t kTurboFanFunction =;

// TODO(bbudge) Try to unify the various implementations of readers and writers
// in Wasm, e.g. StreamProcessor and ZoneBuffer, with these.
class Writer {};

class Reader {};

void WriteHeader(Writer* writer, WasmEnabledFeatures enabled_features) {}

// On Intel, call sites are encoded as a displacement. For linking and for
// serialization/deserialization, we want to store/retrieve a tag (the function
// index). On Intel, that means accessing the raw displacement.
// On ARM64, call sites are encoded as either a literal load or a direct branch.
// Other platforms simply require accessing the target address.
void SetWasmCalleeTag(WritableRelocInfo* rinfo, uint32_t tag) {}

uint32_t GetWasmCalleeTag(RelocInfo* rinfo) {}

constexpr size_t kHeaderSize =;     // all functions validated

constexpr size_t kCodeHeaderSize =;    // tier

// A List of all isolate-independent external references. This is used to create
// a tag from the Address of an external reference and vice versa.
class ExternalReferenceList {};

static_assert(std::is_trivially_destructible<ExternalReferenceList>::value,
              "static destructors not allowed");

}  // namespace

class V8_EXPORT_PRIVATE NativeModuleSerializer {};

NativeModuleSerializer::NativeModuleSerializer(
    const NativeModule* module, base::Vector<WasmCode* const> code_table,
    base::Vector<WellKnownImport const> import_statuses)
    :{}

size_t NativeModuleSerializer::MeasureCode(const WasmCode* code) const {}

size_t NativeModuleSerializer::Measure() const {}

void NativeModuleSerializer::WriteHeader(Writer* writer,
                                         size_t total_code_size) {}

void NativeModuleSerializer::WriteCode(const WasmCode* code, Writer* writer) {}

void NativeModuleSerializer::WriteTieringBudget(Writer* writer) {}

uint32_t NativeModuleSerializer::CanonicalSigIdToModuleLocalTypeId(
    uint32_t canonical_sig_id) {}

bool NativeModuleSerializer::Write(Writer* writer) {}

WasmSerializer::WasmSerializer(NativeModule* native_module)
    :{}

size_t WasmSerializer::GetSerializedNativeModuleSize() const {}

bool WasmSerializer::SerializeNativeModule(base::Vector<uint8_t> buffer) const {}

struct DeserializationUnit {};

class DeserializationQueue {};

class V8_EXPORT_PRIVATE NativeModuleDeserializer {};

class DeserializeCodeTask : public JobTask {};

NativeModuleDeserializer::NativeModuleDeserializer(NativeModule* native_module)
    :{}

bool NativeModuleDeserializer::Read(Reader* reader) {}

void NativeModuleDeserializer::ReadHeader(Reader* reader) {}

DeserializationUnit NativeModuleDeserializer::ReadCode(int fn_index,
                                                       Reader* reader) {}

void NativeModuleDeserializer::CopyAndRelocate(
    const DeserializationUnit& unit) {}

void NativeModuleDeserializer::ReadTieringBudget(Reader* reader) {}

void NativeModuleDeserializer::Publish(std::vector<DeserializationUnit> batch) {}

bool IsSupportedVersion(base::Vector<const uint8_t> header,
                        WasmEnabledFeatures enabled_features) {}

MaybeHandle<WasmModuleObject> DeserializeNativeModule(
    Isolate* isolate, base::Vector<const uint8_t> data,
    base::Vector<const uint8_t> wire_bytes_vec,
    const CompileTimeImports& compile_imports,
    base::Vector<const char> source_url) {}

}  // namespace wasm
}  // namespace internal
}  // namespace v8