<!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>[194449] 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/194449">194449</a></dd>
<dt>Author</dt> <dd>commit-queue@webkit.org</dd>
<dt>Date</dt> <dd>2015-12-30 13:08:16 -0800 (Wed, 30 Dec 2015)</dd>
</dl>

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

Source/JavaScriptCore:

Patch by Aleksandr Skachkov &lt;gskachkov@gmail.com&gt; on 2015-12-30
Reviewed by Saam Barati.

Implemented lexical bind &quot;super&quot; property for arrow function. 'super' property can be accessed
inside of the arrow function in case if arrow function is nested in constructor, method,
getter or setter of class. In current patch using 'super' in arrow function, that declared out of the
class, lead to wrong type of error, should be SyntaxError(https://bugs.webkit.org/show_bug.cgi?id=150893)
and this will be fixed in separete patch.

* builtins/BuiltinExecutables.cpp:
(JSC::createExecutableInternal):
* bytecode/EvalCodeCache.h:
(JSC::EvalCodeCache::getSlow):
* bytecode/ExecutableInfo.h:
(JSC::ExecutableInfo::ExecutableInfo):
(JSC::ExecutableInfo::derivedContextType):
(JSC::ExecutableInfo::isClassContext):
* bytecode/UnlinkedCodeBlock.cpp:
(JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
* bytecode/UnlinkedCodeBlock.h:
(JSC::UnlinkedCodeBlock::derivedContextType):
(JSC::UnlinkedCodeBlock::isClassContext):
* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::generateUnlinkedFunctionCodeBlock):
(JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
* bytecode/UnlinkedFunctionExecutable.h:
* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope):
* bytecompiler/BytecodeGenerator.h:
(JSC::BytecodeGenerator::derivedContextType):
(JSC::BytecodeGenerator::isDerivedConstructorContext):
(JSC::BytecodeGenerator::isDerivedClassContext):
(JSC::BytecodeGenerator::isArrowFunction):
(JSC::BytecodeGenerator::makeFunction):
* bytecompiler/NodesCodegen.cpp:
(JSC::emitHomeObjectForCallee):
(JSC::FunctionCallValueNode::emitBytecode):
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::evaluate):
* interpreter/Interpreter.cpp:
(JSC::eval):
* runtime/CodeCache.cpp:
(JSC::CodeCache::getFunctionExecutableFromGlobalCode):
* runtime/Executable.cpp:
(JSC::ScriptExecutable::ScriptExecutable):
(JSC::EvalExecutable::create):
(JSC::EvalExecutable::EvalExecutable):
(JSC::ProgramExecutable::ProgramExecutable):
(JSC::ModuleProgramExecutable::ModuleProgramExecutable):
(JSC::FunctionExecutable::FunctionExecutable):
* runtime/Executable.h:
(JSC::ScriptExecutable::derivedContextType):
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
* tests/es6.yaml:
* tests/stress/arrowfunction-lexical-bind-superproperty.js: Added.

LayoutTests:

Patch by Skachkov Oleksandr &lt;gskachkov@gmail.com&gt; on 2015-12-30
Reviewed by Saam Barati.

