<!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>[190146] trunk</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/190146">190146</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2015-09-22 17:39:09 -0700 (Tue, 22 Sep 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>Web Inspector: [ES6] Improve Type Profiler Support for Arrow Functions
https://bugs.webkit.org/show_bug.cgi?id=143171

Reviewed by Joseph Pecoraro.

Source/JavaScriptCore:

We now need to take into account TypeProfilerSearchDescriptor when
hashing results for type profiler queries. Before, we've gotten
away with not doing this because before we would never have a text 
collision between a return type text offset and a normal expression text
offset. But, with arrow functions, we will have collisions when
the arrow function doesn't have parens around its single parameter.
I.e: &quot;param =&gt; { ... };&quot;

* runtime/TypeProfiler.cpp:
(JSC::TypeProfiler::findLocation):
* runtime/TypeProfiler.h:
(JSC::QueryKey::QueryKey):
(JSC::QueryKey::isHashTableDeletedValue):
(JSC::QueryKey::operator==):
(JSC::QueryKey::hash):
* tests/typeProfiler/arrow-functions.js: Added.

Source/WebInspectorUI:

Esprima and JSC both support arrow functions. We just
need to support it in our AST and do the right things
to include support in the type profiler bits.

* UserInterface/Controllers/TypeTokenAnnotator.js:
(WebInspector.TypeTokenAnnotator.prototype._insertTypeToken):
(WebInspector.TypeTokenAnnotator.prototype._translateToOffsetAfterFunctionParameterList.isLineTerminator):
(WebInspector.TypeTokenAnnotator.prototype._translateToOffsetAfterFunctionParameterList):
* UserInterface/Models/ScriptSyntaxTree.js:
(WebInspector.ScriptSyntaxTree.prototype.containsNonEmptyReturnStatement.removeFunctionsFilter):
(WebInspector.ScriptSyntaxTree.prototype.containsNonEmptyReturnStatement):
(WebInspector.ScriptSyntaxTree.functionReturnDivot):
(WebInspector.ScriptSyntaxTree.prototype._recurse):
(WebInspector.ScriptSyntaxTree.prototype._createInternalSyntaxTree):
(WebInspector.ScriptSyntaxTree):

LayoutTests:

