]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/GetterSetter.h
JavaScriptCore-7600.1.4.16.1.tar.gz
[apple/javascriptcore.git] / runtime / GetterSetter.h
index aca7e3cbb0272f1ff9dea99c60fe5cdbd309a1d2..bc5cbe0afb1325f1d14f7af26fa9fc956e942ae4 100644 (file)
@@ -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<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;  
     };
@@ -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<GetterSetter*>(value.asCell());
     }
 
+    JSValue callGetter(ExecState*, JSValue base, JSValue getterSetter);
+    void callSetter(ExecState*, JSValue base, JSValue getterSetter, JSValue value, ECMAMode);
 
 } // namespace JSC