Home | History | Annotate | Download | only in src

Lines Matching refs:Scope

68     Scope* scope,
80 p->value = new(zone()) Variable(scope,
105 // Implementation of Scope
107 Scope::Scope(Scope* outer_scope, ScopeType scope_type, Zone* zone)
122 // The outermost scope must be a global scope.
128 Scope::Scope(Scope* inner_scope,
154 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name, Zone* zone)
180 void Scope::SetDefaults(ScopeType scope_type,
181 Scope* outer_scope,
194 // Inherit the strict mode from the parent scope.
217 Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope,
219 // Reconstruct the outer scope chain from a closure's context chain.
220 Scope* current_scope = NULL;
221 Scope* innermost_scope = NULL;
225 Scope* with_scope = new(zone) Scope(current_scope,
232 for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) {
237 current_scope = new(zone) Scope(current_scope,
243 current_scope = new(zone) Scope(current_scope,
249 current_scope = new(zone) Scope(current_scope,
255 current_scope = new(zone) Scope(current_scope,
262 current_scope = new(zone) Scope(
281 bool Scope::Analyze(CompilationInfo* info) {
283 Scope* scope = info->function()->scope();
284 Scope* top = scope;
286 // Traverse the scope tree up to the first unresolved scope or the global
287 // scope and start scope resolution and variable allocation from that scope.
304 scope->Print();
313 info->SetScope(scope);
318 void Scope::Initialize() {
321 // Add this scope as a new inner scope of the outer scope.
330 // Declare and allocate receiver (even for the global scope, and even
332 // NOTE: When loading parameters in the global scope, we must take
366 Scope* Scope::FinalizeBlockScope() {
374 // Remove this scope from outer scope.
396 Variable* Scope::LocalLookup(Handle<String> name) {
401 // If we have a serialized scope info, we might find the variable there.
427 Variable* Scope::LookupFunctionVar(Handle<String> name,
432 // If we are backed by a scope info, try to lookup the variable there.
451 Variable* Scope::Lookup(Handle<String> name) {
452 for (Scope* scope = this;
453 scope != NULL;
454 scope = scope->outer_scope()) {
455 Variable* var = scope->LocalLookup(name);
462 void Scope::DeclareParameter(Handle<String> name, VariableMode mode) {
471 Variable* Scope::DeclareLocal(Handle<String> name,
486 Variable* Scope::DeclareDynamicGlobal(Handle<String> name) {
497 void Scope::RemoveUnresolved(VariableProxy* var) {
509 Variable* Scope::NewInternal(Handle<String> name) {
522 Variable* Scope::NewTemporary(Handle<String> name) {
535 void Scope::AddDeclaration(Declaration* declaration) {
540 void Scope::SetIllegalRedeclaration(Expression* expression) {
549 void Scope::VisitIllegalRedeclaration(AstVisitor* visitor) {
555 Declaration* Scope::CheckConflictingVarDeclarations() {
562 // Iterate through all scopes until and including the declaration scope.
563 Scope* previous = NULL;
564 Scope* current = decl->scope();
594 void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals,
646 bool Scope::AllocateVariables(CompilationInfo* info,
648 // 1) Propagate scope information.
673 bool Scope::HasTrivialContext() const {
674 // A function scope has a trivial context if it always is the global
676 // there is anything that makes this scope non-trivial; otherwise we
678 for (const Scope* scope = this; scope != NULL; scope = scope->outer_scope_) {
679 if (scope->is_eval_scope()) return false;
680 if (scope->scope_inside_with_) return false;
681 if (scope->num_heap_slots_ > 0) return false;
687 bool Scope::HasTrivialOuterContext() const {
688 Scope* outer = outer_scope_;
691 // scope may be inside a 'with' statement in which case the outer context
692 // for this scope is not trivial.
697 bool Scope::HasLazyCompilableOuterContext() const {
698 Scope* outer = outer_scope_;
700 // We have to prevent lazy compilation if this scope is inside a with scope
702 // declaration scopes may become invisible during scope info deserialization.
705 for (const Scope* scope = outer; scope != NULL; scope = scope->outer_scope_) {
706 if (scope->is_with_scope() && !found_non_trivial_declarations) return false;
707 if (scope->is_declaration_scope() && scope->num_heap_slots() > 0) {
715 bool Scope::AllowsLazyCompilation() const {
720 bool Scope::AllowsLazyCompilationWithoutContext() const {
725 int Scope::ContextChainLength(Scope* scope) {
727 for (Scope* s = this; s != scope; s = s->outer_scope_) {
728 ASSERT(s != NULL); // scope must be in the scope chain
738 Scope* Scope::GlobalScope() {
739 Scope* scope = this;
740 while (!scope->is_global_scope()) {
741 scope = scope->outer_scope();
743 return scope;
747 Scope* Scope::DeclarationScope() {
748 Scope* scope = this;
749 while (!scope->is_declaration_scope()) {
750 scope = scope->outer_scope();
752 return scope;
756 Handle<ScopeInfo> Scope::GetScopeInfo() {
764 void Scope::GetNestedScopeChain(
770 Scope* scope = inner_scopes_[i];
771 int beg_pos = scope->start_position();
772 int end_pos = scope->end_position();
775 scope->GetNestedScopeChain(chain, position);
853 void Scope::Print(int n) {
883 // Scope info.
885 Indent(n1, "// scope has trivial outer context\n");
891 Indent(n1, "// strict mode scope\n");
894 Indent(n1, "// extended mode scope\n");
897 if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n");
898 if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n");
899 if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n");
901 Indent(n1, "// outer scope calls 'eval' in non-strict context\n");
903 if (inner_scope_calls_eval_) Indent(n1, "// inner scope calls 'eval'\n");
948 Variable* Scope::NonLocal(Handle<String> name, VariableMode mode) {
969 Variable* Scope::LookupRecursive(Handle<String> name,
974 // Short-cut: if the scope is deserialized from a scope info, variable
980 // Try to find the variable in this scope.
984 // this scope which introduces the same variable again, the resulting
1009 // The current scope is a with scope, so the variable binding can not be
1011 // in the outer scope anyway, because if a binding exists in an outer scope,
1013 // from inside of an inner with scope (the property may not be in the 'with'
1018 // A variable binding may have been found in an outer scope
1019 // scope makes a non-strict 'eval' call, so the found variable may not be
1032 bool Scope::ResolveVariable(CompilationInfo* info,
1052 // scope which was not promoted to a context, this can happen if we use
1071 // No binding has been found. But some scope makes a
1137 bool Scope::ResolveVariablesRecursively(
1142 // Resolve unresolved variables for this scope.
1157 bool Scope::PropagateScopeInfo(bool outer_scope_calls_non_strict_eval ) {
1165 Scope* inner_scope = inner_scopes_[i];
1178 bool Scope::MustAllocate(Variable* var) {
1198 bool Scope::MustAllocateInContext(Variable* var) {
1199 // If var is accessed from an inner scope, or if there is a possibility
1200 // that it might be accessed from the current or an inner scope (through
1204 // Exceptions: If the scope as a whole has forced context allocation, all
1220 bool Scope::HasArgumentsParameter() {
1231 void Scope::AllocateStackSlot(Variable* var) {
1236 void Scope::AllocateHeapSlot(Variable* var) {
1241 void Scope::AllocateParameterLocals() {
1274 ASSERT(var->scope() == this);
1297 void Scope::AllocateNonParameterLocal(Variable* var) {
1298 ASSERT(var->scope() == this);
1311 void Scope::AllocateNonParameterLocals() {
1337 // ScopeInfo::ScopeInfo(FunctionScope* scope) constructor).
1344 void Scope::AllocateVariablesRecursively() {
1350 // If scope is already resolved, we still need to allocate
1357 // Allocate variables for this scope.
1362 // Force allocation of a context for this scope if necessary. For a 'with'
1363 // scope and for a function scope that makes an 'eval' call we need a context,
1364 // even if no local variables were statically allocated in the scope.
1380 void Scope::AllocateModulesRecursively(Scope* host_scope) {
1392 Scope* inner_scope = inner_scopes_.at(i);
1398 int Scope::StackLocalCount() const {
1404 int Scope::ContextLocalCount() const {