Changeset 35853 in webkit for trunk/JavaScriptCore/kjs/JSGlobalData.cpp
- Timestamp:
- Aug 20, 2008, 12:23:06 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/JSGlobalData.cpp
r35815 r35853 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) … … 132 137 } 133 138 139 bool JSGlobalData::sharedInstanceExists() 140 { 141 return sharedInstanceInternal(); 134 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 }
Note:
See TracChangeset
for help on using the changeset viewer.