JSNativeStdFunction.h [plain text]
#pragma once
#include "JSFunction.h"
namespace JSC {
class JSGlobalObject;
class NativeStdFunctionCell;
using NativeStdFunction = WTF::Function<EncodedJSValue(ExecState*)>;
class JSNativeStdFunction final : public JSFunction {
public:
typedef JSFunction Base;
const static unsigned StructureFlags = Base::StructureFlags;
template<typename CellType>
static IsoSubspace* subspaceFor(VM& vm)
{
return &vm.nativeStdFunctionSpace;
}
DECLARE_EXPORT_INFO;
JS_EXPORT_PRIVATE static JSNativeStdFunction* create(VM&, JSGlobalObject*, int length, const String& name, NativeStdFunction&&, Intrinsic = NoIntrinsic, NativeFunction nativeConstructor = callHostFunctionAsConstructor);
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
ASSERT(globalObject);
return Structure::create(vm, globalObject, prototype, TypeInfo(JSFunctionType, StructureFlags), info());
}
NativeStdFunctionCell* nativeStdFunctionCell() { return m_functionCell.get(); }
protected:
static void visitChildren(JSCell*, SlotVisitor&);
void finishCreation(VM&, NativeExecutable*, int length, const String& name, NativeStdFunctionCell*);
private:
JSNativeStdFunction(VM&, JSGlobalObject*, Structure*);
WriteBarrier<NativeStdFunctionCell> m_functionCell;
};
}