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

Unified Diff: src/ast/scopes.h

Issue 2423883002: Move should_eager_compile and is_lazily_parsed to DeclarationScope (Closed)
Patch Set: Created 4 years, 2 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 | « src/ast/ast.cc ('k') | 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 478470eadbc776c83df449469e3ac99f8dda4897..427fab15c226580978eba1505229acb38bef0b46 100644
--- a/src/ast/scopes.h
+++ b/src/ast/scopes.h
@@ -369,6 +369,7 @@ class Scope: public ZoneObject {
// the scope for which a function prologue allocates a context) or declaring
// temporaries.
DeclarationScope* GetClosureScope();
+ const DeclarationScope* GetClosureScope() const;
// Find the first (non-arrow) function or script scope. This is where
// 'this' is bound, and what determines the function kind.
@@ -417,14 +418,6 @@ class Scope: public ZoneObject {
void set_is_debug_evaluate_scope() { is_debug_evaluate_scope_ = true; }
bool is_debug_evaluate_scope() const { return is_debug_evaluate_scope_; }
- bool is_lazily_parsed() const { return is_lazily_parsed_; }
-
- bool ShouldEagerCompile() const;
-
- // Marks this scope and all inner scopes (except for inner function scopes)
- // such that they get eagerly compiled.
- void SetShouldEagerCompile();
-
protected:
explicit Scope(Zone* zone);
@@ -449,16 +442,7 @@ class Scope: public ZoneObject {
// not deserialized from a context). Also, since NeedsContext() is only
// returning a valid result after variables are resolved, NeedsScopeInfo()
// should also be invoked after resolution.
- bool NeedsScopeInfo() const {
- DCHECK(!already_resolved_);
- // A lazily parsed scope doesn't contain enough information to create a
- // ScopeInfo from it.
- if (!ShouldEagerCompile()) return false;
- // The debugger expects all functions to have scope infos.
- // TODO(jochen|yangguo): Remove this requirement.
- if (is_function_scope()) return true;
- return NeedsContext();
- }
+ bool NeedsScopeInfo() const;
Zone* zone_;
@@ -528,9 +512,6 @@ class Scope: public ZoneObject {
// True if it holds 'var' declarations.
bool is_declaration_scope_ : 1;
- bool is_lazily_parsed_ : 1;
- bool should_eager_compile_ : 1;
-
// Create a non-local variable with a given name.
// These variables are looked up dynamically at runtime.
Variable* NonLocal(const AstRawString* name, VariableMode mode);
@@ -636,6 +617,10 @@ class DeclarationScope : public Scope {
IsClassConstructor(function_kind())));
}
+ bool is_lazily_parsed() const { return is_lazily_parsed_; }
+ bool ShouldEagerCompile() const;
+ void set_should_eager_compile();
+
void SetScriptScopeInfo(Handle<ScopeInfo> scope_info) {
DCHECK(is_script_scope());
DCHECK(scope_info_.is_null());
@@ -839,6 +824,8 @@ class DeclarationScope : public Scope {
bool has_arguments_parameter_ : 1;
// This scope uses "super" property ('super.foo').
bool scope_uses_super_property_ : 1;
+ bool should_eager_compile_ : 1;
+ bool is_lazily_parsed_ : 1;
// Parameter list in source order.
ZoneList<Variable*> params_;
« no previous file with comments | « src/ast/ast.cc ('k') | src/ast/scopes.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698