#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 {
+ class JSWrapperObject : public JSNonFinalObject {
+ public:
+ typedef JSNonFinalObject Base;
+
+ JSValue internalValue() const;
+ void setInternalValue(JSGlobalData&, JSValue);
+
+ static Structure* createStructure(JSGlobalData& globalData, JSGlobalObject* globalObject, JSValue prototype)
+ {
+ return Structure::create(globalData, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), &s_info);
+ }
+
protected:
- explicit JSWrapperObject(PassRefPtr<Structure>);
+ explicit JSWrapperObject(JSGlobalData&, Structure*);
+ static const unsigned StructureFlags = OverridesVisitChildren | JSNonFinalObject::StructureFlags;
+
+ static void visitChildren(JSCell*, SlotVisitor&);
- public:
- JSValuePtr internalValue() const { return m_internalValue; }
- void setInternalValue(JSValuePtr);
-
- virtual void mark();
-
private:
- JSValuePtr m_internalValue;
+ WriteBarrier<Unknown> m_internalValue;
};
-
- inline JSWrapperObject::JSWrapperObject(PassRefPtr<Structure> structure)
- : JSObject(structure)
- , m_internalValue(noValue())
+
+ inline JSWrapperObject::JSWrapperObject(JSGlobalData& globalData, Structure* structure)
+ : JSNonFinalObject(globalData, structure)
+ {
+ }
+
+ inline JSValue JSWrapperObject::internalValue() const
{
+ return m_internalValue.get();
}
-
- inline void JSWrapperObject::setInternalValue(JSValuePtr value)
+
+ inline void JSWrapperObject::setInternalValue(JSGlobalData& globalData, JSValue value)
{
ASSERT(value);
ASSERT(!value.isObject());
- m_internalValue = value;
+ m_internalValue.set(globalData, this, value);
}
} // namespace JSC