* inspector/model/parse-script-syntax-tree-expected.txt:
* inspector/model/parse-script-syntax-tree.html:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkLayoutTestsinspectormodelparsescriptsyntaxtreeexpectedtxt">trunk/LayoutTests/inspector/model/parse-script-syntax-tree-expected.txt</a></li>
<li><a href="#trunkLayoutTestsinspectormodelparsescriptsyntaxtreehtml">trunk/LayoutTests/inspector/model/parse-script-syntax-tree.html</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeTypeProfilercpp">trunk/Source/JavaScriptCore/runtime/TypeProfiler.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeTypeProfilerh">trunk/Source/JavaScriptCore/runtime/TypeProfiler.h</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceControllersTypeTokenAnnotatorjs">trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceModelsScriptSyntaxTreejs">trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreteststypeProfilerarrowfunctionsjs">trunk/Source/JavaScriptCore/tests/typeProfiler/arrow-functions.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/LayoutTests/ChangeLog        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -1,3 +1,13 @@
</span><ins>+2015-09-22  Saam barati  &lt;sbarati@apple.com&gt;
+
+        Web Inspector: [ES6] Improve Type Profiler Support for Arrow Functions
+        https://bugs.webkit.org/show_bug.cgi?id=143171
+
+        Reviewed by Joseph Pecoraro.
+
+        * inspector/model/parse-script-syntax-tree-expected.txt:
+        * inspector/model/parse-script-syntax-tree.html:
+
</ins><span class="cx"> 2015-09-22  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r190134.
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelparsescriptsyntaxtreeexpectedtxt"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/parse-script-syntax-tree-expected.txt (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/parse-script-syntax-tree-expected.txt        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/LayoutTests/inspector/model/parse-script-syntax-tree-expected.txt        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -40,5 +40,6 @@
</span><span class="cx"> passed WithStatement
</span><span class="cx"> passed ClassStatement, Super, MetaProperty
</span><span class="cx"> passed AssignmentPattern
</span><ins>+passed ArrowFunctionExpression
</ins><span class="cx"> passed ALL TESTS
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkLayoutTestsinspectormodelparsescriptsyntaxtreehtml"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/inspector/model/parse-script-syntax-tree.html (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/inspector/model/parse-script-syntax-tree.html        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/LayoutTests/inspector/model/parse-script-syntax-tree.html        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -476,6 +476,26 @@
</span><span class="cx">     InspectorTest.assert(node.declarations[0].id.elements[0].right.value === 20);
</span><span class="cx">     InspectorTest.log(&quot;passed AssignmentPattern&quot;);
</span><span class="cx"> 
</span><ins>+    node = makeNode(&quot;(x) =&gt; x;&quot;, true);
+    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
+    InspectorTest.assert(node.params.length === 1);
+    InspectorTest.assert(node.params[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.params[0].name === &quot;x&quot;);
+    InspectorTest.assert(node.expression === true);
+    InspectorTest.assert(node.defaults.length === 0);
+    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+
+    node = makeNode(&quot;(x = 20) =&gt; { return x; };&quot;, true);
+    InspectorTest.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
+    InspectorTest.assert(node.params.length === 1);
+    InspectorTest.assert(node.params[0].type === WebInspector.ScriptSyntaxTree.NodeType.Identifier);
+    InspectorTest.assert(node.params[0].name === &quot;x&quot;);
+    InspectorTest.assert(node.expression === false);
+    InspectorTest.assert(node.defaults.length === 1);
+    InspectorTest.assert(node.defaults[0].type === WebInspector.ScriptSyntaxTree.NodeType.Literal);
+    InspectorTest.assert(node.body.type === WebInspector.ScriptSyntaxTree.NodeType.BlockStatement);
+    InspectorTest.log(&quot;passed ArrowFunctionExpression&quot;);
+
</ins><span class="cx">     InspectorTest.log(&quot;passed ALL TESTS&quot;);
</span><span class="cx">     InspectorTest.completeTest();
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -1,3 +1,27 @@
</span><ins>+2015-09-22  Saam barati  &lt;sbarati@apple.com&gt;
+
+        Web Inspector: [ES6] Improve Type Profiler Support for Arrow Functions
+        https://bugs.webkit.org/show_bug.cgi?id=143171
+
+        Reviewed by Joseph Pecoraro.
+
+        We now need to take into account TypeProfilerSearchDescriptor when
+        hashing results for type profiler queries. Before, we've gotten
+        away with not doing this because before we would never have a text 
+        collision between a return type text offset and a normal expression text
+        offset. But, with arrow functions, we will have collisions when
+        the arrow function doesn't have parens around its single parameter.
+        I.e: &quot;param =&gt; { ... };&quot;
+
+        * runtime/TypeProfiler.cpp:
+        (JSC::TypeProfiler::findLocation):
+        * runtime/TypeProfiler.h:
+        (JSC::QueryKey::QueryKey):
+        (JSC::QueryKey::isHashTableDeletedValue):
+        (JSC::QueryKey::operator==):
+        (JSC::QueryKey::hash):
+        * tests/typeProfiler/arrow-functions.js: Added.
+
</ins><span class="cx"> 2015-09-22  Filip Pizlo  &lt;fpizlo@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Get rid of ENABLE(PARALLEL_GC)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeTypeProfilercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/TypeProfiler.cpp (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/TypeProfiler.cpp        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/Source/JavaScriptCore/runtime/TypeProfiler.cpp        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -108,7 +108,7 @@
</span><span class="cx"> 
</span><span class="cx"> TypeLocation* TypeProfiler::findLocation(unsigned divot, intptr_t sourceID, TypeProfilerSearchDescriptor descriptor, VM&amp; vm)
</span><span class="cx"> {
</span><del>-    QueryKey queryKey(sourceID, divot);
</del><ins>+    QueryKey queryKey(sourceID, divot, descriptor);
</ins><span class="cx">     auto iter = m_queryCache.find(queryKey);
</span><span class="cx">     if (iter != m_queryCache.end())
</span><span class="cx">         return iter-&gt;value;
</span><span class="lines">@@ -129,7 +129,7 @@
</span><span class="cx">         if (descriptor == TypeProfilerSearchDescriptorFunctionReturn &amp;&amp; location-&gt;m_globalVariableID == TypeProfilerReturnStatement &amp;&amp; location-&gt;m_divotForFunctionOffsetIfReturnStatement == divot)
</span><span class="cx">             return location;
</span><span class="cx"> 
</span><del>-        if (descriptor != TypeProfilerSearchDescriptorFunctionReturn &amp;&amp; location-&gt;m_divotStart &lt;= divot &amp;&amp; divot &lt;= location-&gt;m_divotEnd &amp;&amp; location-&gt;m_divotEnd - location-&gt;m_divotStart &lt;= distance) {
</del><ins>+        if (descriptor != TypeProfilerSearchDescriptorFunctionReturn &amp;&amp; location-&gt;m_globalVariableID != TypeProfilerReturnStatement &amp;&amp; location-&gt;m_divotStart &lt;= divot &amp;&amp; divot &lt;= location-&gt;m_divotEnd &amp;&amp; location-&gt;m_divotEnd - location-&gt;m_divotStart &lt;= distance) {
</ins><span class="cx">             distance = location-&gt;m_divotEnd - location-&gt;m_divotStart;
</span><span class="cx">             bestMatch = location;
</span><span class="cx">         }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeTypeProfilerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/TypeProfiler.h (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/TypeProfiler.h        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/Source/JavaScriptCore/runtime/TypeProfiler.h        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -40,28 +40,53 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><ins>+enum TypeProfilerSearchDescriptor {
+    TypeProfilerSearchDescriptorNormal = 1,
+    TypeProfilerSearchDescriptorFunctionReturn = 2
+};
+
</ins><span class="cx"> struct QueryKey {
</span><span class="cx">     QueryKey()
</span><span class="cx">         : m_sourceID(0)
</span><span class="cx">         , m_divot(0)
</span><ins>+        , m_searchDescriptor(TypeProfilerSearchDescriptorFunctionReturn)
</ins><span class="cx">     { }
</span><span class="cx"> 
</span><del>-    QueryKey(intptr_t sourceID, unsigned divot)
</del><ins>+    QueryKey(intptr_t sourceID, unsigned divot, TypeProfilerSearchDescriptor searchDescriptor)
</ins><span class="cx">         : m_sourceID(sourceID)
</span><span class="cx">         , m_divot(divot)
</span><ins>+        , m_searchDescriptor(searchDescriptor)
</ins><span class="cx">     { }
</span><span class="cx"> 
</span><span class="cx">     QueryKey(WTF::HashTableDeletedValueType)
</span><span class="cx">         : m_sourceID(INTPTR_MAX)
</span><span class="cx">         , m_divot(UINT_MAX)
</span><ins>+        , m_searchDescriptor(TypeProfilerSearchDescriptorFunctionReturn)
</ins><span class="cx">     { }
</span><span class="cx"> 
</span><del>-    bool isHashTableDeletedValue() const { return m_sourceID == INTPTR_MAX &amp;&amp; m_divot == UINT_MAX; }
-    bool operator==(const QueryKey&amp; other) const { return m_sourceID == other.m_sourceID &amp;&amp; m_divot == other.m_divot; }
-    unsigned hash() const { return m_sourceID + m_divot; }
</del><ins>+    bool isHashTableDeletedValue() const 
+    { 
+        return m_sourceID == INTPTR_MAX 
+            &amp;&amp; m_divot == UINT_MAX
+            &amp;&amp; m_searchDescriptor == TypeProfilerSearchDescriptorFunctionReturn;
+    }
</ins><span class="cx"> 
</span><ins>+    bool operator==(const QueryKey&amp; other) const
+    {
+        return m_sourceID == other.m_sourceID 
+            &amp;&amp; m_divot == other.m_divot
+            &amp;&amp; m_searchDescriptor == other.m_searchDescriptor;
+    }
+
+    unsigned hash() const 
+    { 
+        unsigned hash = m_sourceID + m_divot * m_searchDescriptor;
+        return hash;
+    }
+
</ins><span class="cx">     intptr_t m_sourceID;
</span><span class="cx">     unsigned m_divot;
</span><ins>+    TypeProfilerSearchDescriptor m_searchDescriptor;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> struct QueryKeyHash {
</span><span class="lines">@@ -80,7 +105,9 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template&lt;typename T&gt; struct HashTraits;
</span><del>-template&lt;&gt; struct HashTraits&lt;JSC::QueryKey&gt; : SimpleClassHashTraits&lt;JSC::QueryKey&gt; { };
</del><ins>+template&lt;&gt; struct HashTraits&lt;JSC::QueryKey&gt; : SimpleClassHashTraits&lt;JSC::QueryKey&gt; {
+    static const bool emptyValueIsZero = false;
+};
</ins><span class="cx"> 
</span><span class="cx"> } // namespace WTF
</span><span class="cx"> 
</span><span class="lines">@@ -88,11 +115,6 @@
</span><span class="cx"> 
</span><span class="cx"> class VM;
</span><span class="cx"> 
</span><del>-enum TypeProfilerSearchDescriptor {
-    TypeProfilerSearchDescriptorNormal = 1,
-    TypeProfilerSearchDescriptorFunctionReturn = 2
-};
-
</del><span class="cx"> class TypeProfiler {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreteststypeProfilerarrowfunctionsjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/typeProfiler/arrow-functions.js (0 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/typeProfiler/arrow-functions.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/typeProfiler/arrow-functions.js        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+load(&quot;./driver/driver.js&quot;);
+
+let foo = (x) =&gt; x;
+let bar = abc =&gt; abc;
+let baz = abc =&gt; { return abc; };
+let jaz = abc =&gt; { };
+
+function wrapper(b) {
+    let baz = (x) =&gt; x;
+    baz(b);
+
+    let foo = yyy =&gt; yyy;
+    foo(b);
+}
+
+// ====== End test cases ======
+
+foo(20);
+var types = returnTypeFor(foo);
+assert(types.globalTypeSet.displayTypeName === T.Integer, &quot;Function 'foo' should return 'Integer'&quot;);
+
+bar(&quot;hello&quot;);
+types = returnTypeFor(bar);
+assert(types.globalTypeSet.displayTypeName === T.String, &quot;Function 'bar' should return 'String'&quot;);
+
+baz(&quot;hello&quot;);
+types = returnTypeFor(baz);
+assert(types.globalTypeSet.displayTypeName === T.String, &quot;Function 'baz' should return 'String'&quot;);
+
+jaz(&quot;hello&quot;);
+types = returnTypeFor(jaz);
+assert(types.globalTypeSet.displayTypeName === T.Undefined, &quot;Function 'jaz' should return 'Undefined'&quot;);
+
+wrapper(&quot;hello&quot;);
+types = findTypeForExpression(wrapper, &quot;x)&quot;); 
+assert(types.instructionTypeSet.displayTypeName === T.String, &quot;Parameter 'x' should be 'String'&quot;);
+
+types = findTypeForExpression(wrapper, &quot;yyy =&gt;&quot;);
+assert(types.instructionTypeSet.displayTypeName === T.String, &quot;Parameter 'yyy' should be 'String'&quot;);
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/Source/WebInspectorUI/ChangeLog        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -1,5 +1,28 @@
</span><span class="cx"> 2015-09-22  Saam barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><ins>+        Web Inspector: [ES6] Improve Type Profiler Support for Arrow Functions
+        https://bugs.webkit.org/show_bug.cgi?id=143171
+
+        Reviewed by Joseph Pecoraro.
+
+        Esprima and JSC both support arrow functions. We just
+        need to support it in our AST and do the right things
+        to include support in the type profiler bits.
+
+        * UserInterface/Controllers/TypeTokenAnnotator.js:
+        (WebInspector.TypeTokenAnnotator.prototype._insertTypeToken):
+        (WebInspector.TypeTokenAnnotator.prototype._translateToOffsetAfterFunctionParameterList.isLineTerminator):
+        (WebInspector.TypeTokenAnnotator.prototype._translateToOffsetAfterFunctionParameterList):
+        * UserInterface/Models/ScriptSyntaxTree.js:
+        (WebInspector.ScriptSyntaxTree.prototype.containsNonEmptyReturnStatement.removeFunctionsFilter):
+        (WebInspector.ScriptSyntaxTree.prototype.containsNonEmptyReturnStatement):
+        (WebInspector.ScriptSyntaxTree.functionReturnDivot):
+        (WebInspector.ScriptSyntaxTree.prototype._recurse):
+        (WebInspector.ScriptSyntaxTree.prototype._createInternalSyntaxTree):
+        (WebInspector.ScriptSyntaxTree):
+
+2015-09-22  Saam barati  &lt;sbarati@apple.com&gt;
+
</ins><span class="cx">         Web Inspector: update Esprima to latest version
</span><span class="cx">         https://bugs.webkit.org/show_bug.cgi?id=148960
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceControllersTypeTokenAnnotatorjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/Source/WebInspectorUI/UserInterface/Controllers/TypeTokenAnnotator.js        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -95,7 +95,7 @@
</span><span class="cx">             return;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        console.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration || node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression);
</del><ins>+        console.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration || node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression || node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression);
</ins><span class="cx"> 
</span><span class="cx">         var functionReturnType = node.attachments.returnTypes;
</span><span class="cx">         if (!functionReturnType || !functionReturnType.valid)
</span><span class="lines">@@ -148,6 +148,7 @@
</span><span class="cx">         var isMultiLineComment = false;
</span><span class="cx">         var isSingleLineComment = false;
</span><span class="cx">         var shouldIgnore = false;
</span><ins>+        const isArrowFunction = node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;
</ins><span class="cx"> 
</span><span class="cx">         function isLineTerminator(char)
</span><span class="cx">         {
</span><span class="lines">@@ -157,7 +158,10 @@
</span><span class="cx">             return char === &quot;\n&quot; || char === &quot;\r&quot; || char === &quot;\u2028&quot; || char === &quot;\u2029&quot;;
</span><span class="cx">         }
</span><span class="cx"> 
</span><del>-        while ((sourceString[offset] !== &quot;)&quot; || shouldIgnore) &amp;&amp; offset &lt; sourceString.length) {
</del><ins>+        while (((!isArrowFunction &amp;&amp; sourceString[offset] !== &quot;)&quot;)
+                || (isArrowFunction &amp;&amp; sourceString[offset] !== &quot;&gt;&quot;)
+                || shouldIgnore)
+               &amp;&amp; offset &lt; sourceString.length) {
</ins><span class="cx">             if (isSingleLineComment &amp;&amp; isLineTerminator(sourceString[offset])) {
</span><span class="cx">                 isSingleLineComment = false;
</span><span class="cx">                 shouldIgnore = false;
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceModelsScriptSyntaxTreejs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js (190145 => 190146)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js        2015-09-23 00:33:21 UTC (rev 190145)
+++ trunk/Source/WebInspectorUI/UserInterface/Models/ScriptSyntaxTree.js        2015-09-23 00:39:09 UTC (rev 190146)
</span><span class="lines">@@ -128,7 +128,8 @@
</span><span class="cx">         function removeFunctionsFilter(node)
</span><span class="cx">         {
</span><span class="cx">             return node.type !== WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression
</span><del>-                &amp;&amp; node.type !== WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration;
</del><ins>+                &amp;&amp; node.type !== WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration
+                &amp;&amp; node.type !== WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression;
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         var nodes = this.filter(removeFunctionsFilter, startNode);
</span><span class="lines">@@ -148,10 +149,7 @@
</span><span class="cx"> 
</span><span class="cx">     static functionReturnDivot(node)
</span><span class="cx">     {
</span><del>-        console.assert(
-            node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration 
-            || node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression 
-            || node.type === WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition);
</del><ins>+        console.assert(node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration || node.type === WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression || node.type === WebInspector.ScriptSyntaxTree.NodeType.MethodDefinition || node.type === WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression); 
</ins><span class="cx"> 
</span><span class="cx">         // COMPATIBILITY (iOS 9): Legacy Backends view the return type as being the opening &quot;{&quot; of the function body. 
</span><span class="cx">         // After iOS 9, this is to move to the start of the function statement/expression. See below:
</span><span class="lines">@@ -179,6 +177,7 @@
</span><span class="cx">             switch (node.type) {
</span><span class="cx">             case WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration:
</span><span class="cx">             case WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression:
</span><ins>+            case WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:
</ins><span class="cx">                 for (var param of node.params) {
</span><span class="cx">                     for (var identifier of this._gatherIdentifiersInDeclaration(param)) {
</span><span class="cx">                         allRequests.push({
</span><span class="lines">@@ -190,7 +189,6 @@
</span><span class="cx">                     }
</span><span class="cx">                 }
</span><span class="cx"> 
</span><del>-
</del><span class="cx">                 allRequests.push({
</span><span class="cx">                     typeInformationDescriptor: WebInspector.ScriptSyntaxTree.TypeProfilerSearchDescriptor.FunctionReturn,
</span><span class="cx">                     sourceID,
</span><span class="lines">@@ -368,6 +366,7 @@
</span><span class="cx">             break;
</span><span class="cx">         case WebInspector.ScriptSyntaxTree.NodeType.FunctionDeclaration:
</span><span class="cx">         case WebInspector.ScriptSyntaxTree.NodeType.FunctionExpression:
</span><ins>+        case WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression:
</ins><span class="cx">             callback(node, state);
</span><span class="cx">             this._recurse(node.id, callback, state);
</span><span class="cx">             this._recurseArray(node.params, callback, state);
</span><span class="lines">@@ -527,6 +526,29 @@
</span><span class="cx"> 
</span><span class="cx">         var result = null;
</span><span class="cx">         switch (node.type) {
</span><ins>+        case &quot;ArrayExpression&quot;:
+            result = {
+                type: WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression,
+                elements: node.elements.map(this._createInternalSyntaxTree.bind(this))
+            };
+            break;
+        case &quot;ArrayPattern&quot;:
+            result = {
+                type: WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern,
+                elements: node.elements.map(this._createInternalSyntaxTree.bind(this))
+            };
+            break;
+        case &quot;ArrowFunctionExpression&quot;:
+            result = {
+                type: WebInspector.ScriptSyntaxTree.NodeType.ArrowFunctionExpression,
+                id: this._createInternalSyntaxTree(node.id),
+                params: node.params.map(this._createInternalSyntaxTree.bind(this)),
+                defaults: node.defaults.map(this._createInternalSyntaxTree.bind(this)),
+                body: this._createInternalSyntaxTree(node.body),
+                expression: node.expression, // Boolean indicating if the body a single expression or a block statement.
+                isGetterOrSetter: false
+            };
+            break;
</ins><span class="cx">         case &quot;AssignmentExpression&quot;:
</span><span class="cx">             result = {
</span><span class="cx">                 type: WebInspector.ScriptSyntaxTree.NodeType.AssignmentExpression,
</span><span class="lines">@@ -542,18 +564,6 @@
</span><span class="cx">                 right: this._createInternalSyntaxTree(node.right),
</span><span class="cx">             };
</span><span class="cx">             break;
</span><del>-        case &quot;ArrayExpression&quot;:
-            result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ArrayExpression,
-                elements: node.elements.map(this._createInternalSyntaxTree.bind(this))
-            };
-            break;
-        case &quot;ArrayPattern&quot;:
-            result = {
-                type: WebInspector.ScriptSyntaxTree.NodeType.ArrayPattern,
-                elements: node.elements.map(this._createInternalSyntaxTree.bind(this))
-            };
-            break;
</del><span class="cx">         case &quot;BlockStatement&quot;:
</span><span class="cx">             result = {
</span><span class="cx">                 type: WebInspector.ScriptSyntaxTree.NodeType.BlockStatement,
</span><span class="lines">@@ -942,6 +952,7 @@
</span><span class="cx"> WebInspector.ScriptSyntaxTree.NodeType = {
</span><span class="cx">     ArrayExpression: Symbol(&quot;array-expression&quot;),
</span><span class="cx">     ArrayPattern: Symbol(&quot;array-pattern&quot;),
</span><ins>+    ArrowFunctionExpression: Symbol(&quot;arrow-function-expression&quot;),
</ins><span class="cx">     AssignmentExpression: Symbol(&quot;assignment-expression&quot;),
</span><span class="cx">     AssignmentPattern: Symbol(&quot;assignment-pattern&quot;),
</span><span class="cx">     BinaryExpression: Symbol(&quot;binary-expression&quot;),
</span></span></pre>
</div>
</div>

</body>
</html>