<!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>[169005] branches/ftlopt/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/169005">169005</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-05-17 20:44:23 -0700 (Sat, 17 May 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ftlopt] InlineCallFrame::isCall should be an enumeration
https://bugs.webkit.org/show_bug.cgi?id=133034

Reviewed by Sam Weinig.
        
Once we start inlining getters and setters, we'll want InlineCallFrame to be able to tell
us that the inlined call was a getter call or a setter call. Initially I thought I would
have a new field called &quot;kind&quot; that would have components NormalCall, GetterCall, and
SetterCall. But that doesn't make sense, because for GetterCall and SetterCall, isCall
would have to be true. Hence, It makes more sense to have one enumeration that is Call,
Construct, GetterCall, or SetterCall. This patch is a first step towards this.
        
It's interesting that isClosureCall should probably still be separate, since getter and
setter inlining could inline closure calls.

* bytecode/CodeBlock.h:
(JSC::baselineCodeBlockForInlineCallFrame):
* bytecode/CodeOrigin.cpp:
(JSC::InlineCallFrame::dumpInContext):
(WTF::printInternal):
* bytecode/CodeOrigin.h:
(JSC::InlineCallFrame::kindFor):
(JSC::InlineCallFrame::specializationKindFor):
(JSC::InlineCallFrame::InlineCallFrame):
(JSC::InlineCallFrame::specializationKind):
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
* dfg/DFGOSRExitPreparation.cpp:
(JSC::DFG::prepareCodeOriginForOSRExit):
* runtime/Arguments.h:
(JSC::Arguments::finishCreation):</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesftloptSourceJavaScriptCoreChangeLog">branches/ftlopt/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchesftloptSourceJavaScriptCorebytecodeCodeBlockh">branches/ftlopt/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCorebytecodeCodeOrigincpp">branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCorebytecodeCodeOriginh">branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGByteCodeParsercpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGOSRExitPreparationcpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoreruntimeArgumentsh">branches/ftlopt/Source/JavaScriptCore/runtime/Arguments.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="branchesftloptSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/ChangeLog (169004 => 169005)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/ChangeLog        2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/JavaScriptCore/ChangeLog        2014-05-18 03:44:23 UTC (rev 169005)
</span><span class="lines">@@ -1,3 +1,37 @@
</span><ins>+2014-05-17  Filip Pizlo  &lt;fpizlo@apple.com&gt;
+
+        [ftlopt] InlineCallFrame::isCall should be an enumeration
+        https://bugs.webkit.org/show_bug.cgi?id=133034
+
+        Reviewed by Sam Weinig.
+        
+        Once we start inlining getters and setters, we'll want InlineCallFrame to be able to tell
+        us that the inlined call was a getter call or a setter call. Initially I thought I would
+        have a new field called &quot;kind&quot; that would have components NormalCall, GetterCall, and
+        SetterCall. But that doesn't make sense, because for GetterCall and SetterCall, isCall
+        would have to be true. Hence, It makes more sense to have one enumeration that is Call,
+        Construct, GetterCall, or SetterCall. This patch is a first step towards this.
+        
+        It's interesting that isClosureCall should probably still be separate, since getter and
+        setter inlining could inline closure calls.
+
+        * bytecode/CodeBlock.h:
+        (JSC::baselineCodeBlockForInlineCallFrame):
+        * bytecode/CodeOrigin.cpp:
+        (JSC::InlineCallFrame::dumpInContext):
+        (WTF::printInternal):
+        * bytecode/CodeOrigin.h:
+        (JSC::InlineCallFrame::kindFor):
+        (JSC::InlineCallFrame::specializationKindFor):
+        (JSC::InlineCallFrame::InlineCallFrame):
+        (JSC::InlineCallFrame::specializationKind):
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::InlineStackEntry::InlineStackEntry):
+        * dfg/DFGOSRExitPreparation.cpp:
+        (JSC::DFG::prepareCodeOriginForOSRExit):
+        * runtime/Arguments.h:
+        (JSC::Arguments::finishCreation):
+
</ins><span class="cx"> 2014-05-13  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ftlopt] DFG should not exit due to inadequate profiling coverage when it can trivially fill in the profiling coverage due to variable constant inference and the better prediction modeling of typed array GetByVals
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/bytecode/CodeBlock.h (169004 => 169005)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/JavaScriptCore/bytecode/CodeBlock.h        2014-05-18 03:44:23 UTC (rev 169005)
</span><span class="lines">@@ -1195,7 +1195,7 @@
</span><span class="cx">     RELEASE_ASSERT(inlineCallFrame);
</span><span class="cx">     ExecutableBase* executable = inlineCallFrame-&gt;executable.get();
</span><span class="cx">     RELEASE_ASSERT(executable-&gt;structure()-&gt;classInfo() == FunctionExecutable::info());
</span><del>-    return static_cast&lt;FunctionExecutable*&gt;(executable)-&gt;baselineCodeBlockFor(inlineCallFrame-&gt;isCall ? CodeForCall : CodeForConstruct);
</del><ins>+    return static_cast&lt;FunctionExecutable*&gt;(executable)-&gt;baselineCodeBlockFor(inlineCallFrame-&gt;specializationKind());
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> inline CodeBlock* baselineCodeBlockForOriginAndBaselineCodeBlock(const CodeOrigin&amp; codeOrigin, CodeBlock* baselineCodeBlock)
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCorebytecodeCodeOrigincpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.cpp (169004 => 169005)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.cpp        2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.cpp        2014-05-18 03:44:23 UTC (rev 169005)
</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">@@ -178,7 +178,7 @@
</span><span class="cx">     out.print(briefFunctionInformation(), &quot;:&lt;&quot;, RawPointer(executable.get()));
</span><span class="cx">     if (executable-&gt;isStrictMode())
</span><span class="cx">         out.print(&quot; (StrictMode)&quot;);
</span><del>-    out.print(&quot;, bc#&quot;, caller.bytecodeIndex, &quot;, &quot;, specializationKind());
</del><ins>+    out.print(&quot;, bc#&quot;, caller.bytecodeIndex, &quot;, &quot;, kind);
</ins><span class="cx">     if (isClosureCall)
</span><span class="cx">         out.print(&quot;, closure call&quot;);
</span><span class="cx">     else
</span><span class="lines">@@ -195,3 +195,20 @@
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span><span class="cx"> 
</span><ins>+namespace WTF {
+
+void printInternal(PrintStream&amp; out, JSC::InlineCallFrame::Kind kind)
+{
+    switch (kind) {
+    case JSC::InlineCallFrame::Call:
+        out.print(&quot;Call&quot;);
+        return;
+    case JSC::InlineCallFrame::Construct:
+        out.print(&quot;Construct&quot;);
+        return;
+    }
+    RELEASE_ASSERT_NOT_REACHED();
+}
+
+} // namespace WTF
+
</ins></span></pre></div>
<a id="branchesftloptSourceJavaScriptCorebytecodeCodeOriginh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.h (169004 => 169005)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.h        2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/JavaScriptCore/bytecode/CodeOrigin.h        2014-05-18 03:44:23 UTC (rev 169005)
</span><span class="lines">@@ -1,5 +1,5 @@
</span><span class="cx"> /*
</span><del>- * Copyright (C) 2011, 2012, 2013 Apple Inc. All rights reserved.
</del><ins>+ * Copyright (C) 2011, 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">@@ -118,13 +118,42 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct InlineCallFrame {
</span><ins>+    enum Kind {
+        Call,
+        Construct,
+    };
+    
+    static Kind kindFor(CodeSpecializationKind kind)
+    {
+        switch (kind) {
+        case CodeForCall:
+            return Call;
+        case CodeForConstruct:
+            return Construct;
+        }
+        RELEASE_ASSERT_NOT_REACHED();
+        return Call;
+    }
+    
+    static CodeSpecializationKind specializationKindFor(Kind kind)
+    {
+        switch (kind) {
+        case Call:
+            return CodeForCall;
+        case Construct:
+            return CodeForConstruct;
+        }
+        RELEASE_ASSERT_NOT_REACHED();
+        return CodeForCall;
+    }
+    
</ins><span class="cx">     Vector&lt;ValueRecovery&gt; arguments; // Includes 'this'.
</span><span class="cx">     WriteBarrier&lt;ScriptExecutable&gt; executable;
</span><span class="cx">     ValueRecovery calleeRecovery;
</span><span class="cx">     CodeOrigin caller;
</span><span class="cx">     BitVector capturedVars; // Indexed by the machine call frame's variable numbering.
</span><span class="cx">     signed stackOffset : 30;
</span><del>-    bool isCall : 1;
</del><ins>+    Kind kind : 1;
</ins><span class="cx">     bool isClosureCall : 1; // If false then we know that callee/scope are constants and the DFG won't treat them as variables, i.e. they have to be recovered manually.
</span><span class="cx">     VirtualRegister argumentsRegister; // This is only set if the code uses arguments. The unmodified arguments register follows the unmodifiedArgumentsRegister() convention (see CodeBlock.h).
</span><span class="cx">     
</span><span class="lines">@@ -133,12 +162,12 @@
</span><span class="cx">     // we forgot to initialize explicitly.
</span><span class="cx">     InlineCallFrame()
</span><span class="cx">         : stackOffset(0)
</span><del>-        , isCall(false)
</del><ins>+        , kind(Call)
</ins><span class="cx">         , isClosureCall(false)
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    CodeSpecializationKind specializationKind() const { return specializationFromIsCall(isCall); }
</del><ins>+    CodeSpecializationKind specializationKind() const { return specializationKindFor(kind); }
</ins><span class="cx"> 
</span><span class="cx">     JSFunction* calleeConstant() const
</span><span class="cx">     {
</span><span class="lines">@@ -209,6 +238,8 @@
</span><span class="cx"> 
</span><span class="cx"> namespace WTF {
</span><span class="cx"> 
</span><ins>+void printInternal(PrintStream&amp;, JSC::InlineCallFrame::Kind);
+
</ins><span class="cx"> template&lt;typename T&gt; struct DefaultHash;
</span><span class="cx"> template&lt;&gt; struct DefaultHash&lt;JSC::CodeOrigin&gt; {
</span><span class="cx">     typedef JSC::CodeOriginHash Hash;
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (169004 => 169005)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2014-05-18 03:44:23 UTC (rev 169005)
</span><span class="lines">@@ -3435,7 +3435,7 @@
</span><span class="cx">             m_inlineCallFrame-&gt;isClosureCall = true;
</span><span class="cx">         m_inlineCallFrame-&gt;caller = byteCodeParser-&gt;currentCodeOrigin();
</span><span class="cx">         m_inlineCallFrame-&gt;arguments.resize(argumentCountIncludingThis); // Set the number of arguments including this, but don't configure the value recoveries, yet.
</span><del>-        m_inlineCallFrame-&gt;isCall = isCall(kind);
</del><ins>+        m_inlineCallFrame-&gt;kind = InlineCallFrame::kindFor(kind);
</ins><span class="cx">         
</span><span class="cx">         if (m_inlineCallFrame-&gt;caller.inlineCallFrame)
</span><span class="cx">             m_inlineCallFrame-&gt;capturedVars = m_inlineCallFrame-&gt;caller.inlineCallFrame-&gt;capturedVars;
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGOSRExitPreparationcpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp (169004 => 169005)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp        2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGOSRExitPreparation.cpp        2014-05-18 03:44:23 UTC (rev 169005)
</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">@@ -45,7 +45,7 @@
</span><span class="cx">         FunctionExecutable* executable =
</span><span class="cx">             static_cast&lt;FunctionExecutable*&gt;(codeOrigin.inlineCallFrame-&gt;executable.get());
</span><span class="cx">         CodeBlock* codeBlock = executable-&gt;baselineCodeBlockFor(
</span><del>-            codeOrigin.inlineCallFrame-&gt;isCall ? CodeForCall : CodeForConstruct);
</del><ins>+            codeOrigin.inlineCallFrame-&gt;specializationKind());
</ins><span class="cx">         
</span><span class="cx">         if (codeBlock-&gt;jitType() == JSC::JITCode::BaselineJIT)
</span><span class="cx">             continue;
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoreruntimeArgumentsh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/runtime/Arguments.h (169004 => 169005)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/runtime/Arguments.h        2014-05-18 02:05:24 UTC (rev 169004)
+++ branches/ftlopt/Source/JavaScriptCore/runtime/Arguments.h        2014-05-18 03:44:23 UTC (rev 169005)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx">  *  Copyright (C) 1999-2000 Harri Porten (porten@kde.org)
</span><del>- *  Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
</del><ins>+ *  Copyright (C) 2003, 2006, 2007, 2008, 2009, 2014 Apple Inc. All rights reserved.
</ins><span class="cx">  *  Copyright (C) 2007 Cameron Zwarich (cwzwarich@uwaterloo.ca)
</span><span class="cx">  *  Copyright (C) 2007 Maks Orlovich
</span><span class="cx">  *
</span><span class="lines">@@ -321,7 +321,7 @@
</span><span class="cx">     m_overrodeCallee = false;
</span><span class="cx">     m_overrodeCaller = false;
</span><span class="cx">     m_isStrictMode = jsCast&lt;FunctionExecutable*&gt;(inlineCallFrame-&gt;executable.get())-&gt;isStrictMode();
</span><del>-    ASSERT(!jsCast&lt;FunctionExecutable*&gt;(inlineCallFrame-&gt;executable.get())-&gt;symbolTable(inlineCallFrame-&gt;isCall ? CodeForCall : CodeForConstruct)-&gt;slowArguments());
</del><ins>+    ASSERT(!jsCast&lt;FunctionExecutable*&gt;(inlineCallFrame-&gt;executable.get())-&gt;symbolTable(inlineCallFrame-&gt;specializationKind())-&gt;slowArguments());
</ins><span class="cx"> 
</span><span class="cx">     // The bytecode generator omits op_tear_off_activation in cases of no
</span><span class="cx">     // declared parameters, so we need to tear off immediately.
</span></span></pre>
</div>
</div>

</body>
</html>