WebAssemblyWrapperFunction.h [plain text]
#pragma once
#if ENABLE(WEBASSEMBLY)
#include "JSWebAssemblyCodeBlock.h"
#include "WebAssemblyFunctionBase.h"
namespace JSC {
using Wasm::WasmToWasmImportableFunction;
class WebAssemblyWrapperFunction final : public WebAssemblyFunctionBase {
public:
using Base = WebAssemblyFunctionBase;
static constexpr unsigned StructureFlags = Base::StructureFlags;
template<typename CellType, SubspaceAccess mode>
static IsoSubspace* subspaceFor(VM& vm)
{
return vm.webAssemblyWrapperFunctionSpace<mode>();
}
DECLARE_INFO;
static WebAssemblyWrapperFunction* create(VM&, JSGlobalObject*, Structure*, JSObject*, unsigned importIndex, JSWebAssemblyInstance*, 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; }
JSObject* function() { return m_function.get(); }
private:
WebAssemblyWrapperFunction(VM&, NativeExecutable*, JSGlobalObject*, Structure*, WasmToWasmImportableFunction);
void finishCreation(VM&, NativeExecutable*, unsigned length, const String& name, JSObject*, JSWebAssemblyInstance*);
static void visitChildren(JSCell*, SlotVisitor&);
WriteBarrier<JSObject> m_function;
WasmToWasmImportableFunction m_importableFunction;
};
}
#endif // ENABLE(WEBASSEMBLY)