OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "src/ast/scopes.h" | 5 #include "src/ast/scopes.h" |
6 | 6 |
7 #include "src/accessors.h" | 7 #include "src/accessors.h" |
8 #include "src/ast/scopeinfo.h" | 8 #include "src/ast/scopeinfo.h" |
9 #include "src/bootstrapper.h" | 9 #include "src/bootstrapper.h" |
10 #include "src/messages.h" | 10 #include "src/messages.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
83 // Implementation of Scope | 83 // Implementation of Scope |
84 | 84 |
85 Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type, | 85 Scope::Scope(Zone* zone, Scope* outer_scope, ScopeType scope_type, |
86 AstValueFactory* ast_value_factory, FunctionKind function_kind) | 86 AstValueFactory* ast_value_factory, FunctionKind function_kind) |
87 : inner_scopes_(4, zone), | 87 : inner_scopes_(4, zone), |
88 variables_(zone), | 88 variables_(zone), |
89 temps_(4, zone), | 89 temps_(4, zone), |
90 params_(4, zone), | 90 params_(4, zone), |
91 unresolved_(16, zone), | 91 unresolved_(16, zone), |
92 decls_(4, zone), | 92 decls_(4, zone), |
93 module_descriptor_( | 93 module_descriptor_(scope_type == MODULE_SCOPE ? new (zone) |
94 scope_type == MODULE_SCOPE ? ModuleDescriptor::New(zone) : NULL), | 94 ModuleDescriptor(zone) |
| 95 : NULL), |
95 sloppy_block_function_map_(zone), | 96 sloppy_block_function_map_(zone), |
96 already_resolved_(false), | 97 already_resolved_(false), |
97 ast_value_factory_(ast_value_factory), | 98 ast_value_factory_(ast_value_factory), |
98 zone_(zone) { | 99 zone_(zone) { |
99 SetDefaults(scope_type, outer_scope, Handle<ScopeInfo>::null(), | 100 SetDefaults(scope_type, outer_scope, Handle<ScopeInfo>::null(), |
100 function_kind); | 101 function_kind); |
101 // The outermost scope must be a script scope. | 102 // The outermost scope must be a script scope. |
102 DCHECK(scope_type == SCRIPT_SCOPE || outer_scope != NULL); | 103 DCHECK(scope_type == SCRIPT_SCOPE || outer_scope != NULL); |
103 } | 104 } |
104 | 105 |
(...skipping 1430 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1535 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1536 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
1536 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1537 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
1537 (is_function_var_in_context ? 1 : 0); | 1538 (is_function_var_in_context ? 1 : 0); |
1538 } | 1539 } |
1539 | 1540 |
1540 | 1541 |
1541 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1542 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1542 | 1543 |
1543 } // namespace internal | 1544 } // namespace internal |
1544 } // namespace v8 | 1545 } // namespace v8 |
OLD | NEW |