// for a property.
class GetterSetter : public JSCell {
friend class JIT;
+
+ private:
+ GetterSetter(VM& vm)
+ : JSCell(vm, vm.getterSetterStructure.get())
+ {
+ }
+
public:
- GetterSetter(ExecState* exec)
- : JSCell(exec->globalData(), exec->globalData().getterSetterStructure.get())
+ typedef JSCell Base;
+
+ static GetterSetter* create(VM& vm)
{
+ GetterSetter* getterSetter = new (NotNull, allocateCell<GetterSetter>(vm.heap)) GetterSetter(vm);
+ getterSetter->finishCreation(vm);
+ return getterSetter;
}
- virtual void visitChildren(SlotVisitor&);
+ static void visitChildren(JSCell*, SlotVisitor&);
JSObject* getter() const { return m_getter.get(); }
- void setGetter(JSGlobalData& globalData, JSObject* getter) { m_getter.set(globalData, this, getter); }
+ void setGetter(VM& vm, JSObject* getter) { m_getter.setMayBeNull(vm, this, getter); }
JSObject* setter() const { return m_setter.get(); }
- void setSetter(JSGlobalData& globalData, JSObject* setter) { m_setter.set(globalData, this, setter); }
- static Structure* createStructure(JSGlobalData& globalData, JSValue prototype)
+ 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), info());
+ }
+
+ static ptrdiff_t offsetOfGetter()
+ {
+ return OBJECT_OFFSETOF(GetterSetter, m_getter);
+ }
+
+ static ptrdiff_t offsetOfSetter()
{
- return Structure::create(globalData, prototype, TypeInfo(GetterSetterType, OverridesVisitChildren), AnonymousSlotCount, &s_info);
+ return OBJECT_OFFSETOF(GetterSetter, m_setter);
}
- static const ClassInfo s_info;
+ DECLARE_INFO;
private:
- virtual bool isGetterSetter() const;
-
WriteBarrier<JSObject> m_getter;
WriteBarrier<JSObject> m_setter;
};
inline GetterSetter* asGetterSetter(JSValue value)
{
- ASSERT(value.asCell()->isGetterSetter());
+ ASSERT_WITH_SECURITY_IMPLICATION(value.asCell()->isGetterSetter());
return static_cast<GetterSetter*>(value.asCell());
}
+ JSValue callGetter(ExecState*, JSValue base, JSValue getterSetter);
+ void callSetter(ExecState*, JSValue base, JSValue getterSetter, JSValue value, ECMAMode);
} // namespace JSC