source: webkit/trunk/JavaScriptCore/runtime/JSGlobalData.h@ 39087

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

Put ENABLE(ASSEMBLER) guards around use of ExecutableAllocator in global data
Correct Qt and Gtk project files

  • Property svn:eol-style set to native
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
39struct OpaqueJSClass;
40struct OpaqueJSClassContextData;
41
42namespace JSC {
43
44 class ArgList;
45 class CommonIdentifiers;
46 class Heap;
47 class IdentifierTable;
48 class JSGlobalObject;
49 class JSObject;
50 class Lexer;
51 class Interpreter;
52 class Parser;
53 class ParserRefCounted;
54 class Structure;
55 class UString;
56 struct HashTable;
57
58 class JSGlobalData : public RefCounted<JSGlobalData> {
59 public:
60 static bool sharedInstanceExists();
61 static JSGlobalData& sharedInstance();
62
63 static PassRefPtr<JSGlobalData> create();
64 static PassRefPtr<JSGlobalData> createLeaked();
65 ~JSGlobalData();
66
67#if ENABLE(JSC_MULTIPLE_THREADS)
68 // Will start tracking threads that use the heap, which is resource-heavy.
69 void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); }
70#endif
71
72 Interpreter* interpreter;
73
74 JSValue* exception;
75#if ENABLE(JIT)
76 void* exceptionLocation;
77#endif
78
79 const HashTable* arrayTable;
80 const HashTable* dateTable;
81 const HashTable* mathTable;
82 const HashTable* numberTable;
83 const HashTable* regExpTable;
84 const HashTable* regExpConstructorTable;
85 const HashTable* stringTable;
86
87 RefPtr<Structure> activationStructure;
88 RefPtr<Structure> interruptedExecutionErrorStructure;
89 RefPtr<Structure> staticScopeStructure;
90 RefPtr<Structure> stringStructure;
91 RefPtr<Structure> notAnObjectErrorStubStructure;
92 RefPtr<Structure> notAnObjectStructure;
93 RefPtr<Structure> numberStructure;
94
95 IdentifierTable* identifierTable;
96 CommonIdentifiers* propertyNames;
97 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.
98
99 SmallStrings smallStrings;
100
101 HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
102
103 HashSet<ParserRefCounted*>* newParserObjects;
104 HashCountedSet<ParserRefCounted*>* parserObjectExtraRefCounts;
105
106 Lexer* lexer;
107 Parser* parser;
108
109 JSGlobalObject* head;
110 JSGlobalObject* dynamicGlobalObject;
111
112 bool isSharedInstance;
113
114 struct ClientData {
115 virtual ~ClientData() = 0;
116 };
117
118 ClientData* clientData;
119
120 HashSet<JSObject*> arrayVisitedElements;
121
122 Heap heap;
123#if ENABLE(ASSEMBLER)
124 PassRefPtr<ExecutablePool> poolForSize(size_t n) { return m_executableAllocator.poolForSize(n); }
125#endif
126 private:
127 JSGlobalData(bool isShared = false);
128#if ENABLE(ASSEMBLER)
129 ExecutableAllocator m_executableAllocator;
130#endif
131
132 static JSGlobalData*& sharedInstanceInternal();
133 };
134
135}
136
137#endif
Note: See TracBrowser for help on using the repository browser.