Ignore:
Timestamp:
Jun 9, 2011, 12:44:37 PM (14 years ago)
Author:
[email protected]
Message:

2011-06-08 Geoffrey Garen <[email protected]>

Reviewed by Oliver Hunt.

Factored a bunch of Heap functionality into stand-alone functors
https://bugs.webkit.org/show_bug.cgi?id=62337


This is in preparation for making these functors operate on arbitrary
sets of MarkedBlocks.

  • debugger/Debugger.cpp: (JSC::Debugger::recompileAllJSFunctions): Updated for type change and rename.
  • heap/HandleHeap.h: (JSC::HandleHeap::forEachStrongHandle): New function for iterating all strong handles, so we can play along in the functor game.
  • heap/Heap.cpp: (JSC::CountFunctor::CountFunctor::CountFunctor): (JSC::CountFunctor::CountFunctor::count): (JSC::CountFunctor::CountFunctor::returnValue): (JSC::CountFunctor::ClearMarks::operator()): (JSC::CountFunctor::ResetAllocator::operator()): (JSC::CountFunctor::Sweep::operator()): (JSC::CountFunctor::MarkCount::operator()): (JSC::CountFunctor::Size::operator()): (JSC::CountFunctor::Capacity::operator()): (JSC::CountFunctor::Count::operator()): (JSC::CountFunctor::CountIfGlobalObject::operator()): (JSC::CountFunctor::TakeIfEmpty::TakeIfEmpty): (JSC::CountFunctor::TakeIfEmpty::operator()): (JSC::CountFunctor::TakeIfEmpty::returnValue): (JSC::CountFunctor::RecordType::RecordType): (JSC::CountFunctor::RecordType::typeName): (JSC::CountFunctor::RecordType::operator()): (JSC::CountFunctor::RecordType::returnValue): These functors factor out behavior that used to be in the functions below.

(JSC::Heap::clearMarks):
(JSC::Heap::sweep):
(JSC::Heap::objectCount):
(JSC::Heap::size):
(JSC::Heap::capacity):
(JSC::Heap::protectedGlobalObjectCount):
(JSC::Heap::protectedObjectCount):
(JSC::Heap::protectedObjectTypeCounts):
(JSC::Heap::objectTypeCounts):
(JSC::Heap::resetAllocator):
(JSC::Heap::freeBlocks):
(JSC::Heap::shrink): Factored out behavior into the functors above.

  • heap/Heap.h: (JSC::Heap::forEachProtectedCell): (JSC::Heap::forEachCell): (JSC::Heap::forEachBlock): Added forEach* iteration templates. I chose functor-based templates instead of plain iterators because they're simpler to implement in this case and they require a lot less code at the call site.
  • heap/MarkedBlock.h: (JSC::MarkedBlock::VoidFunctor::returnValue): Default parent class for trivial functors.

(JSC::MarkedBlock::forEachCell): Renamed forEach to forEachCell because
we have a few different kind of "for each" now.

  • runtime/JSGlobalData.cpp: (WTF::Recompile::operator()): (JSC::JSGlobalData::JSGlobalData): (JSC::JSGlobalData::recompileAllJSFunctions): Updated for type change and rename.
  • runtime/JSGlobalData.h: Removed globalObjectCount because it was unused.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/debugger/Debugger.cpp

    r81904 r88473  
    3434using namespace JSC;
    3535
    36 class Recompiler {
     36class Recompiler : public MarkedBlock::VoidFunctor {
    3737public:
    3838    Recompiler(Debugger*);
     
    119119
    120120    Recompiler recompiler(this);
    121     globalData->heap.forEach(recompiler);
     121    globalData->heap.forEachCell(recompiler);
    122122}
    123123
Note: See TracChangeset for help on using the changeset viewer.