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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 function_ = nullptr; | 168 function_ = nullptr; |
169 arguments_ = nullptr; | 169 arguments_ = nullptr; |
170 this_function_ = nullptr; | 170 this_function_ = nullptr; |
171 scope_inside_with_ = false; | 171 scope_inside_with_ = false; |
172 scope_calls_eval_ = false; | 172 scope_calls_eval_ = false; |
173 scope_uses_arguments_ = false; | 173 scope_uses_arguments_ = false; |
174 scope_uses_super_property_ = false; | 174 scope_uses_super_property_ = false; |
175 asm_module_ = false; | 175 asm_module_ = false; |
176 asm_function_ = outer_scope != NULL && outer_scope->asm_module_; | 176 asm_function_ = outer_scope != NULL && outer_scope->asm_module_; |
177 // Inherit the language mode from the parent scope. | 177 // Inherit the language mode from the parent scope. |
178 language_mode_ = outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY; | 178 language_mode_ = |
| 179 is_module_scope() |
| 180 ? STRICT |
| 181 : (outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY); |
179 outer_scope_calls_sloppy_eval_ = false; | 182 outer_scope_calls_sloppy_eval_ = false; |
180 inner_scope_calls_eval_ = false; | 183 inner_scope_calls_eval_ = false; |
181 scope_nonlinear_ = false; | 184 scope_nonlinear_ = false; |
182 force_eager_compilation_ = false; | 185 force_eager_compilation_ = false; |
183 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) | 186 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) |
184 ? outer_scope->has_forced_context_allocation() : false; | 187 ? outer_scope->has_forced_context_allocation() : false; |
185 num_var_or_const_ = 0; | 188 num_var_or_const_ = 0; |
186 num_stack_slots_ = 0; | 189 num_stack_slots_ = 0; |
187 num_heap_slots_ = 0; | 190 num_heap_slots_ = 0; |
188 num_global_slots_ = 0; | 191 num_global_slots_ = 0; |
(...skipping 1310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1499 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1502 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
1500 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1503 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
1501 (is_function_var_in_context ? 1 : 0); | 1504 (is_function_var_in_context ? 1 : 0); |
1502 } | 1505 } |
1503 | 1506 |
1504 | 1507 |
1505 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1508 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1506 | 1509 |
1507 } // namespace internal | 1510 } // namespace internal |
1508 } // namespace v8 | 1511 } // namespace v8 |
OLD | NEW |