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

[cleanup] Remove modules-related cruft from Scope

These bits were relevant back when we had nested lexical modules, but
I don't think they'll be of any use for ES2015 modules.

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

Cr-Commit-Position: refs/heads/master@{#32534}
parent 74d92ca8
...@@ -252,7 +252,6 @@ class AstValue : public ZoneObject { ...@@ -252,7 +252,6 @@ class AstValue : public ZoneObject {
F(dot_generator, ".generator") \ F(dot_generator, ".generator") \
F(dot_generator_object, ".generator_object") \ F(dot_generator_object, ".generator_object") \
F(dot_iterator, ".iterator") \ F(dot_iterator, ".iterator") \
F(dot_module, ".module") \
F(dot_result, ".result") \ F(dot_result, ".result") \
F(dot_switch_tag, ".switch_tag") \ F(dot_switch_tag, ".switch_tag") \
F(dot_catch, ".catch") \ F(dot_catch, ".catch") \
......
...@@ -202,8 +202,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope, ...@@ -202,8 +202,6 @@ void Scope::SetDefaults(ScopeType scope_type, Scope* outer_scope,
num_stack_slots_ = 0; num_stack_slots_ = 0;
num_heap_slots_ = 0; num_heap_slots_ = 0;
num_global_slots_ = 0; num_global_slots_ = 0;
num_modules_ = 0;
module_var_ = NULL;
arity_ = 0; arity_ = 0;
has_simple_parameters_ = true; has_simple_parameters_ = true;
rest_parameter_ = NULL; rest_parameter_ = NULL;
...@@ -714,16 +712,10 @@ bool Scope::AllocateVariables(ParseInfo* info, AstNodeFactory* factory) { ...@@ -714,16 +712,10 @@ bool Scope::AllocateVariables(ParseInfo* info, AstNodeFactory* factory) {
} }
PropagateScopeInfo(outer_scope_calls_sloppy_eval); PropagateScopeInfo(outer_scope_calls_sloppy_eval);
// 2) Allocate module instances. // 2) Resolve variables.
if (FLAG_harmony_modules && is_script_scope()) {
DCHECK(num_modules_ == 0);
AllocateModules();
}
// 3) Resolve variables.
if (!ResolveVariablesRecursively(info, factory)) return false; if (!ResolveVariablesRecursively(info, factory)) return false;
// 4) Allocate variables. // 3) Allocate variables.
AllocateVariablesRecursively(info->isolate()); AllocateVariablesRecursively(info->isolate());
return true; return true;
...@@ -1648,23 +1640,6 @@ void Scope::AllocateVariablesRecursively(Isolate* isolate) { ...@@ -1648,23 +1640,6 @@ void Scope::AllocateVariablesRecursively(Isolate* isolate) {
} }
void Scope::AllocateModules() {
DCHECK(is_script_scope());
DCHECK(!already_resolved());
for (int i = 0; i < inner_scopes_.length(); i++) {
Scope* scope = inner_scopes_.at(i);
if (scope->is_module_scope()) {
DCHECK(!scope->already_resolved());
DCHECK(scope->module_descriptor_->IsFrozen());
DCHECK_NULL(scope->module_var_);
scope->module_var_ =
NewTemporary(ast_value_factory_->dot_module_string());
++num_modules_;
}
}
}
int Scope::StackLocalCount() const { int Scope::StackLocalCount() const {
return num_stack_slots() - return num_stack_slots() -
(function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0);
......
...@@ -510,12 +510,6 @@ class Scope: public ZoneObject { ...@@ -510,12 +510,6 @@ class Scope: public ZoneObject {
int ContextLocalCount() const; int ContextLocalCount() const;
int ContextGlobalCount() const; int ContextGlobalCount() const;
// For script scopes, the number of module literals (including nested ones).
int num_modules() const { return num_modules_; }
// For module scopes, the host scope's internal variable binding this module.
Variable* module_var() const { return module_var_; }
// Make sure this scope and all outer scopes are eagerly compiled. // Make sure this scope and all outer scopes are eagerly compiled.
void ForceEagerCompilation() { force_eager_compilation_ = true; } void ForceEagerCompilation() { force_eager_compilation_ = true; }
...@@ -692,12 +686,6 @@ class Scope: public ZoneObject { ...@@ -692,12 +686,6 @@ class Scope: public ZoneObject {
int num_heap_slots_; int num_heap_slots_;
int num_global_slots_; int num_global_slots_;
// The number of modules (including nested ones).
int num_modules_;
// For module scopes, the host scope's temporary variable binding this module.
Variable* module_var_;
// Info about the parameter list of a function. // Info about the parameter list of a function.
int arity_; int arity_;
bool has_simple_parameters_; bool has_simple_parameters_;
...@@ -794,7 +782,6 @@ class Scope: public ZoneObject { ...@@ -794,7 +782,6 @@ class Scope: public ZoneObject {
void AllocateVariablesRecursively(Isolate* isolate); void AllocateVariablesRecursively(Isolate* isolate);
void AllocateParameter(Variable* var, int index); void AllocateParameter(Variable* var, int index);
void AllocateReceiver(); void AllocateReceiver();
void AllocateModules();
// Resolve and fill in the allocation information for all variables // Resolve and fill in the allocation information for all variables
// in this scopes. Must be called *after* all scopes have been // in this scopes. Must be called *after* all scopes have been
......
...@@ -5751,10 +5751,7 @@ TEST(ModuleParsingInternals) { ...@@ -5751,10 +5751,7 @@ TEST(ModuleParsingInternals) {
i::Scope* outer_scope = module_scope->outer_scope(); i::Scope* outer_scope = module_scope->outer_scope();
CHECK(outer_scope->is_script_scope()); CHECK(outer_scope->is_script_scope());
CHECK_NULL(outer_scope->outer_scope()); CHECK_NULL(outer_scope->outer_scope());
CHECK_EQ(1, outer_scope->num_modules());
CHECK(module_scope->is_module_scope()); CHECK(module_scope->is_module_scope());
CHECK_NOT_NULL(module_scope->module_var());
CHECK_EQ(i::TEMPORARY, module_scope->module_var()->mode());
i::ModuleDescriptor* descriptor = module_scope->module(); i::ModuleDescriptor* descriptor = module_scope->module();
CHECK_NOT_NULL(descriptor); CHECK_NOT_NULL(descriptor);
CHECK_EQ(1, descriptor->Length()); CHECK_EQ(1, descriptor->Length());
......
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