source:
webkit/trunk/JavaScriptCore/runtime/JSGlobalData.h@
39851
Last change on this file since 39851 was 39670, checked in by [email protected], 16 years ago | |
---|---|
2009-01-05 Gavin Barraclough <[email protected]>
JavaScriptGlue:
2009-01-05 Gavin Barraclough <[email protected]>
WebCore:
2009-01-05 Gavin Barraclough <[email protected]>
WebKit/mac:
2009-01-05 Gavin Barraclough <[email protected]>
|
|
|
|
File size: 4.5 KB |
Line | |
---|---|
1 | /* |
2 | * Copyright (C) 2008 Apple Inc. All rights reserved. |
3 | * |
4 | * Redistribution and use in source and binary forms, with or without |
5 | * modification, are permitted provided that the following conditions |
6 | * are met: |
7 | * |
8 | * 1. Redistributions of source code must retain the above copyright |
9 | * notice, this list of conditions and the following disclaimer. |
10 | * 2. Redistributions in binary form must reproduce the above copyright |
11 | * notice, this list of conditions and the following disclaimer in the |
12 | * documentation and/or other materials provided with the distribution. |
13 | * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of |
14 | * its contributors may be used to endorse or promote products derived |
15 | * from this software without specific prior written permission. |
16 | * |
17 | * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY |
18 | * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
19 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
20 | * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY |
21 | * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
22 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
23 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
24 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF |
26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
27 | */ |
28 | |
29 | #ifndef JSGlobalData_h |
30 | #define JSGlobalData_h |
31 | |
32 | #include <wtf/Forward.h> |
33 | #include <wtf/HashMap.h> |
34 | #include <wtf/RefCounted.h> |
35 | #include "Collector.h" |
36 | #include "ExecutableAllocator.h" |
37 | #include "SmallStrings.h" |
38 | #include "JSValue.h" |
39 | |
40 | struct OpaqueJSClass; |
41 | struct OpaqueJSClassContextData; |
42 | |
43 | namespace JSC { |
44 | |
45 | class ArgList; |
46 | class CommonIdentifiers; |
47 | class Heap; |
48 | class IdentifierTable; |
49 | class JSGlobalObject; |
50 | class JSObject; |
51 | class Lexer; |
52 | class Interpreter; |
53 | class Parser; |
54 | class ParserRefCounted; |
55 | class Structure; |
56 | class UString; |
57 | struct HashTable; |
58 | |
59 | class JSGlobalData : public RefCounted<JSGlobalData> { |
60 | public: |
61 | static bool sharedInstanceExists(); |
62 | static JSGlobalData& sharedInstance(); |
63 | |
64 | static PassRefPtr<JSGlobalData> create(); |
65 | static PassRefPtr<JSGlobalData> createLeaked(); |
66 | ~JSGlobalData(); |
67 | |
68 | #if ENABLE(JSC_MULTIPLE_THREADS) |
69 | // Will start tracking threads that use the heap, which is resource-heavy. |
70 | void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); } |
71 | #endif |
72 | |
73 | Interpreter* interpreter; |
74 | |
75 | JSValuePtr exception; |
76 | #if ENABLE(JIT) |
77 | void* exceptionLocation; |
78 | #endif |
79 | |
80 | const HashTable* arrayTable; |
81 | const HashTable* dateTable; |
82 | const HashTable* mathTable; |
83 | const HashTable* numberTable; |
84 | const HashTable* regExpTable; |
85 | const HashTable* regExpConstructorTable; |
86 | const HashTable* stringTable; |
87 | |
88 | RefPtr<Structure> activationStructure; |
89 | RefPtr<Structure> interruptedExecutionErrorStructure; |
90 | RefPtr<Structure> staticScopeStructure; |
91 | RefPtr<Structure> stringStructure; |
92 | RefPtr<Structure> notAnObjectErrorStubStructure; |
93 | RefPtr<Structure> notAnObjectStructure; |
94 | RefPtr<Structure> numberStructure; |
95 | |
96 | IdentifierTable* identifierTable; |
97 | CommonIdentifiers* propertyNames; |
98 | const ArgList* emptyList; // Lists are supposed to be allocated on the stack to have their elements properly marked, which is not the case here - but this list has nothing to mark. |
99 | |
100 | SmallStrings smallStrings; |
101 | |
102 | HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData; |
103 | |
104 | HashSet<ParserRefCounted*>* newParserObjects; |
105 | HashCountedSet<ParserRefCounted*>* parserObjectExtraRefCounts; |
106 | |
107 | Lexer* lexer; |
108 | Parser* parser; |
109 | |
110 | JSGlobalObject* head; |
111 | JSGlobalObject* dynamicGlobalObject; |
112 | |
113 | bool isSharedInstance; |
114 | |
115 | struct ClientData { |
116 | virtual ~ClientData() = 0; |
117 | }; |
118 | |
119 | ClientData* clientData; |
120 | |
121 | HashSet<JSObject*> arrayVisitedElements; |
122 | |
123 | Heap heap; |
124 | #if ENABLE(ASSEMBLER) |
125 | PassRefPtr<ExecutablePool> poolForSize(size_t n) { return m_executableAllocator.poolForSize(n); } |
126 | #endif |
127 | private: |
128 | JSGlobalData(bool isShared = false); |
129 | #if ENABLE(ASSEMBLER) |
130 | ExecutableAllocator m_executableAllocator; |
131 | #endif |
132 | |
133 | static JSGlobalData*& sharedInstanceInternal(); |
134 | }; |
135 | |
136 | } |
137 | |
138 | #endif |