Commit 8666b951 authored by ggaren@apple.com's avatar ggaren@apple.com

2011-02-18 Geoffrey Garen <ggaren@apple.com>

        Reviewed by Sam Weinig.

        Made MarkedSpace block iteration size-class agnostic
        https://bugs.webkit.org/show_bug.cgi?id=54792
        
        SunSpider reports no change.

        * runtime/MarkedSpace.cpp:
        (JSC::MarkedSpace::clearMarks):
        (JSC::MarkedSpace::sweep):
        (JSC::MarkedSpace::objectCount):
        (JSC::MarkedSpace::size):
        (JSC::MarkedSpace::capacity):
        * runtime/MarkedSpace.h:
        (JSC::MarkedSpace::forEach): Iterate blocks in hashing order instead of
        size class list order. This is a much simpler convention in a world
        of many different size classes.


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@79087 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent aac0a3fb
2011-02-18 Geoffrey Garen <ggaren@apple.com>
Reviewed by Sam Weinig.
Made MarkedSpace block iteration size-class agnostic
https://bugs.webkit.org/show_bug.cgi?id=54792
SunSpider reports no change.
* runtime/MarkedSpace.cpp:
(JSC::MarkedSpace::clearMarks):
(JSC::MarkedSpace::sweep):
(JSC::MarkedSpace::objectCount):
(JSC::MarkedSpace::size):
(JSC::MarkedSpace::capacity):
* runtime/MarkedSpace.h:
(JSC::MarkedSpace::forEach): Iterate blocks in hashing order instead of
size class list order. This is a much simpler convention in a world
of many different size classes.
2011-02-18 Kristian Amlie <kristian.amlie@nokia.com>
Reviewed by Andreas Kling.
......
......@@ -93,37 +93,42 @@ void MarkedSpace::shrink()
void MarkedSpace::clearMarks()
{
for (size_t i = 0; i < m_heap.blocks.size(); ++i)
m_heap.collectorBlock(i)->clearMarks();
BlockIterator end = m_blocks.end();
for (BlockIterator it = m_blocks.begin(); it != end; ++it)
(*it)->clearMarks();
}
void MarkedSpace::sweep()
{
for (size_t i = 0; i < m_heap.blocks.size(); ++i)
m_heap.collectorBlock(i)->sweep();
BlockIterator end = m_blocks.end();
for (BlockIterator it = m_blocks.begin(); it != end; ++it)
(*it)->sweep();
}
size_t MarkedSpace::objectCount() const
{
size_t result = 0;
for (size_t i = 0; i < m_heap.blocks.size(); ++i)
result += m_heap.collectorBlock(i)->markCount();
BlockIterator end = m_blocks.end();
for (BlockIterator it = m_blocks.begin(); it != end; ++it)
result += (*it)->markCount();
return result;
}
size_t MarkedSpace::size() const
{
size_t result = 0;
for (size_t i = 0; i < m_heap.blocks.size(); ++i)
result += m_heap.collectorBlock(i)->size();
BlockIterator end = m_blocks.end();
for (BlockIterator it = m_blocks.begin(); it != end; ++it)
result += (*it)->size();
return result;
}
size_t MarkedSpace::capacity() const
{
size_t result = 0;
for (size_t i = 0; i < m_heap.blocks.size(); ++i)
result += m_heap.collectorBlock(i)->capacity();
BlockIterator end = m_blocks.end();
for (BlockIterator it = m_blocks.begin(); it != end; ++it)
result += (*it)->capacity();
return result;
}
......
......@@ -97,6 +97,8 @@ namespace JSC {
template<typename Functor> void forEach(Functor&);
private:
typedef HashSet<MarkedBlock*>::iterator BlockIterator;
NEVER_INLINE MarkedBlock* allocateBlock();
NEVER_INLINE void freeBlock(size_t);
......@@ -143,8 +145,9 @@ namespace JSC {
template <typename Functor> inline void MarkedSpace::forEach(Functor& functor)
{
for (size_t i = 0; i < m_heap.blocks.size(); ++i)
m_heap.collectorBlock(i)->forEach(functor);
BlockIterator end = m_blocks.end();
for (BlockIterator it = m_blocks.begin(); it != end; ++it)
(*it)->forEach(functor);
}
} // namespace JSC
......
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