<!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>[169786] 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/169786">169786</a></dd>
<dt>Author</dt> <dd>fpizlo@apple.com</dd>
<dt>Date</dt> <dd>2014-06-10 18:51:56 -0700 (Tue, 10 Jun 2014)</dd>
</dl>

<h3>Log Message</h3>
<pre>Added native calling to the FTL and Split the DFG nodes 
Call and Construct into NativeCall and NativeConstruct 
to better represent their semantics.
https://bugs.webkit.org/show_bug.cgi?id=133660

Patch by Matthew Mirman &lt;mmirman@apple.com&gt; on 2014-06-09
Reviewed by Filip Pizlo.

* dfg/DFGAbstractInterpreterInlines.h:
(JSC::DFG::AbstractInterpreter&lt;AbstractStateType&gt;::executeEffects): 
Added NativeCall and NativeConstruct case
* dfg/DFGByteCodeParser.cpp:
(JSC::DFG::ByteCodeParser::addCall): added NativeCall case. 
(JSC::DFG::ByteCodeParser::handleCall): 
set to return NativeCall or NativeConstruct instead of Call or Construct
in the presence of a native function.
* dfg/DFGClobberize.h:
(JSC::DFG::clobberize): added NativeCall and NativeConstruct case.
* dfg/DFGDoesGC.cpp:
(JSC::DFG::doesGC): added NativeCall and NativeConstruct case.
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode): added NativeCall and NativeConstruct case.
* dfg/DFGNode.h:
(JSC::DFG::Node::hasHeapPrediction): added NativeCall and NativeConstruct case.
(JSC::DFG::Node::canBeKnownFunction): changed to NativeCall and NativeConstruct.
(JSC::DFG::Node::hasKnownFunction): changed to NativeCall and NativeConstruct.
* dfg/DFGNodeType.h: added NativeCall and NativeConstruct.
* dfg/DFGPredictionPropagationPhase.cpp:
(JSC::DFG::PredictionPropagationPhase::propagate): added NativeCall and NativeConstruct case.
* dfg/DFGSafeToExecute.h:
(JSC::DFG::safeToExecute): added NativeCall and NativeConstruct case.
* dfg/DFGSpeculativeJIT32_64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall): ditto
(JSC::DFG::SpeculativeJIT::compile): ditto
* dfg/DFGSpeculativeJIT64.cpp:
(JSC::DFG::SpeculativeJIT::emitCall): ditto
(JSC::DFG::SpeculativeJIT::compile): ditto
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile): ditto
* ftl/FTLLowerDFGToLLVM.cpp:  
(JSC::FTL::LowerDFGToLLVM::lower): ditto
(JSC::FTL::LowerDFGToLLVM::compileNode): ditto.
(JSC::FTL::LowerDFGToLLVM::compileNativeCallOrConstruct): Added.
(JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct): removed NativeCall and NativeConstruct functionality.
(JSC::FTL::LowerDFGToLLVM::didOverflowStack): added NativeCall and NativeConstruct case.
* runtime/JSCJSValue.h: added JS_EXPORT_PRIVATE to toInteger as it is apparently needed.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#branchesftloptSourceJavaScriptCoreChangeLog">branches/ftlopt/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh">branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGByteCodeParsercpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGClobberizeh">branches/ftlopt/Source/JavaScriptCore/dfg/DFGClobberize.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGDoesGCcpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGDoesGC.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGFixupPhasecpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGNodeh">branches/ftlopt/Source/JavaScriptCore/dfg/DFGNode.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGNodeTypeh">branches/ftlopt/Source/JavaScriptCore/dfg/DFGNodeType.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGPredictionPropagationPhasecpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGSafeToExecuteh">branches/ftlopt/Source/JavaScriptCore/dfg/DFGSafeToExecute.h</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp">branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoreftlFTLCapabilitiescpp">branches/ftlopt/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp">branches/ftlopt/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp</a></li>
<li><a href="#branchesftloptSourceJavaScriptCoreruntimeJSCJSValueh">branches/ftlopt/Source/JavaScriptCore/runtime/JSCJSValue.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 (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/ChangeLog        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/ChangeLog        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -1,3 +1,51 @@
</span><ins>+2014-06-09  Matthew Mirman  &lt;mmirman@apple.com&gt;
+
+        Added native calling to the FTL and Split the DFG nodes 
+        Call and Construct into NativeCall and NativeConstruct 
+        to better represent their semantics.
+        https://bugs.webkit.org/show_bug.cgi?id=133660
+
+        Reviewed by Filip Pizlo.
+
+        * dfg/DFGAbstractInterpreterInlines.h:
+        (JSC::DFG::AbstractInterpreter&lt;AbstractStateType&gt;::executeEffects): 
+        Added NativeCall and NativeConstruct case
+        * dfg/DFGByteCodeParser.cpp:
+        (JSC::DFG::ByteCodeParser::addCall): added NativeCall case. 
+        (JSC::DFG::ByteCodeParser::handleCall): 
+        set to return NativeCall or NativeConstruct instead of Call or Construct
+        in the presence of a native function.
+        * dfg/DFGClobberize.h:
+        (JSC::DFG::clobberize): added NativeCall and NativeConstruct case.
+        * dfg/DFGDoesGC.cpp:
+        (JSC::DFG::doesGC): added NativeCall and NativeConstruct case.
+        * dfg/DFGFixupPhase.cpp:
+        (JSC::DFG::FixupPhase::fixupNode): added NativeCall and NativeConstruct case.
+        * dfg/DFGNode.h:
+        (JSC::DFG::Node::hasHeapPrediction): added NativeCall and NativeConstruct case.
+        (JSC::DFG::Node::canBeKnownFunction): changed to NativeCall and NativeConstruct.
+        (JSC::DFG::Node::hasKnownFunction): changed to NativeCall and NativeConstruct.
+        * dfg/DFGNodeType.h: added NativeCall and NativeConstruct.
+        * dfg/DFGPredictionPropagationPhase.cpp:
+        (JSC::DFG::PredictionPropagationPhase::propagate): added NativeCall and NativeConstruct case.
+        * dfg/DFGSafeToExecute.h:
+        (JSC::DFG::safeToExecute): added NativeCall and NativeConstruct case.
+        * dfg/DFGSpeculativeJIT32_64.cpp:
+        (JSC::DFG::SpeculativeJIT::emitCall): ditto
+        (JSC::DFG::SpeculativeJIT::compile): ditto
+        * dfg/DFGSpeculativeJIT64.cpp:
+        (JSC::DFG::SpeculativeJIT::emitCall): ditto
+        (JSC::DFG::SpeculativeJIT::compile): ditto
+        * ftl/FTLCapabilities.cpp:
+        (JSC::FTL::canCompile): ditto
+        * ftl/FTLLowerDFGToLLVM.cpp:  
+        (JSC::FTL::LowerDFGToLLVM::lower): ditto
+        (JSC::FTL::LowerDFGToLLVM::compileNode): ditto.
+        (JSC::FTL::LowerDFGToLLVM::compileNativeCallOrConstruct): Added.
+        (JSC::FTL::LowerDFGToLLVM::compileCallOrConstruct): removed NativeCall and NativeConstruct functionality.
+        (JSC::FTL::LowerDFGToLLVM::didOverflowStack): added NativeCall and NativeConstruct case.
+        * runtime/JSCJSValue.h: added JS_EXPORT_PRIVATE to toInteger as it is apparently needed.
+
</ins><span class="cx"> 2014-06-10  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [ftlopt] Structure::dfgShouldWatchIfPossible() is unsound
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGAbstractInterpreterInlinesh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGAbstractInterpreterInlines.h        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -1872,6 +1872,8 @@
</span><span class="cx">             
</span><span class="cx">     case Call:
</span><span class="cx">     case Construct:
</span><ins>+    case NativeCall:
+    case NativeConstruct:
</ins><span class="cx">         node-&gt;setCanExit(true);
</span><span class="cx">         clobberWorld(node-&gt;origin.semantic, clobberLimit);
</span><span class="cx">         forNode(node).makeHeapTop();
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGByteCodeParsercpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGByteCodeParser.cpp        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -820,7 +820,7 @@
</span><span class="cx">         if (parameterSlots &gt; m_parameterSlots)
</span><span class="cx">             m_parameterSlots = parameterSlots;
</span><span class="cx"> 
</span><del>-        int dummyThisArgument = op == Call ? 0 : 1;
</del><ins>+        int dummyThisArgument = op == Call || op == NativeCall ? 0 : 1;
</ins><span class="cx">         for (int i = 0 + dummyThisArgument; i &lt; argCount; ++i)
</span><span class="cx">             addVarArgChild(get(virtualRegisterForArgument(i, registerOffset)));
</span><span class="cx"> 
</span><span class="lines">@@ -1275,9 +1275,19 @@
</span><span class="cx">         if (function-&gt;isHostFunction()) {
</span><span class="cx">             emitFunctionChecks(callLinkStatus, callTarget, registerOffset, specializationKind);
</span><span class="cx">             knownFunction = function;
</span><ins>+
+            if (op == Call) 
+                op = NativeCall;
+            else {
+                ASSERT(op == Construct);
+                op = NativeConstruct;
+            }
</ins><span class="cx">         }
</span><del>-    
-    addCall(result, op, callTarget, argumentCountIncludingThis, registerOffset)-&gt;giveKnownFunction(knownFunction);
</del><ins>+
+     Node* call = addCall(result, op, callTarget, argumentCountIncludingThis, registerOffset);
+
+     if (knownFunction) 
+         call-&gt;giveKnownFunction(knownFunction);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void ByteCodeParser::emitFunctionChecks(const CallLinkStatus&amp; callLinkStatus, Node* callTarget, int registerOffset, CodeSpecializationKind kind)
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGClobberizeh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGClobberize.h (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGClobberize.h        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGClobberize.h        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -200,6 +200,8 @@
</span><span class="cx">     case ArrayPop:
</span><span class="cx">     case Call:
</span><span class="cx">     case Construct:
</span><ins>+    case NativeCall:
+    case NativeConstruct:
</ins><span class="cx">     case ToPrimitive:
</span><span class="cx">     case In:
</span><span class="cx">     case GetMyArgumentsLengthSafe:
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGDoesGCcpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGDoesGC.cpp (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGDoesGC.cpp        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGDoesGC.cpp        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -117,6 +117,8 @@
</span><span class="cx">     case CompareStrictEq:
</span><span class="cx">     case Call:
</span><span class="cx">     case Construct:
</span><ins>+    case NativeCall:
+    case NativeConstruct:
</ins><span class="cx">     case Breakpoint:
</span><span class="cx">     case ProfileWillCall:
</span><span class="cx">     case ProfileDidCall:
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGFixupPhasecpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -1082,6 +1082,8 @@
</span><span class="cx">         case AllocationProfileWatchpoint:
</span><span class="cx">         case Call:
</span><span class="cx">         case Construct:
</span><ins>+        case NativeCall:
+        case NativeConstruct:
</ins><span class="cx">         case NewObject:
</span><span class="cx">         case NewArrayBuffer:
</span><span class="cx">         case NewRegexp:
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGNodeh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGNode.h (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGNode.h        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGNode.h        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -978,6 +978,8 @@
</span><span class="cx">         case GetMyArgumentByValSafe:
</span><span class="cx">         case Call:
</span><span class="cx">         case Construct:
</span><ins>+        case NativeCall:
+        case NativeConstruct:
</ins><span class="cx">         case GetByOffset:
</span><span class="cx">         case MultiGetByOffset:
</span><span class="cx">         case GetClosureVar:
</span><span class="lines">@@ -1008,8 +1010,8 @@
</span><span class="cx">     bool canBeKnownFunction()
</span><span class="cx">     {
</span><span class="cx">         switch (op()) {
</span><del>-        case Construct:
-        case Call:
</del><ins>+        case NativeConstruct:
+        case NativeCall:
</ins><span class="cx">             return true;
</span><span class="cx">         default:
</span><span class="cx">             return false;
</span><span class="lines">@@ -1019,8 +1021,8 @@
</span><span class="cx">     bool hasKnownFunction()
</span><span class="cx">     {
</span><span class="cx">         switch (op()) {
</span><del>-        case Construct:
-        case Call:
</del><ins>+        case NativeConstruct:
+        case NativeCall:
</ins><span class="cx">             return (bool)m_opInfo;
</span><span class="cx">         default:
</span><span class="cx">             return false;
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGNodeTypeh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGNodeType.h (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGNodeType.h        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGNodeType.h        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -215,6 +215,8 @@
</span><span class="cx">     /* Calls. */\
</span><span class="cx">     macro(Call, NodeResultJS | NodeMustGenerate | NodeHasVarArgs | NodeClobbersWorld) \
</span><span class="cx">     macro(Construct, NodeResultJS | NodeMustGenerate | NodeHasVarArgs | NodeClobbersWorld) \
</span><ins>+    macro(NativeCall, NodeResultJS | NodeMustGenerate | NodeHasVarArgs | NodeClobbersWorld) \
+    macro(NativeConstruct, NodeResultJS | NodeMustGenerate | NodeHasVarArgs | NodeClobbersWorld) \
</ins><span class="cx">     \
</span><span class="cx">     /* Allocations. */\
</span><span class="cx">     macro(NewObject, NodeResultJS) \
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGPredictionPropagationPhasecpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGPredictionPropagationPhase.cpp        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -183,6 +183,8 @@
</span><span class="cx">         case MultiGetByOffset:
</span><span class="cx">         case Call:
</span><span class="cx">         case Construct:
</span><ins>+        case NativeCall:
+        case NativeConstruct:
</ins><span class="cx">         case GetGlobalVar:
</span><span class="cx">         case GetClosureVar: {
</span><span class="cx">             changed |= setPrediction(node-&gt;getHeapPrediction());
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGSafeToExecuteh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGSafeToExecute.h (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -256,7 +256,11 @@
</span><span class="cx">     case GetGetter:
</span><span class="cx">     case GetSetter:
</span><span class="cx">         return true;
</span><del>-        
</del><ins>+
+    case NativeCall:
+    case NativeConstruct:
+        return false; // TODO: add a check for already checked. 
+
</ins><span class="cx">     case GetByVal:
</span><span class="cx">     case GetIndexedPropertyStorage:
</span><span class="cx">     case GetArrayLength:
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGSpeculativeJIT32_64cpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT32_64.cpp        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -638,12 +638,13 @@
</span><span class="cx"> 
</span><span class="cx"> void SpeculativeJIT::emitCall(Node* node)
</span><span class="cx"> {
</span><del>-    if (node-&gt;op() != Call)
-        ASSERT(node-&gt;op() == Construct);
</del><ins>+    bool isCall = node-&gt;op() == Call || node-&gt;op() == NativeCall;
+    if (!isCall)
+        ASSERT(node-&gt;op() == Construct || node-&gt;op() == NativeConstruct);
</ins><span class="cx"> 
</span><span class="cx">     // For constructors, the this argument is not passed but we have to make space
</span><span class="cx">     // for it.
</span><del>-    int dummyThisArgument = node-&gt;op() == Call ? 0 : 1;
</del><ins>+    int dummyThisArgument = isCall ? 0 : 1;
</ins><span class="cx"> 
</span><span class="cx">     CallLinkInfo::CallType callType = node-&gt;op() == Call ? CallLinkInfo::Call : CallLinkInfo::Construct;
</span><span class="cx"> 
</span><span class="lines">@@ -4130,6 +4131,8 @@
</span><span class="cx"> 
</span><span class="cx">     case Call:
</span><span class="cx">     case Construct:
</span><ins>+    case NativeCall:
+    case NativeConstruct:
</ins><span class="cx">         emitCall(node);
</span><span class="cx">         break;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoredfgDFGSpeculativeJIT64cpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/dfg/DFGSpeculativeJIT64.cpp        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -637,14 +637,16 @@
</span><span class="cx"> 
</span><span class="cx"> void SpeculativeJIT::emitCall(Node* node)
</span><span class="cx"> {
</span><del>-    if (node-&gt;op() != Call)
-        RELEASE_ASSERT(node-&gt;op() == Construct);
</del><span class="cx"> 
</span><ins>+    bool isCall = node-&gt;op() == Call || node-&gt;op() == NativeCall;
+    if (!isCall)
+        RELEASE_ASSERT(node-&gt;op() == Construct || node-&gt;op() == NativeConstruct);
+
</ins><span class="cx">     // For constructors, the this argument is not passed but we have to make space
</span><span class="cx">     // for it.
</span><del>-    int dummyThisArgument = node-&gt;op() == Call ? 0 : 1;
</del><ins>+    int dummyThisArgument = isCall ? 0 : 1;
</ins><span class="cx">     
</span><del>-    CallLinkInfo::CallType callType = node-&gt;op() == Call ? CallLinkInfo::Call : CallLinkInfo::Construct;
</del><ins>+    CallLinkInfo::CallType callType = isCall ? CallLinkInfo::Call : CallLinkInfo::Construct;
</ins><span class="cx">     
</span><span class="cx">     Edge calleeEdge = m_jit.graph().m_varArgChildren[node-&gt;firstChild()];
</span><span class="cx">     JSValueOperand callee(this, calleeEdge);
</span><span class="lines">@@ -4174,6 +4176,8 @@
</span><span class="cx"> 
</span><span class="cx">     case Call:
</span><span class="cx">     case Construct:
</span><ins>+    case NativeCall:
+    case NativeConstruct:
</ins><span class="cx">         emitCall(node);
</span><span class="cx">         break;
</span><span class="cx"> 
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -119,6 +119,8 @@
</span><span class="cx">     case StoreBarrierWithNullCheck:
</span><span class="cx">     case Call:
</span><span class="cx">     case Construct:
</span><ins>+    case NativeCall:
+    case NativeConstruct:
</ins><span class="cx">     case ValueToInt32:
</span><span class="cx">     case Branch:
</span><span class="cx">     case LogicalNot:
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoreftlFTLLowerDFGToLLVMcpp"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/ftl/FTLLowerDFGToLLVM.cpp        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -154,13 +154,8 @@
</span><span class="cx">                 Node* m_node = block-&gt;at(nodeIndex);
</span><span class="cx">                 if (m_node-&gt;hasKnownFunction()) {
</span><span class="cx">                     int numArgs = m_node-&gt;numChildren();
</span><del>-                    NativeFunction func = m_node-&gt;knownFunction()-&gt;nativeFunction();
-                    Dl_info info;
-                    if (dladdr((void*)func, &amp;info)) {
-                        LValue callee = getFunctionBySymbol(info.dli_sname);
-                        if (callee &amp;&amp; numArgs &gt; maxNumberOfArguments)
-                            maxNumberOfArguments = numArgs;
-                    }
</del><ins>+                    if (numArgs &gt; maxNumberOfArguments)
+                        maxNumberOfArguments = numArgs;
</ins><span class="cx">                 }
</span><span class="cx">             }
</span><span class="cx">         }
</span><span class="lines">@@ -637,6 +632,10 @@
</span><span class="cx">         case Construct:
</span><span class="cx">             compileCallOrConstruct();
</span><span class="cx">             break;
</span><ins>+        case NativeCall:
+        case NativeConstruct:
+            compileNativeCallOrConstruct();
+            break;
</ins><span class="cx">         case Jump:
</span><span class="cx">             compileJump();
</span><span class="cx">             break;
</span><span class="lines">@@ -3585,16 +3584,66 @@
</span><span class="cx">         setBoolean(m_out.bitNot(boolify(m_node-&gt;child1())));
</span><span class="cx">     }
</span><span class="cx"> 
</span><ins>+    void compileNativeCallOrConstruct() 
+    {
+        int dummyThisArgument = m_node-&gt;op() == NativeCall ? 0 : 1;
+        int numPassedArgs = m_node-&gt;numChildren() - 1;
+        int numArgs = numPassedArgs + dummyThisArgument;
+
+        ASSERT(m_node-&gt;hasKnownFunction());
+
+        JSFunction* knownFunction = m_node-&gt;knownFunction();
+        NativeFunction function = knownFunction-&gt;nativeFunction();
+
+        Dl_info info;
+        if (!dladdr((void*)function, &amp;info))
+            ASSERT(false); // if we couldn't find the native function this doesn't bode well.
+
+        LValue callee = getFunctionBySymbol(info.dli_sname);
+
+        bool notInlinable;
+        if ((notInlinable = !callee))
+            callee = m_out.operation(function);
+
+        JSScope* scope = knownFunction-&gt;scopeUnchecked();
+        m_out.storePtr(m_callFrame, m_execStorage, m_heaps.CallFrame_callerFrame);
+        m_out.storePtr(constNull(m_out.intPtr), addressFor(m_execStorage, JSStack::CodeBlock));
+        m_out.storePtr(weakPointer(scope), addressFor(m_execStorage, JSStack::ScopeChain));
+        m_out.storePtr(weakPointer(knownFunction), addressFor(m_execStorage, JSStack::Callee));
+
+        m_out.store64(m_out.constInt64(numArgs), addressFor(m_execStorage, JSStack::ArgumentCount));
+
+        if (dummyThisArgument) 
+            m_out.storePtr(getUndef(m_out.int64), addressFor(m_execStorage, JSStack::ThisArgument));
+        
+        for (int i = 0; i &lt; numPassedArgs; ++i) {
+            m_out.storePtr(lowJSValue(m_graph.varArgChild(m_node, 1 + i)),
+                addressFor(m_execStorage, dummyThisArgument ? JSStack::FirstArgument : JSStack::ThisArgument, i * sizeof(Register)));
+        }
+
+        LValue calleeCallFrame = m_out.address(m_execState, m_heaps.CallFrame_callerFrame).value();
+        m_out.storePtr(m_out.ptrToInt(calleeCallFrame, m_out.intPtr), m_out.absolute(&amp;vm().topCallFrame));
+
+        LType typeCalleeArg;
+        getParamTypes(getElementType(typeOf(callee)), &amp;typeCalleeArg);
+
+        LValue argument = notInlinable 
+            ? m_out.ptrToInt(calleeCallFrame, typeCalleeArg) 
+            : m_out.bitCast(calleeCallFrame, typeCalleeArg);
+        LValue call = vmCall(callee, argument);
+
+        if (Options::verboseCompilation())
+            dataLog(&quot;Native calling: &quot;, info.dli_sname, &quot;\n&quot;);
+
+        setJSValue(call);
+    }
+
</ins><span class="cx">     void compileCallOrConstruct()
</span><span class="cx">     {
</span><span class="cx">         int dummyThisArgument = m_node-&gt;op() == Call ? 0 : 1;
</span><span class="cx">         int numPassedArgs = m_node-&gt;numChildren() - 1;
</span><span class="cx">         int numArgs = numPassedArgs + dummyThisArgument;
</span><span class="cx"> 
</span><del>-        if (m_node-&gt;hasKnownFunction()
-            &amp;&amp; possiblyCompileInlineableNativeCall(dummyThisArgument, numPassedArgs, numArgs))
-            return;
-
</del><span class="cx">         LValue jsCallee = lowJSValue(m_graph.varArgChild(m_node, 0));
</span><span class="cx"> 
</span><span class="cx">         unsigned stackmapID = m_stackmapIDs++;
</span><span class="lines">@@ -3975,50 +4024,6 @@
</span><span class="cx"> #endif
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    bool possiblyCompileInlineableNativeCall(int dummyThisArgument, int numPassedArgs, int numArgs)
-    {
-        JSFunction* knownFunction = m_node-&gt;knownFunction();
-        NativeFunction function = knownFunction-&gt;nativeFunction();
-        Dl_info info;
-        if (dladdr((void*)function, &amp;info)) {
-            LValue callee = getFunctionBySymbol(info.dli_sname);
-            LType typeCallee;
-            if (callee &amp;&amp; (typeCallee = typeOf(callee)) &amp;&amp; (typeCallee = getElementType(typeCallee))) {
-
-                JSScope* scope = knownFunction-&gt;scopeUnchecked();
-                m_out.storePtr(m_callFrame, m_execStorage, m_heaps.CallFrame_callerFrame);
-                m_out.storePtr(constNull(m_out.intPtr), addressFor(m_execStorage, JSStack::CodeBlock));
-                m_out.storePtr(weakPointer(scope), addressFor(m_execStorage, JSStack::ScopeChain));
-                m_out.storePtr(weakPointer(knownFunction), addressFor(m_execStorage, JSStack::Callee));
-
-                m_out.store64(m_out.constInt64(numArgs), addressFor(m_execStorage, JSStack::ArgumentCount));
-
-                if (dummyThisArgument) 
-                    m_out.storePtr(getUndef(m_out.int64), addressFor(m_execStorage, JSStack::ThisArgument));
-                
-                for (int i = 0; i &lt; numPassedArgs; ++i) {
-                    m_out.storePtr(lowJSValue(m_graph.varArgChild(m_node, 1 + i)),
-                        addressFor(m_execStorage, dummyThisArgument ? JSStack::FirstArgument : JSStack::ThisArgument, i * sizeof(Register)));
-                }
-
-                LType typeCalleeArg;
-                getParamTypes(typeCallee, &amp;typeCalleeArg);
-                LValue calleeCallFrame = m_out.address(m_execState, m_heaps.CallFrame_callerFrame).value();
-                m_out.storePtr(m_out.ptrToInt(calleeCallFrame, m_out.intPtr), m_out.absolute(&amp;vm().topCallFrame));
-                
-                LValue call = vmCall(callee, 
-                    m_out.bitCast(calleeCallFrame, typeCalleeArg));
-
-                if (Options::verboseCompilation())
-                    dataLog(&quot;Inlining: &quot;, info.dli_sname, &quot;\n&quot;);
-
-                setJSValue(call);
-                return true;
-            }
-        }
-        return false;
-    }
-
</del><span class="cx">     LValue getFunctionBySymbol(const CString symbol)
</span><span class="cx">     {
</span><span class="cx">         if (!m_ftlState.symbolTable.contains(symbol)) 
</span><span class="lines">@@ -4150,6 +4155,8 @@
</span><span class="cx">                 case PutById:
</span><span class="cx">                 case Call:
</span><span class="cx">                 case Construct:
</span><ins>+                case NativeCall:
+                case NativeConstruct:
</ins><span class="cx">                     return m_out.below(
</span><span class="cx">                         m_callFrame,
</span><span class="cx">                         m_out.loadPtr(
</span></span></pre></div>
<a id="branchesftloptSourceJavaScriptCoreruntimeJSCJSValueh"></a>
<div class="modfile"><h4>Modified: branches/ftlopt/Source/JavaScriptCore/runtime/JSCJSValue.h (169785 => 169786)</h4>
<pre class="diff"><span>
<span class="info">--- branches/ftlopt/Source/JavaScriptCore/runtime/JSCJSValue.h        2014-06-11 01:38:03 UTC (rev 169785)
+++ branches/ftlopt/Source/JavaScriptCore/runtime/JSCJSValue.h        2014-06-11 01:51:56 UTC (rev 169786)
</span><span class="lines">@@ -240,7 +240,7 @@
</span><span class="cx">     JSObject* toObject(ExecState*, JSGlobalObject*) const;
</span><span class="cx"> 
</span><span class="cx">     // Integer conversions.
</span><del>-    double toInteger(ExecState*) const;
</del><ins>+    JS_EXPORT_PRIVATE double toInteger(ExecState*) const;
</ins><span class="cx">     JS_EXPORT_PRIVATE double toIntegerPreserveNaN(ExecState*) const;
</span><span class="cx">     int32_t toInt32(ExecState*) const;
</span><span class="cx">     uint32_t toUInt32(ExecState*) const;
</span></span></pre>
</div>
</div>

</body>
</html>