Commit f67a9641 authored by mjs's avatar mjs

- a simple change for .4% gain on ibench - instead of unmarking

	all objects at the start of collection, instead unmark as part of
	the sweep phase

        * kjs/collector.cpp:
        (Collector::collect): Remove separate unmarking pass and instead
	unmark the objects that don't get collected during the sweep
	phase.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2822 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 36614a72
2002-11-22 Maciej Stachowiak <mjs@apple.com>
- a simple change for .5% gain on ibench - instead of unmarking
all objects at the start of collection, instead unmark as part of
the sweep phase
* kjs/collector.cpp:
(Collector::collect): Remove separate unmarking pass and instead
unmark the objects that don't get collected during the sweep
phase.
2002-11-21 Darin Adler <darin@apple.com>
- stop garbage collecting the ActivationImp objects, gets 3% on iBench
......
2002-11-22 Maciej Stachowiak <mjs@apple.com>
- a simple change for .5% gain on ibench - instead of unmarking
all objects at the start of collection, instead unmark as part of
the sweep phase
* kjs/collector.cpp:
(Collector::collect): Remove separate unmarking pass and instead
unmark the objects that don't get collected during the sweep
phase.
2002-11-21 Darin Adler <darin@apple.com>
- stop garbage collecting the ActivationImp objects, gets 3% on iBench
......
2002-11-22 Maciej Stachowiak <mjs@apple.com>
- a simple change for .5% gain on ibench - instead of unmarking
all objects at the start of collection, instead unmark as part of
the sweep phase
* kjs/collector.cpp:
(Collector::collect): Remove separate unmarking pass and instead
unmark the objects that don't get collected during the sweep
phase.
2002-11-21 Darin Adler <darin@apple.com>
- stop garbage collecting the ActivationImp objects, gets 3% on iBench
......
......@@ -160,17 +160,8 @@ void* Collector::allocate(size_t s)
bool Collector::collect()
{
bool deleted = false;
// MARK: first unmark everything
for (int block = 0; block < heap.usedBlocks; block++) {
for (int cell = 0; cell < CELLS_PER_BLOCK; cell++) {
((ValueImp *)(heap.blocks[block]->cells + cell))->_flags &= ~ValueImp::VI_MARKED;
}
}
for (int cell = 0; cell < heap.usedOversizeCells; cell++) {
((ValueImp *)heap.oversizeCells[cell])->_flags &= ~ValueImp::VI_MARKED;
}
// mark all referenced objects recursively
// MARK: first mark all referenced objects recursively
// starting out from the set of root objects
if (InterpreterImp::s_hook) {
InterpreterImp *scr = InterpreterImp::s_hook;
......@@ -204,8 +195,8 @@ bool Collector::collect()
imp->mark();
}
}
// SWEEP: delete everything with a zero refcount (garbage)
// SWEEP: delete everything with a zero refcount (garbage) and unmark everything else
int emptyBlocks = 0;
......@@ -213,17 +204,20 @@ bool Collector::collect()
for (int wordInBitmap = 0; wordInBitmap < BITMAP_SIZE; wordInBitmap++) {
uint32_t word = heap.blocks[block]->bitmap[wordInBitmap];
for (int bitInWord = 0; bitInWord < BITS_PER_WORD; bitInWord++) {
ValueImp *imp = (ValueImp *)(heap.blocks[block]->cells + BITS_PER_WORD * wordInBitmap + bitInWord);
if ((word & (1 << bitInWord)) &&
!imp->refcount && imp->_flags == (ValueImp::VI_GCALLOWED | ValueImp::VI_CREATED)) {
// emulate destructing part of 'operator delete()'
//fprintf( stderr, "Collector::deleting ValueImp %p (%s)\n", (void*)imp, typeid(*imp).name());
imp->~ValueImp();
heap.blocks[block]->bitmap[wordInBitmap] &= ~(1 << bitInWord);
heap.blocks[block]->usedCells--;
heap.numLiveObjects--;
deleted = true;
if (word & (1 << bitInWord)) {
ValueImp *imp = (ValueImp *)(heap.blocks[block]->cells + BITS_PER_WORD * wordInBitmap + bitInWord);
if (!imp->refcount && imp->_flags == (ValueImp::VI_GCALLOWED | ValueImp::VI_CREATED)) {
//fprintf( stderr, "Collector::deleting ValueImp %p (%s)\n", (void*)imp, typeid(*imp).name());
// emulate destructing part of 'operator delete()'
imp->~ValueImp();
heap.blocks[block]->bitmap[wordInBitmap] &= ~(1 << bitInWord);
heap.blocks[block]->usedCells--;
heap.numLiveObjects--;
deleted = true;
} else {
imp->_flags &= ~ValueImp::VI_MARKED;
}
}
}
}
......@@ -246,7 +240,6 @@ bool Collector::collect()
}
}
int cell = 0;
while (cell < heap.usedOversizeCells) {
......@@ -271,6 +264,7 @@ bool Collector::collect()
}
} else {
imp->_flags &= ~ValueImp::VI_MARKED;
cell++;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment