+2011-02-07 Geoffrey Garen <ggaren@apple.com>
+
+ Reviewed by Oliver Hunt.
+
+ Simplified the marked space's mark invariant
+ https://bugs.webkit.org/show_bug.cgi?id=53968
+
+ SunSpider reports no change.
+
+ * runtime/MarkedSpace.cpp:
+ (JSC::MarkedSpace::allocate): Mark objects when allocating them. This
+ means that, at all times other than the mark phase, an object is live
+ if and only if it is marked.
+
+ (JSC::MarkedSpace::containsSlowCase): Use the new mark invariant to
+ simplify testing whether an object is live.
+
2011-02-07 Beth Dakin <bdakin@apple.com>
Reviewed by Eric Seidel.
Block* block = m_heap.collectorBlock(m_heap.nextBlock);
do {
ASSERT(m_heap.nextCell < HeapConstants::cellsPerBlock);
- if (!block->marked.get(m_heap.nextCell)) { // Always false for the last cell in the block
+ if (!block->marked.testAndSet(m_heap.nextCell)) { // Always false for the last cell in the block
Cell* cell = &block->cells[m_heap.nextCell];
JSCell* imp = reinterpret_cast<JSCell*>(cell);
m_heap.waterMark += BLOCK_SIZE;
} while (++m_heap.nextBlock != m_heap.usedBlocks);
- if (m_heap.waterMark < m_heap.highWaterMark)
- return &allocateBlock()->cells[m_heap.nextCell++];
+ if (m_heap.waterMark < m_heap.highWaterMark) {
+ MarkedBlock* block = allocateBlock();
+ ASSERT(!block->marked.get(m_heap.nextCell));
+ block->marked.set(m_heap.nextCell);
+ return &block->cells[m_heap.nextCell++];
+ }
return 0;
}
// x is a pointer into the heap. Now, verify that the cell it
// points to is live. (If the cell is dead, we must not mark it,
// since that would revive it in a zombie state.)
- if (block < m_heap.nextBlock)
- return true;
-
size_t cellOffset = offset / CELL_SIZE;
-
- if (block == m_heap.nextBlock && cellOffset < m_heap.nextCell)
- return true;
-
return blockAddr->marked.get(cellOffset);
}