summaryrefslogtreecommitdiff
path: root/deps/v8/src/scopes.h
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/src/scopes.h')
-rw-r--r--deps/v8/src/scopes.h33
1 files changed, 25 insertions, 8 deletions
diff --git a/deps/v8/src/scopes.h b/deps/v8/src/scopes.h
index 6e35d05a7f..c60c2e7d49 100644
--- a/deps/v8/src/scopes.h
+++ b/deps/v8/src/scopes.h
@@ -186,10 +186,16 @@ class Scope: public ZoneObject {
// such a variable again if it was added; otherwise this is a no-op.
void RemoveUnresolved(VariableProxy* var);
- // Creates a new temporary variable in this scope. The name is only used
+ // Creates a new internal variable in this scope. The name is only used
// for printing and cannot be used to find the variable. In particular,
// the only way to get hold of the temporary is by keeping the Variable*
// around.
+ Variable* NewInternal(Handle<String> name);
+
+ // Creates a new temporary variable in this scope. The name is only used
+ // for printing and cannot be used to find the variable. In particular,
+ // the only way to get hold of the temporary is by keeping the Variable*
+ // around. The name should not clash with a legitimate variable names.
Variable* NewTemporary(Handle<String> name);
// Adds the specific declaration node to the list of declarations in
@@ -369,6 +375,12 @@ class Scope: public ZoneObject {
int StackLocalCount() const;
int ContextLocalCount() const;
+ // For global 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.
void ForceEagerCompilation() { force_eager_compilation_ = true; }
@@ -387,6 +399,9 @@ class Scope: public ZoneObject {
// The number of contexts between this and scope; zero if this == scope.
int ContextChainLength(Scope* scope);
+ // Find the innermost global scope.
+ Scope* GlobalScope();
+
// Find the first function, global, or eval scope. This is the scope
// where var declarations will be hoisted to in the implementation.
Scope* DeclarationScope();
@@ -441,6 +456,8 @@ class Scope: public ZoneObject {
// variables may be implicitly 'declared' by being used (possibly in
// an inner scope) with no intervening with statements or eval calls.
VariableMap variables_;
+ // Compiler-allocated (user-invisible) internals.
+ ZoneList<Variable*> internals_;
// Compiler-allocated (user-invisible) temporaries.
ZoneList<Variable*> temps_;
// Parameter list in source order.
@@ -494,6 +511,12 @@ class Scope: public ZoneObject {
int num_stack_slots_;
int num_heap_slots_;
+ // The number of modules (including nested ones).
+ int num_modules_;
+
+ // For module scopes, the host scope's internal variable binding this module.
+ Variable* module_var_;
+
// Serialized scope info support.
Handle<ScopeInfo> scope_info_;
bool already_resolved() { return already_resolved_; }
@@ -578,6 +601,7 @@ class Scope: public ZoneObject {
void AllocateNonParameterLocal(Variable* var);
void AllocateNonParameterLocals();
void AllocateVariablesRecursively();
+ void AllocateModulesRecursively(Scope* host_scope);
// Resolve and fill in the allocation information for all variables
// in this scopes. Must be called *after* all scopes have been
@@ -591,13 +615,6 @@ class Scope: public ZoneObject {
bool AllocateVariables(CompilationInfo* info,
AstNodeFactory<AstNullVisitor>* factory);
- // Instance objects have to be created ahead of time (before code generation)
- // because of potentially cyclic references between them.
- // Linking also has to be a separate stage, since populating one object may
- // potentially require (forward) references to others.
- void AllocateModules(CompilationInfo* info);
- void LinkModules(CompilationInfo* info);
-
private:
// Construct a scope based on the scope info.
Scope(Scope* inner_scope, ScopeType type, Handle<ScopeInfo> scope_info,