Commit 25260c2b authored by marja@chromium.org's avatar marja@chromium.org

PreParser cleanup: no need to track with-ness of scopes.

Historically, we used to track the "with-ness" of a scope differently; not
creating a with scope, but setting a property on the scope (see
https://codereview.chromium.org/5166006 ). For laziness decisions, checking the
with-ness should be unnecessary: the current scope is function scope, and if the
outer scope is global scope, there's surely no with scope in between.

R=ulan@chromium.org
BUG=

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

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@20189 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent e5f5cc95
...@@ -850,7 +850,6 @@ PreParser::Expression PreParser::ParseFunctionLiteral( ...@@ -850,7 +850,6 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
// Parse function body. // Parse function body.
ScopeType outer_scope_type = scope_->type(); ScopeType outer_scope_type = scope_->type();
bool inside_with = scope_->inside_with();
PreParserScope function_scope(scope_, FUNCTION_SCOPE); PreParserScope function_scope(scope_, FUNCTION_SCOPE);
FunctionState function_state(&function_state_, &scope_, &function_scope); FunctionState function_state(&function_state_, &scope_, &function_scope);
function_state.set_is_generator(is_generator); function_state.set_is_generator(is_generator);
...@@ -892,8 +891,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral( ...@@ -892,8 +891,7 @@ PreParser::Expression PreParser::ParseFunctionLiteral(
// See Parser::ParseFunctionLiteral for more information about lazy parsing // See Parser::ParseFunctionLiteral for more information about lazy parsing
// and lazy compilation. // and lazy compilation.
bool is_lazily_parsed = (outer_scope_type == GLOBAL_SCOPE && bool is_lazily_parsed = (outer_scope_type == GLOBAL_SCOPE && allow_lazy() &&
!inside_with && allow_lazy() &&
!parenthesized_function_); !parenthesized_function_);
parenthesized_function_ = false; parenthesized_function_ = false;
......
...@@ -678,18 +678,7 @@ class PreParserScope { ...@@ -678,18 +678,7 @@ class PreParserScope {
public: public:
explicit PreParserScope(PreParserScope* outer_scope, ScopeType scope_type) explicit PreParserScope(PreParserScope* outer_scope, ScopeType scope_type)
: scope_type_(scope_type) { : scope_type_(scope_type) {
if (outer_scope) { strict_mode_ = outer_scope ? outer_scope->strict_mode() : SLOPPY;
scope_inside_with_ = outer_scope->scope_inside_with_ || is_with_scope();
strict_mode_ = outer_scope->strict_mode();
} else {
scope_inside_with_ = is_with_scope();
strict_mode_ = SLOPPY;
}
}
bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
bool inside_with() const {
return scope_inside_with_;
} }
ScopeType type() { return scope_type_; } ScopeType type() { return scope_type_; }
...@@ -698,7 +687,6 @@ class PreParserScope { ...@@ -698,7 +687,6 @@ class PreParserScope {
private: private:
ScopeType scope_type_; ScopeType scope_type_;
bool scope_inside_with_;
StrictMode strict_mode_; StrictMode strict_mode_;
}; };
......
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