<!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 <fpizlo@apple.com>
+
+ 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 <pecoraro@apple.com>
</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 = "<group>"; };
</span><span class="cx">                 DC2143051CA32E52000A8869 /* ICStats.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ICStats.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 DC2143061CA32E52000A8869 /* ICStats.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ICStats.h; sourceTree = "<group>"; };
</span><ins>+                DC605B591CE26E9800593718 /* ProfilerEvent.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProfilerEvent.cpp; path = profiler/ProfilerEvent.cpp; sourceTree = "<group>"; };
+                DC605B5A1CE26E9800593718 /* ProfilerEvent.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProfilerEvent.h; path = profiler/ProfilerEvent.h; sourceTree = "<group>"; };
+                DC605B5B1CE26E9800593718 /* ProfilerUID.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ProfilerUID.cpp; path = profiler/ProfilerUID.cpp; sourceTree = "<group>"; };
+                DC605B5C1CE26E9800593718 /* ProfilerUID.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ProfilerUID.h; path = profiler/ProfilerUID.h; sourceTree = "<group>"; };
</ins><span class="cx">                 DC7997811CDE9F9E004D4A09 /* TagRegistersMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = TagRegistersMode.cpp; sourceTree = "<group>"; };
</span><span class="cx">                 DC7997821CDE9F9E004D4A09 /* TagRegistersMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TagRegistersMode.h; sourceTree = "<group>"; };
</span><span class="cx">                 DCF3D5641CD29468003D5C65 /* LazyClassStructure.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = LazyClassStructure.cpp; sourceTree = "<group>"; };
</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 = "<group>";
</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 "TypeLocationCache.h"
</span><span class="cx"> #include "TypeProfiler.h"
</span><span class="cx"> #include "UnlinkedInstructionStream.h"
</span><ins>+#include "VMInlines.h"
</ins><span class="cx"> #include <wtf/BagToHashMap.h>
</span><span class="cx"> #include <wtf/CommaPrinter.h>
</span><span class="cx"> #include <wtf/StringExtras.h>
</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, "jettison", ("due to ", reason, ", counting = ", mode == CountReoptimization, ", detail = ", 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 "LazyOperandValueProfile.h"
</span><span class="cx"> #include "ObjectAllocationProfile.h"
</span><span class="cx"> #include "Options.h"
</span><del>-#include "ProfilerCompilation.h"
</del><span class="cx"> #include "ProfilerJettisonReason.h"
</span><span class="cx"> #include "PutPropertySlot.h"
</span><span class="cx"> #include "RegExpObject.h"
</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->vm()->logEvent(codeBlock, summary, [&] () { 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 "CodeBlock.h"
</span><ins>+#include "VMInlines.h"
</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, "frequentExit", (site));
+
</ins><span class="cx"> if (Options::verboseExitProfile())
</span><span class="cx"> dataLog(pointerDump(owner), ": Adding exit site: ", site, "\n");
</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->addCompilation(m_plan.compilation);
</del><ins>+ m_plan.vm.m_perBytecodeProfiler->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->baselineVersion()->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 "ValueProfile.h"
</span><span class="cx"> #include <wtf/ListDump.h>
</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 "Symbol.h"
</span><span class="cx"> #include "TypeProfilerLog.h"
</span><span class="cx"> #include "TypedArrayInlines.h"
</span><del>-#include "VM.h"
</del><ins>+#include "VMInlines.h"
</ins><span class="cx"> #include <wtf/InlineASM.h>
</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->baselineVersion()->m_didFailFTLCompilation) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "abortFTLCompile", ());
</ins><span class="cx"> if (Options::verboseOSR())
</span><span class="cx"> dataLog("Deferring FTL-optimization of ", *codeBlock, " indefinitely because there was an FTL failure.\n");
</span><span class="cx"> jitCode->dontOptimizeAnytimeSoon(codeBlock);
</span><span class="lines">@@ -1773,6 +1774,7 @@
</span><span class="cx">
</span><span class="cx"> if (!codeBlock->hasOptimizedReplacement()
</span><span class="cx"> && !jitCode->checkIfOptimizationThresholdReached(codeBlock)) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("counter = ", jitCode->tierUpCounter));
</ins><span class="cx"> if (Options::verboseOSR())
</span><span class="cx"> dataLog("Choosing not to FTL-optimize ", *codeBlock, " yet.\n");
</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, "delayFTLCompile", ("still compiling"));
</ins><span class="cx"> jitCode->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->hasOptimizedReplacement()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("has replacement"));
</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->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, "delayFTLCompile", ("compiled and failed"));
</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, "triggerFTLReplacement", ());
</ins><span class="cx"> // We need to compile the code.
</span><span class="cx"> compile(
</span><span class="cx"> *vm, codeBlock->newReplacement(), codeBlock, FTLMode, UINT_MAX,
</span><span class="lines">@@ -1845,12 +1851,14 @@
</span><span class="cx">
</span><span class="cx"> if (codeBlock->hasOptimizedReplacement()) {
</span><span class="cx"> if (jitCode->tierUpEntryTriggers.isEmpty()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("replacement in place, delaying indefinitely"));
</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->dontOptimizeAnytimeSoon(codeBlock);
</span><span class="cx"> return;
</span><span class="cx"> }
</span><span class="cx"> if (jitCode->osrEntryBlock() && jitCode->tierUpEntryTriggers.size() == 1) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("trigger in place, delaying indefinitely"));
</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->jitCode()->dfg();
</span><span class="cx"> if (worklistState == Worklist::Compiling) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("still compiling"));
</ins><span class="cx"> jitCode->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, "delayFTLCompile", ("compiled and failed"));
</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("Code block ", *codeBlock, " was compiled but it doesn't have an optimized replacement.\n");
</span><span class="lines">@@ -1892,8 +1902,10 @@
</span><span class="cx"> if (originBytecodeIndex == osrEntryBytecodeIndex) {
</span><span class="cx"> unsigned streamIndex = jitCode->bytecodeIndexToStreamIndex.get(originBytecodeIndex);
</span><span class="cx"> if (CodeBlock* entryBlock = jitCode->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, "osrEntry", ("at bc#", originBytecodeIndex));
</ins><span class="cx"> return static_cast<char*>(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->osrEntryRetry < Options::ftlOSREntryRetryThreshold()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("avoiding OSR entry compile"));
</ins><span class="cx"> jitCode->osrEntryRetry++;
</span><span class="cx"> return nullptr;
</span><span class="cx"> }
</span><del>- }
</del><ins>+ } else
+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("avoiding replacement compile"));
</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->osrEntryBlock()) {
</span><span class="cx"> if (jitCode->osrEntryRetry < Options::ftlOSREntryRetryThreshold()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("OSR entry failed, OSR entry threshold not met"));
</ins><span class="cx"> jitCode->osrEntryRetry++;
</span><span class="cx"> jitCode->setOptimizationThresholdBasedOnCompilationResult(
</span><span class="cx"> codeBlock, CompilationDeferred);
</span><span class="lines">@@ -1929,6 +1944,7 @@
</span><span class="cx"> entryCode->countEntryFailure();
</span><span class="cx"> if (entryCode->entryFailureCount() <
</span><span class="cx"> Options::ftlOSREntryFailureCountForReoptimization()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("OSR entry failed"));
</ins><span class="cx"> jitCode->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, "delayFTLCompile", ("OSR entry failed too many times"));
</ins><span class="cx"> unsigned osrEntryBytecode = entryBlock->jitCode()->ftlForOSREntry()->bytecodeIndex();
</span><span class="cx"> jitCode->clearOSREntryBlock();
</span><span class="cx"> jitCode->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->newReplacement();
</span><span class="cx">
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "triggerFTLOSR", ());
</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, "delayFTLCompile", ("OSR ecompilation not successful"));
</ins><span class="cx"> jitCode->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->osrEntryBlock(), "osrEntry", ("at bc#", 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 "optimizeSoon()" is not useful.
</span><del>- if (codeBlock->hasOptimizedReplacement())
</del><ins>+ if (codeBlock->hasOptimizedReplacement()) {
+ CODEBLOCK_LOG_EVENT(codeBlock, "delayFTLCompile", ("OSR in loop failed, deferring"));
</ins><span class="cx"> jitCode->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->setJITCode(jitCode);
</span><span class="cx">
</span><span class="cx"> if (m_plan.compilation)
</span><del>- m_plan.vm.m_perBytecodeProfiler->addCompilation(m_plan.compilation);
</del><ins>+ m_plan.vm.m_perBytecodeProfiler->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->reportToProfiler(m_compilation.get(), patchBuffer);
</span><del>- m_vm->m_perBytecodeProfiler->addCompilation(m_compilation);
</del><ins>+ m_vm->m_perBytecodeProfiler->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 "JIT.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><span class="cx"> #include "LinkBuffer.h"
</span><ins>+#include "ProfilerCompilation.h"
</ins><span class="cx"> #include <wtf/StringPrintStream.h>
</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->checkIfOptimizationThresholdReached()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("counter = ", codeBlock->jitExecuteCounter()));
</ins><span class="cx"> codeBlock->updateAllPredictions();
</span><span class="cx"> if (Options::verboseOSR())
</span><span class="cx"> dataLog("Choosing not to optimize ", *codeBlock, " yet, because the threshold hasn't been reached.\n");
</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, "delayOptimizeToDFG", ("profiler is enabled"));
</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->globalObject()->debugger();
</span><span class="cx"> if (debugger && (debugger->isStepping() || codeBlock->baselineAlternative()->hasDebuggerRequests())) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("debugger is stepping or has requests"));
</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->m_shouldAlwaysBeInlined) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("should always be inlined"));
</ins><span class="cx"> updateAllPredictionsAndOptimizeAfterWarmUp(codeBlock);
</span><span class="cx"> if (Options::verboseOSR())
</span><span class="cx"> dataLog("Choosing not to optimize ", *codeBlock, " yet, because m_shouldAlwaysBeInlined == true.\n");
</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, "delayOptimizeToDFG", ("compiling"));
</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->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->hasOptimizedReplacement()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("compiled and failed"));
</ins><span class="cx"> codeBlock->updateAllPredictions();
</span><span class="cx"> if (Options::verboseOSR())
</span><span class="cx"> dataLog("Code block ", *codeBlock, " was compiled but it doesn't have an optimized replacement.\n");
</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->replacement()->shouldReoptimizeFromLoopNow()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("should reoptimize from loop now"));
</ins><span class="cx"> if (Options::verboseOSR()) {
</span><span class="cx"> dataLog(
</span><span class="cx"> "Triggering reoptimization of ", *codeBlock,
</span><span class="lines">@@ -1339,6 +1346,7 @@
</span><span class="cx"> }
</span><span class="cx"> } else {
</span><span class="cx"> if (!codeBlock->shouldOptimizeNow()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("insufficient profiling"));
</ins><span class="cx"> if (Options::verboseOSR()) {
</span><span class="cx"> dataLog(
</span><span class="cx"> "Delaying optimization for ", *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, "delayOptimizeToDFG", ("compilation failed"));
</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->replacement();
</span><span class="cx"> ASSERT(JITCode::isOptimizingJIT(optimizedCodeBlock->jitType()));
</span><span class="cx">
</span><span class="cx"> if (void* dataBuffer = DFG::prepareOSREntry(exec, optimizedCodeBlock, bytecodeIndex)) {
</span><ins>+ CODEBLOCK_LOG_EVENT(optimizedCodeBlock, "osrEntry", ("at bc#", bytecodeIndex));
</ins><span class="cx"> if (Options::verboseOSR()) {
</span><span class="cx"> dataLog(
</span><span class="cx"> "Performing OSR ", *codeBlock, " -> ", *optimizedCodeBlock, ".\n");
</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->shouldReoptimizeNow()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("should reoptimize now"));
</ins><span class="cx"> if (Options::verboseOSR()) {
</span><span class="cx"> dataLog(
</span><span class="cx"> "Triggering reoptimization of ", *codeBlock, " -> ",
</span><span class="lines">@@ -1419,6 +1431,7 @@
</span><span class="cx"> // longer and then try again.
</span><span class="cx"> codeBlock->optimizeAfterWarmUp();
</span><span class="cx">
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayOptimizeToDFG", ("OSR failed"));
</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->updateAllValueProfilePredictions();
</span><span class="cx">
</span><span class="cx"> if (!codeBlock->checkIfJITThresholdReached()) {
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayJITCompile", ("threshold not reached, counter = ", codeBlock->llintExecuteCounter()));
</ins><span class="cx"> if (Options::verboseOSR())
</span><span class="cx"> dataLogF(" JIT threshold should be lifted.\n");
</span><span class="cx"> return false;
</span><span class="lines">@@ -335,6 +336,7 @@
</span><span class="cx"> CompilationResult result = JIT::compile(&vm, codeBlock, JITCompilationCanFail);
</span><span class="cx"> switch (result) {
</span><span class="cx"> case CompilationFailed:
</span><ins>+ CODEBLOCK_LOG_EVENT(codeBlock, "delayJITCompile", ("compilation failed"));
</ins><span class="cx"> if (Options::verboseOSR())
</span><span class="cx"> dataLogF(" JIT compilation failed.\n");
</span><span class="cx"> codeBlock->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, "OSR entry", ("in prologue"));
+
</ins><span class="cx"> if (kind == Prologue)
</span><span class="cx"> LLINT_RETURN_TWO(codeBlock->jitCode()->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, "osrEntry", ("at bc#", pc - codeBlock->instructions().begin()));
+
</ins><span class="cx"> ASSERT(codeBlock->jitType() == JITCode::BaselineJIT);
</span><span class="cx">
</span><span class="cx"> Vector<BytecodeAndMachineOffset> 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& out) const
+{
+ out.print("Comp", 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->putDirect(exec->vm(), exec->propertyNames().additionalJettisonReason, jsString(exec, String::fromUTF8(m_additionalJettisonReason)));
</span><span class="cx">
</span><ins>+ result->putDirect(exec->vm(), exec->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 "ProfilerOSRExitSite.h"
</span><span class="cx"> #include "ProfilerOriginStack.h"
</span><span class="cx"> #include "ProfilerProfiledBytecodes.h"
</span><ins>+#include "ProfilerUID.h"
</ins><span class="cx"> #include <wtf/RefCounted.h>
</span><span class="cx"> #include <wtf/SegmentedVector.h>
</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&) 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 "JSONObject.h"
</span><span class="cx"> #include "ObjectConstructor.h"
</span><span class="cx"> #include "JSCInlines.h"
</span><ins>+#include <wtf/CurrentTime.h>
</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&, CodeBlock* codeBlock)
+{
</ins><span class="cx"> codeBlock = codeBlock->baselineVersion();
</span><span class="cx">
</span><span class="cx"> HashMap<CodeBlock*, Bytecodes*>::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<Compilation> compilation)
</del><ins>+void Database::addCompilation(CodeBlock* codeBlock, PassRefPtr<Compilation> passedCompilation)
</ins><span class="cx"> {
</span><ins>+ LockHolder locker(m_lock);
</ins><span class="cx"> ASSERT(!isCompilationThread());
</span><ins>+
+ RefPtr<Compilation> 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->putDirectIndex(exec, i, m_compilations[i]->toJS(exec));
</span><span class="cx"> result->putDirect(exec->vm(), exec->propertyNames().compilations, compilations);
</span><span class="cx">
</span><ins>+ JSArray* events = constructEmptyArray(exec, 0);
+ for (unsigned i = 0; i < m_events.size(); ++i)
+ events->putDirectIndex(exec, i, m_events[i].toJS(exec));
+ result->putDirect(exec->vm(), exec->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& 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 "ProfilerBytecodes.h"
</span><span class="cx"> #include "ProfilerCompilation.h"
</span><span class="cx"> #include "ProfilerCompilationKind.h"
</span><ins>+#include "ProfilerEvent.h"
</ins><span class="cx"> #include <wtf/FastMalloc.h>
</span><span class="cx"> #include <wtf/HashMap.h>
</span><span class="cx"> #include <wtf/Lock.h>
</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<Compilation>);
</del><ins>+ void addCompilation(CodeBlock*, PassRefPtr<Compilation>);
</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& detail);
+
</ins><span class="cx"> private:
</span><ins>+ Bytecodes* ensureBytecodesFor(const LockHolder&, 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<Bytecodes> m_bytecodes;
</span><span class="cx"> HashMap<CodeBlock*, Bytecodes*> m_bytecodesMap;
</span><span class="cx"> Vector<RefPtr<Compilation>> m_compilations;
</span><ins>+ HashMap<CodeBlock*, RefPtr<Compilation>> m_compilationMap;
+ Vector<Event> 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 "config.h"
+#include "ProfilerEvent.h"
+
+#include "JSCInlines.h"
+#include "ObjectConstructor.h"
+#include "ProfilerBytecodes.h"
+#include "ProfilerCompilation.h"
+#include "ProfilerUID.h"
+
+namespace JSC { namespace Profiler {
+
+void Event::dump(PrintStream& out) const
+{
+ out.print(m_time, ": ", pointerDump(m_bytecodes));
+ if (m_compilation)
+ out.print(" ", *m_compilation);
+ out.print(": ", m_summary);
+ if (m_detail.length())
+ out.print(" (", m_detail, ")");
+}
+
+JSValue Event::toJS(ExecState* exec) const
+{
+ JSObject* result = constructEmptyObject(exec);
+
+ result->putDirect(exec->vm(), exec->propertyNames().time, jsNumber(m_time));
+ result->putDirect(exec->vm(), exec->propertyNames().bytecodesID, jsNumber(m_bytecodes->id()));
+ if (m_compilation)
+ result->putDirect(exec->vm(), exec->propertyNames().compilationUID, m_compilation->uid().toJS(exec));
+ result->putDirect(exec->vm(), exec->propertyNames().summary, jsString(exec, String::fromUTF8(m_summary)));
+ if (m_detail.length())
+ result->putDirect(exec->vm(), exec->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 "JSCJSValue.h"
+#include <wtf/PrintStream.h>
+#include <wtf/text/CString.h>
+
+namespace JSC { namespace Profiler {
+
+class Bytecodes;
+class Compilation;
+
+class Event {
+public:
+ Event()
+ {
+ }
+
+ Event(double time, Bytecodes* bytecodes, Compilation* compilation, const char* summary, const CString& 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& detail() const { return m_detail; }
+
+ void dump(PrintStream&) 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 "config.h"
+#include "ProfilerUID.h"
+
+#include "JSCInlines.h"
+#include <wtf/Lock.h>
+
+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& 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 "JSCJSValue.h"
+#include <wtf/HashMap.h>
+#include <wtf/PrintStream.h>
+
+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<uint64_t>::max())
+ {
+ }
+
+ static UID create();
+
+ uint64_t toInt() const
+ {
+ return m_uid;
+ }
+
+ bool operator==(const UID& other) const
+ {
+ return m_uid == other.m_uid;
+ }
+
+ bool operator!=(const UID& 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<uint64_t>::hash(m_uid);
+ }
+
+ void dump(PrintStream&) const;
+ JSValue toJS(ExecState*) const;
+
+private:
+ uint64_t m_uid;
+};
+
+struct UIDHash {
+ static unsigned hash(const UID& key) { return key.hash(); }
+ static bool equal(const UID& a, const UID& b) { return a == b; }
+ static const bool safeToCompareToEmptyOrDeleted = true;
+};
+
+} } // namespace JSC::Profiler
+
+namespace WTF {
+
+template<typename T> struct DefaultHash;
+template<> struct DefaultHash<JSC::Profiler::UID> {
+ typedef JSC::Profiler::UIDHash Hash;
+};
+
+template<typename T> struct HashTraits;
+template<> struct HashTraits<JSC::Profiler::UID> : SimpleClassHashTraits<JSC::Profiler::UID> { };
+
+} // 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 "Parser.h"
</span><span class="cx"> #include "ProfilerDatabase.h"
</span><span class="cx"> #include "TypeProfiler.h"
</span><ins>+#include "VMInlines.h"
</ins><span class="cx"> #include "WASMFunctionParser.h"
</span><span class="cx"> #include <wtf/CommaPrinter.h>
</span><span class="cx"> #include <wtf/Vector.h>
</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, "installCode", ());
+
</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& bytecodeIntrinsicRegistry() { return *m_bytecodeIntrinsicRegistry; }
</span><span class="cx">
</span><span class="cx"> ShadowChicken& shadowChicken() { return *m_shadowChicken; }
</span><ins>+
+ template<typename Func>
+ void logEvent(CodeBlock*, const char* summary, const Func& 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 "ProfilerDatabase.h"
</ins><span class="cx"> #include "VM.h"
</span><span class="cx"> #include "Watchdog.h"
</span><span class="cx">
</span><span class="lines">@@ -38,6 +39,15 @@
</span><span class="cx"> return watchdog()->shouldTerminate(exec);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+template<typename Func>
+void VM::logEvent(CodeBlock* codeBlock, const char* summary, const Func& func)
+{
+ if (LIKELY(!m_perBytecodeProfiler))
+ return;
+
+ m_perBytecodeProfiler->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 <fpizlo@apple.com>
+
+ 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 <cdumez@apple.com>
</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<typename T>
</span><span class="cx"> void print(const T& 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 <fpizlo@apple.com>
+
+ 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 <mcatanzaro@igalia.com>
</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["bytecodesID"].to_i]
</span><span class="lines">@@ -386,6 +386,7 @@
</span><span class="cx"> @numInlinedCalls = json["numInlinedCalls"]
</span><span class="cx"> @jettisonReason = json["jettisonReason"]
</span><span class="cx"> @additionalJettisonReason = json["additionalJettisonReason"]
</span><ins>+ @uid = json["uid"]
</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["time"].to_f
+ @bytecode = $bytecodes[json["bytecodesID"].to_i]
+ if json["compilationUID"]
+ @compilation = $compilationMap[json["compilationUID"]]
+ end
+ @summary = json["summary"]
+ @detail = json["detail"]
+ 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["events"].map {
+ | subJson |
+ Event.new(subJson)
+}
</ins><span class="cx"> $engines = ["Baseline", "DFG", "FTL", "FTLForOSREntry"]
</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>chars
- str
- else
- "%#{chars}s"%(str)
- end
</del><ins>+def lpad(str, chars)
+ str = str.to_s
+ if str.length > chars
+ str
+ else
+ "%#{chars}s"%(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 < chars
</span><span class="cx"> str += " "
</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 < chars
</span><span class="cx"> str += " "
</span><span class="cx"> if str.length < chars
</span><span class="lines">@@ -736,6 +763,7 @@
</span><span class="cx"> puts "bytecode (b) Show the bytecode for a code block, with counts."
</span><span class="cx"> puts "profiling (p) Show the (internal) profiling data for a code block."
</span><span class="cx"> puts "log (l) List the compilations, exits, and jettisons involving this code block."
</span><ins>+ puts "events (e) List of events involving this code block."
</ins><span class="cx"> puts "display (d) Display details for a code block."
</span><span class="cx"> puts "inlines Show all inlining stacks that the code block was on."
</span><span class="cx"> puts "counts Set whether to show counts for 'bytecode' and 'display'."
</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 "events", "e"
+ if args.length != 1
+ puts "Usage: inlines <code block hash>"
+ return
+ end
+
+ hash = Regexp.new(Regexp.escape(args[0]))
+
+ events = []
+ $events.each {
+ | event |
+ if event.bytecode.to_s =~ hash
+ events << 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 " "
+ print rpad(event.bytecode.to_s, hashCols)
+ print " "
+ compilationStr = ""
+ if event.compilation
+ compilationStr = event.compilation.to_s
+ end
+ print rpad(compilationStr, compilationCols)
+ print " "
+ print rpad(event.summary, summaryCols)
+ print " "
+ puts event.detail
+ }
</ins><span class="cx"> when "inlines"
</span><span class="cx"> if args.length != 1
</span><span class="cx"> puts "Usage: inlines <code block hash>"
</span></span></pre>
</div>
</div>
</body>
</html>