<!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>[208712] 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/208712">208712</a></dd>
<dt>Author</dt> <dd>ggaren@apple.com</dd>
<dt>Date</dt> <dd>2016-11-14 14:57:12 -0800 (Mon, 14 Nov 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>JSC should distinguish between local and global eval
https://bugs.webkit.org/show_bug.cgi?id=164628

Reviewed by Saam Barati.

Local use of the 'eval' keyword and invocation of the global window.eval
function are distinct operations in JavaScript.

This patch splits out LocalEvalExecutable vs GlobalEvalExecutable in
order to help distinguish these operations in code.

Our code used to do some silly things for lack of distinguishing these
cases. For example, it would double cache local eval in CodeCache and
EvalCodeCache. This made CodeCache seem more complicated than it really
was.

* CMakeLists.txt:
* JavaScriptCore.xcodeproj/project.pbxproj: Added some files.

* bytecode/CodeBlock.h:

* bytecode/EvalCodeCache.h:
(JSC::EvalCodeCache::tryGet):
(JSC::EvalCodeCache::set):
(JSC::EvalCodeCache::getSlow): Deleted. Moved code generation out of
the cache to avoid tight coupling. Now the cache just caches.

* bytecode/UnlinkedEvalCodeBlock.h:
* bytecode/UnlinkedFunctionExecutable.cpp:
(JSC::UnlinkedFunctionExecutable::fromGlobalCode):
* bytecode/UnlinkedModuleProgramCodeBlock.h:
* bytecode/UnlinkedProgramCodeBlock.h:
* debugger/DebuggerCallFrame.cpp:
(JSC::DebuggerCallFrame::evaluateWithScopeExtension): Updated for interface
changes.

* interpreter/Interpreter.cpp:
(JSC::eval): Moved code generation here so the cache didn't need to build
it in.

* llint/LLIntOffsetsExtractor.cpp:

* runtime/CodeCache.cpp:
(JSC::CodeCache::getUnlinkedGlobalCodeBlock): No need to check for TDZ
variables any more. We only cache global programs, and global variable
access always does TDZ checks.

(JSC::CodeCache::getUnlinkedProgramCodeBlock):
(JSC::CodeCache::getUnlinkedGlobalEvalCodeBlock):
(JSC::CodeCache::getUnlinkedModuleProgramCodeBlock):
(JSC::CodeCache::getUnlinkedGlobalFunctionExecutable):

(JSC::CodeCache::CodeCache): Deleted.
(JSC::CodeCache::~CodeCache): Deleted.
(JSC::CodeCache::getGlobalCodeBlock): Deleted.
(JSC::CodeCache::getProgramCodeBlock): Deleted.
(JSC::CodeCache::getEvalCodeBlock): Deleted.
(JSC::CodeCache::getModuleProgramCodeBlock): Deleted.
(JSC::CodeCache::getFunctionExecutableFromGlobalCode): Deleted.

* runtime/CodeCache.h:
(JSC::CodeCache::clear):
(JSC::generateUnlinkedCodeBlock): Moved unlinked code block creation
out of the CodeCache class and into a stand-alone function because
we need it for local eval, which does not live in CodeCache.

* runtime/EvalExecutable.cpp:
(JSC::EvalExecutable::create): Deleted.
* runtime/EvalExecutable.h:
(): Deleted.
* runtime/GlobalEvalExecutable.cpp: Added.
(JSC::GlobalEvalExecutable::create):
(JSC::GlobalEvalExecutable::GlobalEvalExecutable):
* runtime/GlobalEvalExecutable.h: Added.
* runtime/LocalEvalExecutable.cpp: Added.
(JSC::LocalEvalExecutable::create):
(JSC::LocalEvalExecutable::LocalEvalExecutable):
* runtime/LocalEvalExecutable.h: Added. Split out Local vs Global
EvalExecutable classes to distinguish these operations in code. The key
difference is that LocalEvalExecutable does not live in the CodeCache
and only lives in the EvalCodeCache.

* runtime/JSGlobalObject.cpp:
(JSC::JSGlobalObject::createProgramCodeBlock):
(JSC::JSGlobalObject::createLocalEvalCodeBlock):
(JSC::JSGlobalObject::createGlobalEvalCodeBlock):
(JSC::JSGlobalObject::createModuleProgramCodeBlock):
(JSC::JSGlobalObject::createEvalCodeBlock): Deleted.
* runtime/JSGlobalObject.h:
* runtime/JSGlobalObjectFunctions.cpp:
(JSC::globalFuncEval):

* runtime/JSScope.cpp:
(JSC::JSScope::collectClosureVariablesUnderTDZ):
(JSC::JSScope::collectVariablesUnderTDZ): Deleted. We don't include
global lexical variables in our concept of TDZ scopes anymore. Global
variable access always does TDZ checks unconditionally. So, only closure
scope accesses give specific consideration to TDZ checks.

* runtime/JSScope.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreCMakeListstxt">trunk/Source/JavaScriptCore/CMakeLists.txt</a></li>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj">trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeCodeBlockh">trunk/Source/JavaScriptCore/bytecode/CodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeEvalCodeCacheh">trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedEvalCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedEvalCodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedFunctionExecutablecpp">trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedModuleProgramCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedModuleProgramCodeBlock.h</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecodeUnlinkedProgramCodeBlockh">trunk/Source/JavaScriptCore/bytecode/UnlinkedProgramCodeBlock.h</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="#trunkSourceJavaScriptCorellintLLIntOffsetsExtractorcpp">trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp</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="#trunkSourceJavaScriptCoreruntimeEvalExecutablecpp">trunk/Source/JavaScriptCore/runtime/EvalExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeEvalExecutableh">trunk/Source/JavaScriptCore/runtime/EvalExecutable.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>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSScopecpp">trunk/Source/JavaScriptCore/runtime/JSScope.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeJSScopeh">trunk/Source/JavaScriptCore/runtime/JSScope.h</a></li>
</ul>

<h3>Added Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreruntimeDirectEvalExecutablecpp">trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeDirectEvalExecutableh">trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeIndirectEvalExecutablecpp">trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreruntimeIndirectEvalExecutableh">trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreCMakeListstxt"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/CMakeLists.txt (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/CMakeLists.txt        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/CMakeLists.txt        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -683,6 +683,7 @@
</span><span class="cx">     runtime/DatePrototype.cpp
</span><span class="cx">     runtime/DirectArguments.cpp
</span><span class="cx">     runtime/DirectArgumentsOffset.cpp
</span><ins>+    runtime/DirectEvalExecutable.cpp
</ins><span class="cx">     runtime/DumpContext.cpp
</span><span class="cx">     runtime/ECMAScriptSpecInternalFunctions.cpp
</span><span class="cx">     runtime/Error.cpp
</span><span class="lines">@@ -710,6 +711,7 @@
</span><span class="cx">     runtime/HashMapImpl.cpp
</span><span class="cx">     runtime/Identifier.cpp
</span><span class="cx">     runtime/IndexingType.cpp
</span><ins>+    runtime/IndirectEvalExecutable.cpp
</ins><span class="cx">     runtime/InferredType.cpp
</span><span class="cx">     runtime/InferredTypeTable.cpp
</span><span class="cx">     runtime/InferredValue.cpp
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -1,3 +1,106 @@
</span><ins>+2016-11-11  Geoffrey Garen  &lt;ggaren@apple.com&gt;
+
+        JSC should distinguish between local and global eval
+        https://bugs.webkit.org/show_bug.cgi?id=164628
+
+        Reviewed by Saam Barati.
+
+        Local use of the 'eval' keyword and invocation of the global window.eval
+        function are distinct operations in JavaScript.
+
+        This patch splits out LocalEvalExecutable vs GlobalEvalExecutable in
+        order to help distinguish these operations in code.
+
+        Our code used to do some silly things for lack of distinguishing these
+        cases. For example, it would double cache local eval in CodeCache and
+        EvalCodeCache. This made CodeCache seem more complicated than it really
+        was.
+
+        * CMakeLists.txt:
+        * JavaScriptCore.xcodeproj/project.pbxproj: Added some files.
+
+        * bytecode/CodeBlock.h:
+
+        * bytecode/EvalCodeCache.h:
+        (JSC::EvalCodeCache::tryGet):
+        (JSC::EvalCodeCache::set):
+        (JSC::EvalCodeCache::getSlow): Deleted. Moved code generation out of
+        the cache to avoid tight coupling. Now the cache just caches.
+
+        * bytecode/UnlinkedEvalCodeBlock.h:
+        * bytecode/UnlinkedFunctionExecutable.cpp:
+        (JSC::UnlinkedFunctionExecutable::fromGlobalCode):
+        * bytecode/UnlinkedModuleProgramCodeBlock.h:
+        * bytecode/UnlinkedProgramCodeBlock.h:
+        * debugger/DebuggerCallFrame.cpp:
+        (JSC::DebuggerCallFrame::evaluateWithScopeExtension): Updated for interface
+        changes.
+
+        * interpreter/Interpreter.cpp:
+        (JSC::eval): Moved code generation here so the cache didn't need to build
+        it in.
+
+        * llint/LLIntOffsetsExtractor.cpp:
+
+        * runtime/CodeCache.cpp:
+        (JSC::CodeCache::getUnlinkedGlobalCodeBlock): No need to check for TDZ
+        variables any more. We only cache global programs, and global variable
+        access always does TDZ checks.
+
+        (JSC::CodeCache::getUnlinkedProgramCodeBlock):
+        (JSC::CodeCache::getUnlinkedGlobalEvalCodeBlock):
+        (JSC::CodeCache::getUnlinkedModuleProgramCodeBlock):
+        (JSC::CodeCache::getUnlinkedGlobalFunctionExecutable):
+
+        (JSC::CodeCache::CodeCache): Deleted.
+        (JSC::CodeCache::~CodeCache): Deleted.
+        (JSC::CodeCache::getGlobalCodeBlock): Deleted.
+        (JSC::CodeCache::getProgramCodeBlock): Deleted.
+        (JSC::CodeCache::getEvalCodeBlock): Deleted.
+        (JSC::CodeCache::getModuleProgramCodeBlock): Deleted.
+        (JSC::CodeCache::getFunctionExecutableFromGlobalCode): Deleted.
+
+        * runtime/CodeCache.h:
+        (JSC::CodeCache::clear):
+        (JSC::generateUnlinkedCodeBlock): Moved unlinked code block creation
+        out of the CodeCache class and into a stand-alone function because
+        we need it for local eval, which does not live in CodeCache.
+
+        * runtime/EvalExecutable.cpp:
+        (JSC::EvalExecutable::create): Deleted.
+        * runtime/EvalExecutable.h:
+        (): Deleted.
+        * runtime/GlobalEvalExecutable.cpp: Added.
+        (JSC::GlobalEvalExecutable::create):
+        (JSC::GlobalEvalExecutable::GlobalEvalExecutable):
+        * runtime/GlobalEvalExecutable.h: Added.
+        * runtime/LocalEvalExecutable.cpp: Added.
+        (JSC::LocalEvalExecutable::create):
+        (JSC::LocalEvalExecutable::LocalEvalExecutable):
+        * runtime/LocalEvalExecutable.h: Added. Split out Local vs Global
+        EvalExecutable classes to distinguish these operations in code. The key
+        difference is that LocalEvalExecutable does not live in the CodeCache
+        and only lives in the EvalCodeCache.
+
+        * runtime/JSGlobalObject.cpp:
+        (JSC::JSGlobalObject::createProgramCodeBlock):
+        (JSC::JSGlobalObject::createLocalEvalCodeBlock):
+        (JSC::JSGlobalObject::createGlobalEvalCodeBlock):
+        (JSC::JSGlobalObject::createModuleProgramCodeBlock):
+        (JSC::JSGlobalObject::createEvalCodeBlock): Deleted.
+        * runtime/JSGlobalObject.h:
+        * runtime/JSGlobalObjectFunctions.cpp:
+        (JSC::globalFuncEval):
+
+        * runtime/JSScope.cpp:
+        (JSC::JSScope::collectClosureVariablesUnderTDZ):
+        (JSC::JSScope::collectVariablesUnderTDZ): Deleted. We don't include
+        global lexical variables in our concept of TDZ scopes anymore. Global
+        variable access always does TDZ checks unconditionally. So, only closure
+        scope accesses give specific consideration to TDZ checks.
+
+        * runtime/JSScope.h:
+
</ins><span class="cx"> 2016-11-14  Caitlin Potter  &lt;caitp@igalia.com&gt;
</span><span class="cx"> 
</span><span class="cx">         [JSC] Handle new_async_func / new_async_func_exp in DFG / FTL
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreJavaScriptCorexcodeprojprojectpbxproj"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -1055,6 +1055,10 @@
</span><span class="cx">                 142E313A134FF0A600AFADB5 /* LocalScope.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E3131134FF0A600AFADB5 /* LocalScope.h */; };
</span><span class="cx">                 142E313B134FF0A600AFADB5 /* Strong.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E3132134FF0A600AFADB5 /* Strong.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><span class="cx">                 142E313C134FF0A600AFADB5 /* Weak.h in Headers */ = {isa = PBXBuildFile; fileRef = 142E3133134FF0A600AFADB5 /* Weak.h */; settings = {ATTRIBUTES = (Private, ); }; };
</span><ins>+                14386A741DD69895008652C4 /* DirectEvalExecutable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14386A721DD69895008652C4 /* DirectEvalExecutable.cpp */; };
+                14386A751DD69895008652C4 /* DirectEvalExecutable.h in Headers */ = {isa = PBXBuildFile; fileRef = 14386A731DD69895008652C4 /* DirectEvalExecutable.h */; settings = {ATTRIBUTES = (Private, ); }; };
+                14386A781DD6989C008652C4 /* IndirectEvalExecutable.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 14386A761DD6989C008652C4 /* IndirectEvalExecutable.cpp */; };
+                14386A791DD6989C008652C4 /* IndirectEvalExecutable.h in Headers */ = {isa = PBXBuildFile; fileRef = 14386A771DD6989C008652C4 /* IndirectEvalExecutable.h */; settings = {ATTRIBUTES = (Private, ); }; };
</ins><span class="cx">                 1440057F0A5335640005F061 /* JSNode.c in Sources */ = {isa = PBXBuildFile; fileRef = 1440F6420A4F8B6A0005F061 /* JSNode.c */; };
</span><span class="cx">                 144005CB0A5338D10005F061 /* JSNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440F6410A4F8B6A0005F061 /* JSNode.h */; };
</span><span class="cx">                 144005CC0A5338F80005F061 /* Node.h in Headers */ = {isa = PBXBuildFile; fileRef = 1440051F0A531D3B0005F061 /* Node.h */; };
</span><span class="lines">@@ -3433,6 +3437,10 @@
</span><span class="cx">                 142E3131134FF0A600AFADB5 /* LocalScope.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = LocalScope.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 142E3132134FF0A600AFADB5 /* Strong.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Strong.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 142E3133134FF0A600AFADB5 /* Weak.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Weak.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><ins>+                14386A721DD69895008652C4 /* DirectEvalExecutable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DirectEvalExecutable.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                14386A731DD69895008652C4 /* DirectEvalExecutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DirectEvalExecutable.h; sourceTree = &quot;&lt;group&gt;&quot;; };
+                14386A761DD6989C008652C4 /* IndirectEvalExecutable.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = IndirectEvalExecutable.cpp; sourceTree = &quot;&lt;group&gt;&quot;; };
+                14386A771DD6989C008652C4 /* IndirectEvalExecutable.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = IndirectEvalExecutable.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</ins><span class="cx">                 1440051F0A531D3B0005F061 /* Node.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Node.h; path = tests/Node.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 144005200A531D3B0005F061 /* Node.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; name = Node.c; path = tests/Node.c; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="cx">                 144007480A536CC20005F061 /* NodeList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = NodeList.h; path = tests/NodeList.h; sourceTree = &quot;&lt;group&gt;&quot;; };
</span><span class="lines">@@ -6062,12 +6070,12 @@
</span><span class="cx">                                 F692A84D0255597D01FF60F7 /* ArrayPrototype.cpp */,
</span><span class="cx">                                 F692A84E0255597D01FF60F7 /* ArrayPrototype.h */,
</span><span class="cx">                                 0FB7F38A15ED8E3800F167B2 /* ArrayStorage.h */,
</span><del>-                                0F7CF9541DC1258B0098CC12 /* AtomicsObject.cpp */,
-                                0F7CF9551DC1258B0098CC12 /* AtomicsObject.h */,
</del><span class="cx">                                 5B70CFDD1DB69E5C00EC23F9 /* AsyncFunctionConstructor.cpp */,
</span><span class="cx">                                 5B70CFDC1DB69E5C00EC23F9 /* AsyncFunctionConstructor.h */,
</span><span class="cx">                                 5B70CFDB1DB69E5C00EC23F9 /* AsyncFunctionPrototype.cpp */,
</span><span class="cx">                                 5B70CFDA1DB69E5C00EC23F9 /* AsyncFunctionPrototype.h */,
</span><ins>+                                0F7CF9541DC1258B0098CC12 /* AtomicsObject.cpp */,
+                                0F7CF9551DC1258B0098CC12 /* AtomicsObject.h */,
</ins><span class="cx">                                 0F38D2A01D44196600680499 /* AuxiliaryBarrier.h */,
</span><span class="cx">                                 0F38D2A11D44196600680499 /* AuxiliaryBarrierInlines.h */,
</span><span class="cx">                                 52678F8C1A031009006A306D /* BasicBlockLocation.cpp */,
</span><span class="lines">@@ -6136,6 +6144,8 @@
</span><span class="cx">                                 0FE050101AA9091100D33B33 /* DirectArguments.h */,
</span><span class="cx">                                 0FE0500D1AA9091100D33B33 /* DirectArgumentsOffset.cpp */,
</span><span class="cx">                                 0FE0500E1AA9091100D33B33 /* DirectArgumentsOffset.h */,
</span><ins>+                                14386A721DD69895008652C4 /* DirectEvalExecutable.cpp */,
+                                14386A731DD69895008652C4 /* DirectEvalExecutable.h */,
</ins><span class="cx">                                 A70447EB17A0BD7000F5898E /* DumpContext.cpp */,
</span><span class="cx">                                 A70447EC17A0BD7000F5898E /* DumpContext.h */,
</span><span class="cx">                                 FE318FDD1CAC8C5300DFCC54 /* ECMAScriptSpecInternalFunctions.cpp */,
</span><span class="lines">@@ -6203,6 +6213,8 @@
</span><span class="cx">                                 0FB7F38E15ED8E3800F167B2 /* IndexingHeaderInlines.h */,
</span><span class="cx">                                 0F13E04C16164A1B00DC8DE7 /* IndexingType.cpp */,
</span><span class="cx">                                 0FB7F38F15ED8E3800F167B2 /* IndexingType.h */,
</span><ins>+                                14386A761DD6989C008652C4 /* IndirectEvalExecutable.cpp */,
+                                14386A771DD6989C008652C4 /* IndirectEvalExecutable.h */,
</ins><span class="cx">                                 0F0A75201B94BFA900110660 /* InferredType.cpp */,
</span><span class="cx">                                 0F0A75211B94BFA900110660 /* InferredType.h */,
</span><span class="cx">                                 0FFC920F1B94D4DF0071DD66 /* InferredTypeTable.cpp */,
</span><span class="lines">@@ -8413,6 +8425,7 @@
</span><span class="cx">                                 0F2B66EA17B6B5AB00A7AE3F /* JSArrayBufferViewInlines.h in Headers */,
</span><span class="cx">                                 BC18C4180E16F5CD00B34460 /* JSBase.h in Headers */,
</span><span class="cx">                                 140D17D70E8AD4A9000CD17D /* JSBasePrivate.h in Headers */,
</span><ins>+                                14386A751DD69895008652C4 /* DirectEvalExecutable.h in Headers */,
</ins><span class="cx">                                 86FA9E92142BBB2E001773B7 /* JSBoundFunction.h in Headers */,
</span><span class="cx">                                 BC18C4190E16F5CD00B34460 /* JSCallbackConstructor.h in Headers */,
</span><span class="cx">                                 BC18C41A0E16F5CD00B34460 /* JSCallbackFunction.h in Headers */,
</span><span class="lines">@@ -8771,6 +8784,7 @@
</span><span class="cx">                                 DC2143071CA32E55000A8869 /* ICStats.h in Headers */,
</span><span class="cx">                                 869EBCB70E8C6D4A008722CC /* ResultType.h in Headers */,
</span><span class="cx">                                 70B0A9D11A9B66460001306A /* RuntimeFlags.h in Headers */,
</span><ins>+                                14386A791DD6989C008652C4 /* IndirectEvalExecutable.h in Headers */,
</ins><span class="cx">                                 52C0611F1AA51E1C00B4ADBA /* RuntimeType.h in Headers */,
</span><span class="cx">                                 C22B31B9140577D700DB475A /* SamplingCounter.h in Headers */,
</span><span class="cx">                                 0FE050281AA9095600D33B33 /* ScopedArguments.h in Headers */,
</span><span class="lines">@@ -9648,6 +9662,7 @@
</span><span class="cx">                                 0FBF158C19B7A53100695DD0 /* DFGBlockSet.cpp in Sources */,
</span><span class="cx">                                 86EC9DC41328DF82002B2AD7 /* DFGByteCodeParser.cpp in Sources */,
</span><span class="cx">                                 0FD82E2114172CE300179C94 /* DFGCapabilities.cpp in Sources */,
</span><ins>+                                14386A741DD69895008652C4 /* DirectEvalExecutable.cpp in Sources */,
</ins><span class="cx">                                 0FFFC95714EF90A000C72532 /* DFGCFAPhase.cpp in Sources */,
</span><span class="cx">                                 0F3B3A271544C995003ED0FF /* DFGCFGSimplificationPhase.cpp in Sources */,
</span><span class="cx">                                 0F9D36941AE9CC33000D4DFB /* DFGCleanUpPhase.cpp in Sources */,
</span><span class="lines">@@ -9793,6 +9808,7 @@
</span><span class="cx">                                 0FE254F61ABDDD2200A7C6D2 /* DFGVarargsForwardingPhase.cpp in Sources */,
</span><span class="cx">                                 0F6E845A19030BEF00562741 /* DFGVariableAccessData.cpp in Sources */,
</span><span class="cx">                                 0FDDBFB51666EED800C55FEF /* DFGVariableAccessDataDump.cpp in Sources */,
</span><ins>+                                14386A781DD6989C008652C4 /* IndirectEvalExecutable.cpp in Sources */,
</ins><span class="cx">                                 0F9495871C57F47500413A48 /* B3StackSlot.cpp in Sources */,
</span><span class="cx">                                 0F2BDC5115228FFD00CD8910 /* DFGVariableEvent.cpp in Sources */,
</span><span class="cx">                                 AD2FCBF21DB58DAD00B3E736 /* WebAssemblyInstancePrototype.cpp in Sources */,
</span><span class="lines">@@ -10098,7 +10114,6 @@
</span><span class="cx">                                 0FF4275715914A20004CB9FF /* LinkBuffer.cpp in Sources */,
</span><span class="cx">                                 A7E2EA6C0FB460CF00601F06 /* LiteralParser.cpp in Sources */,
</span><span class="cx">                                 A5A1A0951D8CB341004C2EB8 /* DebuggerParseData.cpp in Sources */,
</span><del>-                                53FF7F9D1DC00DB100A26CCC /* WasmFormat.cpp in Sources */,
</del><span class="cx">                                 FE3913541B794F6E00EDAF71 /* LiveObjectList.cpp in Sources */,
</span><span class="cx">                                 FE20CE9D15F04A9500DF3430 /* LLIntCLoop.cpp in Sources */,
</span><span class="cx">                                 0F4680D214BBD16500BFE272 /* LLIntData.cpp in Sources */,
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/CodeBlock.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/bytecode/CodeBlock.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -43,6 +43,7 @@
</span><span class="cx"> #include &quot;DFGExitProfile.h&quot;
</span><span class="cx"> #include &quot;DeferredCompilationCallback.h&quot;
</span><span class="cx"> #include &quot;EvalCodeCache.h&quot;
</span><ins>+#include &quot;EvalExecutable.h&quot;
</ins><span class="cx"> #include &quot;ExecutionCounter.h&quot;
</span><span class="cx"> #include &quot;ExpressionRangeInfo.h&quot;
</span><span class="cx"> #include &quot;FunctionExecutable.h&quot;
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeEvalCodeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/bytecode/EvalCodeCache.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -28,12 +28,7 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><del>-#include &quot;EvalExecutable.h&quot;
-#include &quot;JSGlobalObject.h&quot;
-#include &quot;JSScope.h&quot;
-#include &quot;Options.h&quot;
-#include &quot;SourceCode.h&quot;
-#include &quot;SourceCodeKey.h&quot;
</del><ins>+#include &quot;DirectEvalExecutable.h&quot;
</ins><span class="cx"> #include &lt;wtf/HashMap.h&gt;
</span><span class="cx"> #include &lt;wtf/RefPtr.h&gt;
</span><span class="cx"> #include &lt;wtf/text/StringHash.h&gt;
</span><span class="lines">@@ -44,7 +39,6 @@
</span><span class="cx"> 
</span><span class="cx">     class EvalCodeCache {
</span><span class="cx">     public:
</span><del>-        // Specialized cache key (compared with SourceCodeKey) for eval code cache.
</del><span class="cx">         class CacheKey {
</span><span class="cx">         public:
</span><span class="cx">             CacheKey(const String&amp; source, CallSiteIndex callSiteIndex)
</span><span class="lines">@@ -90,23 +84,15 @@
</span><span class="cx">             CallSiteIndex m_callSiteIndex;
</span><span class="cx">         };
</span><span class="cx"> 
</span><del>-        EvalExecutable* tryGet(const String&amp; evalSource, CallSiteIndex callSiteIndex)
</del><ins>+        DirectEvalExecutable* tryGet(const String&amp; evalSource, CallSiteIndex callSiteIndex)
</ins><span class="cx">         {
</span><span class="cx">             return m_cacheMap.fastGet(CacheKey(evalSource, callSiteIndex)).get();
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        EvalExecutable* getSlow(ExecState* exec, JSCell* owner, const String&amp; evalSource, CallSiteIndex callSiteIndex, bool inStrictContext, DerivedContextType derivedContextType, EvalContextType evalContextType, bool isArrowFunctionContext, JSScope* scope)
</del><ins>+        void set(ExecState* exec, JSCell* owner, const String&amp; evalSource, CallSiteIndex callSiteIndex, DirectEvalExecutable* evalExecutable)
</ins><span class="cx">         {
</span><del>-            VariableEnvironment variablesUnderTDZ;
-            JSScope::collectVariablesUnderTDZ(scope, variablesUnderTDZ);
-            EvalExecutable* evalExecutable = EvalExecutable::create(exec, makeSource(evalSource), inStrictContext, derivedContextType, isArrowFunctionContext, evalContextType, &amp;variablesUnderTDZ);
-            if (!evalExecutable)
-                return nullptr;
-
</del><span class="cx">             if (m_cacheMap.size() &lt; maxCacheEntries)
</span><del>-                m_cacheMap.set(CacheKey(evalSource, callSiteIndex), WriteBarrier&lt;EvalExecutable&gt;(exec-&gt;vm(), owner, evalExecutable));
-
-            return evalExecutable;
</del><ins>+                m_cacheMap.set(CacheKey(evalSource, callSiteIndex), WriteBarrier&lt;DirectEvalExecutable&gt;(exec-&gt;vm(), owner, evalExecutable));
</ins><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         bool isEmpty() const { return m_cacheMap.isEmpty(); }
</span><span class="lines">@@ -121,7 +107,7 @@
</span><span class="cx">     private:
</span><span class="cx">         static const int maxCacheEntries = 64;
</span><span class="cx"> 
</span><del>-        typedef HashMap&lt;CacheKey, WriteBarrier&lt;EvalExecutable&gt;, CacheKey::Hash, CacheKey::HashTraits&gt; EvalCacheMap;
</del><ins>+        typedef HashMap&lt;CacheKey, WriteBarrier&lt;DirectEvalExecutable&gt;, CacheKey::Hash, CacheKey::HashTraits&gt; EvalCacheMap;
</ins><span class="cx">         EvalCacheMap m_cacheMap;
</span><span class="cx">     };
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedEvalCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedEvalCodeBlock.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedEvalCodeBlock.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedEvalCodeBlock.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -30,8 +30,9 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class UnlinkedEvalCodeBlock final : public UnlinkedGlobalCodeBlock {
</span><del>-private:
-    friend class CodeCache;
</del><ins>+public:
+    typedef UnlinkedGlobalCodeBlock Base;
+    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
</ins><span class="cx"> 
</span><span class="cx">     static UnlinkedEvalCodeBlock* create(VM* vm, const ExecutableInfo&amp; info, DebuggerMode debuggerMode)
</span><span class="cx">     {
</span><span class="lines">@@ -40,10 +41,6 @@
</span><span class="cx">         return instance;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-public:
-    typedef UnlinkedGlobalCodeBlock Base;
-    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
-
</del><span class="cx">     static void destroy(JSCell*);
</span><span class="cx"> 
</span><span class="cx">     const Identifier&amp; variable(unsigned index) { return m_variables[index]; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedFunctionExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedFunctionExecutable.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -180,7 +180,7 @@
</span><span class="cx">     ParserError error;
</span><span class="cx">     VM&amp; vm = exec.vm();
</span><span class="cx">     CodeCache* codeCache = vm.codeCache();
</span><del>-    UnlinkedFunctionExecutable* executable = codeCache-&gt;getFunctionExecutableFromGlobalCode(vm, name, source, error);
</del><ins>+    UnlinkedFunctionExecutable* executable = codeCache-&gt;getUnlinkedGlobalFunctionExecutable(vm, name, source, error);
</ins><span class="cx"> 
</span><span class="cx">     auto&amp; globalObject = *exec.lexicalGlobalObject();
</span><span class="cx">     if (globalObject.hasDebugger())
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedModuleProgramCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedModuleProgramCodeBlock.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedModuleProgramCodeBlock.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedModuleProgramCodeBlock.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -30,8 +30,10 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class UnlinkedModuleProgramCodeBlock final : public UnlinkedGlobalCodeBlock {
</span><del>-private:
-    friend class CodeCache;
</del><ins>+public:
+    typedef UnlinkedGlobalCodeBlock Base;
+    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
+
</ins><span class="cx">     static UnlinkedModuleProgramCodeBlock* create(VM* vm, const ExecutableInfo&amp; info, DebuggerMode debuggerMode)
</span><span class="cx">     {
</span><span class="cx">         UnlinkedModuleProgramCodeBlock* instance = new (NotNull, allocateCell&lt;UnlinkedModuleProgramCodeBlock&gt;(vm-&gt;heap)) UnlinkedModuleProgramCodeBlock(vm, vm-&gt;unlinkedModuleProgramCodeBlockStructure.get(), info, debuggerMode);
</span><span class="lines">@@ -39,10 +41,6 @@
</span><span class="cx">         return instance;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-public:
-    typedef UnlinkedGlobalCodeBlock Base;
-    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
-
</del><span class="cx">     static void destroy(JSCell*);
</span><span class="cx"> 
</span><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecodeUnlinkedProgramCodeBlockh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecode/UnlinkedProgramCodeBlock.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecode/UnlinkedProgramCodeBlock.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/bytecode/UnlinkedProgramCodeBlock.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -30,8 +30,10 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class UnlinkedProgramCodeBlock final : public UnlinkedGlobalCodeBlock {
</span><del>-private:
-    friend class CodeCache;
</del><ins>+public:
+    typedef UnlinkedGlobalCodeBlock Base;
+    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
+
</ins><span class="cx">     static UnlinkedProgramCodeBlock* create(VM* vm, const ExecutableInfo&amp; info, DebuggerMode debuggerMode)
</span><span class="cx">     {
</span><span class="cx">         UnlinkedProgramCodeBlock* instance = new (NotNull, allocateCell&lt;UnlinkedProgramCodeBlock&gt;(vm-&gt;heap)) UnlinkedProgramCodeBlock(vm, vm-&gt;unlinkedProgramCodeBlockStructure.get(), info, debuggerMode);
</span><span class="lines">@@ -39,10 +41,6 @@
</span><span class="cx">         return instance;
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-public:
-    typedef UnlinkedGlobalCodeBlock Base;
-    static const unsigned StructureFlags = Base::StructureFlags | StructureIsImmortal;
-
</del><span class="cx">     static void destroy(JSCell*);
</span><span class="cx"> 
</span><span class="cx">     void setVariableDeclarations(const VariableEnvironment&amp; environment) { m_varDeclarations = environment; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoredebuggerDebuggerCallFramecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/debugger/DebuggerCallFrame.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -241,9 +241,9 @@
</span><span class="cx">         evalContextType = EvalContextType::None;
</span><span class="cx"> 
</span><span class="cx">     VariableEnvironment variablesUnderTDZ;
</span><del>-    JSScope::collectVariablesUnderTDZ(scope()-&gt;jsScope(), variablesUnderTDZ);
</del><ins>+    JSScope::collectClosureVariablesUnderTDZ(scope()-&gt;jsScope(), variablesUnderTDZ);
</ins><span class="cx"> 
</span><del>-    EvalExecutable* eval = EvalExecutable::create(callFrame, makeSource(script), codeBlock-&gt;isStrictMode(), codeBlock-&gt;unlinkedCodeBlock()-&gt;derivedContextType(), codeBlock-&gt;unlinkedCodeBlock()-&gt;isArrowFunction(), evalContextType, &amp;variablesUnderTDZ);
</del><ins>+    EvalExecutable* eval = DirectEvalExecutable::create(callFrame, makeSource(script), codeBlock-&gt;isStrictMode(), codeBlock-&gt;unlinkedCodeBlock()-&gt;derivedContextType(), codeBlock-&gt;unlinkedCodeBlock()-&gt;isArrowFunction(), evalContextType, &amp;variablesUnderTDZ);
</ins><span class="cx">     if (UNLIKELY(catchScope.exception())) {
</span><span class="cx">         exception = catchScope.exception();
</span><span class="cx">         catchScope.clearException();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreinterpreterInterpretercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/interpreter/Interpreter.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -131,7 +131,7 @@
</span><span class="cx">     else
</span><span class="cx">         evalContextType = EvalContextType::None;
</span><span class="cx"> 
</span><del>-    EvalExecutable* eval = callerCodeBlock-&gt;evalCodeCache().tryGet(programSource, callerCallSiteIndex);
</del><ins>+    DirectEvalExecutable* eval = callerCodeBlock-&gt;evalCodeCache().tryGet(programSource, callerCallSiteIndex);
</ins><span class="cx">     if (!eval) {
</span><span class="cx">         if (!callerCodeBlock-&gt;isStrictMode()) {
</span><span class="cx">             if (programSource.is8Bit()) {
</span><span class="lines">@@ -148,10 +148,13 @@
</span><span class="cx">         // If the literal parser bailed, it should not have thrown exceptions.
</span><span class="cx">         ASSERT(!scope.exception());
</span><span class="cx"> 
</span><del>-        eval = callerCodeBlock-&gt;evalCodeCache().getSlow(callFrame, callerCodeBlock, programSource, callerCallSiteIndex, callerCodeBlock-&gt;isStrictMode(), derivedContextType, evalContextType, isArrowFunctionContext, callerScopeChain);
-
</del><ins>+        VariableEnvironment variablesUnderTDZ;
+        JSScope::collectClosureVariablesUnderTDZ(callerScopeChain, variablesUnderTDZ);
+        eval = DirectEvalExecutable::create(callFrame, makeSource(programSource), callerCodeBlock-&gt;isStrictMode(), derivedContextType, isArrowFunctionContext, evalContextType, &amp;variablesUnderTDZ);
</ins><span class="cx">         if (!eval)
</span><span class="cx">             return jsUndefined();
</span><ins>+
+        callerCodeBlock-&gt;evalCodeCache().set(callFrame, callerCodeBlock, programSource, callerCallSiteIndex, eval);
</ins><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     JSValue thisValue = callerFrame-&gt;thisValue();
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorellintLLIntOffsetsExtractorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/llint/LLIntOffsetsExtractor.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -29,14 +29,17 @@
</span><span class="cx"> #include &quot;CodeBlock.h&quot;
</span><span class="cx"> #include &quot;CommonSlowPaths.h&quot;
</span><span class="cx"> #include &quot;DirectArguments.h&quot;
</span><ins>+#include &quot;DirectEvalExecutable.h&quot;
+#include &quot;EvalExecutable.h&quot;
</ins><span class="cx"> #include &quot;Exception.h&quot;
</span><span class="cx"> #include &quot;Heap.h&quot;
</span><ins>+#include &quot;IndirectEvalExecutable.h&quot;
</ins><span class="cx"> #include &quot;Interpreter.h&quot;
</span><span class="cx"> #include &quot;JSArray.h&quot;
</span><span class="cx"> #include &quot;JSArrayBufferView.h&quot;
</span><span class="cx"> #include &quot;JSCell.h&quot;
</span><ins>+#include &quot;JSEnvironmentRecord.h&quot;
</ins><span class="cx"> #include &quot;JSFunction.h&quot;
</span><del>-#include &quot;JSEnvironmentRecord.h&quot;
</del><span class="cx"> #include &quot;JSGlobalObject.h&quot;
</span><span class="cx"> #include &quot;JSModuleRecord.h&quot;
</span><span class="cx"> #include &quot;JSObject.h&quot;
</span><span class="lines">@@ -52,13 +55,12 @@
</span><span class="cx"> #include &quot;StructureChain.h&quot;
</span><span class="cx"> #include &quot;TypeProfiler.h&quot;
</span><span class="cx"> #include &quot;TypeProfilerLog.h&quot;
</span><ins>+#include &quot;VM.h&quot;
</ins><span class="cx"> #include &quot;VMEntryRecord.h&quot;
</span><span class="cx"> #include &quot;ValueProfile.h&quot;
</span><del>-#include &quot;VM.h&quot;
</del><span class="cx"> #include &quot;Watchdog.h&quot;
</span><span class="cx"> #include &lt;wtf/text/StringImpl.h&gt;
</span><span class="cx"> 
</span><del>-
</del><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> #define OFFLINE_ASM_OFFSETOF(clazz, field) (static_cast&lt;unsigned&gt;(OBJECT_OFFSETOF(clazz, field)))
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCachecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -26,14 +26,7 @@
</span><span class="cx"> #include &quot;config.h&quot;
</span><span class="cx"> #include &quot;CodeCache.h&quot;
</span><span class="cx"> 
</span><del>-#include &quot;BytecodeGenerator.h&quot;
-#include &quot;JSCInlines.h&quot;
-#include &quot;Parser.h&quot;
-#include &quot;StrongInlines.h&quot;
-#include &quot;UnlinkedCodeBlock.h&quot;
-#include &quot;UnlinkedEvalCodeBlock.h&quot;
-#include &quot;UnlinkedModuleProgramCodeBlock.h&quot;
-#include &quot;UnlinkedProgramCodeBlock.h&quot;
</del><ins>+#include &quot;IndirectEvalExecutable.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="lines">@@ -55,45 +48,15 @@
</span><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-CodeCache::CodeCache()
-{
-}
-
-CodeCache::~CodeCache()
-{
-}
-
-template &lt;typename T&gt; struct CacheTypes { };
-
-template &lt;&gt; struct CacheTypes&lt;UnlinkedProgramCodeBlock&gt; {
-    typedef JSC::ProgramNode RootNode;
-    static const SourceCodeType codeType = SourceCodeType::ProgramType;
-    static const SourceParseMode parseMode = SourceParseMode::ProgramMode;
-};
-
-template &lt;&gt; struct CacheTypes&lt;UnlinkedEvalCodeBlock&gt; {
-    typedef JSC::EvalNode RootNode;
-    static const SourceCodeType codeType = SourceCodeType::EvalType;
-    static const SourceParseMode parseMode = SourceParseMode::ProgramMode;
-};
-
-template &lt;&gt; struct CacheTypes&lt;UnlinkedModuleProgramCodeBlock&gt; {
-    typedef JSC::ModuleProgramNode RootNode;
-    static const SourceCodeType codeType = SourceCodeType::ModuleType;
-    static const SourceParseMode parseMode = SourceParseMode::ModuleEvaluateMode;
-};
-
</del><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, JSParserScriptMode scriptMode, DebuggerMode debuggerMode, ParserError&amp; error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
</del><ins>+UnlinkedCodeBlockType* CodeCache::getUnlinkedGlobalCodeBlock(VM&amp; vm, ExecutableType* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, JSParserScriptMode scriptMode, DebuggerMode debuggerMode, ParserError&amp; error, EvalContextType evalContextType)
</ins><span class="cx"> {
</span><span class="cx">     DerivedContextType derivedContextType = executable-&gt;derivedContextType();
</span><span class="cx">     bool isArrowFunctionContext = executable-&gt;isArrowFunctionContext();
</span><span class="cx">     SourceCodeKey key(source, String(), CacheTypes&lt;UnlinkedCodeBlockType&gt;::codeType, builtinMode, strictMode, scriptMode, derivedContextType, evalContextType, isArrowFunctionContext);
</span><span class="cx">     SourceCodeValue* cache = m_sourceCode.findCacheAndUpdateAge(key);
</span><del>-    // FIXME: We should do something smart for TDZ instead of just disabling caching.
-    // https://bugs.webkit.org/show_bug.cgi?id=154010
-    bool canCache = debuggerMode == DebuggerOff &amp;&amp; !vm.typeProfiler() &amp;&amp; !vm.controlFlowProfiler() &amp;&amp; !variablesUnderTDZ-&gt;size();
-    if (cache &amp;&amp; canCache &amp;&amp; Options::useCodeCache()) {
</del><ins>+    bool canCache = debuggerMode == DebuggerOff &amp;&amp; !vm.typeProfiler() &amp;&amp; !vm.controlFlowProfiler() &amp;&amp; Options::useCodeCache();
+    if (cache &amp;&amp; canCache) {
</ins><span class="cx">         UnlinkedCodeBlockType* unlinkedCodeBlock = jsCast&lt;UnlinkedCodeBlockType*&gt;(cache-&gt;cell.get());
</span><span class="cx">         unsigned firstLine = source.firstLine() + unlinkedCodeBlock-&gt;firstLine();
</span><span class="cx">         unsigned lineCount = unlinkedCodeBlock-&gt;lineCount();
</span><span class="lines">@@ -105,56 +68,32 @@
</span><span class="cx">         source.provider()-&gt;setSourceMappingURLDirective(unlinkedCodeBlock-&gt;sourceMappingURLDirective());
</span><span class="cx">         return unlinkedCodeBlock;
</span><span class="cx">     }
</span><del>-    typedef typename CacheTypes&lt;UnlinkedCodeBlockType&gt;::RootNode RootNode;
-    std::unique_ptr&lt;RootNode&gt; rootNode = parse&lt;RootNode&gt;(
-        &amp;vm, source, Identifier(), builtinMode, strictMode, scriptMode, CacheTypes&lt;UnlinkedCodeBlockType&gt;::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, derivedContextType, evalContextType);
-    if (!rootNode)
-        return nullptr;
</del><ins>+    
+    VariableEnvironment variablesUnderTDZ;
+    UnlinkedCodeBlockType* unlinkedCodeBlock = generateUnlinkedCodeBlock&lt;UnlinkedCodeBlockType, ExecutableType&gt;(vm, executable, source, builtinMode, strictMode, scriptMode, debuggerMode, error, evalContextType, &amp;variablesUnderTDZ);
</ins><span class="cx"> 
</span><del>-    unsigned lineCount = rootNode-&gt;lastLine() - rootNode-&gt;firstLine();
-    unsigned startColumn = rootNode-&gt;startColumn() + 1;
-    bool endColumnIsOnStartLine = !lineCount;
-    unsigned unlinkedEndColumn = rootNode-&gt;endColumn();
-    unsigned endColumn = unlinkedEndColumn + (endColumnIsOnStartLine ? startColumn : 1);
-    unsigned arrowContextFeature = executable-&gt;isArrowFunctionContext() ? ArrowFunctionContextFeature : 0;
-    executable-&gt;recordParse(rootNode-&gt;features() | arrowContextFeature, rootNode-&gt;hasCapturedVariables(), rootNode-&gt;firstLine(), rootNode-&gt;lastLine(), startColumn, endColumn);
</del><ins>+    if (unlinkedCodeBlock &amp;&amp; canCache)
+        m_sourceCode.addCache(key, SourceCodeValue(vm, unlinkedCodeBlock, m_sourceCode.age()));
</ins><span class="cx"> 
</span><del>-    UnlinkedCodeBlockType* unlinkedCodeBlock = UnlinkedCodeBlockType::create(&amp;vm, executable-&gt;executableInfo(), debuggerMode);
-    unlinkedCodeBlock-&gt;recordParse(rootNode-&gt;features(), rootNode-&gt;hasCapturedVariables(), rootNode-&gt;firstLine() - source.firstLine(), lineCount, unlinkedEndColumn);
-    unlinkedCodeBlock-&gt;setSourceURLDirective(source.provider()-&gt;sourceURL());
-    unlinkedCodeBlock-&gt;setSourceMappingURLDirective(source.provider()-&gt;sourceMappingURL());
-
-    error = BytecodeGenerator::generate(vm, rootNode.get(), unlinkedCodeBlock, debuggerMode, variablesUnderTDZ);
-
-    if (error.isValid())
-        return nullptr;
-
-    if (!canCache)
-        return unlinkedCodeBlock;
-
-    m_sourceCode.addCache(key, SourceCodeValue(vm, unlinkedCodeBlock, m_sourceCode.age()));
</del><span class="cx">     return unlinkedCodeBlock;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-UnlinkedProgramCodeBlock* CodeCache::getProgramCodeBlock(VM&amp; vm, ProgramExecutable* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError&amp; error)
</del><ins>+UnlinkedProgramCodeBlock* CodeCache::getUnlinkedProgramCodeBlock(VM&amp; vm, ProgramExecutable* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError&amp; error)
</ins><span class="cx"> {
</span><del>-    VariableEnvironment emptyParentTDZVariables;
-    return getGlobalCodeBlock&lt;UnlinkedProgramCodeBlock&gt;(vm, executable, source, builtinMode, strictMode, JSParserScriptMode::Classic, debuggerMode, error, EvalContextType::None, &amp;emptyParentTDZVariables);
</del><ins>+    return getUnlinkedGlobalCodeBlock&lt;UnlinkedProgramCodeBlock&gt;(vm, executable, source, builtinMode, strictMode, JSParserScriptMode::Classic, debuggerMode, error, EvalContextType::None);
</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, ParserError&amp; error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
</del><ins>+UnlinkedEvalCodeBlock* CodeCache::getUnlinkedGlobalEvalCodeBlock(VM&amp; vm, IndirectEvalExecutable* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, DebuggerMode debuggerMode, ParserError&amp; error, EvalContextType evalContextType)
</ins><span class="cx"> {
</span><del>-    return getGlobalCodeBlock&lt;UnlinkedEvalCodeBlock&gt;(vm, executable, source, builtinMode, strictMode, JSParserScriptMode::Classic, debuggerMode, error, evalContextType, variablesUnderTDZ);
</del><ins>+    return getUnlinkedGlobalCodeBlock&lt;UnlinkedEvalCodeBlock&gt;(vm, executable, source, builtinMode, strictMode, JSParserScriptMode::Classic, debuggerMode, error, evalContextType);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-UnlinkedModuleProgramCodeBlock* CodeCache::getModuleProgramCodeBlock(VM&amp; vm, ModuleProgramExecutable* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, DebuggerMode debuggerMode, ParserError&amp; error)
</del><ins>+UnlinkedModuleProgramCodeBlock* CodeCache::getUnlinkedModuleProgramCodeBlock(VM&amp; vm, ModuleProgramExecutable* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, DebuggerMode debuggerMode, ParserError&amp; error)
</ins><span class="cx"> {
</span><del>-    VariableEnvironment emptyParentTDZVariables;
-    return getGlobalCodeBlock&lt;UnlinkedModuleProgramCodeBlock&gt;(vm, executable, source, builtinMode, JSParserStrictMode::Strict, JSParserScriptMode::Module, debuggerMode, error, EvalContextType::None, &amp;emptyParentTDZVariables);
</del><ins>+    return getUnlinkedGlobalCodeBlock&lt;UnlinkedModuleProgramCodeBlock&gt;(vm, executable, source, builtinMode, JSParserStrictMode::Strict, JSParserScriptMode::Module, debuggerMode, error, EvalContextType::None);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><del>-// FIXME: There's no need to add the function's name to the key here. It's already in the source code.
-UnlinkedFunctionExecutable* CodeCache::getFunctionExecutableFromGlobalCode(VM&amp; vm, const Identifier&amp; name, const SourceCode&amp; source, ParserError&amp; error)
</del><ins>+UnlinkedFunctionExecutable* CodeCache::getUnlinkedGlobalFunctionExecutable(VM&amp; vm, const Identifier&amp; name, const SourceCode&amp; source, ParserError&amp; error)
</ins><span class="cx"> {
</span><span class="cx">     bool isArrowFunctionContext = false;
</span><span class="cx">     SourceCodeKey key(
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeCodeCacheh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/CodeCache.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/CodeCache.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/CodeCache.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -25,11 +25,19 @@
</span><span class="cx"> 
</span><span class="cx"> #pragma once
</span><span class="cx"> 
</span><ins>+#include &quot;BytecodeGenerator.h&quot;
</ins><span class="cx"> #include &quot;ExecutableInfo.h&quot;
</span><ins>+#include &quot;JSCInlines.h&quot;
+#include &quot;Parser.h&quot;
</ins><span class="cx"> #include &quot;ParserModes.h&quot;
</span><span class="cx"> #include &quot;SourceCode.h&quot;
</span><span class="cx"> #include &quot;SourceCodeKey.h&quot;
</span><span class="cx"> #include &quot;Strong.h&quot;
</span><ins>+#include &quot;StrongInlines.h&quot;
+#include &quot;UnlinkedCodeBlock.h&quot;
+#include &quot;UnlinkedEvalCodeBlock.h&quot;
+#include &quot;UnlinkedModuleProgramCodeBlock.h&quot;
+#include &quot;UnlinkedProgramCodeBlock.h&quot;
</ins><span class="cx"> #include &lt;wtf/CurrentTime.h&gt;
</span><span class="cx"> #include &lt;wtf/Forward.h&gt;
</span><span class="cx"> #include &lt;wtf/text/WTFString.h&gt;
</span><span class="lines">@@ -37,7 +45,9 @@
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><span class="cx"> class EvalExecutable;
</span><ins>+class IndirectEvalExecutable;
</ins><span class="cx"> class Identifier;
</span><ins>+class DirectEvalExecutable;
</ins><span class="cx"> class ModuleProgramExecutable;
</span><span class="cx"> class ParserError;
</span><span class="cx"> class ProgramExecutable;
</span><span class="lines">@@ -179,28 +189,73 @@
</span><span class="cx">     int64_t m_age;
</span><span class="cx"> };
</span><span class="cx"> 
</span><del>-// Caches top-level code such as &lt;script&gt;, eval(), new Function, and JSEvaluateScript().
</del><ins>+// Caches top-level code such as &lt;script&gt;, window.eval(), new Function, and JSEvaluateScript().
</ins><span class="cx"> class CodeCache {
</span><span class="cx">     WTF_MAKE_FAST_ALLOCATED;
</span><span class="cx"> public:
</span><del>-    CodeCache();
-    ~CodeCache();
</del><ins>+    UnlinkedProgramCodeBlock* getUnlinkedProgramCodeBlock(VM&amp;, ProgramExecutable*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&amp;);
+    UnlinkedEvalCodeBlock* getUnlinkedGlobalEvalCodeBlock(VM&amp;, IndirectEvalExecutable*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&amp;, EvalContextType);
+    UnlinkedModuleProgramCodeBlock* getUnlinkedModuleProgramCodeBlock(VM&amp;, ModuleProgramExecutable*, const SourceCode&amp;, JSParserBuiltinMode, DebuggerMode, ParserError&amp;);
+    UnlinkedFunctionExecutable* getUnlinkedGlobalFunctionExecutable(VM&amp;, const Identifier&amp;, const SourceCode&amp;, ParserError&amp;);
</ins><span class="cx"> 
</span><del>-    UnlinkedProgramCodeBlock* getProgramCodeBlock(VM&amp;, ProgramExecutable*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&amp;);
-    UnlinkedEvalCodeBlock* getEvalCodeBlock(VM&amp;, EvalExecutable*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, DebuggerMode, ParserError&amp;, EvalContextType, const VariableEnvironment*);
-    UnlinkedModuleProgramCodeBlock* getModuleProgramCodeBlock(VM&amp;, ModuleProgramExecutable*, const SourceCode&amp;, JSParserBuiltinMode, DebuggerMode, ParserError&amp;);
-    UnlinkedFunctionExecutable* getFunctionExecutableFromGlobalCode(VM&amp;, const Identifier&amp;, const SourceCode&amp;, ParserError&amp;);
</del><ins>+    void clear() { m_sourceCode.clear(); }
</ins><span class="cx"> 
</span><del>-    void clear()
-    {
-        m_sourceCode.clear();
-    }
-
</del><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, JSParserScriptMode, DebuggerMode, ParserError&amp;, EvalContextType, const VariableEnvironment*);
</del><ins>+    UnlinkedCodeBlockType* getUnlinkedGlobalCodeBlock(VM&amp;, ExecutableType*, const SourceCode&amp;, JSParserBuiltinMode, JSParserStrictMode, JSParserScriptMode, DebuggerMode, ParserError&amp;, EvalContextType);
</ins><span class="cx"> 
</span><span class="cx">     CodeCacheMap m_sourceCode;
</span><span class="cx"> };
</span><span class="cx"> 
</span><ins>+template &lt;typename T&gt; struct CacheTypes { };
+
+template &lt;&gt; struct CacheTypes&lt;UnlinkedProgramCodeBlock&gt; {
+    typedef JSC::ProgramNode RootNode;
+    static const SourceCodeType codeType = SourceCodeType::ProgramType;
+    static const SourceParseMode parseMode = SourceParseMode::ProgramMode;
+};
+
+template &lt;&gt; struct CacheTypes&lt;UnlinkedEvalCodeBlock&gt; {
+    typedef JSC::EvalNode RootNode;
+    static const SourceCodeType codeType = SourceCodeType::EvalType;
+    static const SourceParseMode parseMode = SourceParseMode::ProgramMode;
+};
+
+template &lt;&gt; struct CacheTypes&lt;UnlinkedModuleProgramCodeBlock&gt; {
+    typedef JSC::ModuleProgramNode RootNode;
+    static const SourceCodeType codeType = SourceCodeType::ModuleType;
+    static const SourceParseMode parseMode = SourceParseMode::ModuleEvaluateMode;
+};
+
+template &lt;class UnlinkedCodeBlockType, class ExecutableType&gt;
+UnlinkedCodeBlockType* generateUnlinkedCodeBlock(VM&amp; vm, ExecutableType* executable, const SourceCode&amp; source, JSParserBuiltinMode builtinMode, JSParserStrictMode strictMode, JSParserScriptMode scriptMode, DebuggerMode debuggerMode, ParserError&amp; error, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
+{
+    typedef typename CacheTypes&lt;UnlinkedCodeBlockType&gt;::RootNode RootNode;
+    DerivedContextType derivedContextType = executable-&gt;derivedContextType();
+    std::unique_ptr&lt;RootNode&gt; rootNode = parse&lt;RootNode&gt;(
+        &amp;vm, source, Identifier(), builtinMode, strictMode, scriptMode, CacheTypes&lt;UnlinkedCodeBlockType&gt;::parseMode, SuperBinding::NotNeeded, error, nullptr, ConstructorKind::None, derivedContextType, evalContextType);
+    if (!rootNode)
+        return nullptr;
+
+    unsigned lineCount = rootNode-&gt;lastLine() - rootNode-&gt;firstLine();
+    unsigned startColumn = rootNode-&gt;startColumn() + 1;
+    bool endColumnIsOnStartLine = !lineCount;
+    unsigned unlinkedEndColumn = rootNode-&gt;endColumn();
+    unsigned endColumn = unlinkedEndColumn + (endColumnIsOnStartLine ? startColumn : 1);
+    unsigned arrowContextFeature = executable-&gt;isArrowFunctionContext() ? ArrowFunctionContextFeature : 0;
+    executable-&gt;recordParse(rootNode-&gt;features() | arrowContextFeature, rootNode-&gt;hasCapturedVariables(), rootNode-&gt;firstLine(), rootNode-&gt;lastLine(), startColumn, endColumn);
+
+    UnlinkedCodeBlockType* unlinkedCodeBlock = UnlinkedCodeBlockType::create(&amp;vm, executable-&gt;executableInfo(), debuggerMode);
+    unlinkedCodeBlock-&gt;recordParse(rootNode-&gt;features(), rootNode-&gt;hasCapturedVariables(), rootNode-&gt;firstLine() - source.firstLine(), lineCount, unlinkedEndColumn);
+    unlinkedCodeBlock-&gt;setSourceURLDirective(source.provider()-&gt;sourceURL());
+    unlinkedCodeBlock-&gt;setSourceMappingURLDirective(source.provider()-&gt;sourceMappingURL());
+
+    error = BytecodeGenerator::generate(vm, rootNode.get(), unlinkedCodeBlock, debuggerMode, variablesUnderTDZ);
+
+    if (error.isValid())
+        return nullptr;
+
+    return unlinkedCodeBlock;
+}
+
</ins><span class="cx"> } // namespace JSC
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDirectEvalExecutablecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp (0 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+#include &quot;DirectEvalExecutable.h&quot;
+
+#include &quot;Error.h&quot;
+#include &quot;HeapInlines.h&quot;
+#include &quot;JSCJSValueInlines.h&quot;
+
+namespace JSC {
+
+DirectEvalExecutable* DirectEvalExecutable::create(ExecState* exec, const SourceCode&amp; source, bool isInStrictContext, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
+{
+    VM&amp; vm = exec-&gt;vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
+    if (!globalObject-&gt;evalEnabled()) {
+        throwException(exec, scope, createEvalError(exec, globalObject-&gt;evalDisabledErrorMessage()));
+        return 0;
+    }
+
+    auto* executable = new (NotNull, allocateCell&lt;DirectEvalExecutable&gt;(*exec-&gt;heap())) DirectEvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
+    executable-&gt;finishCreation(vm);
+
+    UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject-&gt;createLocalEvalCodeBlock(exec, executable, variablesUnderTDZ);
+    if (!unlinkedEvalCode)
+        return 0;
+
+    executable-&gt;m_unlinkedEvalCodeBlock.set(vm, executable, unlinkedEvalCode);
+
+    return executable;
+}
+
+DirectEvalExecutable::DirectEvalExecutable(ExecState* exec, const SourceCode&amp; source, bool inStrictContext, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType)
+    : EvalExecutable(exec, source, inStrictContext, derivedContextType, isArrowFunctionContext, evalContextType)
+{
+}
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeDirectEvalExecutableh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.h (0 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/DirectEvalExecutable.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#include &quot;EvalExecutable.h&quot;
+
+namespace JSC {
+
+class DirectEvalExecutable final : public EvalExecutable {
+public:
+    static DirectEvalExecutable* create(ExecState*, const SourceCode&amp;, bool isInStrictContext, DerivedContextType, bool isArrowFunctionContext, EvalContextType, const VariableEnvironment*);
+private:
+    DirectEvalExecutable(ExecState*, const SourceCode&amp;, bool inStrictContext, DerivedContextType, bool isArrowFunctionContext, EvalContextType);
+};
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeEvalExecutablecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/EvalExecutable.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/EvalExecutable.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/EvalExecutable.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -24,47 +24,17 @@
</span><span class="cx">  */
</span><span class="cx"> 
</span><span class="cx"> #include &quot;config.h&quot;
</span><ins>+#include &quot;EvalExecutable.h&quot;
</ins><span class="cx"> 
</span><del>-#include &quot;BatchedTransitionOptimizer.h&quot;
-#include &quot;CodeBlock.h&quot;
-#include &quot;Debugger.h&quot;
</del><span class="cx"> #include &quot;EvalCodeBlock.h&quot;
</span><del>-#include &quot;FunctionCodeBlock.h&quot;
-#include &quot;JIT.h&quot;
-#include &quot;JSCInlines.h&quot;
-#include &quot;LLIntEntrypoint.h&quot;
-#include &quot;Parser.h&quot;
-#include &quot;TypeProfiler.h&quot;
-#include &quot;VMInlines.h&quot;
-#include &lt;wtf/CommaPrinter.h&gt;
</del><ins>+#include &quot;HeapCellInlines.h&quot;
+#include &quot;JSCJSValueInlines.h&quot;
+#include &quot;SlotVisitorInlines.h&quot;
</ins><span class="cx"> 
</span><span class="cx"> namespace JSC {
</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, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType, const VariableEnvironment* variablesUnderTDZ)
-{
-    VM&amp; vm = exec-&gt;vm();
-    auto scope = DECLARE_THROW_SCOPE(vm);
-
-    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
-    if (!globalObject-&gt;evalEnabled()) {
-        throwException(exec, scope, createEvalError(exec, globalObject-&gt;evalDisabledErrorMessage()));
-        return 0;
-    }
-
-    EvalExecutable* executable = new (NotNull, allocateCell&lt;EvalExecutable&gt;(*exec-&gt;heap())) EvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
-    executable-&gt;finishCreation(vm);
-
-    UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject-&gt;createEvalCodeBlock(exec, executable, variablesUnderTDZ);
-    if (!unlinkedEvalCode)
-        return 0;
-
-    executable-&gt;m_unlinkedEvalCodeBlock.set(vm, executable, unlinkedEvalCode);
-
-    return executable;
-}
-
</del><span class="cx"> EvalExecutable::EvalExecutable(ExecState* exec, const SourceCode&amp; source, bool inStrictContext, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType)
</span><span class="cx">     : ScriptExecutable(exec-&gt;vm().evalExecutableStructure.get(), exec-&gt;vm(), source, inStrictContext, derivedContextType, isArrowFunctionContext, evalContextType, NoIntrinsic)
</span><span class="cx"> {
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeEvalExecutableh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/EvalExecutable.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/EvalExecutable.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/EvalExecutable.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -30,7 +30,7 @@
</span><span class="cx"> 
</span><span class="cx"> namespace JSC {
</span><span class="cx"> 
</span><del>-class EvalExecutable final : public ScriptExecutable {
</del><ins>+class EvalExecutable : public ScriptExecutable {
</ins><span class="cx">     friend class LLIntOffsetsExtractor;
</span><span class="cx"> public:
</span><span class="cx">     typedef ScriptExecutable Base;
</span><span class="lines">@@ -43,8 +43,6 @@
</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, DerivedContextType, bool isArrowFunctionContext, EvalContextType, const VariableEnvironment*);
-
</del><span class="cx">     PassRefPtr&lt;JITCode&gt; generatedJITCode()
</span><span class="cx">     {
</span><span class="cx">         return generatedJITCodeForCall();
</span><span class="lines">@@ -54,7 +52,7 @@
</span><span class="cx">     {
</span><span class="cx">         return Structure::create(vm, globalObject, proto, TypeInfo(EvalExecutableType, StructureFlags), info());
</span><span class="cx">     }
</span><del>-        
</del><ins>+
</ins><span class="cx">     DECLARE_INFO;
</span><span class="cx"> 
</span><span class="cx">     ExecutableInfo executableInfo() const { return ExecutableInfo(usesEval(), isStrictMode(), false, false, ConstructorKind::None, JSParserScriptMode::Classic, SuperBinding::NotNeeded, SourceParseMode::ProgramMode, derivedContextType(), isArrowFunctionContext(), false, evalContextType()); }
</span><span class="lines">@@ -62,10 +60,11 @@
</span><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><del>-private:
</del><ins>+protected:
</ins><span class="cx">     friend class ExecutableBase;
</span><span class="cx">     friend class ScriptExecutable;
</span><span class="cx"> 
</span><ins>+    using Base::finishCreation;
</ins><span class="cx">     EvalExecutable(ExecState*, const SourceCode&amp;, bool inStrictContext, DerivedContextType, bool isArrowFunctionContext, EvalContextType);
</span><span class="cx"> 
</span><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeIndirectEvalExecutablecpp"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp (0 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -0,0 +1,63 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#include &quot;config.h&quot;
+#include &quot;IndirectEvalExecutable.h&quot;
+
+#include &quot;Error.h&quot;
+#include &quot;HeapInlines.h&quot;
+#include &quot;JSCJSValueInlines.h&quot;
+
+namespace JSC {
+
+IndirectEvalExecutable* IndirectEvalExecutable::create(ExecState* exec, const SourceCode&amp; source, bool isInStrictContext, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType)
+{
+    VM&amp; vm = exec-&gt;vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    JSGlobalObject* globalObject = exec-&gt;lexicalGlobalObject();
+    if (!globalObject-&gt;evalEnabled()) {
+        throwException(exec, scope, createEvalError(exec, globalObject-&gt;evalDisabledErrorMessage()));
+        return 0;
+    }
+
+    auto* executable = new (NotNull, allocateCell&lt;IndirectEvalExecutable&gt;(*exec-&gt;heap())) IndirectEvalExecutable(exec, source, isInStrictContext, derivedContextType, isArrowFunctionContext, evalContextType);
+    executable-&gt;finishCreation(vm);
+
+    UnlinkedEvalCodeBlock* unlinkedEvalCode = globalObject-&gt;createGlobalEvalCodeBlock(exec, executable);
+    if (!unlinkedEvalCode)
+        return 0;
+
+    executable-&gt;m_unlinkedEvalCodeBlock.set(vm, executable, unlinkedEvalCode);
+
+    return executable;
+}
+
+IndirectEvalExecutable::IndirectEvalExecutable(ExecState* exec, const SourceCode&amp; source, bool inStrictContext, DerivedContextType derivedContextType, bool isArrowFunctionContext, EvalContextType evalContextType)
+    : EvalExecutable(exec, source, inStrictContext, derivedContextType, isArrowFunctionContext, evalContextType)
+{
+}
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeIndirectEvalExecutableh"></a>
<div class="addfile"><h4>Added: trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.h (0 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.h                                (rev 0)
+++ trunk/Source/JavaScriptCore/runtime/IndirectEvalExecutable.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -0,0 +1,39 @@
</span><ins>+/*
+ * Copyright (C) 2016 Apple Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the distribution.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
+ * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
+ * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
+ */
+
+#pragma once
+
+#include &quot;EvalExecutable.h&quot;
+
+namespace JSC {
+
+class IndirectEvalExecutable final : public EvalExecutable {
+public:
+    static IndirectEvalExecutable* create(ExecState*, const SourceCode&amp;, bool isInStrictContext, DerivedContextType, bool isArrowFunctionContext, EvalContextType);
+private:
+    IndirectEvalExecutable(ExecState*, const SourceCode&amp;, bool inStrictContext, DerivedContextType, bool isArrowFunctionContext, EvalContextType);
+};
+
+} // namespace JSC
</ins></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -49,6 +49,7 @@
</span><span class="cx"> #include &quot;Debugger.h&quot;
</span><span class="cx"> #include &quot;DebuggerScope.h&quot;
</span><span class="cx"> #include &quot;DirectArguments.h&quot;
</span><ins>+#include &quot;DirectEvalExecutable.h&quot;
</ins><span class="cx"> #include &quot;ECMAScriptSpecInternalFunctions.h&quot;
</span><span class="cx"> #include &quot;Error.h&quot;
</span><span class="cx"> #include &quot;ErrorConstructor.h&quot;
</span><span class="lines">@@ -60,6 +61,7 @@
</span><span class="cx"> #include &quot;GeneratorPrototype.h&quot;
</span><span class="cx"> #include &quot;GetterSetter.h&quot;
</span><span class="cx"> #include &quot;HeapIterationScope.h&quot;
</span><ins>+#include &quot;IndirectEvalExecutable.h&quot;
</ins><span class="cx"> #include &quot;InspectorInstrumentationObject.h&quot;
</span><span class="cx"> #include &quot;Interpreter.h&quot;
</span><span class="cx"> #include &quot;IteratorPrototype.h&quot;
</span><span class="lines">@@ -1317,7 +1319,7 @@
</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 = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
</span><del>-    UnlinkedProgramCodeBlock* unlinkedCodeBlock = vm().codeCache()-&gt;getProgramCodeBlock(
</del><ins>+    UnlinkedProgramCodeBlock* unlinkedCodeBlock = vm().codeCache()-&gt;getUnlinkedProgramCodeBlock(
</ins><span class="cx">         vm(), executable, executable-&gt;source(), JSParserBuiltinMode::NotBuiltin, strictMode, 
</span><span class="cx">         debuggerMode, error);
</span><span class="cx"> 
</span><span class="lines">@@ -1332,7 +1334,7 @@
</span><span class="cx">     return unlinkedCodeBlock;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-UnlinkedEvalCodeBlock* JSGlobalObject::createEvalCodeBlock(CallFrame* callFrame, EvalExecutable* executable, const VariableEnvironment* variablesUnderTDZ)
</del><ins>+UnlinkedEvalCodeBlock* JSGlobalObject::createLocalEvalCodeBlock(CallFrame* callFrame, DirectEvalExecutable* executable, const VariableEnvironment* variablesUnderTDZ)
</ins><span class="cx"> {
</span><span class="cx">     VM&amp; vm = this-&gt;vm();
</span><span class="cx">     auto scope = DECLARE_THROW_SCOPE(vm);
</span><span class="lines">@@ -1341,9 +1343,34 @@
</span><span class="cx">     JSParserStrictMode strictMode = executable-&gt;isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
</span><span class="cx">     DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
</span><span class="cx">     EvalContextType evalContextType = executable-&gt;executableInfo().evalContextType();
</span><ins>+
+    // We don't bother with CodeCache here because local eval uses a specialized EvalCodeCache.
+    UnlinkedEvalCodeBlock* unlinkedCodeBlock = generateUnlinkedCodeBlock&lt;UnlinkedEvalCodeBlock&gt;(
+        vm, executable, executable-&gt;source(), JSParserBuiltinMode::NotBuiltin, strictMode, JSParserScriptMode::Classic, debuggerMode, error, evalContextType, variablesUnderTDZ);
+
+    if (hasDebugger())
+        debugger()-&gt;sourceParsed(callFrame, executable-&gt;source().provider(), error.line(), error.message());
+
+    if (error.isValid()) {
+        throwVMError(callFrame, scope, error.toErrorObject(this, executable-&gt;source()));
+        return nullptr;
+    }
+
+    return unlinkedCodeBlock;
+}
+
+UnlinkedEvalCodeBlock* JSGlobalObject::createGlobalEvalCodeBlock(CallFrame* callFrame, IndirectEvalExecutable* executable)
+{
+    VM&amp; vm = this-&gt;vm();
+    auto scope = DECLARE_THROW_SCOPE(vm);
+
+    ParserError error;
+    JSParserStrictMode strictMode = executable-&gt;isStrictMode() ? JSParserStrictMode::Strict : JSParserStrictMode::NotStrict;
+    DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
+    EvalContextType evalContextType = executable-&gt;executableInfo().evalContextType();
</ins><span class="cx">     
</span><del>-    UnlinkedEvalCodeBlock* unlinkedCodeBlock = vm.codeCache()-&gt;getEvalCodeBlock(
-        vm, executable, executable-&gt;source(), JSParserBuiltinMode::NotBuiltin, strictMode, debuggerMode, error, evalContextType, variablesUnderTDZ);
</del><ins>+    UnlinkedEvalCodeBlock* unlinkedCodeBlock = vm.codeCache()-&gt;getUnlinkedGlobalEvalCodeBlock(
+        vm, executable, executable-&gt;source(), JSParserBuiltinMode::NotBuiltin, strictMode, debuggerMode, error, evalContextType);
</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 class="lines">@@ -1363,7 +1390,7 @@
</span><span class="cx"> 
</span><span class="cx">     ParserError error;
</span><span class="cx">     DebuggerMode debuggerMode = hasInteractiveDebugger() ? DebuggerOn : DebuggerOff;
</span><del>-    UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock = vm.codeCache()-&gt;getModuleProgramCodeBlock(
</del><ins>+    UnlinkedModuleProgramCodeBlock* unlinkedCodeBlock = vm.codeCache()-&gt;getUnlinkedModuleProgramCodeBlock(
</ins><span class="cx">         vm, executable, executable-&gt;source(), JSParserBuiltinMode::NotBuiltin, debuggerMode, error);
</span><span class="cx"> 
</span><span class="cx">     if (hasDebugger())
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjecth"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObject.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -71,6 +71,7 @@
</span><span class="cx"> class GeneratorFunctionPrototype;
</span><span class="cx"> class GetterSetter;
</span><span class="cx"> class GlobalCodeBlock;
</span><ins>+class IndirectEvalExecutable;
</ins><span class="cx"> class InputCursor;
</span><span class="cx"> class JSArrayBuffer;
</span><span class="cx"> class JSArrayBufferConstructor;
</span><span class="lines">@@ -86,6 +87,7 @@
</span><span class="cx"> class JSSharedArrayBufferPrototype;
</span><span class="cx"> class JSTypedArrayViewConstructor;
</span><span class="cx"> class JSTypedArrayViewPrototype;
</span><ins>+class DirectEvalExecutable;
</ins><span class="cx"> class LLIntOffsetsExtractor;
</span><span class="cx"> class Microtask;
</span><span class="cx"> class ModuleLoaderPrototype;
</span><span class="lines">@@ -827,7 +829,8 @@
</span><span class="cx">     WeakRandom&amp; weakRandom() { return m_weakRandom; }
</span><span class="cx"> 
</span><span class="cx">     UnlinkedProgramCodeBlock* createProgramCodeBlock(CallFrame*, ProgramExecutable*, JSObject** exception);
</span><del>-    UnlinkedEvalCodeBlock* createEvalCodeBlock(CallFrame*, EvalExecutable*, const VariableEnvironment*);
</del><ins>+    UnlinkedEvalCodeBlock* createLocalEvalCodeBlock(CallFrame*, DirectEvalExecutable*, const VariableEnvironment*);
+    UnlinkedEvalCodeBlock* createGlobalEvalCodeBlock(CallFrame*, IndirectEvalExecutable*);
</ins><span class="cx">     UnlinkedModuleProgramCodeBlock* createModuleProgramCodeBlock(CallFrame*, ModuleProgramExecutable*);
</span><span class="cx"> 
</span><span class="cx">     bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSGlobalObjectFunctionscpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/JSGlobalObjectFunctions.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -27,6 +27,7 @@
</span><span class="cx"> 
</span><span class="cx"> #include &quot;CallFrame.h&quot;
</span><span class="cx"> #include &quot;EvalExecutable.h&quot;
</span><ins>+#include &quot;IndirectEvalExecutable.h&quot;
</ins><span class="cx"> #include &quot;Interpreter.h&quot;
</span><span class="cx"> #include &quot;JSFunction.h&quot;
</span><span class="cx"> #include &quot;JSGlobalObject.h&quot;
</span><span class="lines">@@ -680,8 +681,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     JSGlobalObject* calleeGlobalObject = exec-&gt;callee()-&gt;globalObject();
</span><del>-    VariableEnvironment emptyTDZVariables; // Indirect eval does not have access to the lexical scope.
-    EvalExecutable* eval = EvalExecutable::create(exec, makeSource(s), false, DerivedContextType::None, false, EvalContextType::None, &amp;emptyTDZVariables);
</del><ins>+    EvalExecutable* eval = IndirectEvalExecutable::create(exec, makeSource(s), false, DerivedContextType::None, false, EvalContextType::None);
</ins><span class="cx">     if (!eval)
</span><span class="cx">         return JSValue::encode(jsUndefined());
</span><span class="cx"> 
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSScopecpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSScope.cpp (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSScope.cpp        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/JSScope.cpp        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -263,10 +263,10 @@
</span><span class="cx">     return op;
</span><span class="cx"> }
</span><span class="cx"> 
</span><del>-void JSScope::collectVariablesUnderTDZ(JSScope* scope, VariableEnvironment&amp; result)
</del><ins>+void JSScope::collectClosureVariablesUnderTDZ(JSScope* scope, VariableEnvironment&amp; result)
</ins><span class="cx"> {
</span><span class="cx">     for (; scope; scope = scope-&gt;next()) {
</span><del>-        if (!scope-&gt;isLexicalScope() &amp;&amp; !scope-&gt;isGlobalLexicalEnvironment() &amp;&amp; !scope-&gt;isCatchScope())
</del><ins>+        if (!scope-&gt;isLexicalScope() &amp;&amp; !scope-&gt;isCatchScope())
</ins><span class="cx">             continue;
</span><span class="cx"> 
</span><span class="cx">         if (scope-&gt;isModuleScope()) {
</span><span class="lines">@@ -276,7 +276,7 @@
</span><span class="cx">         }
</span><span class="cx"> 
</span><span class="cx">         SymbolTable* symbolTable = jsCast&lt;JSSymbolTableObject*&gt;(scope)-&gt;symbolTable();
</span><del>-        ASSERT(symbolTable-&gt;scopeType() == SymbolTable::ScopeType::LexicalScope || symbolTable-&gt;scopeType() == SymbolTable::ScopeType::GlobalLexicalScope || symbolTable-&gt;scopeType() == SymbolTable::ScopeType::CatchScope);
</del><ins>+        ASSERT(symbolTable-&gt;scopeType() == SymbolTable::ScopeType::LexicalScope || symbolTable-&gt;scopeType() == SymbolTable::ScopeType::CatchScope);
</ins><span class="cx">         ConcurrentJITLocker locker(symbolTable-&gt;m_lock);
</span><span class="cx">         for (auto end = symbolTable-&gt;end(locker), iter = symbolTable-&gt;begin(locker); iter != end; ++iter)
</span><span class="cx">             result.add(iter-&gt;key);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreruntimeJSScopeh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/runtime/JSScope.h (208711 => 208712)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/runtime/JSScope.h        2016-11-14 22:54:09 UTC (rev 208711)
+++ trunk/Source/JavaScriptCore/runtime/JSScope.h        2016-11-14 22:57:12 UTC (rev 208712)
</span><span class="lines">@@ -51,7 +51,7 @@
</span><span class="cx">     static bool hasConstantScope(ResolveType);
</span><span class="cx">     static JSScope* constantScopeForCodeBlock(ResolveType, CodeBlock*);
</span><span class="cx"> 
</span><del>-    static void collectVariablesUnderTDZ(JSScope*, VariableEnvironment&amp; result);
</del><ins>+    static void collectClosureVariablesUnderTDZ(JSScope*, VariableEnvironment&amp; result);
</ins><span class="cx"> 
</span><span class="cx">     static void visitChildren(JSCell*, SlotVisitor&amp;);
</span><span class="cx"> 
</span></span></pre>
</div>
</div>

</body>
</html>