Commit 0c92a6eb authored by marja's avatar marja Committed by Commit bot

Scope cleanup: remove unneeded params.

BUG=

Review-Url: https://codereview.chromium.org/2517993002
Cr-Commit-Position: refs/heads/master@{#41145}
parent 2e5a90fd
...@@ -243,8 +243,8 @@ Scope::Scope(Zone* zone, const AstRawString* catch_variable_name, ...@@ -243,8 +243,8 @@ Scope::Scope(Zone* zone, const AstRawString* catch_variable_name,
// Cache the catch variable, even though it's also available via the // Cache the catch variable, even though it's also available via the
// scope_info, as the parser expects that a catch scope always has the catch // scope_info, as the parser expects that a catch scope always has the catch
// variable as first and only variable. // variable as first and only variable.
Variable* variable = Declare(zone, this, catch_variable_name, VAR, Variable* variable = Declare(zone, catch_variable_name, VAR, NORMAL_VARIABLE,
NORMAL_VARIABLE, kCreatedInitialized); kCreatedInitialized);
AllocateHeapSlot(variable); AllocateHeapSlot(variable);
} }
...@@ -579,7 +579,7 @@ void DeclarationScope::DeclareThis(AstValueFactory* ast_value_factory) { ...@@ -579,7 +579,7 @@ void DeclarationScope::DeclareThis(AstValueFactory* ast_value_factory) {
bool subclass_constructor = IsSubclassConstructor(function_kind_); bool subclass_constructor = IsSubclassConstructor(function_kind_);
Variable* var = Declare( Variable* var = Declare(
zone(), this, ast_value_factory->this_string(), zone(), ast_value_factory->this_string(),
subclass_constructor ? CONST : VAR, THIS_VARIABLE, subclass_constructor ? CONST : VAR, THIS_VARIABLE,
subclass_constructor ? kNeedsInitialization : kCreatedInitialized); subclass_constructor ? kNeedsInitialization : kCreatedInitialized);
receiver_ = var; receiver_ = var;
...@@ -594,8 +594,8 @@ void DeclarationScope::DeclareArguments(AstValueFactory* ast_value_factory) { ...@@ -594,8 +594,8 @@ void DeclarationScope::DeclareArguments(AstValueFactory* ast_value_factory) {
// Declare 'arguments' variable which exists in all non arrow functions. // Declare 'arguments' variable which exists in all non arrow functions.
// Note that it might never be accessed, in which case it won't be // Note that it might never be accessed, in which case it won't be
// allocated during variable allocation. // allocated during variable allocation.
arguments_ = Declare(zone(), this, ast_value_factory->arguments_string(), arguments_ = Declare(zone(), ast_value_factory->arguments_string(), VAR,
VAR, NORMAL_VARIABLE, kCreatedInitialized); NORMAL_VARIABLE, kCreatedInitialized);
} else if (IsLexicalVariableMode(arguments_->mode())) { } else if (IsLexicalVariableMode(arguments_->mode())) {
// Check if there's lexically declared variable named arguments to avoid // Check if there's lexically declared variable named arguments to avoid
// redeclaration. See ES#sec-functiondeclarationinstantiation, step 20. // redeclaration. See ES#sec-functiondeclarationinstantiation, step 20.
...@@ -609,14 +609,13 @@ void DeclarationScope::DeclareDefaultFunctionVariables( ...@@ -609,14 +609,13 @@ void DeclarationScope::DeclareDefaultFunctionVariables(
DCHECK(!is_arrow_scope()); DCHECK(!is_arrow_scope());
DeclareThis(ast_value_factory); DeclareThis(ast_value_factory);
new_target_ = Declare(zone(), this, ast_value_factory->new_target_string(), new_target_ = Declare(zone(), ast_value_factory->new_target_string(), CONST,
CONST, NORMAL_VARIABLE, kCreatedInitialized); NORMAL_VARIABLE, kCreatedInitialized);
if (IsConciseMethod(function_kind_) || IsClassConstructor(function_kind_) || if (IsConciseMethod(function_kind_) || IsClassConstructor(function_kind_) ||
IsAccessorFunction(function_kind_)) { IsAccessorFunction(function_kind_)) {
this_function_ = this_function_ = Declare(zone(), ast_value_factory->this_function_string(),
Declare(zone(), this, ast_value_factory->this_function_string(), CONST, CONST, NORMAL_VARIABLE, kCreatedInitialized);
NORMAL_VARIABLE, kCreatedInitialized);
} }
} }
...@@ -686,13 +685,13 @@ void DeclarationScope::AddLocal(Variable* var) { ...@@ -686,13 +685,13 @@ void DeclarationScope::AddLocal(Variable* var) {
locals_.Add(var); locals_.Add(var);
} }
Variable* Scope::Declare(Zone* zone, Scope* scope, const AstRawString* name, Variable* Scope::Declare(Zone* zone, const AstRawString* name,
VariableMode mode, VariableKind kind, VariableMode mode, VariableKind kind,
InitializationFlag initialization_flag, InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag) { MaybeAssignedFlag maybe_assigned_flag) {
bool added; bool added;
Variable* var = Variable* var =
variables_.Declare(zone, scope, name, mode, kind, initialization_flag, variables_.Declare(zone, this, name, mode, kind, initialization_flag,
maybe_assigned_flag, &added); maybe_assigned_flag, &added);
if (added) locals_.Add(var); if (added) locals_.Add(var);
return var; return var;
...@@ -844,8 +843,7 @@ Variable* DeclarationScope::DeclareParameter( ...@@ -844,8 +843,7 @@ Variable* DeclarationScope::DeclareParameter(
if (mode == TEMPORARY) { if (mode == TEMPORARY) {
var = NewTemporary(name); var = NewTemporary(name);
} else { } else {
var = var = Declare(zone(), name, mode, NORMAL_VARIABLE, kCreatedInitialized);
Declare(zone(), this, name, mode, NORMAL_VARIABLE, kCreatedInitialized);
// TODO(wingo): Avoid O(n^2) check. // TODO(wingo): Avoid O(n^2) check.
*is_duplicate = IsDeclaredParameter(name); *is_duplicate = IsDeclaredParameter(name);
} }
...@@ -865,8 +863,7 @@ Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode, ...@@ -865,8 +863,7 @@ Variable* Scope::DeclareLocal(const AstRawString* name, VariableMode mode,
// introduced during variable allocation, and TEMPORARY variables are // introduced during variable allocation, and TEMPORARY variables are
// allocated via NewTemporary(). // allocated via NewTemporary().
DCHECK(IsDeclaredVariableMode(mode)); DCHECK(IsDeclaredVariableMode(mode));
return Declare(zone(), this, name, mode, kind, init_flag, return Declare(zone(), name, mode, kind, init_flag, maybe_assigned_flag);
maybe_assigned_flag);
} }
Variable* Scope::DeclareVariable( Variable* Scope::DeclareVariable(
......
...@@ -426,9 +426,8 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) { ...@@ -426,9 +426,8 @@ class V8_EXPORT_PRIVATE Scope : public NON_EXPORTED_BASE(ZoneObject) {
} }
private: private:
Variable* Declare(Zone* zone, Scope* scope, const AstRawString* name, Variable* Declare(Zone* zone, const AstRawString* name, VariableMode mode,
VariableMode mode, VariableKind kind, VariableKind kind, InitializationFlag initialization_flag,
InitializationFlag initialization_flag,
MaybeAssignedFlag maybe_assigned_flag = kNotAssigned); MaybeAssignedFlag maybe_assigned_flag = kNotAssigned);
// This method should only be invoked on scopes created during parsing (i.e., // This method should only be invoked on scopes created during parsing (i.e.,
......
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