Title: [199768] trunk/Source/_javascript_Core
Revision
199768
Author
sbar...@apple.com
Date
2016-04-20 01:44:43 -0700 (Wed, 20 Apr 2016)

Log Message

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<LexerType>::parseInner):
(JSC::Parser<LexerType>::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:

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (199767 => 199768)


--- trunk/Source/_javascript_Core/ChangeLog	2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-04-20 08:44:43 UTC (rev 199768)
@@ -1,3 +1,43 @@
+2016-04-20  Saam barati  <sbar...@apple.com>
+
+        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<LexerType>::parseInner):
+        (JSC::Parser<LexerType>::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:
+
 2016-04-19  Saam barati  <sbar...@apple.com>
 
         Unreviewed, fix cloop build after r199754.

Modified: trunk/Source/_javascript_Core/parser/Nodes.h (199767 => 199768)


--- trunk/Source/_javascript_Core/parser/Nodes.h	2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/_javascript_Core/parser/Nodes.h	2016-04-20 08:44:43 UTC (rev 199768)
@@ -1592,8 +1592,6 @@
         bool usesEval() const { return m_features & EvalFeature; }
         bool usesArguments() const { return (m_features & ArgumentsFeature) && !(m_features & ShadowsArgumentsFeature); }
         bool usesArrowFunction() const { return m_features & ArrowFunctionFeature; }
-        bool modifiesParameter() const { return m_features & ModifiedParameterFeature; }
-        bool modifiesArguments() const { return m_features & (EvalFeature | ModifiedArgumentsFeature); }
         bool isStrictMode() const { return m_features & StrictModeFeature; }
         void setUsesArguments() { m_features |= ArgumentsFeature; }
         bool usesThis() const { return m_features & ThisFeature; }

Modified: trunk/Source/_javascript_Core/parser/Parser.cpp (199767 => 199768)


--- trunk/Source/_javascript_Core/parser/Parser.cpp	2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/_javascript_Core/parser/Parser.cpp	2016-04-20 08:44:43 UTC (rev 199768)
@@ -297,10 +297,8 @@
 
     IdentifierSet capturedVariables;
     UniquedStringImplPtrSet sloppyModeHoistedFunctions;
-    bool modifiedParameter = false;
-    bool modifiedArguments = false;
     scope->getSloppyModeHoistedFunctions(sloppyModeHoistedFunctions);
-    scope->getCapturedVars(capturedVariables,  modifiedParameter, modifiedArguments);
+    scope->getCapturedVars(capturedVariables);
 
     VariableEnvironment& varDeclarations = scope->declaredVariables();
     for (auto& entry : capturedVariables)
@@ -316,10 +314,6 @@
         features |= StrictModeFeature;
     if (scope->shadowsArguments())
         features |= ShadowsArgumentsFeature;
-    if (modifiedParameter)
-        features |= ModifiedParameterFeature;
-    if (modifiedArguments)
-        features |= ModifiedArgumentsFeature;
 
 #ifndef NDEBUG
     if (m_parsingBuiltin && isProgramParseMode(parseMode)) {
@@ -3122,7 +3116,6 @@
         if (strictMode() && m_parserState.lastIdentifier && context.isResolve(lhs)) {
             failIfTrueIfStrict(m_vm->propertyNames->eval == *m_parserState.lastIdentifier, "Cannot modify 'eval' in strict mode");
             failIfTrueIfStrict(m_vm->propertyNames->arguments == *m_parserState.lastIdentifier, "Cannot modify 'arguments' in strict mode");
-            declareWrite(m_parserState.lastIdentifier);
             m_parserState.lastIdentifier = 0;
         }
         lhs = parseAssignmentExpression(context);

Modified: trunk/Source/_javascript_Core/parser/Parser.h (199767 => 199768)


--- trunk/Source/_javascript_Core/parser/Parser.h	2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/_javascript_Core/parser/Parser.h	2016-04-20 08:44:43 UTC (rev 199768)
@@ -213,7 +213,6 @@
         , m_lexicalVariables(WTFMove(other.m_lexicalVariables))
         , m_usedVariables(WTFMove(other.m_usedVariables))
         , m_closedVariableCandidates(WTFMove(other.m_closedVariableCandidates))
-        , m_writtenVariables(WTFMove(other.m_writtenVariables))
         , m_moduleScopeData(WTFMove(other.m_moduleScopeData))
         , m_functionDeclarations(WTFMove(other.m_functionDeclarations))
     {
@@ -465,12 +464,6 @@
         return m_declaredParameters.contains(ident.get()) || hasDeclaredVariable(ident);
     }
     
-    void declareWrite(const Identifier* ident)
-    {
-        ASSERT(m_strictMode);
-        m_writtenVariables.add(ident->impl());
-    }
-
     void preventAllVariableDeclarations()
     {
         m_allowsVarDeclarations = false; 
@@ -598,14 +591,6 @@
             IdentifierSet::iterator begin = nestedScope->m_closedVariableCandidates.begin();
             m_closedVariableCandidates.add(begin, end);
         }
-
-        if (nestedScope->m_writtenVariables.size()) {
-            for (UniquedStringImpl* impl : nestedScope->m_writtenVariables) {
-                if (nestedScope->m_declaredVariables.contains(impl) || nestedScope->m_lexicalVariables.contains(impl))
-                    continue;
-                m_writtenVariables.add(impl);
-            }
-        }
     }
     
     void mergeInnerArrowFunctionFeatures(InnerArrowFunctionCodeFeatures arrowFunctionCodeFeatures)
@@ -632,10 +617,9 @@
         }
     }
 
