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

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

Clean up ArgList to be a trivial type

Reviewed by Gavin Barraclough

Separate out old ArgList logic to handle buffering and marking arguments
into a distinct MarkedArgumentBuffer type. ArgList becomes a trivial
struct of a pointer and length.

  • Property svn:eol-style set to native
File size: 5.0 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 "Collector.h"
33#include "ExecutableAllocator.h"
34#include "JITStubs.h"
35#include "JSValue.h"
36#include "SmallStrings.h"
37#include "TimeoutChecker.h"
38#include <wtf/Forward.h>
39#include <wtf/HashMap.h>
40#include <wtf/RefCounted.h>
41
42struct OpaqueJSClass;
43struct OpaqueJSClassContextData;
44
45namespace JSC {
46
47 class ArgList;
48 class CommonIdentifiers;
49 class Heap;
50 class IdentifierTable;
51 class Instruction;
52 class Interpreter;
53 class JSGlobalObject;
54 class JSObject;
55 class Lexer;
56 class Parser;
57 class ParserRefCounted;
58 class ScopeNode;
59 class Structure;
60 class UString;
61 struct HashTable;
62 struct VPtrSet;
63
64 class JSGlobalData : public RefCounted<JSGlobalData> {
65 public:
66 struct ClientData {
67 virtual ~ClientData() = 0;
68 };
69
70 static bool sharedInstanceExists();
71 static JSGlobalData& sharedInstance();
72
73 static PassRefPtr<JSGlobalData> create(bool isShared = false);
74 static PassRefPtr<JSGlobalData> createLeaked();
75 ~JSGlobalData();
76
77#if ENABLE(JSC_MULTIPLE_THREADS)
78 // Will start tracking threads that use the heap, which is resource-heavy.
79 void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); }
80#endif
81
82 bool isSharedInstance;
83 ClientData* clientData;
84
85 const HashTable* arrayTable;
86 const HashTable* dateTable;
87 const HashTable* mathTable;
88 const HashTable* numberTable;
89 const HashTable* regExpTable;
90 const HashTable* regExpConstructorTable;
91 const HashTable* stringTable;
92
93 RefPtr<Structure> activationStructure;
94 RefPtr<Structure> interruptedExecutionErrorStructure;
95 RefPtr<Structure> staticScopeStructure;
96 RefPtr<Structure> stringStructure;
97 RefPtr<Structure> notAnObjectErrorStubStructure;
98 RefPtr<Structure> notAnObjectStructure;
99#if !USE(ALTERNATE_JSIMMEDIATE)
100 RefPtr<Structure> numberStructure;
101#endif
102
103 void* jsArrayVPtr;
104 void* jsByteArrayVPtr;
105 void* jsStringVPtr;
106 void* jsFunctionVPtr;
107
108 IdentifierTable* identifierTable;
109 CommonIdentifiers* propertyNames;
110 const MarkedArgumentBuffer* 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.
111 SmallStrings smallStrings;
112
113#if ENABLE(ASSEMBLER)
114 ExecutableAllocator executableAllocator;
115#endif
116
117 Lexer* lexer;
118 Parser* parser;
119 Interpreter* interpreter;
120#if ENABLE(JIT)
121 JITStubs jitStubs;
122#endif
123 TimeoutChecker timeoutChecker;
124 Heap heap;
125
126 JSValuePtr exception;
127#if ENABLE(JIT)
128 void* exceptionLocation;
129#endif
130
131 const Vector<Instruction>& numericCompareFunction(ExecState*);
132 Vector<Instruction> lazyNumericCompareFunction;
133 bool initializingLazyNumericCompareFunction;
134
135 HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
136
137 HashSet<ParserRefCounted*>* newParserObjects;
138 HashCountedSet<ParserRefCounted*>* parserObjectExtraRefCounts;
139
140 JSGlobalObject* head;
141 JSGlobalObject* dynamicGlobalObject;
142
143 HashSet<JSObject*> arrayVisitedElements;
144
145 ScopeNode* scopeNodeBeingReparsed;
146
147 private:
148 JSGlobalData(bool isShared, const VPtrSet&);
149 static JSGlobalData*& sharedInstanceInternal();
150 };
151} // namespace JSC
152
153#endif // JSGlobalData_h
Note: See TracBrowser for help on using the repository browser.