<!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("this.foo") 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 "this"
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<LexerType>::Parser):
(JSC::Parser<LexerType>::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 <rniwa@webkit.org>
+
+ eval("this.foo") 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 "this"
+ 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<LexerType>::Parser):
+ (JSC::Parser<LexerType>::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 <commit-queue@webkit.org>
</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& evalSource, JSScope* scope)
</del><ins>+ EvalExecutable* getSlow(ExecState* exec, ScriptExecutable* owner, bool inStrictContext, ThisTDZMode thisTDZMode, const String& 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& 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& vm = callFrame->vm();
</span><del>- EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), callFrame->codeBlock()->isStrictMode());
</del><ins>+ auto& codeBlock = *callFrame->codeBlock();
+ ThisTDZMode thisTDZMode = codeBlock.unlinkedCodeBlock()->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->vm().exception());
</span><span class="cx">
</span><del>- eval = callerCodeBlock->evalCodeCache().getSlow(callFrame, callerCodeBlock->ownerExecutable(), callerCodeBlock->isStrictMode(), programSource, callerScopeChain);
</del><ins>+ ThisTDZMode thisTDZMode = callerCodeBlock->unlinkedCodeBlock()->constructorKind() == ConstructorKind::Derived ? ThisTDZMode::AlwaysCheck : ThisTDZMode::CheckIfNeeded;
+ eval = callerCodeBlock->evalCodeCache().getSlow(callFrame, callerCodeBlock->ownerExecutable(), callerCodeBlock->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& location)
</del><ins>+ ExpressionNode* thisExpr(const JSTokenLocation& 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& 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& location)
</del><ins>+ inline ThisNode::ThisNode(const JSTokenLocation& 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&);
</del><ins>+ ThisNode(const JSTokenLocation&, ThisTDZMode);
</ins><span class="cx">
</span><span class="cx"> private:
</span><span class="cx"> virtual RegisterID* emitBytecode(BytecodeGenerator&, 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& source, FunctionParameters* parameters,
</span><span class="cx"> const Identifier& 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(&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<LexerType>(vm, builtinMode);
</span><span class="cx"> m_lexer->setCode(source, &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&, FunctionParameters*, const Identifier&,
</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 <class ParsedNode>
</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& name, JSParserBuiltinMode builtinMode,
</span><span class="cx"> JSParserStrictMode strictMode, JSParserCodeType codeType,
</span><span class="cx"> ParserError& 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("Parsing");
</span><span class="cx">
</span><span class="cx"> ASSERT(!source.provider()->source().isNull());
</span><span class="cx"> if (source.provider()->source().is8Bit()) {
</span><del>- Parser<Lexer<LChar>> parser(vm, source, parameters, name, builtinMode, strictMode, codeType, defaultConstructorKind);
</del><ins>+ Parser<Lexer<LChar>> parser(vm, source, parameters, name, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
</ins><span class="cx"> std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(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, "BuiltinExecutables::createDefaultConstructor should always use a 8-bit string");
</span><del>- Parser<Lexer<UChar>> parser(vm, source, parameters, name, builtinMode, strictMode, codeType);
</del><ins>+ Parser<Lexer<UChar>> parser(vm, source, parameters, name, builtinMode, strictMode, codeType, defaultConstructorKind, thisTDZMode);
</ins><span class="cx"> std::unique_ptr<ParsedNode> result = parser.parse<ParsedNode>(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&, ExpressionType) { return UnaryExpr; }
</span><span class="cx"> ExpressionType createUnaryPlus(const JSTokenLocation&, ExpressionType) { return UnaryExpr; }
</span><span class="cx"> ExpressionType createVoid(const JSTokenLocation&, ExpressionType) { return UnaryExpr; }
</span><del>- ExpressionType thisExpr(const JSTokenLocation&) { return ThisExpr; }
</del><ins>+ ExpressionType thisExpr(const JSTokenLocation&, ThisTDZMode) { return ThisExpr; }
</ins><span class="cx"> ExpressionType superExpr(const JSTokenLocation&) { return SuperExpr; }
</span><span class="cx"> ExpressionType createResolve(const JSTokenLocation&, const Identifier*, int) { return ResolveExpr; }
</span><span class="cx"> ExpressionType createObjectLiteral(const JSTokenLocation&) { 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 <class UnlinkedCodeBlockType, class ExecutableType>
</span><del>-UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM& vm, ExecutableType* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error)
</del><ins>+UnlinkedCodeBlockType* CodeCache::getGlobalCodeBlock(VM& vm, ExecutableType* executable, const SourceCode& source, JSParserBuiltinMode builtinMode,
+ JSParserStrictMode strictMode, ThisTDZMode thisTDZMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error)
</ins><span class="cx"> {
</span><del>- SourceCodeKey key = SourceCodeKey(source, String(), CacheTypes<UnlinkedCodeBlockType>::codeType, builtinMode, strictMode);
</del><ins>+ SourceCodeKey key = SourceCodeKey(source, String(), CacheTypes<UnlinkedCodeBlockType>::codeType, builtinMode, strictMode, thisTDZMode);
</ins><span class="cx"> SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
</span><span class="cx"> bool canCache = debuggerMode == DebuggerOff && profilerMode == ProfilerOff && !vm.typeProfiler() && !vm.controlFlowProfiler();
</span><span class="cx"> if (cache && canCache) {
</span><span class="lines">@@ -94,7 +95,7 @@
</span><span class="cx"> typedef typename CacheTypes<UnlinkedCodeBlockType>::RootNode RootNode;
</span><span class="cx"> std::unique_ptr<RootNode> rootNode = parse<RootNode>(
</span><span class="cx"> &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& vm, ProgramExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error)
</span><span class="cx"> {
</span><del>- return getGlobalCodeBlock<UnlinkedProgramCodeBlock>(vm, executable, source, builtinMode, strictMode, debuggerMode, profilerMode, error);
</del><ins>+ return getGlobalCodeBlock<UnlinkedProgramCodeBlock>(vm, executable, source, builtinMode, strictMode, ThisTDZMode::CheckIfNeeded, debuggerMode, profilerMode, error);
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-UnlinkedEvalCodeBlock* CodeCache::getEvalCodeBlock(VM& vm, EvalExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error)
</del><ins>+UnlinkedEvalCodeBlock* CodeCache::getEvalCodeBlock(VM& vm, EvalExecutable* executable, const SourceCode& source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, ThisTDZMode thisTDZMode, DebuggerMode debuggerMode, ProfilerMode profilerMode, ParserError& error)
</ins><span class="cx"> {
</span><del>- return getGlobalCodeBlock<UnlinkedEvalCodeBlock>(vm, executable, source, builtinMode, strictMode, debuggerMode, profilerMode, error);
</del><ins>+ return getGlobalCodeBlock<UnlinkedEvalCodeBlock>(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& sourceCode, const String& name, CodeType codeType, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode)
</del><ins>+ SourceCodeKey(const SourceCode& sourceCode, const String& 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<unsigned>(codeType) << 2)
- | (static_cast<unsigned>(builtinMode) << 1)
- | static_cast<unsigned>(strictMode))
</del><ins>+ (static_cast<unsigned>(codeType) << 3)
+ | (static_cast<unsigned>(builtinMode) << 2)
+ | (static_cast<unsigned>(strictMode) << 1)
+ | static_cast<unsigned>(thisTDZMode))
</ins><span class="cx"> , m_hash(string().impl()->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&, ProgramExecutable*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ProfilerMode, ParserError&);
</span><del>- UnlinkedEvalCodeBlock* getEvalCodeBlock(VM&, EvalExecutable*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ProfilerMode, ParserError&);
</del><ins>+ UnlinkedEvalCodeBlock* getEvalCodeBlock(VM&, EvalExecutable*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, ThisTDZMode, DebuggerMode, ProfilerMode, ParserError&);
</ins><span class="cx"> UnlinkedFunctionExecutable* getFunctionExecutableFromGlobalCode(VM&, const Identifier&, const SourceCode&, ParserError&);
</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 <class UnlinkedCodeBlockType, class ExecutableType>
</span><del>- UnlinkedCodeBlockType* getGlobalCodeBlock(VM&, ExecutableType*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ProfilerMode, ParserError&);
</del><ins>+ UnlinkedCodeBlockType* getGlobalCodeBlock(VM&, ExecutableType*, const SourceCode&, JSParserBuiltinMode, JSParserStrictMode, ThisTDZMode, DebuggerMode, ProfilerMode, ParserError&);
</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 = { "EvalExecutable", &ScriptExecutable::s_info, 0, CREATE_METHOD_TABLE(EvalExecutable) };
</span><span class="cx">
</span><del>-EvalExecutable* EvalExecutable::create(ExecState* exec, const SourceCode& source, bool isInStrictContext)
</del><ins>+EvalExecutable* EvalExecutable::create(ExecState* exec, const SourceCode& source, bool isInStrictContext, ThisTDZMode thisTDZMode)
</ins><span class="cx"> {
</span><span class="cx"> JSGlobalObject* globalObject = exec->lexicalGlobalObject();
</span><span class="cx"> if (!globalObject->evalEnabled()) {
</span><span class="lines">@@ -358,7 +358,7 @@
</span><span class="cx"> EvalExecutable* executable = new (NotNull, allocateCell<EvalExecutable>(*exec->heap())) EvalExecutable(exec, source, isInStrictContext);
</span><span class="cx"> executable->finishCreation(exec->vm());
</span><span class="cx">
</span><del>- UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject->createEvalCodeBlock(exec, executable);
</del><ins>+ UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject->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&, bool isInStrictContext);
</del><ins>+ static EvalExecutable* create(ExecState*, const SourceCode&, bool isInStrictContext, ThisTDZMode);
</ins><span class="cx">
</span><span class="cx"> PassRefPtr<JITCode> 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->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()->getEvalCodeBlock(
</span><del>- vm(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, strictMode,
- debuggerMode, profilerMode, error);
</del><ins>+ vm(), executable, executable->source(), JSParserBuiltinMode::NotBuiltin, strictMode, thisTDZMode, debuggerMode, profilerMode, error);
</ins><span class="cx">
</span><span class="cx"> if (hasDebugger())
</span><span class="cx"> debugger()->sourceParsed(callFrame, executable->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->callee()->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("this");
+ eval("shouldAccessThis ? this : null");
+ super();
+ }
+}
+
+noInline(B);
+
+for (var i = 0; i < 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("this");
+ super();
+ }
+}
+
+noInline(B);
+
+for (var i = 0; i < 1e4; ++i) {
+ var exception;
+ try {
+ new B();
+ } catch (e) {
+ exception = e;
+ if (!(e instanceof ReferenceError))
+ throw "Exception thrown in iteration " + i + " was not a reference error";
+ }
+ if (!exception)
+ throw "Exception not thrown for an unitialized this at iteration " + i;
+}
</ins></span></pre>
</div>
</div>
</body>
</html>