* js/arrowfunction-superproperty-expected.txt: Added.
* js/arrowfunction-superproperty.html: Added.
* js/script-tests/arrowfunction-superproperty.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="#trunkSourceJavaScriptCorebuiltinsBuiltinExecutablescpp">trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeEvalCodeCacheh">trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeExecutableInfoh">trunk/Source/JavaScriptCore/bytecode/ExecutableInfo.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedFunctionExecutablecpp">trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedFunctionExecutableh">trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerNodesCodegencpp">trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoredebuggerDebuggerCallFramecpp">trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreinterpreterInterpretercpp">trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCodeCachecpp">trunk/Source/JavaScriptCore/runtime/CodeCache.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutablecpp">trunk/Source/JavaScriptCore/runtime/Executable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeExecutableh">trunk/Source/JavaScriptCore/runtime/Executable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectFunctionscpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoretestses6yaml">trunk/Source/JavaScriptCore/tests/es6.yaml</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkLayoutTestsjsarrowfunctionsuperpropertyexpectedtxt">trunk/LayoutTests/js/arrowfunction-superproperty-expected.txt</a></li>
<li><a href="#trunkLayoutTestsjsarrowfunctionsuperpropertyhtml">trunk/LayoutTests/js/arrowfunction-superproperty.html</a></li>
<li><a href="#trunkLayoutTestsjsscripttestsarrowfunctionsuperpropertyjs">trunk/LayoutTests/js/script-tests/arrowfunction-superproperty.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindsuperpropertyjs">trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkLayoutTestsChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/LayoutTests/ChangeLog (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/ChangeLog        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/LayoutTests/ChangeLog        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -1,3 +1,14 @@
</span><ins>+2015-12-30  Skachkov Oleksandr  &lt;gskachkov@gmail.com&gt;
+
+        [ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;super&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=149615
+
+        Reviewed by Saam Barati.
+
+        * js/arrowfunction-superproperty-expected.txt: Added.
+        * js/arrowfunction-superproperty.html: Added.
+        * js/script-tests/arrowfunction-superproperty.js: Added.
+
</ins><span class="cx"> 2015-12-29  Andy VanWagoner  &lt;andy@instructure.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Remove tests for sometimes unsupported calendars, numbering systems, and time zone backward links
</span></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsuperpropertyexpectedtxt"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-superproperty-expected.txt (0 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-superproperty-expected.txt                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-superproperty-expected.txt        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -0,0 +1,16 @@
</span><ins>+Tests for ES6 arrow function, access to the super property in arrow function
+
+On success, you will see a series of &quot;PASS&quot; messages, followed by &quot;TEST COMPLETE&quot;.
+
+
+PASS (new B()).getValueParentFunction() is expectedValue
+PASS (new C(false)).value is expectedValue
+PASS E.getParentStaticValue() is expectedValue
+PASS f.prop is expectedValue + &quot;-&quot; + expectedValue
+PASS f.prop is expectedValue + &quot;-&quot; + &quot;new-value&quot;
+PASS (new F()).getParentValue() is expectedValue
+PASS (new F()).getParentValueWithError()() threw exception TypeError: undefined is not an object (evaluating 'super.getValue').
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
</ins></span></pre></div>
<a id="trunkLayoutTestsjsarrowfunctionsuperpropertyhtml"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/arrowfunction-superproperty.html (0 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/arrowfunction-superproperty.html                                (rev 0)
+++ trunk/LayoutTests/js/arrowfunction-superproperty.html        2015-12-30 21:08:16 UTC (rev 194449)
</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-superproperty.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="trunkLayoutTestsjsscripttestsarrowfunctionsuperpropertyjs"></a>
<div class="addfile"><h4>Added: trunk/LayoutTests/js/script-tests/arrowfunction-superproperty.js (0 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/LayoutTests/js/script-tests/arrowfunction-superproperty.js                                (rev 0)
+++ trunk/LayoutTests/js/script-tests/arrowfunction-superproperty.js        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -0,0 +1,95 @@
</span><ins>+description('Tests for ES6 arrow function, access to the super property in arrow function');
+
+var expectedValue = 'test-value';
+
+class A {
+    getValue () {
+        return expectedValue;
+    }
+};
+
+class B extends A {
+    getValueParentFunction() {
+        var arrow  = () =&gt; super.getValue();
+        return arrow();
+    }
+};
+
+class C extends B {
+    constructor(beforeSuper) {
+        let _value;
+        let arrow = () =&gt; super.getValue();
+        if (beforeSuper) {
+            _value = arrow();
+            super();
+        } else {
+            super();
+            _value = arrow();
+        }
+        this.value = _value;
+    }
+};
+
+class D {
+    constructor() {
+        this.value = expectedValue;
+    }
+    static getStaticValue() {
+        return expectedValue;
+    }
+};
+
+class E extends D {
+    static getParentStaticValue() {
+        var arrow  = () =&gt; super.getStaticValue();
+        return arrow();
+    }
+};
+
+class F extends A {
+    constructor() {
+        super();
+        this.value = expectedValue;
+    }
+    get prop() {
+        var arrow = () =&gt; super.getValue()+ '-' + this.value;
+        return arrow();
+    }
+    set prop(value) {
+        var arrow = (newVal) =&gt; this.value = newVal;
+        arrow(value);
+    }
+    getParentValue() {
+        let arrow = () =&gt; () =&gt; super.getValue();
+        return arrow()();
+    }
+    getParentValueWithError() {
+        var f =  function () {
+            return () =&gt; super.getValue();
+        };
+        return f();
+    }
+ };
+
+shouldBe('(new B()).getValueParentFunction()', 'expectedValue');
+
+shouldBe('(new C(false)).value', 'expectedValue');
+
+// FIXME: Problem with access to the super before super() in constructor
+// https://bugs.webkit.org/show_bug.cgi?id=152108
+//shouldThrow('(new C(true))', 'ReferenceError');
+
+shouldBe('E.getParentStaticValue()', 'expectedValue');
+
+var f = new F();
+
+shouldBe('f.prop', 'expectedValue + &quot;-&quot; + expectedValue');
+
+f.prop = 'new-value';
+shouldBe('f.prop', 'expectedValue + &quot;-&quot; + &quot;new-value&quot;');
+
+shouldBe('(new F()).getParentValue()', 'expectedValue');
+
+shouldThrow('(new F()).getParentValueWithError()()');
+
+var successfullyParsed = true;
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -1,3 +1,65 @@
</span><ins>+2015-12-30  Aleksandr Skachkov  &lt;gskachkov@gmail.com&gt;
+
+        [ES6] Arrow function syntax. Arrow function specific features. Lexical bind &quot;super&quot;
+        https://bugs.webkit.org/show_bug.cgi?id=149615
+
+        Reviewed by Saam Barati.
+
+        Implemented lexical bind &quot;super&quot; property for arrow function. 'super' property can be accessed 
+        inside of the arrow function in case if arrow function is nested in constructor, method, 
+        getter or setter of class. In current patch using 'super' in arrow function, that declared out of the 
+        class, lead to wrong type of error, should be SyntaxError(https://bugs.webkit.org/show_bug.cgi?id=150893) 
+        and this will be fixed in separete patch.
+
+        * builtins/BuiltinExecutables.cpp:
+        (JSC::createExecutableInternal):
+        * bytecode/EvalCodeCache.h:
+        (JSC::EvalCodeCache::getSlow):
+        * bytecode/ExecutableInfo.h:
+        (JSC::ExecutableInfo::ExecutableInfo):
+        (JSC::ExecutableInfo::derivedContextType):
+        (JSC::ExecutableInfo::isClassContext):
+        * bytecode/UnlinkedCodeBlock.cpp:
+        (JSC::UnlinkedCodeBlock::UnlinkedCodeBlock):
+        * bytecode/UnlinkedCodeBlock.h:
+        (JSC::UnlinkedCodeBlock::derivedContextType):
+        (JSC::UnlinkedCodeBlock::isClassContext):
+        * bytecode/UnlinkedFunctionExecutable.cpp:
+        (JSC::generateUnlinkedFunctionCodeBlock):
+        (JSC::UnlinkedFunctionExecutable::UnlinkedFunctionExecutable):
+        * bytecode/UnlinkedFunctionExecutable.h:
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        (JSC::BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope):
+        * bytecompiler/BytecodeGenerator.h:
+        (JSC::BytecodeGenerator::derivedContextType):
+        (JSC::BytecodeGenerator::isDerivedConstructorContext):
+        (JSC::BytecodeGenerator::isDerivedClassContext):
+        (JSC::BytecodeGenerator::isArrowFunction):
+        (JSC::BytecodeGenerator::makeFunction):
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::emitHomeObjectForCallee):
+        (JSC::FunctionCallValueNode::emitBytecode):
+        * debugger/DebuggerCallFrame.cpp:
+        (JSC::DebuggerCallFrame::evaluate):
+        * interpreter/Interpreter.cpp:
+        (JSC::eval):
+        * runtime/CodeCache.cpp:
+        (JSC::CodeCache::getFunctionExecutableFromGlobalCode):
+        * runtime/Executable.cpp:
+        (JSC::ScriptExecutable::ScriptExecutable):
+        (JSC::EvalExecutable::create):
+        (JSC::EvalExecutable::EvalExecutable):
+        (JSC::ProgramExecutable::ProgramExecutable):
+        (JSC::ModuleProgramExecutable::ModuleProgramExecutable):
+        (JSC::FunctionExecutable::FunctionExecutable):
+        * runtime/Executable.h:
+        (JSC::ScriptExecutable::derivedContextType):
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::globalFuncEval):
+        * tests/es6.yaml:
+        * tests/stress/arrowfunction-lexical-bind-superproperty.js: Added.
+
</ins><span class="cx"> 2015-12-29  Yusuke Suzuki  &lt;utatane.tea@gmail.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, relax limitation in operationCreateThis
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebuiltinsBuiltinExecutablescpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/builtins/BuiltinExecutables.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -115,7 +115,7 @@
</span><span class="cx">     }
</span><span class="cx">     metadata-&gt;overrideName(name);
</span><span class="cx">     VariableEnvironment dummyTDZVariables;
</span><del>-    UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&amp;vm, source, metadata, kind, constructAbility, dummyTDZVariables, false, WTF::move(sourceOverride));
</del><ins>+    UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&amp;vm, source, metadata, kind, constructAbility, dummyTDZVariables, DerivedContextType::None, WTF::move(sourceOverride));
</ins><span class="cx">     functionExecutable-&gt;setNameValue(vm, jsString(&amp;vm, name.string()));
</span><span class="cx">     return functionExecutable;
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeEvalCodeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -55,11 +55,11 @@
</span><span class="cx">             return nullptr;
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        EvalExecutable* getSlow(ExecState* exec, JSCell* owner, bool inStrictContext, ThisTDZMode thisTDZMode, bool isDerivedConstructorContext, bool isArrowFunctionContext, const SourceCode&amp; evalSource, JSScope* scope)
</del><ins>+        EvalExecutable* getSlow(ExecState* exec, JSCell* owner, bool inStrictContext, ThisTDZMode thisTDZMode, DerivedContextType derivedContextType, bool isArrowFunctionContext, const SourceCode&amp; evalSource, JSScope* scope)
</ins><span class="cx">         {
</span><span class="cx">             VariableEnvironment variablesUnderTDZ;
</span><span class="cx">             JSScope::collectVariablesUnderTDZ(scope, variablesUnderTDZ);
</span><del>-            EvalExecutable* evalExecutable = EvalExecutable::create(exec, evalSource, inStrictContext, thisTDZMode, isDerivedConstructorContext, isArrowFunctionContext, &amp;variablesUnderTDZ);
</del><ins>+            EvalExecutable* evalExecutable = EvalExecutable::create(exec, evalSource, inStrictContext, thisTDZMode, derivedContextType, isArrowFunctionContext, &amp;variablesUnderTDZ);
</ins><span class="cx"> 
</span><span class="cx">             if (!evalExecutable)
</span><span class="cx">                 return nullptr;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeExecutableInfoh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/ExecutableInfo.h (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/ExecutableInfo.h        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecode/ExecutableInfo.h        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -29,11 +29,13 @@
</span><span class="cx"> #include &quot;ParserModes.h&quot;
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><ins>+    
+enum class DerivedContextType { None, DerivedConstructorContext, DerivedMethodContext };
</ins><span class="cx"> 
</span><span class="cx"> // FIXME: These flags, ParserModes and propagation to XXXCodeBlocks should be reorganized.
</span><span class="cx"> // https://bugs.webkit.org/show_bug.cgi?id=151547
</span><span class="cx"> struct ExecutableInfo {
</span><del>-    ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, ConstructorKind constructorKind, SuperBinding superBinding, SourceParseMode parseMode, bool isDerivedConstructorContext, bool isArrowFunctionContext)
</del><ins>+    ExecutableInfo(bool needsActivation, bool usesEval, bool isStrictMode, bool isConstructor, bool isBuiltinFunction, ConstructorKind constructorKind, SuperBinding superBinding, SourceParseMode parseMode, DerivedContextType derivedContextType, bool isArrowFunctionContext, bool isClassContext)
</ins><span class="cx">         : m_needsActivation(needsActivation)
</span><span class="cx">         , m_usesEval(usesEval)
</span><span class="cx">         , m_isStrictMode(isStrictMode)
</span><span class="lines">@@ -42,8 +44,9 @@
</span><span class="cx">         , m_constructorKind(static_cast&lt;unsigned&gt;(constructorKind))
</span><span class="cx">         , m_superBinding(static_cast&lt;unsigned&gt;(superBinding))
</span><span class="cx">         , m_parseMode(parseMode)
</span><del>-        , m_isDerivedConstructorContext(isDerivedConstructorContext)
</del><ins>+        , m_derivedContextType(static_cast&lt;unsigned&gt;(derivedContextType))
</ins><span class="cx">         , m_isArrowFunctionContext(isArrowFunctionContext)
</span><ins>+        , m_isClassContext(isClassContext)
</ins><span class="cx">     {
</span><span class="cx">         ASSERT(m_constructorKind == static_cast&lt;unsigned&gt;(constructorKind));
</span><span class="cx">         ASSERT(m_superBinding == static_cast&lt;unsigned&gt;(superBinding));
</span><span class="lines">@@ -57,8 +60,9 @@
</span><span class="cx">     ConstructorKind constructorKind() const { return static_cast&lt;ConstructorKind&gt;(m_constructorKind); }
</span><span class="cx">     SuperBinding superBinding() const { return static_cast&lt;SuperBinding&gt;(m_superBinding); }
</span><span class="cx">     SourceParseMode parseMode() const { return m_parseMode; }
</span><del>-    bool isDerivedConstructorContext() const { return m_isDerivedConstructorContext; }
</del><ins>+    DerivedContextType derivedContextType() const { return static_cast&lt;DerivedContextType&gt;(m_derivedContextType); }
</ins><span class="cx">     bool isArrowFunctionContext() const { return m_isArrowFunctionContext; }
</span><ins>+    bool isClassContext() const { return m_isClassContext; }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     unsigned m_needsActivation : 1;
</span><span class="lines">@@ -69,8 +73,9 @@
</span><span class="cx">     unsigned m_constructorKind : 2;
</span><span class="cx">     unsigned m_superBinding : 1;
</span><span class="cx">     SourceParseMode m_parseMode;
</span><del>-    unsigned m_isDerivedConstructorContext : 1;
</del><ins>+    unsigned m_derivedContextType : 2;
</ins><span class="cx">     unsigned m_isArrowFunctionContext : 1;
</span><ins>+    unsigned m_isClassContext : 1;
</ins><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -66,8 +66,9 @@
</span><span class="cx">     , m_isBuiltinFunction(info.isBuiltinFunction())
</span><span class="cx">     , m_constructorKind(static_cast&lt;unsigned&gt;(info.constructorKind()))
</span><span class="cx">     , m_superBinding(static_cast&lt;unsigned&gt;(info.superBinding()))
</span><del>-    , m_isDerivedConstructorContext(info.isDerivedConstructorContext())
</del><ins>+    , m_derivedContextType(static_cast&lt;unsigned&gt;(info.derivedContextType()))
</ins><span class="cx">     , m_isArrowFunctionContext(info.isArrowFunctionContext())
</span><ins>+    , m_isClassContext(info.isClassContext())
</ins><span class="cx">     , m_firstLine(0)
</span><span class="cx">     , m_lineCount(0)
</span><span class="cx">     , m_endColumn(UINT_MAX)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedCodeBlock.h        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -119,8 +119,9 @@
</span><span class="cx">     bool usesEval() const { return m_usesEval; }
</span><span class="cx">     SourceParseMode parseMode() const { return m_parseMode; }
</span><span class="cx">     bool isArrowFunction() const { return m_parseMode == SourceParseMode::ArrowFunctionMode; }
</span><del>-    bool isDerivedConstructorContext() const { return m_isDerivedConstructorContext; }
</del><ins>+    DerivedContextType derivedContextType() const { return static_cast&lt;DerivedContextType&gt;(m_derivedContextType); }
</ins><span class="cx">     bool isArrowFunctionContext() const { return m_isArrowFunctionContext; }
</span><ins>+    bool isClassContext() const { return m_isClassContext; }
</ins><span class="cx"> 
</span><span class="cx">     bool needsFullScopeChain() const { return m_needsFullScopeChain; }
</span><span class="cx"> 
</span><span class="lines">@@ -393,9 +394,9 @@
</span><span class="cx">     unsigned m_isBuiltinFunction : 1;
</span><span class="cx">     unsigned m_constructorKind : 2;
</span><span class="cx">     unsigned m_superBinding : 1;
</span><del>-    unsigned m_isDerivedConstructorContext : 1;
</del><ins>+    unsigned m_derivedContextType : 2;
</ins><span class="cx">     unsigned m_isArrowFunctionContext : 1;
</span><del>-
</del><ins>+    unsigned m_isClassContext : 1;
</ins><span class="cx">     unsigned m_firstLine;
</span><span class="cx">     unsigned m_lineCount;
</span><span class="cx">     unsigned m_endColumn;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedFunctionExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -65,9 +65,11 @@
</span><span class="cx"> 
</span><span class="cx">     function-&gt;finishParsing(executable-&gt;name(), executable-&gt;functionMode());
</span><span class="cx">     executable-&gt;recordParse(function-&gt;features(), function-&gt;hasCapturedVariables());
</span><del>-    
</del><ins>+
+    bool isClassContext = executable-&gt;superBinding() == SuperBinding::Needed;
+
</ins><span class="cx">     UnlinkedFunctionCodeBlock* result = UnlinkedFunctionCodeBlock::create(&amp;vm, FunctionCode,
</span><del>-        ExecutableInfo(function-&gt;needsActivation(), function-&gt;usesEval(), function-&gt;isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction, executable-&gt;constructorKind(), executable-&gt;superBinding(), parseMode,  executable-&gt;isDerivedConstructorContext(), false));
</del><ins>+        ExecutableInfo(function-&gt;needsActivation(), function-&gt;usesEval(), function-&gt;isStrictMode(), kind == CodeForConstruct, functionKind == UnlinkedBuiltinFunction, executable-&gt;constructorKind(), executable-&gt;superBinding(), parseMode, executable-&gt;derivedContextType(), false, isClassContext));
</ins><span class="cx"> 
</span><span class="cx">     auto generator(std::make_unique&lt;BytecodeGenerator&gt;(vm, function.get(), result, debuggerMode, profilerMode, executable-&gt;parentScopeTDZVariables()));
</span><span class="cx">     error = generator-&gt;generate();
</span><span class="lines">@@ -76,7 +78,7 @@
</span><span class="cx">     return result;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode&amp; source, RefPtr&lt;SourceProvider&gt;&amp;&amp; sourceOverride, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, VariableEnvironment&amp; parentScopeTDZVariables, bool isDerivedConstructorContext)
</del><ins>+UnlinkedFunctionExecutable::UnlinkedFunctionExecutable(VM* vm, Structure* structure, const SourceCode&amp; source, RefPtr&lt;SourceProvider&gt;&amp;&amp; sourceOverride, FunctionMetadataNode* node, UnlinkedFunctionKind kind, ConstructAbility constructAbility, VariableEnvironment&amp; parentScopeTDZVariables, DerivedContextType derivedContextType)
</ins><span class="cx">     : Base(*vm, structure)
</span><span class="cx">     , m_name(node-&gt;ident())
</span><span class="cx">     , m_inferredName(node-&gt;inferredName())
</span><span class="lines">@@ -101,7 +103,7 @@
</span><span class="cx">     , m_constructorKind(static_cast&lt;unsigned&gt;(node-&gt;constructorKind()))
</span><span class="cx">     , m_functionMode(node-&gt;functionMode())
</span><span class="cx">     , m_superBinding(static_cast&lt;unsigned&gt;(node-&gt;superBinding()))
</span><del>-    , m_isDerivedConstructorContext(isDerivedConstructorContext)
</del><ins>+    , m_derivedContextType(static_cast&lt;unsigned&gt;(derivedContextType))
</ins><span class="cx"> {
</span><span class="cx">     ASSERT(m_constructorKind == static_cast&lt;unsigned&gt;(node-&gt;constructorKind()));
</span><span class="cx">     m_parentScopeTDZVariables.swap(parentScopeTDZVariables);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedFunctionExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.h        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -30,6 +30,7 @@
</span><span class="cx"> #include &quot;CodeSpecializationKind.h&quot;
</span><span class="cx"> #include &quot;CodeType.h&quot;
</span><span class="cx"> #include &quot;ConstructAbility.h&quot;
</span><ins>+#include &quot;ExecutableInfo.h&quot;
</ins><span class="cx"> #include &quot;ExpressionRangeInfo.h&quot;
</span><span class="cx"> #include &quot;HandlerInfo.h&quot;
</span><span class="cx"> #include &quot;Identifier.h&quot;
</span><span class="lines">@@ -65,10 +66,10 @@
</span><span class="cx">     typedef JSCell Base;
</span><span class="cx">     static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
</span><span class="cx"> 
</span><del>-    static UnlinkedFunctionExecutable* create(VM* vm, const SourceCode&amp; source, FunctionMetadataNode* node, UnlinkedFunctionKind unlinkedFunctionKind, ConstructAbility constructAbility, VariableEnvironment&amp; parentScopeTDZVariables, bool isDerivedConstructorContext, RefPtr&lt;SourceProvider&gt;&amp;&amp; sourceOverride = nullptr)
</del><ins>+    static UnlinkedFunctionExecutable* create(VM* vm, const SourceCode&amp; source, FunctionMetadataNode* node, UnlinkedFunctionKind unlinkedFunctionKind, ConstructAbility constructAbility, VariableEnvironment&amp; parentScopeTDZVariables, DerivedContextType derivedContextType, RefPtr&lt;SourceProvider&gt;&amp;&amp; sourceOverride = nullptr)
</ins><span class="cx">     {
</span><span class="cx">         UnlinkedFunctionExecutable* instance = new (NotNull, allocateCell&lt;UnlinkedFunctionExecutable&gt;(vm-&gt;heap))
</span><del>-            UnlinkedFunctionExecutable(vm, vm-&gt;unlinkedFunctionExecutableStructure.get(), source, WTF::move(sourceOverride), node, unlinkedFunctionKind, constructAbility, parentScopeTDZVariables, isDerivedConstructorContext);
</del><ins>+            UnlinkedFunctionExecutable(vm, vm-&gt;unlinkedFunctionExecutableStructure.get(), source, WTF::move(sourceOverride), node, unlinkedFunctionKind, constructAbility, parentScopeTDZVariables, derivedContextType);
</ins><span class="cx">         instance-&gt;finishCreation(*vm);
</span><span class="cx">         return instance;
</span><span class="cx">     }
</span><span class="lines">@@ -128,11 +129,12 @@
</span><span class="cx">     const VariableEnvironment* parentScopeTDZVariables() const { return &amp;m_parentScopeTDZVariables; }
</span><span class="cx">     
</span><span class="cx">     bool isArrowFunction() const { return m_parseMode == SourceParseMode::ArrowFunctionMode; }
</span><del>-    bool isDerivedConstructorContext() const {return m_isDerivedConstructorContext; }
</del><span class="cx"> 
</span><ins>+    JSC::DerivedContextType derivedContextType() const {return static_cast&lt;JSC::DerivedContextType&gt;(m_derivedContextType); }
+    
</ins><span class="cx"> private:
</span><del>-    UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&amp;, RefPtr&lt;SourceProvider&gt;&amp;&amp; sourceOverride, FunctionMetadataNode*, UnlinkedFunctionKind, ConstructAbility, VariableEnvironment&amp;, bool isDerivedConstructorContext);
-    
</del><ins>+    UnlinkedFunctionExecutable(VM*, Structure*, const SourceCode&amp;, RefPtr&lt;SourceProvider&gt;&amp;&amp; sourceOverride, FunctionMetadataNode*, UnlinkedFunctionKind, ConstructAbility, VariableEnvironment&amp;,  JSC::DerivedContextType);
+
</ins><span class="cx">     WriteBarrier&lt;UnlinkedFunctionCodeBlock&gt; m_unlinkedCodeBlockForCall;
</span><span class="cx">     WriteBarrier&lt;UnlinkedFunctionCodeBlock&gt; m_unlinkedCodeBlockForConstruct;
</span><span class="cx"> 
</span><span class="lines">@@ -163,7 +165,7 @@
</span><span class="cx">     unsigned m_constructorKind : 2;
</span><span class="cx">     unsigned m_functionMode : 1; // FunctionMode
</span><span class="cx">     unsigned m_superBinding : 1;
</span><del>-    unsigned m_isDerivedConstructorContext : 1;
</del><ins>+    unsigned m_derivedContextType: 2;
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx">     void finishCreation(VM&amp; vm)
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -157,7 +157,6 @@
</span><span class="cx">     , m_thisRegister(CallFrame::thisArgumentOffset())
</span><span class="cx">     , m_codeType(GlobalCode)
</span><span class="cx">     , m_vm(&amp;vm)
</span><del>-    , m_isDerivedConstructorContext(false)
</del><span class="cx">     , m_needsToUpdateArrowFunctionContext(programNode-&gt;usesArrowFunction() || programNode-&gt;usesEval())
</span><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(parentScopeTDZVariables, !parentScopeTDZVariables-&gt;size());
</span><span class="lines">@@ -211,8 +210,8 @@
</span><span class="cx">     // compatible with tail calls (we have no way of emitting op_did_call).
</span><span class="cx">     // https://bugs.webkit.org/show_bug.cgi?id=148819
</span><span class="cx">     , m_inTailPosition(Options::useTailCalls() &amp;&amp; !isConstructor() &amp;&amp; constructorKind() == ConstructorKind::None &amp;&amp; isStrictMode() &amp;&amp; !m_shouldEmitProfileHooks)
</span><del>-    , m_isDerivedConstructorContext(codeBlock-&gt;isDerivedConstructorContext())
</del><span class="cx">     , m_needsToUpdateArrowFunctionContext(functionNode-&gt;usesArrowFunction() || functionNode-&gt;usesEval())
</span><ins>+    , m_derivedContextType(codeBlock-&gt;derivedContextType())
</ins><span class="cx"> {
</span><span class="cx">     for (auto&amp; constantRegister : m_linkTimeConstantRegisters)
</span><span class="cx">         constantRegister = nullptr;
</span><span class="lines">@@ -571,9 +570,9 @@
</span><span class="cx">     // Loading |this| inside an arrow function must be done after initializeDefaultParameterValuesAndSetupFunctionScopeStack()
</span><span class="cx">     // because that function sets up the SymbolTable stack and emitLoadThisFromArrowFunctionLexicalEnvironment()
</span><span class="cx">     // consults the SymbolTable stack
</span><del>-    if (parseMode == SourceParseMode::ArrowFunctionMode &amp;&amp; functionNode-&gt;usesThis())
</del><ins>+    if (SourceParseMode::ArrowFunctionMode == parseMode &amp;&amp; (functionNode-&gt;usesThis() || isDerivedClassContext() || isDerivedConstructorContext()))
</ins><span class="cx">         emitLoadThisFromArrowFunctionLexicalEnvironment();
</span><del>-
</del><ins>+    
</ins><span class="cx">     if (needsToUpdateArrowFunctionContext() &amp;&amp; !codeBlock-&gt;isArrowFunction()) {
</span><span class="cx">         initializeArrowFunctionContextScopeIfNeeded(functionSymbolTable);
</span><span class="cx">         emitPutThisToArrowFunctionContextScope();
</span><span class="lines">@@ -593,8 +592,8 @@
</span><span class="cx">     , m_codeType(EvalCode)
</span><span class="cx">     , m_vm(&amp;vm)
</span><span class="cx">     , m_usesNonStrictEval(codeBlock-&gt;usesEval() &amp;&amp; !codeBlock-&gt;isStrictMode())
</span><del>-    , m_isDerivedConstructorContext(codeBlock-&gt;isDerivedConstructorContext())
</del><span class="cx">     , m_needsToUpdateArrowFunctionContext(evalNode-&gt;usesArrowFunction() || evalNode-&gt;usesEval())
</span><ins>+    , m_derivedContextType(codeBlock-&gt;derivedContextType())
</ins><span class="cx"> {
</span><span class="cx">     for (auto&amp; constantRegister : m_linkTimeConstantRegisters)
</span><span class="cx">         constantRegister = nullptr;
</span><span class="lines">@@ -644,7 +643,6 @@
</span><span class="cx">     , m_codeType(ModuleCode)
</span><span class="cx">     , m_vm(&amp;vm)
</span><span class="cx">     , m_usesNonStrictEval(false)
</span><del>-    , m_isDerivedConstructorContext(false)
</del><span class="cx">     , m_needsToUpdateArrowFunctionContext(moduleProgramNode-&gt;usesArrowFunction() || moduleProgramNode-&gt;usesEval())
</span><span class="cx"> {
</span><span class="cx">     ASSERT_UNUSED(parentScopeTDZVariables, !parentScopeTDZVariables-&gt;size());
</span><span class="lines">@@ -4047,14 +4045,14 @@
</span><span class="cx">     
</span><span class="cx"> void BytecodeGenerator::emitPutDerivedConstructorToArrowFunctionContextScope()
</span><span class="cx"> {
</span><del>-    if (isConstructor() &amp;&amp; constructorKind() == ConstructorKind::Derived) {
</del><ins>+    if ((isConstructor() &amp;&amp; constructorKind() == ConstructorKind::Derived) || m_codeBlock-&gt;isClassContext()) {
</ins><span class="cx">         ASSERT(m_arrowFunctionContextLexicalEnvironmentRegister);
</span><span class="cx">             
</span><span class="cx">         Variable protoScope = variable(propertyNames().derivedConstructorPrivateName);
</span><span class="cx">         emitPutToScope(m_arrowFunctionContextLexicalEnvironmentRegister, protoScope, &amp;m_calleeRegister, DoNotThrowIfNotFound, Initialization);
</span><span class="cx">     }
</span><span class="cx"> }
</span><del>-    
</del><ins>+
</ins><span class="cx"> void BytecodeGenerator::emitPutThisToArrowFunctionContextScope()
</span><span class="cx"> {
</span><span class="cx">     ASSERT(isDerivedConstructorContext() || m_arrowFunctionContextLexicalEnvironmentRegister != nullptr);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -281,7 +281,7 @@
</span><span class="cx">         const CommonIdentifiers&amp; propertyNames() const { return *m_vm-&gt;propertyNames; }
</span><span class="cx"> 
</span><span class="cx">         bool isConstructor() const { return m_codeBlock-&gt;isConstructor(); }
</span><del>-        bool isDerivedConstructorContext() const { return m_codeBlock-&gt;isDerivedConstructorContext(); }
</del><ins>+        DerivedContextType derivedContextType() const { return m_derivedContextType; }
</ins><span class="cx">         bool usesArrowFunction() const { return m_scopeNode-&gt;usesArrowFunction(); }
</span><span class="cx">         bool needsToUpdateArrowFunctionContext() const { return m_needsToUpdateArrowFunctionContext; }
</span><span class="cx">         bool usesEval() const { return m_scopeNode-&gt;usesEval(); }
</span><span class="lines">@@ -697,6 +697,10 @@
</span><span class="cx">         bool isBuiltinFunction() const { return m_isBuiltinFunction; }
</span><span class="cx"> 
</span><span class="cx">         OpcodeID lastOpcodeID() const { return m_lastOpcodeID; }
</span><ins>+        
+        bool isDerivedConstructorContext() { return m_derivedContextType == DerivedContextType::DerivedConstructorContext; }
+        bool isDerivedClassContext() { return m_derivedContextType == DerivedContextType::DerivedMethodContext; }
+        bool isArrowFunction() { return m_codeBlock-&gt;isArrowFunction(); }
</ins><span class="cx"> 
</span><span class="cx">         enum class TDZCheckOptimization { Optimize, DoNotOptimize };
</span><span class="cx">         enum class NestedScopeType { IsNested, IsNotNested };
</span><span class="lines">@@ -794,8 +798,15 @@
</span><span class="cx">         
</span><span class="cx">         UnlinkedFunctionExecutable* makeFunction(FunctionMetadataNode* metadata)
</span><span class="cx">         {
</span><del>-            bool newisDerivedConstructorContext = constructorKind() == ConstructorKind::Derived || (m_isDerivedConstructorContext &amp;&amp; metadata-&gt;parseMode() == SourceParseMode::ArrowFunctionMode);
</del><ins>+            DerivedContextType newDerivedContextType = DerivedContextType::None;
</ins><span class="cx"> 
</span><ins>+            if (metadata-&gt;parseMode() == SourceParseMode::ArrowFunctionMode) {
+                if (constructorKind() == ConstructorKind::Derived || isDerivedConstructorContext())
+                    newDerivedContextType = DerivedContextType::DerivedConstructorContext;
+                else if (m_codeBlock-&gt;isClassContext() || isDerivedClassContext())
+                    newDerivedContextType = DerivedContextType::DerivedMethodContext;
+            }
+
</ins><span class="cx">             VariableEnvironment variablesUnderTDZ;
</span><span class="cx">             getVariablesUnderTDZ(variablesUnderTDZ);
</span><span class="cx"> 
</span><span class="lines">@@ -808,7 +819,7 @@
</span><span class="cx">             else if (parseMode == SourceParseMode::MethodMode &amp;&amp; metadata-&gt;constructorKind() == ConstructorKind::None)
</span><span class="cx">                 constructAbility = ConstructAbility::CannotConstruct;
</span><span class="cx"> 
</span><del>-            return UnlinkedFunctionExecutable::create(m_vm, m_scopeNode-&gt;source(), metadata, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, constructAbility, variablesUnderTDZ, newisDerivedConstructorContext);
</del><ins>+            return UnlinkedFunctionExecutable::create(m_vm, m_scopeNode-&gt;source(), metadata, isBuiltinFunction() ? UnlinkedBuiltinFunction : UnlinkedNormalFunction, constructAbility, variablesUnderTDZ, newDerivedContextType);
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         void getVariablesUnderTDZ(VariableEnvironment&amp;);
</span><span class="lines">@@ -918,9 +929,9 @@
</span><span class="cx">         bool m_isBuiltinFunction { false };
</span><span class="cx">         bool m_usesNonStrictEval { false };
</span><span class="cx">         bool m_inTailPosition { false };
</span><del>-        bool m_isDerivedConstructorContext { false };
</del><span class="cx">         bool m_needsToUpdateArrowFunctionContext;
</span><span class="cx">         bool m_isNewTargetLoadedInArrowFunction { false };
</span><ins>+        DerivedContextType m_derivedContextType { DerivedContextType::None };
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx"> }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerNodesCodegencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -173,12 +173,16 @@
</span><span class="cx"> 
</span><span class="cx">     RegisterID callee;
</span><span class="cx">     callee.setIndex(JSStack::Callee);
</span><del>-
</del><span class="cx">     return generator.emitGetById(generator.finalDestination(dst), &amp;callee, generator.propertyNames().underscoreProto);
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> static RegisterID* emitHomeObjectForCallee(BytecodeGenerator&amp; generator)
</span><span class="cx"> {
</span><ins>+    if (generator.isDerivedClassContext() || generator.isDerivedConstructorContext()) {
+        RegisterID* derivedConstructor = generator.emitLoadDerivedConstructorFromArrowFunctionLexicalEnvironment();
+        return generator.emitGetById(generator.newTemporary(), derivedConstructor, generator.propertyNames().homeObjectPrivateName);
+    }
+
</ins><span class="cx">     RegisterID callee;
</span><span class="cx">     callee.setIndex(JSStack::Callee);
</span><span class="cx">     return generator.emitGetById(generator.newTemporary(), &amp;callee, generator.propertyNames().homeObjectPrivateName);
</span><span class="lines">@@ -749,8 +753,8 @@
</span><span class="cx">     RefPtr&lt;RegisterID&gt; returnValue = generator.finalDestination(dst, func.get());
</span><span class="cx">     CallArguments callArguments(generator, m_args);
</span><span class="cx">     if (m_expr-&gt;isSuperNode()) {
</span><del>-        ASSERT(generator.isConstructor() || generator.isDerivedConstructorContext());
-        ASSERT(generator.constructorKind() == ConstructorKind::Derived || generator.isDerivedConstructorContext());
</del><ins>+        ASSERT(generator.isConstructor() || generator.derivedContextType() == DerivedContextType::DerivedConstructorContext);
+        ASSERT(generator.constructorKind() == ConstructorKind::Derived || generator.derivedContextType() == DerivedContextType::DerivedConstructorContext);
</ins><span class="cx">         generator.emitMove(callArguments.thisRegister(), generator.newTarget());
</span><span class="cx">         RegisterID* ret = generator.emitConstruct(returnValue.get(), func.get(), NoExpectedFunction, callArguments, divot(), divotStart(), divotEnd());
</span><span class="cx">         generator.emitMove(generator.thisRegister(), ret);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggerCallFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -192,7 +192,7 @@
</span><span class="cx">     VariableEnvironment variablesUnderTDZ;
</span><span class="cx">     JSScope::collectVariablesUnderTDZ(scope()-&gt;jsScope(), variablesUnderTDZ);
</span><span class="cx"> 
</span><del>-    EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock.isStrictMode(), thisTDZMode, codeBlock.unlinkedCodeBlock()-&gt;isDerivedConstructorContext(), codeBlock.unlinkedCodeBlock()-&gt;isArrowFunction(), &amp;variablesUnderTDZ);
</del><ins>+    EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock.isStrictMode(), thisTDZMode, codeBlock.unlinkedCodeBlock()-&gt;derivedContextType(), codeBlock.unlinkedCodeBlock()-&gt;isArrowFunction(), &amp;variablesUnderTDZ);
</ins><span class="cx">     if (vm.exception()) {
</span><span class="cx">         exception = vm.exception();
</span><span class="cx">         vm.clearException();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterInterpretercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -183,7 +183,7 @@
</span><span class="cx">         // If the literal parser bailed, it should not have thrown exceptions.
</span><span class="cx">         ASSERT(!callFrame-&gt;vm().exception());
</span><span class="cx"> 
</span><del>-        eval = callerCodeBlock-&gt;evalCodeCache().getSlow(callFrame, callerCodeBlock, callerCodeBlock-&gt;isStrictMode(), thisTDZMode, callerCodeBlock-&gt;unlinkedCodeBlock()-&gt;isDerivedConstructorContext(), callerCodeBlock-&gt;unlinkedCodeBlock()-&gt;isArrowFunction(), sourceCode, callerScopeChain);
</del><ins>+        eval = callerCodeBlock-&gt;evalCodeCache().getSlow(callFrame, callerCodeBlock, callerCodeBlock-&gt;isStrictMode(), thisTDZMode, callerCodeBlock-&gt;unlinkedCodeBlock()-&gt;derivedContextType(), callerCodeBlock-&gt;unlinkedCodeBlock()-&gt;isArrowFunction(), sourceCode, callerScopeChain);
</ins><span class="cx"> 
</span><span class="cx">         if (!eval)
</span><span class="cx">             return jsUndefined();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -188,7 +188,8 @@
</span><span class="cx">     metadata-&gt;setEndPosition(positionBeforeLastNewline);
</span><span class="cx">     // The Function constructor only has access to global variables, so no variables will be under TDZ.
</span><span class="cx">     VariableEnvironment emptyTDZVariables;
</span><del>-    UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&amp;vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, emptyTDZVariables, false);
</del><ins>+    UnlinkedFunctionExecutable* functionExecutable = UnlinkedFunctionExecutable::create(&amp;vm, source, metadata, UnlinkedNormalFunction, ConstructAbility::CanConstruct, emptyTDZVariables, DerivedContextType::None);
+
</ins><span class="cx">     functionExecutable-&gt;m_nameValue.set(vm, functionExecutable, jsString(&amp;vm, name.string()));
</span><span class="cx"> 
</span><span class="cx">     m_sourceCode.addCache(key, SourceCodeValue(vm, functionExecutable, m_sourceCode.age()));
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -131,14 +131,14 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo ScriptExecutable::s_info = { &quot;ScriptExecutable&quot;, &amp;ExecutableBase::s_info, 0, CREATE_METHOD_TABLE(ScriptExecutable) };
</span><span class="cx"> 
</span><del>-ScriptExecutable::ScriptExecutable(Structure* structure, VM&amp; vm, const SourceCode&amp; source, bool isInStrictContext, bool isInDerivedConstructorContext, bool isInArrowFunctionContext)
</del><ins>+ScriptExecutable::ScriptExecutable(Structure* structure, VM&amp; vm, const SourceCode&amp; source, bool isInStrictContext, DerivedContextType derivedContextType, bool isInArrowFunctionContext)
</ins><span class="cx">     : ExecutableBase(vm, structure, NUM_PARAMETERS_NOT_COMPILED)
</span><span class="cx">     , m_source(source)
</span><span class="cx">     , m_features(isInStrictContext ? StrictModeFeature : 0)
</span><span class="cx">     , m_hasCapturedVariables(false)
</span><span class="cx">     , m_neverInline(false)
</span><span class="cx">     , m_didTryToEnterInLoop(false)
</span><del>-    , m_isDerivedConstructorContext(isInDerivedConstructorContext)
</del><ins>+    , m_derivedContextType(derivedContextType)
</ins><span class="cx">     , m_isArrowFunctionContext(isInArrowFunctionContext)
</span><span class="cx">     , m_overrideLineNumber(-1)
</span><span class="cx">     , m_firstLine(-1)
</span><span class="lines">@@ -414,7 +414,7 @@
</span><span class="cx"> 
</span><span class="cx"> const ClassInfo EvalExecutable::s_info = { &quot;EvalExecutable&quot;, &amp;ScriptExecutable::s_info, 0, CREATE_METHOD_TABLE(EvalExecutable) };
</span><span class="cx"> 
</span><del>-EvalExecutable* EvalExecutable::create(ExecState* exec, const SourceCode&amp; source, bool isInStrictContext, ThisTDZMode thisTDZMode, bool isDerivedConstructorContext, bool isArrowFunctionContext, const VariableEnvironment* variablesUnderTDZ)
</del><ins>+EvalExecutable* EvalExecutable::create(ExecState* exec, const SourceCode&amp; source, bool isInStrictContext, ThisTDZMode thisTDZMode, DerivedContextType derivedContextType, bool isArrowFunctionContext, const VariableEnvironment* variablesUnderTDZ)
</ins><span class="cx"> {
</span><span class="cx">     JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
</span><span class="cx">     if (!globalObject-&gt;evalEnabled()) {
</span><span class="lines">@@ -422,7 +422,7 @@
</span><span class="cx">         return 0;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    EvalExecutable* executable = new (NotNull, allocateCell&lt;EvalExecutable&gt;(*exec-&gt;heap())) EvalExecutable(exec, source, isInStrictContext, isDerivedConstructorContext, isArrowFunctionContext);
</del><ins>+    EvalExecutable* executable = new (NotNull, allocateCell&lt;EvalExecutable&gt;(*exec-&gt;heap())) EvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext);
</ins><span class="cx">     executable-&gt;finishCreation(exec-&gt;vm());
</span><span class="cx"> 
</span><span class="cx">     UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject-&gt;createEvalCodeBlock(exec, executable, thisTDZMode, isArrowFunctionContext, variablesUnderTDZ);
</span><span class="lines">@@ -434,8 +434,8 @@
</span><span class="cx">     return executable;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode&amp; source, bool inStrictContext, bool isDerivedConstructorContext, bool isArrowFunctionContext)
-    : ScriptExecutable(exec-&gt;vm().evalExecutableStructure.get(), exec-&gt;vm(), source, inStrictContext, isDerivedConstructorContext, isArrowFunctionContext)
</del><ins>+EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode&amp; source, bool inStrictContext, DerivedContextType derivedContextType, bool isArrowFunctionContext)
+    : ScriptExecutable(exec-&gt;vm().evalExecutableStructure.get(), exec-&gt;vm(), source, inStrictContext, derivedContextType, isArrowFunctionContext)
</ins><span class="cx"> {
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -447,7 +447,7 @@
</span><span class="cx"> const ClassInfo ProgramExecutable::s_info = { &quot;ProgramExecutable&quot;, &amp;ScriptExecutable::s_info, 0, CREATE_METHOD_TABLE(ProgramExecutable) };
</span><span class="cx"> 
</span><span class="cx"> ProgramExecutable::ProgramExecutable(ExecState* exec, const SourceCode&amp; source)
</span><del>-    : ScriptExecutable(exec-&gt;vm().programExecutableStructure.get(), exec-&gt;vm(), source, false, false, false)
</del><ins>+    : ScriptExecutable(exec-&gt;vm().programExecutableStructure.get(), exec-&gt;vm(), source, false, DerivedContextType::None, false)
</ins><span class="cx"> {
</span><span class="cx">     m_typeProfilingStartOffset = 0;
</span><span class="cx">     m_typeProfilingEndOffset = source.length() - 1;
</span><span class="lines">@@ -463,7 +463,7 @@
</span><span class="cx"> const ClassInfo ModuleProgramExecutable::s_info = { &quot;ModuleProgramExecutable&quot;, &amp;ScriptExecutable::s_info, 0, CREATE_METHOD_TABLE(ModuleProgramExecutable) };
</span><span class="cx"> 
</span><span class="cx"> ModuleProgramExecutable::ModuleProgramExecutable(ExecState* exec, const SourceCode&amp; source)
</span><del>-    : ScriptExecutable(exec-&gt;vm().moduleProgramExecutableStructure.get(), exec-&gt;vm(), source, false, false, false)
</del><ins>+    : ScriptExecutable(exec-&gt;vm().moduleProgramExecutableStructure.get(), exec-&gt;vm(), source, false, DerivedContextType::None, false)
</ins><span class="cx"> {
</span><span class="cx">     m_typeProfilingStartOffset = 0;
</span><span class="cx">     m_typeProfilingEndOffset = source.length() - 1;
</span><span class="lines">@@ -495,7 +495,7 @@
</span><span class="cx"> const ClassInfo FunctionExecutable::s_info = { &quot;FunctionExecutable&quot;, &amp;ScriptExecutable::s_info, 0, CREATE_METHOD_TABLE(FunctionExecutable) };
</span><span class="cx"> 
</span><span class="cx"> FunctionExecutable::FunctionExecutable(VM&amp; vm, const SourceCode&amp; source, UnlinkedFunctionExecutable* unlinkedExecutable, unsigned firstLine, unsigned lastLine, unsigned startColumn, unsigned endColumn)
</span><del>-    : ScriptExecutable(vm.functionExecutableStructure.get(), vm, source, unlinkedExecutable-&gt;isInStrictContext(), unlinkedExecutable-&gt;isDerivedConstructorContext(), false)
</del><ins>+    : ScriptExecutable(vm.functionExecutableStructure.get(), vm, source, unlinkedExecutable-&gt;isInStrictContext(), unlinkedExecutable-&gt;derivedContextType(), false)
</ins><span class="cx">     , m_unlinkedExecutable(vm, this, unlinkedExecutable)
</span><span class="cx"> {
</span><span class="cx">     RELEASE_ASSERT(!source.isNull());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.h (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.h        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/runtime/Executable.h        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -346,7 +346,8 @@
</span><span class="cx">     bool needsActivation() const { return m_hasCapturedVariables || m_features &amp; (EvalFeature | WithFeature); }
</span><span class="cx">     bool isArrowFunctionContext() const { return m_isArrowFunctionContext; }
</span><span class="cx">     bool isStrictMode() const { return m_features &amp; StrictModeFeature; }
</span><del>-    bool isDerivedConstructorContext() const { return m_isDerivedConstructorContext; }
</del><ins>+    DerivedContextType derivedContextType() const { return m_derivedContextType; }
+
</ins><span class="cx">     ECMAMode ecmaMode() const { return isStrictMode() ? StrictMode : NotStrictMode; }
</span><span class="cx">         
</span><span class="cx">     void setNeverInline(bool value) { m_neverInline = value; }
</span><span class="lines">@@ -395,7 +396,7 @@
</span><span class="cx">     JSObject* prepareForExecutionImpl(ExecState*, JSFunction*, JSScope*, CodeSpecializationKind);
</span><span class="cx"> 
</span><span class="cx"> protected:
</span><del>-    ScriptExecutable(Structure*, VM&amp;, const SourceCode&amp;, bool isInStrictContext, bool isInDerivedConstructorContext, bool isInArrowFunctionContext);
</del><ins>+    ScriptExecutable(Structure*, VM&amp;, const SourceCode&amp;, bool isInStrictContext, DerivedContextType, bool isInArrowFunctionContext);
</ins><span class="cx"> 
</span><span class="cx">     void finishCreation(VM&amp; vm)
</span><span class="cx">     {
</span><span class="lines">@@ -414,7 +415,7 @@
</span><span class="cx">     bool m_neverInline;
</span><span class="cx">     bool m_neverOptimize { false };
</span><span class="cx">     bool m_didTryToEnterInLoop;
</span><del>-    bool m_isDerivedConstructorContext;
</del><ins>+    DerivedContextType m_derivedContextType;
</ins><span class="cx">     bool m_isArrowFunctionContext;
</span><span class="cx">     int m_overrideLineNumber;
</span><span class="cx">     int m_firstLine;
</span><span class="lines">@@ -438,7 +439,7 @@
</span><span class="cx">         return m_evalCodeBlock.get();
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    static EvalExecutable* create(ExecState*, const SourceCode&amp;, bool isInStrictContext, ThisTDZMode, bool isDerivedConstructorContext, bool isArrowFunctionContext, const VariableEnvironment*);
</del><ins>+    static EvalExecutable* create(ExecState*, const SourceCode&amp;, bool isInStrictContext, ThisTDZMode, DerivedContextType, bool isArrowFunctionContext, const VariableEnvironment*);
</ins><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;JITCode&gt; generatedJITCode()
</span><span class="cx">     {
</span><span class="lines">@@ -452,17 +453,17 @@
</span><span class="cx">         
</span><span class="cx">     DECLARE_INFO;
</span><span class="cx"> 
</span><ins>+    ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext() , false); }
</ins><span class="cx"> 
</span><del>-    ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, isDerivedConstructorContext(), isArrowFunctionContext()); }
-
</del><span class="cx">     unsigned numVariables() { return m_unlinkedEvalCodeBlock-&gt;numVariables(); }
</span><span class="cx">     unsigned numberOfFunctionDecls() { return m_unlinkedEvalCodeBlock-&gt;numberOfFunctionDecls(); }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend class ExecutableBase;
</span><span class="cx">     friend class ScriptExecutable;
</span><del>-    EvalExecutable(ExecState*, const SourceCode&amp;, bool inStrictContext, bool isDerivedConstructorContext, bool isArrowFunctionContext);
</del><span class="cx"> 
</span><ins>+    EvalExecutable(ExecState*, const SourceCode&amp;, bool inStrictContext, DerivedContextType, bool isArrowFunctionContext);
+
</ins><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx"> 
</span><span class="cx">     WriteBarrier&lt;EvalCodeBlock&gt; m_evalCodeBlock;
</span><span class="lines">@@ -506,7 +507,7 @@
</span><span class="cx">         
</span><span class="cx">     DECLARE_INFO;
</span><span class="cx"> 
</span><del>-    ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, isDerivedConstructorContext(), false); }
</del><ins>+    ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext(), false); }
</ins><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     friend class ExecutableBase;
</span><span class="lines">@@ -547,7 +548,7 @@
</span><span class="cx"> 
</span><span class="cx">     DECLARE_INFO;
</span><span class="cx"> 
</span><del>-    ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ModuleEvaluateMode, isDerivedConstructorContext(), false); }
</del><ins>+    ExecutableInfo executableInfo() const { return ExecutableInfo(needsActivation(), usesEval(), isStrictMode(), false, false, ConstructorKind::None, SuperBinding::NotNeeded, SourceParseMode::ModuleEvaluateMode, derivedContextType(), isArrowFunctionContext(), false); }
</ins><span class="cx"> 
</span><span class="cx">     UnlinkedModuleProgramCodeBlock* unlinkedModuleProgramCodeBlock() { return m_unlinkedModuleProgramCodeBlock.get(); }
</span><span class="cx"> 
</span><span class="lines">@@ -657,7 +658,7 @@
</span><span class="cx">     bool isBuiltinFunction() const { return m_unlinkedExecutable-&gt;isBuiltinFunction(); }
</span><span class="cx">     ConstructAbility constructAbility() const { return m_unlinkedExecutable-&gt;constructAbility(); }
</span><span class="cx">     bool isArrowFunction() const { return parseMode() == SourceParseMode::ArrowFunctionMode; }
</span><del>-    bool isDerivedConstructorContext() const { return m_unlinkedExecutable-&gt;isDerivedConstructorContext(); }
</del><ins>+    DerivedContextType derivedContextType() const { return m_unlinkedExecutable-&gt;derivedContextType(); }
</ins><span class="cx">     bool isClassConstructorFunction() const { return m_unlinkedExecutable-&gt;isClassConstructorFunction(); }
</span><span class="cx">     const Identifier&amp; name() { return m_unlinkedExecutable-&gt;name(); }
</span><span class="cx">     const Identifier&amp; inferredName() { return m_unlinkedExecutable-&gt;inferredName(); }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectFunctionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -587,7 +587,7 @@
</span><span class="cx"> 
</span><span class="cx">     JSGlobalObject* calleeGlobalObject = exec-&gt;callee()-&gt;globalObject();
</span><span class="cx">     VariableEnvironment emptyTDZVariables; // Indirect eval does not have access to the lexical scope.
</span><del>-    EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false, ThisTDZMode::CheckIfNeeded, false, false, &amp;emptyTDZVariables);
</del><ins>+    EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false, ThisTDZMode::CheckIfNeeded, DerivedContextType::None, false, &amp;emptyTDZVariables);
</ins><span class="cx">     if (!eval)
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestses6yaml"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/tests/es6.yaml (194448 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/es6.yaml        2015-12-30 20:15:27 UTC (rev 194448)
+++ trunk/Source/JavaScriptCore/tests/es6.yaml        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -747,7 +747,7 @@
</span><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><del>-  cmd: runES6 :fail
</del><ins>+  cmd: runES6 :normal
</ins><span class="cx"> - path: es6/arrow_functions_no_prototype_property.js
</span><span class="cx">   cmd: runES6 :normal
</span><span class="cx"> - path: es6/block-level_function_declaration.js
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressarrowfunctionlexicalbindsuperpropertyjs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js (0 => 194449)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/arrowfunction-lexical-bind-superproperty.js        2015-12-30 21:08:16 UTC (rev 194449)
</span><span class="lines">@@ -0,0 +1,224 @@
</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 testValue  = 'test-value';
+
+var A = class A {
+    constructor() {
+        this.value = testValue;
+    }
+    getConstValue () {
+        return testValue;
+    }
+    getValue () {
+        return this.value;
+    }
+    setValue (value) {
+        this.value = value;
+    }
+};
+
+var B = class B extends A {
+    getParentValue() {
+        var arrow  = () =&gt; super.getValue();
+        return arrow();
+    }
+};
+
+var C = class C {
+    constructor() {
+        this.value = testValue;
+    }
+    static getStaticValue() {
+        return testValue;
+    }
+};
+
+var D = class D extends C {
+    static getParentStaticValue() {
+        var arrow  = () =&gt; super.getStaticValue();
+        return arrow();
+    }
+};
+
+var E = class E extends A {
+     constructor() {
+         super();
+     }
+     get prop() {
+         var arrow = () =&gt; super.getConstValue() + '-' + this.value;
+         return arrow();
+     }
+     set prop(value) {
+         var arrow = (newVal) =&gt; super.setValue(newVal);
+         arrow(value);
+     }
+     setInitValue() {
+       this.value = testValue;
+     }
+ };
+
+var b = new B();
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(b.getParentValue(), testValue, i);
+}
+
+for (var i = 0; i &lt; 10000; i++) {
+    testCase(D.getParentStaticValue(), testValue, i);
+}
+
+var e = new E();
+for (var i = 0; i &lt; 10000; i++) {
+     e.setInitValue();
+     testCase(e.prop, testValue+'-'+testValue, i);
+     e.prop = 'new-test-value';
+     testCase(e.prop, testValue+'-new-test-value', i);
+}
+
+var F  = class F extends A {
+    newMethod() {
+        var arrow  = () =&gt; eval('super.getValue()');
+        var r = arrow();
+        return r;
+    }
+};
+
+var f = new F();
+for (var i=0; i &lt; 10000; i++) {
+    try {
+        var result = f.newMethod();
+        testCase(result, testValue, i);
+     } catch(e) {
+        if (!(e instanceof SyntaxError))
+           throw e;
+     }
+}
+
+var G = class G extends A {
+     constructor() {
+         super();
+     }
+     get prop() {
+         var arrow = () =&gt; () =&gt; super.getConstValue() + '-' + this.value;
+         return arrow()();
+     }
+     set prop(value) {
+         var arrow =  () =&gt; (newVal) =&gt; this.value = newVal;
+         arrow()(value);
+     }
+     setInitValue() {
+         this.value = testValue;
+     }
+     getValueCB() {
+         var arrow  = () =&gt; super.getValue();
+         return arrow;
+     }
+     setValueCB() {
+         var arrow =  (newVal) =&gt; this.value = newVal;
+         return arrow;
+     }
+     getParentValue() {
+         return super.getValue();
+     }
+     getParentValueWithError() {
+         var f =  function () {
+             return () =&gt; super.getValue();
+         };
+         return f();
+     }
+ };
+
+ var g = new G();
+ for (var i = 0; i &lt; 10000; i++) {
+    g.setInitValue();
+    testCase(g.prop, testValue + '-' + testValue, 'Error: Some problem with using arrow and &quot;super&quot; inside of the method');
+    g.prop = 'new-test-value';
+    testCase(g.prop, testValue + '-new-test-value', 'Error: Some problem with using arrow and &quot;super&quot; inside of the getter and setter');
+ }
+
+var g1 = new G();
+for (var i = 0; i &lt; 10000; i++) {
+    g1.setInitValue();
+    let getValue = g1.getValueCB();
+    testCase(getValue(), testValue,  'Error: Some problem with using arrow and &quot;super&quot; inside of the method that retun arrow function');
+    let setValue = g1.setValueCB();
+    setValue('new-value');
+    testCase(getValue(), 'new-value', 'Error: Some problem with using arrow and &quot;super&quot; inside of the method that retun arrow function');
+}
+
+var g2 = new G();
+for (var i = 0; i &lt; 10000; i++) {
+    let error = false;
+    try {
+       g2.getParentValueWithError()();
+    } catch(e) {
+      // FIXME: should by check if e instanceof SyntaxError
+      // https://bugs.webkit.org/show_bug.cgi?id=150893
+      error = true;
+    }
+    testCase(error, true, 'Error: using &quot;super&quot; should lead to error');
+}
+
+
+var H = class H extends A {
+    constructor() {
+        var arrow = () =&gt; () =&gt; super.getValue();
+        super();
+        this.newValue  = arrow()();
+    }
+};
+
+for (var i = 0; i &lt; 10000; i++) {
+    let h = new H();
+    testCase(h.newValue, testValue, 'Error: Some problem with using &quot;super&quot; inside of the constructor');
+}
+
+var I = class I extends A {
+    constructor (beforeSuper) {
+        var arrow = () =&gt; super.getValue();
+        if (beforeSuper)  {
+            this._value = arrow();
+            super();
+        } else {
+            super();
+            this._value = arrow();
+        }
+    }
+}
+
+var J = class J extends A {
+    constructor (beforeSuper) {
+        var _value;
+        var arrow = () =&gt; super.getConstValue();
+        if (beforeSuper)  {
+            _value = arrow();
+            super();
+         } else {
+            super();
+            _value = arrow();
+        }
+        this._value = _value;
+    }
+}
+
+for (var i = 0; i &lt; 10000; i++) {
+    let i = new I(false);
+    testCase(i._value, testValue, 'Error: Some problem with using &quot;super&quot; inside of the constructor');
+    let j = new J(false);
+    testCase(j._value, testValue, 'Error: Some problem with using &quot;super&quot; inside of the constructor');
+
+    // FIXME: Problem with access to the super before super() in constructor
+    // https://bugs.webkit.org/show_bug.cgi?id=152108
+    //let j2 = new J(true);
+    //testCase(j2._value, testValue, 'Error: Some problem with using &quot;super&quot; inside of the constructor');
+    error = false;
+    try {
+        new I(true);
+    } catch (e) {
+        error = e instanceof ReferenceError;
+    }
+    testCase(error, true, 'Error: using &quot;super&quot; property before super() should lead to error');
+}
</ins></span></pre>
</div>
</div>

</body>
</html>