]> git.saurik.com Git - apple/javascriptcore.git/blobdiff - runtime/StringObject.h
JavaScriptCore-7600.1.4.17.5.tar.gz
[apple/javascriptcore.git] / runtime / StringObject.h
index e3add77b92bbff5843186b46dec4ed5cedc07738..df63614747362bfd3bf33eac58e641067677305a 100644 (file)
@@ -28,42 +28,59 @@ namespace JSC {
 
     class StringObject : public JSWrapperObject {
     public:
 
     class StringObject : public JSWrapperObject {
     public:
-        StringObject(ExecState*, NonNullPassRefPtr<Structure>);
-        StringObject(ExecState*, NonNullPassRefPtr<Structure>, const UString&);
+        typedef JSWrapperObject Base;
 
 
-        static StringObject* create(ExecState*, JSString*);
+        static StringObject* create(VM& vm, Structure* structure)
+        {
+            JSString* string = jsEmptyString(&vm);
+            StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, structure);
+            object->finishCreation(vm, string);
+            return object;
+        }
+        static StringObject* create(VM& vm, Structure* structure, JSString* string)
+        {
+            StringObject* object = new (NotNull, allocateCell<StringObject>(vm.heap)) StringObject(vm, structure);
+            object->finishCreation(vm, string);
+            return object;
+        }
+        static StringObject* create(VM&, JSGlobalObject*, JSString*);
+
+        static bool getOwnPropertySlot(JSObject*, ExecState*, PropertyName, PropertySlot&);
+        static bool getOwnPropertySlotByIndex(JSObject*, ExecState*, unsigned propertyName, PropertySlot&);
 
 
-        virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&);
-        virtual bool getOwnPropertySlot(ExecState*, unsigned propertyName, PropertySlot&);
-        virtual bool getOwnPropertyDescriptor(ExecState*, const Identifier&, PropertyDescriptor&);
+        static void put(JSCell*, ExecState*, PropertyName, JSValue, PutPropertySlot&);
+        static void putByIndex(JSCell*, ExecState*, unsigned propertyName, JSValue, bool shouldThrow);
 
 
-        virtual void put(ExecState* exec, const Identifier& propertyName, JSValue, PutPropertySlot&);
-        virtual bool deleteProperty(ExecState*, const Identifier& propertyName);
-        virtual void getOwnPropertyNames(ExecState*, PropertyNameArray&, EnumerationMode mode = ExcludeDontEnumProperties);
+        static bool deleteProperty(JSCell*, ExecState*, PropertyName);
+        static bool deletePropertyByIndex(JSCell*, ExecState*, unsigned propertyName);
+        static void getOwnPropertyNames(JSObject*, ExecState*, PropertyNameArray&, EnumerationMode);
+        static bool defineOwnProperty(JSObject*, ExecState*, PropertyName, const PropertyDescriptor&, bool shouldThrow);
 
 
-        virtual const ClassInfo* classInfo() const { return &info; }
-        static const JS_EXPORTDATA ClassInfo info;
+        DECLARE_EXPORT_INFO;
 
         JSString* internalValue() const { return asString(JSWrapperObject::internalValue());}
 
 
         JSString* internalValue() const { return asString(JSWrapperObject::internalValue());}
 
-        static PassRefPtr<Structure> createStructure(JSValue prototype)
+        static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
         {
         {
-            return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags), AnonymousSlotCount);
+            return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
         }
 
     protected:
         }
 
     protected:
-        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | OverridesMarkChildren | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
-        StringObject(NonNullPassRefPtr<Structure>, JSString*);
-  };
+        JS_EXPORT_PRIVATE void finishCreation(VM&, JSString*);
+        static const unsigned StructureFlags = OverridesGetOwnPropertySlot | InterceptsGetOwnPropertySlotByIndexEvenWhenLengthIsNotZero | OverridesGetPropertyNames | JSWrapperObject::StructureFlags;
+        JS_EXPORT_PRIVATE StringObject(VM&, Structure*);
+    };
 
     StringObject* asStringObject(JSValue);
 
     inline StringObject* asStringObject(JSValue value)
     {
 
     StringObject* asStringObject(JSValue);
 
     inline StringObject* asStringObject(JSValue value)
     {
-        ASSERT(asObject(value)->inherits(&StringObject::info));
+        ASSERT(asObject(value)->inherits(StringObject::info()));
         return static_cast<StringObject*>(asObject(value));
     }
 
         return static_cast<StringObject*>(asObject(value));
     }
 
+    JS_EXPORT_PRIVATE StringObject* constructString(VM&, JSGlobalObject*, JSValue);
+
 } // namespace JSC
 
 #endif // StringObject_h
 } // namespace JSC
 
 #endif // StringObject_h