<!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>[161737] branches/jsCStack</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/161737">161737</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-01-10 21:48:20 -0800 (Fri, 10 Jan 2014)</dd>
</dl>
<h3>Log Message</h3>
<pre>FTL should work with the bytecode profiler
https://bugs.webkit.org/show_bug.cgi?id=126804
Source/JavaScriptCore:
Reviewed by Sam Weinig.
Implement CountExecution in FTL and make the FTL report a compilation with some kind
of description to the database. This still leaves a lot to be desired; for example
the descriptions we report don't have disassembly. But, this small step already
allows for some basic profiling.
* dfg/DFGPlan.cpp:
(JSC::DFG::profilerCompilationKindForMode):
(JSC::DFG::Plan::Plan):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLJITFinalizer.cpp:
(JSC::FTL::JITFinalizer::finalizeFunction):
* ftl/FTLLink.cpp:
(JSC::FTL::link):
* ftl/FTLLowerDFGToLLVM.cpp:
(JSC::FTL::LowerDFGToLLVM::compileNode):
(JSC::FTL::LowerDFGToLLVM::compileCountExecution):
* profiler/ProfilerCompilation.cpp:
(JSC::Profiler::Compilation::addDescription):
* profiler/ProfilerCompilation.h:
* profiler/ProfilerCompilationKind.cpp:
(WTF::printInternal):
* profiler/ProfilerCompilationKind.h:
Tools:
Reviewed by Sam Weinig.
Teach this that there are more JITs.
* Scripts/display-profiler-output:</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesjsCStackSourceJavaScriptCoreChangeLog">branches/jsCStack/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoredfgDFGPlancpp">branches/jsCStack/Source/JavaScriptCore/dfg/DFGPlan.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreftlFTLCapabilitiescpp">branches/jsCStack/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreftlFTLJITFinalizercpp">branches/jsCStack/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreftlFTLLinkcpp">branches/jsCStack/Source/JavaScriptCore/ftl/FTLLink.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">branches/jsCStack/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreprofilerProfilerCompilationcpp">branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreprofilerProfilerCompilationh">branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilation.h</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreprofilerProfilerCompilationKindcpp">branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilationKind.cpp</a></li>
<li><a href="#branchesjsCStackSourceJavaScriptCoreprofilerProfilerCompilationKindh">branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilationKind.h</a></li>
<li><a href="#branchesjsCStackToolsChangeLog">branches/jsCStack/Tools/ChangeLog</a></li>
<li><a href="#branchesjsCStackToolsScriptsdisplayprofileroutput">branches/jsCStack/Tools/Scripts/display-profiler-output</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesjsCStackSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/ChangeLog (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/ChangeLog        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/ChangeLog        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -1,5 +1,36 @@
</span><span class="cx"> 2014-01-10 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><ins>+ FTL should work with the bytecode profiler
+ https://bugs.webkit.org/show_bug.cgi?id=126804
+
+ Reviewed by Sam Weinig.
+
+ Implement CountExecution in FTL and make the FTL report a compilation with some kind
+ of description to the database. This still leaves a lot to be desired; for example
+ the descriptions we report don't have disassembly. But, this small step already
+ allows for some basic profiling.
+
+ * dfg/DFGPlan.cpp:
+ (JSC::DFG::profilerCompilationKindForMode):
+ (JSC::DFG::Plan::Plan):
+ * ftl/FTLCapabilities.cpp:
+ (JSC::FTL::canCompile):
+ * ftl/FTLJITFinalizer.cpp:
+ (JSC::FTL::JITFinalizer::finalizeFunction):
+ * ftl/FTLLink.cpp:
+ (JSC::FTL::link):
+ * ftl/FTLLowerDFGToLLVM.cpp:
+ (JSC::FTL::LowerDFGToLLVM::compileNode):
+ (JSC::FTL::LowerDFGToLLVM::compileCountExecution):
+ * profiler/ProfilerCompilation.cpp:
+ (JSC::Profiler::Compilation::addDescription):
+ * profiler/ProfilerCompilation.h:
+ * profiler/ProfilerCompilationKind.cpp:
+ (WTF::printInternal):
+ * profiler/ProfilerCompilationKind.h:
+
+2014-01-10 Filip Pizlo <fpizlo@apple.com>
+
</ins><span class="cx"> Unreviewed, unbreak all tests by undoing some assertions junk in
</span><span class="cx"> http://trac.webkit.org/changeset/161732 and changing typo "node->function()"
</span><span class="cx"> which should have been "node->executable()".
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoredfgDFGPlancpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/dfg/DFGPlan.cpp (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/dfg/DFGPlan.cpp        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/dfg/DFGPlan.cpp        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2014 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">@@ -89,6 +89,23 @@
</span><span class="cx"> validate(graph, modeForFinalValidate);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+static Profiler::CompilationKind profilerCompilationKindForMode(CompilationMode mode)
+{
+ switch (mode) {
+ case InvalidCompilationMode:
+ RELEASE_ASSERT_NOT_REACHED();
+ return Profiler::DFG;
+ case DFGMode:
+ return Profiler::DFG;
+ case FTLMode:
+ return Profiler::FTL;
+ case FTLForOSREntryMode:
+ return Profiler::FTLForOSREntry;
+ }
+ RELEASE_ASSERT_NOT_REACHED();
+ return Profiler::DFG;
+}
+
</ins><span class="cx"> Plan::Plan(
</span><span class="cx"> PassRefPtr<CodeBlock> passedCodeBlock, CompilationMode mode,
</span><span class="cx"> unsigned osrEntryBytecodeIndex, const Operands<JSValue>& mustHandleValues)
</span><span class="lines">@@ -97,7 +114,7 @@
</span><span class="cx"> , mode(mode)
</span><span class="cx"> , osrEntryBytecodeIndex(osrEntryBytecodeIndex)
</span><span class="cx"> , mustHandleValues(mustHandleValues)
</span><del>- , compilation(codeBlock->vm()->m_perBytecodeProfiler ? adoptRef(new Profiler::Compilation(codeBlock->vm()->m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get()), Profiler::DFG)) : 0)
</del><ins>+ , compilation(codeBlock->vm()->m_perBytecodeProfiler ? adoptRef(new Profiler::Compilation(codeBlock->vm()->m_perBytecodeProfiler->ensureBytecodesFor(codeBlock.get()), profilerCompilationKindForMode(mode))) : 0)
</ins><span class="cx"> , identifiers(codeBlock.get())
</span><span class="cx"> , weakReferences(codeBlock.get())
</span><span class="cx"> , isCompiled(false)
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -116,6 +116,7 @@
</span><span class="cx"> case CheckInBounds:
</span><span class="cx"> case ConstantStoragePointer:
</span><span class="cx"> case Check:
</span><ins>+ case CountExecution:
</ins><span class="cx"> case CheckExecutable:
</span><span class="cx"> case GetScope:
</span><span class="cx"> // These are OK.
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreftlFTLJITFinalizercpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/ftl/FTLJITFinalizer.cpp        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -110,6 +110,9 @@
</span><span class="cx">
</span><span class="cx"> m_plan.codeBlock->setJITCode(jitCode);
</span><span class="cx">
</span><ins>+ if (m_plan.compilation)
+ m_plan.vm.m_perBytecodeProfiler->addCompilation(m_plan.compilation);
+
</ins><span class="cx"> return true;
</span><span class="cx"> }
</span><span class="cx">
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreftlFTLLinkcpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/ftl/FTLLink.cpp (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/ftl/FTLLink.cpp        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/ftl/FTLLink.cpp        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2013, 2014 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">@@ -38,6 +38,7 @@
</span><span class="cx"> #include "JITStubs.h"
</span><span class="cx"> #include "LLVMAPI.h"
</span><span class="cx"> #include "LinkBuffer.h"
</span><ins>+#include "ProfilerCompilation.h"
</ins><span class="cx"> #include "VirtualRegister.h"
</span><span class="cx">
</span><span class="cx"> namespace JSC { namespace FTL {
</span><span class="lines">@@ -46,8 +47,9 @@
</span><span class="cx">
</span><span class="cx"> void link(State& state)
</span><span class="cx"> {
</span><del>- CodeBlock* codeBlock = state.graph.m_codeBlock;
- VM& vm = state.graph.m_vm;
</del><ins>+ Graph& graph = state.graph;
+ CodeBlock* codeBlock = graph.m_codeBlock;
+ VM& vm = graph.m_vm;
</ins><span class="cx">
</span><span class="cx"> // LLVM will create its own jump tables as needed.
</span><span class="cx"> codeBlock->clearSwitchJumpTables();
</span><span class="lines">@@ -56,10 +58,10 @@
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=125727
</span><span class="cx"> state.jitCode->common.frameRegisterCount = 1000;
</span><span class="cx">
</span><del>- state.jitCode->common.requiredRegisterCountForExit = state.graph.requiredRegisterCountForExit();
</del><ins>+ state.jitCode->common.requiredRegisterCountForExit = graph.requiredRegisterCountForExit();
</ins><span class="cx">
</span><del>- if (!state.graph.m_inlineCallFrames->isEmpty())
- state.jitCode->common.inlineCallFrames = std::move(state.graph.m_inlineCallFrames);
</del><ins>+ if (!graph.m_inlineCallFrames->isEmpty())
+ state.jitCode->common.inlineCallFrames = std::move(graph.m_inlineCallFrames);
</ins><span class="cx">
</span><span class="cx"> // Create the entrypoint. Note that we use this entrypoint totally differently
</span><span class="cx"> // depending on whether we're doing OSR entry or not.
</span><span class="lines">@@ -71,7 +73,62 @@
</span><span class="cx"> CCallHelpers::Address frame = CCallHelpers::Address(
</span><span class="cx"> CCallHelpers::stackPointerRegister, -static_cast<int32_t>(sizeof(void*)));
</span><span class="cx">
</span><del>- switch (state.graph.m_plan.mode) {
</del><ins>+ if (Profiler::Compilation* compilation = graph.compilation()) {
+ compilation->addDescription(
+ Profiler::OriginStack(),
+ toCString("Generated FTL JIT code for ", CodeBlockWithJITType(codeBlock, JITCode::FTLJIT), ", instruction count = ", graph.m_codeBlock->instructionCount(), ":\n"));
+
+ graph.m_dominators.computeIfNecessary(graph);
+ graph.m_naturalLoops.computeIfNecessary(graph);
+
+ const char* prefix = " ";
+
+ DumpContext dumpContext;
+ StringPrintStream out;
+ Node* lastNode = 0;
+ for (size_t blockIndex = 0; blockIndex < graph.numBlocks(); ++blockIndex) {
+ BasicBlock* block = graph.block(blockIndex);
+ if (!block)
+ continue;
+
+ graph.dumpBlockHeader(out, prefix, block, Graph::DumpLivePhisOnly, &dumpContext);
+ compilation->addDescription(Profiler::OriginStack(), out.toCString());
+ out.reset();
+
+ for (size_t nodeIndex = 0; nodeIndex < block->size(); ++nodeIndex) {
+ Node* node = block->at(nodeIndex);
+ if (!node->willHaveCodeGenOrOSR() && !Options::showAllDFGNodes())
+ continue;
+
+ Profiler::OriginStack stack;
+
+ if (node->codeOrigin.isSet()) {
+ stack = Profiler::OriginStack(
+ *vm.m_perBytecodeProfiler, codeBlock, node->codeOrigin);
+ }
+
+ if (graph.dumpCodeOrigin(out, prefix, lastNode, node, &dumpContext)) {
+ compilation->addDescription(stack, out.toCString());
+ out.reset();
+ }
+
+ graph.dump(out, prefix, node, &dumpContext);
+ compilation->addDescription(stack, out.toCString());
+ out.reset();
+
+ if (node->codeOrigin.isSet())
+ lastNode = node;
+ }
+ }
+
+ dumpContext.dump(out, prefix);
+ compilation->addDescription(Profiler::OriginStack(), out.toCString());
+ out.reset();
+
+ state.jitCode->common.compilation = compilation;
+ }
+
+ switch (graph.m_plan.mode) {
</ins><span class="cx"> case FTLMode: {
</span><span class="cx"> CCallHelpers::JumpList mainPathJumps;
</span><span class="cx">
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -503,6 +503,9 @@
</span><span class="cx"> case Int52ToValue:
</span><span class="cx"> compileInt52ToValue();
</span><span class="cx"> break;
</span><ins>+ case CountExecution:
+ compileCountExecution();
+ break;
</ins><span class="cx"> case Flush:
</span><span class="cx"> case PhantomLocal:
</span><span class="cx"> case SetArgument:
</span><span class="lines">@@ -2790,6 +2793,12 @@
</span><span class="cx"> info.m_isInvalidationPoint = true;
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+ void compileCountExecution()
+ {
+ TypedPointer counter = m_out.absolute(m_node->executionCounter()->address());
+ m_out.store64(m_out.add(m_out.load64(counter), m_out.constInt64(1)), counter);
+ }
+
</ins><span class="cx"> TypedPointer baseIndex(IndexedAbstractHeap& heap, LValue storage, LValue index, Edge edge)
</span><span class="cx"> {
</span><span class="cx"> return m_out.baseIndex(
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreprofilerProfilerCompilationcpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilation.cpp        2014-01-11 05:48:20 UTC (rev 161737)
</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, 2014 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">@@ -67,6 +67,11 @@
</span><span class="cx"> m_descriptions.append(compiledBytecode);
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void Compilation::addDescription(const OriginStack& stack, const CString& description)
+{
+ addDescription(CompiledBytecode(stack, description));
+}
+
</ins><span class="cx"> ExecutionCounter* Compilation::executionCounterFor(const OriginStack& origin)
</span><span class="cx"> {
</span><span class="cx"> std::unique_ptr<ExecutionCounter>& counter = m_counters.add(origin, nullptr).iterator->value;
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreprofilerProfilerCompilationh"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilation.h (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilation.h        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilation.h        2014-01-11 05:48:20 UTC (rev 161737)
</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, 2014 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">@@ -63,6 +63,7 @@
</span><span class="cx"> CompilationKind kind() const { return m_kind; }
</span><span class="cx">
</span><span class="cx"> void addDescription(const CompiledBytecode&);
</span><ins>+ void addDescription(const OriginStack&, const CString& description);
</ins><span class="cx"> ExecutionCounter* executionCounterFor(const OriginStack&);
</span><span class="cx"> void addOSRExitSite(const Vector<const void*>& codeAddresses);
</span><span class="cx"> OSRExit* addOSRExit(unsigned id, const OriginStack&, ExitKind, bool isWatchpoint);
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreprofilerProfilerCompilationKindcpp"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilationKind.cpp (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilationKind.cpp        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilationKind.cpp        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2014 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,12 @@
</span><span class="cx"> case JSC::Profiler::DFG:
</span><span class="cx"> out.print("DFG");
</span><span class="cx"> return;
</span><ins>+ case JSC::Profiler::FTL:
+ out.print("FTL");
+ return;
+ case JSC::Profiler::FTLForOSREntry:
+ out.print("FTLForOSREntry");
+ return;
</ins><span class="cx"> default:
</span><span class="cx"> CRASH();
</span><span class="cx"> return;
</span></span></pre></div>
<a id="branchesjsCStackSourceJavaScriptCoreprofilerProfilerCompilationKindh"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilationKind.h (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilationKind.h        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Source/JavaScriptCore/profiler/ProfilerCompilationKind.h        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2012 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2012, 2014 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">@@ -31,7 +31,9 @@
</span><span class="cx"> enum CompilationKind {
</span><span class="cx"> LLInt,
</span><span class="cx"> Baseline,
</span><del>- DFG
</del><ins>+ DFG,
+ FTL,
+ FTLForOSREntry
</ins><span class="cx"> };
</span><span class="cx">
</span><span class="cx"> } } // namespace JSC::Profiler
</span></span></pre></div>
<a id="branchesjsCStackToolsChangeLog"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Tools/ChangeLog (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Tools/ChangeLog        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Tools/ChangeLog        2014-01-11 05:48:20 UTC (rev 161737)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2014-01-10 Filip Pizlo <fpizlo@apple.com>
+
+ FTL should work with the bytecode profiler
+ https://bugs.webkit.org/show_bug.cgi?id=126804
+
+ Reviewed by Sam Weinig.
+
+ Teach this that there are more JITs.
+
+ * Scripts/display-profiler-output:
+
</ins><span class="cx"> 2014-01-06 Filip Pizlo <fpizlo@apple.com>
</span><span class="cx">
</span><span class="cx"> Merge trunk r160411.
</span></span></pre></div>
<a id="branchesjsCStackToolsScriptsdisplayprofileroutput"></a>
<div class="modfile"><h4>Modified: branches/jsCStack/Tools/Scripts/display-profiler-output (161736 => 161737)</h4>
<pre class="diff"><span>
<span class="info">--- branches/jsCStack/Tools/Scripts/display-profiler-output        2014-01-11 05:45:18 UTC (rev 161736)
+++ branches/jsCStack/Tools/Scripts/display-profiler-output        2014-01-11 05:48:20 UTC (rev 161737)
</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 Apple Inc. All rights reserved.
</del><ins>+# Copyright (C) 2012, 2013, 2014 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">@@ -437,8 +437,12 @@
</span><span class="cx"> | subJson |
</span><span class="cx"> Compilation.new(subJson)
</span><span class="cx"> }
</span><del>-$engines = ["Baseline", "DFG"]
</del><ins>+$engines = ["Baseline", "DFG", "FTL", "FTLForOSREntry"]
</ins><span class="cx">
</span><ins>+def isOptimizing(engine)
+ engine == "DFG" or engine == "FTL" or engine == "FTLForOSREntry"
+end
+
</ins><span class="cx"> $showCounts = true
</span><span class="cx"> $sortMode = :time
</span><span class="cx">
</span><span class="lines">@@ -572,9 +576,9 @@
</span><span class="cx"> if mode == :full
</span><span class="cx"> print(" " + (" " * instructionCountCols))
</span><span class="cx"> end
</span><del>- print(" " + center("Base/DFG", countCols))
</del><ins>+ print(" " + center("Base/DFG/FTL/FTLOSR", countCols))
</ins><span class="cx"> if mode == :full
</span><del>- print(" " + center("Base/DFG", machineCountCols))
</del><ins>+ print(" " + center("Base/DFG/FTL/FTLOSR", machineCountCols))
</ins><span class="cx"> print(" " + (" " * compilationsCols))
</span><span class="cx"> print(" " + center("Src/Total", inlinesCols))
</span><span class="cx"> print(" " + (" " * exitCountCols))
</span><span class="lines">@@ -674,7 +678,7 @@
</span><span class="cx"> if $showCounts
</span><span class="cx"> puts(center("Source Counts", countCols) + " " + center("Machine Counts", machineCols) +
</span><span class="cx"> (" " * pad) + center("Bytecode for #{bytecodes}", screenWidth - pad - countCols - 1 - machineCols))
</span><del>- puts(center("Base/DFG", countCols) + " " + center("Base/DFG", countCols))
</del><ins>+ puts(center("Base/DFG/FTL/FTLOSR", countCols) + " " + center("Base/DFG/FTL/FTLOSR", countCols))
</ins><span class="cx"> else
</span><span class="cx"> puts("Bytecode for #{bytecodes}:")
</span><span class="cx"> end
</span><span class="lines">@@ -894,7 +898,7 @@
</span><span class="cx"> puts("Compilation #{compilation}:")
</span><span class="cx"> if $showCounts
</span><span class="cx"> puts(center("Actual Counts", actualCountCols) + " " + center("Source Counts", sourceCountCols) + " " + center("Disassembly in #{compilation.engine}", screenWidth - 1 - sourceCountCols - 1 - actualCountCols))
</span><del>- puts((" " * actualCountCols) + " " + center("Base/DFG", sourceCountCols))
</del><ins>+ puts((" " * actualCountCols) + " " + center("Base/DFG/FTL/FTLOSR", sourceCountCols))
</ins><span class="cx"> else
</span><span class="cx"> puts("Disassembly in #{compilation.engine}")
</span><span class="cx"> end
</span><span class="lines">@@ -905,11 +909,15 @@
</span><span class="cx"> | description |
</span><span class="cx"> # FIXME: We should have a better way of detecting things like CountExecution nodes
</span><span class="cx"> # and slow path entries in the baseline JIT.
</span><del>- if description.description =~ /CountExecution\(/ and compilation.engine == "DFG"
</del><ins>+ if description.description =~ /CountExecution\(/ and isOptimizing(compilation.engine)
</ins><span class="cx"> shouldShow = false
</span><span class="cx"> else
</span><span class="cx"> shouldShow = true
</span><span class="cx"> end
</span><ins>+ if not description.origin.empty? and not description.origin[-1]
+ p description.origin
+ p description.description
+ end
</ins><span class="cx"> if description.origin.empty? or not description.origin[-1].shouldHaveCounts? or (compilation.engine == "Baseline" and description.description =~ /^\s*\(S\)/)
</span><span class="cx"> actualCountsString = ""
</span><span class="cx"> sourceCountsString = ""
</span></span></pre>
</div>
</div>
</body>
</html>