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/v8.h" | 5 #include "src/v8.h" |
6 | 6 |
7 #include "src/scopes.h" | 7 #include "src/scopes.h" |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 Scope::Scope(Isolate* isolate, Zone* zone, Scope* outer_scope, | 70 Scope::Scope(Isolate* isolate, Zone* zone, Scope* outer_scope, |
71 ScopeType scope_type, AstValueFactory* ast_value_factory) | 71 ScopeType scope_type, AstValueFactory* ast_value_factory) |
72 : isolate_(isolate), | 72 : isolate_(isolate), |
73 inner_scopes_(4, zone), | 73 inner_scopes_(4, zone), |
74 variables_(zone), | 74 variables_(zone), |
75 internals_(4, zone), | 75 internals_(4, zone), |
76 temps_(4, zone), | 76 temps_(4, zone), |
77 params_(4, zone), | 77 params_(4, zone), |
78 unresolved_(16, zone), | 78 unresolved_(16, zone), |
79 decls_(4, zone), | 79 decls_(4, zone), |
80 interface_(FLAG_harmony_modules && (scope_type == MODULE_SCOPE || | 80 interface_(scope_type == MODULE_SCOPE ? Interface::NewModule(zone) |
81 scope_type == SCRIPT_SCOPE) | 81 : NULL), |
82 ? Interface::NewModule(zone) | |
83 : NULL), | |
84 already_resolved_(false), | 82 already_resolved_(false), |
85 ast_value_factory_(ast_value_factory), | 83 ast_value_factory_(ast_value_factory), |
86 zone_(zone) { | 84 zone_(zone) { |
87 SetDefaults(scope_type, outer_scope, Handle<ScopeInfo>::null()); | 85 SetDefaults(scope_type, outer_scope, Handle<ScopeInfo>::null()); |
88 // The outermost scope must be a script scope. | 86 // The outermost scope must be a script scope. |
89 DCHECK(scope_type == SCRIPT_SCOPE || outer_scope != NULL); | 87 DCHECK(scope_type == SCRIPT_SCOPE || outer_scope != NULL); |
90 DCHECK(!HasIllegalRedeclaration()); | 88 DCHECK(!HasIllegalRedeclaration()); |
91 } | 89 } |
92 | 90 |
93 | 91 |
(...skipping 1329 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1423 } | 1421 } |
1424 | 1422 |
1425 | 1423 |
1426 int Scope::ContextLocalCount() const { | 1424 int Scope::ContextLocalCount() const { |
1427 if (num_heap_slots() == 0) return 0; | 1425 if (num_heap_slots() == 0) return 0; |
1428 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1426 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1429 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1427 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1430 } | 1428 } |
1431 | 1429 |
1432 } } // namespace v8::internal | 1430 } } // namespace v8::internal |
OLD | NEW |