diff options
Diffstat (limited to 'JavaScriptCore/runtime/JSWrapperObject.h')
-rw-r--r-- | JavaScriptCore/runtime/JSWrapperObject.h | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/JavaScriptCore/runtime/JSWrapperObject.h b/JavaScriptCore/runtime/JSWrapperObject.h index 0b2c680..723b75d 100644 --- a/JavaScriptCore/runtime/JSWrapperObject.h +++ b/JavaScriptCore/runtime/JSWrapperObject.h @@ -25,33 +25,41 @@ #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); - + + static PassRefPtr<Structure> createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType, HasStandardGetOwnPropertySlot | HasDefaultGetPropertyNames | HasDefaultMark)); + } + + private: virtual void markChildren(MarkStack&); - private: JSValue m_internalValue; }; - - inline JSWrapperObject::JSWrapperObject(PassRefPtr<Structure> structure) + + inline JSWrapperObject::JSWrapperObject(NonNullPassRefPtr<Structure> structure) : JSObject(structure) { + addAnonymousSlots(1); + putAnonymousValue(0, jsNull()); } - + inline void JSWrapperObject::setInternalValue(JSValue value) { ASSERT(value); ASSERT(!value.isObject()); m_internalValue = value; + putAnonymousValue(0, value); } } // namespace JSC |