Home | History | Annotate | Download | only in src

Lines Matching refs:Scope

65     Scope* scope,
76 p->value = new Variable(scope,
100 // Implementation of Scope
102 Scope::Scope(Scope* outer_scope, ScopeType type)
116 // eval scopes (by walking the stack and reading the scope info).
123 Scope::Scope(Scope* inner_scope,
146 Scope::Scope(Scope* inner_scope, Handle<String> catch_variable_name)
170 void Scope::SetDefaults(ScopeType type,
171 Scope* outer_scope,
184 // Inherit the strict mode from the parent scope.
203 Scope* Scope::DeserializeScopeChain(Context* context, Scope* global_scope) {
204 // Reconstruct the outer scope chain from a closure's context chain.
205 Scope* current_scope = NULL;
206 Scope* innermost_scope = NULL;
210 Scope* with_scope = new Scope(current_scope,
216 for (Scope* s = innermost_scope; s != NULL; s = s->outer_scope()) {
221 current_scope = new Scope(current_scope,
226 current_scope = new Scope(current_scope,
232 current_scope = new Scope(current_scope, Handle<String>(name));
250 bool Scope::Analyze(CompilationInfo* info) {
252 Scope* scope = info->function()->scope();
253 Scope* top = scope;
255 // Traverse the scope tree up to the first unresolved scope or the global
256 // scope and start scope resolution and variable allocation from that scope.
272 scope->Print();
282 VariableProxy* proxy = scope->CheckAssignmentToConst();
298 info->SetScope(scope);
303 void Scope::Initialize() {
306 // Add this scope as a new inner scope of the outer scope.
315 // Declare and allocate receiver (even for the global scope, and even
317 // NOTE: When loading parameters in the global scope, we must take
351 Scope* Scope::FinalizeBlockScope() {
358 // Remove this scope from outer scope.
380 Variable* Scope::LocalLookup(Handle<String> name) {
385 // If we have a serialized scope info, we might find the variable there.
413 Variable* Scope::LookupFunctionVar(Handle<String> name,
418 // If we are backed by a scope info, try to lookup the variable there.
431 Variable* Scope::Lookup(Handle<String> name) {
432 for (Scope* scope = this;
433 scope != NULL;
434 scope = scope->outer_scope()) {
435 Variable* var = scope->LocalLookup(name);
442 void Scope::DeclareParameter(Handle<String> name, VariableMode mode) {
451 Variable* Scope::DeclareLocal(Handle<String> name,
469 Variable* Scope::DeclareGlobal(Handle<String> name) {
480 void Scope::RemoveUnresolved(VariableProxy* var) {
492 Variable* Scope
505 void Scope::AddDeclaration(Declaration* declaration) {
510 void Scope::SetIllegalRedeclaration(Expression* expression) {
519 void Scope::VisitIllegalRedeclaration(AstVisitor* visitor) {
525 Declaration* Scope::CheckConflictingVarDeclarations() {
532 // Iterate through all scopes until and including the declaration scope.
533 Scope* previous = NULL;
534 Scope* current = decl->scope();
549 VariableProxy* Scope::CheckAssignmentToConst() {
550 // Check this scope.
572 void Scope::CollectStackAndContextLocals(ZoneList<Variable*>* stack_locals,
602 bool Scope::AllocateVariables(CompilationInfo* info,
604 // 1) Propagate scope information.
623 bool Scope::AllowsLazyCompilation() const {
628 bool Scope::HasTrivialContext() const {
629 // A function scope has a trivial context if it always is the global
631 // there is anything that makes this scope non-trivial; otherwise we
633 for (const Scope* scope = this; scope != NULL; scope = scope->outer_scope_) {
634 if (scope->is_eval_scope()) return false;
635 if (scope->scope_inside_with_) return false;
636 if (scope->num_heap_slots_ > 0) return false;
642 bool Scope::HasTrivialOuterContext() const {
643 Scope* outer = outer_scope_;
646 // scope may be inside a 'with' statement in which case the outer context
647 // for this scope is not trivial.
652 bool Scope::AllowsLazyRecompilation() const {
658 bool Scope::TrivialDeclarationScopesBeforeWithScope() const {
659 Scope* outer = outer_scope_;
672 int Scope::ContextChainLength(Scope* scope) {
674 for (Scope* s = this; s != scope; s = s->outer_scope_) {
675 ASSERT(s != NULL); // scope must be in the scope chain
682 Scope* Scope::DeclarationScope() {
683 Scope* scope = this;
684 while (!scope->is_declaration_scope()) {
685 scope = scope->outer_scope();
687 return scope;
691 Handle<ScopeInfo> Scope::GetScopeInfo() {
699 void Scope::GetNestedScopeChain(
705 Scope* scope = inner_scopes_[i];
706 int beg_pos = scope->start_position();
707 int end_pos = scope->end_position();
710 scope->GetNestedScopeChain(chain, position);
788 void Scope::Print(int n) {
818 // Scope info.
820 Indent(n1, "// scope has trivial outer context\n");
826 Indent(n1, "// strict mode scope\n");
829 Indent(n1, "// extended mode scope\n");
832 if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n");
833 if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n");
834 if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n");
836 Indent(n1, "// outer scope calls 'eval' in non-strict context\n");
838 if (inner_scope_calls_eval_) Indent(n1, "// inner scope calls 'eval'\n");
878 Variable* Scope::NonLocal(Handle<String> name, VariableMode mode) {
899 Variable* Scope::LookupRecursive(Handle<String> name,
903 // Try to find the variable in this scope.
907 // this scope which introduces the same variable again, the resulting
931 // The current scope is a with scope, so the variable binding can not be
933 // in the outer scope anyway, because if a binding exists in an outer scope,
935 // from inside of an inner with scope (the property may not be in the 'with'
940 // A variable binding may have been found in an outer scope, but the current
941 // scope makes a non-strict 'eval' call, so the found variable may not be
954 bool Scope::ResolveVariable(CompilationInfo* info,
984 // No binding has been found. Declare a variable in global scope.
989 // No binding has been found. But some scope makes a
1041 bool Scope::ResolveVariablesRecursively(
1046 // Resolve unresolved variables for this scope.
1061 bool Scope::PropagateScopeInfo(bool outer_scope_calls_non_strict_eval ) {
1069 Scope* inner_scope = inner_scopes_[i];
1082 bool Scope::MustAllocate(Variable* var) {
1100 bool Scope::MustAllocateInContext(Variable* var) {
1101 // If var is accessed from an inner scope, or if there is a possibility
1102 // that it might be accessed from the current or an inner scope (through
1118 bool Scope::HasArgumentsParameter() {
1129 void Scope::AllocateStackSlot(Variable* var) {
1134 void Scope::AllocateHeapSlot(Variable* var) {
1139 void Scope::AllocateParameterLocals() {
1172 ASSERT(var->scope() == this);
1195 void Scope::AllocateNonParameterLocal(Variable* var) {
1196 ASSERT(var->scope() == this);
1209 void Scope::AllocateNonParameterLocals() {
1225 // ScopeInfo::ScopeInfo(FunctionScope* scope) constructor).
1232 void Scope::AllocateVariablesRecursively() {
1238 // If scope is already resolved, we still need to allocate
1245 // Allocate variables for this scope.
1250 // Force allocation of a context for this scope if necessary. For a 'with'
1251 // scope and for a function scope that makes an 'eval' call we need a context,
1252 // even if no local variables were statically allocated in the scope.
1267 int Scope::StackLocalCount() const {
1273 int Scope::ContextLocalCount() const {