~oif-team/ubuntu/natty/qt4-x11/xi2.1

« back to all changes in this revision

Viewing changes to src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSGlobalData.h

  • Committer: Bazaar Package Importer
  • Author(s): Alessandro Ghersi
  • Date: 2009-11-02 18:30:08 UTC
  • mfrom: (1.2.2 upstream)
  • mto: (15.2.5 experimental)
  • mto: This revision was merged to the branch mainline in revision 88.
  • Revision ID: james.westby@ubuntu.com-20091102183008-b6a4gcs128mvfb3m
Tags: upstream-4.6.0~beta1
ImportĀ upstreamĀ versionĀ 4.6.0~beta1

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (C) 2008, 2009 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 "MarkStack.h"
 
37
#include "NumericStrings.h"
 
38
#include "SmallStrings.h"
 
39
#include "TimeoutChecker.h"
 
40
#include <wtf/Forward.h>
 
41
#include <wtf/HashMap.h>
 
42
#include <wtf/RefCounted.h>
 
43
 
 
44
struct OpaqueJSClass;
 
45
struct OpaqueJSClassContextData;
 
46
 
 
47
namespace JSC {
 
48
 
 
49
    class CodeBlock;
 
50
    class CommonIdentifiers;
 
51
    class IdentifierTable;
 
52
    class Interpreter;
 
53
    class JSGlobalObject;
 
54
    class JSObject;
 
55
    class Lexer;
 
56
    class Parser;
 
57
    class Stringifier;
 
58
    class Structure;
 
59
    class UString;
 
60
 
 
61
    struct HashTable;
 
62
    struct Instruction;    
 
63
    struct VPtrSet;
 
64
 
 
65
    class JSGlobalData : public RefCounted<JSGlobalData> {
 
66
    public:
 
67
        struct ClientData {
 
68
            virtual ~ClientData() = 0;
 
69
#ifdef QT_BUILD_SCRIPT_LIB
 
70
            virtual void mark(MarkStack&) {}
 
71
#endif
 
72
        };
 
73
 
 
74
        static bool sharedInstanceExists();
 
75
        static JSGlobalData& sharedInstance();
 
76
 
 
77
        static PassRefPtr<JSGlobalData> create(bool isShared = false);
 
78
        static PassRefPtr<JSGlobalData> createLeaked();
 
79
        ~JSGlobalData();
 
80
 
 
81
#if ENABLE(JSC_MULTIPLE_THREADS)
 
82
        // Will start tracking threads that use the heap, which is resource-heavy.
 
83
        void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThreads(); }
 
84
#endif
 
85
 
 
86
        bool isSharedInstance;
 
87
        ClientData* clientData;
 
88
 
 
89
        const HashTable* arrayTable;
 
90
        const HashTable* dateTable;
 
91
        const HashTable* jsonTable;
 
92
        const HashTable* mathTable;
 
93
        const HashTable* numberTable;
 
94
        const HashTable* regExpTable;
 
95
        const HashTable* regExpConstructorTable;
 
96
        const HashTable* stringTable;
 
97
        
 
98
        RefPtr<Structure> activationStructure;
 
99
        RefPtr<Structure> interruptedExecutionErrorStructure;
 
100
        RefPtr<Structure> staticScopeStructure;
 
101
        RefPtr<Structure> stringStructure;
 
102
        RefPtr<Structure> notAnObjectErrorStubStructure;
 
103
        RefPtr<Structure> notAnObjectStructure;
 
104
        RefPtr<Structure> propertyNameIteratorStructure;
 
105
        RefPtr<Structure> getterSetterStructure;
 
106
        RefPtr<Structure> apiWrapperStructure;
 
107
 
 
108
#if USE(JSVALUE32)
 
109
        RefPtr<Structure> numberStructure;
 
110
#endif
 
111
 
 
112
        void* jsArrayVPtr;
 
113
        void* jsByteArrayVPtr;
 
114
        void* jsStringVPtr;
 
115
        void* jsFunctionVPtr;
 
116
 
 
117
        IdentifierTable* identifierTable;
 
118
        CommonIdentifiers* propertyNames;
 
119
        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.
 
120
        SmallStrings smallStrings;
 
121
        NumericStrings numericStrings;
 
122
 
 
123
#if ENABLE(ASSEMBLER)
 
124
        ExecutableAllocator executableAllocator;
 
125
#endif
 
126
 
 
127
        Lexer* lexer;
 
128
        Parser* parser;
 
129
        Interpreter* interpreter;
 
130
#if ENABLE(JIT)
 
131
        JITThunks jitStubs;
 
132
#endif
 
133
        TimeoutChecker* timeoutChecker;
 
134
        Heap heap;
 
135
 
 
136
        JSValue exception;
 
137
#if ENABLE(JIT)
 
138
        ReturnAddressPtr exceptionLocation;
 
139
#endif
 
140
 
 
141
        const Vector<Instruction>& numericCompareFunction(ExecState*);
 
142
        Vector<Instruction> lazyNumericCompareFunction;
 
143
        bool initializingLazyNumericCompareFunction;
 
144
 
 
145
        HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData;
 
146
 
 
147
        JSGlobalObject* head;
 
148
        JSGlobalObject* dynamicGlobalObject;
 
149
 
 
150
        HashSet<JSObject*> arrayVisitedElements;
 
151
 
 
152
        CodeBlock* functionCodeBlockBeingReparsed;
 
153
        Stringifier* firstStringifierToMark;
 
154
 
 
155
        MarkStack markStack;
 
156
 
 
157
#ifndef NDEBUG
 
158
        bool mainThreadOnly;
 
159
#endif
 
160
 
 
161
    private:
 
162
        JSGlobalData(bool isShared, const VPtrSet&);
 
163
        static JSGlobalData*& sharedInstanceInternal();
 
164
        void createNativeThunk();
 
165
    };
 
166
 
 
167
} // namespace JSC
 
168
 
 
169
#endif // JSGlobalData_h