Reviewers: rossberg,
Description:
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.
Please review this at https://codereview.chromium.org/1219993002/
Base URL: https://chromium.googlesource.com/v8/v8.git@master
Affected files (+1, -27 lines):
M src/objects.h
M src/parser.cc
M src/scopeinfo.cc
M src/scopes.h
M src/scopes.cc
Index: src/objects.h
diff --git a/src/objects.h b/src/objects.h
index
ac101e5579cc25465f6cb45647f8e183898d1bdb..4f366cc276985141f5e37ae4a57a8b6e55e065b4
100644
--- a/src/objects.h
+++ b/src/objects.h
@@ -4029,7 +4029,6 @@ class ScopeInfo : public FixedArray {
// context-allocated. Otherwise returns a value < 0.
int ReceiverContextSlotIndex();
- bool block_scope_is_class_scope();
FunctionKind function_kind();
// Copies all the context locals into an object used to materialize a
scope.
@@ -4157,10 +4156,8 @@ class ScopeInfo : public FixedArray {
class AsmFunctionField : public BitField<bool, AsmModuleField::kNext, 1>
{};
class IsSimpleParameterListField
: public BitField<bool, AsmFunctionField::kNext, 1> {};
- class BlockScopeIsClassScopeField
- : public BitField<bool, IsSimpleParameterListField::kNext, 1> {};
class FunctionKindField
- : public BitField<FunctionKind, BlockScopeIsClassScopeField::kNext,
8> {};
+ : public BitField<FunctionKind, IsSimpleParameterListField::kNext,
8> {};
// BitFields representing the encoded information for context locals in
the
// ContextLocalInfoEntries part.
Index: src/parser.cc
diff --git a/src/parser.cc b/src/parser.cc
index
b9dcbfd84d11baf66e5b9f51e3f822510e0ed1d1..8f53c257c68e3c2579ece335c0518a19787a243e
100644
--- a/src/parser.cc
+++ b/src/parser.cc
@@ -4421,11 +4421,7 @@ ClassLiteral* Parser::ParseClassLiteral(const
AstRawString* name,
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);
- block_scope->tag_as_class_scope();
BlockState block_state(&scope_, block_scope);
scope_->SetLanguageMode(
static_cast<LanguageMode>(scope_->language_mode() | STRICT_BIT));
Index: src/scopeinfo.cc
diff --git a/src/scopeinfo.cc b/src/scopeinfo.cc
index
8bc0a9a503440441b9ac99ffe2ae60d452c3a5cb..f77ef96ebac4cd8da6bd33f1bd58936a021f354f
100644
--- a/src/scopeinfo.cc
+++ b/src/scopeinfo.cc
@@ -89,7 +89,6 @@ Handle<ScopeInfo> ScopeInfo::Create(Isolate* isolate,
Zone* zone,
AsmModuleField::encode(scope->asm_module()) |
AsmFunctionField::encode(scope->asm_function()) |
IsSimpleParameterListField::encode(simple_parameter_list) |
- BlockScopeIsClassScopeField::encode(scope->is_class_scope())
|
FunctionKindField::encode(scope->function_kind());
scope_info->SetFlags(flags);
scope_info->SetParameterCount(parameter_count);
@@ -223,7 +222,6 @@ Handle<ScopeInfo>
ScopeInfo::CreateGlobalThisBinding(Isolate* isolate) {
FunctionVariableMode::encode(function_variable_mode) |
AsmModuleField::encode(false) |
AsmFunctionField::encode(false) |
IsSimpleParameterListField::encode(simple_parameter_list) |
- BlockScopeIsClassScopeField::encode(false) |
FunctionKindField::encode(FunctionKind::kNormalFunction);
scope_info->SetFlags(flags);
scope_info->SetParameterCount(parameter_count);
@@ -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() {
return FunctionKindField::decode(Flags());
}
Index: src/scopes.cc
diff --git a/src/scopes.cc b/src/scopes.cc
index
5f7ed84beecca11f7e5f3715c93b5aa4f58a903e..64f9584d59dcb5974952981386f3ff9a0ba50cd3
100644
--- a/src/scopes.cc
+++ b/src/scopes.cc
@@ -152,7 +152,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope*
outer_scope,
outer_scope_ = outer_scope;
scope_type_ = scope_type;
function_kind_ = function_kind;
- block_scope_is_class_scope_ = false;
scope_name_ = ast_value_factory_->empty_string();
dynamics_ = nullptr;
receiver_ = nullptr;
@@ -189,7 +188,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope*
outer_scope,
if (!scope_info.is_null()) {
scope_calls_eval_ = scope_info->CallsEval();
language_mode_ = scope_info->language_mode();
- block_scope_is_class_scope_ = scope_info->block_scope_is_class_scope();
function_kind_ = scope_info->function_kind();
}
}
@@ -1232,7 +1230,6 @@ ClassVariable* Scope::ClassVariableForMethod() const {
return nullptr;
}
DCHECK_NOT_NULL(outer_scope_);
- DCHECK(outer_scope_->is_class_scope());
// The class scope contains at most one variable, the class name.
DCHECK(outer_scope_->variables_.occupancy() <= 1);
if (outer_scope_->variables_.occupancy() == 0) return nullptr;
Index: src/scopes.h
diff --git a/src/scopes.h b/src/scopes.h
index
fac8a5622d440d1a4a6db537839d297089d77091..1b43f8e393399e152cb389fb737c56f74f150560
100644
--- a/src/scopes.h
+++ b/src/scopes.h
@@ -280,13 +280,6 @@ class Scope: public ZoneObject {
bool is_block_scope() const { return scope_type_ == BLOCK_SCOPE; }
bool is_with_scope() const { return scope_type_ == WITH_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 {
return is_eval_scope() || is_function_scope() ||
is_module_scope() || is_script_scope();
@@ -544,8 +537,6 @@ class Scope: public ZoneObject {
// The 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.
FunctionKind function_kind_;
--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
---
You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.