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 constexpr unsigned StructureFlags = Base::StructureFlags;
template<typename CellType, SubspaceAccess mode>
static IsoSubspace* subspaceFor(VM& vm)
{
return vm.customGetterSetterFunctionSpace<mode>();
}
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;
CustomGetterSetter* customGetterSetter() const { return m_getterSetter.get(); }
bool isSetter() const { return m_type == Type::Setter; }
const PropertyName& propertyName() const { return m_propertyName; }
private:
JSCustomGetterSetterFunction(VM&, NativeExecutable*, JSGlobalObject*, Structure*, Type, const PropertyName&);
void finishCreation(VM&, NativeExecutable*, CustomGetterSetter*, const String&);
static void visitChildren(JSCell*, SlotVisitor&);
WriteBarrier<CustomGetterSetter> m_getterSetter;
Type m_type;
PropertyName m_propertyName;
};
}