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

Remove unused is_class_scope bit from Scope and ScopeInfo

This was added in https://chromium.googlesource.com/v8/v8/+/4a709dd65,
but the only check for it that remained in the final patch is inside
a DCHECK. It appears that the approach for checking use of class names
in methods evolved quite a bit over the review of the original patch.

Review URL: https://codereview.chromium.org/1219993002

Cr-Commit-Position: refs/heads/master@{#29428}
parent c26e5144
...@@ -4029,7 +4029,6 @@ class ScopeInfo : public FixedArray { ...@@ -4029,7 +4029,6 @@ class ScopeInfo : public FixedArray {
// context-allocated. Otherwise returns a value < 0. // context-allocated. Otherwise returns a value < 0.
int ReceiverContextSlotIndex(); int ReceiverContextSlotIndex();
bool block_scope_is_class_scope();
FunctionKind function_kind(); FunctionKind function_kind();
// Copies all the context locals into an object used to materialize a scope. // Copies all the context locals into an object used to materialize a scope.
...@@ -4157,10 +4156,8 @@ class ScopeInfo : public FixedArray { ...@@ -4157,10 +4156,8 @@ class ScopeInfo : public FixedArray {
class AsmFunctionField : public BitField<bool, AsmModuleField::kNext, 1> {}; class AsmFunctionField : public BitField<bool, AsmModuleField::kNext, 1> {};
class IsSimpleParameterListField class IsSimpleParameterListField
: public BitField<bool, AsmFunctionField::kNext, 1> {}; : public BitField<bool, AsmFunctionField::kNext, 1> {};
class BlockScopeIsClassScopeField
: public BitField<bool, IsSimpleParameterListField::kNext, 1> {};
class FunctionKindField class FunctionKindField
: public BitField<FunctionKind, BlockScopeIsClassScopeField::kNext, 8> {}; : public BitField<FunctionKind, IsSimpleParameterListField::kNext, 8> {};
// BitFields representing the encoded information for context locals in the // BitFields representing the encoded information for context locals in the
// ContextLocalInfoEntries part. // ContextLocalInfoEntries part.
......
...@@ -4455,11 +4455,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name, ...@@ -4455,11 +4455,7 @@ ClassLiteral* Parser::ParseClassLiteral(const AstRawString* name,
return NULL; return NULL;
} }
// Create a block scope which is additionally tagged as class scope; this is
// important for resolving variable references to the class name in the strong
// mode.
Scope* block_scope = NewScope(scope_, BLOCK_SCOPE); Scope* block_scope = NewScope(scope_, BLOCK_SCOPE);
block_scope->tag_as_class_scope();
BlockState block_state(&scope_, block_scope); BlockState block_state(&scope_, block_scope);
scope_->SetLanguageMode( scope_->SetLanguageMode(
static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT)); static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT));
......
...@@ -89,7 +89,6 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone, ...@@ -89,7 +89,6 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate, Zone* zone,
AsmModuleField::encode(scope->asm_module()) | AsmModuleField::encode(scope->asm_module()) |
AsmFunctionField::encode(scope->asm_function()) | AsmFunctionField::encode(scope->asm_function()) |
IsSimpleParameterListField::encode(simple_parameter_list) | IsSimpleParameterListField::encode(simple_parameter_list) |
BlockScopeIsClassScopeField::encode(scope->is_class_scope()) |
FunctionKindField::encode(scope->function_kind()); FunctionKindField::encode(scope->function_kind());
scope_info->SetFlags(flags); scope_info->SetFlags(flags);
scope_info->SetParameterCount(parameter_count); scope_info->SetParameterCount(parameter_count);
...@@ -223,7 +222,6 @@ Handle<ScopeInfo> ScopeInfo::CreateGlobalThisBinding(Isolate* isolate) { ...@@ -223,7 +222,6 @@ Handle<ScopeInfo> ScopeInfo::CreateGlobalThisBinding(Isolate* isolate) {
FunctionVariableMode::encode(function_variable_mode) | FunctionVariableMode::encode(function_variable_mode) |
AsmModuleField::encode(false) | AsmFunctionField::encode(false) | AsmModuleField::encode(false) | AsmFunctionField::encode(false) |
IsSimpleParameterListField::encode(simple_parameter_list) | IsSimpleParameterListField::encode(simple_parameter_list) |
BlockScopeIsClassScopeField::encode(false) |
FunctionKindField::encode(FunctionKind::kNormalFunction); FunctionKindField::encode(FunctionKind::kNormalFunction);
scope_info->SetFlags(flags); scope_info->SetFlags(flags);
scope_info->SetParameterCount(parameter_count); scope_info->SetParameterCount(parameter_count);
...@@ -567,11 +565,6 @@ int ScopeInfo::FunctionContextSlotIndex(String* name, VariableMode* mode) { ...@@ -567,11 +565,6 @@ int ScopeInfo::FunctionContextSlotIndex(String* name, VariableMode* mode) {
} }
bool ScopeInfo::block_scope_is_class_scope() {
return BlockScopeIsClassScopeField::decode(Flags());
}
FunctionKind ScopeInfo::function_kind() { FunctionKind ScopeInfo::function_kind() {
return FunctionKindField::decode(Flags()); return FunctionKindField::decode(Flags());
} }
......
...@@ -152,7 +152,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope, ...@@ -152,7 +152,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope,
outer_scope_ = outer_scope; outer_scope_ = outer_scope;
scope_type_ = scope_type; scope_type_ = scope_type;
function_kind_ = function_kind; function_kind_ = function_kind;
block_scope_is_class_scope_ = false;
scope_name_ = ast_value_factory_->empty_string(); scope_name_ = ast_value_factory_->empty_string();
dynamics_ = nullptr; dynamics_ = nullptr;
receiver_ = nullptr; receiver_ = nullptr;
...@@ -189,7 +188,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope, ...@@ -189,7 +188,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope,
if (!scope_info.is_null()) { if (!scope_info.is_null()) {
scope_calls_eval_ = scope_info->CallsEval(); scope_calls_eval_ = scope_info->CallsEval();
language_mode_ = scope_info->language_mode(); language_mode_ = scope_info->language_mode();
block_scope_is_class_scope_ = scope_info->block_scope_is_class_scope();
function_kind_ = scope_info->function_kind(); function_kind_ = scope_info->function_kind();
} }
} }
...@@ -1232,7 +1230,6 @@ ClassVariable* Scope::ClassVariableForMethod() const { ...@@ -1232,7 +1230,6 @@ ClassVariable* Scope::ClassVariableForMethod() const {
return nullptr; return nullptr;
} }
DCHECK_NOT_NULL(outer_scope_); DCHECK_NOT_NULL(outer_scope_);
DCHECK(outer_scope_->is_class_scope());
// The class scope contains at most one variable, the class name. // The class scope contains at most one variable, the class name.
DCHECK(outer_scope_->variables_.occupancy() <= 1); DCHECK(outer_scope_->variables_.occupancy() <= 1);
if (outer_scope_->variables_.occupancy() == 0) return nullptr; if (outer_scope_->variables_.occupancy() == 0) return nullptr;
......
...@@ -280,13 +280,6 @@ class Scope: public ZoneObject { ...@@ -280,13 +280,6 @@ class Scope: public ZoneObject {
bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; } bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; }
bool is_with_scope() const { return scope_type_ == WITH_SCOPE; } bool is_with_scope() const { return scope_type_ == WITH_SCOPE; }
bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; } bool is_arrow_scope() const { return scope_type_ == ARROW_SCOPE; }
void tag_as_class_scope() {
DCHECK(is_block_scope());
block_scope_is_class_scope_ = true;
}
bool is_class_scope() const {
return is_block_scope() && block_scope_is_class_scope_;
}
bool is_declaration_scope() const { bool is_declaration_scope() const {
return is_eval_scope() || is_function_scope() || return is_eval_scope() || is_function_scope() ||
is_module_scope() || is_script_scope(); is_module_scope() || is_script_scope();
...@@ -544,8 +537,6 @@ class Scope: public ZoneObject { ...@@ -544,8 +537,6 @@ class Scope: public ZoneObject {
// The scope type. // The scope type.
ScopeType scope_type_; ScopeType scope_type_;
// Some block scopes are tagged as class scopes.
bool block_scope_is_class_scope_;
// If the scope is a function scope, this is the function kind. // If the scope is a function scope, this is the function kind.
FunctionKind function_kind_; FunctionKind function_kind_;
......
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