WebAssemblyFunction.h [plain text]
#pragma once
#if ENABLE(WEBASSEMBLY)
#include "MacroAssemblerCodeRef.h"
#include "WasmCallee.h"
#include "WebAssemblyFunctionBase.h"
#include <wtf/Noncopyable.h>
namespace JSC {
class JSGlobalObject;
struct ProtoCallFrame;
class WebAssemblyInstance;
using Wasm::WasmToWasmImportableFunction;
namespace B3 {
class Compilation;
}
class WebAssemblyFunction final : public WebAssemblyFunctionBase {
public:
using Base = WebAssemblyFunctionBase;
const static unsigned StructureFlags = Base::StructureFlags;
template<typename CellType>
static IsoSubspace* subspaceFor(VM& vm)
{
return &vm.webAssemblyFunctionSpace;
}
DECLARE_EXPORT_INFO;
JS_EXPORT_PRIVATE static WebAssemblyFunction* create(VM&, JSGlobalObject*, unsigned, const String&, JSWebAssemblyInstance*, Wasm::Callee& jsEntrypoint, WasmToWasmImportableFunction::LoadLocation, Wasm::SignatureIndex);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
Wasm::SignatureIndex signatureIndex() const { return m_importableFunction.signatureIndex; }
WasmToWasmImportableFunction::LoadLocation entrypointLoadLocation() const { return m_importableFunction.entrypointLoadLocation; }
WasmToWasmImportableFunction importableFunction() const { return m_importableFunction; }
MacroAssemblerCodePtr<WasmEntryPtrTag> jsEntrypoint(ArityCheckMode arity)
{
if (arity == ArityCheckNotRequired)
return m_jsEntrypoint;
ASSERT(arity == MustCheckArity);
return m_jsEntrypoint;
}
static ptrdiff_t offsetOfEntrypointLoadLocation() { return OBJECT_OFFSETOF(WebAssemblyFunction, m_importableFunction) + WasmToWasmImportableFunction::offsetOfEntrypointLoadLocation(); }
private:
WebAssemblyFunction(VM&, JSGlobalObject*, Structure*, Wasm::Callee& jsEntrypoint, WasmToWasmImportableFunction::LoadLocation entrypointLoadLocation, Wasm::SignatureIndex);
MacroAssemblerCodePtr<WasmEntryPtrTag> m_jsEntrypoint;
WasmToWasmImportableFunction m_importableFunction;
};
}
#endif // ENABLE(WEBASSEMBLY)