Reviewers: Yang,
Message:
yangguo, ptal
Description:
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.)
[email protected]
BUG=
Please review this at https://codereview.chromium.org/216883003/
SVN Base: https://v8.googlecode.com/svn/branches/bleeding_edge
Affected files (+6, -8 lines):
M src/parser.h
M src/preparser.h
Index: src/parser.h
diff --git a/src/parser.h b/src/parser.h
index
f49626766eb1dab32ea2bddb5d99289aa91ecd10..4bb9aad5a69459b009138555cc511d0533255a6a
100644
--- a/src/parser.h
+++ b/src/parser.h
@@ -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_);
}
}
Index: src/preparser.h
diff --git a/src/preparser.h b/src/preparser.h
index
080b7728730b576a18adcb6b5699f8dd20d5e4fb..38d12e11afa752c2eea349b76519d1d59ef1d885
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<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_);
}
--
--
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.