Added WTF::StackStats mechanism.
authormark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Oct 2012 20:09:36 +0000 (20:09 +0000)
committermark.lam@apple.com <mark.lam@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 19 Oct 2012 20:09:36 +0000 (20:09 +0000)
commitf6a8c5cf19f8b10ad1f13fad8a8d17c60c34c254
tree5b6dd9885f58a945bcf4e38c9c9a0b1deac5896d
parent89a4ccd3906fb17425a742ccd8493956d0b1f09e
Added WTF::StackStats mechanism.
https://bugs.webkit.org/show_bug.cgi?id=99805.

Reviewed by Geoffrey Garen.

Source/JavaScriptCore:

Added StackStats checkpoints and probes.

* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::emitNode):
(JSC::BytecodeGenerator::emitNodeInConditionContext):
* heap/SlotVisitor.cpp:
(JSC::SlotVisitor::append):
(JSC::visitChildren):
(JSC::SlotVisitor::donateKnownParallel):
(JSC::SlotVisitor::drain):
(JSC::SlotVisitor::drainFromShared):
(JSC::SlotVisitor::mergeOpaqueRoots):
(JSC::SlotVisitor::internalAppend):
(JSC::SlotVisitor::harvestWeakReferences):
(JSC::SlotVisitor::finalizeUnconditionalFinalizers):
* interpreter/Interpreter.cpp:
(JSC::Interpreter::execute):
(JSC::Interpreter::executeCall):
(JSC::Interpreter::executeConstruct):
(JSC::Interpreter::prepareForRepeatCall):
* parser/Parser.h:
(JSC::Parser::canRecurse):
* runtime/StringRecursionChecker.h:
(StringRecursionChecker):

Source/WebCore:

Added StackStats probes in layout methods.

* dom/Document.cpp:
(WebCore::Document::updateLayout):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::layout):
* rendering/RenderBox.cpp:
(WebCore::RenderBox::layout):
* rendering/RenderDialog.cpp:
(WebCore::RenderDialog::layout):
* rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::layout):
* rendering/RenderFlowThread.cpp:
(WebCore::RenderFlowThread::layout):
* rendering/RenderFrameSet.cpp:
(WebCore::RenderFrameSet::layout):
* rendering/RenderIFrame.cpp:
(WebCore::RenderIFrame::layout):
* rendering/RenderImage.cpp:
(WebCore::RenderImage::layout):
* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::layout):
* rendering/RenderListItem.cpp:
(WebCore::RenderListItem::layout):
* rendering/RenderListMarker.cpp:
(WebCore::RenderListMarker::layout):
* rendering/RenderMedia.cpp:
(WebCore::RenderMedia::layout):
* rendering/RenderObject.cpp:
(WebCore::RenderObject::layout):
* rendering/RenderObject.h:
* rendering/RenderRegion.cpp:
(WebCore::RenderRegion::layout):
* rendering/RenderReplaced.cpp:
(WebCore::RenderReplaced::layout):
* rendering/RenderReplica.cpp:
(WebCore::RenderReplica::layout):
* rendering/RenderRubyRun.cpp:
(WebCore::RenderRubyRun::layoutSpecialExcludedChild):
* rendering/RenderScrollbarPart.cpp:
(WebCore::RenderScrollbarPart::layout):
* rendering/RenderSlider.cpp:
(WebCore::RenderSlider::layout):
* rendering/RenderTable.cpp:
(WebCore::RenderTable::layout):
* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::layout):
* rendering/RenderTableRow.cpp:
(WebCore::RenderTableRow::layout):
* rendering/RenderTableSection.cpp:
(WebCore::RenderTableSection::layout):
* rendering/RenderTextControlSingleLine.cpp:
(WebCore::RenderTextControlSingleLine::layout):
* rendering/RenderTextTrackCue.cpp:
(WebCore::RenderTextTrackCue::layout):
* rendering/RenderVideo.cpp:
(WebCore::RenderVideo::layout):
* rendering/RenderView.cpp:
(WebCore::RenderView::layout):
* rendering/RenderWidget.cpp:
(WebCore::RenderWidget::layout):
* rendering/svg/RenderSVGContainer.cpp:
(WebCore::RenderSVGContainer::layout):
* rendering/svg/RenderSVGForeignObject.cpp:
(WebCore::RenderSVGForeignObject::layout):
* rendering/svg/RenderSVGGradientStop.cpp:
(WebCore::RenderSVGGradientStop::layout):
* rendering/svg/RenderSVGHiddenContainer.cpp:
(WebCore::RenderSVGHiddenContainer::layout):
* rendering/svg/RenderSVGImage.cpp:
(WebCore::RenderSVGImage::layout):
* rendering/svg/RenderSVGResourceContainer.cpp:
(WebCore::RenderSVGResourceContainer::layout):
* rendering/svg/RenderSVGResourceMarker.cpp:
(WebCore::RenderSVGResourceMarker::layout):
* rendering/svg/RenderSVGRoot.cpp:
(WebCore::RenderSVGRoot::layout):
* rendering/svg/RenderSVGShape.cpp:
(WebCore::RenderSVGShape::layout):
* rendering/svg/RenderSVGText.cpp:
(WebCore::RenderSVGText::layout):

