Changeset 447 for trunk/JavaScriptCore/kjs/JSGlobalData.cpp
- Timestamp:
- 08/20/08 13:23:52 (5 months ago)
- Files:
-
- trunk/JavaScriptCore/kjs/JSGlobalData.cpp (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/JavaScriptCore/kjs/JSGlobalData.cpp
r427 r447 33 33 #include "CommonIdentifiers.h" 34 34 #include "JSClassRef.h" 35 #include "JSLock.h" 35 36 #include "Machine.h" 36 37 #include "Parser.h" … … 56 57 extern const HashTable stringTable; 57 58 58 JSGlobalData::JSGlobalData( )59 JSGlobalData::JSGlobalData(bool isShared) 59 60 : machine(new Machine) 60 61 , heap(new Heap(this)) … … 85 86 , parser(new Parser) 86 87 , head(0) 88 , isSharedInstance(isShared) 87 89 { 88 90 } … … 91 93 { 92 94 delete heap; 93 heap = 0; // zeroing out to make the behavior more predictable when someone attempts to use a deleted instance.94 95 delete machine; 96 #ifndef NDEBUG 97 // Zeroing out to make the behavior more predictable when someone attempts to use a deleted instance. 98 heap = 0; 95 99 machine = 0; 100 #endif 96 101 97 102 #if ENABLE(JSC_MULTIPLE_THREADS) … … 118 123 delete opaqueJSClassData; 119 124 125 delete emptyList; 126 120 127 delete propertyNames; 121 128 deleteIdentifierTable(identifierTable); … … 130 137 } 131 138 139 bool JSGlobalData::sharedInstanceExists() 140 { 141 return sharedInstanceInternal(); 132 142 } 143 144 JSGlobalData& JSGlobalData::sharedInstance() 145 { 146 JSGlobalData*& instance = sharedInstanceInternal(); 147 if (!instance) 148 instance = new JSGlobalData(true); 149 return *instance; 150 } 151 152 JSGlobalData*& JSGlobalData::sharedInstanceInternal() 153 { 154 ASSERT(JSLock::currentThreadIsHoldingLock()); 155 static JSGlobalData* sharedInstance; 156 return sharedInstance; 157 } 158 159 }
