| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All rights reserved. | 2 * Copyright (C) 2008 Apple Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * | 7 * |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 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 | 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. | 26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 27 */ | 27 */ |
| 28 | 28 |
| 29 #ifndef JSGlobalData_h | 29 #ifndef JSGlobalData_h |
| 30 #define JSGlobalData_h | 30 #define JSGlobalData_h |
| 31 | 31 |
| 32 #include "Collector.h" | 32 #include "Collector.h" |
| 33 #include "ExecutableAllocator.h" | 33 #include "ExecutableAllocator.h" |
| 34 #include "JITStubs.h" |
| 34 #include "JSValue.h" | 35 #include "JSValue.h" |
| 35 #include "SmallStrings.h" | 36 #include "SmallStrings.h" |
| 36 #include "TimeoutChecker.h" | 37 #include "TimeoutChecker.h" |
| 37 #include <wtf/Forward.h> | 38 #include <wtf/Forward.h> |
| 38 #include <wtf/HashMap.h> | 39 #include <wtf/HashMap.h> |
| 39 #include <wtf/RefCounted.h> | 40 #include <wtf/RefCounted.h> |
| 40 | 41 |
| 41 struct OpaqueJSClass; | 42 struct OpaqueJSClass; |
| 42 struct OpaqueJSClassContextData; | 43 struct OpaqueJSClassContextData; |
| 43 | 44 |
| 44 namespace JSC { | 45 namespace JSC { |
| 45 | 46 |
| 46 class ArgList; | 47 class ArgList; |
| 47 class CommonIdentifiers; | 48 class CommonIdentifiers; |
| 48 class Heap; | 49 class Heap; |
| 49 class IdentifierTable; | 50 class IdentifierTable; |
| 50 class Instruction; | 51 class Instruction; |
| 51 class Interpreter; | 52 class Interpreter; |
| 52 class JSGlobalObject; | 53 class JSGlobalObject; |
| 53 class JSObject; | 54 class JSObject; |
| 54 class Lexer; | 55 class Lexer; |
| 55 class Parser; | 56 class Parser; |
| 56 class ParserRefCounted; | 57 class ParserRefCounted; |
| 57 class ScopeNode; | 58 class ScopeNode; |
| 58 class Structure; | 59 class Structure; |
| 59 class UString; | 60 class UString; |
| 60 struct HashTable; | 61 struct HashTable; |
| 62 struct VPtrSet; |
| 61 | 63 |
| 62 class JSGlobalData : public RefCounted<JSGlobalData> { | 64 class JSGlobalData : public RefCounted<JSGlobalData> { |
| 63 public: | 65 public: |
| 64 struct ClientData { | 66 struct ClientData { |
| 65 virtual ~ClientData() = 0; | 67 virtual ~ClientData() = 0; |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 static bool sharedInstanceExists(); | 70 static bool sharedInstanceExists(); |
| 69 static JSGlobalData& sharedInstance(); | 71 static JSGlobalData& sharedInstance(); |
| 70 | 72 |
| 71 static PassRefPtr<JSGlobalData> create(); | 73 static PassRefPtr<JSGlobalData> create(bool isShared = false); |
| 72 static PassRefPtr<JSGlobalData> createLeaked(); | 74 static PassRefPtr<JSGlobalData> createLeaked(); |
| 73 ~JSGlobalData(); | 75 ~JSGlobalData(); |
| 74 | 76 |
| 75 #if ENABLE(JSC_MULTIPLE_THREADS) | 77 #if ENABLE(JSC_MULTIPLE_THREADS) |
| 76 // Will start tracking threads that use the heap, which is resource-heav
y. | 78 // Will start tracking threads that use the heap, which is resource-heav
y. |
| 77 void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThread
s(); } | 79 void makeUsableFromMultipleThreads() { heap.makeUsableFromMultipleThread
s(); } |
| 78 #endif | 80 #endif |
| 79 | 81 |
| 80 bool isSharedInstance; | 82 bool isSharedInstance; |
| 81 ClientData* clientData; | 83 ClientData* clientData; |
| 82 | 84 |
| 83 Interpreter* interpreter; | |
| 84 TimeoutChecker timeoutChecker; | |
| 85 | |
| 86 JSValuePtr exception; | |
| 87 #if ENABLE(JIT) | |
| 88 void* exceptionLocation; | |
| 89 #endif | |
| 90 | |
| 91 const Vector<Instruction>& numericCompareFunction(ExecState*); | |
| 92 Vector<Instruction> lazyNumericCompareFunction; | |
| 93 bool initializingLazyNumericCompareFunction; | |
| 94 | |
| 95 const HashTable* arrayTable; | 85 const HashTable* arrayTable; |
| 96 const HashTable* dateTable; | 86 const HashTable* dateTable; |
| 97 const HashTable* mathTable; | 87 const HashTable* mathTable; |
| 98 const HashTable* numberTable; | 88 const HashTable* numberTable; |
| 99 const HashTable* regExpTable; | 89 const HashTable* regExpTable; |
| 100 const HashTable* regExpConstructorTable; | 90 const HashTable* regExpConstructorTable; |
| 101 const HashTable* stringTable; | 91 const HashTable* stringTable; |
| 102 | 92 |
| 103 RefPtr<Structure> activationStructure; | 93 RefPtr<Structure> activationStructure; |
| 104 RefPtr<Structure> interruptedExecutionErrorStructure; | 94 RefPtr<Structure> interruptedExecutionErrorStructure; |
| 105 RefPtr<Structure> staticScopeStructure; | 95 RefPtr<Structure> staticScopeStructure; |
| 106 RefPtr<Structure> stringStructure; | 96 RefPtr<Structure> stringStructure; |
| 107 RefPtr<Structure> notAnObjectErrorStubStructure; | 97 RefPtr<Structure> notAnObjectErrorStubStructure; |
| 108 RefPtr<Structure> notAnObjectStructure; | 98 RefPtr<Structure> notAnObjectStructure; |
| 109 #if !USE(ALTERNATE_JSIMMEDIATE) | 99 #if !USE(ALTERNATE_JSIMMEDIATE) |
| 110 RefPtr<Structure> numberStructure; | 100 RefPtr<Structure> numberStructure; |
| 111 #endif | 101 #endif |
| 112 | 102 |
| 103 void* jsArrayVPtr; |
| 104 void* jsByteArrayVPtr; |
| 105 void* jsStringVPtr; |
| 106 void* jsFunctionVPtr; |
| 107 |
| 113 IdentifierTable* identifierTable; | 108 IdentifierTable* identifierTable; |
| 114 CommonIdentifiers* propertyNames; | 109 CommonIdentifiers* propertyNames; |
| 115 const ArgList* emptyList; // Lists are supposed to be allocated on the s
tack to have their elements properly marked, which is not the case here - but th
is list has nothing to mark. | 110 const ArgList* emptyList; // Lists are supposed to be allocated on the s
tack to have their elements properly marked, which is not the case here - but th
is list has nothing to mark. |
| 116 SmallStrings smallStrings; | 111 SmallStrings smallStrings; |
| 117 | 112 |
| 118 HashMap<OpaqueJSClass*, OpaqueJSClassContextData*> opaqueJSClassData; | 113 #if ENABLE(ASSEMBLER) |
| 114 ExecutableAllocator executableAllocator; |
| 115 #endif |
| 119 | 116 |
| 120 Lexer* lexer; | 117 Lexer* lexer; |
| 121 Parser* parser; | 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 |
| 122 HashSet<ParserRefCounted*>* newParserObjects; | 137 HashSet<ParserRefCounted*>* newParserObjects; |
| 123 HashCountedSet<ParserRefCounted*>* parserObjectExtraRefCounts; | 138 HashCountedSet<ParserRefCounted*>* parserObjectExtraRefCounts; |
| 124 | 139 |
| 125 JSGlobalObject* head; | 140 JSGlobalObject* head; |
| 126 JSGlobalObject* dynamicGlobalObject; | 141 JSGlobalObject* dynamicGlobalObject; |
| 127 | 142 |
| 128 HashSet<JSObject*> arrayVisitedElements; | 143 HashSet<JSObject*> arrayVisitedElements; |
| 129 | 144 |
| 130 ScopeNode* scopeNodeBeingReparsed; | 145 ScopeNode* scopeNodeBeingReparsed; |
| 131 | 146 |
| 132 Heap heap; | |
| 133 #if ENABLE(ASSEMBLER) | |
| 134 PassRefPtr<ExecutablePool> poolForSize(size_t n) { return m_executableAl
locator.poolForSize(n); } | |
| 135 #endif | |
| 136 | |
| 137 private: | 147 private: |
| 138 JSGlobalData(bool isShared = false); | 148 JSGlobalData(bool isShared, const VPtrSet&); |
| 139 #if ENABLE(ASSEMBLER) | |
| 140 ExecutableAllocator m_executableAllocator; | |
| 141 #endif | |
| 142 | |
| 143 static JSGlobalData*& sharedInstanceInternal(); | 149 static JSGlobalData*& sharedInstanceInternal(); |
| 144 }; | 150 }; |
| 145 } // namespace JSC | 151 } // namespace JSC |
| 146 | 152 |
| 147 #endif // JSGlobalData_h | 153 #endif // JSGlobalData_h |
| 148 | 154 |
| 149 | 155 |
| OLD | NEW |