Commit f77d1bfc authored by adamk's avatar adamk Committed by Commit bot

Remove redundant Scope book-keeping

The uses_arguments() bool is not needed for correct
behavior, since that same information is available after scope analysis
based on whether we allocated the Scope::arguments_ var.

BUG=v8:5209

Review-Url: https://codereview.chromium.org/2168293002
Cr-Commit-Position: refs/heads/master@{#37990}
parent e9dea58f
......@@ -180,7 +180,6 @@ void Scope::SetDefaults() {
this_function_ = nullptr;
scope_inside_with_ = false;
scope_calls_eval_ = false;
scope_uses_arguments_ = false;
has_arguments_parameter_ = false;
scope_uses_super_property_ = false;
asm_module_ = false;
......@@ -429,7 +428,6 @@ void Scope::PropagateUsageFlagsToScope(Scope* other) {
DCHECK_NOT_NULL(other);
DCHECK(!already_resolved());
DCHECK(!other->already_resolved());
if (uses_arguments()) other->RecordArgumentsUsage();
if (uses_super_property()) other->RecordSuperPropertyUsage();
if (calls_eval()) other->RecordEvalCall();
}
......@@ -1030,7 +1028,6 @@ void Scope::Print(int n) {
if (asm_function_) Indent(n1, "// scope is an asm function\n");
if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n");
if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n");
if (scope_uses_arguments_) Indent(n1, "// scope uses 'arguments'\n");
if (scope_uses_super_property_)
Indent(n1, "// scope uses 'super' property\n");
if (outer_scope_calls_sloppy_eval_) {
......
......@@ -270,9 +270,6 @@ class Scope: public ZoneObject {
// Inform the scope that the corresponding code contains an eval call.
void RecordEvalCall() { scope_calls_eval_ = true; }
// Inform the scope that the corresponding code uses "arguments".
void RecordArgumentsUsage() { scope_uses_arguments_ = true; }
// Inform the scope that the corresponding code uses "super".
void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; }
......@@ -376,8 +373,6 @@ class Scope: public ZoneObject {
// Is this scope inside a with statement.
bool inside_with() const { return scope_inside_with_; }
// Does this scope access "arguments".
bool uses_arguments() const { return scope_uses_arguments_; }
// Does this scope access "super" property (super.foo).
bool uses_super_property() const { return scope_uses_super_property_; }
// Does this scope have the potential to execute declarations non-linearly?
......@@ -681,8 +676,6 @@ class Scope: public ZoneObject {
// This scope or a nested catch scope or with scope contain an 'eval' call. At
// the 'eval' call site this scope is the declaration scope.
bool scope_calls_eval_;
// This scope uses "arguments".
bool scope_uses_arguments_;
// This scope uses "super" property ('super.foo').
bool scope_uses_super_property_;
// This scope has a parameter called "arguments".
......
......@@ -1367,7 +1367,6 @@ ParserBase<Traits>::ParseAndClassifyIdentifier(ExpressionClassifier* classifier,
}
}
if (this->IsArguments(name)) {
scope()->RecordArgumentsUsage();
classifier->RecordStrictModeFormalParameterError(
scanner()->location(), MessageTemplate::kStrictEvalArguments);
if (is_strict(language_mode())) {
......@@ -1434,9 +1433,7 @@ ParserBase<Traits>::ParseIdentifierOrStrictReservedWord(
return Traits::EmptyIdentifier();
}
IdentifierT name = this->GetSymbol(scanner());
if (this->IsArguments(name)) scope()->RecordArgumentsUsage();
return name;
return this->GetSymbol(scanner());
}
template <class Traits>
......@@ -1454,9 +1451,7 @@ ParserBase<Traits>::ParseIdentifierName(bool* ok) {
return Traits::EmptyIdentifier();
}
IdentifierT name = this->GetSymbol(scanner());
if (this->IsArguments(name)) scope()->RecordArgumentsUsage();
return name;
return this->GetSymbol(scanner());
}
......
......@@ -1104,8 +1104,11 @@ TEST(ScopeUsesArgumentsSuperThis) {
DCHECK_NOT_NULL(scope);
DCHECK_NULL(scope->sibling());
}
CHECK_EQ((source_data[i].expected & ARGUMENTS) != 0,
scope->uses_arguments());
// Arrows themselves never get an arguments object.
if ((source_data[i].expected & ARGUMENTS) != 0 &&
!scope->is_arrow_scope()) {
CHECK_NOT_NULL(scope->arguments());
}
CHECK_EQ((source_data[i].expected & SUPER_PROPERTY) != 0,
scope->uses_super_property());
if ((source_data[i].expected & THIS) != 0) {
......
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