Commit 0a93ebaa authored by verwaest's avatar verwaest Committed by Commit bot

Get rid of dead RemoveTemporary

kudos to marja@ for finding this

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2243833002
Cr-Commit-Position: refs/heads/master@{#38619}
parent b167ae33
...@@ -709,28 +709,6 @@ Variable* Scope::NewTemporary(const AstRawString* name) { ...@@ -709,28 +709,6 @@ Variable* Scope::NewTemporary(const AstRawString* name) {
return var; 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) { void Scope::AddDeclaration(Declaration* declaration) {
DCHECK(!already_resolved()); DCHECK(!already_resolved());
decls_.Add(declaration, zone()); decls_.Add(declaration, zone());
...@@ -813,7 +791,6 @@ void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals, ...@@ -813,7 +791,6 @@ void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals,
ZoneList<Variable*>* temps = AsDeclarationScope()->temps(); ZoneList<Variable*>* temps = AsDeclarationScope()->temps();
for (int i = 0; i < temps->length(); i++) { for (int i = 0; i < temps->length(); i++) {
Variable* var = (*temps)[i]; Variable* var = (*temps)[i];
if (var == nullptr) continue;
if (var->is_used()) { if (var->is_used()) {
if (var->IsContextSlot()) { if (var->IsContextSlot()) {
DCHECK(has_forced_context_allocation()); DCHECK(has_forced_context_allocation());
...@@ -1190,13 +1167,11 @@ void Scope::Print(int n) { ...@@ -1190,13 +1167,11 @@ void Scope::Print(int n) {
bool printed_header = false; bool printed_header = false;
ZoneList<Variable*>* temps = AsDeclarationScope()->temps(); ZoneList<Variable*>* temps = AsDeclarationScope()->temps();
for (int i = 0; i < temps->length(); i++) { for (int i = 0; i < temps->length(); i++) {
if ((*temps)[i] != nullptr) { if (!printed_header) {
if (!printed_header) { printed_header = true;
printed_header = true; Indent(n1, "// temporary vars:\n");
Indent(n1, "// temporary vars:\n");
}
PrintVar(n1, (*temps)[i]);
} }
PrintVar(n1, (*temps)[i]);
} }
} }
...@@ -1661,7 +1636,6 @@ void Scope::AllocateNonParameterLocalsAndDeclaredGlobals( ...@@ -1661,7 +1636,6 @@ void Scope::AllocateNonParameterLocalsAndDeclaredGlobals(
if (is_declaration_scope()) { if (is_declaration_scope()) {
ZoneList<Variable*>* temps = AsDeclarationScope()->temps(); ZoneList<Variable*>* temps = AsDeclarationScope()->temps();
for (int i = 0; i < temps->length(); i++) { for (int i = 0; i < temps->length(); i++) {
if ((*temps)[i] == nullptr) continue;
AllocateNonParameterLocal((*temps)[i], ast_value_factory); AllocateNonParameterLocal((*temps)[i], ast_value_factory);
} }
} }
......
...@@ -800,12 +800,6 @@ class DeclarationScope : public Scope { ...@@ -800,12 +800,6 @@ class DeclarationScope : public Scope {
return this_function_; return this_function_;
} }
// Remove a temporary variable. This is for adjusting the scope of
// temporaries used when desugaring parameter initializers.
// Returns the index at which it was found in this scope, or -1 if
// it was not found.
int RemoveTemporary(Variable* var);
// Adds a temporary variable in this scope's TemporaryScope. This is for // Adds a temporary variable in this scope's TemporaryScope. This is for
// adjusting the scope of temporaries used when desugaring parameter // adjusting the scope of temporaries used when desugaring parameter
// initializers. // initializers.
...@@ -873,9 +867,7 @@ class DeclarationScope : public Scope { ...@@ -873,9 +867,7 @@ class DeclarationScope : public Scope {
int arity_; int arity_;
int rest_index_; int rest_index_;
Variable* rest_parameter_; Variable* rest_parameter_;
// Compiler-allocated (user-invisible) temporaries. Due to the implementation // Compiler-allocated (user-invisible) temporaries.
// of RemoveTemporary(), may contain nulls, which must be skipped-over during
// allocation and printing.
ZoneList<Variable*> temps_; ZoneList<Variable*> temps_;
// Parameter list in source order. // Parameter list in source order.
ZoneList<Variable*> params_; ZoneList<Variable*> params_;
......
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