Title: [190014] trunk/Source/_javascript_Core
Revision
190014
Author
sbar...@apple.com
Date
2015-09-19 08:36:46 -0700 (Sat, 19 Sep 2015)

Log Message

VariableEnvironmentNode should inherit from ParserArenaDeletable because VariableEnvironment's must have their destructors run
https://bugs.webkit.org/show_bug.cgi?id=149359

Reviewed by Andreas Kling.

VariableEnvironment must have its destructor run.
Therefore, VariableEnvironmentNode should inherit from ParserArenaDeletable.
Also, anything that inherits from VariableEnvironmentNode must use
ParserArenaDeletable's operator new. Also, any other nodes that own
a VariableEnvironment must also have their destructors run.

* parser/Nodes.h:
(JSC::VariableEnvironmentNode::VariableEnvironmentNode):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (190013 => 190014)


--- trunk/Source/_javascript_Core/ChangeLog	2015-09-19 09:59:47 UTC (rev 190013)
+++ trunk/Source/_javascript_Core/ChangeLog	2015-09-19 15:36:46 UTC (rev 190014)
@@ -1,3 +1,19 @@
+2015-09-19  Saam barati  <sbar...@apple.com>
+
+        VariableEnvironmentNode should inherit from ParserArenaDeletable because VariableEnvironment's must have their destructors run
+        https://bugs.webkit.org/show_bug.cgi?id=149359
+
+        Reviewed by Andreas Kling.
+
+        VariableEnvironment must have its destructor run.
+        Therefore, VariableEnvironmentNode should inherit from ParserArenaDeletable.
+        Also, anything that inherits from VariableEnvironmentNode must use
+        ParserArenaDeletable's operator new. Also, any other nodes that own
+        a VariableEnvironment must also have their destructors run.
+
+        * parser/Nodes.h:
+        (JSC::VariableEnvironmentNode::VariableEnvironmentNode):
+
 2015-09-18  Sukolsak Sakshuwong  <sukol...@gmail.com>
 
         Remove duplicate code in the WebAssembly parser

Modified: trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp (190013 => 190014)


--- trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2015-09-19 09:59:47 UTC (rev 190013)
+++ trunk/Source/_javascript_Core/bytecompiler/NodesCodegen.cpp	2015-09-19 15:36:46 UTC (rev 190014)
@@ -2850,13 +2850,13 @@
             tryData = generator.pushTry(here.get());
         }
 
-        generator.emitPushCatchScope(m_thrownValueIdent, thrownValueRegister.get(), m_catchEnvironment);
+        generator.emitPushCatchScope(m_thrownValueIdent, thrownValueRegister.get(), m_lexicalVariables);
         generator.emitProfileControlFlow(m_tryBlock->endOffset() + 1);
         if (m_finallyBlock)
             generator.emitNode(dst, m_catchBlock);
         else
             generator.emitNodeInTailPosition(dst, m_catchBlock);
-        generator.emitPopCatchScope(m_catchEnvironment);
+        generator.emitPopCatchScope(m_lexicalVariables);
         generator.emitLabel(catchEndLabel.get());
     }
 

Modified: trunk/Source/_javascript_Core/parser/NodeConstructors.h (190013 => 190014)


--- trunk/Source/_javascript_Core/parser/NodeConstructors.h	2015-09-19 09:59:47 UTC (rev 190013)
+++ trunk/Source/_javascript_Core/parser/NodeConstructors.h	2015-09-19 15:36:46 UTC (rev 190014)
@@ -878,12 +878,12 @@
 
     inline TryNode::TryNode(const JSTokenLocation& location, StatementNode* tryBlock, const Identifier& thrownValueIdent, StatementNode* catchBlock, VariableEnvironment& catchEnvironment, StatementNode* finallyBlock)
         : StatementNode(location)
+        , VariableEnvironmentNode(catchEnvironment)
         , m_tryBlock(tryBlock)
         , m_thrownValueIdent(thrownValueIdent)
         , m_catchBlock(catchBlock)
         , m_finallyBlock(finallyBlock)
     {
-        m_catchEnvironment.swap(catchEnvironment);
     }
 
     inline FunctionParameters::FunctionParameters()

Modified: trunk/Source/_javascript_Core/parser/Nodes.h (190013 => 190014)


--- trunk/Source/_javascript_Core/parser/Nodes.h	2015-09-19 09:59:47 UTC (rev 190013)
+++ trunk/Source/_javascript_Core/parser/Nodes.h	2015-09-19 15:36:46 UTC (rev 190014)
@@ -209,7 +209,7 @@
         int m_lastLine;
     };
 
-    class VariableEnvironmentNode {
+    class VariableEnvironmentNode : public ParserArenaDeletable {
     public:
         VariableEnvironmentNode()
         {
@@ -1286,6 +1286,8 @@
 
     class BlockNode : public StatementNode, public VariableEnvironmentNode {
     public:
+        using ParserArenaDeletable::operator new;
+
         BlockNode(const JSTokenLocation&, SourceElements*, VariableEnvironment&);
 
         StatementNode* singleStatement() const;
@@ -1398,6 +1400,8 @@
 
     class ForNode : public StatementNode, public VariableEnvironmentNode {
     public:
+        using ParserArenaDeletable::operator new;
+
         ForNode(const JSTokenLocation&, ExpressionNode* expr1, ExpressionNode* expr2, ExpressionNode* expr3, StatementNode*, VariableEnvironment&);
 
     private:
@@ -1413,6 +1417,8 @@
     
     class EnumerationNode : public StatementNode, public ThrowableExpressionData, public VariableEnvironmentNode {
     public:
+        using ParserArenaDeletable::operator new;
+
         EnumerationNode(const JSTokenLocation&, ExpressionNode*, ExpressionNode*, StatementNode*, VariableEnvironment&);
         
     protected:
@@ -1513,8 +1519,10 @@
         ExpressionNode* m_expr;
     };
 
-    class TryNode : public StatementNode {
+    class TryNode : public StatementNode, public VariableEnvironmentNode {
     public:
+        using ParserArenaDeletable::operator new;
+
         TryNode(const JSTokenLocation&, StatementNode* tryBlock, const Identifier& exceptionIdent, StatementNode* catchBlock, VariableEnvironment& catchEnvironment, StatementNode* finallyBlock);
 
     private:
@@ -1524,7 +1532,6 @@
         const Identifier& m_thrownValueIdent;
         StatementNode* m_catchBlock;
         StatementNode* m_finallyBlock;
-        VariableEnvironment m_catchEnvironment;
     };
 
     class ScopeNode : public StatementNode, public ParserArenaRoot, public VariableEnvironmentNode {
@@ -2112,6 +2119,8 @@
 
     class SwitchNode : public StatementNode, public VariableEnvironmentNode {
     public:
+        using ParserArenaDeletable::operator new;
+
         SwitchNode(const JSTokenLocation&, ExpressionNode*, CaseBlockNode*, VariableEnvironment&);
 
     private:
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to