Chromium Code Reviews| Index: src/ast/scopes.cc |
| diff --git a/src/ast/scopes.cc b/src/ast/scopes.cc |
| index 8d23875ab6bca368251b9dd13d2172e8291a571d..d2f9ca2edfdbc037b3f2457428f5fd4acc799a3b 100644 |
| --- a/src/ast/scopes.cc |
| +++ b/src/ast/scopes.cc |
| @@ -953,7 +953,7 @@ VariableProxy* Scope::NewUnresolved(AstNodeFactory* factory, |
| // the same name because they may be removed selectively via |
| // RemoveUnresolved(). |
| DCHECK(!already_resolved_); |
| - DCHECK_EQ(factory->zone(), zone()); |
| + // DCHECK_EQ(factory->zone(), zone()); |
|
Toon Verwaest
2016/09/26 14:24:30
We should probably just drop this?
marja
2016/09/27 07:14:03
Hmmmm... I think this was a nice DCHECK for guardi
marja
2016/09/27 11:17:34
Suggestion: flag scopes w/ needs_migration, here w
|
| VariableProxy* proxy = |
| factory->NewVariableProxy(name, kind, start_position, end_position); |
| proxy->set_next_unresolved(unresolved_); |
| @@ -1188,36 +1188,29 @@ Handle<StringSet> DeclarationScope::CollectNonLocals( |
| return non_locals; |
| } |
| -void DeclarationScope::AnalyzePartially(DeclarationScope* migrate_to, |
| - AstNodeFactory* ast_node_factory) { |
| - // Try to resolve unresolved variables for this Scope and migrate those which |
| - // cannot be resolved inside. It doesn't make sense to try to resolve them in |
| - // the outer Scopes here, because they are incomplete. |
| - for (VariableProxy* proxy = |
| - FetchFreeVariables(this, !FLAG_lazy_inner_functions); |
| - proxy != nullptr; proxy = proxy->next_unresolved()) { |
| - DCHECK(!proxy->is_resolved()); |
| - VariableProxy* copy = ast_node_factory->CopyVariableProxy(proxy); |
| - migrate_to->AddUnresolved(copy); |
| +void DeclarationScope::AnalyzePartially(AstNodeFactory* ast_node_factory) { |
| + DCHECK(!force_eager_compilation_); |
| + VariableProxy* unresolved = nullptr; |
| + |
| + if (!outer_scope_->is_script_scope()) { |
| + // Try to resolve unresolved variables for this Scope and migrate those |
| + // which |
| + // cannot be resolved inside. It doesn't make sense to try to resolve them |
| + // in |
| + // the outer Scopes here, because they are incomplete. |
| + for (VariableProxy* proxy = |
| + FetchFreeVariables(this, !FLAG_lazy_inner_functions); |
| + proxy != nullptr; proxy = proxy->next_unresolved()) { |
| + DCHECK(!proxy->is_resolved()); |
| + VariableProxy* copy = ast_node_factory->CopyVariableProxy(proxy); |
| + copy->set_next_unresolved(unresolved); |
| + unresolved = copy; |
| + } |
| } |
| - // Push scope data up to migrate_to. Note that migrate_to and this Scope |
| - // describe the same Scope, just in different Zones. |
| - PropagateUsageFlagsToScope(migrate_to); |
| - if (scope_uses_super_property_) migrate_to->scope_uses_super_property_ = true; |
| - if (inner_scope_calls_eval_) migrate_to->inner_scope_calls_eval_ = true; |
| - if (is_lazily_parsed_) migrate_to->is_lazily_parsed_ = true; |
| - DCHECK(!force_eager_compilation_); |
| - migrate_to->set_start_position(start_position_); |
| - migrate_to->set_end_position(end_position_); |
| - migrate_to->set_language_mode(language_mode()); |
| - migrate_to->arity_ = arity_; |
| - migrate_to->force_context_allocation_ = force_context_allocation_; |
| - outer_scope_->RemoveInnerScope(this); |
| - DCHECK_EQ(outer_scope_, migrate_to->outer_scope_); |
| - DCHECK_EQ(outer_scope_->zone(), migrate_to->zone()); |
| - DCHECK_EQ(NeedsHomeObject(), migrate_to->NeedsHomeObject()); |
| - DCHECK_EQ(asm_function_, migrate_to->asm_function_); |
| + ResetAfterPreparsing(); |
|
marja
2016/09/27 07:14:03
This is somewhat surprising now since we haven't n
|
| + |
| + unresolved_ = unresolved; |
| } |
| #ifdef DEBUG |