Title: [199787] trunk/Source/_javascript_Core
Revision
199787
Author
sbar...@apple.com
Date
2016-04-20 14:47:39 -0700 (Wed, 20 Apr 2016)

Log Message

We don't need a manual stack for an RAII object when the machine's stack will do just fine
https://bugs.webkit.org/show_bug.cgi?id=156807

Reviewed by Mark Lam.

We kept around a vector for an RAII object to maintain
the recursive nature of having these RAII objects on
the stack as the parser recursed. Instead, the RAII object
can just have a field with the value it wants to restore
and use the machine's stack.

This is a 1% octane code-load progression.

* parser/SyntaxChecker.h:
(JSC::SyntaxChecker::BinaryExprContext::BinaryExprContext):
(JSC::SyntaxChecker::BinaryExprContext::~BinaryExprContext):
(JSC::SyntaxChecker::UnaryExprContext::UnaryExprContext):
(JSC::SyntaxChecker::UnaryExprContext::~UnaryExprContext):
(JSC::SyntaxChecker::operatorStackPop):

Modified Paths

Diff

Modified: trunk/Source/_javascript_Core/ChangeLog (199786 => 199787)


--- trunk/Source/_javascript_Core/ChangeLog	2016-04-20 21:25:11 UTC (rev 199786)
+++ trunk/Source/_javascript_Core/ChangeLog	2016-04-20 21:47:39 UTC (rev 199787)
@@ -1,3 +1,25 @@
+2016-04-20  Saam barati  <sbar...@apple.com>
+
+        We don't need a manual stack for an RAII object when the machine's stack will do just fine
+        https://bugs.webkit.org/show_bug.cgi?id=156807
+
+        Reviewed by Mark Lam.
+
+        We kept around a vector for an RAII object to maintain
+        the recursive nature of having these RAII objects on
+        the stack as the parser recursed. Instead, the RAII object
+        can just have a field with the value it wants to restore
+        and use the machine's stack.
+
+        This is a 1% octane code-load progression.
+
+        * parser/SyntaxChecker.h:
+        (JSC::SyntaxChecker::BinaryExprContext::BinaryExprContext):
+        (JSC::SyntaxChecker::BinaryExprContext::~BinaryExprContext):
+        (JSC::SyntaxChecker::UnaryExprContext::UnaryExprContext):
+        (JSC::SyntaxChecker::UnaryExprContext::~UnaryExprContext):
+        (JSC::SyntaxChecker::operatorStackPop):
+
 2016-04-20  Michael Saboff  <msab...@apple.com>
 
         REGRESSION(r190289): Spin trying to view/sign in to hbogo.com

Modified: trunk/Source/_javascript_Core/parser/SyntaxChecker.h (199786 => 199787)


--- trunk/Source/_javascript_Core/parser/SyntaxChecker.h	2016-04-20 21:25:11 UTC (rev 199786)
+++ trunk/Source/_javascript_Core/parser/SyntaxChecker.h	2016-04-20 21:47:39 UTC (rev 199787)
@@ -38,30 +38,30 @@
         BinaryExprContext(SyntaxChecker& context)
             : m_context(&context)
         {
-            m_context->m_topBinaryExprs.append(m_context->m_topBinaryExpr);
+            m_token = m_context->m_topBinaryExpr;
             m_context->m_topBinaryExpr = 0;
         }
         ~BinaryExprContext()
         {
-            m_context->m_topBinaryExpr = m_context->m_topBinaryExprs.last();
-            m_context->m_topBinaryExprs.removeLast();
+            m_context->m_topBinaryExpr = m_token;
         }
     private:
+        int m_token;
         SyntaxChecker* m_context;
     };
     struct UnaryExprContext {
         UnaryExprContext(SyntaxChecker& context)
             : m_context(&context)
         {
-            m_context->m_topUnaryTokens.append(m_context->m_topUnaryToken);
+            m_token = m_context->m_topUnaryToken;
             m_context->m_topUnaryToken = 0;
         }
         ~UnaryExprContext()
         {
-            m_context->m_topUnaryToken = m_context->m_topUnaryTokens.last();
-            m_context->m_topUnaryTokens.removeLast();
+            m_context->m_topUnaryToken = m_token;
         }
     private:
+        int m_token;
         SyntaxChecker* m_context;
     };
     
@@ -397,8 +397,6 @@
 private:
     int m_topBinaryExpr;
     int m_topUnaryToken;
-    Vector<int, 8> m_topBinaryExprs;
-    Vector<int, 8> m_topUnaryTokens;
 };
 
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to