<!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>[195581] 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/195581">195581</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2016-01-25 21:43:11 -0800 (Mon, 25 Jan 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>[ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;arguments&quot;
https://bugs.webkit.org/show_bug.cgi?id=145132

Patch by Skachkov Oleksandr &lt;gskachkov@gmail.com&gt; on 2016-01-25
Reviewed by Saam Barati.
Source/JavaScriptCore:

Added support of ES6 arrow function specific feature, lexical bind of arguments.
http://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definitions-runtime-semantics-evaluation
'arguments' variable in arrow function must resolve to a binding in a lexically enclosing environment.
In srict mode it points to arguments object, and in non-stric mode it points to arguments object or varible
with name 'arguments' if it was declared.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
* parser/Parser.h:
(JSC::Scope::Scope):
(JSC::Scope::setSourceParseMode):
(JSC::Scope::isArrowFunction):
(JSC::Scope::collectFreeVariables):
(JSC::Scope::setIsArrowFunction):
* tests/es6.yaml:
* tests/stress/arrowfunction-lexical-bind-arguments-non-strict-1.js: Added.
* tests/stress/arrowfunction-lexical-bind-arguments-non-strict-2.js: Added.
* tests/stress/arrowfunction-lexical-bind-arguments-strict.js: Added.

Source/WebInspectorUI:

Current patch is implementing lexical bind of arguments, so in this callback we need
to return to ordinary function.

* UserInterface/Base/Object.js:
(WebInspector.Object.singleFireEventListener.let.wrappedCallback):
(WebInspector.Object.singleFireEventListener):

LayoutTests:

