Commit 6608110e authored by marja@chromium.org's avatar marja@chromium.org

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
parent 6d91c1e7
......@@ -441,16 +441,14 @@ class ParserTraits {
template<typename FunctionState>
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<typename FunctionState>
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_);
}
}
......
......@@ -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<typename FunctionState>
static void SetUpFunctionState(FunctionState* function_state, void*) {}
template<typename FunctionState>
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<Traits>::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<class Traits>
ParserBase<Traits>::FunctionState::~FunctionState() {
*scope_stack_ = outer_scope_;
*function_state_stack_ = outer_function_state_;
Traits::TearDownFunctionState(this);
Traits::TearDownFunctionState(this, extra_param_);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment