Chromium Code Reviews| Index: src/ast/scopes.h |
| diff --git a/src/ast/scopes.h b/src/ast/scopes.h |
| index 0b84d630b91325343c6f77dd29f3ae31f6e257c3..b125e1795bbc8788cb22d738634495d330c363bc 100644 |
| --- a/src/ast/scopes.h |
| +++ b/src/ast/scopes.h |
| @@ -221,8 +221,14 @@ class Scope: public ZoneObject { |
| // --------------------------------------------------------------------------- |
| // Scope-specific info. |
| - // Inform the scope that the corresponding code contains an eval call. |
| - void RecordEvalCall() { scope_calls_eval_ = true; } |
| + // Inform the scope and outer scopes that the corresponding code contains an |
| + // eval call. |
| + void RecordEvalCall() { |
| + scope_calls_eval_ = true; |
| + for (Scope* scope = this; scope != nullptr; scope = scope->outer_scope()) { |
| + scope->inner_scope_calls_eval_ = true; |
| + } |
| + } |
|
neis
2016/08/22 13:21:47
Do I understand correctly that you are setting inn
Toon Verwaest
2016/08/22 14:13:28
Yes. All uses of inner_scope_calls_eval_ always di
|
| // Inform the scope that the corresponding code uses "super". |
| void RecordSuperPropertyUsage() { scope_uses_super_property_ = true; } |
| @@ -367,18 +373,9 @@ class Scope: public ZoneObject { |
| int ContextLocalCount() const; |
| int ContextGlobalCount() const; |
| - // Make sure this scope and all outer scopes are eagerly compiled. |
| - void ForceEagerCompilation() { force_eager_compilation_ = true; } |
| - |
| // Determine if we can parse a function literal in this scope lazily. |
| bool AllowsLazyParsing() const; |
| - // Determine if we can use lazy compilation for this scope. |
| - bool AllowsLazyCompilation() const; |
| - |
| - // Determine if we can use lazy compilation for this scope without a context. |
| - bool AllowsLazyCompilationWithoutContext() const; |
| - |
| // The number of contexts between this and scope; zero if this == scope. |
| int ContextChainLength(Scope* scope) const; |
| @@ -512,9 +509,7 @@ class Scope: public ZoneObject { |
| // Temporary workaround that allows masking of 'this' in debug-evalute scopes. |
| bool is_debug_evaluate_scope_ : 1; |
| - // Computed via PropagateScopeInfo. |
| bool inner_scope_calls_eval_ : 1; |
| - bool force_eager_compilation_ : 1; |
| bool force_context_allocation_ : 1; |
| // True if it holds 'var' declarations. |
| @@ -664,10 +659,9 @@ class DeclarationScope : public Scope { |
| bool NeedsHomeObject() const { |
| return scope_uses_super_property_ || |
| - ((scope_calls_eval_ || inner_scope_calls_eval_) && |
| - (IsConciseMethod(function_kind()) || |
| - IsAccessorFunction(function_kind()) || |
| - IsClassConstructor(function_kind()))); |
| + (inner_scope_calls_eval_ && (IsConciseMethod(function_kind()) || |
| + IsAccessorFunction(function_kind()) || |
| + IsClassConstructor(function_kind()))); |
| } |
| bool asm_module() const { return asm_module_; } |
| @@ -834,6 +828,20 @@ class DeclarationScope : public Scope { |
| Handle<StringSet> CollectNonLocals(ParseInfo* info, |
| Handle<StringSet> non_locals); |
| + // Determine if we can use lazy compilation for this scope. |
| + bool AllowsLazyCompilation() const; |
| + |
| + // Determine if we can use lazy compilation for this scope without a context. |
| + bool AllowsLazyCompilationWithoutContext() const; |
| + |
| + // Make this closure and all outer closures are eagerly compiled. |
|
neis
2016/08/22 13:21:47
There's a word missing here.
Toon Verwaest
2016/08/22 14:13:28
Done.
|
| + void ForceEagerCompilation() { |
|
neis
2016/08/22 13:21:47
Can you add something like DCHECK(IsClosureScope)
Toon Verwaest
2016/08/22 14:13:29
Done.
|
| + for (DeclarationScope* s = this; !s->is_script_scope(); |
| + s = s->outer_scope()->GetClosureScope()) { |
| + force_eager_compilation_ = true; |
|
neis
2016/08/22 13:21:47
s->force_eager_compilation_
Should this have caus
|
| + } |
| + } |
| + |
| #ifdef DEBUG |
| void PrintParameters(); |
| #endif |
| @@ -855,6 +863,7 @@ class DeclarationScope : public Scope { |
| bool asm_module_ : 1; |
| // This scope's outer context is an asm module. |
| bool asm_function_ : 1; |
| + bool force_eager_compilation_ : 1; |
| // Info about the parameter list of a function. |
| int arity_; |