<!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>[209723] 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/209723">209723</a></dd>
<dt>Author</dt> <dd>mark.lam@apple.com</dd>
<dt>Date</dt> <dd>2016-12-12 13:03:49 -0800 (Mon, 12 Dec 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Rename BytecodeGenerator's m_symbolTableStack to m_lexicalScopeStack.
https://bugs.webkit.org/show_bug.cgi?id=165768

Reviewed by Saam Barati.

The lexical scope in &quot;m_lexicalScopeStack&quot; here refers to a pair of { } in the
source code that bounds the scope of variables.

There are 4 places in the code where we call m_symbolTableStack.append() to
append a new stack entry.  In only 3 of the 4 cases, a symbol table is provided
in the new stack entry.  In all 4 cases, a scope register is provided in the new
stack entry.

Also, 3 of the 4 functions that appends an entry to this stack are named:
1. initializeVarLexicalEnvironment()
2. pushLexicalScopeInternal()
3. emitPushWithScope()

The 4th function is the BytecodeGenerator constructor where it pushes the scope
for a module environment.

Based on these details, m_lexicalScopeStack is a better name for this stack than
m_symbolTableStack.

* bytecompiler/BytecodeGenerator.cpp:
(JSC::BytecodeGenerator::BytecodeGenerator):
(JSC::BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded):
(JSC::BytecodeGenerator::initializeVarLexicalEnvironment):
(JSC::BytecodeGenerator::pushLexicalScopeInternal):
(JSC::BytecodeGenerator::initializeBlockScopedFunctions):
(JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
(JSC::BytecodeGenerator::popLexicalScopeInternal):
(JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration):
(JSC::BytecodeGenerator::variable):
(JSC::BytecodeGenerator::resolveType):
(JSC::BytecodeGenerator::emitResolveScope):
(JSC::BytecodeGenerator::emitPushWithScope):
(JSC::BytecodeGenerator::emitPopWithScope):
(JSC::BytecodeGenerator::pushFinallyContext):
(JSC::BytecodeGenerator::pushIteratorCloseContext):
(JSC::BytecodeGenerator::emitComplexPopScopes):
(JSC::BytecodeGenerator::popTryAndEmitCatch):
(JSC::BytecodeGenerator::emitPushFunctionNameScope):
* bytecompiler/BytecodeGenerator.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh">trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (209722 => 209723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-12-12 20:55:23 UTC (rev 209722)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-12-12 21:03:49 UTC (rev 209723)
</span><span class="lines">@@ -1,3 +1,50 @@
</span><ins>+2016-12-12  Mark Lam  &lt;mark.lam@apple.com&gt;
+
+        Rename BytecodeGenerator's m_symbolTableStack to m_lexicalScopeStack.
+        https://bugs.webkit.org/show_bug.cgi?id=165768
+
+        Reviewed by Saam Barati.
+
+        The lexical scope in &quot;m_lexicalScopeStack&quot; here refers to a pair of { } in the
+        source code that bounds the scope of variables.
+
+        There are 4 places in the code where we call m_symbolTableStack.append() to
+        append a new stack entry.  In only 3 of the 4 cases, a symbol table is provided
+        in the new stack entry.  In all 4 cases, a scope register is provided in the new
+        stack entry.
+
+        Also, 3 of the 4 functions that appends an entry to this stack are named:
+        1. initializeVarLexicalEnvironment()
+        2. pushLexicalScopeInternal()
+        3. emitPushWithScope()
+
+        The 4th function is the BytecodeGenerator constructor where it pushes the scope
+        for a module environment.
+
+        Based on these details, m_lexicalScopeStack is a better name for this stack than
+        m_symbolTableStack.
+
+        * bytecompiler/BytecodeGenerator.cpp:
+        (JSC::BytecodeGenerator::BytecodeGenerator):
+        (JSC::BytecodeGenerator::initializeArrowFunctionContextScopeIfNeeded):
+        (JSC::BytecodeGenerator::initializeVarLexicalEnvironment):
+        (JSC::BytecodeGenerator::pushLexicalScopeInternal):
+        (JSC::BytecodeGenerator::initializeBlockScopedFunctions):
+        (JSC::BytecodeGenerator::hoistSloppyModeFunctionIfNecessary):
+        (JSC::BytecodeGenerator::popLexicalScopeInternal):
+        (JSC::BytecodeGenerator::prepareLexicalScopeForNextForLoopIteration):
+        (JSC::BytecodeGenerator::variable):
+        (JSC::BytecodeGenerator::resolveType):
+        (JSC::BytecodeGenerator::emitResolveScope):
+        (JSC::BytecodeGenerator::emitPushWithScope):
+        (JSC::BytecodeGenerator::emitPopWithScope):
+        (JSC::BytecodeGenerator::pushFinallyContext):
+        (JSC::BytecodeGenerator::pushIteratorCloseContext):
+        (JSC::BytecodeGenerator::emitComplexPopScopes):
+        (JSC::BytecodeGenerator::popTryAndEmitCatch):
+        (JSC::BytecodeGenerator::emitPushFunctionNameScope):
+        * bytecompiler/BytecodeGenerator.h:
+
</ins><span class="cx"> 2016-12-12  Saam Barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed. Try to fix the cloop build.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorcpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp (209722 => 209723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2016-12-12 20:55:23 UTC (rev 209722)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp        2016-12-12 21:03:49 UTC (rev 209723)
</span><span class="lines">@@ -869,7 +869,7 @@
</span><span class="cx"> 
</span><span class="cx">     pushTDZVariables(lexicalVariables, TDZCheckOptimization::Optimize, TDZRequirement::UnderTDZ);
</span><span class="cx">     bool isWithScope = false;
</span><del>-    m_symbolTableStack.append(SymbolTableStackEntry { moduleEnvironmentSymbolTable, m_topMostScope, isWithScope, constantSymbolTable-&gt;index() });
</del><ins>+    m_lexicalScopeStack.append({ moduleEnvironmentSymbolTable, m_topMostScope, isWithScope, constantSymbolTable-&gt;index() });
</ins><span class="cx">     emitPrefillStackTDZVariables(lexicalVariables, moduleEnvironmentSymbolTable);
</span><span class="cx"> 
</span><span class="cx">     // makeFunction assumes that there's correct TDZ stack entries.
</span><span class="lines">@@ -1073,12 +1073,12 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     if (environment.size() &gt; 0) {
</span><del>-        size_t size = m_symbolTableStack.size();
</del><ins>+        size_t size = m_lexicalScopeStack.size();
</ins><span class="cx">         pushLexicalScopeInternal(environment, TDZCheckOptimization::Optimize, NestedScopeType::IsNotNested, nullptr, TDZRequirement::UnderTDZ, ScopeType::LetConstScope, ScopeRegisterType::Block);
</span><span class="cx"> 
</span><del>-        ASSERT_UNUSED(size, m_symbolTableStack.size() == size + 1);
</del><ins>+        ASSERT_UNUSED(size, m_lexicalScopeStack.size() == size + 1);
</ins><span class="cx"> 
</span><del>-        m_arrowFunctionContextLexicalEnvironmentRegister = m_symbolTableStack.last().m_scope;
</del><ins>+        m_arrowFunctionContextLexicalEnvironmentRegister = m_lexicalScopeStack.last().m_scope;
</ins><span class="cx">     }
</span><span class="cx"> }
</span><span class="cx"> 
</span><span class="lines">@@ -1124,8 +1124,8 @@
</span><span class="cx">         pushScopedControlFlowContext();
</span><span class="cx">     }
</span><span class="cx">     bool isWithScope = false;
</span><del>-    m_symbolTableStack.append(SymbolTableStackEntry{ functionSymbolTable, m_lexicalEnvironmentRegister, isWithScope, symbolTableConstantIndex });
-    m_varScopeSymbolTableIndex = m_symbolTableStack.size() - 1;
</del><ins>+    m_lexicalScopeStack.append({ functionSymbolTable, m_lexicalEnvironmentRegister, isWithScope, symbolTableConstantIndex });
+    m_varScopeLexicalScopeStackIndex = m_lexicalScopeStack.size() - 1;
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> UniquedStringImpl* BytecodeGenerator::visibleNameForParameter(DestructuringPatternNode* pattern)
</span><span class="lines">@@ -2071,7 +2071,7 @@
</span><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx">     bool isWithScope = false;
</span><del>-    m_symbolTableStack.append(SymbolTableStackEntry{ symbolTable, newScope, isWithScope, symbolTableConstantIndex });
</del><ins>+    m_lexicalScopeStack.append({ symbolTable, newScope, isWithScope, symbolTableConstantIndex });
</ins><span class="cx">     pushTDZVariables(environment, tdzCheckOptimization, tdzRequirement);
</span><span class="cx"> 
</span><span class="cx">     if (tdzRequirement == TDZRequirement::UnderTDZ)
</span><span class="lines">@@ -2114,8 +2114,8 @@
</span><span class="cx">     if (!functionStack.size())
</span><span class="cx">         return;
</span><span class="cx"> 
</span><del>-    SymbolTable* symbolTable = m_symbolTableStack.last().m_symbolTable;
-    RegisterID* scope = m_symbolTableStack.last().m_scope;
</del><ins>+    SymbolTable* symbolTable = m_lexicalScopeStack.last().m_symbolTable;
+    RegisterID* scope = m_lexicalScopeStack.last().m_scope;
</ins><span class="cx">     RefPtr&lt;RegisterID&gt; temp = newTemporary();
</span><span class="cx">     int symbolTableIndex = constantSymbolTable ? constantSymbolTable-&gt;index() : 0;
</span><span class="cx">     for (FunctionMetadataNode* function : functionStack) {
</span><span class="lines">@@ -2144,9 +2144,9 @@
</span><span class="cx">             currentValue = emitGetFromScope(newTemporary(), scope.get(), currentFunctionVariable, DoNotThrowIfNotFound);
</span><span class="cx">         }
</span><span class="cx">         
</span><del>-        ASSERT(m_varScopeSymbolTableIndex);
-        ASSERT(*m_varScopeSymbolTableIndex &lt; m_symbolTableStack.size());
-        SymbolTableStackEntry&amp; varScope = m_symbolTableStack[*m_varScopeSymbolTableIndex];
</del><ins>+        ASSERT(m_varScopeLexicalScopeStackIndex);
+        ASSERT(*m_varScopeLexicalScopeStackIndex &lt; m_lexicalScopeStack.size());
+        auto&amp; varScope = m_lexicalScopeStack[*m_varScopeLexicalScopeStackIndex];
</ins><span class="cx">         SymbolTable* varSymbolTable = varScope.m_symbolTable;
</span><span class="cx">         ASSERT(varSymbolTable-&gt;scopeType() == SymbolTable::ScopeType::VarScope);
</span><span class="cx">         SymbolTableEntry entry = varSymbolTable-&gt;get(NoLockingNecessary, functionName.impl());
</span><span class="lines">@@ -2172,7 +2172,7 @@
</span><span class="cx">     if (m_shouldEmitDebugHooks)
</span><span class="cx">         environment.markAllVariablesAsCaptured();
</span><span class="cx"> 
</span><del>-    SymbolTableStackEntry stackEntry = m_symbolTableStack.takeLast();
</del><ins>+    auto stackEntry = m_lexicalScopeStack.takeLast();
</ins><span class="cx">     SymbolTable* symbolTable = stackEntry.m_symbolTable;
</span><span class="cx">     bool hasCapturedVariables = false;
</span><span class="cx">     for (auto&amp; entry : environment) {
</span><span class="lines">@@ -2217,7 +2217,7 @@
</span><span class="cx">     // activation into the new activation because each iteration of a for loop
</span><span class="cx">     // gets a new activation.
</span><span class="cx"> 
</span><del>-    SymbolTableStackEntry stackEntry = m_symbolTableStack.last();
</del><ins>+    auto stackEntry = m_lexicalScopeStack.last();
</ins><span class="cx">     SymbolTable* symbolTable = stackEntry.m_symbolTable;
</span><span class="cx">     RegisterID* loopScope = stackEntry.m_scope;
</span><span class="cx">     ASSERT(symbolTable-&gt;scopeSize());
</span><span class="lines">@@ -2296,8 +2296,8 @@
</span><span class="cx">     //         doSomethingWith(x);
</span><span class="cx">     //     }
</span><span class="cx">     // }
</span><del>-    for (unsigned i = m_symbolTableStack.size(); i--; ) {
-        SymbolTableStackEntry&amp; stackEntry = m_symbolTableStack[i];
</del><ins>+    for (unsigned i = m_lexicalScopeStack.size(); i--; ) {
+        auto&amp; stackEntry = m_lexicalScopeStack[i];
</ins><span class="cx">         if (stackEntry.m_isWithScope)
</span><span class="cx">             return Variable(property);
</span><span class="cx">         SymbolTable* symbolTable = stackEntry.m_symbolTable;
</span><span class="lines">@@ -2392,10 +2392,10 @@
</span><span class="cx"> // will start with this ResolveType and compute the least upper bound including intercepting scopes.
</span><span class="cx"> ResolveType BytecodeGenerator::resolveType()
</span><span class="cx"> {
</span><del>-    for (unsigned i = m_symbolTableStack.size(); i--; ) {
-        if (m_symbolTableStack[i].m_isWithScope)
</del><ins>+    for (unsigned i = m_lexicalScopeStack.size(); i--; ) {
+        if (m_lexicalScopeStack[i].m_isWithScope)
</ins><span class="cx">             return Dynamic;
</span><del>-        if (m_usesNonStrictEval &amp;&amp; m_symbolTableStack[i].m_symbolTable-&gt;scopeType() == SymbolTable::ScopeType::FunctionNameScope) {
</del><ins>+        if (m_usesNonStrictEval &amp;&amp; m_lexicalScopeStack[i].m_symbolTable-&gt;scopeType() == SymbolTable::ScopeType::FunctionNameScope) {
</ins><span class="cx">             // We never want to assign to a FunctionNameScope. Returning Dynamic here achieves this goal.
</span><span class="cx">             // If we aren't in non-strict eval mode, then NodesCodeGen needs to take care not to emit
</span><span class="cx">             // a put_to_scope with the destination being the function name scope variable.
</span><span class="lines">@@ -2424,8 +2424,8 @@
</span><span class="cx">         // don't do that already is that m_lexicalEnvironment is required by ConstDeclNode. ConstDeclNode
</span><span class="cx">         // requires weird things because it is a shameful pile of nonsense, but block scoping would make
</span><span class="cx">         // that code sensible and obviate the need for us to do bad things.
</span><del>-        for (unsigned i = m_symbolTableStack.size(); i--; ) {
-            SymbolTableStackEntry&amp; stackEntry = m_symbolTableStack[i];
</del><ins>+        for (unsigned i = m_lexicalScopeStack.size(); i--; ) {
+            auto&amp; stackEntry = m_lexicalScopeStack[i];
</ins><span class="cx">             // We should not resolve a variable to VarKind::Scope if a &quot;with&quot; scope lies in between the current
</span><span class="cx">             // scope and the resolved scope.
</span><span class="cx">             RELEASE_ASSERT(!stackEntry.m_isWithScope);
</span><span class="lines">@@ -3609,7 +3609,7 @@
</span><span class="cx">     instructions().append(scopeRegister()-&gt;index());
</span><span class="cx"> 
</span><span class="cx">     emitMove(scopeRegister(), newScope);
</span><del>-    m_symbolTableStack.append(SymbolTableStackEntry{ nullptr, newScope, true, 0 });
</del><ins>+    m_lexicalScopeStack.append({ nullptr, newScope, true, 0 });
</ins><span class="cx"> 
</span><span class="cx">     return newScope;
</span><span class="cx"> }
</span><span class="lines">@@ -3632,7 +3632,7 @@
</span><span class="cx"> {
</span><span class="cx">     emitPopScope(scopeRegister(), scopeRegister());
</span><span class="cx">     popScopedControlFlowContext();
</span><del>-    SymbolTableStackEntry stackEntry = m_symbolTableStack.takeLast();
</del><ins>+    auto stackEntry = m_lexicalScopeStack.takeLast();
</ins><span class="cx">     stackEntry.m_scope-&gt;deref();
</span><span class="cx">     RELEASE_ASSERT(stackEntry.m_isWithScope);
</span><span class="cx"> }
</span><span class="lines">@@ -3690,7 +3690,7 @@
</span><span class="cx">         static_cast&lt;unsigned&gt;(m_forInContextStack.size()),
</span><span class="cx">         static_cast&lt;unsigned&gt;(m_tryContextStack.size()),
</span><span class="cx">         static_cast&lt;unsigned&gt;(m_labelScopes.size()),
</span><del>-        static_cast&lt;unsigned&gt;(m_symbolTableStack.size()),
</del><ins>+        static_cast&lt;unsigned&gt;(m_lexicalScopeStack.size()),
</ins><span class="cx">         m_finallyDepth,
</span><span class="cx">         m_localScopeDepth
</span><span class="cx">     };
</span><span class="lines">@@ -3716,7 +3716,7 @@
</span><span class="cx">         static_cast&lt;unsigned&gt;(m_forInContextStack.size()),
</span><span class="cx">         static_cast&lt;unsigned&gt;(m_tryContextStack.size()),
</span><span class="cx">         static_cast&lt;unsigned&gt;(m_labelScopes.size()),
</span><del>-        static_cast&lt;unsigned&gt;(m_symbolTableStack.size()),
</del><ins>+        static_cast&lt;unsigned&gt;(m_lexicalScopeStack.size()),
</ins><span class="cx">         m_finallyDepth,
</span><span class="cx">         m_localScopeDepth
</span><span class="cx">     };
</span><span class="lines">@@ -3878,7 +3878,7 @@
</span><span class="cx">         Vector&lt;SwitchInfo&gt; savedSwitchContextStack;
</span><span class="cx">         Vector&lt;RefPtr&lt;ForInContext&gt;&gt; savedForInContextStack;
</span><span class="cx">         Vector&lt;TryContext&gt; poppedTryContexts;
</span><del>-        Vector&lt;SymbolTableStackEntry&gt; savedSymbolTableStack;
</del><ins>+        Vector&lt;LexicalScopeStackEntry&gt; savedLexicalScopeStack;
</ins><span class="cx">         LabelScopeStore savedLabelScopes;
</span><span class="cx">         while (topScope &gt; bottomScope &amp;&amp; topScope-&gt;isFinallyBlock) {
</span><span class="cx">             RefPtr&lt;Label&gt; beforeFinally = emitLabel(newLabel().get());
</span><span class="lines">@@ -3891,7 +3891,7 @@
</span><span class="cx">             bool flipForIns = finallyContext.forInContextStackSize != m_forInContextStack.size();
</span><span class="cx">             bool flipTries = finallyContext.tryContextStackSize != m_tryContextStack.size();
</span><span class="cx">             bool flipLabelScopes = finallyContext.labelScopesSize != m_labelScopes.size();
</span><del>-            bool flipSymbolTableStack = finallyContext.symbolTableStackSize != m_symbolTableStack.size();
</del><ins>+            bool flipLexicalScopeStack = finallyContext.lexicalScopeStackSize != m_lexicalScopeStack.size();
</ins><span class="cx">             int topScopeIndex = -1;
</span><span class="cx">             int bottomScopeIndex = -1;
</span><span class="cx">             if (flipScopes) {
</span><span class="lines">@@ -3925,9 +3925,9 @@
</span><span class="cx">                 while (m_labelScopes.size() &gt; finallyContext.labelScopesSize)
</span><span class="cx">                     m_labelScopes.removeLast();
</span><span class="cx">             }
</span><del>-            if (flipSymbolTableStack) {
-                savedSymbolTableStack = m_symbolTableStack;
-                m_symbolTableStack.shrink(finallyContext.symbolTableStackSize);
</del><ins>+            if (flipLexicalScopeStack) {
+                savedLexicalScopeStack = m_lexicalScopeStack;
+                m_lexicalScopeStack.shrink(finallyContext.lexicalScopeStackSize);
</ins><span class="cx">             }
</span><span class="cx">             int savedFinallyDepth = m_finallyDepth;
</span><span class="cx">             m_finallyDepth = finallyContext.finallyDepth;
</span><span class="lines">@@ -3966,8 +3966,8 @@
</span><span class="cx">             }
</span><span class="cx">             if (flipLabelScopes)
</span><span class="cx">                 m_labelScopes = savedLabelScopes;
</span><del>-            if (flipSymbolTableStack)
-                m_symbolTableStack = savedSymbolTableStack;
</del><ins>+            if (flipLexicalScopeStack)
+                m_lexicalScopeStack = savedLexicalScopeStack;
</ins><span class="cx">             m_finallyDepth = savedFinallyDepth;
</span><span class="cx">             m_localScopeDepth = savedDynamicScopeDepth;
</span><span class="cx">             
</span><span class="lines">@@ -4035,12 +4035,12 @@
</span><span class="cx">     instructions().append(thrownValueRegister-&gt;index());
</span><span class="cx"> 
</span><span class="cx">     bool foundLocalScope = false;
</span><del>-    for (unsigned i = m_symbolTableStack.size(); i--; ) {
</del><ins>+    for (unsigned i = m_lexicalScopeStack.size(); i--; ) {
</ins><span class="cx">         // Note that if we don't find a local scope in the current function/program, 
</span><span class="cx">         // we must grab the outer-most scope of this bytecode generation.
</span><del>-        if (m_symbolTableStack[i].m_scope) {
</del><ins>+        if (m_lexicalScopeStack[i].m_scope) {
</ins><span class="cx">             foundLocalScope = true;
</span><del>-            emitMove(scopeRegister(), m_symbolTableStack[i].m_scope);
</del><ins>+            emitMove(scopeRegister(), m_lexicalScopeStack[i].m_scope);
</ins><span class="cx">             break;
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="lines">@@ -4119,8 +4119,8 @@
</span><span class="cx">     pushLexicalScopeInternal(nameScopeEnvironment, TDZCheckOptimization::Optimize, NestedScopeType::IsNotNested, nullptr, TDZRequirement::NotUnderTDZ, ScopeType::FunctionNameScope, ScopeRegisterType::Var);
</span><span class="cx">     ASSERT_UNUSED(numVars, m_codeBlock-&gt;m_numVars == static_cast&lt;int&gt;(numVars + 1)); // Should have only created one new &quot;var&quot; for the function name scope.
</span><span class="cx">     bool shouldTreatAsLexicalVariable = isStrictMode();
</span><del>-    Variable functionVar = variableForLocalEntry(property, m_symbolTableStack.last().m_symbolTable-&gt;get(NoLockingNecessary, property.impl()), m_symbolTableStack.last().m_symbolTableConstantIndex, shouldTreatAsLexicalVariable);
-    emitPutToScope(m_symbolTableStack.last().m_scope, functionVar, callee, ThrowIfNotFound, InitializationMode::NotInitialization);
</del><ins>+    Variable functionVar = variableForLocalEntry(property, m_lexicalScopeStack.last().m_symbolTable-&gt;get(NoLockingNecessary, property.impl()), m_lexicalScopeStack.last().m_symbolTableConstantIndex, shouldTreatAsLexicalVariable);
+    emitPutToScope(m_lexicalScopeStack.last().m_scope, functionVar, callee, ThrowIfNotFound, InitializationMode::NotInitialization);
</ins><span class="cx"> }
</span><span class="cx"> 
</span><span class="cx"> void BytecodeGenerator::pushScopedControlFlowContext()
</span></span></pre></div>
<a id="trunkSourceJavaScriptCorebytecompilerBytecodeGeneratorh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h (209722 => 209723)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2016-12-12 20:55:23 UTC (rev 209722)
+++ trunk/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.h        2016-12-12 21:03:49 UTC (rev 209723)
</span><span class="lines">@@ -89,7 +89,7 @@
</span><span class="cx">         unsigned forInContextStackSize;
</span><span class="cx">         unsigned tryContextStackSize;
</span><span class="cx">         unsigned labelScopesSize;
</span><del>-        unsigned symbolTableStackSize;
</del><ins>+        unsigned lexicalScopeStackSize;
</ins><span class="cx">         int finallyDepth;
</span><span class="cx">         int dynamicScopeDepth;
</span><span class="cx">     };
</span><span class="lines">@@ -896,13 +896,13 @@
</span><span class="cx"> 
</span><span class="cx">         bool m_shouldEmitDebugHooks;
</span><span class="cx"> 
</span><del>-        struct SymbolTableStackEntry {
</del><ins>+        struct LexicalScopeStackEntry {
</ins><span class="cx">             SymbolTable* m_symbolTable;
</span><span class="cx">             RegisterID* m_scope;
</span><span class="cx">             bool m_isWithScope;
</span><span class="cx">             int m_symbolTableConstantIndex;
</span><span class="cx">         };
</span><del>-        Vector&lt;SymbolTableStackEntry&gt; m_symbolTableStack;
</del><ins>+        Vector&lt;LexicalScopeStackEntry&gt; m_lexicalScopeStack;
</ins><span class="cx">         enum class TDZNecessityLevel {
</span><span class="cx">             NotNeeded,
</span><span class="cx">             Optimize,
</span><span class="lines">@@ -910,7 +910,7 @@
</span><span class="cx">         };
</span><span class="cx">         typedef HashMap&lt;RefPtr&lt;UniquedStringImpl&gt;, TDZNecessityLevel, IdentifierRepHash&gt; TDZMap;
</span><span class="cx">         Vector&lt;TDZMap&gt; m_TDZStack;
</span><del>-        std::optional&lt;size_t&gt; m_varScopeSymbolTableIndex;
</del><ins>+        std::optional&lt;size_t&gt; m_varScopeLexicalScopeStackIndex;
</ins><span class="cx">         void pushTDZVariables(const VariableEnvironment&amp;, TDZCheckOptimization, TDZRequirement);
</span><span class="cx"> 
</span><span class="cx">         ScopeNode* const m_scopeNode;
</span></span></pre>
</div>
</div>

</body>
</html>