<!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>[199768] 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/199768">199768</a></dd>
<dt>Author</dt> <dd>sbarati@apple.com</dd>
<dt>Date</dt> <dd>2016-04-20 01:44:43 -0700 (Wed, 20 Apr 2016)</dd>
</dl>

<h3>Log Message</h3>
<pre>Remove unused m_writtenVariables from the parser and related bits
https://bugs.webkit.org/show_bug.cgi?id=156784

Reviewed by Yusuke Suzuki.

This isn't a octane/codeload speedup even though we're doing less work in
collectFreeVariables. But it's good to get rid of things that are not used.

* parser/Nodes.h:
(JSC::ScopeNode::usesEval):
(JSC::ScopeNode::usesArguments):
(JSC::ScopeNode::usesArrowFunction):
(JSC::ScopeNode::isStrictMode):
(JSC::ScopeNode::setUsesArguments):
(JSC::ScopeNode::usesThis):
(JSC::ScopeNode::modifiesParameter): Deleted.
(JSC::ScopeNode::modifiesArguments): Deleted.
* parser/Parser.cpp:
(JSC::Parser&lt;LexerType&gt;::parseInner):
(JSC::Parser&lt;LexerType&gt;::parseAssignmentExpression):
* parser/Parser.h:
(JSC::Scope::Scope):
(JSC::Scope::hasDeclaredParameter):
(JSC::Scope::preventAllVariableDeclarations):
(JSC::Scope::collectFreeVariables):
(JSC::Scope::mergeInnerArrowFunctionFeatures):
(JSC::Scope::getSloppyModeHoistedFunctions):
(JSC::Scope::getCapturedVars):
(JSC::Scope::setStrictMode):
(JSC::Scope::strictMode):
(JSC::Scope::fillParametersForSourceProviderCache):
(JSC::Scope::restoreFromSourceProviderCache):
(JSC::Parser::hasDeclaredParameter):
(JSC::Parser::exportName):
(JSC::Scope::declareWrite): Deleted.
(JSC::Parser::declareWrite): Deleted.
* parser/ParserModes.h:</pre>

<h3>Modified Paths</h3>
<ul>
<li><a href="#trunkSourceJavaScriptCoreChangeLog">trunk/Source/JavaScriptCore/ChangeLog</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserNodesh">trunk/Source/JavaScriptCore/parser/Nodes.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParsercpp">trunk/Source/JavaScriptCore/parser/Parser.cpp</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserh">trunk/Source/JavaScriptCore/parser/Parser.h</a></li>
<li><a href="#trunkSourceJavaScriptCoreparserParserModesh">trunk/Source/JavaScriptCore/parser/ParserModes.h</a></li>
</ul>

