Commit 7d9a0375 authored by jochen's avatar jochen Committed by Commit bot

Only create ScopeInfos for scopes that really need one

R=verwaest@chromium.org,marja@chromium.org

Review-Url: https://codereview.chromium.org/2351823005
Cr-Commit-Position: refs/heads/master@{#39546}
parent bedde181
......@@ -1043,6 +1043,13 @@ void DeclarationScope::AllocateVariables(ParseInfo* info, AnalyzeMode mode) {
break;
}
AllocateScopeInfosRecursively(info->isolate(), mode, outer_scope);
// The debugger expects all shared function infos to contain a scope info.
// Since the top-most scope will end up in a shared function info, make sure
// it has one, even if it doesn't need a scope info.
// TODO(jochen|yangguo): Remove this requirement.
if (scope_info_.is_null()) {
scope_info_ = ScopeInfo::Create(info->isolate(), zone(), this, outer_scope);
}
}
bool Scope::AllowsLazyParsing() const {
......
......@@ -444,8 +444,10 @@ class Scope: public ZoneObject {
// A lazily parsed scope doesn't contain enough information to create a
// ScopeInfo from it.
if (is_lazily_parsed_) return false;
return NeedsContext() || is_script_scope() || is_function_scope() ||
is_eval_scope() || is_module_scope();
// The debugger expects all functions to have scope infos.
// TODO(jochen|yangguo): Remove this requirement.
if (is_function_scope()) return true;
return NeedsContext();
}
Zone* zone_;
......
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