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

Unified Diff: src/ast/scopes.h

Issue 2272083003: Merge DeclarationScope::temps_ and Scope::ordered_variables_ into Scope::locals_ (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: fixes + add cornercase test + still failing cornercase test Created 4 years, 4 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 | « no previous file | src/ast/scopes.cc » ('j') | src/ast/scopes.cc » ('J')
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 c4adb8037d71e2b50d1dacb6b5ffce1823efbf39..54166efdccf194f00bb521a3073873c6632592e5 100644
--- a/src/ast/scopes.h
+++ b/src/ast/scopes.h
@@ -27,6 +27,8 @@ class VariableMap: public ZoneHashMap {
bool* added = nullptr);
Variable* Lookup(const AstRawString* name);
+ void Remove(Variable* var);
+ void Add(Zone* zone, Variable* var);
};
@@ -84,7 +86,8 @@ class Scope: public ZoneObject {
Scope* outer_scope_;
Scope* top_inner_scope_;
VariableProxy* top_unresolved_;
- int top_temp_;
+ int top_local_;
+ int top_decl_;
};
// Compute top scope and allocate variables. For lazy compilation the top
@@ -431,7 +434,7 @@ class Scope: public ZoneObject {
Variable* var =
variables_.Declare(zone, scope, name, mode, kind, initialization_flag,
maybe_assigned_flag, &added);
- if (added) ordered_variables_.Add(var, zone);
+ if (added) locals_.Add(var, zone);
return var;
}
Zone* zone_;
@@ -450,7 +453,7 @@ class Scope: public ZoneObject {
// In case of non-scopeinfo-backed scopes, this contains the variables of the
// map above in order of addition.
// TODO(verwaest): Thread through Variable.
- ZoneList<Variable*> ordered_variables_;
+ ZoneList<Variable*> locals_;
// Unresolved variables referred to from this scope. The proxies themselves
// form a linked list of all unresolved proxies.
VariableProxy* unresolved_;
@@ -741,18 +744,16 @@ class DeclarationScope : public Scope {
return this_function_;
}
- // Adds a temporary variable in this scope's TemporaryScope. This is for
- // adjusting the scope of temporaries used when desugaring parameter
+ // Adds a local variable in this scope's locals list. This is for adjusting
+ // the scope of temporaries and do-expression vars when desugaring parameter
// initializers.
- void AddTemporary(Variable* var) {
+ void AddLocal(Variable* var) {
DCHECK(!already_resolved_);
// Temporaries are only placed in ClosureScopes.
DCHECK_EQ(GetClosureScope(), this);
- temps_.Add(var, zone());
+ locals_.Add(var, zone());
}
- ZoneList<Variable*>* temps() { return &temps_; }
-
void DeclareSloppyBlockFunction(const AstRawString* name,
SloppyBlockFunctionStatement* statement) {
sloppy_block_function_map_.Declare(zone(), name, statement);
@@ -829,8 +830,6 @@ class DeclarationScope : public Scope {
// Info about the parameter list of a function.
int arity_;
- // Compiler-allocated (user-invisible) temporaries.
- ZoneList<Variable*> temps_;
// Parameter list in source order.
ZoneList<Variable*> params_;
// Map of function names to lists of functions defined in sloppy blocks
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | src/ast/scopes.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698