Commit bb9706c5 authored by ggaren@apple.com's avatar ggaren@apple.com
Browse files

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.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@77877 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 1cabbdd2
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.
......
......@@ -126,7 +126,7 @@ void* MarkedSpace::allocate(size_t s)
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);
......@@ -141,8 +141,12 @@ void* MarkedSpace::allocate(size_t s)
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;
}
......@@ -208,14 +212,7 @@ bool MarkedSpace::containsSlowCase(const void* x)
// 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);
}
......
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