Ignore:
Timestamp:
Apr 22, 2015, 1:05:06 PM (10 years ago)
Author:
[email protected]
Message:

Give the heap object iterators the ability to return early.
https://bugs.webkit.org/show_bug.cgi?id=144011

Reviewed by Michael Saboff.

JSDollarVMPrototype::isValidCell() uses a heap object iterator to validate
candidate cell pointers, and, when in use, is called a lot more often than
the normal way those iterators are used. As a result, I see my instrumented
VM killed with a SIGXCPU (CPU time limit exceeded). This patch gives the
callback functor the ability to tell the iterators to return early when the
functor no longer needs to continue iterating. With this, my instrumented
VM is useful again for debugging.

Since heap iteration is not something that we do in a typical fast path,
I don't expect this to have any noticeable impact on performance.

I also renamed ObjectAddressCheckFunctor to CellAddressCheckFunctor since
it checks JSCell addresses, not just JSObjects.

(JSC::LoggingFunctor::operator()):

  • heap/Heap.cpp:

(JSC::Zombify::visit):
(JSC::Zombify::operator()):

  • heap/HeapStatistics.cpp:

(JSC::StorageStatistics::visit):
(JSC::StorageStatistics::operator()):

  • heap/HeapVerifier.cpp:

(JSC::GatherLiveObjFunctor::visit):
(JSC::GatherLiveObjFunctor::operator()):

  • heap/MarkedBlock.cpp:

(JSC::SetNewlyAllocatedFunctor::operator()):

  • heap/MarkedBlock.h:

(JSC::MarkedBlock::forEachCell):
(JSC::MarkedBlock::forEachLiveCell):
(JSC::MarkedBlock::forEachDeadCell):

  • heap/MarkedSpace.h:

(JSC::MarkedSpace::forEachLiveCell):
(JSC::MarkedSpace::forEachDeadCell):

  • inspector/agents/InspectorRuntimeAgent.cpp:

(Inspector::TypeRecompiler::visit):
(Inspector::TypeRecompiler::operator()):

  • runtime/IterationStatus.h: Added.
  • runtime/JSGlobalObject.cpp:
  • runtime/VM.cpp:

(JSC::StackPreservingRecompiler::visit):
(JSC::StackPreservingRecompiler::operator()):

  • tools/JSDollarVMPrototype.cpp:

(JSC::CellAddressCheckFunctor::CellAddressCheckFunctor):
(JSC::CellAddressCheckFunctor::operator()):
(JSC::JSDollarVMPrototype::isValidCell):
(JSC::ObjectAddressCheckFunctor::ObjectAddressCheckFunctor): Deleted.
(JSC::ObjectAddressCheckFunctor::operator()): Deleted.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/JavaScriptCore/heap/HeapStatistics.cpp

    r174509 r183124  
    168168    StorageStatistics();
    169169
    170     void operator()(JSCell*);
     170    IterationStatus operator()(JSCell*);
    171171
    172172    size_t objectWithOutOfLineStorageCount();
     
    177177
    178178private:
     179    void visit(JSCell*);
     180
    179181    size_t m_objectWithOutOfLineStorageCount;
    180182    size_t m_objectCount;
     
    191193}
    192194
    193 inline void StorageStatistics::operator()(JSCell* cell)
     195inline void StorageStatistics::visit(JSCell* cell)
    194196{
    195197    if (!cell->isObject())
     
    208210    m_storageSize += object->structure()->totalStorageSize() * sizeof(WriteBarrierBase<Unknown>);
    209211    m_storageCapacity += object->structure()->totalStorageCapacity() * sizeof(WriteBarrierBase<Unknown>);
     212}
     213
     214inline IterationStatus StorageStatistics::operator()(JSCell* cell)
     215{
     216    visit(cell);
     217    return IterationStatus::Continue;
    210218}
    211219
Note: See TracChangeset for help on using the changeset viewer.