source: webkit/trunk/JavaScriptCore/runtime/JSWrapperObject.h@ 50320

Last change on this file since 50320 was 49721, checked in by [email protected], 16 years ago

structure typeinfo flags should be inherited.
https://bugs.webkit.org/show_bug.cgi?id=30468

Reviewed by Gavin Barraclough.

Add StructureFlag constant to the various JSC classes and use
it for the TypeInfo construction. This allows us to simply
accumulate flags by basing each classes StructureInfo on its parents.

  • Property svn:eol-style set to native
File size: 2.1 KB
Line 
1/*
2 * Copyright (C) 2006 Maks Orlovich
3 * Copyright (C) 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
4 *
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.
9 *
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.
14 *
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.
19 *
20 */
21
22#ifndef JSWrapperObject_h
23#define JSWrapperObject_h
24
25#include "JSObject.h"
26
27namespace JSC {
28
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 JSObject {
32 protected:
33 explicit JSWrapperObject(NonNullPassRefPtr<Structure>);
34
35 public:
36 JSValue internalValue() const { return m_internalValue; }
37 void setInternalValue(JSValue);
38
39 static PassRefPtr<Structure> createStructure(JSValue prototype)
40 {
41 return Structure::create(prototype, TypeInfo(ObjectType, StructureFlags));
42 }
43
44 private:
45 virtual void markChildren(MarkStack&);
46
47 JSValue m_internalValue;
48 };
49
50 inline JSWrapperObject::JSWrapperObject(NonNullPassRefPtr<Structure> structure)
51 : JSObject(structure)
52 {
53 addAnonymousSlots(1);
54 putAnonymousValue(0, jsNull());
55 }
56
57 inline void JSWrapperObject::setInternalValue(JSValue value)
58 {
59 ASSERT(value);
60 ASSERT(!value.isObject());
61 m_internalValue = value;
62 putAnonymousValue(0, value);
63 }
64
65} // namespace JSC
66
67#endif // JSWrapperObject_h
Note: See TracBrowser for help on using the repository browser.