-    void getCapturedVars(IdentifierSet& capturedVariables, bool& modifiedParameter, bool& modifiedArguments)
+    void getCapturedVars(IdentifierSet& capturedVariables)
     {
         if (m_needsFullActivation || m_usesEval) {
-            modifiedParameter = true;
             for (auto& entry : m_declaredVariables)
                 capturedVariables.add(entry.key);
             return;
@@ -646,19 +630,6 @@
                 continue;
             capturedVariables.add(*ptr);
         }
-        modifiedParameter = false;
-        if (shadowsArguments())
-            modifiedArguments = true;
-        if (m_declaredParameters.size()) {
-            for (UniquedStringImpl* impl : m_writtenVariables) {
-                if (impl == m_vm->propertyNames->arguments.impl())
-                    modifiedArguments = true;
-                if (!m_declaredParameters.contains(impl))
-                    continue;
-                modifiedParameter = true;
-                break;
-            }
-        }
     }
     void setStrictMode() { m_strictMode = true; }
     bool strictMode() const { return m_strictMode; }
@@ -681,7 +652,6 @@
         parameters.strictMode = m_strictMode;
         parameters.needsFullActivation = m_needsFullActivation;
         parameters.innerArrowFunctionFeatures = m_innerArrowFunctionFeatures;
-        copyCapturedVariablesToVector(m_writtenVariables, parameters.writtenVariables);
         for (const UniquedStringImplPtrSet& set : m_usedVariables)
             copyCapturedVariablesToVector(set, parameters.usedVariables);
     }
@@ -696,8 +666,6 @@
         UniquedStringImplPtrSet& destSet = m_usedVariables.last();
         for (unsigned i = 0; i < info->usedVariablesCount; ++i)
             destSet.add(info->usedVariables()[i]);
-        for (unsigned i = 0; i < info->writtenVariablesCount; ++i)
-            m_writtenVariables.add(info->writtenVariables()[i]);
     }
 
 private:
@@ -773,7 +741,6 @@
     Vector<UniquedStringImplPtrSet, 6> m_usedVariables;
     UniquedStringImplPtrSet m_sloppyModeHoistableFunctionCandidates;
     IdentifierSet m_closedVariableCandidates;
-    UniquedStringImplPtrSet m_writtenVariables;
     RefPtr<ModuleScopeData> m_moduleScopeData;
     DeclarationStacks::FunctionStack m_functionDeclarations;
 };
@@ -1175,12 +1142,6 @@
         return m_scopeStack[i].hasDeclaredParameter(ident);
     }
     
-    void declareWrite(const Identifier* ident)
-    {
-        if (!m_syntaxAlreadyValidated || strictMode())
-            m_scopeStack.last().declareWrite(ident);
-    }
-
     bool exportName(const Identifier& ident)
     {
         ASSERT(currentScope().index() == 0);

Modified: trunk/Source/_javascript_Core/parser/ParserModes.h (199767 => 199768)


--- trunk/Source/_javascript_Core/parser/ParserModes.h	2016-04-20 08:33:22 UTC (rev 199767)
+++ trunk/Source/_javascript_Core/parser/ParserModes.h	2016-04-20 08:44:43 UTC (rev 199768)
@@ -154,15 +154,13 @@
 const CodeFeatures ThisFeature =                 1 << 3;
 const CodeFeatures StrictModeFeature =           1 << 4;
 const CodeFeatures ShadowsArgumentsFeature =     1 << 5;
-const CodeFeatures ModifiedParameterFeature =    1 << 6;
-const CodeFeatures ModifiedArgumentsFeature =    1 << 7;
-const CodeFeatures ArrowFunctionFeature =        1 << 8;
-const CodeFeatures ArrowFunctionContextFeature = 1 << 9;
-const CodeFeatures SuperCallFeature =            1 << 10;
-const CodeFeatures SuperPropertyFeature =        1 << 11;
-const CodeFeatures NewTargetFeature =            1 << 12;
+const CodeFeatures ArrowFunctionFeature =        1 << 6;
+const CodeFeatures ArrowFunctionContextFeature = 1 << 7;
+const CodeFeatures SuperCallFeature =            1 << 8;
+const CodeFeatures SuperPropertyFeature =        1 << 9;
+const CodeFeatures NewTargetFeature =            1 << 10;
 
-const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature | ModifiedParameterFeature | ArrowFunctionFeature | ArrowFunctionContextFeature |
+const CodeFeatures AllFeatures = EvalFeature | ArgumentsFeature | WithFeature | ThisFeature | StrictModeFeature | ShadowsArgumentsFeature | ArrowFunctionFeature | ArrowFunctionContextFeature |
     SuperCallFeature | SuperPropertyFeature | NewTargetFeature;
 
 typedef uint8_t InnerArrowFunctionCodeFeatures;
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to