JSCustomGetterSetterFunction.h [plain text]
#pragma once
#include "JSFunction.h"
namespace JSC {
class CustomGetterSetter;
class JSCustomGetterSetterFunction final : public JSFunction {
public:
typedef JSFunction Base;
enum class Type { Getter = 0, Setter = 1 };
static const unsigned StructureFlags = Base::StructureFlags;
template<typename CellType>
static IsoSubspace* subspaceFor(VM& vm)
{
return &vm.customGetterSetterFunctionSpace;
}
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
ASSERT(globalObject);
return Structure::create(vm, globalObject, prototype, TypeInfo(JSFunctionType, StructureFlags), info());
}
static JSCustomGetterSetterFunction* create(VM&, JSGlobalObject*, CustomGetterSetter*, const Type, const PropertyName&);
DECLARE_EXPORT_INFO;
protected:
static void visitChildren(JSCell*, SlotVisitor&);
private:
JSCustomGetterSetterFunction(VM&, JSGlobalObject*, Structure*, Type, const PropertyName&);
void finishCreation(VM&, NativeExecutable*, CustomGetterSetter*, const String&);
static EncodedJSValue JSC_HOST_CALL customGetterSetterFunctionCall(ExecState*);
CustomGetterSetter* customGetterSetter() const { return m_getterSetter.get(); }
bool isSetter() const { return m_type == Type::Setter; }
const PropertyName& propertyName() const { return m_propertyName; }
WriteBarrier<CustomGetterSetter> m_getterSetter;
Type m_type;
PropertyName m_propertyName;
};
}