<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[200658] trunk</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/200658">200658</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2016-05-10 17:08:50 -0700 (Tue, 10 May 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Internal JSC profiler should have a timestamped log of events for each code block
https://bugs.webkit.org/show_bug.cgi?id=157538

Reviewed by Benjamin Poulain.
Source/JavaScriptCore:

        
For example, in 3d-cube, I can query the events for MMulti and I get:

1462917476.17083  MMulti#DTZ7qc                          installCode        
1462917476.179663 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline installCode        
1462917476.179664 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline osrEntry           at bc#49
1462917476.185651 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 1011.214233/1717.000000, -707
1462917476.187913 MMulti#DTZ7qc MMulti#DTZ7qc-2-DFG      installCode        
1462917476.187917 MMulti#DTZ7qc MMulti#DTZ7qc-2-DFG      osrEntry           at bc#49
1462917476.205365 MMulti#DTZ7qc MMulti#DTZ7qc-2-DFG      jettison           due to OSRExit, counting = true, detail = (null)
1462917476.205368 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline frequentExit       bc#65: BadCache/FromDFG
1462917476.205369 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline installCode        
1462917476.205482 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 1013.000000/3434.000000, -1000
1462917476.211547 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 2013.000000/3434.000000, -1000
1462917476.213721 MMulti#DTZ7qc MMulti#DTZ7qc-3-DFG      installCode        
1462917476.213726 MMulti#DTZ7qc MMulti#DTZ7qc-3-DFG      osrEntry           at bc#49
1462917476.223976 MMulti#DTZ7qc MMulti#DTZ7qc-3-DFG      jettison           due to OSRExit, counting = true, detail = (null)
1462917476.223981 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline frequentExit       bc#77: BadCache/FromDFG
1462917476.223982 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline frequentExit       bc#94: BadCache/FromDFG
1462917476.223982 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline installCode        
1462917476.224064 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 1013.000000/6868.000000, -1000
1462917476.224151 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 2013.000000/6868.000000, -1000
1462917476.224258 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 3013.000000/6868.000000, -1000
1462917476.224337 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 4023.000000/6868.000000, -1000
1462917476.224425 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 5023.000000/6868.000000, -1000
1462917476.224785 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 6023.396484/6868.000000, -862
1462917476.227669 MMulti#DTZ7qc MMulti#DTZ7qc-4-DFG      installCode        
1462917476.227675 MMulti#DTZ7qc MMulti#DTZ7qc-4-DFG      osrEntry           at bc#0
        
The output is ugly but useful. We can make it less ugly later.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj:
* bytecode/CodeBlock.cpp:
(JSC::CodeBlock::jettison):
* bytecode/CodeBlock.h:
(JSC::ScriptExecutable::forEachCodeBlock):
* bytecode/DFGExitProfile.cpp:
(JSC::DFG::ExitProfile::add):
* dfg/DFGJITFinalizer.cpp:
(JSC::DFG::JITFinalizer::finalizeCommon):
* dfg/DFGOperations.cpp:
* ftl/FTLJITFinalizer.cpp:
(JSC::FTL::JITFinalizer::finalizeFunction):
* jit/JIT.cpp:
(JSC::JIT::privateCompile):
* jit/JITOperations.cpp:
* llint/LLIntSlowPaths.cpp:
(JSC::LLInt::jitCompileAndSetHeuristics):
(JSC::LLInt::entryOSR):
(JSC::LLInt::LLINT_SLOW_PATH_DECL):
* profiler/ProfilerCompilation.cpp:
(JSC::Profiler::Compilation::Compilation):
(JSC::Profiler::Compilation::setJettisonReason):
(JSC::Profiler::Compilation::dump):
(JSC::Profiler::Compilation::toJS):
* profiler/ProfilerCompilation.h:
(JSC::Profiler::Compilation::uid):
* profiler/ProfilerDatabase.cpp:
(JSC::Profiler::Database::ensureBytecodesFor):
(JSC::Profiler::Database::notifyDestruction):
(JSC::Profiler::Database::addCompilation):
(JSC::Profiler::Database::toJS):
(JSC::Profiler::Database::registerToSaveAtExit):
(JSC::Profiler::Database::logEvent):
(JSC::Profiler::Database::addDatabaseToAtExit):
* profiler/ProfilerDatabase.h:
* profiler/ProfilerEvent.cpp: Added.
(JSC::Profiler::Event::dump):
(JSC::Profiler::Event::toJS):
* profiler/ProfilerEvent.h: Added.
(JSC::Profiler::Event::Event):
(JSC::Profiler::Event::operator bool):
(JSC::Profiler::Event::time):
(JSC::Profiler::Event::bytecodes):
(JSC::Profiler::Event::compilation):
(JSC::Profiler::Event::summary):
(JSC::Profiler::Event::detail):
* profiler/ProfilerUID.cpp: Added.
(JSC::Profiler::UID::create):
(JSC::Profiler::UID::dump):
(JSC::Profiler::UID::toJS):
* profiler/ProfilerUID.h: Added.
(JSC::Profiler::UID::UID):
(JSC::Profiler::UID::fromInt):
(JSC::Profiler::UID::toInt):
(JSC::Profiler::UID::operator==):
(JSC::Profiler::UID::operator!=):
(JSC::Profiler::UID::operator bool):
(JSC::Profiler::UID::isHashTableDeletedValue):
(JSC::Profiler::UID::hash):
(JSC::Profiler::UIDHash::hash):
(JSC::Profiler::UIDHash::equal):
* runtime/CommonIdentifiers.h:
* runtime/Executable.cpp:
(JSC::ScriptExecutable::installCode):
* runtime/VM.h:
(JSC::VM::bytecodeIntrinsicRegistry):
(JSC::VM::shadowChicken):
* runtime/VMInlines.h:
(JSC::VM::shouldTriggerTermination):
(JSC::VM::logEvent):

Source/WTF:


* wtf/PrintStream.h:
(WTF::PrintStream::print):

Tools:


