Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10)

Unified Diff: src/ast/scopes.h

Issue 2269603002: Always immediately propagate flags outwards rather than relying on PropagateScopeInfo (Closed) Base URL: https://chromium.googlesource.com/v8/v8.git@master
Patch Set: Rebase Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/ast/scopes.h
diff --git a/src/ast/scopes.h b/src/ast/scopes.h
index 00f4b1dc8b26891b16d29672a371f4232e3af582..ea478f69b1c269c1ac438f10113f1923a6c6a633 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() {
adamk 2016/08/22 19:12:07 Note that in sloppy mode we make two calls to Reco
+ scope_calls_eval_ = true;
+ for (Scope* scope = this; scope != nullptr; scope = scope->outer_scope()) {
+ scope->inner_scope_calls_eval_ = true;
+ }
+ }
// 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;
@@ -510,9 +507,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.
@@ -662,10 +657,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_; }
@@ -832,6 +826,21 @@ 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 sure this closure and all outer closures are eagerly compiled.
+ void ForceEagerCompilation() {
+ DCHECK_EQ(this, GetClosureScope());
+ for (DeclarationScope* s = this; !s->is_script_scope();
+ s = s->outer_scope()->GetClosureScope()) {
+ s->force_eager_compilation_ = true;
+ }
+ }
+
#ifdef DEBUG
void PrintParameters();
#endif
@@ -853,6 +862,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;
// This scope has a parameter called "arguments".
bool has_arguments_parameter_ : 1;
« no previous file with comments | « no previous file | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698