From 6608110e8737074701d235aabfe987fe8bee4e14 Mon Sep 17 00:00:00 2001 From: "marja@chromium.org" Date: Fri, 28 Mar 2014 12:49:34 +0000 Subject: [PATCH] Make it clearer that PreParser doesn't depend on Isolate. The Isolate* member of ParserBase::FunctionState was only used by Parser. Removing it makes it clear that there are no isolates in PreParser. (There's also no Zone, since PreParserTraits::Type::Zone is void.) R=yangguo@chromium.org BUG= Review URL: https://codereview.chromium.org/216883003 git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20331 ce2b1a6d-e550-0410-aec6-3dcde31c8c00 --- src/parser.h | 6 ++---- src/preparser.h | 8 ++++---- 2 files changed, 6 insertions(+), 8 deletions(-) diff --git a/src/parser.h b/src/parser.h index f49626766e..4bb9aad5a6 100644 --- a/src/parser.h +++ b/src/parser.h @@ -441,16 +441,14 @@ class ParserTraits { template static void SetUpFunctionState(FunctionState* function_state, Zone* zone) { Isolate* isolate = zone->isolate(); - function_state->isolate_ = isolate; function_state->saved_ast_node_id_ = isolate->ast_node_id(); isolate->set_ast_node_id(BailoutId::FirstUsable().ToInt()); } template - static void TearDownFunctionState(FunctionState* function_state) { + static void TearDownFunctionState(FunctionState* function_state, Zone* zone) { if (function_state->outer_function_state_ != NULL) { - function_state->isolate_->set_ast_node_id( - function_state->saved_ast_node_id_); + zone->isolate()->set_ast_node_id(function_state->saved_ast_node_id_); } } diff --git a/src/preparser.h b/src/preparser.h index 080b772873..38d12e11af 100644 --- a/src/preparser.h +++ b/src/preparser.h @@ -228,8 +228,8 @@ class ParserBase : public Traits { FunctionState* outer_function_state_; typename Traits::Type::Scope** scope_stack_; typename Traits::Type::Scope* outer_scope_; - Isolate* isolate_; // Only used by ParserTraits. int saved_ast_node_id_; // Only used by ParserTraits. + typename Traits::Type::Zone* extra_param_; typename Traits::Type::Factory factory_; friend class ParserTraits; @@ -829,7 +829,7 @@ class PreParserTraits { template static void SetUpFunctionState(FunctionState* function_state, void*) {} template - static void TearDownFunctionState(FunctionState* function_state) {} + static void TearDownFunctionState(FunctionState* function_state, void*) {} // Helper functions for recursive descent. static bool IsEvalOrArguments(PreParserIdentifier identifier) { @@ -1181,8 +1181,8 @@ ParserBase::FunctionState::FunctionState( outer_function_state_(*function_state_stack), scope_stack_(scope_stack), outer_scope_(*scope_stack), - isolate_(NULL), saved_ast_node_id_(0), + extra_param_(extra_param), factory_(extra_param) { *scope_stack_ = scope; *function_state_stack = this; @@ -1194,7 +1194,7 @@ template ParserBase::FunctionState::~FunctionState() { *scope_stack_ = outer_scope_; *function_state_stack_ = outer_function_state_; - Traits::TearDownFunctionState(this); + Traits::TearDownFunctionState(this, extra_param_); }