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 <set> | 7 #include <set> |
8 | 8 |
9 #include "src/accessors.h" | 9 #include "src/accessors.h" |
10 #include "src/bootstrapper.h" | 10 #include "src/bootstrapper.h" |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
82 decls_(4, zone), | 82 decls_(4, zone), |
83 scope_type_(scope_type), | 83 scope_type_(scope_type), |
84 already_resolved_(false) { | 84 already_resolved_(false) { |
85 SetDefaults(); | 85 SetDefaults(); |
86 if (outer_scope == nullptr) { | 86 if (outer_scope == nullptr) { |
87 // If the outer scope is null, this cannot be a with scope. The outermost | 87 // If the outer scope is null, this cannot be a with scope. The outermost |
88 // scope must be a script scope. | 88 // scope must be a script scope. |
89 DCHECK_EQ(SCRIPT_SCOPE, scope_type); | 89 DCHECK_EQ(SCRIPT_SCOPE, scope_type); |
90 } else { | 90 } else { |
91 asm_function_ = outer_scope_->asm_module_; | 91 asm_function_ = outer_scope_->asm_module_; |
92 // Inherit the language mode from the parent scope unless we're a module | 92 // Inherit the language mode from the parent scope. |
neis
2016/08/17 15:22:52
Feel free to remove the comment completely.
| |
93 // scope. | 93 language_mode_ = outer_scope->language_mode_; |
94 if (!is_module_scope()) language_mode_ = outer_scope->language_mode_; | |
95 force_context_allocation_ = | 94 force_context_allocation_ = |
96 !is_function_scope() && outer_scope->has_forced_context_allocation(); | 95 !is_function_scope() && outer_scope->has_forced_context_allocation(); |
97 outer_scope_->AddInnerScope(this); | 96 outer_scope_->AddInnerScope(this); |
98 scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope(); | 97 scope_inside_with_ = outer_scope_->scope_inside_with_ || is_with_scope(); |
99 } | 98 } |
100 } | 99 } |
101 | 100 |
102 Scope::Snapshot::Snapshot(Scope* scope) | 101 Scope::Snapshot::Snapshot(Scope* scope) |
103 : outer_scope_(scope), | 102 : outer_scope_(scope), |
104 top_inner_scope_(scope->inner_scope_), | 103 top_inner_scope_(scope->inner_scope_), |
(...skipping 1662 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1767 function != nullptr && function->IsContextSlot(); | 1766 function != nullptr && function->IsContextSlot(); |
1768 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1767 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
1769 (is_function_var_in_context ? 1 : 0); | 1768 (is_function_var_in_context ? 1 : 0); |
1770 } | 1769 } |
1771 | 1770 |
1772 | 1771 |
1773 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1772 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1774 | 1773 |
1775 } // namespace internal | 1774 } // namespace internal |
1776 } // namespace v8 | 1775 } // namespace v8 |
OLD | NEW |