* js/arrowfunction-lexical-bind-arguments-non-strict-expected.txt: Added.
* js/arrowfunction-lexical-bind-arguments-non-strict.html: Added.
* js/arrowfunction-lexical-bind-arguments-strict-expected.txt: Added.
* js/arrowfunction-lexical-bind-arguments-strict.html: Added.
* js/script-tests/arrowfunction-lexical-bind-arguments-non-strict.js: Added.
* js/script-tests/arrowfunction-lexical-bind-arguments-strict.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsChangeLog">trunk/LayoutTests/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserh">trunk/Source/JavaScriptCore/parser/Parser.h</a></li>
<li><a href="#trunkSourceJavaScriptCoretestses6yaml">trunk/Source/JavaScriptCore/tests/es6.yaml</a></li>
<li><a href="#trunkSourceWebInspectorUIChangeLog">trunk/Source/WebInspectorUI/ChangeLog</a></li>
<li><a href="#trunkSourceWebInspectorUIUserInterfaceBaseObjectjs">trunk/Source/WebInspectorUI/UserInterface/Base/Object.js</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsarrowfunctionlexicalbindargumentsnonstrictexpectedtxt">trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-non-strict-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionlexicalbindargumentsnonstricthtml">trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-non-strict.html</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionlexicalbindargumentsstrictexpectedtxt">trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-strict-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionlexicalbindargumentsstricthtml">trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-strict.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionlexicalbindargumentsnonstrictjs">trunk/LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-non-strict.js</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionlexicalbindargumentsstrictjs">trunk/LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-strict.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindargumentsnonstrict1js">trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-non-strict-1.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindargumentsnonstrict2js">trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-non-strict-2.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindargumentsstrictjs">trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-strict.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (195580 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2016-01-26 05:41:44 UTC (rev 195580)
+++ trunk/LayoutTests/ChangeLog        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-01-25  Skachkov Oleksandr  &lt;gskachkov@gmail.com&gt;
+
+        [ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;arguments&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=145132
+
+        Reviewed by Saam Barati.
+
+        * js/arrowfunction-lexical-bind-arguments-non-strict-expected.txt: Added.
+        * js/arrowfunction-lexical-bind-arguments-non-strict.html: Added.
+        * js/arrowfunction-lexical-bind-arguments-strict-expected.txt: Added.
+        * js/arrowfunction-lexical-bind-arguments-strict.html: Added.
+        * js/script-tests/arrowfunction-lexical-bind-arguments-non-strict.js: Added.
+        * js/script-tests/arrowfunction-lexical-bind-arguments-strict.js: Added.
+
</ins><span class="cx"> 2016-01-25  Simon Fraser  &lt;simon.fraser@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Give the layout test results file a &lt;title&gt; showing the date and time the tests were run
</span></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionlexicalbindargumentsnonstrictexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-non-strict-expected.txt (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-non-strict-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-non-strict-expected.txt        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,28 @@
</span><ins>+Tests for ES6 arrow function lexical bind of arguments
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS arr.length is 2
+PASS arr[0] is &quot;ABC&quot;
+PASS arr[1] is &quot;DEF&quot;
+PASS typeof arr[2] is &quot;undefined&quot;
+PASS afFactory1('AB', 'CD', 'EF')('G', 'H') is &quot;AB-CD-EF-G-H&quot;
+PASS (new afFactory2('P1', 'Q2', 'R3')).func('A4', 'B5') is &quot;P1_Q2_R3_A4_B5&quot;
+PASS (new afFactory3('PQ', 'RS', 'TU')).func('VW', 'XY')('Z', 'A') is &quot;PQ_RS_TU_VW_XY_Z_A&quot;
+PASS af5.func('VW', 'XY')('Z', '') is &quot;GH_IJ_KL_VW_XY_Z_&quot;
+PASS objInternal.method('H') is &quot;ABC-H&quot;
+PASS (() =&gt; arguments)() is arguments
+PASS func_with_eval(&quot;abc&quot;, &quot;def&quot;)(&quot;xyz&quot;)[0] is &quot;abc&quot;
+PASS func_with_eval(&quot;abc&quot;, &quot;def&quot;)(&quot;xyz&quot;)[1] is &quot;def&quot;
+PASS af_block_scope('A', 'B')('C') is 'branch-1'
+PASS af_function_scope(true, 'D', 'E')('F') is 'af_function_scope'
+PASS af_mixed_scope(true, 'G', 'H')('I') is 'local-scope'
+PASS test() is 40000
+PASS foo(10, 11, 12).next().value()[0] is 10
+PASS foo(10, 11, 12).next().value()[1] is 11
+PASS foo(10, 11, 12).next().value()[2] is 12
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionlexicalbindargumentsnonstricthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-non-strict.html (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-non-strict.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-non-strict.html        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-lexical-bind-arguments-non-strict.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionlexicalbindargumentsstrictexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-strict-expected.txt (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-strict-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-strict-expected.txt        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,25 @@
</span><ins>+Tests for ES6 arrow function lexical bind of arguments
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS arr.length is 2
+PASS arr[0] is &quot;ABC&quot;
+PASS arr[1] is &quot;DEF&quot;
+PASS typeof arr[2] is &quot;undefined&quot;
+PASS afFactory1('AB', 'CD', 'EF')('G', 'H') is &quot;AB-CD-EF-G-H&quot;
+PASS (new afFactory2('P1', 'Q2', 'R3')).func('A4', 'B5') is &quot;P1_Q2_R3_A4_B5&quot;
+PASS (new afFactory3('PQ', 'RS', 'TU')).func('VW', 'XY')('Z', 'A') is &quot;PQ_RS_TU_VW_XY_Z_A&quot;
+PASS af5.func('VW', 'XY')('Z', '') is &quot;GH_IJ_KL_VW_XY_Z_&quot;
+PASS objInternal.method('H') is &quot;ABC-H&quot;
+PASS arr_nesting()()().id is &quot;data&quot;
+PASS func_with_eval(&quot;abc&quot;, &quot;def&quot;)(&quot;xyz&quot;)[0] is &quot;abc&quot;
+PASS func_with_eval(&quot;abc&quot;, &quot;def&quot;)(&quot;xyz&quot;)[1] is &quot;def&quot;
+PASS test() is 40000
+PASS foo(10, 11, 12).next().value()[0] is 10
+PASS foo(10, 11, 12).next().value()[1] is 11
+PASS foo(10, 11, 12).next().value()[2] is 12
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionlexicalbindargumentsstricthtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-strict.html (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-strict.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-lexical-bind-arguments-strict.html        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,10 @@
</span><ins>+&lt;DOCTYPE HTML PUBLIC &quot;-//IETF//DTD HTML//EN&quot;&gt;
+&lt;html&gt;
+&lt;head&gt;
+&lt;script src=&quot;../resources/js-test-pre.js&quot;&gt;&lt;/script&gt;
+&lt;/head&gt;
+&lt;body&gt;
+&lt;script src=&quot;script-tests/arrowfunction-lexical-bind-arguments-strict.js&quot;&gt;&lt;/script&gt;
+&lt;script src=&quot;../resources/js-test-post.js&quot;&gt;&lt;/script&gt;
+&lt;/body&gt;
+&lt;/html&gt;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionlexicalbindargumentsnonstrictjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-non-strict.js (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-non-strict.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-non-strict.js        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,149 @@
</span><ins>+description('Tests for ES6 arrow function lexical bind of arguments');
+
+function afFactory0() {
+    return a =&gt; arguments;
+}
+var af0 = afFactory0('ABC', 'DEF');
+
+var arr = af0(0);
+
+shouldBe('arr.length', '2');
+shouldBe('arr[0]','&quot;ABC&quot;');
+shouldBe('arr[1]','&quot;DEF&quot;');
+shouldBe('typeof arr[2]','&quot;undefined&quot;');
+
+function afFactory1(x, y, z) {
+    return (a, b) =&gt; arguments[0] + '-' + arguments[1] + '-' + arguments[2] + '-' + a + '-' + b;
+}
+
+shouldBe(&quot;afFactory1('AB', 'CD', 'EF')('G', 'H')&quot;, '&quot;AB-CD-EF-G-H&quot;');
+
+var afFactory2 = function () {
+    this.func = (a, b) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b;
+};
+
+shouldBe(&quot;(new afFactory2('P1', 'Q2', 'R3')).func('A4', 'B5')&quot;, '&quot;P1_Q2_R3_A4_B5&quot;');
+
+var afFactory3 = function () {
+    this.func = (a, b) =&gt; (c, d) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b + '_' + c + '_' + d;
+};
+
+shouldBe(&quot;(new afFactory3('PQ', 'RS', 'TU')).func('VW', 'XY')('Z', 'A')&quot;, '&quot;PQ_RS_TU_VW_XY_Z_A&quot;');
+
+var afNested = function () {
+    return function () {
+        this.func = (a, b) =&gt; (c, d) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b + '_' + c + '_' + d;
+    };
+};
+
+var afInternal = new afNested('AB', 'CD', 'EF');
+var af5 = new afInternal('GH', 'IJ', 'KL');
+shouldBe(&quot;af5.func('VW', 'XY')('Z', '')&quot;, '&quot;GH_IJ_KL_VW_XY_Z_&quot;');
+
+var objFactory = function () {
+    return {
+        name : 'nested',
+        method : (index) =&gt; arguments[0] + '-' + index
+    };
+};
+
+var objInternal = objFactory('ABC', 'DEF');
+shouldBe(&quot;objInternal.method('H')&quot;, '&quot;ABC-H&quot;');
+
+shouldBe(&quot;(() =&gt; arguments)()&quot;, &quot;arguments&quot;)
+
+var func_with_eval = function (a, b) { return () =&gt; eval('arguments') }
+
+shouldBe('func_with_eval(&quot;abc&quot;, &quot;def&quot;)(&quot;xyz&quot;)[0]', '&quot;abc&quot;');
+shouldBe('func_with_eval(&quot;abc&quot;, &quot;def&quot;)(&quot;xyz&quot;)[1]', '&quot;def&quot;');
+
+var af_function_scope = function (first, x, y) {
+    let arr;
+    var arguments = 'af_function_scope';
+    if (first) {
+        arr = () =&gt; arguments;
+    } else {
+        arr = () =&gt; arguments;
+    }
+    return arr;
+};
+
+var af_mixed_scope = function (first, x, y) {
+    let arr;
+    var arguments = 'af_mixed_scope';
+    if (first) {
+        let arguments = 'local-scope';
+        arr = () =&gt; arguments;
+    } else {
+        let arguments = 'local-scope-2';
+        arr = () =&gt; arguments;
+    }
+    return arr;
+};
+
+var af_block_scope = function (x, y) {
+    let arr;
+    if (true) {
+        let arguments = 'branch-1';
+        arr = () =&gt; arguments;
+    } else {
+        let arguments = 'branch-2';
+        arr = () =&gt; arguments;
+    }
+    return arr;
+};
+
+shouldBe(&quot;af_block_scope('A', 'B')('C')&quot;, &quot;'branch-1'&quot;);
+shouldBe(&quot;af_function_scope(true, 'D', 'E')('F')&quot;, &quot;'af_function_scope'&quot;);
+shouldBe(&quot;af_mixed_scope(true, 'G', 'H')('I')&quot;, &quot;'local-scope'&quot;);
+
+class A {
+   constructor() {
+      this.list = [];
+   }
+};
+
+class B extends A {
+   addObj(obj) {
+      this.list.push(obj);
+      this.result = 0;
+   }
+   runAll() {
+      for (let i = 0; i &lt; this.list.length; i++) {
+          this.result += this.list[i].operand(1);
+      }
+   }
+};
+
+function test() {
+    let b = new B();
+
+    function runTest () {
+        b.addObj({ operand : (value) =&gt;  value + value });
+        b.addObj({ operand : (value) =&gt;  value + value });
+    }
+
+    for (var i = 0; i &lt; 10000; i++) {
+        runTest();
+    }
+
+    b.runAll();
+
+    return b.result;
+}
+
+test();
+
+shouldBe(&quot;test()&quot;, &quot;40000&quot;);
+
+function* foo(a, b, c) {
+    yield () =&gt; arguments;
+}
+
+foo(10, 11, 12).next().value()[0];
+
+shouldBe(&quot;foo(10, 11, 12).next().value()[0]&quot;, &quot;10&quot;);
+shouldBe(&quot;foo(10, 11, 12).next().value()[1]&quot;, &quot;11&quot;);
+shouldBe(&quot;foo(10, 11, 12).next().value()[2]&quot;, &quot;12&quot;);
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkLayoutTestsjsscripttestsarrowfunctionlexicalbindargumentsstrictjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-strict.js (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-strict.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-lexical-bind-arguments-strict.js        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,116 @@
</span><ins>+&quot;use strict&quot;;
+description('Tests for ES6 arrow function lexical bind of arguments');
+
+function afFactory0() {
+    return a =&gt; arguments;
+}
+var af0 = afFactory0('ABC', 'DEF');
+
+var arr = af0(0);
+
+shouldBe('arr.length', '2');
+shouldBe('arr[0]','&quot;ABC&quot;');
+shouldBe('arr[1]','&quot;DEF&quot;');
+shouldBe('typeof arr[2]','&quot;undefined&quot;');
+
+function afFactory1(x, y, z) {
+    return (a, b) =&gt; arguments[0] + '-' + arguments[1] + '-' + arguments[2] + '-' + a + '-' + b;
+}
+
+shouldBe(&quot;afFactory1('AB', 'CD', 'EF')('G', 'H')&quot;, '&quot;AB-CD-EF-G-H&quot;');
+
+var afFactory2 = function () {
+    this.func = (a, b) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b;
+};
+
+shouldBe(&quot;(new afFactory2('P1', 'Q2', 'R3')).func('A4', 'B5')&quot;, '&quot;P1_Q2_R3_A4_B5&quot;');
+
+var afFactory3 = function () {
+    this.func = (a, b) =&gt; (c, d) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b + '_' + c + '_' + d;
+};
+
+shouldBe(&quot;(new afFactory3('PQ', 'RS', 'TU')).func('VW', 'XY')('Z', 'A')&quot;, '&quot;PQ_RS_TU_VW_XY_Z_A&quot;');
+
+var afNested = function () {
+    return function () {
+        this.func = (a, b) =&gt; (c, d) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b + '_' + c + '_' + d;
+    };
+};
+
+var afInternal = new afNested('AB', 'CD', 'EF');
+var af5 = new afInternal('GH', 'IJ', 'KL');
+shouldBe(&quot;af5.func('VW', 'XY')('Z', '')&quot;, '&quot;GH_IJ_KL_VW_XY_Z_&quot;');
+
+var objFactory = function () {
+    return {
+        name : 'nested',
+        method : (index) =&gt; arguments[0] + '-' + index
+    };
+};
+
+var objInternal = objFactory('ABC', 'DEF');
+shouldBe(&quot;objInternal.method('H')&quot;, '&quot;ABC-H&quot;');
+
+var obj = function (value) {
+  this.id = value;
+};
+
+var arr_nesting = () =&gt; () =&gt; () =&gt; new obj('data');
+
+shouldBe(&quot;arr_nesting()()().id&quot;, '&quot;data&quot;');
+
+var func_with_eval = function (a, b) { return () =&gt; eval('arguments') }
+
+shouldBe('func_with_eval(&quot;abc&quot;, &quot;def&quot;)(&quot;xyz&quot;)[0]', '&quot;abc&quot;');
+shouldBe('func_with_eval(&quot;abc&quot;, &quot;def&quot;)(&quot;xyz&quot;)[1]', '&quot;def&quot;');
+
+class A {
+   constructor() {
+      this.list = [];
+   }
+};
+
+class B extends A {
+   addObj(obj) {
+      this.list.push(obj);
+      this.result = 0;
+   }
+   runAll() {
+      for (let i = 0; i &lt; this.list.length; i++) {
+          this.result += this.list[i].operand(1);
+      }
+   }
+};
+
+function test() {
+    let b = new B();
+
+    function runTest () {
+        b.addObj({ operand : (value) =&gt;  value + value });
+        b.addObj({ operand : (value) =&gt;  value + value });
+    }
+
+    for (var i = 0; i &lt; 10000; i++) {
+        runTest();
+    }
+
+    b.runAll();
+
+    return b.result;
+}
+
+test();
+
+shouldBe(&quot;test()&quot;, &quot;40000&quot;);
+
+function* foo(a, b, c) {
+    yield () =&gt; arguments;
+}
+
+foo(10, 11, 12).next().value()[0];
+
+shouldBe(&quot;foo(10, 11, 12).next().value()[0]&quot;, &quot;10&quot;);
+shouldBe(&quot;foo(10, 11, 12).next().value()[1]&quot;, &quot;11&quot;);
+shouldBe(&quot;foo(10, 11, 12).next().value()[2]&quot;, &quot;12&quot;);
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (195580 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-01-26 05:41:44 UTC (rev 195580)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -1,3 +1,29 @@
</span><ins>+2016-01-25  Skachkov Oleksandr  &lt;gskachkov@gmail.com&gt;
+
+        [ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;arguments&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=145132
+
+        Reviewed by Saam Barati.
+        
+        Added support of ES6 arrow function specific feature, lexical bind of arguments. 
+        http://www.ecma-international.org/ecma-262/6.0/#sec-arrow-function-definitions-runtime-semantics-evaluation
+        'arguments' variable in arrow function must resolve to a binding in a lexically enclosing environment.
+        In srict mode it points to arguments object, and in non-stric mode it points to arguments object or varible 
+        with name 'arguments' if it was declared. 
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        * parser/Parser.h:
+        (JSC::Scope::Scope):
+        (JSC::Scope::setSourceParseMode):
+        (JSC::Scope::isArrowFunction):
+        (JSC::Scope::collectFreeVariables):
+        (JSC::Scope::setIsArrowFunction):
+        * tests/es6.yaml:
+        * tests/stress/arrowfunction-lexical-bind-arguments-non-strict-1.js: Added.
+        * tests/stress/arrowfunction-lexical-bind-arguments-non-strict-2.js: Added.
+        * tests/stress/arrowfunction-lexical-bind-arguments-strict.js: Added.
+
</ins><span class="cx"> 2016-01-25  Benjamin Poulain  &lt;bpoulain@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] We should never use x18 on iOS ARM64
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (195580 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2016-01-26 05:41:44 UTC (rev 195580)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -243,7 +243,7 @@
</span><span class="cx">     bool shouldCaptureSomeOfTheThings = m_shouldEmitDebugHooks || m_codeBlock-&gt;needsFullScopeChain() || containsArrowOrEvalButNotInArrowBlock;
</span><span class="cx"> 
</span><span class="cx">     bool shouldCaptureAllOfTheThings = m_shouldEmitDebugHooks || codeBlock-&gt;usesEval();
</span><del>-    bool needsArguments = functionNode-&gt;usesArguments() || codeBlock-&gt;usesEval();
</del><ins>+    bool needsArguments = (functionNode-&gt;usesArguments() || codeBlock-&gt;usesEval() || (functionNode-&gt;usesArrowFunction() &amp;&amp; !codeBlock-&gt;isArrowFunction()));
</ins><span class="cx"> 
</span><span class="cx">     // Generator never provides &quot;arguments&quot;. &quot;arguments&quot; reference will be resolved in an upper generator function scope.
</span><span class="cx">     if (parseMode == SourceParseMode::GeneratorBodyMode)
</span><span class="lines">@@ -508,10 +508,12 @@
</span><span class="cx">                 break;
</span><span class="cx">             }
</span><span class="cx">         }
</span><del>-        
-        if (!haveParameterNamedArguments) {
</del><ins>+
+        // Do not create arguments variable in case of Arrow function. Value will be loaded from parent scope
+        if (!haveParameterNamedArguments &amp;&amp; !m_codeBlock-&gt;isArrowFunction()) {
</ins><span class="cx">             createVariable(
</span><span class="cx">                 propertyNames().arguments, varKind(propertyNames().arguments.impl()), functionSymbolTable);
</span><ins>+
</ins><span class="cx">             m_needToInitializeArguments = true;
</span><span class="cx">         }
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (195580 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2016-01-26 05:41:44 UTC (rev 195580)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -170,6 +170,7 @@
</span><span class="cx">         , m_strictMode(strictMode)
</span><span class="cx">         , m_isFunction(isFunction)
</span><span class="cx">         , m_isGenerator(isGenerator)
</span><ins>+        , m_isArrowFunction(false)
</ins><span class="cx">         , m_isLexicalScope(false)
</span><span class="cx">         , m_isFunctionBoundary(false)
</span><span class="cx">         , m_isValidStrictMode(true)
</span><span class="lines">@@ -191,6 +192,7 @@
</span><span class="cx">         , m_strictMode(rhs.m_strictMode)
</span><span class="cx">         , m_isFunction(rhs.m_isFunction)
</span><span class="cx">         , m_isGenerator(rhs.m_isGenerator)
</span><ins>+        , m_isArrowFunction(rhs.m_isArrowFunction)
</ins><span class="cx">         , m_isLexicalScope(rhs.m_isLexicalScope)
</span><span class="cx">         , m_isFunctionBoundary(rhs.m_isFunctionBoundary)
</span><span class="cx">         , m_isValidStrictMode(rhs.m_isValidStrictMode)
</span><span class="lines">@@ -257,10 +259,13 @@
</span><span class="cx">         case SourceParseMode::GetterMode:
</span><span class="cx">         case SourceParseMode::SetterMode:
</span><span class="cx">         case SourceParseMode::MethodMode:
</span><del>-        case SourceParseMode::ArrowFunctionMode:
</del><span class="cx">             setIsFunction();
</span><span class="cx">             break;
</span><span class="cx"> 
</span><ins>+        case SourceParseMode::ArrowFunctionMode:
+            setIsArrowFunction();
+            break;
+
</ins><span class="cx">         case SourceParseMode::ProgramMode:
</span><span class="cx">             break;
</span><span class="cx"> 
</span><span class="lines">@@ -446,6 +451,7 @@
</span><span class="cx"> 
</span><span class="cx">     void setNeedsFullActivation() { m_needsFullActivation = true; }
</span><span class="cx">     bool needsFullActivation() const { return m_needsFullActivation; }
</span><ins>+    bool isArrowFunction() { return m_isArrowFunction; }
</ins><span class="cx"> 
</span><span class="cx">     bool hasDirectSuper() { return m_hasDirectSuper; }
</span><span class="cx">     void setHasDirectSuper() { m_hasDirectSuper = true; }
</span><span class="lines">@@ -464,7 +470,7 @@
</span><span class="cx">                     continue;
</span><span class="cx"> 
</span><span class="cx">                 // &quot;arguments&quot; reference should be resolved at function boudary.
</span><del>-                if (nestedScope-&gt;isFunctionBoundary() &amp;&amp; nestedScope-&gt;hasArguments() &amp;&amp; impl == m_vm-&gt;propertyNames-&gt;arguments.impl())
</del><ins>+                if (nestedScope-&gt;isFunctionBoundary() &amp;&amp; nestedScope-&gt;hasArguments() &amp;&amp; impl == m_vm-&gt;propertyNames-&gt;arguments.impl() &amp;&amp; !nestedScope-&gt;isArrowFunction())
</ins><span class="cx">                     continue;
</span><span class="cx"> 
</span><span class="cx">                 m_usedVariables.add(impl);
</span><span class="lines">@@ -580,6 +586,12 @@
</span><span class="cx">         m_isGenerator = true;
</span><span class="cx">         m_hasArguments = false;
</span><span class="cx">     }
</span><ins>+    
+    void setIsArrowFunction()
+    {
+        setIsFunction();
+        m_isArrowFunction = true;
+    }
</ins><span class="cx"> 
</span><span class="cx">     void setIsModule()
</span><span class="cx">     {
</span><span class="lines">@@ -597,6 +609,7 @@
</span><span class="cx">     bool m_strictMode : 1;
</span><span class="cx">     bool m_isFunction : 1;
</span><span class="cx">     bool m_isGenerator : 1;
</span><ins>+    bool m_isArrowFunction : 1;
</ins><span class="cx">     bool m_isLexicalScope : 1;
</span><span class="cx">     bool m_isFunctionBoundary : 1;
</span><span class="cx">     bool m_isValidStrictMode : 1;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestses6yaml"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/es6.yaml (195580 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/es6.yaml        2016-01-26 05:41:44 UTC (rev 195580)
+++ trunk/Source/JavaScriptCore/tests/es6.yaml        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -745,7 +745,7 @@
</span><span class="cx"> - path: es6/Array_static_methods_Array[Symbol.species].js
</span><span class="cx">   cmd: runES6 :normal
</span><span class="cx"> - path: es6/arrow_functions_lexical_arguments_binding.js
</span><del>-  cmd: runES6 :fail
</del><ins>+  cmd: runES6 :normal
</ins><span class="cx"> - path: es6/arrow_functions_lexical_new.target_binding.js
</span><span class="cx">   cmd: runES6 :normal
</span><span class="cx"> - path: es6/arrow_functions_lexical_super_binding.js
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindargumentsnonstrict1js"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-non-strict-1.js (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-non-strict-1.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-non-strict-1.js        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,207 @@
</span><ins>+var testCase = function (actual, expected, message) {
+    if (actual !== expected) {
+        throw message + &quot;. Expected '&quot; + expected + &quot;', but was '&quot; + actual + &quot;'&quot;;
+    }
+};
+
+var txtMsg = 'Error: arguments is not lexically binded inside of the arrow function ';
+
+function afFactory0() {
+    return a =&gt; arguments;
+}
+
+var af0 = afFactory0('ABC', 'DEF');
+
+noInline(af0);
+
+for (var i=0; i&lt;10000; i++) {
+    var arr = af0(i);
+
+    testCase(arr.length, 2, txtMsg + &quot;#1&quot;);
+    testCase(arr[0],'ABC', txtMsg + &quot;#2&quot;);
+    testCase(arr[1],'DEF', txtMsg + &quot;#3&quot;);
+    testCase(typeof arr[2], 'undefined',  txtMsg + &quot;#4&quot;);
+}
+
+
+function afFactory() {
+    return a =&gt; arguments[0];
+}
+
+var af = afFactory(12);
+
+noInline(af);
+
+for (var i=0; i&lt;10000; i++) {
+    testCase(af(6), 12, txtMsg + &quot;#5&quot;);
+}
+
+function afFactory1(x, y, z) {
+    return (a, b) =&gt; arguments[0] + '-' + arguments[1] + '-' + arguments[2] + '-' + a + '-' + b;
+}
+
+var af1 = afFactory1('AB', 'CD', 'EF');
+
+noInline(af1);
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(af1('G', i), 'AB-CD-EF-G-' + i, txtMsg + &quot;#5&quot;);
+}
+
+var af2 = (x, y) =&gt; arguments[0] + '-' + x + y;
+
+noInline(af2);
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(af2('ABC', i), 'undefined-ABC' + i, txtMsg + &quot;#6&quot;);
+}
+
+var af3 = () =&gt; arguments;
+noInline(af3);
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(typeof af3('ABC', i), 'object', txtMsg + &quot;#7&quot;);
+    testCase(typeof af3('ABC', i)[0], 'undefined', txtMsg + &quot;#8&quot;);
+}
+
+var afFactory4 = function () {
+    this.func = (a, b) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b;
+};
+
+var af4 = new afFactory4('P1', 'Q2', 'R3');
+noInline(af4);
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(af4.func('EF', i), 'P1_Q2_R3_EF_' + i, txtMsg + &quot;#9&quot;);
+}
+
+var afFactory5 = function () {
+    this.func = (a, b) =&gt; (c, d) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b + '_' + c + '_' + d;
+};
+
+var af5 = new afFactory5('PQ', 'RS', 'TU');
+noInline(af5);
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(af5.func('VW', 'XY')('Z',i), 'PQ_RS_TU_VW_XY_Z_' + i, txtMsg + &quot;#9&quot;);
+}
+
+var afNested = function () {
+    return function () {
+        this.func = (a, b) =&gt; (c, d) =&gt; arguments[0] + '_' + arguments[1] + '_' + arguments[2] + '_' + a + '_' + b + '_' + c + '_' + d;
+    };
+};
+
+var afInternal = new afNested('AB', 'CD', 'EF');
+var af6 = new afInternal('GH', 'IJ', 'KL');
+noInline(af6);
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(af6.func('VW', 'XY')('Z',i), 'GH_IJ_KL_VW_XY_Z_' + i, txtMsg + &quot;#9&quot;);
+}
+
+var obj = {
+    name : 'id',
+    method : (index) =&gt; arguments[0] + '-' + index
+};
+
+noInline(obj.method);
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(obj.method(i), 'undefined-' + i, txtMsg + &quot;#10&quot;);
+}
+
+var objFactory = function () {
+    return {
+        name : 'nested',
+        method : (index) =&gt; arguments[0] + '-' + index
+    };
+};
+
+var objInternal = objFactory('ABC', 'DEF');
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(objInternal.method(i), 'ABC-' + i, txtMsg + &quot;#11&quot;);
+}
+
+var af_block_scope = function (first, x, y) {
+    let arr;
+    if (first) {
+        let arguments = 'branch-1';
+        arr = () =&gt; arguments;
+    } else {
+        let arguments = 'branch-2';
+        arr = () =&gt; {
+            if (true) {
+                let arguments = 'internal-arrow-block-scope';
+                return arguments;
+            }
+        };
+    }
+    return arr;
+};
+
+var af_function_scope = function (first, x, y) {
+    let arr;
+    var arguments = 'af_function_scope';
+    if (first) {
+        arr = () =&gt; arguments;
+    } else {
+        arr = () =&gt; {
+         var arguments = 'internal-arrow-scope';
+         return arguments;
+        };
+    }
+    return arr;
+};
+
+var af_mixed_scope = function (first, x, y) {
+    let arr;
+    var arguments = 'af_mixed_scope';
+    if (first) {
+        let arguments = 'local-scope';
+        arr = () =&gt; arguments;
+    } else {
+        let arguments = 'local-scope-2';
+        arr = () =&gt; {
+            let arguments = 'internal-arrow-scope';
+            return arguments;
+        };
+    }
+    return arr;
+};
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(af_block_scope(true, 'A', 'B')('C'), 'branch-1', txtMsg + &quot;#12&quot;);
+    testCase(af_block_scope(false, 'A', 'B')('C'), 'internal-arrow-block-scope', txtMsg + &quot;#12&quot;);
+    testCase(af_function_scope(true, 'D', 'E')('F'), 'af_function_scope', txtMsg + &quot;#13&quot;);
+    testCase(af_function_scope(false, 'D', 'E')('F'), 'internal-arrow-scope', txtMsg + &quot;#13&quot;);
+    testCase(af_mixed_scope(true, 'G', 'H')('I'), 'local-scope', txtMsg + &quot;#14&quot;);
+    testCase(af_mixed_scope(false, 'G', 'H')('I'), 'internal-arrow-scope', txtMsg + &quot;#14&quot;);
+}
+
+function foo() {
+    var x = (p) =&gt; eval(p);
+    return x;
+}
+
+var foo_arr = foo('A', 'B');
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(foo_arr('arguments[0]'), 'A', txtMsg + &quot;#15&quot;);
+    testCase(foo_arr('arguments[1]'), 'B', txtMsg + &quot;#16&quot;);
+}
+
+function boo() {
+    return () =&gt; {
+        return () =&gt; {
+            return function () {
+                return () =&gt; arguments;
+            }
+        }
+    }
+}
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(boo('A' + i)('B' + i)('D' + i)('E' + i)('G' + i)[0], 'E' + i, txtMsg + &quot;#17&quot;);
+}
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindargumentsnonstrict2js"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-non-strict-2.js (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-non-strict-2.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-non-strict-2.js        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,100 @@
</span><ins>+var testCase = function (actual, expected, message) {
+    if (actual !== expected) {
+        throw message + &quot;. Expected '&quot; + expected + &quot;', but was '&quot; + actual + &quot;'&quot;;
+    }
+};
+
+var txtMsg = 'Error: arguments is not lexically binded inside of the arrow function ';
+var text_value = 'function_global_scope';
+var arguments = text_value;
+
+var arr = a =&gt; arguments;
+
+noInline(arr);
+
+for (let i=0; i&lt;10000; i++) {
+    let value = arr(i);
+
+    testCase(value, text_value, txtMsg + &quot;#1&quot;);
+}
+
+function afFactory0() {
+    return a =&gt; arguments;
+}
+
+var af0 = afFactory0('ABC', 'DEF');
+
+noInline(af0);
+
+for (var i=0; i&lt;10000; i++) {
+    var arr = af0(i);
+
+    testCase(arr.length, 2, txtMsg + &quot;#2&quot;);
+    testCase(arr[0],'ABC', txtMsg + &quot;#3&quot;);
+    testCase(arr[1],'DEF', txtMsg + &quot;#4&quot;);
+    testCase(typeof arr[2], 'undefined',  txtMsg + &quot;#5&quot;);
+}
+
+var innerUseStrict = function () {
+    'use strict';
+    var createArrow = function (a, b, c) {
+        return (x, y) =&gt; arguments[0] + arguments[1] + arguments[2] + x + y;
+    };
+
+    let af = createArrow('A', 'B', 'C');
+    noInline(af);
+
+    for (var i=0; i&lt;10000; i++) {
+        let arr = af('D', 'E');
+        testCase(arr, 'ABCDE', txtMsg + &quot;#6&quot;);
+    }
+};
+
+innerUseStrict();
+
+var obj = function (value) {
+  this.id = value;
+};
+
+var arr_nesting = () =&gt; () =&gt; () =&gt; new obj('data');
+
+for (var i=0; i&lt;10000; i++) {
+    testCase(arr_nesting()()().id, 'data');
+}
+
+class A {
+   constructor() {
+      this.list = [];
+   }
+};
+
+class B extends A {
+   addObj(obj) {
+      this.list.push(obj);
+      this.result = 0;
+   }
+   runAll() {
+      for (let i = 0; i &lt; this.list.length; i++) {
+          this.result += this.list[i].operand(1);
+      }
+   }
+};
+
+function test() {
+    let b = new B();
+
+    function runTest () {
+        b.addObj({ operand : (value) =&gt;  value + value });
+        b.addObj({ operand : (value) =&gt;  value + value });
+    }
+
+    for (var i = 0; i &lt; 10000; i++) {
+        runTest();
+    }
+
+    b.runAll();
+
+    testCase(b.result, 40000, txtMsg + &quot;#7&quot;);
+}
+
+test();
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindargumentsstrictjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-strict.js (0 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-strict.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-arguments-strict.js        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -0,0 +1,148 @@
</span><ins>+'use strict'
+var testCase = function (actual, expected, message) {
+    if (actual !== expected) {
+        throw message + &quot;. Expected '&quot; + expected + &quot;', but was '&quot; + actual + &quot;'&quot;;
+    }
+};
+
+var txtMsg = 'Error: arguments is not lexically binded inside of the arrow function in strict mode';
+var text_value = 'function_global_scope';
+
+var arr = (error) =&gt;  {
+  if (error)
+      return arguments;
+  else
+      return 'no-error';
+};
+
+noInline(arr);
+
+for (let i=0; i&lt;10000; i++) {
+    let value = arr(true);
+    let isArray = typeof value === 'array';
+    testCase(isArray, false, txtMsg + &quot;#1&quot;);
+}
+
+function afFactory0() {
+    return a =&gt; arguments;
+}
+
+var af0 = afFactory0('ABC', 'DEF');
+
+noInline(af0);
+
+for (var i=0; i&lt;10000; i++) {
+    let args = af0(i);
+
+    testCase(args.length, 2, txtMsg + &quot;#2&quot;);
+    testCase(args[0], 'ABC', txtMsg + &quot;#3&quot;);
+    testCase(args[1], 'DEF', txtMsg + &quot;#4&quot;);
+    testCase(typeof args[2], 'undefined', txtMsg + &quot;#5&quot;);
+}
+
+for (var i=0; i&lt;10000; i++) {
+    let args = af0.call(this, i);
+
+    testCase(args.length, 2, txtMsg + &quot;#2&quot;);
+    testCase(args[0], 'ABC', txtMsg + &quot;#3&quot;);
+    testCase(args[1], 'DEF', txtMsg + &quot;#4&quot;);
+    testCase(typeof args[2], 'undefined', txtMsg + &quot;#5&quot;);
+}
+
+for (var i=0; i&lt;10000; i++) {
+    var args = af0.apply(this, [i]);
+
+    testCase(args.length, 2, txtMsg + &quot;#2&quot;);
+    testCase(args[0], 'ABC', txtMsg + &quot;#3&quot;);
+    testCase(args[1], 'DEF', txtMsg + &quot;#4&quot;);
+    testCase(typeof args[2], 'undefined', txtMsg + &quot;#5&quot;);
+}
+
+var innerUseStrict = function () {
+    var createArrow = function (a, b, c) {
+        return (x, y) =&gt; arguments[0] + arguments[1] + arguments[2] + x + y;
+    };
+
+    let af = createArrow('A', 'B', 'C');
+    noInline(af);
+
+    for (var i=0; i&lt;10000; i++) {
+        let args = af('D', 'E');
+        testCase(args, 'ABCDE', txtMsg + &quot;#6&quot;);
+    }
+};
+
+innerUseStrict();
+
+var obj = function (value) {
+  this.id = value;
+};
+
+var arr_nesting = () =&gt; () =&gt; () =&gt; new obj('data');
+
+for (var i=0; i&lt;10000; i++) {
+    testCase(arr_nesting()()().id, 'data');
+}
+
+function foo() {
+    var x = (p) =&gt; eval(p);
+    return x;
+}
+
+var foo_arr = foo('A', 'B');
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(foo_arr('arguments[0]'), 'A', txtMsg + &quot;#15&quot;);
+    testCase(foo_arr('arguments[1]'), 'B', txtMsg + &quot;#16&quot;);
+}
+
+function boo() {
+    return () =&gt; {
+        return () =&gt; {
+            return function () {
+                return () =&gt; arguments;
+            }
+        }
+    }
+}
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(boo('A' + i)('B' + i)('D' + i)('E' + i)('G' + i)[0], 'E' + i, txtMsg + &quot;#17&quot;);
+}
+
+class A {
+   constructor() {
+      this.list = [];
+   }
+};
+
+class B extends A {
+   addObj(obj) {
+      this.list.push(obj);
+      this.result = 0;
+   }
+   runAll() {
+      for (let i = 0; i &lt; this.list.length; i++) {
+          this.result += this.list[i].operand(1);
+      }
+   }
+};
+
+function test() {
+    let b = new B();
+
+    function runTest () {
+        b.addObj({ operand : (value) =&gt;  value + value });
+        b.addObj({ operand : (value) =&gt;  value + value });
+    }
+
+    for (var i = 0; i &lt; 10000; i++) {
+        runTest();
+    }
+
+    b.runAll();
+
+    testCase(b.result, 40000, txtMsg + &quot;#18&quot;);
+}
+
+test();
</ins></span></pre></div>
<a id="trunkSourceWebInspectorUIChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/ChangeLog (195580 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/ChangeLog        2016-01-26 05:41:44 UTC (rev 195580)
+++ trunk/Source/WebInspectorUI/ChangeLog        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -1,3 +1,17 @@
</span><ins>+2016-01-25  Skachkov Oleksandr  &lt;gskachkov@gmail.com&gt;
+
+        [ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;arguments&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=145132
+
+        Reviewed by Saam Barati.
+
+        Current patch is implementing lexical bind of arguments, so in this callback we need 
+        to return to ordinary function.
+
+        * UserInterface/Base/Object.js:
+        (WebInspector.Object.singleFireEventListener.let.wrappedCallback):
+        (WebInspector.Object.singleFireEventListener):
+
</ins><span class="cx"> 2016-01-25  Saam barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Web Inspector: Have top-level ScriptTimelineDataGridNode events show sample counts
</span></span></pre></div>
<a id="trunkSourceWebInspectorUIUserInterfaceBaseObjectjs"></a>
<div class="modfile"><h4>Modified: trunk/Source/WebInspectorUI/UserInterface/Base/Object.js (195580 => 195581)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/WebInspectorUI/UserInterface/Base/Object.js        2016-01-26 05:41:44 UTC (rev 195580)
+++ trunk/Source/WebInspectorUI/UserInterface/Base/Object.js        2016-01-26 05:43:11 UTC (rev 195581)
</span><span class="lines">@@ -58,10 +58,10 @@
</span><span class="cx"> 
</span><span class="cx">     static singleFireEventListener(eventType, listener, thisObject)
</span><span class="cx">     {
</span><del>-        let wrappedCallback = () =&gt; {
</del><ins>+        let wrappedCallback = function() {
</ins><span class="cx">             this.removeEventListener(eventType, wrappedCallback, null);
</span><span class="cx">             listener.apply(thisObject, arguments);
</span><del>-        };
</del><ins>+        }.bind(this);
</ins><span class="cx"> 
</span><span class="cx">         this.addEventListener(eventType, wrappedCallback, null);
</span><span class="cx">         return wrappedCallback;
</span></span></pre>
</div>
</div>

</body>
</html>