]>
git.saurik.com Git - apple/javascriptcore.git/blob - runtime/JSWrapperObject.h
89726486584f40753525a5d9a8201480c73d01f3
2 * Copyright (C) 2006 Maks Orlovich
3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Library General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Library General Public License for more details.
15 * You should have received a copy of the GNU Library General Public License
16 * along with this library; see the file COPYING.LIB. If not, write to
17 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
18 * Boston, MA 02110-1301, USA.
22 #ifndef JSWrapperObject_h
23 #define JSWrapperObject_h
29 // This class is used as a base for classes such as String,
30 // Number, Boolean and Date which are wrappers for primitive types.
31 class JSWrapperObject
: public JSNonFinalObject
{
33 explicit JSWrapperObject(JSGlobalData
&, Structure
*);
36 JSValue
internalValue() const;
37 void setInternalValue(JSGlobalData
&, JSValue
);
39 static Structure
* createStructure(JSGlobalData
& globalData
, JSValue prototype
)
41 return Structure::create(globalData
, prototype
, TypeInfo(ObjectType
, StructureFlags
), AnonymousSlotCount
, &s_info
);
45 static const unsigned StructureFlags
= OverridesVisitChildren
| JSNonFinalObject::StructureFlags
;
48 virtual void visitChildren(SlotVisitor
&);
50 WriteBarrier
<Unknown
> m_internalValue
;
53 inline JSWrapperObject::JSWrapperObject(JSGlobalData
& globalData
, Structure
* structure
)
54 : JSNonFinalObject(globalData
, structure
)
58 inline JSValue
JSWrapperObject::internalValue() const
60 return m_internalValue
.get();
63 inline void JSWrapperObject::setInternalValue(JSGlobalData
& globalData
, JSValue value
)
66 ASSERT(!value
.isObject());
67 m_internalValue
.set(globalData
, this, value
);
72 #endif // JSWrapperObject_h