<!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>[182198] trunk/Source/JavaScriptCore</title>
</head>
<body>

<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt;  }
#msg dl a { font-weight: bold}
#msg dl a:link    { color:#fc3; }
#msg dl a:active  { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff  {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://trac.webkit.org/projects/webkit/changeset/182198">182198</a></dd>
<dt>Author</dt> <dd>rniwa@webkit.org</dd>
<dt>Date</dt> <dd>2015-03-31 12:42:56 -0700 (Tue, 31 Mar 2015)</dd>
</dl>

<h3>Log Message</h3>
<pre>eval(&quot;this.foo&quot;) causes a crash if this had not been initialized in a derived class's constructor
https://bugs.webkit.org/show_bug.cgi?id=142883

Reviewed by Filip Pizlo.

The crash was caused by eval inside the constructor of a derived class not checking TDZ.

Fixed the bug by adding a parser flag that forces the TDZ check to be always emitted when accessing &quot;this&quot;
in eval inside a derived class' constructor.

* bytecode/EvalCodeCache.h:
(JSC::EvalCodeCache::getSlow):
* bytecompiler/NodesCodegen.cpp:
(JSC::ThisNode::emitBytecode):
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::evaluate):
* interpreter/Interpreter.cpp:
(JSC::eval):
* parser/ASTBuilder.h:
(JSC::ASTBuilder::thisExpr):
* parser/NodeConstructors.h:
(JSC::ThisNode::ThisNode):
* parser/Nodes.h:
* parser/Parser.cpp:
(JSC::Parser&lt;LexerType&gt;::Parser):
(JSC::Parser&lt;LexerType&gt;::parsePrimaryExpression):
* parser/Parser.h:
(JSC::parse):
* parser/ParserModes.h:
* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::thisExpr):
* runtime/CodeCache.cpp:
(JSC::CodeCache::getGlobalCodeBlock):
(JSC::CodeCache::getProgramCodeBlock):
(JSC::CodeCache::getEvalCodeBlock):
* runtime/CodeCache.h:
(JSC::SourceCodeKey::SourceCodeKey):
* runtime/Executable.cpp:
(JSC::EvalExecutable::create):
* runtime/Executable.h:
* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::createEvalCodeBlock):
* runtime/JSGlobalObject.h:
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):
* tests/stress/class-syntax-no-tdz-in-eval.js: Added.
* tests/stress/class-syntax-tdz-in-eval.js: Added.</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeEvalCodeCacheh">trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.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="#trunkSourceJavaScriptCoreparserASTBuilderh">trunk/Source/JavaScriptCore/parser/ASTBuilder.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserNodeConstructorsh">trunk/Source/JavaScriptCore/parser/NodeConstructors.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserNodesh">trunk/Source/JavaScriptCore/parser/Nodes.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParsercpp">trunk/Source/JavaScriptCore/parser/Parser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserh">trunk/Source/JavaScriptCore/parser/Parser.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserModesh">trunk/Source/JavaScriptCore/parser/ParserModes.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserSyntaxCheckerh">trunk/Source/JavaScriptCore/parser/SyntaxChecker.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCodeCachecpp">trunk/Source/JavaScriptCore/runtime/CodeCache.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeCodeCacheh">trunk/Source/JavaScriptCore/runtime/CodeCache.h</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="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjecth">trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSGlobalObjectFunctionscpp">trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoretestsstressclasssyntaxnotdzinevaljs">trunk/Source/JavaScriptCore/tests/stress/class-syntax-no-tdz-in-eval.js</a></li>
<li><a href="#trunkSourceJavaScriptCoretestsstressclasssyntaxtdzinevaljs">trunk/Source/JavaScriptCore/tests/stress/class-syntax-tdz-in-eval.js</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/ChangeLog        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -1,3 +1,53 @@
</span><ins>+2015-03-31  Ryosuke Niwa  &lt;rniwa@webkit.org&gt;
+
+        eval(&quot;this.foo&quot;) causes a crash if this had not been initialized in a derived class's constructor
+        https://bugs.webkit.org/show_bug.cgi?id=142883
+
+        Reviewed by Filip Pizlo.
+
+        The crash was caused by eval inside the constructor of a derived class not checking TDZ.
+
+        Fixed the bug by adding a parser flag that forces the TDZ check to be always emitted when accessing &quot;this&quot;
+        in eval inside a derived class' constructor.
+
+        * bytecode/EvalCodeCache.h:
+        (JSC::EvalCodeCache::getSlow):
+        * bytecompiler/NodesCodegen.cpp:
+        (JSC::ThisNode::emitBytecode):
+        * debugger/DebuggerCallFrame.cpp:
+        (JSC::DebuggerCallFrame::evaluate):
+        * interpreter/Interpreter.cpp:
+        (JSC::eval):
+        * parser/ASTBuilder.h:
+        (JSC::ASTBuilder::thisExpr):
+        * parser/NodeConstructors.h:
+        (JSC::ThisNode::ThisNode):
+        * parser/Nodes.h:
+        * parser/Parser.cpp:
+        (JSC::Parser&lt;LexerType&gt;::Parser):
+        (JSC::Parser&lt;LexerType&gt;::parsePrimaryExpression):
+        * parser/Parser.h:
+        (JSC::parse):
+        * parser/ParserModes.h:
+        * parser/SyntaxChecker.h:
+        (JSC::SyntaxChecker::thisExpr):
+        * runtime/CodeCache.cpp:
+        (JSC::CodeCache::getGlobalCodeBlock):
+        (JSC::CodeCache::getProgramCodeBlock):
+        (JSC::CodeCache::getEvalCodeBlock):
+        * runtime/CodeCache.h:
+        (JSC::SourceCodeKey::SourceCodeKey):
+        * runtime/Executable.cpp:
+        (JSC::EvalExecutable::create):
+        * runtime/Executable.h:
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::createEvalCodeBlock):
+        * runtime/JSGlobalObject.h:
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::globalFuncEval):
+        * tests/stress/class-syntax-no-tdz-in-eval.js: Added.
+        * tests/stress/class-syntax-tdz-in-eval.js: Added.
+
</ins><span class="cx"> 2015-03-31  Commit Queue  &lt;commit-queue@webkit.org&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, rolling out r182186.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeEvalCodeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -50,9 +50,9 @@
</span><span class="cx">             return 0;
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        EvalExecutable* getSlow(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, const String&amp; evalSource, JSScope* scope)
</del><ins>+        EvalExecutable* getSlow(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, ThisTDZMode thisTDZMode, const String&amp; evalSource, JSScope* scope)
</ins><span class="cx">         {
</span><del>-            EvalExecutable* evalExecutable = EvalExecutable::create(exec, makeSource(evalSource), inStrictContext);
</del><ins>+            EvalExecutable* evalExecutable = EvalExecutable::create(exec, makeSource(evalSource), inStrictContext, thisTDZMode);
</ins><span class="cx">             if (!evalExecutable)
</span><span class="cx">                 return 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerNodesCodegencpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/bytecompiler/NodesCodegen.cpp        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -144,7 +144,7 @@
</span><span class="cx"> 
</span><span class="cx"> RegisterID* ThisNode::emitBytecode(BytecodeGenerator&amp; generator, RegisterID* dst)
</span><span class="cx"> {
</span><del>-    if (generator.constructorKind() == ConstructorKind::Derived)
</del><ins>+    if (m_shouldAlwaysEmitTDZCheck || generator.constructorKind() == ConstructorKind::Derived)
</ins><span class="cx">         generator.emitTDZCheck(generator.thisRegister());
</span><span class="cx"> 
</span><span class="cx">     if (dst == generator.ignoredResult())
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggerCallFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -190,7 +190,9 @@
</span><span class="cx">     
</span><span class="cx">     DebuggerEvalEnabler evalEnabler(callFrame);
</span><span class="cx">     VM&amp; vm = callFrame-&gt;vm();
</span><del>-    EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), callFrame-&gt;codeBlock()-&gt;isStrictMode());
</del><ins>+    auto&amp; codeBlock = *callFrame-&gt;codeBlock();
+    ThisTDZMode thisTDZMode = codeBlock.unlinkedCodeBlock()-&gt;constructorKind() == ConstructorKind::Derived ? ThisTDZMode::AlwaysCheck : ThisTDZMode::CheckIfNeeded;
+    EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock.isStrictMode(), thisTDZMode);
</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 (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -126,7 +126,8 @@
</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-&gt;ownerExecutable(), callerCodeBlock-&gt;isStrictMode(), programSource, callerScopeChain);
</del><ins>+        ThisTDZMode thisTDZMode = callerCodeBlock-&gt;unlinkedCodeBlock()-&gt;constructorKind() == ConstructorKind::Derived ? ThisTDZMode::AlwaysCheck : ThisTDZMode::CheckIfNeeded;
+        eval = callerCodeBlock-&gt;evalCodeCache().getSlow(callFrame, callerCodeBlock-&gt;ownerExecutable(), callerCodeBlock-&gt;isStrictMode(), thisTDZMode, programSource, callerScopeChain);
</ins><span class="cx">         if (!eval)
</span><span class="cx">             return jsUndefined();
</span><span class="cx">     }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserASTBuilderh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ASTBuilder.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ASTBuilder.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/parser/ASTBuilder.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -164,10 +164,10 @@
</span><span class="cx">         incConstants();
</span><span class="cx">         return new (m_parserArena) VoidNode(location, expr);
</span><span class="cx">     }
</span><del>-    ExpressionNode* thisExpr(const JSTokenLocation&amp; location)
</del><ins>+    ExpressionNode* thisExpr(const JSTokenLocation&amp; location, ThisTDZMode thisTDZMode)
</ins><span class="cx">     {
</span><span class="cx">         usesThis();
</span><del>-        return new (m_parserArena) ThisNode(location);
</del><ins>+        return new (m_parserArena) ThisNode(location, thisTDZMode);
</ins><span class="cx">     }
</span><span class="cx">     ExpressionNode* superExpr(const JSTokenLocation&amp; location)
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserNodeConstructorsh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/NodeConstructors.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/NodeConstructors.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/parser/NodeConstructors.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -107,8 +107,9 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    inline ThisNode::ThisNode(const JSTokenLocation&amp; location)
</del><ins>+    inline ThisNode::ThisNode(const JSTokenLocation&amp; location, ThisTDZMode thisTDZMode)
</ins><span class="cx">         : ExpressionNode(location)
</span><ins>+        , m_shouldAlwaysEmitTDZCheck(thisTDZMode == ThisTDZMode::AlwaysCheck)
</ins><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserNodesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Nodes.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Nodes.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/parser/Nodes.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -440,10 +440,12 @@
</span><span class="cx"> 
</span><span class="cx">     class ThisNode : public ExpressionNode {
</span><span class="cx">     public:
</span><del>-        ThisNode(const JSTokenLocation&amp;);
</del><ins>+        ThisNode(const JSTokenLocation&amp;, ThisTDZMode);
</ins><span class="cx"> 
</span><span class="cx">     private:
</span><span class="cx">         virtual RegisterID* emitBytecode(BytecodeGenerator&amp;, RegisterID* = 0) override;
</span><ins>+
+        bool m_shouldAlwaysEmitTDZCheck;
</ins><span class="cx">     };
</span><span class="cx"> 
</span><span class="cx">     class SuperNode final : public ExpressionNode {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -194,7 +194,7 @@
</span><span class="cx">     VM* vm, const SourceCode&amp; source, FunctionParameters* parameters, 
</span><span class="cx">     const Identifier&amp; name, JSParserBuiltinMode builtinMode, 
</span><span class="cx">     JSParserStrictMode strictMode, JSParserCodeType codeType, 
</span><del>-    ConstructorKind defaultConstructorKind)
</del><ins>+    ConstructorKind defaultConstructorKind, ThisTDZMode thisTDZMode)
</ins><span class="cx">     : m_vm(vm)
</span><span class="cx">     , m_source(&amp;source)
</span><span class="cx">     , m_hasStackOverflow(false)
</span><span class="lines">@@ -209,6 +209,7 @@
</span><span class="cx">     , m_sourceElements(0)
</span><span class="cx">     , m_parsingBuiltin(builtinMode == JSParserBuiltinMode::Builtin)
</span><span class="cx">     , m_defaultConstructorKind(defaultConstructorKind)
</span><ins>+    , m_thisTDZMode(thisTDZMode)
</ins><span class="cx"> {
</span><span class="cx">     m_lexer = std::make_unique&lt;LexerType&gt;(vm, builtinMode);
</span><span class="cx">     m_lexer-&gt;setCode(source, &amp;m_parserArena);
</span><span class="lines">@@ -2293,7 +2294,7 @@
</span><span class="cx">     case THISTOKEN: {
</span><span class="cx">         JSTokenLocation location(tokenLocation());
</span><span class="cx">         next();
</span><del>-        return context.thisExpr(location);
</del><ins>+        return context.thisExpr(location, m_thisTDZMode);
</ins><span class="cx">     }
</span><span class="cx">     case IDENT: {
</span><span class="cx">         JSTextPosition start = tokenStartPosition();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -429,7 +429,7 @@
</span><span class="cx">     Parser(
</span><span class="cx">         VM*, const SourceCode&amp;, FunctionParameters*, const Identifier&amp;, 
</span><span class="cx">         JSParserBuiltinMode, JSParserStrictMode, JSParserCodeType,
</span><del>-        ConstructorKind defaultConstructorKind = ConstructorKind::None);
</del><ins>+        ConstructorKind defaultConstructorKind = ConstructorKind::None, ThisTDZMode = ThisTDZMode::CheckIfNeeded);
</ins><span class="cx">     ~Parser();
</span><span class="cx"> 
</span><span class="cx">     template &lt;class ParsedNode&gt;
</span><span class="lines">@@ -876,6 +876,7 @@
</span><span class="cx">     SourceElements* m_sourceElements;
</span><span class="cx">     bool m_parsingBuiltin;
</span><span class="cx">     ConstructorKind m_defaultConstructorKind;
</span><ins>+    ThisTDZMode m_thisTDZMode;
</ins><span class="cx">     DeclarationStacks::VarStack m_varDeclarations;
</span><span class="cx">     DeclarationStacks::FunctionStack m_funcDeclarations;
</span><span class="cx">     IdentifierSet m_capturedVariables;
</span><span class="lines">@@ -988,13 +989,13 @@
</span><span class="cx">     const Identifier&amp; name, JSParserBuiltinMode builtinMode,
</span><span class="cx">     JSParserStrictMode strictMode, JSParserCodeType codeType,
</span><span class="cx">     ParserError&amp; error, JSTextPosition* positionBeforeLastNewline = 0,
</span><del>-    ConstructorKind defaultConstructorKind = ConstructorKind::None)
</del><ins>+    ConstructorKind defaultConstructorKind = ConstructorKind::None, ThisTDZMode thisTDZMode = ThisTDZMode::CheckIfNeeded)
</ins><span class="cx"> {
</span><span class="cx">     SamplingRegion samplingRegion(&quot;Parsing&quot;);
</span><span class="cx"> 
</span><span class="cx">     ASSERT(!source.provider()-&gt;source().isNull());
</span><span class="cx">     if (source.provider()-&gt;source().is8Bit()) {
</span><del>-        Parser&lt;Lexer&lt;LChar&gt;&gt; parser(vm, source, parameters, name, builtinMode, strictMode, codeType, defaultConstructorKind);
</del><ins>+        Parser&lt;Lexer&lt;LChar&gt;&gt; parser(vm, source, parameters, name, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
</ins><span class="cx">         std::unique_ptr&lt;ParsedNode&gt; result = parser.parse&lt;ParsedNode&gt;(error);
</span><span class="cx">         if (positionBeforeLastNewline)
</span><span class="cx">             *positionBeforeLastNewline = parser.positionBeforeLastNewline();
</span><span class="lines">@@ -1007,7 +1008,7 @@
</span><span class="cx">         return result;
</span><span class="cx">     }
</span><span class="cx">     ASSERT_WITH_MESSAGE(defaultConstructorKind == ConstructorKind::None, &quot;BuiltinExecutables::createDefaultConstructor should always use a 8-bit string&quot;);
</span><del>-    Parser&lt;Lexer&lt;UChar&gt;&gt; parser(vm, source, parameters, name, builtinMode, strictMode, codeType);
</del><ins>+    Parser&lt;Lexer&lt;UChar&gt;&gt; parser(vm, source, parameters, name, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
</ins><span class="cx">     std::unique_ptr&lt;ParsedNode&gt; result = parser.parse&lt;ParsedNode&gt;(error);
</span><span class="cx">     if (positionBeforeLastNewline)
</span><span class="cx">         *positionBeforeLastNewline = parser.positionBeforeLastNewline();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserModesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ParserModes.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ParserModes.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/parser/ParserModes.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -37,6 +37,7 @@
</span><span class="cx"> 
</span><span class="cx"> enum class ConstructorKind { None, Base, Derived };
</span><span class="cx"> enum class SuperBinding { Needed, NotNeeded };
</span><ins>+enum class ThisTDZMode { AlwaysCheck, CheckIfNeeded };
</ins><span class="cx"> 
</span><span class="cx"> enum ProfilerMode { ProfilerOff, ProfilerOn };
</span><span class="cx"> enum DebuggerMode { DebuggerOff, DebuggerOn };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserSyntaxCheckerh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/SyntaxChecker.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/SyntaxChecker.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/parser/SyntaxChecker.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -145,7 +145,7 @@
</span><span class="cx">     ExpressionType createLogicalNot(const JSTokenLocation&amp;, ExpressionType) { return UnaryExpr; }
</span><span class="cx">     ExpressionType createUnaryPlus(const JSTokenLocation&amp;, ExpressionType) { return UnaryExpr; }
</span><span class="cx">     ExpressionType createVoid(const JSTokenLocation&amp;, ExpressionType) { return UnaryExpr; }
</span><del>-    ExpressionType thisExpr(const JSTokenLocation&amp;) { return ThisExpr; }
</del><ins>+    ExpressionType thisExpr(const JSTokenLocation&amp;, ThisTDZMode) { return ThisExpr; }
</ins><span class="cx">     ExpressionType superExpr(const JSTokenLocation&amp;) { return SuperExpr; }
</span><span class="cx">     ExpressionType createResolve(const JSTokenLocation&amp;, const Identifier*, int) { return ResolveExpr; }
</span><span class="cx">     ExpressionType createObjectLiteral(const JSTokenLocation&amp;) { return ObjectLiteralExpr; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.cpp (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -75,9 +75,10 @@
</span><span class="cx"> };
</span><span class="cx"> 
</span><span class="cx"> template &lt;class UnlinkedCodeBlockType, class ExecutableType&gt;
</span><del>-UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM&amp; vm, ExecutableType* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError&amp; error)
</del><ins>+UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM&amp; vm, ExecutableType* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode,
+    JSParserStrictMode strictMode, ThisTDZMode thisTDZMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError&amp; error)
</ins><span class="cx"> {
</span><del>-    SourceCodeKey key = SourceCodeKey(source, String(), CacheTypes&lt;UnlinkedCodeBlockType&gt;::codeType, builtinMode, strictMode);
</del><ins>+    SourceCodeKey key = SourceCodeKey(source, String(), CacheTypes&lt;UnlinkedCodeBlockType&gt;::codeType, builtinMode, strictMode, thisTDZMode);
</ins><span class="cx">     SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
</span><span class="cx">     bool canCache = debuggerMode == DebuggerOff &amp;&amp; profilerMode == ProfilerOff &amp;&amp; !vm.typeProfiler() &amp;&amp; !vm.controlFlowProfiler();
</span><span class="cx">     if (cache &amp;&amp; canCache) {
</span><span class="lines">@@ -94,7 +95,7 @@
</span><span class="cx">     typedef typename CacheTypes&lt;UnlinkedCodeBlockType&gt;::RootNode RootNode;
</span><span class="cx">     std::unique_ptr&lt;RootNode&gt; rootNode = parse&lt;RootNode&gt;(
</span><span class="cx">         &amp;vm, source, 0, Identifier(), builtinMode, strictMode, 
</span><del>-        JSParserCodeType::Program, error);
</del><ins>+        JSParserCodeType::Program, error, 0, ConstructorKind::None, thisTDZMode);
</ins><span class="cx">     if (!rootNode)
</span><span class="cx">         return nullptr;
</span><span class="cx"> 
</span><span class="lines">@@ -122,12 +123,12 @@
</span><span class="cx"> 
</span><span class="cx"> UnlinkedProgramCodeBlock* CodeCache::getProgramCodeBlock(VM&amp; vm, ProgramExecutable* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError&amp; error)
</span><span class="cx"> {
</span><del>-    return getGlobalCodeBlock&lt;UnlinkedProgramCodeBlock&gt;(vm, executable, source, builtinMode, strictMode, debuggerMode, profilerMode, error);
</del><ins>+    return getGlobalCodeBlock&lt;UnlinkedProgramCodeBlock&gt;(vm, executable, source, builtinMode, strictMode, ThisTDZMode::CheckIfNeeded, debuggerMode, profilerMode, error);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-UnlinkedEvalCodeBlock* CodeCache::getEvalCodeBlock(VM&amp; vm, EvalExecutable* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError&amp; error)
</del><ins>+UnlinkedEvalCodeBlock* CodeCache::getEvalCodeBlock(VM&amp; vm, EvalExecutable* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, ThisTDZMode thisTDZMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError&amp; error)
</ins><span class="cx"> {
</span><del>-    return getGlobalCodeBlock&lt;UnlinkedEvalCodeBlock&gt;(vm, executable, source, builtinMode, strictMode, debuggerMode, profilerMode, error);
</del><ins>+    return getGlobalCodeBlock&lt;UnlinkedEvalCodeBlock&gt;(vm, executable, source, builtinMode, strictMode, thisTDZMode, debuggerMode, profilerMode, error);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> // FIXME: There's no need to add the function's name to the key here. It's already in the source code.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -61,13 +61,15 @@
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    SourceCodeKey(const SourceCode&amp; sourceCode, const String&amp; name, CodeType codeType, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode)
</del><ins>+    SourceCodeKey(const SourceCode&amp; sourceCode, const String&amp; name, CodeType codeType, JSParserBuiltinMode builtinMode,
+        JSParserStrictMode strictMode, ThisTDZMode thisTDZMode = ThisTDZMode::CheckIfNeeded)
</ins><span class="cx">         : m_sourceCode(sourceCode)
</span><span class="cx">         , m_name(name)
</span><span class="cx">         , m_flags(
</span><del>-            (static_cast&lt;unsigned&gt;(codeType) &lt;&lt; 2) 
-            | (static_cast&lt;unsigned&gt;(builtinMode) &lt;&lt; 1) 
-            | static_cast&lt;unsigned&gt;(strictMode))
</del><ins>+            (static_cast&lt;unsigned&gt;(codeType) &lt;&lt; 3)
+            | (static_cast&lt;unsigned&gt;(builtinMode) &lt;&lt; 2)
+            | (static_cast&lt;unsigned&gt;(strictMode) &lt;&lt; 1)
+            | static_cast&lt;unsigned&gt;(thisTDZMode))
</ins><span class="cx">         , m_hash(string().impl()-&gt;hash())
</span><span class="cx">     {
</span><span class="cx">     }
</span><span class="lines">@@ -253,7 +255,7 @@
</span><span class="cx">     ~CodeCache();
</span><span class="cx"> 
</span><span class="cx">     UnlinkedProgramCodeBlock* getProgramCodeBlock(VM&amp;, ProgramExecutable*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ProfilerMode, ParserError&amp;);
</span><del>-    UnlinkedEvalCodeBlock* getEvalCodeBlock(VM&amp;, EvalExecutable*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ProfilerMode, ParserError&amp;);
</del><ins>+    UnlinkedEvalCodeBlock* getEvalCodeBlock(VM&amp;, EvalExecutable*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, ThisTDZMode, DebuggerMode, ProfilerMode, ParserError&amp;);
</ins><span class="cx">     UnlinkedFunctionExecutable* getFunctionExecutableFromGlobalCode(VM&amp;, const Identifier&amp;, const SourceCode&amp;, ParserError&amp;);
</span><span class="cx"> 
</span><span class="cx">     void clear()
</span><span class="lines">@@ -263,7 +265,7 @@
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="cx">     template &lt;class UnlinkedCodeBlockType, class ExecutableType&gt; 
</span><del>-    UnlinkedCodeBlockType* getGlobalCodeBlock(VM&amp;, ExecutableType*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ProfilerMode, ParserError&amp;);
</del><ins>+    UnlinkedCodeBlockType* getGlobalCodeBlock(VM&amp;, ExecutableType*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, ThisTDZMode, DebuggerMode, ProfilerMode, ParserError&amp;);
</ins><span class="cx"> 
</span><span class="cx">     CodeCacheMap m_sourceCode;
</span><span class="cx"> };
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.cpp (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/runtime/Executable.cpp        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -347,7 +347,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) 
</del><ins>+EvalExecutable* EvalExecutable::create(ExecState* exec, const SourceCode&amp; source, bool isInStrictContext, ThisTDZMode thisTDZMode)
</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">@@ -358,7 +358,7 @@
</span><span class="cx">     EvalExecutable* executable = new (NotNull, allocateCell&lt;EvalExecutable&gt;(*exec-&gt;heap())) EvalExecutable(exec, source, isInStrictContext);
</span><span class="cx">     executable-&gt;finishCreation(exec-&gt;vm());
</span><span class="cx"> 
</span><del>-    UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject-&gt;createEvalCodeBlock(exec, executable);
</del><ins>+    UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject-&gt;createEvalCodeBlock(exec, executable, thisTDZMode);
</ins><span class="cx">     if (!unlinkedEvalCode)
</span><span class="cx">         return 0;
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/Executable.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/Executable.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/runtime/Executable.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -453,7 +453,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);
</del><ins>+    static EvalExecutable* create(ExecState*, const SourceCode&amp;, bool isInStrictContext, ThisTDZMode);
</ins><span class="cx"> 
</span><span class="cx">     PassRefPtr&lt;JITCode&gt; generatedJITCode()
</span><span class="cx">     {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -822,15 +822,14 @@
</span><span class="cx">     return unlinkedCodeBlock;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-UnlinkedEvalCodeBlock* JSGlobalObject::createEvalCodeBlock(CallFrame* callFrame, EvalExecutable* executable)
</del><ins>+UnlinkedEvalCodeBlock* JSGlobalObject::createEvalCodeBlock(CallFrame* callFrame, EvalExecutable* executable, ThisTDZMode thisTDZMode)
</ins><span class="cx"> {
</span><span class="cx">     ParserError error;
</span><span class="cx">     JSParserStrictMode strictMode = executable-&gt;isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
</span><span class="cx">     DebuggerMode debuggerMode = hasDebugger() ? DebuggerOn : DebuggerOff;
</span><span class="cx">     ProfilerMode profilerMode = hasProfiler() ? ProfilerOn : ProfilerOff;
</span><span class="cx">     UnlinkedEvalCodeBlock* unlinkedCodeBlock = vm().codeCache()-&gt;getEvalCodeBlock(
</span><del>-        vm(), executable, executable-&gt;source(), JSParserBuiltinMode::NotBuiltin, strictMode, 
-        debuggerMode, profilerMode, error);
</del><ins>+        vm(), executable, executable-&gt;source(), JSParserBuiltinMode::NotBuiltin, strictMode, thisTDZMode, debuggerMode, profilerMode, error);
</ins><span class="cx"> 
</span><span class="cx">     if (hasDebugger())
</span><span class="cx">         debugger()-&gt;sourceParsed(callFrame, executable-&gt;source().provider(), error.line(), error.message());
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -83,6 +83,7 @@
</span><span class="cx"> class SourceCode;
</span><span class="cx"> class NullGetterFunction;
</span><span class="cx"> class NullSetterFunction;
</span><ins>+enum class ThisTDZMode;
</ins><span class="cx"> struct ActivationStackNode;
</span><span class="cx"> struct HashTable;
</span><span class="cx"> 
</span><span class="lines">@@ -599,7 +600,7 @@
</span><span class="cx">     unsigned weakRandomInteger() { return m_weakRandom.getUint32(); }
</span><span class="cx"> 
</span><span class="cx">     UnlinkedProgramCodeBlock* createProgramCodeBlock(CallFrame*, ProgramExecutable*, JSObject** exception);
</span><del>-    UnlinkedEvalCodeBlock* createEvalCodeBlock(CallFrame*, EvalExecutable*);
</del><ins>+    UnlinkedEvalCodeBlock* createEvalCodeBlock(CallFrame*, EvalExecutable*, ThisTDZMode);
</ins><span class="cx"> 
</span><span class="cx"> protected:
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectFunctionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp (182197 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp        2015-03-31 19:32:12 UTC (rev 182197)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -571,7 +571,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     JSGlobalObject* calleeGlobalObject = exec-&gt;callee()-&gt;globalObject();
</span><del>-    EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false);
</del><ins>+    EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false, ThisTDZMode::CheckIfNeeded);
</ins><span class="cx">     if (!eval)
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressclasssyntaxnotdzinevaljs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/class-syntax-no-tdz-in-eval.js (0 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/class-syntax-no-tdz-in-eval.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/class-syntax-no-tdz-in-eval.js        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -0,0 +1,18 @@
</span><ins>+
+class A {
+    constructor() { }
+}
+
+class B extends A {
+    constructor(shouldAccessThis) {
+        var evalFunction = eval;
+        evalFunction(&quot;this&quot;);
+        eval(&quot;shouldAccessThis ? this : null&quot;);
+        super();
+    }
+}
+
+noInline(B);
+
+for (var i = 0; i &lt; 1e4; ++i)
+    new B(false);
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoretestsstressclasssyntaxtdzinevaljs"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/tests/stress/class-syntax-tdz-in-eval.js (0 => 182198)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/tests/stress/class-syntax-tdz-in-eval.js                                (rev 0)
+++ trunk/Source/JavaScriptCore/tests/stress/class-syntax-tdz-in-eval.js        2015-03-31 19:42:56 UTC (rev 182198)
</span><span class="lines">@@ -0,0 +1,26 @@
</span><ins>+
+class A {
+    constructor() { }
+}
+
+class B extends A {
+    constructor() {
+        eval(&quot;this&quot;);
+        super();
+    }
+}
+
+noInline(B);
+
+for (var i = 0; i &lt; 1e4; ++i) {
+    var exception;
+    try {
+        new B();
+    } catch (e) {
+        exception = e;
+        if (!(e instanceof ReferenceError))
+            throw &quot;Exception thrown in iteration &quot; + i + &quot; was not a reference error&quot;;
+    }
+    if (!exception)
+        throw &quot;Exception not thrown for an unitialized this at iteration &quot; + i;
+}
</ins></span></pre>
</div>
</div>

</body>
</html>