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;
namespace B3 {
class Compilation;
}
class WebAssemblyFunction final : public WebAssemblyFunctionBase {
public:
using Base = WebAssemblyFunctionBase;
const static unsigned StructureFlags = Base::StructureFlags | TypeOfShouldCallGetCallData;
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, Wasm::WasmEntrypointLoadLocation, Wasm::SignatureIndex);
static Structure* createStructure(VM&, JSGlobalObject*, JSValue);
Wasm::SignatureIndex signatureIndex() const { return m_wasmFunction.signatureIndex; }
Wasm::WasmEntrypointLoadLocation wasmEntrypointLoadLocation() const { return m_wasmFunction.code; }
Wasm::CallableFunction callableFunction() const { return m_wasmFunction; }
MacroAssemblerCodePtr jsEntrypoint() { return m_jsEntrypoint; }
static ptrdiff_t offsetOfWasmEntrypointLoadLocation() { return OBJECT_OFFSETOF(WebAssemblyFunction, m_wasmFunction) + Wasm::CallableFunction::offsetOfWasmEntrypointLoadLocation(); }
private:
WebAssemblyFunction(VM&, JSGlobalObject*, Structure*, Wasm::Callee& jsEntrypoint, Wasm::WasmEntrypointLoadLocation, Wasm::SignatureIndex);
MacroAssemblerCodePtr m_jsEntrypoint;
Wasm::CallableFunction m_wasmFunction;
};
}
#endif // ENABLE(WEBASSEMBLY)