* Scripts/display-profiler-output:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockh">trunk/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeDFGExitProfilecpp">trunk/Source/JavaScriptCore/bytecode/DFGExitProfile.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGJITFinalizercpp">trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGNodeh">trunk/Source/JavaScriptCore/dfg/DFGNode.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGOperationscpp">trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLJITFinalizercpp">trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITcpp">trunk/Source/JavaScriptCore/jit/JIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITh">trunk/Source/JavaScriptCore/jit/JIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITDisassemblercpp">trunk/Source/JavaScriptCore/jit/JITDisassembler.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorejitJITOperationscpp">trunk/Source/JavaScriptCore/jit/JITOperations.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorellintLLIntSlowPathscpp">trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerCompilationcpp">trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerCompilationh">trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerDatabasecpp">trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerDatabaseh">trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCommonIdentifiersh">trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMh">trunk/Source/JavaScriptCore/runtime/VM.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeVMInlinesh">trunk/Source/JavaScriptCore/runtime/VMInlines.h</a></li>
<li><a href="#trunkSourceWTFChangeLog">trunk/Source/WTF/ChangeLog</a></li>
<li><a href="#trunkSourceWTFwtfPrintStreamh">trunk/Source/WTF/wtf/PrintStream.h</a></li>
<li><a href="#trunkToolsChangeLog">trunk/Tools/ChangeLog</a></li>
<li><a href="#trunkToolsScriptsdisplayprofileroutput">trunk/Tools/Scripts/display-profiler-output</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerEventcpp">trunk/Source/JavaScriptCore/profiler/ProfilerEvent.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerEventh">trunk/Source/JavaScriptCore/profiler/ProfilerEvent.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerUIDcpp">trunk/Source/JavaScriptCore/profiler/ProfilerUID.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreprofilerProfilerUIDh">trunk/Source/JavaScriptCore/profiler/ProfilerUID.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -597,12 +597,14 @@
</span><span class="cx">     profiler/ProfilerCompilationKind.cpp
</span><span class="cx">     profiler/ProfilerCompiledBytecode.cpp
</span><span class="cx">     profiler/ProfilerDatabase.cpp
</span><ins>+    profiler/ProfilerEvent.cpp
</ins><span class="cx">     profiler/ProfilerJettisonReason.cpp
</span><span class="cx">     profiler/ProfilerOSRExit.cpp
</span><span class="cx">     profiler/ProfilerOSRExitSite.cpp
</span><span class="cx">     profiler/ProfilerOrigin.cpp
</span><span class="cx">     profiler/ProfilerOriginStack.cpp
</span><span class="cx">     profiler/ProfilerProfiledBytecodes.cpp
</span><ins>+    profiler/ProfilerUID.cpp
</ins><span class="cx"> 
</span><span class="cx">     runtime/ArgList.cpp
</span><span class="cx">     runtime/ArrayBuffer.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,3 +1,112 @@
</span><ins>+2016-05-10  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Internal JSC profiler should have a timestamped log of events for each code block
+        https://bugs.webkit.org/show_bug.cgi?id=157538
+
+        Reviewed by Benjamin Poulain.
+        
+        For example, in 3d-cube, I can query the events for MMulti and I get:
+
+        1462917476.17083  MMulti#DTZ7qc                          installCode        
+        1462917476.179663 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline installCode        
+        1462917476.179664 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline osrEntry           at bc#49
+        1462917476.185651 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 1011.214233/1717.000000, -707
+        1462917476.187913 MMulti#DTZ7qc MMulti#DTZ7qc-2-DFG      installCode        
+        1462917476.187917 MMulti#DTZ7qc MMulti#DTZ7qc-2-DFG      osrEntry           at bc#49
+        1462917476.205365 MMulti#DTZ7qc MMulti#DTZ7qc-2-DFG      jettison           due to OSRExit, counting = true, detail = (null)
+        1462917476.205368 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline frequentExit       bc#65: BadCache/FromDFG
+        1462917476.205369 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline installCode        
+        1462917476.205482 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 1013.000000/3434.000000, -1000
+        1462917476.211547 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 2013.000000/3434.000000, -1000
+        1462917476.213721 MMulti#DTZ7qc MMulti#DTZ7qc-3-DFG      installCode        
+        1462917476.213726 MMulti#DTZ7qc MMulti#DTZ7qc-3-DFG      osrEntry           at bc#49
+        1462917476.223976 MMulti#DTZ7qc MMulti#DTZ7qc-3-DFG      jettison           due to OSRExit, counting = true, detail = (null)
+        1462917476.223981 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline frequentExit       bc#77: BadCache/FromDFG
+        1462917476.223982 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline frequentExit       bc#94: BadCache/FromDFG
+        1462917476.223982 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline installCode        
+        1462917476.224064 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 1013.000000/6868.000000, -1000
+        1462917476.224151 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 2013.000000/6868.000000, -1000
+        1462917476.224258 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 3013.000000/6868.000000, -1000
+        1462917476.224337 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 4023.000000/6868.000000, -1000
+        1462917476.224425 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 5023.000000/6868.000000, -1000
+        1462917476.224785 MMulti#DTZ7qc MMulti#DTZ7qc-1-Baseline delayOptimizeToDFG counter = 6023.396484/6868.000000, -862
+        1462917476.227669 MMulti#DTZ7qc MMulti#DTZ7qc-4-DFG      installCode        
+        1462917476.227675 MMulti#DTZ7qc MMulti#DTZ7qc-4-DFG      osrEntry           at bc#0
+        
+        The output is ugly but useful. We can make it less ugly later.
+
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * bytecode/CodeBlock.cpp:
+        (JSC::CodeBlock::jettison):
+        * bytecode/CodeBlock.h:
+        (JSC::ScriptExecutable::forEachCodeBlock):
+        * bytecode/DFGExitProfile.cpp:
+        (JSC::DFG::ExitProfile::add):
+        * dfg/DFGJITFinalizer.cpp:
+        (JSC::DFG::JITFinalizer::finalizeCommon):
+        * dfg/DFGOperations.cpp:
+        * ftl/FTLJITFinalizer.cpp:
+        (JSC::FTL::JITFinalizer::finalizeFunction):
+        * jit/JIT.cpp:
+        (JSC::JIT::privateCompile):
+        * jit/JITOperations.cpp:
+        * llint/LLIntSlowPaths.cpp:
+        (JSC::LLInt::jitCompileAndSetHeuristics):
+        (JSC::LLInt::entryOSR):
+        (JSC::LLInt::LLINT_SLOW_PATH_DECL):
+        * profiler/ProfilerCompilation.cpp:
+        (JSC::Profiler::Compilation::Compilation):
+        (JSC::Profiler::Compilation::setJettisonReason):
+        (JSC::Profiler::Compilation::dump):
+        (JSC::Profiler::Compilation::toJS):
+        * profiler/ProfilerCompilation.h:
+        (JSC::Profiler::Compilation::uid):
+        * profiler/ProfilerDatabase.cpp:
+        (JSC::Profiler::Database::ensureBytecodesFor):
+        (JSC::Profiler::Database::notifyDestruction):
+        (JSC::Profiler::Database::addCompilation):
+        (JSC::Profiler::Database::toJS):
+        (JSC::Profiler::Database::registerToSaveAtExit):
+        (JSC::Profiler::Database::logEvent):
+        (JSC::Profiler::Database::addDatabaseToAtExit):
+        * profiler/ProfilerDatabase.h:
+        * profiler/ProfilerEvent.cpp: Added.
+        (JSC::Profiler::Event::dump):
+        (JSC::Profiler::Event::toJS):
+        * profiler/ProfilerEvent.h: Added.
+        (JSC::Profiler::Event::Event):
+        (JSC::Profiler::Event::operator bool):
+        (JSC::Profiler::Event::time):
+        (JSC::Profiler::Event::bytecodes):
+        (JSC::Profiler::Event::compilation):
+        (JSC::Profiler::Event::summary):
+        (JSC::Profiler::Event::detail):
+        * profiler/ProfilerUID.cpp: Added.
+        (JSC::Profiler::UID::create):
+        (JSC::Profiler::UID::dump):
+        (JSC::Profiler::UID::toJS):
+        * profiler/ProfilerUID.h: Added.
+        (JSC::Profiler::UID::UID):
+        (JSC::Profiler::UID::fromInt):
+        (JSC::Profiler::UID::toInt):
+        (JSC::Profiler::UID::operator==):
+        (JSC::Profiler::UID::operator!=):
+        (JSC::Profiler::UID::operator bool):
+        (JSC::Profiler::UID::isHashTableDeletedValue):
+        (JSC::Profiler::UID::hash):
+        (JSC::Profiler::UIDHash::hash):
+        (JSC::Profiler::UIDHash::equal):
+        * runtime/CommonIdentifiers.h:
+        * runtime/Executable.cpp:
+        (JSC::ScriptExecutable::installCode):
+        * runtime/VM.h:
+        (JSC::VM::bytecodeIntrinsicRegistry):
+        (JSC::VM::shadowChicken):
+        * runtime/VMInlines.h:
+        (JSC::VM::shouldTriggerTermination):
+        (JSC::VM::logEvent):
+
</ins><span class="cx"> 2016-05-10  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Backend should initiate timeline recordings on page navigations to ensure nothing is missed
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1992,6 +1992,10 @@
</span><span class="cx">                 DC17E81A1C9C91E9008A6AB3 /* CCallHelpers.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC17E8161C9C802B008A6AB3 /* CCallHelpers.cpp */; };
</span><span class="cx">                 DC2143071CA32E55000A8869 /* ICStats.h in Headers */ = {isa = PBXBuildFile; fileRef = DC2143061CA32E52000A8869 /* ICStats.h */; };
</span><span class="cx">                 DC2143081CA32E58000A8869 /* ICStats.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC2143051CA32E52000A8869 /* ICStats.cpp */; };
</span><ins>+                DC605B5D1CE26EA000593718 /* ProfilerEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC605B591CE26E9800593718 /* ProfilerEvent.cpp */; };
+                DC605B5E1CE26EA200593718 /* ProfilerEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = DC605B5A1CE26E9800593718 /* ProfilerEvent.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                DC605B5F1CE26EA500593718 /* ProfilerUID.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC605B5B1CE26E9800593718 /* ProfilerUID.cpp */; };
+                DC605B601CE26EA700593718 /* ProfilerUID.h in Headers */ = {isa = PBXBuildFile; fileRef = DC605B5C1CE26E9800593718 /* ProfilerUID.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 DC7997831CDE9FA0004D4A09 /* TagRegistersMode.h in Headers */ = {isa = PBXBuildFile; fileRef = DC7997821CDE9F9E004D4A09 /* TagRegistersMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 DC7997841CDE9FA2004D4A09 /* TagRegistersMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DC7997811CDE9F9E004D4A09 /* TagRegistersMode.cpp */; };
</span><span class="cx">                 DCF3D5691CD2946D003D5C65 /* LazyClassStructure.cpp in Sources */ = {isa = PBXBuildFile; fileRef = DCF3D5641CD29468003D5C65 /* LazyClassStructure.cpp */; };
</span><span class="lines">@@ -4206,6 +4210,10 @@
</span><span class="cx">                 DC17E8161C9C802B008A6AB3 /* CCallHelpers.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CCallHelpers.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DC2143051CA32E52000A8869 /* ICStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ICStats.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DC2143061CA32E52000A8869 /* ICStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICStats.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                DC605B591CE26E9800593718 /* ProfilerEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProfilerEvent.cpp; path = profiler/ProfilerEvent.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                DC605B5A1CE26E9800593718 /* ProfilerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProfilerEvent.h; path = profiler/ProfilerEvent.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                DC605B5B1CE26E9800593718 /* ProfilerUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProfilerUID.cpp; path = profiler/ProfilerUID.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                DC605B5C1CE26E9800593718 /* ProfilerUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProfilerUID.h; path = profiler/ProfilerUID.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 DC7997811CDE9F9E004D4A09 /* TagRegistersMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagRegistersMode.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DC7997821CDE9F9E004D4A09 /* TagRegistersMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagRegistersMode.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 DCF3D5641CD29468003D5C65 /* LazyClassStructure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LazyClassStructure.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6445,6 +6453,8 @@
</span><span class="cx">                                 0FF7299B166AD347000F5BA3 /* ProfilerCompiledBytecode.h */,
</span><span class="cx">                                 0FF7299C166AD347000F5BA3 /* ProfilerDatabase.cpp */,
</span><span class="cx">                                 0FF7299D166AD347000F5BA3 /* ProfilerDatabase.h */,
</span><ins>+                                DC605B591CE26E9800593718 /* ProfilerEvent.cpp */,
+                                DC605B5A1CE26E9800593718 /* ProfilerEvent.h */,
</ins><span class="cx">                                 0FF7299E166AD347000F5BA3 /* ProfilerExecutionCounter.h */,
</span><span class="cx">                                 0F190CAA189D82F6000AE5F0 /* ProfilerJettisonReason.cpp */,
</span><span class="cx">                                 0F190CAB189D82F6000AE5F0 /* ProfilerJettisonReason.h */,
</span><span class="lines">@@ -6458,6 +6468,8 @@
</span><span class="cx">                                 0FB1058A1675482E00F8AB6E /* ProfilerOSRExitSite.h */,
</span><span class="cx">                                 0F13912616771C30009CCB07 /* ProfilerProfiledBytecodes.cpp */,
</span><span class="cx">                                 0F13912716771C30009CCB07 /* ProfilerProfiledBytecodes.h */,
</span><ins>+                                DC605B5B1CE26E9800593718 /* ProfilerUID.cpp */,
+                                DC605B5C1CE26E9800593718 /* ProfilerUID.h */,
</ins><span class="cx">                         );
</span><span class="cx">                         name = profiler;
</span><span class="cx">                         sourceTree = &quot;&lt;group&gt;&quot;;
</span><span class="lines">@@ -7757,6 +7769,7 @@
</span><span class="cx">                                 70B7919C1C024A49002481E2 /* JSGeneratorFunction.h in Headers */,
</span><span class="cx">                                 BC18C42A0E16F5CD00B34460 /* JSType.h in Headers */,
</span><span class="cx">                                 0F2B66FB17B6B5AB00A7AE3F /* JSTypedArrayConstructors.h in Headers */,
</span><ins>+                                DC605B601CE26EA700593718 /* ProfilerUID.h in Headers */,
</ins><span class="cx">                                 0F2B66FD17B6B5AB00A7AE3F /* JSTypedArrayPrototypes.h in Headers */,
</span><span class="cx">                                 0F2B66FF17B6B5AB00A7AE3F /* JSTypedArrays.h in Headers */,
</span><span class="cx">                                 534C457C1BC72411007476A7 /* JSTypedArrayViewConstructor.h in Headers */,
</span><span class="lines">@@ -7772,6 +7785,7 @@
</span><span class="cx">                                 86E3C615167BABD7006D760A /* JSVirtualMachine.h in Headers */,
</span><span class="cx">                                 86E3C61D167BABEE006D760A /* JSVirtualMachineInternal.h in Headers */,
</span><span class="cx">                                 7B98D1371B60CD620023B1A4 /* JSWASMModule.h in Headers */,
</span><ins>+                                DC605B5E1CE26EA200593718 /* ProfilerEvent.h in Headers */,
</ins><span class="cx">                                 A7CA3AE817DA41AE006538AF /* JSWeakMap.h in Headers */,
</span><span class="cx">                                 A7482E93116A7CAD003B0712 /* JSWeakObjectMapRefInternal.h in Headers */,
</span><span class="cx">                                 A7482B9311671147003B0712 /* JSWeakObjectMapRefPrivate.h in Headers */,
</span><span class="lines">@@ -9208,6 +9222,7 @@
</span><span class="cx">                                 A700873D17CBE8D300C3E643 /* MapPrototype.cpp in Sources */,
</span><span class="cx">                                 C2B916C514DA040C00CBAC86 /* MarkedAllocator.cpp in Sources */,
</span><span class="cx">                                 142D6F0813539A2800B02E86 /* MarkedBlock.cpp in Sources */,
</span><ins>+                                DC605B5D1CE26EA000593718 /* ProfilerEvent.cpp in Sources */,
</ins><span class="cx">                                 14D2F3DA139F4BE200491031 /* MarkedSpace.cpp in Sources */,
</span><span class="cx">                                 142D6F1113539A4100B02E86 /* MarkStack.cpp in Sources */,
</span><span class="cx">                                 70B791981C024A29002481E2 /* GeneratorPrototype.cpp in Sources */,
</span><span class="lines">@@ -9344,6 +9359,7 @@
</span><span class="cx">                                 705B41AF1A6E501E00716757 /* SymbolObject.cpp in Sources */,
</span><span class="cx">                                 705B41B11A6E501E00716757 /* SymbolPrototype.cpp in Sources */,
</span><span class="cx">                                 0F919D2815856773004A4E7D /* SymbolTable.cpp in Sources */,
</span><ins>+                                DC605B5F1CE26EA500593718 /* ProfilerUID.cpp in Sources */,
</ins><span class="cx">                                 70ECA6071AFDBEA200449739 /* TemplateRegistry.cpp in Sources */,
</span><span class="cx">                                 0FC314131814559100033232 /* TempRegisterSet.cpp in Sources */,
</span><span class="cx">                                 0FA2C17B17D7CF84009D015F /* TestRunnerUtils.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -63,6 +63,7 @@
</span><span class="cx"> #include &quot;TypeLocationCache.h&quot;
</span><span class="cx"> #include &quot;TypeProfiler.h&quot;
</span><span class="cx"> #include &quot;UnlinkedInstructionStream.h&quot;
</span><ins>+#include &quot;VMInlines.h&quot;
</ins><span class="cx"> #include &lt;wtf/BagToHashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/CommaPrinter.h&gt;
</span><span class="cx"> #include &lt;wtf/StringExtras.h&gt;
</span><span class="lines">@@ -3310,6 +3311,8 @@
</span><span class="cx">     UNUSED_PARAM(mode);
</span><span class="cx">     UNUSED_PARAM(detail);
</span><span class="cx"> #endif
</span><ins>+    
+    CODEBLOCK_LOG_EVENT(this, &quot;jettison&quot;, (&quot;due to &quot;, reason, &quot;, counting = &quot;, mode == CountReoptimization, &quot;, detail = &quot;, pointerDump(detail)));
</ins><span class="cx"> 
</span><span class="cx">     RELEASE_ASSERT(reason != Profiler::NotJettisoned);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -59,7 +59,6 @@
</span><span class="cx"> #include &quot;LazyOperandValueProfile.h&quot;
</span><span class="cx"> #include &quot;ObjectAllocationProfile.h&quot;
</span><span class="cx"> #include &quot;Options.h&quot;
</span><del>-#include &quot;ProfilerCompilation.h&quot;
</del><span class="cx"> #include &quot;ProfilerJettisonReason.h&quot;
</span><span class="cx"> #include &quot;PutPropertySlot.h&quot;
</span><span class="cx"> #include &quot;RegExpObject.h&quot;
</span><span class="lines">@@ -1404,6 +1403,9 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+#define CODEBLOCK_LOG_EVENT(codeBlock, summary, details) \
+    (codeBlock-&gt;vm()-&gt;logEvent(codeBlock, summary, [&amp;] () { return toCString details; }))
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // CodeBlock_h
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeDFGExitProfilecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/DFGExitProfile.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/DFGExitProfile.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/bytecode/DFGExitProfile.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -29,6 +29,7 @@
</span><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CodeBlock.h&quot;
</span><ins>+#include &quot;VMInlines.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC { namespace DFG {
</span><span class="cx"> 
</span><span class="lines">@@ -44,6 +45,8 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(site.jitType() != ExitFromAnything);
</span><span class="cx"> 
</span><ins>+    CODEBLOCK_LOG_EVENT(owner, &quot;frequentExit&quot;, (site));
+    
</ins><span class="cx">     if (Options::verboseExitProfile())
</span><span class="cx">         dataLog(pointerDump(owner), &quot;: Adding exit site: &quot;, site, &quot;\n&quot;);
</span><span class="cx">     
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGJITFinalizercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/dfg/DFGJITFinalizer.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -91,7 +91,7 @@
</span><span class="cx"> #endif // ENABLE(FTL_JIT)
</span><span class="cx">     
</span><span class="cx">     if (m_plan.compilation)
</span><del>-        m_plan.vm.m_perBytecodeProfiler-&gt;addCompilation(m_plan.compilation);
</del><ins>+        m_plan.vm.m_perBytecodeProfiler-&gt;addCompilation(m_plan.codeBlock, m_plan.compilation);
</ins><span class="cx">     
</span><span class="cx">     if (!m_plan.willTryToTierUp)
</span><span class="cx">         m_plan.codeBlock-&gt;baselineVersion()-&gt;m_didFailFTLCompilation = true;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGNodeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGNode.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGNode.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/dfg/DFGNode.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -56,8 +56,14 @@
</span><span class="cx"> #include &quot;ValueProfile.h&quot;
</span><span class="cx"> #include &lt;wtf/ListDump.h&gt;
</span><span class="cx"> 
</span><del>-namespace JSC { namespace DFG {
</del><ins>+namespace JSC {
</ins><span class="cx"> 
</span><ins>+namespace Profiler {
+class ExecutionCounter;
+}
+
+namespace DFG {
+
</ins><span class="cx"> class Graph;
</span><span class="cx"> class PromotedLocationDescriptor;
</span><span class="cx"> struct BasicBlock;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/dfg/DFGOperations.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -57,7 +57,7 @@
</span><span class="cx"> #include &quot;Symbol.h&quot;
</span><span class="cx"> #include &quot;TypeProfilerLog.h&quot;
</span><span class="cx"> #include &quot;TypedArrayInlines.h&quot;
</span><del>-#include &quot;VM.h&quot;
</del><ins>+#include &quot;VMInlines.h&quot;
</ins><span class="cx"> #include &lt;wtf/InlineASM.h&gt;
</span><span class="cx"> 
</span><span class="cx"> #if ENABLE(JIT)
</span><span class="lines">@@ -1765,6 +1765,7 @@
</span><span class="cx"> static bool shouldTriggerFTLCompile(CodeBlock* codeBlock, JITCode* jitCode)
</span><span class="cx"> {
</span><span class="cx">     if (codeBlock-&gt;baselineVersion()-&gt;m_didFailFTLCompilation) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;abortFTLCompile&quot;, ());
</ins><span class="cx">         if (Options::verboseOSR())
</span><span class="cx">             dataLog(&quot;Deferring FTL-optimization of &quot;, *codeBlock, &quot; indefinitely because there was an FTL failure.\n&quot;);
</span><span class="cx">         jitCode-&gt;dontOptimizeAnytimeSoon(codeBlock);
</span><span class="lines">@@ -1773,6 +1774,7 @@
</span><span class="cx"> 
</span><span class="cx">     if (!codeBlock-&gt;hasOptimizedReplacement()
</span><span class="cx">         &amp;&amp; !jitCode-&gt;checkIfOptimizationThresholdReached(codeBlock)) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;counter = &quot;, jitCode-&gt;tierUpCounter));
</ins><span class="cx">         if (Options::verboseOSR())
</span><span class="cx">             dataLog(&quot;Choosing not to FTL-optimize &quot;, *codeBlock, &quot; yet.\n&quot;);
</span><span class="cx">         return false;
</span><span class="lines">@@ -1790,12 +1792,14 @@
</span><span class="cx">         worklistState = Worklist::NotKnown;
</span><span class="cx">     
</span><span class="cx">     if (worklistState == Worklist::Compiling) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;still compiling&quot;));
</ins><span class="cx">         jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(
</span><span class="cx">             codeBlock, CompilationDeferred);
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     if (codeBlock-&gt;hasOptimizedReplacement()) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;has replacement&quot;));
</ins><span class="cx">         // That's great, we've compiled the code - next time we call this function,
</span><span class="cx">         // we'll enter that replacement.
</span><span class="cx">         jitCode-&gt;optimizeSoon(codeBlock);
</span><span class="lines">@@ -1803,6 +1807,7 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     if (worklistState == Worklist::Compiled) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;compiled and failed&quot;));
</ins><span class="cx">         // This means that we finished compiling, but failed somehow; in that case the
</span><span class="cx">         // thresholds will be set appropriately.
</span><span class="cx">         if (Options::verboseOSR())
</span><span class="lines">@@ -1810,6 +1815,7 @@
</span><span class="cx">         return;
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    CODEBLOCK_LOG_EVENT(codeBlock, &quot;triggerFTLReplacement&quot;, ());
</ins><span class="cx">     // We need to compile the code.
</span><span class="cx">     compile(
</span><span class="cx">         *vm, codeBlock-&gt;newReplacement(), codeBlock, FTLMode, UINT_MAX,
</span><span class="lines">@@ -1845,12 +1851,14 @@
</span><span class="cx"> 
</span><span class="cx">     if (codeBlock-&gt;hasOptimizedReplacement()) {
</span><span class="cx">         if (jitCode-&gt;tierUpEntryTriggers.isEmpty()) {
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;replacement in place, delaying indefinitely&quot;));
</ins><span class="cx">             // There is nothing more we can do, the only way this will be entered
</span><span class="cx">             // is through the function entry point.
</span><span class="cx">             jitCode-&gt;dontOptimizeAnytimeSoon(codeBlock);
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx">         if (jitCode-&gt;osrEntryBlock() &amp;&amp; jitCode-&gt;tierUpEntryTriggers.size() == 1) {
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;trigger in place, delaying indefinitely&quot;));
</ins><span class="cx">             // There is only one outer loop and its trigger must have been set
</span><span class="cx">             // when the plan completed.
</span><span class="cx">             // Exiting the inner loop is useless, we can ignore the counter and leave
</span><span class="lines">@@ -1876,12 +1884,14 @@
</span><span class="cx"> 
</span><span class="cx">     JITCode* jitCode = codeBlock-&gt;jitCode()-&gt;dfg();
</span><span class="cx">     if (worklistState == Worklist::Compiling) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;still compiling&quot;));
</ins><span class="cx">         jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(
</span><span class="cx">             codeBlock, CompilationDeferred);
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (worklistState == Worklist::Compiled) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;compiled and failed&quot;));
</ins><span class="cx">         // This means that compilation failed and we already set the thresholds.
</span><span class="cx">         if (Options::verboseOSR())
</span><span class="cx">             dataLog(&quot;Code block &quot;, *codeBlock, &quot; was compiled but it doesn't have an optimized replacement.\n&quot;);
</span><span class="lines">@@ -1892,8 +1902,10 @@
</span><span class="cx">     if (originBytecodeIndex == osrEntryBytecodeIndex) {
</span><span class="cx">         unsigned streamIndex = jitCode-&gt;bytecodeIndexToStreamIndex.get(originBytecodeIndex);
</span><span class="cx">         if (CodeBlock* entryBlock = jitCode-&gt;osrEntryBlock()) {
</span><del>-            if (void* address = FTL::prepareOSREntry(exec, codeBlock, entryBlock, originBytecodeIndex, streamIndex))
</del><ins>+            if (void* address = FTL::prepareOSREntry(exec, codeBlock, entryBlock, originBytecodeIndex, streamIndex)) {
+                CODEBLOCK_LOG_EVENT(entryBlock, &quot;osrEntry&quot;, (&quot;at bc#&quot;, originBytecodeIndex));
</ins><span class="cx">                 return static_cast&lt;char*&gt;(address);
</span><ins>+            }
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -1911,14 +1923,17 @@
</span><span class="cx">             return nullptr;
</span><span class="cx"> 
</span><span class="cx">         if (jitCode-&gt;osrEntryRetry &lt; Options::ftlOSREntryRetryThreshold()) {
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;avoiding OSR entry compile&quot;));
</ins><span class="cx">             jitCode-&gt;osrEntryRetry++;
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><del>-    }
</del><ins>+    } else
+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;avoiding replacement compile&quot;));
</ins><span class="cx"> 
</span><span class="cx">     // It's time to try to compile code for OSR entry.
</span><span class="cx">     if (CodeBlock* entryBlock = jitCode-&gt;osrEntryBlock()) {
</span><span class="cx">         if (jitCode-&gt;osrEntryRetry &lt; Options::ftlOSREntryRetryThreshold()) {
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;OSR entry failed, OSR entry threshold not met&quot;));
</ins><span class="cx">             jitCode-&gt;osrEntryRetry++;
</span><span class="cx">             jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(
</span><span class="cx">                 codeBlock, CompilationDeferred);
</span><span class="lines">@@ -1929,6 +1944,7 @@
</span><span class="cx">         entryCode-&gt;countEntryFailure();
</span><span class="cx">         if (entryCode-&gt;entryFailureCount() &lt;
</span><span class="cx">             Options::ftlOSREntryFailureCountForReoptimization()) {
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;OSR entry failed&quot;));
</ins><span class="cx">             jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(
</span><span class="cx">                 codeBlock, CompilationDeferred);
</span><span class="cx">             return nullptr;
</span><span class="lines">@@ -1936,6 +1952,7 @@
</span><span class="cx"> 
</span><span class="cx">         // OSR entry failed. Oh no! This implies that we need to retry. We retry
</span><span class="cx">         // without exponential backoff and we only do this for the entry code block.
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;OSR entry failed too many times&quot;));
</ins><span class="cx">         unsigned osrEntryBytecode = entryBlock-&gt;jitCode()-&gt;ftlForOSREntry()-&gt;bytecodeIndex();
</span><span class="cx">         jitCode-&gt;clearOSREntryBlock();
</span><span class="cx">         jitCode-&gt;osrEntryRetry = 0;
</span><span class="lines">@@ -1967,6 +1984,7 @@
</span><span class="cx">         exec, codeBlock, CodeOrigin(osrEntryBytecodeIndex), streamIndex, mustHandleValues);
</span><span class="cx">     CodeBlock* replacementCodeBlock = codeBlock-&gt;newReplacement();
</span><span class="cx"> 
</span><ins>+    CODEBLOCK_LOG_EVENT(codeBlock, &quot;triggerFTLOSR&quot;, ());
</ins><span class="cx">     CompilationResult forEntryResult = compile(
</span><span class="cx">         *vm, replacementCodeBlock, codeBlock, FTLForOSREntryMode, osrEntryBytecodeIndex,
</span><span class="cx">         mustHandleValues, ToFTLForOSREntryDeferredCompilationCallback::create(triggerAddress));
</span><span class="lines">@@ -1975,11 +1993,13 @@
</span><span class="cx">         triggerFTLReplacementCompile(vm, codeBlock, jitCode);
</span><span class="cx"> 
</span><span class="cx">     if (forEntryResult != CompilationSuccessful) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;OSR ecompilation not successful&quot;));
</ins><span class="cx">         jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(
</span><span class="cx">             codeBlock, CompilationDeferred);
</span><span class="cx">         return nullptr;
</span><span class="cx">     }
</span><del>-
</del><ins>+    
+    CODEBLOCK_LOG_EVENT(jitCode-&gt;osrEntryBlock(), &quot;osrEntry&quot;, (&quot;at bc#&quot;, originBytecodeIndex));
</ins><span class="cx">     // It's possible that the for-entry compile already succeeded. In that case OSR
</span><span class="cx">     // entry will succeed unless we ran out of stack. It's not clear what we should do.
</span><span class="cx">     // We signal to try again after a while if that happens.
</span><span class="lines">@@ -2016,8 +2036,10 @@
</span><span class="cx">         triggerFTLReplacementCompile(vm, codeBlock, jitCode);
</span><span class="cx"> 
</span><span class="cx">     // Since we cannot OSR Enter here, the default &quot;optimizeSoon()&quot; is not useful.
</span><del>-    if (codeBlock-&gt;hasOptimizedReplacement())
</del><ins>+    if (codeBlock-&gt;hasOptimizedReplacement()) {
+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayFTLCompile&quot;, (&quot;OSR in loop failed, deferring&quot;));
</ins><span class="cx">         jitCode-&gt;setOptimizationThresholdBasedOnCompilationResult(codeBlock, CompilationDeferred);
</span><ins>+    }
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> char* JIT_OPERATION triggerOSREntryNow(ExecState* exec, unsigned bytecodeIndex)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLJITFinalizercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013-2014, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -83,7 +83,7 @@
</span><span class="cx">     m_plan.codeBlock-&gt;setJITCode(jitCode);
</span><span class="cx"> 
</span><span class="cx">     if (m_plan.compilation)
</span><del>-        m_plan.vm.m_perBytecodeProfiler-&gt;addCompilation(m_plan.compilation);
</del><ins>+        m_plan.vm.m_perBytecodeProfiler-&gt;addCompilation(m_plan.codeBlock, m_plan.compilation);
</ins><span class="cx">     
</span><span class="cx">     return true;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/jit/JIT.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -81,6 +81,10 @@
</span><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+JIT::~JIT()
+{
+}
+
</ins><span class="cx"> #if ENABLE(DFG_JIT)
</span><span class="cx"> void JIT::emitEnterOptimizationCheck()
</span><span class="cx"> {
</span><span class="lines">@@ -738,7 +742,7 @@
</span><span class="cx">     if (m_compilation) {
</span><span class="cx">         if (Options::disassembleBaselineForProfiler())
</span><span class="cx">             m_disassembler-&gt;reportToProfiler(m_compilation.get(), patchBuffer);
</span><del>-        m_vm-&gt;m_perBytecodeProfiler-&gt;addCompilation(m_compilation);
</del><ins>+        m_vm-&gt;m_perBytecodeProfiler-&gt;addCompilation(m_codeBlock, m_compilation);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (m_pcToCodeOriginMapBuilder.didBuildMapping())
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JIT.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JIT.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/jit/JIT.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -257,6 +257,7 @@
</span><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         JIT(VM*, CodeBlock* = 0);
</span><ins>+        ~JIT();
</ins><span class="cx"> 
</span><span class="cx">         void privateCompileMainPass();
</span><span class="cx">         void privateCompileLinkPass();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITDisassemblercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITDisassembler.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITDisassembler.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/jit/JITDisassembler.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2013, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -33,6 +33,7 @@
</span><span class="cx"> #include &quot;JIT.h&quot;
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><span class="cx"> #include &quot;LinkBuffer.h&quot;
</span><ins>+#include &quot;ProfilerCompilation.h&quot;
</ins><span class="cx"> #include &lt;wtf/StringPrintStream.h&gt;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorejitJITOperationscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/jit/JITOperations.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/jit/JITOperations.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1235,6 +1235,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (!codeBlock-&gt;checkIfOptimizationThresholdReached()) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;counter = &quot;, codeBlock-&gt;jitExecuteCounter()));
</ins><span class="cx">         codeBlock-&gt;updateAllPredictions();
</span><span class="cx">         if (Options::verboseOSR())
</span><span class="cx">             dataLog(&quot;Choosing not to optimize &quot;, *codeBlock, &quot; yet, because the threshold hasn't been reached.\n&quot;);
</span><span class="lines">@@ -1242,17 +1243,20 @@
</span><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     if (vm.enabledProfiler()) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;profiler is enabled&quot;));
</ins><span class="cx">         updateAllPredictionsAndOptimizeAfterWarmUp(codeBlock);
</span><span class="cx">         return encodeResult(0, 0);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     Debugger* debugger = codeBlock-&gt;globalObject()-&gt;debugger();
</span><span class="cx">     if (debugger &amp;&amp; (debugger-&gt;isStepping() || codeBlock-&gt;baselineAlternative()-&gt;hasDebuggerRequests())) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;debugger is stepping or has requests&quot;));
</ins><span class="cx">         updateAllPredictionsAndOptimizeAfterWarmUp(codeBlock);
</span><span class="cx">         return encodeResult(0, 0);
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (codeBlock-&gt;m_shouldAlwaysBeInlined) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;should always be inlined&quot;));
</ins><span class="cx">         updateAllPredictionsAndOptimizeAfterWarmUp(codeBlock);
</span><span class="cx">         if (Options::verboseOSR())
</span><span class="cx">             dataLog(&quot;Choosing not to optimize &quot;, *codeBlock, &quot; yet, because m_shouldAlwaysBeInlined == true.\n&quot;);
</span><span class="lines">@@ -1293,6 +1297,7 @@
</span><span class="cx">         worklistState = DFG::Worklist::NotKnown;
</span><span class="cx"> 
</span><span class="cx">     if (worklistState == DFG::Worklist::Compiling) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;compiling&quot;));
</ins><span class="cx">         // We cannot be in the process of asynchronous compilation and also have an optimized
</span><span class="cx">         // replacement.
</span><span class="cx">         RELEASE_ASSERT(!codeBlock-&gt;hasOptimizedReplacement());
</span><span class="lines">@@ -1307,6 +1312,7 @@
</span><span class="cx">         // CodeBlock::setOptimizationThresholdBasedOnCompilationResult() and we have
</span><span class="cx">         // nothing left to do.
</span><span class="cx">         if (!codeBlock-&gt;hasOptimizedReplacement()) {
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;compiled and failed&quot;));
</ins><span class="cx">             codeBlock-&gt;updateAllPredictions();
</span><span class="cx">             if (Options::verboseOSR())
</span><span class="cx">                 dataLog(&quot;Code block &quot;, *codeBlock, &quot; was compiled but it doesn't have an optimized replacement.\n&quot;);
</span><span class="lines">@@ -1329,6 +1335,7 @@
</span><span class="cx">         // shouldReoptimizeFromLoopNow() to always return true. But we make it do some
</span><span class="cx">         // additional checking anyway, to reduce the amount of recompilation thrashing.
</span><span class="cx">         if (codeBlock-&gt;replacement()-&gt;shouldReoptimizeFromLoopNow()) {
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;should reoptimize from loop now&quot;));
</ins><span class="cx">             if (Options::verboseOSR()) {
</span><span class="cx">                 dataLog(
</span><span class="cx">                     &quot;Triggering reoptimization of &quot;, *codeBlock,
</span><span class="lines">@@ -1339,6 +1346,7 @@
</span><span class="cx">         }
</span><span class="cx">     } else {
</span><span class="cx">         if (!codeBlock-&gt;shouldOptimizeNow()) {
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;insufficient profiling&quot;));
</ins><span class="cx">             if (Options::verboseOSR()) {
</span><span class="cx">                 dataLog(
</span><span class="cx">                     &quot;Delaying optimization for &quot;, *codeBlock,
</span><span class="lines">@@ -1369,14 +1377,17 @@
</span><span class="cx">             vm, replacementCodeBlock, nullptr, DFG::DFGMode, bytecodeIndex,
</span><span class="cx">             mustHandleValues, JITToDFGDeferredCompilationCallback::create());
</span><span class="cx">         
</span><del>-        if (result != CompilationSuccessful)
</del><ins>+        if (result != CompilationSuccessful) {
+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;compilation failed&quot;));
</ins><span class="cx">             return encodeResult(0, 0);
</span><ins>+        }
</ins><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     CodeBlock* optimizedCodeBlock = codeBlock-&gt;replacement();
</span><span class="cx">     ASSERT(JITCode::isOptimizingJIT(optimizedCodeBlock-&gt;jitType()));
</span><span class="cx">     
</span><span class="cx">     if (void* dataBuffer = DFG::prepareOSREntry(exec, optimizedCodeBlock, bytecodeIndex)) {
</span><ins>+        CODEBLOCK_LOG_EVENT(optimizedCodeBlock, &quot;osrEntry&quot;, (&quot;at bc#&quot;, bytecodeIndex));
</ins><span class="cx">         if (Options::verboseOSR()) {
</span><span class="cx">             dataLog(
</span><span class="cx">                 &quot;Performing OSR &quot;, *codeBlock, &quot; -&gt; &quot;, *optimizedCodeBlock, &quot;.\n&quot;);
</span><span class="lines">@@ -1406,6 +1417,7 @@
</span><span class="cx">     // right now. So, we only trigger reoptimization only upon the more conservative (non-loop)
</span><span class="cx">     // reoptimization trigger.
</span><span class="cx">     if (optimizedCodeBlock-&gt;shouldReoptimizeNow()) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;should reoptimize now&quot;));
</ins><span class="cx">         if (Options::verboseOSR()) {
</span><span class="cx">             dataLog(
</span><span class="cx">                 &quot;Triggering reoptimization of &quot;, *codeBlock, &quot; -&gt; &quot;,
</span><span class="lines">@@ -1419,6 +1431,7 @@
</span><span class="cx">     // longer and then try again.
</span><span class="cx">     codeBlock-&gt;optimizeAfterWarmUp();
</span><span class="cx">     
</span><ins>+    CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayOptimizeToDFG&quot;, (&quot;OSR failed&quot;));
</ins><span class="cx">     return encodeResult(0, 0);
</span><span class="cx"> }
</span><span class="cx"> #endif
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntSlowPathscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/llint/LLIntSlowPaths.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -319,6 +319,7 @@
</span><span class="cx">     codeBlock-&gt;updateAllValueProfilePredictions();
</span><span class="cx"> 
</span><span class="cx">     if (!codeBlock-&gt;checkIfJITThresholdReached()) {
</span><ins>+        CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayJITCompile&quot;, (&quot;threshold not reached, counter = &quot;, codeBlock-&gt;llintExecuteCounter()));
</ins><span class="cx">         if (Options::verboseOSR())
</span><span class="cx">             dataLogF(&quot;    JIT threshold should be lifted.\n&quot;);
</span><span class="cx">         return false;
</span><span class="lines">@@ -335,6 +336,7 @@
</span><span class="cx">         CompilationResult result = JIT::compile(&amp;vm, codeBlock, JITCompilationCanFail);
</span><span class="cx">         switch (result) {
</span><span class="cx">         case CompilationFailed:
</span><ins>+            CODEBLOCK_LOG_EVENT(codeBlock, &quot;delayJITCompile&quot;, (&quot;compilation failed&quot;));
</ins><span class="cx">             if (Options::verboseOSR())
</span><span class="cx">                 dataLogF(&quot;    JIT compilation failed.\n&quot;);
</span><span class="cx">             codeBlock-&gt;dontJITAnytimeSoon();
</span><span class="lines">@@ -372,6 +374,8 @@
</span><span class="cx">     if (!jitCompileAndSetHeuristics(codeBlock, exec))
</span><span class="cx">         LLINT_RETURN_TWO(0, 0);
</span><span class="cx">     
</span><ins>+    CODEBLOCK_LOG_EVENT(codeBlock, &quot;OSR entry&quot;, (&quot;in prologue&quot;));
+    
</ins><span class="cx">     if (kind == Prologue)
</span><span class="cx">         LLINT_RETURN_TWO(codeBlock-&gt;jitCode()-&gt;executableAddress(), 0);
</span><span class="cx">     ASSERT(kind == ArityCheck);
</span><span class="lines">@@ -429,6 +433,8 @@
</span><span class="cx">     if (!jitCompileAndSetHeuristics(codeBlock, exec))
</span><span class="cx">         LLINT_RETURN_TWO(0, 0);
</span><span class="cx">     
</span><ins>+    CODEBLOCK_LOG_EVENT(codeBlock, &quot;osrEntry&quot;, (&quot;at bc#&quot;, pc - codeBlock-&gt;instructions().begin()));
+
</ins><span class="cx">     ASSERT(codeBlock-&gt;jitType() == JITCode::BaselineJIT);
</span><span class="cx">     
</span><span class="cx">     Vector&lt;BytecodeAndMachineOffset&gt; map;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerCompilationcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2014, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -42,6 +42,7 @@
</span><span class="cx">     , m_numInlinedGetByIds(0)
</span><span class="cx">     , m_numInlinedPutByIds(0)
</span><span class="cx">     , m_numInlinedCalls(0)
</span><ins>+    , m_uid(UID::create())
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -106,6 +107,11 @@
</span><span class="cx">         m_additionalJettisonReason = CString();
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Compilation::dump(PrintStream&amp; out) const
+{
+    out.print(&quot;Comp&quot;, m_uid);
+}
+
</ins><span class="cx"> JSValue Compilation::toJS(ExecState* exec) const
</span><span class="cx"> {
</span><span class="cx">     JSObject* result = constructEmptyObject(exec);
</span><span class="lines">@@ -149,6 +155,8 @@
</span><span class="cx">     if (!m_additionalJettisonReason.isNull())
</span><span class="cx">         result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().additionalJettisonReason, jsString(exec, String::fromUTF8(m_additionalJettisonReason)));
</span><span class="cx">     
</span><ins>+    result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().uid, m_uid.toJS(exec));
+    
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerCompilationh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerCompilation.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2014, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include &quot;ProfilerOSRExitSite.h&quot;
</span><span class="cx"> #include &quot;ProfilerOriginStack.h&quot;
</span><span class="cx"> #include &quot;ProfilerProfiledBytecodes.h&quot;
</span><ins>+#include &quot;ProfilerUID.h&quot;
</ins><span class="cx"> #include &lt;wtf/RefCounted.h&gt;
</span><span class="cx"> #include &lt;wtf/SegmentedVector.h&gt;
</span><span class="cx"> 
</span><span class="lines">@@ -75,6 +76,9 @@
</span><span class="cx">     
</span><span class="cx">     void setJettisonReason(JettisonReason, const FireDetail*);
</span><span class="cx">     
</span><ins>+    UID uid() const { return m_uid; }
+    
+    void dump(PrintStream&amp;) const;
</ins><span class="cx">     JSValue toJS(ExecState*) const;
</span><span class="cx">     
</span><span class="cx"> private:
</span><span class="lines">@@ -90,6 +94,7 @@
</span><span class="cx">     unsigned m_numInlinedGetByIds;
</span><span class="cx">     unsigned m_numInlinedPutByIds;
</span><span class="cx">     unsigned m_numInlinedCalls;
</span><ins>+    UID m_uid;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } } // namespace JSC::Profiler
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerDatabasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2013, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;JSONObject.h&quot;
</span><span class="cx"> #include &quot;ObjectConstructor.h&quot;
</span><span class="cx"> #include &quot;JSCInlines.h&quot;
</span><ins>+#include &lt;wtf/CurrentTime.h&gt;
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC { namespace Profiler {
</span><span class="cx"> 
</span><span class="lines">@@ -58,7 +59,11 @@
</span><span class="cx"> Bytecodes* Database::ensureBytecodesFor(CodeBlock* codeBlock)
</span><span class="cx"> {
</span><span class="cx">     LockHolder locker(m_lock);
</span><del>-    
</del><ins>+    return ensureBytecodesFor(locker, codeBlock);
+}
+
+Bytecodes* Database::ensureBytecodesFor(const LockHolder&amp;, CodeBlock* codeBlock)
+{
</ins><span class="cx">     codeBlock = codeBlock-&gt;baselineVersion();
</span><span class="cx">     
</span><span class="cx">     HashMap&lt;CodeBlock*, Bytecodes*&gt;::iterator iter = m_bytecodesMap.find(codeBlock);
</span><span class="lines">@@ -78,13 +83,18 @@
</span><span class="cx">     LockHolder locker(m_lock);
</span><span class="cx">     
</span><span class="cx">     m_bytecodesMap.remove(codeBlock);
</span><ins>+    m_compilationMap.remove(codeBlock);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-void Database::addCompilation(PassRefPtr&lt;Compilation&gt; compilation)
</del><ins>+void Database::addCompilation(CodeBlock* codeBlock, PassRefPtr&lt;Compilation&gt; passedCompilation)
</ins><span class="cx"> {
</span><ins>+    LockHolder locker(m_lock);
</ins><span class="cx">     ASSERT(!isCompilationThread());
</span><ins>+
+    RefPtr&lt;Compilation&gt; compilation = passedCompilation;
</ins><span class="cx">     
</span><span class="cx">     m_compilations.append(compilation);
</span><ins>+    m_compilationMap.set(codeBlock, compilation);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> JSValue Database::toJS(ExecState* exec) const
</span><span class="lines">@@ -101,6 +111,11 @@
</span><span class="cx">         compilations-&gt;putDirectIndex(exec, i, m_compilations[i]-&gt;toJS(exec));
</span><span class="cx">     result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().compilations, compilations);
</span><span class="cx">     
</span><ins>+    JSArray* events = constructEmptyArray(exec, 0);
+    for (unsigned i = 0; i &lt; m_events.size(); ++i)
+        events-&gt;putDirectIndex(exec, i, m_events[i].toJS(exec));
+    result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().events, events);
+    
</ins><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -133,6 +148,15 @@
</span><span class="cx">     m_shouldSaveAtExit = true;
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+void Database::logEvent(CodeBlock* codeBlock, const char* summary, const CString&amp; detail)
+{
+    LockHolder locker(m_lock);
+    
+    Bytecodes* bytecodes = ensureBytecodesFor(locker, codeBlock);
+    Compilation* compilation = m_compilationMap.get(codeBlock);
+    m_events.append(Event(currentTime(), bytecodes, compilation, summary, detail));
+}
+
</ins><span class="cx"> void Database::addDatabaseToAtExit()
</span><span class="cx"> {
</span><span class="cx">     if (++didRegisterAtExit == 1)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerDatabaseh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerDatabase.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012-2013, 2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;ProfilerBytecodes.h&quot;
</span><span class="cx"> #include &quot;ProfilerCompilation.h&quot;
</span><span class="cx"> #include &quot;ProfilerCompilationKind.h&quot;
</span><ins>+#include &quot;ProfilerEvent.h&quot;
</ins><span class="cx"> #include &lt;wtf/FastMalloc.h&gt;
</span><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/Lock.h&gt;
</span><span class="lines">@@ -52,7 +53,7 @@
</span><span class="cx">     Bytecodes* ensureBytecodesFor(CodeBlock*);
</span><span class="cx">     void notifyDestruction(CodeBlock*);
</span><span class="cx">     
</span><del>-    void addCompilation(PassRefPtr&lt;Compilation&gt;);
</del><ins>+    void addCompilation(CodeBlock*, PassRefPtr&lt;Compilation&gt;);
</ins><span class="cx">     
</span><span class="cx">     // Converts the database to a JavaScript object that is suitable for JSON stringification.
</span><span class="cx">     // Note that it's probably a good idea to use an ExecState* associated with a global
</span><span class="lines">@@ -70,7 +71,11 @@
</span><span class="cx"> 
</span><span class="cx">     void registerToSaveAtExit(const char* filename);
</span><span class="cx">     
</span><ins>+    JS_EXPORT_PRIVATE void logEvent(CodeBlock* codeBlock, const char* summary, const CString&amp; detail);
+    
</ins><span class="cx"> private:
</span><ins>+    Bytecodes* ensureBytecodesFor(const LockHolder&amp;, CodeBlock*);
+    
</ins><span class="cx">     void addDatabaseToAtExit();
</span><span class="cx">     void removeDatabaseFromAtExit();
</span><span class="cx">     void performAtExitSave() const;
</span><span class="lines">@@ -82,6 +87,8 @@
</span><span class="cx">     SegmentedVector&lt;Bytecodes&gt; m_bytecodes;
</span><span class="cx">     HashMap&lt;CodeBlock*, Bytecodes*&gt; m_bytecodesMap;
</span><span class="cx">     Vector&lt;RefPtr&lt;Compilation&gt;&gt; m_compilations;
</span><ins>+    HashMap&lt;CodeBlock*, RefPtr&lt;Compilation&gt;&gt; m_compilationMap;
+    Vector&lt;Event&gt; m_events;
</ins><span class="cx">     bool m_shouldSaveAtExit;
</span><span class="cx">     CString m_atExitSaveFilename;
</span><span class="cx">     Database* m_nextRegisteredDatabase;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerEventcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/profiler/ProfilerEvent.cpp (0 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerEvent.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerEvent.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ProfilerEvent.h&quot;
+
+#include &quot;JSCInlines.h&quot;
+#include &quot;ObjectConstructor.h&quot;
+#include &quot;ProfilerBytecodes.h&quot;
+#include &quot;ProfilerCompilation.h&quot;
+#include &quot;ProfilerUID.h&quot;
+
+namespace JSC { namespace Profiler {
+
+void Event::dump(PrintStream&amp; out) const
+{
+    out.print(m_time, &quot;: &quot;, pointerDump(m_bytecodes));
+    if (m_compilation)
+        out.print(&quot; &quot;, *m_compilation);
+    out.print(&quot;: &quot;, m_summary);
+    if (m_detail.length())
+        out.print(&quot; (&quot;, m_detail, &quot;)&quot;);
+}
+
+JSValue Event::toJS(ExecState* exec) const
+{
+    JSObject* result = constructEmptyObject(exec);
+    
+    result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().time, jsNumber(m_time));
+    result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().bytecodesID, jsNumber(m_bytecodes-&gt;id()));
+    if (m_compilation)
+        result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().compilationUID, m_compilation-&gt;uid().toJS(exec));
+    result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().summary, jsString(exec, String::fromUTF8(m_summary)));
+    if (m_detail.length())
+        result-&gt;putDirect(exec-&gt;vm(), exec-&gt;propertyNames().detail, jsString(exec, String::fromUTF8(m_detail)));
+    
+    return result;
+}
+
+} } // namespace JSC::Profiler
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerEventh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/profiler/ProfilerEvent.h (0 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerEvent.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerEvent.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -0,0 +1,78 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef ProfilerEvent_h
+#define ProfilerEvent_h
+
+#include &quot;JSCJSValue.h&quot;
+#include &lt;wtf/PrintStream.h&gt;
+#include &lt;wtf/text/CString.h&gt;
+
+namespace JSC { namespace Profiler {
+
+class Bytecodes;
+class Compilation;
+
+class Event {
+public:
+    Event()
+    {
+    }
+    
+    Event(double time, Bytecodes* bytecodes, Compilation* compilation, const char* summary, const CString&amp; detail)
+        : m_time(time)
+        , m_bytecodes(bytecodes)
+        , m_compilation(compilation)
+        , m_summary(summary)
+        , m_detail(detail)
+    {
+    }
+    
+    explicit operator bool() const
+    {
+        return m_bytecodes;
+    }
+    
+    double time() const { return m_time; }
+    Bytecodes* bytecodes() const { return m_bytecodes; }
+    Compilation* compilation() const { return m_compilation; }
+    const char* summary() const { return m_summary; }
+    const CString&amp; detail() const { return m_detail; }
+    
+    void dump(PrintStream&amp;) const;
+    JSValue toJS(ExecState*) const;
+    
+private:
+    double m_time { 0 };
+    Bytecodes* m_bytecodes { nullptr };
+    Compilation* m_compilation { nullptr };
+    const char* m_summary { nullptr };
+    CString m_detail;
+};
+
+} } // namespace JSC::Profiler
+
+#endif // ProfilerEvent_h
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerUIDcpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/profiler/ProfilerUID.cpp (0 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerUID.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerUID.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -0,0 +1,56 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+#include &quot;ProfilerUID.h&quot;
+
+#include &quot;JSCInlines.h&quot;
+#include &lt;wtf/Lock.h&gt;
+
+namespace JSC { namespace Profiler {
+
+UID UID::create()
+{
+    static StaticLock lock;
+    static uint64_t counter;
+    
+    LockHolder locker(lock);
+    UID result;
+    result.m_uid = ++counter;
+    return result;
+}
+
+void UID::dump(PrintStream&amp; out) const
+{
+    out.print(m_uid);
+}
+
+JSValue UID::toJS(ExecState* exec) const
+{
+    return jsString(exec, toString(*this));
+}
+
+} } // namespace JSC::Profiler
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreprofilerProfilerUIDh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/profiler/ProfilerUID.h (0 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/profiler/ProfilerUID.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/profiler/ProfilerUID.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -0,0 +1,114 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#ifndef ProfilerUID_h
+#define ProfilerUID_h
+
+#include &quot;JSCJSValue.h&quot;
+#include &lt;wtf/HashMap.h&gt;
+#include &lt;wtf/PrintStream.h&gt;
+
+namespace JSC { namespace Profiler {
+
+class UID {
+public:
+    UID()
+        : m_uid(0)
+    {
+    }
+    
+    static UID fromInt(uint64_t value)
+    {
+        UID result;
+        result.m_uid = value;
+        return result;
+    }
+    
+    UID(WTF::HashTableDeletedValueType)
+        : m_uid(std::numeric_limits&lt;uint64_t&gt;::max())
+    {
+    }
+    
+    static UID create();
+    
+    uint64_t toInt() const
+    {
+        return m_uid;
+    }
+    
+    bool operator==(const UID&amp; other) const
+    {
+        return m_uid == other.m_uid;
+    }
+    
+    bool operator!=(const UID&amp; other) const
+    {
+        return !(*this == other);
+    }
+    
+    explicit operator bool() const
+    {
+        return *this != UID();
+    }
+    
+    bool isHashTableDeletedValue() const
+    {
+        return *this != UID(WTF::HashTableDeletedValue);
+    }
+    
+    unsigned hash() const
+    {
+        return IntHash&lt;uint64_t&gt;::hash(m_uid);
+    }
+    
+    void dump(PrintStream&amp;) const;
+    JSValue toJS(ExecState*) const;
+    
+private:
+    uint64_t m_uid;
+};
+
+struct UIDHash {
+    static unsigned hash(const UID&amp; key) { return key.hash(); }
+    static bool equal(const UID&amp; a, const UID&amp; b) { return a == b; }
+    static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+} } // namespace JSC::Profiler
+
+namespace WTF {
+
+template&lt;typename T&gt; struct DefaultHash;
+template&lt;&gt; struct DefaultHash&lt;JSC::Profiler::UID&gt; {
+    typedef JSC::Profiler::UIDHash Hash;
+};
+
+template&lt;typename T&gt; struct HashTraits;
+template&lt;&gt; struct HashTraits&lt;JSC::Profiler::UID&gt; : SimpleClassHashTraits&lt;JSC::Profiler::UID&gt; { };
+
+} // namespace WTF
+
+#endif // ProfilerUID_h
+
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCommonIdentifiersh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/runtime/CommonIdentifiers.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -126,6 +126,7 @@
</span><span class="cx">     macro(collation) \
</span><span class="cx">     macro(column) \
</span><span class="cx">     macro(compilationKind) \
</span><ins>+    macro(compilationUID) \
</ins><span class="cx">     macro(compilations) \
</span><span class="cx">     macro(compile) \
</span><span class="cx">     macro(configurable) \
</span><span class="lines">@@ -136,12 +137,14 @@
</span><span class="cx">     macro(defineProperty) \
</span><span class="cx">     macro(description) \
</span><span class="cx">     macro(descriptions) \
</span><ins>+    macro(detail) \
</ins><span class="cx">     macro(displayName) \
</span><span class="cx">     macro(document) \
</span><span class="cx">     macro(done) \
</span><span class="cx">     macro(enumerable) \
</span><span class="cx">     macro(era) \
</span><span class="cx">     macro(eval) \
</span><ins>+    macro(events) \
</ins><span class="cx">     macro(exec) \
</span><span class="cx">     macro(executionCount) \
</span><span class="cx">     macro(exitKind) \
</span><span class="lines">@@ -227,9 +230,11 @@
</span><span class="cx">     macro(stack) \
</span><span class="cx">     macro(sticky) \
</span><span class="cx">     macro(subarray) \
</span><ins>+    macro(summary) \
</ins><span class="cx">     macro(target) \
</span><span class="cx">     macro(test) \
</span><span class="cx">     macro(then) \
</span><ins>+    macro(time) \
</ins><span class="cx">     macro(timeZone) \
</span><span class="cx">     macro(timeZoneName) \
</span><span class="cx">     macro(toExponential) \
</span><span class="lines">@@ -240,6 +245,7 @@
</span><span class="cx">     macro(toPrecision) \
</span><span class="cx">     macro(toString) \
</span><span class="cx">     macro(top) \
</span><ins>+    macro(uid) \
</ins><span class="cx">     macro(unicode) \
</span><span class="cx">     macro(usage) \
</span><span class="cx">     macro(value) \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2009, 2010, 2013, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2009, 2010, 2013, 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -36,6 +36,7 @@
</span><span class="cx"> #include &quot;Parser.h&quot;
</span><span class="cx"> #include &quot;ProfilerDatabase.h&quot;
</span><span class="cx"> #include &quot;TypeProfiler.h&quot;
</span><ins>+#include &quot;VMInlines.h&quot;
</ins><span class="cx"> #include &quot;WASMFunctionParser.h&quot;
</span><span class="cx"> #include &lt;wtf/CommaPrinter.h&gt;
</span><span class="cx"> #include &lt;wtf/Vector.h&gt;
</span><span class="lines">@@ -176,6 +177,8 @@
</span><span class="cx"> {
</span><span class="cx">     ASSERT(vm.heap.isDeferred());
</span><span class="cx">     
</span><ins>+    CODEBLOCK_LOG_EVENT(genericCodeBlock, &quot;installCode&quot;, ());
+    
</ins><span class="cx">     CodeBlock* oldCodeBlock = nullptr;
</span><span class="cx">     
</span><span class="cx">     switch (codeType) {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VM.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VM.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/runtime/VM.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -612,6 +612,9 @@
</span><span class="cx">     BytecodeIntrinsicRegistry&amp; bytecodeIntrinsicRegistry() { return *m_bytecodeIntrinsicRegistry; }
</span><span class="cx">     
</span><span class="cx">     ShadowChicken&amp; shadowChicken() { return *m_shadowChicken; }
</span><ins>+    
+    template&lt;typename Func&gt;
+    void logEvent(CodeBlock*, const char* summary, const Func&amp; func);
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend class LLIntOffsetsExtractor;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeVMInlinesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/VMInlines.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/VMInlines.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/JavaScriptCore/runtime/VMInlines.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2015-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -26,6 +26,7 @@
</span><span class="cx"> #ifndef VMInlines_h
</span><span class="cx"> #define VMInlines_h
</span><span class="cx"> 
</span><ins>+#include &quot;ProfilerDatabase.h&quot;
</ins><span class="cx"> #include &quot;VM.h&quot;
</span><span class="cx"> #include &quot;Watchdog.h&quot;
</span><span class="cx"> 
</span><span class="lines">@@ -38,6 +39,15 @@
</span><span class="cx">     return watchdog()-&gt;shouldTerminate(exec);
</span><span class="cx"> }
</span><span class="cx"> 
</span><ins>+template&lt;typename Func&gt;
+void VM::logEvent(CodeBlock* codeBlock, const char* summary, const Func&amp; func)
+{
+    if (LIKELY(!m_perBytecodeProfiler))
+        return;
+    
+    m_perBytecodeProfiler-&gt;logEvent(codeBlock, summary, func());
+}
+
</ins><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><span class="cx"> #endif // LLIntData_h
</span></span></pre></div>
<a id="trunkSourceWTFChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/ChangeLog (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/ChangeLog        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/WTF/ChangeLog        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2016-05-10  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Internal JSC profiler should have a timestamped log of events for each code block
+        https://bugs.webkit.org/show_bug.cgi?id=157538
+
+        Reviewed by Benjamin Poulain.
+
+        * wtf/PrintStream.h:
+        (WTF::PrintStream::print):
+
</ins><span class="cx"> 2016-05-10  Chris Dumez  &lt;cdumez@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Get rid of a lot of calls to RefPtr::release()
</span></span></pre></div>
<a id="trunkSourceWTFwtfPrintStreamh"></a>
<div class="modfile"><h4>Modified: trunk/Source/WTF/wtf/PrintStream.h (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WTF/wtf/PrintStream.h        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Source/WTF/wtf/PrintStream.h        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012, 2014, 2015 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2014-2016 Apple Inc. All rights reserved.
</ins><span class="cx">  *
</span><span class="cx">  * Redistribution and use in source and binary forms, with or without
</span><span class="cx">  * modification, are permitted provided that the following conditions
</span><span class="lines">@@ -55,6 +55,8 @@
</span><span class="cx">     // Typically a no-op for many subclasses of PrintStream, this is a hint that
</span><span class="cx">     // the implementation should flush its buffers if it had not done so already.
</span><span class="cx">     virtual void flush();
</span><ins>+    
+    void print() { }
</ins><span class="cx"> 
</span><span class="cx">     template&lt;typename T&gt;
</span><span class="cx">     void print(const T&amp; value)
</span></span></pre></div>
<a id="trunkToolsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Tools/ChangeLog (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/ChangeLog        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Tools/ChangeLog        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,3 +1,12 @@
</span><ins>+2016-05-10  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        Internal JSC profiler should have a timestamped log of events for each code block
+        https://bugs.webkit.org/show_bug.cgi?id=157538
+
+        Reviewed by Benjamin Poulain.
+
+        * Scripts/display-profiler-output:
+
</ins><span class="cx"> 2016-05-10  Michael Catanzaro  &lt;mcatanzaro@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [Linux] Remove seccomp filters support
</span></span></pre></div>
<a id="trunkToolsScriptsdisplayprofileroutput"></a>
<div class="modfile"><h4>Modified: trunk/Tools/Scripts/display-profiler-output (200657 => 200658)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Tools/Scripts/display-profiler-output        2016-05-11 00:02:02 UTC (rev 200657)
+++ trunk/Tools/Scripts/display-profiler-output        2016-05-11 00:08:50 UTC (rev 200658)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> #!/usr/bin/env ruby
</span><span class="cx"> 
</span><del>-# Copyright (C) 2012, 2013, 2014 Apple Inc. All rights reserved.
</del><ins>+# Copyright (C) 2012-2014, 2016 Apple Inc. All rights reserved.
</ins><span class="cx"> #
</span><span class="cx"> # Redistribution and use in source and binary forms, with or without
</span><span class="cx"> # modification, are permitted provided that the following conditions
</span><span class="lines">@@ -331,7 +331,7 @@
</span><span class="cx"> class Compilation
</span><span class="cx">     attr_accessor :bytecode, :engine, :descriptions, :counters, :compilationIndex
</span><span class="cx">     attr_accessor :osrExits, :profiledBytecodes, :numInlinedGetByIds, :numInlinedPutByIds
</span><del>-    attr_accessor :numInlinedCalls, :jettisonReason, :additionalJettisonReason
</del><ins>+    attr_accessor :numInlinedCalls, :jettisonReason, :additionalJettisonReason, :uid
</ins><span class="cx">     
</span><span class="cx">     def initialize(json)
</span><span class="cx">         @bytecode = $bytecodes[json[&quot;bytecodesID&quot;].to_i]
</span><span class="lines">@@ -386,6 +386,7 @@
</span><span class="cx">         @numInlinedCalls = json[&quot;numInlinedCalls&quot;]
</span><span class="cx">         @jettisonReason = json[&quot;jettisonReason&quot;]
</span><span class="cx">         @additionalJettisonReason = json[&quot;additionalJettisonReason&quot;]
</span><ins>+        @uid = json[&quot;uid&quot;]
</ins><span class="cx">     end
</span><span class="cx">     
</span><span class="cx">     def codeHashSortKey
</span><span class="lines">@@ -438,6 +439,20 @@
</span><span class="cx">     end
</span><span class="cx"> end
</span><span class="cx"> 
</span><ins>+class Event
+    attr_reader :time, :bytecode, :compilation, :summary, :detail
+    
+    def initialize(json)
+        @time = json[&quot;time&quot;].to_f
+        @bytecode = $bytecodes[json[&quot;bytecodesID&quot;].to_i]
+        if json[&quot;compilationUID&quot;]
+            @compilation = $compilationMap[json[&quot;compilationUID&quot;]]
+        end
+        @summary = json[&quot;summary&quot;]
+        @detail = json[&quot;detail&quot;]
+    end
+end
+
</ins><span class="cx"> def originToPrintStack(origin)
</span><span class="cx">     (0...(origin.size - 1)).map {
</span><span class="cx">         | index |
</span><span class="lines">@@ -468,6 +483,15 @@
</span><span class="cx">     | subJson |
</span><span class="cx">     Compilation.new(subJson)
</span><span class="cx"> }
</span><ins>+$compilationMap = {}
+$compilations.each {
+    | compilation |
+    $compilationMap[compilation.uid] = compilation
+}
+$events = $json[&quot;events&quot;].map {
+    | subJson |
+    Event.new(subJson)
+}
</ins><span class="cx"> $engines = [&quot;Baseline&quot;, &quot;DFG&quot;, &quot;FTL&quot;, &quot;FTLForOSREntry&quot;]
</span><span class="cx"> 
</span><span class="cx"> def isOptimizing(engine)
</span><span class="lines">@@ -477,15 +501,17 @@
</span><span class="cx"> $showCounts = true
</span><span class="cx"> $sortMode = :time
</span><span class="cx"> 
</span><del>-def lpad(str,chars)
-  if str.length&gt;chars
-    str
-  else
-    &quot;%#{chars}s&quot;%(str)
-  end
</del><ins>+def lpad(str, chars)
+    str = str.to_s
+    if str.length &gt; chars
+        str
+    else
+        &quot;%#{chars}s&quot;%(str)
+    end
</ins><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> def rpad(str, chars)
</span><ins>+    str = str.to_s
</ins><span class="cx">     while str.length &lt; chars
</span><span class="cx">         str += &quot; &quot;
</span><span class="cx">     end
</span><span class="lines">@@ -493,6 +519,7 @@
</span><span class="cx"> end
</span><span class="cx"> 
</span><span class="cx"> def center(str, chars)
</span><ins>+    str = str.to_s
</ins><span class="cx">     while str.length &lt; chars
</span><span class="cx">         str += &quot; &quot;
</span><span class="cx">         if str.length &lt; chars
</span><span class="lines">@@ -736,6 +763,7 @@
</span><span class="cx">         puts &quot;bytecode (b)    Show the bytecode for a code block, with counts.&quot;
</span><span class="cx">         puts &quot;profiling (p)   Show the (internal) profiling data for a code block.&quot;
</span><span class="cx">         puts &quot;log (l)         List the compilations, exits, and jettisons involving this code block.&quot;
</span><ins>+        puts &quot;events (e)      List of events involving this code block.&quot;
</ins><span class="cx">         puts &quot;display (d)     Display details for a code block.&quot;
</span><span class="cx">         puts &quot;inlines         Show all inlining stacks that the code block was on.&quot;
</span><span class="cx">         puts &quot;counts          Set whether to show counts for 'bytecode' and 'display'.&quot;
</span><span class="lines">@@ -875,6 +903,52 @@
</span><span class="cx">                 end
</span><span class="cx">             end
</span><span class="cx">         }
</span><ins>+    when &quot;events&quot;, &quot;e&quot;
+        if args.length != 1
+            puts &quot;Usage: inlines &lt;code block hash&gt;&quot;
+            return
+        end
+        
+        hash = Regexp.new(Regexp.escape(args[0]))
+        
+        events = []
+        $events.each {
+            | event |
+            if event.bytecode.to_s =~ hash
+                events &lt;&lt; event
+            end
+        }
+        
+        timeCols = 0
+        hashCols = 0
+        compilationCols = 0
+        summaryCols = 0
+        events.each {
+            | event |
+            timeCols = [event.time.to_s.size, timeCols].max
+            hashCols = [event.bytecode.to_s.size, hashCols].max
+            if event.compilation
+                compilationCols = [event.compilation.to_s.size, compilationCols].max
+            end
+            summaryCols = [event.summary.size, summaryCols].max
+        }
+        
+        events.each {
+            | event |
+            print rpad(event.time.to_s, timeCols)
+            print &quot; &quot;
+            print rpad(event.bytecode.to_s, hashCols)
+            print &quot; &quot;
+            compilationStr = &quot;&quot;
+            if event.compilation
+                compilationStr = event.compilation.to_s
+            end
+            print rpad(compilationStr, compilationCols)
+            print &quot; &quot;
+            print rpad(event.summary, summaryCols)
+            print &quot; &quot;
+            puts event.detail
+        }
</ins><span class="cx">     when &quot;inlines&quot;
</span><span class="cx">         if args.length != 1
</span><span class="cx">             puts &quot;Usage: inlines &lt;code block hash&gt;&quot;
</span></span></pre>
</div>
</div>

</body>
</html>