#ifndef GetterSetter_h
#define GetterSetter_h
#include "JSCell.h"
#include "CallFrame.h"
#include "Structure.h"
namespace JSC {
class JSObject;
class GetterSetter : public JSCell {
friend class JIT;
private:
GetterSetter(ExecState* exec)
: JSCell(exec->vm(), exec->vm().getterSetterStructure.get())
{
}
public:
typedef JSCell Base;
static GetterSetter* create(ExecState* exec)
{
GetterSetter* getterSetter = new (NotNull, allocateCell<GetterSetter>(*exec->heap())) GetterSetter(exec);
getterSetter->finishCreation(exec->vm());
return getterSetter;
}
static void visitChildren(JSCell*, SlotVisitor&);
JSObject* getter() const { return m_getter.get(); }
void setGetter(VM& vm, JSObject* getter) { m_getter.setMayBeNull(vm, this, getter); }
JSObject* setter() const { return m_setter.get(); }
void setSetter(VM& vm, JSObject* setter) { m_setter.setMayBeNull(vm, this, setter); }
static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
{
return Structure::create(vm, globalObject, prototype, TypeInfo(GetterSetterType, OverridesVisitChildren), &s_info);
}
static const ClassInfo s_info;
private:
WriteBarrier<JSObject> m_getter;
WriteBarrier<JSObject> m_setter;
};
GetterSetter* asGetterSetter(JSValue);
inline GetterSetter* asGetterSetter(JSValue value)
{
ASSERT(value.asCell()->isGetterSetter());
return static_cast<GetterSetter*>(value.asCell());
}
}
#endif // GetterSetter_h