]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/JSWrapperObject.h
JavaScriptCore-721.26.tar.gz
[apple/javascriptcore.git] / runtime / JSWrapperObject.h
index 2a2e3c6ffdddabf0be3da80fb60f62b220c24455..f19cd30c85049409a338cce27f617e899ede340b 100644 (file)
 #include "JSObject.h"
 
 namespace JSC {
-    
+
     // This class is used as a base for classes such as String,
     // Number, Boolean and Date which are wrappers for primitive types.
     class JSWrapperObject : public JSObject {
     protected:
-        explicit JSWrapperObject(PassRefPtr<Structure>);
+        explicit JSWrapperObject(NonNullPassRefPtr<Structure>);
 
     public:
         JSValue internalValue() const { return m_internalValue; }
         void setInternalValue(JSValue);
-        
-        virtual void mark();
-        
+
+        static PassRefPtr<Structure> createStructure(JSValue prototype) 
+        { 
+            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+        }
+
+    protected:
+        static const unsigned AnonymousSlotCount = 1 + JSObject::AnonymousSlotCount;
+
     private:
+        virtual void markChildren(MarkStack&);
+        
         JSValue m_internalValue;
     };
-    
-    inline JSWrapperObject::JSWrapperObject(PassRefPtr<Structure> structure)
+
+    inline JSWrapperObject::JSWrapperObject(NonNullPassRefPtr<Structure> structure)
         : JSObject(structure)
     {
+        putAnonymousValue(0, jsNull());
     }
-    
+
     inline void JSWrapperObject::setInternalValue(JSValue value)
     {
         ASSERT(value);
         ASSERT(!value.isObject());
         m_internalValue = value;
+        putAnonymousValue(0, value);
     }
 
 } // namespace JSC