Source/WTF:

Disabled by default. Should have no performance and memory cost when
disabled. To enable, #define ENABLE_STACK_STATS 1 in StackStats.h.
The output is currently hardcoded to be dumped in /tmp/stack-stats.log,
and is in the form of stack sample events. By default, it only logs
a sample event when a new high watermark value is encountered.

Also renamed StackBounds::recursiveCheck() to isSafeToRecurse().

* WTF.xcodeproj/project.pbxproj:
* wtf/StackBounds.h:
(StackBounds):
(WTF::StackBounds::size):
(WTF::StackBounds::isSafeToRecurse):
* wtf/StackStats.cpp: Added.
(WTF):
(WTF::StackStats::initialize):
(WTF::StackStats::PerThreadStats::PerThreadStats):
(WTF::StackStats::CheckPoint::CheckPoint):
(WTF::StackStats::CheckPoint::~CheckPoint):
(WTF::StackStats::probe):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
(WTF::StackStats::LayoutCheckPoint::~LayoutCheckPoint):
* wtf/StackStats.h: Added.
(WTF):
(StackStats):
(CheckPoint):
(WTF::StackStats::CheckPoint::CheckPoint):
(PerThreadStats):
(WTF::StackStats::PerThreadStats::PerThreadStats):
(LayoutCheckPoint):
(WTF::StackStats::LayoutCheckPoint::LayoutCheckPoint):
(WTF::StackStats::initialize):
(WTF::StackStats::probe):
* wtf/ThreadingPthreads.cpp:
(WTF::initializeThreading):
* wtf/WTFThreadData.cpp:
(WTF::WTFThreadData::WTFThreadData):
* wtf/WTFThreadData.h:
(WTFThreadData):
(WTF::WTFThreadData::stackStats):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@131938 268f45cc-cd09-0410-ab3c-d52691b4dbfc
55 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h
Source/JavaScriptCore/heap/SlotVisitor.cpp
Source/JavaScriptCore/interpreter/Interpreter.cpp
Source/JavaScriptCore/parser/Parser.h
Source/JavaScriptCore/runtime/StringRecursionChecker.h
Source/WTF/ChangeLog
Source/WTF/WTF.xcodeproj/project.pbxproj
Source/WTF/wtf/StackBounds.h
Source/WTF/wtf/StackStats.cpp [new file with mode: 0644]
Source/WTF/wtf/StackStats.h [new file with mode: 0644]
Source/WTF/wtf/ThreadingPthreads.cpp
Source/WTF/wtf/WTFThreadData.cpp
Source/WTF/wtf/WTFThreadData.h
Source/WebCore/ChangeLog
Source/WebCore/dom/Document.cpp
Source/WebCore/rendering/RenderBlock.cpp
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderDialog.cpp
Source/WebCore/rendering/RenderEmbeddedObject.cpp
Source/WebCore/rendering/RenderFlowThread.cpp
Source/WebCore/rendering/RenderFrameSet.cpp
Source/WebCore/rendering/RenderIFrame.cpp
Source/WebCore/rendering/RenderImage.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderListItem.cpp
Source/WebCore/rendering/RenderListMarker.cpp
Source/WebCore/rendering/RenderMedia.cpp
Source/WebCore/rendering/RenderObject.cpp
Source/WebCore/rendering/RenderObject.h
Source/WebCore/rendering/RenderRegion.cpp
Source/WebCore/rendering/RenderReplaced.cpp
Source/WebCore/rendering/RenderReplica.cpp
Source/WebCore/rendering/RenderRubyRun.cpp
Source/WebCore/rendering/RenderScrollbarPart.cpp
Source/WebCore/rendering/RenderSlider.cpp
Source/WebCore/rendering/RenderTable.cpp
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTableRow.cpp
Source/WebCore/rendering/RenderTableSection.cpp
Source/WebCore/rendering/RenderTextControlSingleLine.cpp
Source/WebCore/rendering/RenderTextTrackCue.cpp
Source/WebCore/rendering/RenderVideo.cpp
Source/WebCore/rendering/RenderView.cpp
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/svg/RenderSVGContainer.cpp
Source/WebCore/rendering/svg/RenderSVGForeignObject.cpp
Source/WebCore/rendering/svg/RenderSVGGradientStop.cpp
Source/WebCore/rendering/svg/RenderSVGHiddenContainer.cpp
Source/WebCore/rendering/svg/RenderSVGImage.cpp
Source/WebCore/rendering/svg/RenderSVGResourceContainer.cpp
Source/WebCore/rendering/svg/RenderSVGResourceMarker.cpp
Source/WebCore/rendering/svg/RenderSVGRoot.cpp
Source/WebCore/rendering/svg/RenderSVGShape.cpp
Source/WebCore/rendering/svg/RenderSVGText.cpp