X-Git-Url: https://git.saurik.com/apple/javascriptcore.git/blobdiff_plain/14957cd040308e3eeec43d26bae5d76da13fcd85..2656c66b5b30d5597e842a751c7f19ad6c2fe31a:/runtime/GetterSetter.h diff --git a/runtime/GetterSetter.h b/runtime/GetterSetter.h index aca7e3c..bc5cbe0 100644 --- a/runtime/GetterSetter.h +++ b/runtime/GetterSetter.h @@ -36,28 +36,47 @@ namespace JSC { // 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(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 m_getter; WriteBarrier m_setter; }; @@ -66,10 +85,12 @@ namespace JSC { inline GetterSetter* asGetterSetter(JSValue value) { - ASSERT(value.asCell()->isGetterSetter()); + ASSERT_WITH_SECURITY_IMPLICATION(value.asCell()->isGetterSetter()); return static_cast(value.asCell()); } + JSValue callGetter(ExecState*, JSValue base, JSValue getterSetter); + void callSetter(ExecState*, JSValue base, JSValue getterSetter, JSValue value, ECMAMode); } // namespace JSC