]> git.saurik.com Git - apple/javascriptcore.git/blob - runtime/SymbolObject.h
JavaScriptCore-7601.1.46.3.tar.gz
[apple/javascriptcore.git] / runtime / SymbolObject.h
1 /*
2 * Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
3 * Copyright (C) 2007, 2008 Apple Inc. All rights reserved.
4 * Copyright (C) 2015 Yusuke Suzuki <utatane.tea@gmail.com>.
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
15 *
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
19 *
20 */
21
22 #ifndef SymbolObject_h
23 #define SymbolObject_h
24
25 #include "JSWrapperObject.h"
26 #include "Symbol.h"
27
28 namespace JSC {
29
30 class SymbolObject : public JSWrapperObject {
31 public:
32 typedef JSWrapperObject Base;
33
34 static SymbolObject* create(VM& vm, Structure* structure)
35 {
36 Symbol* symbol = Symbol::create(vm);
37 SymbolObject* object = new (NotNull, allocateCell<SymbolObject>(vm.heap)) SymbolObject(vm, structure);
38 object->finishCreation(vm, symbol);
39 return object;
40 }
41 static SymbolObject* create(VM& vm, Structure* structure, Symbol* symbol)
42 {
43 SymbolObject* object = new (NotNull, allocateCell<SymbolObject>(vm.heap)) SymbolObject(vm, structure);
44 object->finishCreation(vm, symbol);
45 return object;
46 }
47 static SymbolObject* create(VM&, JSGlobalObject*, Symbol*);
48
49 DECLARE_EXPORT_INFO;
50
51 Symbol* internalValue() const { return asSymbol(JSWrapperObject::internalValue());}
52
53 static Structure* createStructure(VM& vm, JSGlobalObject* globalObject, JSValue prototype)
54 {
55 return Structure::create(vm, globalObject, prototype, TypeInfo(ObjectType, StructureFlags), info());
56 }
57
58 static JSValue defaultValue(const JSObject*, ExecState*, PreferredPrimitiveType);
59
60 protected:
61 JS_EXPORT_PRIVATE void finishCreation(VM&, Symbol*);
62 JS_EXPORT_PRIVATE SymbolObject(VM&, Structure*);
63 };
64
65 } // namespace JSC
66
67 #endif // SymbolObject_h