2011-06-09 Geoffrey Garen <ggaren@apple.com>
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Jun 2011 00:02:23 +0000 (00:02 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 10 Jun 2011 00:02:23 +0000 (00:02 +0000)
commit21467cf7c92eeb83bfb4e3eaf0787aa6171bb06a
treebdbb475c20820f959746a865b559c34ad044481c
parent5c6db8b49cf8f1fc86f62bdd16f0c4bada55908c
2011-06-09  Geoffrey Garen  <ggaren@apple.com>

        Reviewed by Oliver Hunt.

        Factored MarkedBlock set management into a helper class with a fast case Bloom filter
        https://bugs.webkit.org/show_bug.cgi?id=62413

        SunSpider reports a small speedup.

        This is in preparation for having ConservativeSet operate on arbitrary
        sets of MarkedBlocks, and in preparation for conservative scanning
        becoming proportionally more important than other GC activities.

        * GNUmakefile.list.am:
        * JavaScriptCore.gypi:
        * JavaScriptCore.xcodeproj/project.pbxproj: Build-o.

        * heap/ConservativeRoots.cpp:
        (JSC::ConservativeRoots::add):
        * heap/ConservativeRoots.h:
        (JSC::ConservativeRoots::ConservativeRoots): Operate on a MarkedBlockSet
        directly, instead of a Heap, so we can operate on subsets of the Heap
        instead.

        Use a TinyBloomFilter for single-cycle exclusion of most pointers. This
        is particularly important since we expect not to find our subject pointer
        in the MarkedBlock hash, and hash misses are more expensive than typical
        hash lookups because they have high collision rates.

        No need for single-pointer add() to be public anymore, since nobody uses it.

        * heap/Heap.cpp:
        (JSC::Heap::markRoots):
        * heap/Heap.h:
        (JSC::Heap::forEachCell):
        (JSC::Heap::forEachBlock): Use MarkedBlockSet since that's what
        ConservativeRoots relies on.

        Nixed contains(), since nobody uses it anymore.

        * heap/MarkedBlock.h:
        (WTF::MarkedBlockHash::hash): Added a faster hash taking advantage of
        the VM layout properties of MarkedBlocks.

        * heap/MarkedBlockSet.h: Added.
        (JSC::MarkedBlockSet::add):
        (JSC::MarkedBlockSet::remove):
        (JSC::MarkedBlockSet::recomputeFilter):
        (JSC::MarkedBlockSet::filter):
        (JSC::MarkedBlockSet::set):
        * heap/TinyBloomFilter.h: Added.
        (JSC::TinyBloomFilter::TinyBloomFilter):
        (JSC::TinyBloomFilter::add):
        (JSC::TinyBloomFilter::ruleOut): New helper class, used above.

        * interpreter/RegisterFile.cpp:
        (JSC::RegisterFile::gatherConservativeRoots): No need to specifically
        exclude values by tag -- the tiny bloom filter is already a register-register
        compare, so adding another "rule out" factor just slows things down.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@88504 268f45cc-cd09-0410-ab3c-d52691b4dbfc
12 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/GNUmakefile.list.am
Source/JavaScriptCore/JavaScriptCore.gypi
Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
Source/JavaScriptCore/heap/ConservativeRoots.cpp
Source/JavaScriptCore/heap/ConservativeRoots.h
Source/JavaScriptCore/heap/Heap.cpp
Source/JavaScriptCore/heap/Heap.h
Source/JavaScriptCore/heap/MarkedBlock.h
Source/JavaScriptCore/heap/MarkedBlockSet.h [new file with mode: 0644]
Source/JavaScriptCore/heap/TinyBloomFilter.h [new file with mode: 0644]
Source/JavaScriptCore/interpreter/RegisterFile.cpp