Do not save/restore AST id generator.

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

R=dslomov@chromium.org

Review URL: https://codereview.chromium.org/633053002

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@24433 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
This commit is contained in:
svenpanne@chromium.org 2014-10-07 12:16:28 +00:00
parent ec871585fc
commit f647ed7bfd
4 changed files with 5 additions and 37 deletions

View File

@ -342,25 +342,6 @@ class TargetScope BASE_EMBEDDED {
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// Implementation of Parser // 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 { bool ParserTraits::IsEvalOrArguments(const AstRawString* identifier) const {
return identifier == parser_->ast_value_factory()->eval_string() || return identifier == parser_->ast_value_factory()->eval_string() ||
identifier == parser_->ast_value_factory()->arguments_string(); identifier == parser_->ast_value_factory()->arguments_string();

View File

@ -374,8 +374,6 @@ class ParserTraits {
typedef AstNodeFactory<AstConstructionVisitor> Factory; typedef AstNodeFactory<AstConstructionVisitor> Factory;
}; };
class Checkpoint;
explicit ParserTraits(Parser* parser) : parser_(parser) {} explicit ParserTraits(Parser* parser) : parser_(parser) {}
// Custom operations executed when FunctionStates are created and destructed. // Custom operations executed when FunctionStates are created and destructed.

View File

@ -32,13 +32,6 @@ int isfinite(double value);
namespace v8 { namespace v8 {
namespace internal { 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, void PreParserTraits::ReportMessageAt(Scanner::Location location,
const char* message, const char* message,
const char* arg, const char* arg,

View File

@ -123,8 +123,6 @@ class ParserBase : public Traits {
} }
protected: protected:
friend class Traits::Checkpoint;
enum AllowEvalOrArgumentsAsIdentifier { enum AllowEvalOrArgumentsAsIdentifier {
kAllowEvalOrArguments, kAllowEvalOrArguments,
kDontAllowEvalOrArguments kDontAllowEvalOrArguments
@ -135,7 +133,7 @@ class ParserBase : public Traits {
PARSE_EAGERLY PARSE_EAGERLY
}; };
class CheckpointBase; class Checkpoint;
class ObjectLiteralChecker; class ObjectLiteralChecker;
// --------------------------------------------------------------------------- // ---------------------------------------------------------------------------
@ -235,16 +233,16 @@ class ParserBase : public Traits {
typename Traits::Type::Factory factory_; typename Traits::Type::Factory factory_;
friend class ParserTraits; friend class ParserTraits;
friend class CheckpointBase; friend class Checkpoint;
}; };
// Annoyingly, arrow functions first parse as comma expressions, then when we // 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 // 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 // parameters. To do so we need to reset some of the parser state back to
// what it was before the arguments were first seen. // what it was before the arguments were first seen.
class CheckpointBase BASE_EMBEDDED { class Checkpoint BASE_EMBEDDED {
public: public:
explicit CheckpointBase(ParserBase* parser) { explicit Checkpoint(ParserBase* parser) {
function_state_ = parser->function_state_; function_state_ = parser->function_state_;
next_materialized_literal_index_ = next_materialized_literal_index_ =
function_state_->next_materialized_literal_index_; function_state_->next_materialized_literal_index_;
@ -1149,8 +1147,6 @@ class PreParserTraits {
typedef PreParserFactory Factory; typedef PreParserFactory Factory;
}; };
class Checkpoint;
explicit PreParserTraits(PreParser* pre_parser) : pre_parser_(pre_parser) {} explicit PreParserTraits(PreParser* pre_parser) : pre_parser_(pre_parser) {}
// Custom operations executed when FunctionStates are created and // 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(); if (fni_ != NULL) fni_->Enter();
typename Traits::Checkpoint checkpoint(this); ParserBase<Traits>::Checkpoint checkpoint(this);
ExpressionT expression = ExpressionT expression =
this->ParseConditionalExpression(accept_IN, CHECK_OK); this->ParseConditionalExpression(accept_IN, CHECK_OK);