Changeset 2822 in webkit for trunk/JavaScriptCore/kjs/collector.cpp
- Timestamp:
- Nov 22, 2002, 12:13:09 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/collector.cpp
r2788 r2822 161 161 { 162 162 bool deleted = false; 163 // MARK: first unmark everything 164 for (int block = 0; block < heap.usedBlocks; block++) { 165 for (int cell = 0; cell < CELLS_PER_BLOCK; cell++) { 166 ((ValueImp *)(heap.blocks[block]->cells + cell))->_flags &= ~ValueImp::VI_MARKED; 167 } 168 } 169 for (int cell = 0; cell < heap.usedOversizeCells; cell++) { 170 ((ValueImp *)heap.oversizeCells[cell])->_flags &= ~ValueImp::VI_MARKED; 171 } 172 173 // mark all referenced objects recursively 163 164 // MARK: first mark all referenced objects recursively 174 165 // starting out from the set of root objects 175 166 if (InterpreterImp::s_hook) { … … 205 196 } 206 197 } 207 208 // SWEEP: delete everything with a zero refcount (garbage) 198 199 // SWEEP: delete everything with a zero refcount (garbage) and unmark everything else 209 200 210 201 int emptyBlocks = 0; … … 214 205 uint32_t word = heap.blocks[block]->bitmap[wordInBitmap]; 215 206 for (int bitInWord = 0; bitInWord < BITS_PER_WORD; bitInWord++) { 207 208 if (word & (1 << bitInWord)) { 216 209 ValueImp *imp = (ValueImp *)(heap.blocks[block]->cells + BITS_PER_WORD * wordInBitmap + bitInWord); 217 218 if ((word & (1 << bitInWord)) && 219 !imp->refcount && imp->_flags == (ValueImp::VI_GCALLOWED | ValueImp::VI_CREATED)) { 220 // emulate destructing part of 'operator delete()' 221 //fprintf( stderr, "Collector::deleting ValueImp %p (%s)\n", (void*)imp, typeid(*imp).name()); 222 imp->~ValueImp(); 223 heap.blocks[block]->bitmap[wordInBitmap] &= ~(1 << bitInWord); 224 heap.blocks[block]->usedCells--; 225 heap.numLiveObjects--; 226 deleted = true; 210 if (!imp->refcount && imp->_flags == (ValueImp::VI_GCALLOWED | ValueImp::VI_CREATED)) { 211 //fprintf( stderr, "Collector::deleting ValueImp %p (%s)\n", (void*)imp, typeid(*imp).name()); 212 // emulate destructing part of 'operator delete()' 213 imp->~ValueImp(); 214 heap.blocks[block]->bitmap[wordInBitmap] &= ~(1 << bitInWord); 215 heap.blocks[block]->usedCells--; 216 heap.numLiveObjects--; 217 deleted = true; 218 } else { 219 imp->_flags &= ~ValueImp::VI_MARKED; 220 } 227 221 } 228 222 } … … 246 240 } 247 241 } 248 249 242 250 243 … … 272 265 273 266 } else { 267 imp->_flags &= ~ValueImp::VI_MARKED; 274 268 cell++; 275 269 }
Note:
See TracChangeset
for help on using the changeset viewer.