JavaScriptCore: Added an SPI for asking about all the different live objects on the...
authorggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Feb 2010 21:28:52 +0000 (21:28 +0000)
committerggaren@apple.com <ggaren@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 11 Feb 2010 21:28:52 +0000 (21:28 +0000)
commitb7a8f7b1a463b5b40771621f578b5a7061e6d312
tree14fd33dfd8fafd1bd11458530cbd89eee7bcb5e5
parentd089f8413ac18d8d659268588b8065d1ffbe8862
JavaScriptCore: Added an SPI for asking about all the different live objects on the heap.
Useful for memory debugging.

Reviewed by Oliver Hunt.

* JavaScriptCore.exp: Export the new SPI.

* runtime/Collector.cpp:
(JSC::typeName): Use a little capitalization. Don't crash in the case of
a non-object cell, since it might just be an uninitialized cell.

(JSC::Heap::objectTypeCounts): The new SPI.

* runtime/Collector.h:
* runtime/CollectorHeapIterator.h:
(JSC::CollectorHeapIterator::advance):
(JSC::LiveObjectIterator::operator++):
(JSC::DeadObjectIterator::operator++):
(JSC::ObjectIterator::operator++): Made 2 tweaks to these iterators:
(1) Skip the last cell in the block, since it's a dummy sentinel, and
we don't want it to confuse the object count; (2) Fixed a logic error
in LiveObjectIterator that could cause it to iterate dead objects if
m_block were equal to m_heap.nextBlock and m_cell were less than
m_heap.nextCell. No test for this since I can't think of a way that this
could make WebKit behave badly.

WebKit/mac: Exported some new JavaScript heap introspection.

Reviewed by Oliver Hunt.

* Misc/WebCoreStatistics.h:
* Misc/WebCoreStatistics.mm:
(+[WebCoreStatistics javaScriptObjectTypeCounts]): Just like
javaScriptProtectedObjectTypeCounts, except this function enumerates all
live objects, not just protected objects.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@54672 268f45cc-cd09-0410-ab3c-d52691b4dbfc
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.exp
JavaScriptCore/runtime/Collector.cpp
JavaScriptCore/runtime/Collector.h
JavaScriptCore/runtime/CollectorHeapIterator.h
WebKit/mac/ChangeLog
WebKit/mac/Misc/WebCoreStatistics.h
WebKit/mac/Misc/WebCoreStatistics.mm