<!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>[206047] 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/206047">206047</a></dd>
<dt>Author</dt> <dd>utatane.tea@gmail.com</dd>
<dt>Date</dt> <dd>2016-09-16 14:17:33 -0700 (Fri, 16 Sep 2016)</dd>
</dl>
<h3>Log Message</h3>
<pre>[DFG] Introduce ArrayUse
https://bugs.webkit.org/show_bug.cgi?id=162063
Reviewed by Keith Miller.
ArrayUse is particularly useful: for IsJSArray.
We can drop IsJSArray in fixup phase by setting ArrayUse edge filter.
Since @isJSArray user is limited (Array.prototype.concat), the effect of this patch is small.
But later, I'll update {@isArray, Array.isArray} to use @isJSArray[1]. In that patch, we are planning
to implement more aggressive optimization like, setting CellUse edge filter to avoid cell check in
SpeculativeJIT::compileIsJSArray.
In the benchmark using Array.prototype.concat, we can see perf improvement since we can drop IsJSArray in fixup phase.
baseline patched
lazy-array-species-watchpoints 25.0911+-0.0516 ^ 24.7687+-0.0767 ^ definitely 1.0130x faster
[1]: https://bugs.webkit.org/show_bug.cgi?id=162000
* dfg/DFGFixupPhase.cpp:
(JSC::DFG::FixupPhase::fixupNode):
* dfg/DFGSafeToExecute.h:
(JSC::DFG::SafeToExecuteEdge::operator()):
* dfg/DFGSpeculativeJIT.cpp:
(JSC::DFG::SpeculativeJIT::speculateArray):
(JSC::DFG::SpeculativeJIT::speculate):
* dfg/DFGSpeculativeJIT.h:
* dfg/DFGUseKind.cpp:
(WTF::printInternal):
* dfg/DFGUseKind.h:
(JSC::DFG::typeFilterFor):
(JSC::DFG::isCell):
* ftl/FTLCapabilities.cpp:
(JSC::FTL::canCompile):
* ftl/FTLLowerDFGToB3.cpp:
(JSC::FTL::DFG::LowerDFGToB3::speculate):
(JSC::FTL::DFG::LowerDFGToB3::speculateArray):
(JSC::FTL::DFG::LowerDFGToB3::speculateObject): Deleted.</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGFixupPhasecpp">trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSafeToExecuteh">trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGSpeculativeJITh">trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGUseKindcpp">trunk/Source/JavaScriptCore/dfg/DFGUseKind.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredfgDFGUseKindh">trunk/Source/JavaScriptCore/dfg/DFGUseKind.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLCapabilitiescpp">trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp">trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -1,3 +1,46 @@
</span><ins>+2016-09-16 Yusuke Suzuki <utatane.tea@gmail.com>
+
+ [DFG] Introduce ArrayUse
+ https://bugs.webkit.org/show_bug.cgi?id=162063
+
+ Reviewed by Keith Miller.
+
+ ArrayUse is particularly useful: for IsJSArray.
+ We can drop IsJSArray in fixup phase by setting ArrayUse edge filter.
+
+ Since @isJSArray user is limited (Array.prototype.concat), the effect of this patch is small.
+ But later, I'll update {@isArray, Array.isArray} to use @isJSArray[1]. In that patch, we are planning
+ to implement more aggressive optimization like, setting CellUse edge filter to avoid cell check in
+ SpeculativeJIT::compileIsJSArray.
+
+ In the benchmark using Array.prototype.concat, we can see perf improvement since we can drop IsJSArray in fixup phase.
+
+ baseline patched
+
+ lazy-array-species-watchpoints 25.0911+-0.0516 ^ 24.7687+-0.0767 ^ definitely 1.0130x faster
+
+ [1]: https://bugs.webkit.org/show_bug.cgi?id=162000
+
+ * dfg/DFGFixupPhase.cpp:
+ (JSC::DFG::FixupPhase::fixupNode):
+ * dfg/DFGSafeToExecute.h:
+ (JSC::DFG::SafeToExecuteEdge::operator()):
+ * dfg/DFGSpeculativeJIT.cpp:
+ (JSC::DFG::SpeculativeJIT::speculateArray):
+ (JSC::DFG::SpeculativeJIT::speculate):
+ * dfg/DFGSpeculativeJIT.h:
+ * dfg/DFGUseKind.cpp:
+ (WTF::printInternal):
+ * dfg/DFGUseKind.h:
+ (JSC::DFG::typeFilterFor):
+ (JSC::DFG::isCell):
+ * ftl/FTLCapabilities.cpp:
+ (JSC::FTL::canCompile):
+ * ftl/FTLLowerDFGToB3.cpp:
+ (JSC::FTL::DFG::LowerDFGToB3::speculate):
+ (JSC::FTL::DFG::LowerDFGToB3::speculateArray):
+ (JSC::FTL::DFG::LowerDFGToB3::speculateObject): Deleted.
+
</ins><span class="cx"> 2016-09-16 Joseph Pecoraro <pecoraro@apple.com>
</span><span class="cx">
</span><span class="cx"> test262: Various Constructors length properties should be configurable
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGFixupPhasecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/dfg/DFGFixupPhase.cpp        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -1417,6 +1417,16 @@
</span><span class="cx"> }
</span><span class="cx"> break;
</span><span class="cx">
</span><ins>+ case IsJSArray:
+ if (node->child1()->shouldSpeculateArray()) {
+ m_insertionSet.insertNode(
+ m_indexInBlock, SpecNone, Check, node->origin,
+ Edge(node->child1().node(), ArrayUse));
+ m_graph.convertToConstant(node, jsBoolean(true));
+ observeUseKindOnNode<ArrayUse>(node);
+ }
+ break;
+
</ins><span class="cx"> case GetEnumerableLength: {
</span><span class="cx"> fixEdge<CellUse>(node->child1());
</span><span class="cx"> break;
</span><span class="lines">@@ -1622,7 +1632,6 @@
</span><span class="cx"> case NewRegexp:
</span><span class="cx"> case DeleteById:
</span><span class="cx"> case DeleteByVal:
</span><del>- case IsJSArray:
</del><span class="cx"> case IsTypedArrayView:
</span><span class="cx"> case IsEmpty:
</span><span class="cx"> case IsUndefined:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSafeToExecuteh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/dfg/DFGSafeToExecute.h        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -55,6 +55,7 @@
</span><span class="cx"> case CellUse:
</span><span class="cx"> case CellOrOtherUse:
</span><span class="cx"> case ObjectUse:
</span><ins>+ case ArrayUse:
</ins><span class="cx"> case FunctionUse:
</span><span class="cx"> case FinalObjectUse:
</span><span class="cx"> case RegExpObjectUse:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.cpp        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -7394,6 +7394,20 @@
</span><span class="cx"> speculateRegExpObject(edge, operand.gpr());
</span><span class="cx"> }
</span><span class="cx">
</span><ins>+void SpeculativeJIT::speculateArray(Edge edge, GPRReg cell)
+{
+ speculateCellType(edge, cell, SpecArray, ArrayType);
+}
+
+void SpeculativeJIT::speculateArray(Edge edge)
+{
+ if (!needsTypeCheck(edge, SpecArray))
+ return;
+
+ SpeculateCellOperand operand(this, edge);
+ speculateArray(edge, operand.gpr());
+}
+
</ins><span class="cx"> void SpeculativeJIT::speculateMapObject(Edge edge, GPRReg cell)
</span><span class="cx"> {
</span><span class="cx"> speculateCellType(edge, cell, SpecMapObject, JSMapType);
</span><span class="lines">@@ -7703,6 +7717,9 @@
</span><span class="cx"> case FunctionUse:
</span><span class="cx"> speculateFunction(edge);
</span><span class="cx"> break;
</span><ins>+ case ArrayUse:
+ speculateArray(edge);
+ break;
</ins><span class="cx"> case FinalObjectUse:
</span><span class="cx"> speculateFinalObject(edge);
</span><span class="cx"> break;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGSpeculativeJITh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/dfg/DFGSpeculativeJIT.h        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -2674,6 +2674,8 @@
</span><span class="cx"> void speculateCell(Edge);
</span><span class="cx"> void speculateCellOrOther(Edge);
</span><span class="cx"> void speculateObject(Edge);
</span><ins>+ void speculateArray(Edge, GPRReg cell);
+ void speculateArray(Edge);
</ins><span class="cx"> void speculateFunction(Edge);
</span><span class="cx"> void speculateFinalObject(Edge);
</span><span class="cx"> void speculateRegExpObject(Edge, GPRReg cell);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGUseKindcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGUseKind.cpp (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGUseKind.cpp        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/dfg/DFGUseKind.cpp        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -85,6 +85,9 @@
</span><span class="cx"> case ObjectUse:
</span><span class="cx"> out.print("Object");
</span><span class="cx"> return;
</span><ins>+ case ArrayUse:
+ out.print("Array");
+ return;
</ins><span class="cx"> case FunctionUse:
</span><span class="cx"> out.print("Function");
</span><span class="cx"> return;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredfgDFGUseKindh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/dfg/DFGUseKind.h (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/dfg/DFGUseKind.h        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/dfg/DFGUseKind.h        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -53,6 +53,7 @@
</span><span class="cx"> KnownCellUse,
</span><span class="cx"> CellOrOtherUse,
</span><span class="cx"> ObjectUse,
</span><ins>+ ArrayUse,
</ins><span class="cx"> FunctionUse,
</span><span class="cx"> FinalObjectUse,
</span><span class="cx"> RegExpObjectUse,
</span><span class="lines">@@ -117,6 +118,8 @@
</span><span class="cx"> return SpecCell | SpecOther;
</span><span class="cx"> case ObjectUse:
</span><span class="cx"> return SpecObject;
</span><ins>+ case ArrayUse:
+ return SpecArray;
</ins><span class="cx"> case FunctionUse:
</span><span class="cx"> return SpecFunction;
</span><span class="cx"> case FinalObjectUse:
</span><span class="lines">@@ -218,6 +221,7 @@
</span><span class="cx"> case CellUse:
</span><span class="cx"> case KnownCellUse:
</span><span class="cx"> case ObjectUse:
</span><ins>+ case ArrayUse:
</ins><span class="cx"> case FunctionUse:
</span><span class="cx"> case FinalObjectUse:
</span><span class="cx"> case RegExpObjectUse:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLCapabilitiescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/ftl/FTLCapabilities.cpp        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -422,6 +422,7 @@
</span><span class="cx"> case KnownCellUse:
</span><span class="cx"> case CellOrOtherUse:
</span><span class="cx"> case ObjectUse:
</span><ins>+ case ArrayUse:
</ins><span class="cx"> case FunctionUse:
</span><span class="cx"> case ObjectOrOtherUse:
</span><span class="cx"> case StringUse:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreftlFTLLowerDFGToB3cpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp (206046 => 206047)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-09-16 20:49:16 UTC (rev 206046)
+++ trunk/Source/JavaScriptCore/ftl/FTLLowerDFGToB3.cpp        2016-09-16 21:17:33 UTC (rev 206047)
</span><span class="lines">@@ -10676,6 +10676,9 @@
</span><span class="cx"> case ObjectUse:
</span><span class="cx"> speculateObject(edge);
</span><span class="cx"> break;
</span><ins>+ case ArrayUse:
+ speculateArray(edge);
+ break;
</ins><span class="cx"> case FunctionUse:
</span><span class="cx"> speculateFunction(edge);
</span><span class="cx"> break;
</span><span class="lines">@@ -10960,6 +10963,17 @@
</span><span class="cx"> {
</span><span class="cx"> speculateObject(edge, lowCell(edge));
</span><span class="cx"> }
</span><ins>+
+ void speculateArray(Edge edge, LValue cell)
+ {
+ FTL_TYPE_CHECK(
+ jsValueValue(cell), edge, SpecArray, isNotType(cell, ArrayType));
+ }
+
+ void speculateArray(Edge edge)
+ {
+ speculateArray(edge, lowCell(edge));
+ }
</ins><span class="cx">
</span><span class="cx"> void speculateFunction(Edge edge, LValue cell)
</span><span class="cx"> {
</span></span></pre>
</div>
</div>
</body>
</html>