diff options
Diffstat (limited to 'deps/v8/src/scopes.h')
-rw-r--r-- | deps/v8/src/scopes.h | 57 |
1 files changed, 37 insertions, 20 deletions
diff --git a/deps/v8/src/scopes.h b/deps/v8/src/scopes.h index 30c95ee4e..d315b7e5d 100644 --- a/deps/v8/src/scopes.h +++ b/deps/v8/src/scopes.h @@ -49,7 +49,8 @@ class VariableMap: public ZoneHashMap { VariableMode mode, bool is_valid_lhs, Variable::Kind kind, - InitializationFlag initialization_flag); + InitializationFlag initialization_flag, + Interface* interface = Interface::NewValue()); Variable* Lookup(Handle<String> name); }; @@ -145,7 +146,8 @@ class Scope: public ZoneObject { // declared before, the previously declared variable is returned. Variable* DeclareLocal(Handle<String> name, VariableMode mode, - InitializationFlag init_flag); + InitializationFlag init_flag, + Interface* interface = Interface::NewValue()); // Declare an implicit global variable in this scope which must be a // global scope. The variable was introduced (possibly from an inner @@ -157,12 +159,14 @@ class Scope: public ZoneObject { template<class Visitor> VariableProxy* NewUnresolved(AstNodeFactory<Visitor>* factory, Handle<String> name, - int position = RelocInfo::kNoPosition) { + int position = RelocInfo::kNoPosition, + Interface* interface = Interface::NewValue()) { // Note that we must not share the unresolved variables with // the same name because they may be removed selectively via // RemoveUnresolved(). ASSERT(!already_resolved()); - VariableProxy* proxy = factory->NewVariableProxy(name, false, position); + VariableProxy* proxy = + factory->NewVariableProxy(name, false, position, interface); unresolved_.Add(proxy); return proxy; } @@ -295,9 +299,6 @@ class Scope: public ZoneObject { // Does this scope contain a with statement. bool contains_with() const { return scope_contains_with_; } - // The scope immediately surrounding this scope, or NULL. - Scope* outer_scope() const { return outer_scope_; } - // --------------------------------------------------------------------------- // Accessors. @@ -336,6 +337,12 @@ class Scope: public ZoneObject { // Inner scope list. ZoneList<Scope*>* inner_scopes() { return &inner_scopes_; } + // The scope immediately surrounding this scope, or NULL. + Scope* outer_scope() const { return outer_scope_; } + + // The interface as inferred so far; only for module scopes. + Interface* interface() const { return interface_; } + // --------------------------------------------------------------------------- // Variable allocation. @@ -345,17 +352,6 @@ class Scope: public ZoneObject { void CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals, ZoneList<Variable*>* context_locals); - // Resolve and fill in the allocation information for all variables - // in this scopes. Must be called *after* all scopes have been - // processed (parsed) to ensure that unresolved variables can be - // resolved properly. - // - // In the case of code compiled and run using 'eval', the context - // parameter is the context in which eval was called. In all other - // cases the context parameter is an empty handle. - void AllocateVariables(Scope* global_scope, - AstNodeFactory<AstNullVisitor>* factory); - // Current number of var or const locals. int num_var_or_const() { return num_var_or_const_; } @@ -372,6 +368,11 @@ class Scope: public ZoneObject { // Determine if we can use lazy compilation for this scope. bool AllowsLazyCompilation() const; + // True if we can lazily recompile functions with this scope. + bool allows_lazy_recompilation() const { + return !force_eager_compilation_; + } + // True if the outer context of this scope is always the global context. bool HasTrivialOuterContext() const; @@ -448,6 +449,8 @@ class Scope: public ZoneObject { VariableProxy* function_; // Convenience variable; function scopes only. Variable* arguments_; + // Interface; module scopes only. + Interface* interface_; // Illegal redeclaration. Expression* illegal_redecl_; @@ -543,10 +546,12 @@ class Scope: public ZoneObject { Variable* LookupRecursive(Handle<String> name, BindingKind* binding_kind, AstNodeFactory<AstNullVisitor>* factory); - void ResolveVariable(Scope* global_scope, + MUST_USE_RESULT + bool ResolveVariable(CompilationInfo* info, VariableProxy* proxy, AstNodeFactory<AstNullVisitor>* factory); - void ResolveVariablesRecursively(Scope* global_scope, + MUST_USE_RESULT + bool ResolveVariablesRecursively(CompilationInfo* info, AstNodeFactory<AstNullVisitor>* factory); // Scope analysis. @@ -566,6 +571,18 @@ class Scope: public ZoneObject { void AllocateNonParameterLocals(); void AllocateVariablesRecursively(); + // Resolve and fill in the allocation information for all variables + // in this scopes. Must be called *after* all scopes have been + // processed (parsed) to ensure that unresolved variables can be + // resolved properly. + // + // In the case of code compiled and run using 'eval', the context + // parameter is the context in which eval was called. In all other + // cases the context parameter is an empty handle. + MUST_USE_RESULT + bool AllocateVariables(CompilationInfo* info, + AstNodeFactory<AstNullVisitor>* factory); + private: // Construct a scope based on the scope info. Scope(Scope* inner_scope, ScopeType type, Handle<ScopeInfo> scope_info); |