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

Unified Diff: src/ast/scopes.cc

Issue 2243833002: Get rid of dead RemoveTemporary (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Remove outdated comment 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 | « src/ast/scopes.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.cc
diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc
index f7cbdd4279bcb03a94d70c6052ec70ba478bba91..6615a31fbaa8ba1e50bef00e6777e032d866250a 100644
--- a/src/ast/scopes.cc
+++ b/src/ast/scopes.cc
@@ -709,28 +709,6 @@ Variable* Scope::NewTemporary(const AstRawString* name) {
return var;
}
-int DeclarationScope::RemoveTemporary(Variable* var) {
- DCHECK(!already_resolved());
- DCHECK_NOT_NULL(var);
- // Temporaries are only placed in ClosureScopes.
- DCHECK_EQ(GetClosureScope(), this);
- DCHECK_EQ(var->scope()->GetClosureScope(), var->scope());
- // If the temporary is not here, return quickly.
- if (var->scope() != this) return -1;
- // Most likely (always?) any temporary variable we want to remove
- // was just added before, so we search backwards.
- for (int i = temps_.length(); i-- > 0;) {
- if (temps_[i] == var) {
- // Don't shrink temps_, as callers of this method expect
- // the returned indices to be unique per-scope.
- temps_[i] = nullptr;
- return i;
- }
- }
- return -1;
-}
-
-
void Scope::AddDeclaration(Declaration* declaration) {
DCHECK(!already_resolved());
decls_.Add(declaration, zone());
@@ -813,7 +791,6 @@ void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals,
ZoneList<Variable*>* temps = AsDeclarationScope()->temps();
for (int i = 0; i < temps->length(); i++) {
Variable* var = (*temps)[i];
- if (var == nullptr) continue;
if (var->is_used()) {
if (var->IsContextSlot()) {
DCHECK(has_forced_context_allocation());
@@ -1190,13 +1167,11 @@ void Scope::Print(int n) {
bool printed_header = false;
ZoneList<Variable*>* temps = AsDeclarationScope()->temps();
for (int i = 0; i < temps->length(); i++) {
- if ((*temps)[i] != nullptr) {
- if (!printed_header) {
- printed_header = true;
- Indent(n1, "// temporary vars:\n");
- }
- PrintVar(n1, (*temps)[i]);
+ if (!printed_header) {
+ printed_header = true;
+ Indent(n1, "// temporary vars:\n");
}
+ PrintVar(n1, (*temps)[i]);
}
}
@@ -1661,7 +1636,6 @@ void Scope::AllocateNonParameterLocalsAndDeclaredGlobals(
if (is_declaration_scope()) {
ZoneList<Variable*>* temps = AsDeclarationScope()->temps();
for (int i = 0; i < temps->length(); i++) {
- if ((*temps)[i] == nullptr) continue;
AllocateNonParameterLocal((*temps)[i], ast_value_factory);
}
}
« no previous file with comments | « src/ast/scopes.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698