Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(365)

Unified Diff: src/parser.cc

Issue 490173002: Take ast node id counting away from Isolate. (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: rebased Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index db4e0fed2416554afc676609979d00e0317acf46..c91ba291a36590e2c76cde0c6396c7f8a08c0555 100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -345,19 +345,18 @@ class ParserTraits::Checkpoint
: public ParserBase<ParserTraits>::CheckpointBase {
public:
explicit Checkpoint(ParserBase<ParserTraits>* parser)
- : CheckpointBase(parser) {
- isolate_ = parser->zone()->isolate();
- saved_ast_node_id_ = isolate_->ast_node_id();
+ : CheckpointBase(parser), parser_(parser) {
+ saved_ast_node_id_gen_ = *parser_->ast_node_id_gen_;
}
void Restore() {
CheckpointBase::Restore();
- isolate_->set_ast_node_id(saved_ast_node_id_);
+ *parser_->ast_node_id_gen_ = saved_ast_node_id_gen_;
}
private:
- Isolate* isolate_;
- int saved_ast_node_id_;
+ ParserBase<ParserTraits>* parser_;
+ AstNode::IdGen saved_ast_node_id_gen_;
};
@@ -732,9 +731,9 @@ FunctionLiteral* ParserTraits::ParseFunctionLiteral(
Parser::Parser(CompilationInfo* info)
- : ParserBase<ParserTraits>(&scanner_,
- info->isolate()->stack_guard()->real_climit(),
- info->extension(), NULL, info->zone(), this),
+ : ParserBase<ParserTraits>(
+ &scanner_, info->isolate()->stack_guard()->real_climit(),
+ info->extension(), NULL, info->zone(), info->ast_node_id_gen(), this),
isolate_(info->isolate()),
script_(info->script()),
scanner_(isolate_->unicode_cache()),
@@ -749,7 +748,6 @@ Parser::Parser(CompilationInfo* info)
pending_error_arg_(NULL),
pending_error_char_arg_(NULL) {
DCHECK(!script_.is_null());
- isolate_->set_ast_node_id(0);
set_allow_harmony_scoping(!info->is_native() && FLAG_harmony_scoping);
set_allow_modules(!info->is_native() && FLAG_harmony_modules);
set_allow_natives_syntax(FLAG_allow_natives_syntax || info->is_native());
@@ -861,7 +859,7 @@ FunctionLiteral* Parser::DoParseProgram(CompilationInfo* info,
// Enters 'scope'.
FunctionState function_state(&function_state_, &scope_, scope, zone(),
- ast_value_factory_);
+ ast_value_factory_, info->ast_node_id_gen());
scope_->SetStrictMode(info->strict_mode());
ZoneList<Statement*>* body = new(zone()) ZoneList<Statement*>(16, zone());
@@ -979,7 +977,7 @@ FunctionLiteral* Parser::ParseLazy(Utf16CharacterStream* source) {
}
original_scope_ = scope;
FunctionState function_state(&function_state_, &scope_, scope, zone(),
- ast_value_factory_);
+ ast_value_factory_, info()->ast_node_id_gen());
DCHECK(scope->strict_mode() == SLOPPY || info()->strict_mode() == STRICT);
DCHECK(info()->strict_mode() == shared_info->strict_mode());
scope->SetStrictMode(shared_info->strict_mode());
@@ -3442,7 +3440,7 @@ FunctionLiteral* Parser::ParseFunctionLiteral(
// Parse function body.
{
FunctionState function_state(&function_state_, &scope_, scope, zone(),
- ast_value_factory_);
+ ast_value_factory_, info()->ast_node_id_gen());
scope_->SetScopeName(function_name);
if (is_generator) {
« no previous file with comments | « src/parser.h ('k') | src/preparser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698