#if !V8_ENABLE_WEBASSEMBLY
#error This header should only be included if WebAssembly is enabled.
#endif
#ifndef V8_WASM_WASM_OBJECTS_H_
#define V8_WASM_WASM_OBJECTS_H_
#include <memory>
#include <optional>
#include "src/base/bit-field.h"
#include "src/debug/interface-types.h"
#include "src/heap/heap.h"
#include "src/objects/backing-store.h"
#include "src/objects/casting.h"
#include "src/objects/foreign.h"
#include "src/objects/js-function.h"
#include "src/objects/js-objects.h"
#include "src/objects/objects-body-descriptors.h"
#include "src/objects/objects.h"
#include "src/objects/struct.h"
#include "src/objects/trusted-object.h"
#include "src/wasm/module-instantiate.h"
#include "src/wasm/stacks.h"
#include "src/wasm/struct-types.h"
#include "src/wasm/value-type.h"
#include "src/objects/object-macros.h"
namespace v8 {
namespace internal {
namespace wasm {
class NativeModule;
class WasmCode;
struct WasmFunction;
struct WasmGlobal;
struct WasmModule;
struct WasmTag;
WasmTagSig;
class WasmValue;
class WireBytesRef;
}
class BreakPoint;
class JSArrayBuffer;
class SeqOneByteString;
class StructBodyDescriptor;
class WasmCapiFunction;
class WasmExceptionTag;
class WasmExportedFunction;
class WasmExternalFunction;
class WasmTrustedInstanceData;
class WasmJSFunction;
class WasmModuleObject;
enum class SharedFlag : uint8_t;
enum class WasmTableFlag : uint8_t { … };
enum class IsAWrapper : uint8_t { … };
template <typename CppType>
class Managed;
template <typename CppType>
class TrustedManaged;
#include "torque-generated/src/wasm/wasm-objects-tq.inc"
#define DECL_OPTIONAL_ACCESSORS …
class V8_EXPORT_PRIVATE FunctionTargetAndImplicitArg { … };
namespace wasm {
enum class OnResume : int { … };
}
class ImportedFunctionEntry { … };
enum InternalizeString : bool { … };
class WasmModuleObject
: public TorqueGeneratedWasmModuleObject<WasmModuleObject, JSObject> { … };
#if V8_ENABLE_SANDBOX || DEBUG
bool FunctionSigMatchesTable(uint32_t canonical_sig_id,
const wasm::WasmModule* module, int table_index);
#endif
class WasmTableObject
: public TorqueGeneratedWasmTableObject<WasmTableObject, JSObject> { … };
class WasmMemoryObject
: public TorqueGeneratedWasmMemoryObject<WasmMemoryObject, JSObject> { … };
class WasmGlobalObject
: public TorqueGeneratedWasmGlobalObject<WasmGlobalObject, JSObject> { … };
class V8_EXPORT_PRIVATE WasmTrustedInstanceData : public ExposedTrustedObject { … };
class WasmInstanceObject
: public TorqueGeneratedWasmInstanceObject<WasmInstanceObject, JSObject> { … };
class WasmTagObject
: public TorqueGeneratedWasmTagObject<WasmTagObject, JSObject> { … };
class WasmDispatchTableData { … };
class WasmDispatchTable : public TrustedObject { … };
class V8_EXPORT_PRIVATE WasmExceptionPackage : public JSObject { … };
void V8_EXPORT_PRIVATE
EncodeI32ExceptionValue(DirectHandle<FixedArray> encoded_values,
uint32_t* encoded_index, uint32_t value);
void V8_EXPORT_PRIVATE
EncodeI64ExceptionValue(DirectHandle<FixedArray> encoded_values,
uint32_t* encoded_index, uint64_t value);
void V8_EXPORT_PRIVATE
DecodeI32ExceptionValue(DirectHandle<FixedArray> encoded_values,
uint32_t* encoded_index, uint32_t* value);
void V8_EXPORT_PRIVATE
DecodeI64ExceptionValue(DirectHandle<FixedArray> encoded_values,
uint32_t* encoded_index, uint64_t* value);
bool UseGenericWasmToJSWrapper(wasm::ImportCallKind kind,
const wasm::FunctionSig* sig,
wasm::Suspend suspend);
class WasmExportedFunction : public JSFunction { … };
class WasmJSFunction : public JSFunction { … };
class WasmCapiFunction : public JSFunction { … };
class WasmExternalFunction : public JSFunction { … };
class WasmFunctionData
: public TorqueGeneratedWasmFunctionData<WasmFunctionData,
ExposedTrustedObject> { … };
class WasmExportedFunctionData
: public TorqueGeneratedWasmExportedFunctionData<WasmExportedFunctionData,
WasmFunctionData> { … };
class WasmImportData
: public TorqueGeneratedWasmImportData<WasmImportData, TrustedObject> { … };
class WasmInternalFunction
: public TorqueGeneratedWasmInternalFunction<WasmInternalFunction,
ExposedTrustedObject> { … };
class WasmFuncRef : public TorqueGeneratedWasmFuncRef<WasmFuncRef, HeapObject> { … };
class WasmJSFunctionData
: public TorqueGeneratedWasmJSFunctionData<WasmJSFunctionData,
WasmFunctionData> { … };
class WasmCapiFunctionData
: public TorqueGeneratedWasmCapiFunctionData<WasmCapiFunctionData,
WasmFunctionData> { … };
class WasmResumeData
: public TorqueGeneratedWasmResumeData<WasmResumeData, HeapObject> { … };
class WasmScript : public AllStatic { … };
class WasmExceptionTag
: public TorqueGeneratedWasmExceptionTag<WasmExceptionTag, Struct> { … };
class AsmWasmData : public TorqueGeneratedAsmWasmData<AsmWasmData, Struct> { … };
class WasmTypeInfo
: public TorqueGeneratedWasmTypeInfo<WasmTypeInfo, HeapObject> { … };
class WasmObject : public TorqueGeneratedWasmObject<WasmObject, JSReceiver> { … };
class WasmStruct : public TorqueGeneratedWasmStruct<WasmStruct, WasmObject> { … };
int WasmStruct::Size(const wasm::StructType* type) { … }
class WasmArray : public TorqueGeneratedWasmArray<WasmArray, WasmObject> { … };
class WasmContinuationObject
: public TorqueGeneratedWasmContinuationObject<WasmContinuationObject,
HeapObject> { … };
class WasmSuspenderObject
: public TorqueGeneratedWasmSuspenderObject<WasmSuspenderObject,
HeapObject> { … };
class WasmSuspendingObject
: public TorqueGeneratedWasmSuspendingObject<WasmSuspendingObject,
JSObject> { … };
class WasmNull : public TorqueGeneratedWasmNull<WasmNull, HeapObject> { … };
#undef DECL_OPTIONAL_ACCESSORS
Handle<Map> CreateFuncRefMap(Isolate* isolate, Handle<Map> opt_rtt_parent);
namespace wasm {
MaybeHandle<Object> JSToWasmObject(Isolate* isolate, Handle<Object> value,
ValueType expected, uint32_t canonical_index,
const char** error_message);
MaybeHandle<Object> JSToWasmObject(Isolate* isolate, const WasmModule* module,
Handle<Object> value, ValueType expected,
const char** error_message);
Handle<Object> WasmToJSObject(Isolate* isolate, Handle<Object> value);
}
}
}
#include "src/objects/object-macros-undef.h"
#endif