Changeset 37215 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Oct 2, 2008, 4:48:47 PM (17 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/ExecState.h
r37125 r37215 83 83 static const HashTable* stringTable(ExecState* exec) { return exec->m_globalData->stringTable; } 84 84 85 Heap* heap() const { return m_globalData->heap; }85 Heap* heap() const { return &m_globalData->heap; } 86 86 87 87 private: -
trunk/JavaScriptCore/kjs/JSGlobalData.cpp
r37190 r37215 59 59 JSGlobalData::JSGlobalData(bool isShared) 60 60 : machine(new Machine) 61 , heap(new Heap(this))62 61 #if ENABLE(JSC_MULTIPLE_THREADS) 63 62 , arrayTable(new HashTable(JSC::arrayTable)) … … 90 89 , isSharedInstance(isShared) 91 90 , clientData(0) 91 , heap(this) 92 92 { 93 93 } … … 95 95 JSGlobalData::~JSGlobalData() 96 96 { 97 delete heap;97 heap.destroy(); 98 98 delete machine; 99 99 #ifndef NDEBUG 100 100 // Zeroing out to make the behavior more predictable when someone attempts to use a deleted instance. 101 heap = 0;102 101 machine = 0; 103 102 #endif -
trunk/JavaScriptCore/kjs/JSGlobalData.h
r37190 r37215 31 31 32 32 #include <wtf/Forward.h> 33 #include <wtf/HashCountedSet.h>34 33 #include <wtf/HashMap.h> 35 #include <wtf/HashSet.h>36 34 #include <wtf/RefCounted.h> 35 #include "collector.h" 37 36 #include "SmallStrings.h" 38 37 … … 65 64 66 65 Machine* machine; 67 Heap* heap;68 66 69 67 const HashTable* arrayTable; … … 105 103 HashSet<JSObject*> arrayVisitedElements; 106 104 105 Heap heap; 106 107 107 private: 108 108 JSGlobalData(bool isShared = false); -
trunk/JavaScriptCore/kjs/JSGlobalObject.cpp
r37213 r37215 360 360 RegisterFile& registerFile = globalData()->machine->registerFile(); 361 361 if (registerFile.globalObject() == this) 362 registerFile.markGlobals( globalData()->heap);362 registerFile.markGlobals(&globalData()->heap); 363 363 364 364 markIfNeeded(d()->globalExec->exception()); … … 449 449 { 450 450 #ifdef JAVASCRIPTCORE_BUILDING_ALL_IN_ONE_FILE 451 return globalData->heap ->inlineAllocate(size);451 return globalData->heap.inlineAllocate(size); 452 452 #else 453 return globalData->heap ->allocate(size);453 return globalData->heap.allocate(size); 454 454 #endif 455 455 } -
trunk/JavaScriptCore/kjs/collector.cpp
r36263 r37215 124 124 , m_globalData(globalData) 125 125 { 126 ASSERT(globalData); 127 126 128 #if ENABLE(JSC_MULTIPLE_THREADS) 127 129 int error = pthread_key_create(&m_currentThreadRegistrar, unregisterThread); … … 136 138 Heap::~Heap() 137 139 { 140 // The destroy function must already have been called, so assert this. 141 ASSERT(!m_globalData); 142 } 143 144 void Heap::destroy() 145 { 138 146 JSLock lock(false); 139 147 140 // The global object is not GC protected at this point, so sweeping may delete it (and thus the global data) 141 // before other objects that may use the global data. 148 if (!m_globalData) 149 return; 150 151 // The global object is not GC protected at this point, so sweeping may delete it 152 // (and thus the global data) before other objects that may use the global data. 142 153 RefPtr<JSGlobalData> protect(m_globalData); 143 154 … … 167 178 } 168 179 #endif 180 181 m_globalData = 0; 169 182 } 170 183 -
trunk/JavaScriptCore/kjs/collector.h
r36263 r37215 64 64 class Thread; 65 65 enum HeapType { PrimaryHeap, NumberHeap }; 66 67 void destroy(); 66 68 67 69 #ifdef JAVASCRIPTCORE_BUILDING_ALL_IN_ONE_FILE … … 79 81 bool isBusy(); // true if an allocation or collection is in progress 80 82 81 ~Heap();82 83 83 static const size_t minExtraCostSize = 256; 84 84 … … 119 119 friend class JSGlobalData; 120 120 Heap(JSGlobalData*); 121 ~Heap(); 121 122 122 123 void recordExtraCost(size_t);
Note:
See TracChangeset
for help on using the changeset viewer.