Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(785)

Unified Diff: src/ast/scopes.h

Issue 2193793002: Put Scopes into temporary Zone (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: rebased Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/ast/ast.cc ('k') | src/ast/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.h
diff --git a/src/ast/scopes.h b/src/ast/scopes.h
index 9ebc7961c6eb49d8587bea7bdbf93aeeabb74556..304b877bfacdf803319401502cea2d43778da90c 100644
--- a/src/ast/scopes.h
+++ b/src/ast/scopes.h
@@ -201,6 +201,7 @@ class Scope: public ZoneObject {
// the same name because they may be removed selectively via
// RemoveUnresolved().
DCHECK(!already_resolved());
+ DCHECK_EQ(factory->zone(), zone());
VariableProxy* proxy =
factory->NewVariableProxy(name, kind, start_position, end_position);
proxy->set_next_unresolved(unresolved_);
@@ -609,6 +610,13 @@ class Scope: public ZoneObject {
return &sloppy_block_function_map_;
}
+ // To be called during parsing. Do just enough scope analysis that we can
+ // discard the Scope for lazily compiled functions. In particular, this
+ // records variables which cannot be resolved inside the Scope (we don't yet
+ // know what they will resolve to since the outer Scopes are incomplete) and
+ // migrates them into migrate_to.
+ void AnalyzePartially(Scope* migrate_to, AstNodeFactory* ast_node_factory);
+
// ---------------------------------------------------------------------------
// Debugging.
@@ -617,6 +625,9 @@ class Scope: public ZoneObject {
// Check that the scope has positions assigned.
void CheckScopePositions();
+
+ // Check that all Scopes in the scope tree use the same Zone.
+ void CheckZones();
#endif
// ---------------------------------------------------------------------------
@@ -777,16 +788,23 @@ class Scope: public ZoneObject {
};
// Lookup a variable reference given by name recursively starting with this
- // scope. If the code is executed because of a call to 'eval', the context
- // parameter should be set to the calling context of 'eval'.
+ // scope, but only until max_outer_scope (if not nullptr). If the code is
+ // executed because of a call to 'eval', the context parameter should be set
+ // to the calling context of 'eval'.
Variable* LookupRecursive(VariableProxy* proxy, BindingKind* binding_kind,
- AstNodeFactory* factory);
+ AstNodeFactory* factory,
+ Scope* max_outer_scope = nullptr);
MUST_USE_RESULT
bool ResolveVariable(ParseInfo* info, VariableProxy* proxy,
AstNodeFactory* factory);
MUST_USE_RESULT
bool ResolveVariablesRecursively(ParseInfo* info, AstNodeFactory* factory);
+ // Tries to resolve local variables inside max_outer_scope; collects those
+ // which cannot be resolved.
+ void CollectUnresolvableLocals(VariableProxy** still_unresolved,
+ Scope* max_outer_scope);
+
// Scope analysis.
void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval);
bool HasTrivialContext() const;
« no previous file with comments | « src/ast/ast.cc ('k') | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698