<!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>[211542] trunk/Source/JavaScriptCore</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/211542">211542</a></dd>
<dt>Author</dt> <dd>keith_miller@apple.com</dd>
<dt>Date</dt> <dd>2017-02-01 17:23:37 -0800 (Wed, 01 Feb 2017)</dd>
</dl>

<h3>Log Message</h3>
<pre>The sampling profile should have an option to sample from C frames.
https://bugs.webkit.org/show_bug.cgi?id=167614

Reviewed by Saam Barati.

We should be able to use the sampling profiler, at least
internally, to trace C calls.  This patch only modifies the JSC
shell although it would be nice to add it to the Web Inspector in
a future patch.

* runtime/Options.h:
* runtime/SamplingProfiler.cpp:
(JSC::FrameWalker::FrameWalker):
(JSC::FrameWalker::walk):
(JSC::FrameWalker::recordJSFrame):
(JSC::CFrameWalker::CFrameWalker):
(JSC::CFrameWalker::walk):
(JSC::CFrameWalker::isCFrame):
(JSC::CFrameWalker::advanceToParentFrame):
(JSC::CFrameWalker::frame):
(JSC::SamplingProfiler::takeSample):
(JSC::SamplingProfiler::processUnverifiedStackTraces):
(JSC::SamplingProfiler::StackFrame::displayName):
* runtime/SamplingProfiler.h:
(JSC::SamplingProfiler::UnprocessedStackFrame::UnprocessedStackFrame):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeOptionsh">trunk/Source/JavaScriptCore/runtime/Options.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeSamplingProfilercpp">trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeSamplingProfilerh">trunk/Source/JavaScriptCore/runtime/SamplingProfiler.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (211541 => 211542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2017-02-02 01:12:53 UTC (rev 211541)
+++ trunk/Source/JavaScriptCore/ChangeLog        2017-02-02 01:23:37 UTC (rev 211542)
</span><span class="lines">@@ -1,3 +1,31 @@
</span><ins>+2017-02-01  Keith Miller  &lt;keith_miller@apple.com&gt;
+
+        The sampling profile should have an option to sample from C frames.
+        https://bugs.webkit.org/show_bug.cgi?id=167614
+
+        Reviewed by Saam Barati.
+
+        We should be able to use the sampling profiler, at least
+        internally, to trace C calls.  This patch only modifies the JSC
+        shell although it would be nice to add it to the Web Inspector in
+        a future patch.
+
+        * runtime/Options.h:
+        * runtime/SamplingProfiler.cpp:
+        (JSC::FrameWalker::FrameWalker):
+        (JSC::FrameWalker::walk):
+        (JSC::FrameWalker::recordJSFrame):
+        (JSC::CFrameWalker::CFrameWalker):
+        (JSC::CFrameWalker::walk):
+        (JSC::CFrameWalker::isCFrame):
+        (JSC::CFrameWalker::advanceToParentFrame):
+        (JSC::CFrameWalker::frame):
+        (JSC::SamplingProfiler::takeSample):
+        (JSC::SamplingProfiler::processUnverifiedStackTraces):
+        (JSC::SamplingProfiler::StackFrame::displayName):
+        * runtime/SamplingProfiler.h:
+        (JSC::SamplingProfiler::UnprocessedStackFrame::UnprocessedStackFrame):
+
</ins><span class="cx"> 2017-02-01  Joseph Pecoraro  &lt;pecoraro@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Use guaranteed RunLoop instead of RunLoop::current for dispatching inspector GC event
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeOptionsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Options.h (211541 => 211542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Options.h        2017-02-02 01:12:53 UTC (rev 211541)
+++ trunk/Source/JavaScriptCore/runtime/Options.h        2017-02-02 01:23:37 UTC (rev 211542)
</span><span class="lines">@@ -367,6 +367,7 @@
</span><span class="cx">     v(unsigned, samplingProfilerTopFunctionsCount, 12, Normal, &quot;Number of top functions to report when using the command line interface.&quot;) \
</span><span class="cx">     v(unsigned, samplingProfilerTopBytecodesCount, 40, Normal, &quot;Number of top bytecodes to report when using the command line interface.&quot;) \
</span><span class="cx">     v(optionString, samplingProfilerPath, nullptr, Normal, &quot;The path to the directory to write sampiling profiler output to. This probably will not work with WK2 unless the path is in the whitelist.&quot;) \
</span><ins>+    v(bool, sampleCCode, false, Normal, &quot;Causes the sampling profiler to record profiling data for C frames.&quot;) \
</ins><span class="cx">     \
</span><span class="cx">     v(bool, alwaysGeneratePCToCodeOriginMap, false, Normal, &quot;This will make sure we always generate a PCToCodeOriginMap for JITed code.&quot;) \
</span><span class="cx">     \
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeSamplingProfilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp (211541 => 211542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp        2017-02-02 01:12:53 UTC (rev 211541)
+++ trunk/Source/JavaScriptCore/runtime/SamplingProfiler.cpp        2017-02-02 01:23:37 UTC (rev 211542)
</span><span class="lines">@@ -51,6 +51,11 @@
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringBuilder.h&gt;
</span><span class="cx"> 
</span><ins>+#if OS(DARWIN)
+#include &lt;cxxabi.h&gt;
+#include &lt;dlfcn.h&gt;
+#endif
+
</ins><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> static double sNumTotalStackTraces = 0;
</span><span class="lines">@@ -76,7 +81,7 @@
</span><span class="cx"> 
</span><span class="cx"> class FrameWalker {
</span><span class="cx"> public:
</span><del>-    FrameWalker(ExecState* callFrame, VM&amp; vm, const LockHolder&amp; codeBlockSetLocker, const LockHolder&amp; machineThreadsLocker)
</del><ins>+    FrameWalker(VM&amp; vm, ExecState* callFrame, const LockHolder&amp; codeBlockSetLocker, const LockHolder&amp; machineThreadsLocker)
</ins><span class="cx">         : m_vm(vm)
</span><span class="cx">         , m_callFrame(callFrame)
</span><span class="cx">         , m_vmEntryFrame(vm.topVMEntryFrame)
</span><span class="lines">@@ -93,15 +98,7 @@
</span><span class="cx">         resetAtMachineFrame();
</span><span class="cx">         size_t maxStackTraceSize = stackTrace.size();
</span><span class="cx">         while (!isAtTop() &amp;&amp; !m_bailingOut &amp;&amp; m_depth &lt; maxStackTraceSize) {
</span><del>-            CallSiteIndex callSiteIndex;
-            JSValue unsafeCallee = m_callFrame-&gt;unsafeCallee();
-            CodeBlock* codeBlock = m_callFrame-&gt;unsafeCodeBlock();
-            if (codeBlock) {
-                ASSERT(isValidCodeBlock(codeBlock));
-                callSiteIndex = m_callFrame-&gt;unsafeCallSiteIndex();
-            }
-            stackTrace[m_depth] = UnprocessedStackFrame(codeBlock, JSValue::encode(unsafeCallee), callSiteIndex);
-            m_depth++;
</del><ins>+            recordJSFrame(stackTrace);
</ins><span class="cx">             advanceToParentFrame();
</span><span class="cx">             resetAtMachineFrame();
</span><span class="cx">         }
</span><span class="lines">@@ -115,9 +112,23 @@
</span><span class="cx">         return !m_bailingOut;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-private:
</del><ins>+protected:
</ins><span class="cx"> 
</span><span class="cx">     SUPPRESS_ASAN
</span><ins>+    void recordJSFrame(Vector&lt;UnprocessedStackFrame&gt;&amp; stackTrace)
+    {
+        CallSiteIndex callSiteIndex;
+        JSValue unsafeCallee = m_callFrame-&gt;unsafeCallee();
+        CodeBlock* codeBlock = m_callFrame-&gt;unsafeCodeBlock();
+        if (codeBlock) {
+            ASSERT(isValidCodeBlock(codeBlock));
+            callSiteIndex = m_callFrame-&gt;unsafeCallSiteIndex();
+        }
+        stackTrace[m_depth] = UnprocessedStackFrame(codeBlock, JSValue::encode(unsafeCallee), callSiteIndex);
+        m_depth++;
+    }
+
+    SUPPRESS_ASAN
</ins><span class="cx">     void advanceToParentFrame()
</span><span class="cx">     {
</span><span class="cx">         m_callFrame = m_callFrame-&gt;unsafeCallerFrame(m_vmEntryFrame);
</span><span class="lines">@@ -154,7 +165,7 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    bool isValidFramePointer(ExecState* exec)
</del><ins>+    bool isValidFramePointer(void* exec)
</ins><span class="cx">     {
</span><span class="cx">         uint8_t* fpCast = bitwise_cast&lt;uint8_t*&gt;(exec);
</span><span class="cx">         for (MachineThreads::Thread* thread = m_vm.heap.machineThreads().threadsListHead(m_machineThreadsLocker); thread; thread = thread-&gt;next) {
</span><span class="lines">@@ -185,6 +196,85 @@
</span><span class="cx">     size_t m_depth { 0 };
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+class CFrameWalker : public FrameWalker {
+public:
+    typedef FrameWalker Base;
+
+    CFrameWalker(VM&amp; vm, void* machineFrame, ExecState* callFrame, const LockHolder&amp; codeBlockSetLocker, const LockHolder&amp; machineThreadsLocker)
+        : Base(vm, callFrame, codeBlockSetLocker, machineThreadsLocker)
+        , m_machineFrame(machineFrame)
+    {
+    }
+
+    size_t walk(Vector&lt;UnprocessedStackFrame&gt;&amp; stackTrace, bool&amp; didRunOutOfSpace)
+    {
+        if (sReportStats)
+            sNumTotalWalks++;
+        resetAtMachineFrame();
+        size_t maxStackTraceSize = stackTrace.size();
+        // The way the C walker decides if a frame it is about to trace is C or JS is by
+        // ensuring m_callFrame points to some frame above the machineFrame.
+        if (!isAtTop() &amp;&amp; !m_bailingOut &amp;&amp; m_machineFrame == m_callFrame) {
+            recordJSFrame(stackTrace);
+            Base::advanceToParentFrame();
+            resetAtMachineFrame();
+        }
+
+        while (!isAtTop() &amp;&amp; !m_bailingOut &amp;&amp; m_depth &lt; maxStackTraceSize) {
+            if (m_machineFrame &gt;= m_callFrame) {
+                // If we get to this state we probably have an invalid trace.
+                m_bailingOut = true;
+                break;
+            }
+
+            if (isCFrame()) {
+                RELEASE_ASSERT(!LLInt::isLLIntPC(frame()-&gt;callerFrame));
+                stackTrace[m_depth] = UnprocessedStackFrame(frame()-&gt;pc);
+                m_depth++;
+            } else
+                recordJSFrame(stackTrace);
+            advanceToParentFrame();
+            resetAtMachineFrame();
+        }
+        didRunOutOfSpace = m_depth &gt;= maxStackTraceSize &amp;&amp; !isAtTop();
+        reportStats();
+        return m_depth;
+    }
+
+private:
+
+    bool isCFrame()
+    {
+        return frame()-&gt;callerFrame != m_callFrame;
+    }
+
+    void advanceToParentFrame()
+    {
+        if (!isCFrame())
+            Base::advanceToParentFrame();
+        m_machineFrame = frame()-&gt;callerFrame;
+    }
+
+    void resetAtMachineFrame()
+    {
+        if (!isValidFramePointer(m_machineFrame)) {
+            // Guard against pausing the process at weird program points.
+            m_bailingOut = true;
+            if (sReportStats)
+                sNumFailedWalks++;
+            return;
+        }
+        Base::resetAtMachineFrame();
+    }
+
+    CallerFrameAndPC* frame()
+    {
+        return reinterpret_cast&lt;CallerFrameAndPC*&gt;(m_machineFrame);
+    }
+
+    void* m_machineFrame;
+};
+
</ins><span class="cx"> SamplingProfiler::SamplingProfiler(VM&amp; vm, RefPtr&lt;Stopwatch&gt;&amp;&amp; stopwatch)
</span><span class="cx">     : m_vm(vm)
</span><span class="cx">     , m_stopwatch(WTFMove(stopwatch))
</span><span class="lines">@@ -258,6 +348,7 @@
</span><span class="cx">         if (didSuspend) {
</span><span class="cx">             // While the JSC thread is suspended, we can't do things like malloc because the JSC thread
</span><span class="cx">             // may be holding the malloc lock.
</span><ins>+            void* machineFrame;
</ins><span class="cx">             ExecState* callFrame;
</span><span class="cx">             void* machinePC;
</span><span class="cx">             bool topFrameIsLLInt = false;
</span><span class="lines">@@ -265,7 +356,8 @@
</span><span class="cx">             {
</span><span class="cx">                 MachineThreads::Thread::Registers registers;
</span><span class="cx">                 m_jscExecutionThread-&gt;getRegisters(registers);
</span><del>-                callFrame = static_cast&lt;ExecState*&gt;(registers.framePointer());
</del><ins>+                machineFrame = registers.framePointer();
+                callFrame = static_cast&lt;ExecState*&gt;(machineFrame);
</ins><span class="cx">                 machinePC = registers.instructionPointer();
</span><span class="cx">                 llintPC = registers.llintPC();
</span><span class="cx">                 m_jscExecutionThread-&gt;freeRegisters(registers);
</span><span class="lines">@@ -291,10 +383,14 @@
</span><span class="cx">             size_t walkSize;
</span><span class="cx">             bool wasValidWalk;
</span><span class="cx">             bool didRunOutOfVectorSpace;
</span><del>-            {
-                FrameWalker walker(callFrame, m_vm, codeBlockSetLocker, machineThreadsLocker);
</del><ins>+            if (Options::sampleCCode()) {
+                CFrameWalker walker(m_vm, machineFrame, callFrame, codeBlockSetLocker, machineThreadsLocker);
</ins><span class="cx">                 walkSize = walker.walk(m_currentFrames, didRunOutOfVectorSpace);
</span><span class="cx">                 wasValidWalk = walker.wasValidWalk();
</span><ins>+            } else {
+                FrameWalker walker(m_vm, callFrame, codeBlockSetLocker, machineThreadsLocker);
+                walkSize = walker.walk(m_currentFrames, didRunOutOfVectorSpace);
+                wasValidWalk = walker.wasValidWalk();
</ins><span class="cx">             }
</span><span class="cx"> 
</span><span class="cx">             m_jscExecutionThread-&gt;resume();
</span><span class="lines">@@ -527,12 +623,17 @@
</span><span class="cx"> #else
</span><span class="cx">                 appendCodeBlockNoInlining();
</span><span class="cx"> #endif
</span><ins>+            } else if (unprocessedStackFrame.cCodePC) {
+                appendEmptyFrame();
+                stackTrace.frames.last().cCodePC = unprocessedStackFrame.cCodePC;
+                stackTrace.frames.last().frameType = FrameType::C;
</ins><span class="cx">             } else
</span><span class="cx">                 appendEmptyFrame();
</span><span class="cx"> 
</span><span class="cx">             // Note that this is okay to do if we walked the inline stack because
</span><span class="cx">             // the machine frame will be at the top of the processed stack trace.
</span><del>-            storeCalleeIntoLastFrame(unprocessedStackFrame.unverifiedCallee);
</del><ins>+            if (!unprocessedStackFrame.cCodePC)
+                storeCalleeIntoLastFrame(unprocessedStackFrame.unverifiedCallee);
</ins><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="lines">@@ -644,8 +745,23 @@
</span><span class="cx">             return name;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (frameType == FrameType::Unknown)
-        return ASCIILiteral(&quot;(unknown)&quot;);
</del><ins>+    if (frameType == FrameType::Unknown || frameType == FrameType::C) {
+#if OS(DARWIN)
+        if (frameType == FrameType::C) {
+            const char* mangledName = nullptr;
+            const char* cxaDemangled = nullptr;
+            Dl_info info;
+            if (dladdr(cCodePC, &amp;info) &amp;&amp; info.dli_sname)
+                mangledName = info.dli_sname;
+            if (mangledName) {
+                cxaDemangled = abi::__cxa_demangle(mangledName, 0, 0, 0);
+                return String(cxaDemangled ? cxaDemangled : mangledName);
+            }
+            WTF::dataLog(&quot;couldn't get a name&quot;);
+        }
+#endif
+        return ASCIILiteral(&quot;(unknown12)&quot;);
+    }
</ins><span class="cx">     if (frameType == FrameType::Host)
</span><span class="cx">         return ASCIILiteral(&quot;(host)&quot;);
</span><span class="cx"> 
</span><span class="lines">@@ -671,7 +787,7 @@
</span><span class="cx">             return name;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    if (frameType == FrameType::Unknown)
</del><ins>+    if (frameType == FrameType::Unknown || frameType == FrameType::C)
</ins><span class="cx">         return ASCIILiteral(&quot;(unknown)&quot;);
</span><span class="cx">     if (frameType == FrameType::Host)
</span><span class="cx">         return ASCIILiteral(&quot;(host)&quot;);
</span><span class="lines">@@ -698,7 +814,7 @@
</span><span class="cx"> 
</span><span class="cx"> int SamplingProfiler::StackFrame::functionStartLine()
</span><span class="cx"> {
</span><del>-    if (frameType == FrameType::Unknown || frameType == FrameType::Host)
</del><ins>+    if (frameType == FrameType::Unknown || frameType == FrameType::Host || frameType == FrameType::C)
</ins><span class="cx">         return -1;
</span><span class="cx"> 
</span><span class="cx">     if (executable-&gt;isHostFunction())
</span><span class="lines">@@ -708,7 +824,7 @@
</span><span class="cx"> 
</span><span class="cx"> unsigned SamplingProfiler::StackFrame::functionStartColumn()
</span><span class="cx"> {
</span><del>-    if (frameType == FrameType::Unknown || frameType == FrameType::Host)
</del><ins>+    if (frameType == FrameType::Unknown || frameType == FrameType::Host || frameType == FrameType::C)
</ins><span class="cx">         return std::numeric_limits&lt;unsigned&gt;::max();
</span><span class="cx"> 
</span><span class="cx">     if (executable-&gt;isHostFunction())
</span><span class="lines">@@ -719,7 +835,7 @@
</span><span class="cx"> 
</span><span class="cx"> intptr_t SamplingProfiler::StackFrame::sourceID()
</span><span class="cx"> {
</span><del>-    if (frameType == FrameType::Unknown || frameType == FrameType::Host)
</del><ins>+    if (frameType == FrameType::Unknown || frameType == FrameType::Host || frameType == FrameType::C)
</ins><span class="cx">         return -1;
</span><span class="cx"> 
</span><span class="cx">     if (executable-&gt;isHostFunction())
</span><span class="lines">@@ -730,7 +846,7 @@
</span><span class="cx"> 
</span><span class="cx"> String SamplingProfiler::StackFrame::url()
</span><span class="cx"> {
</span><del>-    if (frameType == FrameType::Unknown || frameType == FrameType::Host)
</del><ins>+    if (frameType == FrameType::Unknown || frameType == FrameType::Host || frameType == FrameType::C)
</ins><span class="cx">         return emptyString();
</span><span class="cx"> 
</span><span class="cx">     if (executable-&gt;isHostFunction())
</span><span class="lines">@@ -968,6 +1084,7 @@
</span><span class="cx">     case SamplingProfiler::FrameType::Host:
</span><span class="cx">         out.print(&quot;Host&quot;);
</span><span class="cx">         break;
</span><ins>+    case SamplingProfiler::FrameType::C:
</ins><span class="cx">     case SamplingProfiler::FrameType::Unknown:
</span><span class="cx">         out.print(&quot;Unknown&quot;);
</span><span class="cx">         break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeSamplingProfilerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/SamplingProfiler.h (211541 => 211542)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/SamplingProfiler.h        2017-02-02 01:12:53 UTC (rev 211541)
+++ trunk/Source/JavaScriptCore/runtime/SamplingProfiler.h        2017-02-02 01:23:37 UTC (rev 211542)
</span><span class="lines">@@ -51,14 +51,19 @@
</span><span class="cx">             , verifiedCodeBlock(codeBlock)
</span><span class="cx">             , callSiteIndex(callSiteIndex)
</span><span class="cx">         { }
</span><ins>+
+        UnprocessedStackFrame(void* pc)
+            : cCodePC(pc)
+        { }
+
</ins><span class="cx">         UnprocessedStackFrame()
</span><span class="cx">         {
</span><span class="cx">             unverifiedCallee = JSValue::encode(JSValue());
</span><del>-            verifiedCodeBlock = nullptr;
</del><span class="cx">         }
</span><span class="cx"> 
</span><ins>+        void* cCodePC { nullptr };
</ins><span class="cx">         EncodedJSValue unverifiedCallee;
</span><del>-        CodeBlock* verifiedCodeBlock;
</del><ins>+        CodeBlock* verifiedCodeBlock { nullptr };
</ins><span class="cx">         CallSiteIndex callSiteIndex;
</span><span class="cx">     };
</span><span class="cx"> 
</span><span class="lines">@@ -65,7 +70,8 @@
</span><span class="cx">     enum class FrameType { 
</span><span class="cx">         Executable,
</span><span class="cx">         Host,
</span><del>-        Unknown 
</del><ins>+        C,
+        Unknown
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     struct StackFrame {
</span><span class="lines">@@ -78,6 +84,7 @@
</span><span class="cx">         { }
</span><span class="cx"> 
</span><span class="cx">         FrameType frameType { FrameType::Unknown };
</span><ins>+        void* cCodePC { nullptr };
</ins><span class="cx">         ExecutableBase* executable { nullptr };
</span><span class="cx">         JSObject* callee { nullptr };
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>