Reviewers: Dmitry Lomov (chromium),

Description:
Do not save/restore AST id generator.

AST ids only need to be unique, so there is no need to fiddle around with them.

Please review this at https://codereview.chromium.org/633053002/

SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge

Affected files (+5, -37 lines):
  M src/parser.h
  M src/parser.cc
  M src/preparser.h
  M src/preparser.cc


Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index ef9069ce43a3509766e3e7b57a43591271ac7462..2b91443775795fafaec6e2846db8a01cc904820a 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -342,25 +342,6 @@ class TargetScope BASE_EMBEDDED {
// ----------------------------------------------------------------------------
 // Implementation of Parser

-class ParserTraits::Checkpoint
-    : public ParserBase<ParserTraits>::CheckpointBase {
- public:
-  explicit Checkpoint(ParserBase<ParserTraits>* parser)
-      : CheckpointBase(parser), parser_(parser) {
-    saved_ast_node_id_gen_ = *parser_->ast_node_id_gen_;
-  }
-
-  void Restore() {
-    CheckpointBase::Restore();
-    *parser_->ast_node_id_gen_ = saved_ast_node_id_gen_;
-  }
-
- private:
-  ParserBase<ParserTraits>* parser_;
-  AstNode::IdGen saved_ast_node_id_gen_;
-};
-
-
bool ParserTraits::IsEvalOrArguments(const AstRawString* identifier) const {
   return identifier == parser_->ast_value_factory()->eval_string() ||
          identifier == parser_->ast_value_factory()->arguments_string();
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index 5cbb19aabb43aeece712e35d80b409ce90c51a84..300cc03a917f64717dc58ac844185b4f4674b53f 100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -374,8 +374,6 @@ class ParserTraits {
     typedef AstNodeFactory<AstConstructionVisitor> Factory;
   };

-  class Checkpoint;
-
   explicit ParserTraits(Parser* parser) : parser_(parser) {}

// Custom operations executed when FunctionStates are created and destructed.
Index: src/preparser.cc
diff --git a/src/preparser.cc b/src/preparser.cc
index 3173cc0f900255aa1d764736d8c6f70d51da0ddb..27a7b9ed4bc706a04e7bed2e9b2e90bf8448924f 100644
--- a/src/preparser.cc
+++ b/src/preparser.cc
@@ -32,13 +32,6 @@ int isfinite(double value);
 namespace v8 {
 namespace internal {

-class PreParserTraits::Checkpoint
-    : public ParserBase<PreParserTraits>::CheckpointBase {
- public:
-  explicit Checkpoint(ParserBase<PreParserTraits>* parser)
-      : ParserBase<PreParserTraits>::CheckpointBase(parser) {}
-};
-
 void PreParserTraits::ReportMessageAt(Scanner::Location location,
                                       const char* message,
                                       const char* arg,
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index f3bb292e2c5ca56afd33939d0e860091f4c0176e..5c2a62218524ec4e38ab1ba19261d7814e29beb5 100644
--- a/src/preparser.h
+++ b/src/preparser.h
@@ -123,8 +123,6 @@ class ParserBase : public Traits {
   }

  protected:
-  friend class Traits::Checkpoint;
-
   enum AllowEvalOrArgumentsAsIdentifier {
     kAllowEvalOrArguments,
     kDontAllowEvalOrArguments
@@ -135,7 +133,7 @@ class ParserBase : public Traits {
     PARSE_EAGERLY
   };

-  class CheckpointBase;
+  class Checkpoint;
   class ObjectLiteralChecker;

// ---------------------------------------------------------------------------
@@ -235,16 +233,16 @@ class ParserBase : public Traits {
     typename Traits::Type::Factory factory_;

     friend class ParserTraits;
-    friend class CheckpointBase;
+    friend class Checkpoint;
   };

// Annoyingly, arrow functions first parse as comma expressions, then when we // see the => we have to go back and reinterpret the arguments as being formal // parameters. To do so we need to reset some of the parser state back to
   // what it was before the arguments were first seen.
-  class CheckpointBase BASE_EMBEDDED {
+  class Checkpoint BASE_EMBEDDED {
    public:
-    explicit CheckpointBase(ParserBase* parser) {
+    explicit Checkpoint(ParserBase* parser) {
       function_state_ = parser->function_state_;
       next_materialized_literal_index_ =
           function_state_->next_materialized_literal_index_;
@@ -1149,8 +1147,6 @@ class PreParserTraits {
     typedef PreParserFactory Factory;
   };

-  class Checkpoint;
-
explicit PreParserTraits(PreParser* pre_parser) : pre_parser_(pre_parser) {}

   // Custom operations executed when FunctionStates are created and
@@ -2164,7 +2160,7 @@ ParserBase<Traits>::ParseAssignmentExpression(bool accept_IN, bool* ok) {
   }

   if (fni_ != NULL) fni_->Enter();
-  typename Traits::Checkpoint checkpoint(this);
+  ParserBase<Traits>::Checkpoint checkpoint(this);
   ExpressionT expression =
       this->ParseConditionalExpression(accept_IN, CHECK_OK);



--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to