</div>
<div id="patch">
<h3>Diff</h3>
<a id="trunkSourceJavaScriptCoreChangeLog"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/ChangeLog (199767 => 199768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/ChangeLog        2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/JavaScriptCore/ChangeLog        2016-04-20 08:44:43 UTC (rev 199768)
</span><span class="lines">@@ -1,3 +1,43 @@
</span><ins>+2016-04-20  Saam barati  &lt;sbarati@apple.com&gt;
+
+        Remove unused m_writtenVariables from the parser and related bits
+        https://bugs.webkit.org/show_bug.cgi?id=156784
+
+        Reviewed by Yusuke Suzuki.
+
+        This isn't a octane/codeload speedup even though we're doing less work in
+        collectFreeVariables. But it's good to get rid of things that are not used.
+
+        * parser/Nodes.h:
+        (JSC::ScopeNode::usesEval):
+        (JSC::ScopeNode::usesArguments):
+        (JSC::ScopeNode::usesArrowFunction):
+        (JSC::ScopeNode::isStrictMode):
+        (JSC::ScopeNode::setUsesArguments):
+        (JSC::ScopeNode::usesThis):
+        (JSC::ScopeNode::modifiesParameter): Deleted.
+        (JSC::ScopeNode::modifiesArguments): Deleted.
+        * parser/Parser.cpp:
+        (JSC::Parser&lt;LexerType&gt;::parseInner):
+        (JSC::Parser&lt;LexerType&gt;::parseAssignmentExpression):
+        * parser/Parser.h:
+        (JSC::Scope::Scope):
+        (JSC::Scope::hasDeclaredParameter):
+        (JSC::Scope::preventAllVariableDeclarations):
+        (JSC::Scope::collectFreeVariables):
+        (JSC::Scope::mergeInnerArrowFunctionFeatures):
+        (JSC::Scope::getSloppyModeHoistedFunctions):
+        (JSC::Scope::getCapturedVars):
+        (JSC::Scope::setStrictMode):
+        (JSC::Scope::strictMode):
+        (JSC::Scope::fillParametersForSourceProviderCache):
+        (JSC::Scope::restoreFromSourceProviderCache):
+        (JSC::Parser::hasDeclaredParameter):
+        (JSC::Parser::exportName):
+        (JSC::Scope::declareWrite): Deleted.
+        (JSC::Parser::declareWrite): Deleted.
+        * parser/ParserModes.h:
+
</ins><span class="cx"> 2016-04-19  Saam barati  &lt;sbarati@apple.com&gt;
</span><span class="cx"> 
</span><span class="cx">         Unreviewed, fix cloop build after r199754.
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserNodesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Nodes.h (199767 => 199768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Nodes.h        2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/JavaScriptCore/parser/Nodes.h        2016-04-20 08:44:43 UTC (rev 199768)
</span><span class="lines">@@ -1592,8 +1592,6 @@
</span><span class="cx">         bool usesEval() const { return m_features &amp; EvalFeature; }
</span><span class="cx">         bool usesArguments() const { return (m_features &amp; ArgumentsFeature) &amp;&amp; !(m_features &amp; ShadowsArgumentsFeature); }
</span><span class="cx">         bool usesArrowFunction() const { return m_features &amp; ArrowFunctionFeature; }
</span><del>-        bool modifiesParameter() const { return m_features &amp; ModifiedParameterFeature; }
-        bool modifiesArguments() const { return m_features &amp; (EvalFeature | ModifiedArgumentsFeature); }
</del><span class="cx">         bool isStrictMode() const { return m_features &amp; StrictModeFeature; }
</span><span class="cx">         void setUsesArguments() { m_features |= ArgumentsFeature; }
</span><span class="cx">         bool usesThis() const { return m_features &amp; ThisFeature; }
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParsercpp"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.cpp (199767 => 199768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/JavaScriptCore/parser/Parser.cpp        2016-04-20 08:44:43 UTC (rev 199768)
</span><span class="lines">@@ -297,10 +297,8 @@
</span><span class="cx"> 
</span><span class="cx">     IdentifierSet capturedVariables;
</span><span class="cx">     UniquedStringImplPtrSet sloppyModeHoistedFunctions;
</span><del>-    bool modifiedParameter = false;
-    bool modifiedArguments = false;
</del><span class="cx">     scope-&gt;getSloppyModeHoistedFunctions(sloppyModeHoistedFunctions);
</span><del>-    scope-&gt;getCapturedVars(capturedVariables,  modifiedParameter, modifiedArguments);
</del><ins>+    scope-&gt;getCapturedVars(capturedVariables);
</ins><span class="cx"> 
</span><span class="cx">     VariableEnvironment&amp; varDeclarations = scope-&gt;declaredVariables();
</span><span class="cx">     for (auto&amp; entry : capturedVariables)
</span><span class="lines">@@ -316,10 +314,6 @@
</span><span class="cx">         features |= StrictModeFeature;
</span><span class="cx">     if (scope-&gt;shadowsArguments())
</span><span class="cx">         features |= ShadowsArgumentsFeature;
</span><del>-    if (modifiedParameter)
-        features |= ModifiedParameterFeature;
-    if (modifiedArguments)
-        features |= ModifiedArgumentsFeature;
</del><span class="cx"> 
</span><span class="cx"> #ifndef NDEBUG
</span><span class="cx">     if (m_parsingBuiltin &amp;&amp; isProgramParseMode(parseMode)) {
</span><span class="lines">@@ -3122,7 +3116,6 @@
</span><span class="cx">         if (strictMode() &amp;&amp; m_parserState.lastIdentifier &amp;&amp; context.isResolve(lhs)) {
</span><span class="cx">             failIfTrueIfStrict(m_vm-&gt;propertyNames-&gt;eval == *m_parserState.lastIdentifier, &quot;Cannot modify 'eval' in strict mode&quot;);
</span><span class="cx">             failIfTrueIfStrict(m_vm-&gt;propertyNames-&gt;arguments == *m_parserState.lastIdentifier, &quot;Cannot modify 'arguments' in strict mode&quot;);
</span><del>-            declareWrite(m_parserState.lastIdentifier);
</del><span class="cx">             m_parserState.lastIdentifier = 0;
</span><span class="cx">         }
</span><span class="cx">         lhs = parseAssignmentExpression(context);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/Parser.h (199767 => 199768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/Parser.h        2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/JavaScriptCore/parser/Parser.h        2016-04-20 08:44:43 UTC (rev 199768)
</span><span class="lines">@@ -213,7 +213,6 @@
</span><span class="cx">         , m_lexicalVariables(WTFMove(other.m_lexicalVariables))
</span><span class="cx">         , m_usedVariables(WTFMove(other.m_usedVariables))
</span><span class="cx">         , m_closedVariableCandidates(WTFMove(other.m_closedVariableCandidates))
</span><del>-        , m_writtenVariables(WTFMove(other.m_writtenVariables))
</del><span class="cx">         , m_moduleScopeData(WTFMove(other.m_moduleScopeData))
</span><span class="cx">         , m_functionDeclarations(WTFMove(other.m_functionDeclarations))
</span><span class="cx">     {
</span><span class="lines">@@ -465,12 +464,6 @@
</span><span class="cx">         return m_declaredParameters.contains(ident.get()) || hasDeclaredVariable(ident);
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    void declareWrite(const Identifier* ident)
-    {
-        ASSERT(m_strictMode);
-        m_writtenVariables.add(ident-&gt;impl());
-    }
-
</del><span class="cx">     void preventAllVariableDeclarations()
</span><span class="cx">     {
</span><span class="cx">         m_allowsVarDeclarations = false; 
</span><span class="lines">@@ -598,14 +591,6 @@
</span><span class="cx">             IdentifierSet::iterator begin = nestedScope-&gt;m_closedVariableCandidates.begin();
</span><span class="cx">             m_closedVariableCandidates.add(begin, end);
</span><span class="cx">         }
</span><del>-
-        if (nestedScope-&gt;m_writtenVariables.size()) {
-            for (UniquedStringImpl* impl : nestedScope-&gt;m_writtenVariables) {
-                if (nestedScope-&gt;m_declaredVariables.contains(impl) || nestedScope-&gt;m_lexicalVariables.contains(impl))
-                    continue;
-                m_writtenVariables.add(impl);
-            }
-        }
</del><span class="cx">     }
</span><span class="cx">     
</span><span class="cx">     void mergeInnerArrowFunctionFeatures(InnerArrowFunctionCodeFeatures arrowFunctionCodeFeatures)
</span><span class="lines">@@ -632,10 +617,9 @@
</span><span class="cx">         }
</span><span class="cx">     }
</span><span class="cx"> 
</span><del>-    void getCapturedVars(IdentifierSet&amp; capturedVariables, bool&amp; modifiedParameter, bool&amp; modifiedArguments)
</del><ins>+    void getCapturedVars(IdentifierSet&amp; capturedVariables)
</ins><span class="cx">     {
</span><span class="cx">         if (m_needsFullActivation || m_usesEval) {
</span><del>-            modifiedParameter = true;
</del><span class="cx">             for (auto&amp; entry : m_declaredVariables)
</span><span class="cx">                 capturedVariables.add(entry.key);
</span><span class="cx">             return;
</span><span class="lines">@@ -646,19 +630,6 @@
</span><span class="cx">                 continue;
</span><span class="cx">             capturedVariables.add(*ptr);
</span><span class="cx">         }
</span><del>-        modifiedParameter = false;
-        if (shadowsArguments())
-            modifiedArguments = true;
-        if (m_declaredParameters.size()) {
-            for (UniquedStringImpl* impl : m_writtenVariables) {
-                if (impl == m_vm-&gt;propertyNames-&gt;arguments.impl())
-                    modifiedArguments = true;
-                if (!m_declaredParameters.contains(impl))
-                    continue;
-                modifiedParameter = true;
-                break;
-            }
-        }
</del><span class="cx">     }
</span><span class="cx">     void setStrictMode() { m_strictMode = true; }
</span><span class="cx">     bool strictMode() const { return m_strictMode; }
</span><span class="lines">@@ -681,7 +652,6 @@
</span><span class="cx">         parameters.strictMode = m_strictMode;
</span><span class="cx">         parameters.needsFullActivation = m_needsFullActivation;
</span><span class="cx">         parameters.innerArrowFunctionFeatures = m_innerArrowFunctionFeatures;
</span><del>-        copyCapturedVariablesToVector(m_writtenVariables, parameters.writtenVariables);
</del><span class="cx">         for (const UniquedStringImplPtrSet&amp; set : m_usedVariables)
</span><span class="cx">             copyCapturedVariablesToVector(set, parameters.usedVariables);
</span><span class="cx">     }
</span><span class="lines">@@ -696,8 +666,6 @@
</span><span class="cx">         UniquedStringImplPtrSet&amp; destSet = m_usedVariables.last();
</span><span class="cx">         for (unsigned i = 0; i &lt; info-&gt;usedVariablesCount; ++i)
</span><span class="cx">             destSet.add(info-&gt;usedVariables()[i]);
</span><del>-        for (unsigned i = 0; i &lt; info-&gt;writtenVariablesCount; ++i)
-            m_writtenVariables.add(info-&gt;writtenVariables()[i]);
</del><span class="cx">     }
</span><span class="cx"> 
</span><span class="cx"> private:
</span><span class="lines">@@ -773,7 +741,6 @@
</span><span class="cx">     Vector&lt;UniquedStringImplPtrSet, 6&gt; m_usedVariables;
</span><span class="cx">     UniquedStringImplPtrSet m_sloppyModeHoistableFunctionCandidates;
</span><span class="cx">     IdentifierSet m_closedVariableCandidates;
</span><del>-    UniquedStringImplPtrSet m_writtenVariables;
</del><span class="cx">     RefPtr&lt;ModuleScopeData&gt; m_moduleScopeData;
</span><span class="cx">     DeclarationStacks::FunctionStack m_functionDeclarations;
</span><span class="cx"> };
</span><span class="lines">@@ -1175,12 +1142,6 @@
</span><span class="cx">         return m_scopeStack[i].hasDeclaredParameter(ident);
</span><span class="cx">     }
</span><span class="cx">     
</span><del>-    void declareWrite(const Identifier* ident)
-    {
-        if (!m_syntaxAlreadyValidated || strictMode())
-            m_scopeStack.last().declareWrite(ident);
-    }
-
</del><span class="cx">     bool exportName(const Identifier&amp; ident)
</span><span class="cx">     {
</span><span class="cx">         ASSERT(currentScope().index() == 0);
</span></span></pre></div>
<a id="trunkSourceJavaScriptCoreparserParserModesh"></a>
<div class="modfile"><h4>Modified: trunk/Source/JavaScriptCore/parser/ParserModes.h (199767 => 199768)</h4>
<pre class="diff"><span>
<span class="info">--- trunk/Source/JavaScriptCore/parser/ParserModes.h        2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/JavaScriptCore/parser/ParserModes.h        2016-04-20 08:44:43 UTC (rev 199768)
</span><span class="lines">@@ -154,15 +154,13 @@
</span><span class="cx"> const CodeFeatures ThisFeature =                 1 &lt;&lt; 3;
</span><span class="cx"> const CodeFeatures StrictModeFeature =           1 &lt;&lt; 4;
</span><span class="cx"> const CodeFeatures ShadowsArgumentsFeature =     1 &lt;&lt; 5;
</span><del>-const CodeFeatures ModifiedParameterFeature =    1 &lt;&lt; 6;
-const CodeFeatures ModifiedArgumentsFeature =    1 &lt;&lt; 7;
-const CodeFeatures ArrowFunctionFeature =        1 &lt;&lt; 8;
-const CodeFeatures ArrowFunctionContextFeature = 1 &lt;&lt; 9;
-const CodeFeatures SuperCallFeature =            1 &lt;&lt; 10;
-const CodeFeatures SuperPropertyFeature =        1 &lt;&lt; 11;
-const CodeFeatures NewTargetFeature =            1 &lt;&lt; 12;
</del><ins>+const CodeFeatures ArrowFunctionFeature =        1 &lt;&lt; 6;
+const CodeFeatures ArrowFunctionContextFeature = 1 &lt;&lt; 7;
+const CodeFeatures SuperCallFeature =            1 &lt;&lt; 8;
+const CodeFeatures SuperPropertyFeature =        1 &lt;&lt; 9;
+const CodeFeatures NewTargetFeature =            1 &lt;&lt; 10;
</ins><span class="cx"> 
</span><del>-const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature | ModifiedParameterFeature | ArrowFunctionFeature | ArrowFunctionContextFeature |
</del><ins>+const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature | ArrowFunctionFeature | ArrowFunctionContextFeature |
</ins><span class="cx">     SuperCallFeature | SuperPropertyFeature | NewTargetFeature;
</span><span class="cx"> 
</span><span class="cx"> typedef uint8_t InnerArrowFunctionCodeFeatures;
</span></span></pre>
</div>
</div>

</body>
</html>