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 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
154 illegal_redecl_ = NULL; | 154 illegal_redecl_ = NULL; |
155 scope_inside_with_ = false; | 155 scope_inside_with_ = false; |
156 scope_contains_with_ = false; | 156 scope_contains_with_ = false; |
157 scope_calls_eval_ = false; | 157 scope_calls_eval_ = false; |
158 scope_uses_arguments_ = false; | 158 scope_uses_arguments_ = false; |
159 scope_uses_super_property_ = false; | 159 scope_uses_super_property_ = false; |
160 scope_uses_super_constructor_call_ = false; | 160 scope_uses_super_constructor_call_ = false; |
161 scope_uses_this_ = false; | 161 scope_uses_this_ = false; |
162 asm_module_ = false; | 162 asm_module_ = false; |
163 asm_function_ = outer_scope != NULL && outer_scope->asm_module_; | 163 asm_function_ = outer_scope != NULL && outer_scope->asm_module_; |
164 // Inherit the strict mode from the parent scope. | 164 // Inherit the language mode from the parent scope. |
165 language_mode_ = outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY; | 165 language_mode_ = outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY; |
166 outer_scope_calls_sloppy_eval_ = false; | 166 outer_scope_calls_sloppy_eval_ = false; |
167 inner_scope_calls_eval_ = false; | 167 inner_scope_calls_eval_ = false; |
168 inner_scope_uses_arguments_ = false; | 168 inner_scope_uses_arguments_ = false; |
169 inner_scope_uses_this_ = false; | 169 inner_scope_uses_this_ = false; |
170 inner_scope_uses_super_property_ = false; | 170 inner_scope_uses_super_property_ = false; |
171 inner_scope_uses_super_constructor_call_ = false; | 171 inner_scope_uses_super_constructor_call_ = false; |
172 force_eager_compilation_ = false; | 172 force_eager_compilation_ = false; |
173 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) | 173 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) |
174 ? outer_scope->has_forced_context_allocation() : false; | 174 ? outer_scope->has_forced_context_allocation() : false; |
(...skipping 710 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
885 if (function_ != NULL) { | 885 if (function_ != NULL) { |
886 Indent(n1, "// (local) function name: "); | 886 Indent(n1, "// (local) function name: "); |
887 PrintName(function_->proxy()->raw_name()); | 887 PrintName(function_->proxy()->raw_name()); |
888 PrintF("\n"); | 888 PrintF("\n"); |
889 } | 889 } |
890 | 890 |
891 // Scope info. | 891 // Scope info. |
892 if (HasTrivialOuterContext()) { | 892 if (HasTrivialOuterContext()) { |
893 Indent(n1, "// scope has trivial outer context\n"); | 893 Indent(n1, "// scope has trivial outer context\n"); |
894 } | 894 } |
895 if (is_strict(language_mode())) { | 895 if (is_strong(language_mode())) { |
| 896 Indent(n1, "// strong mode scope\n"); |
| 897 } else if (is_strict(language_mode())) { |
896 Indent(n1, "// strict mode scope\n"); | 898 Indent(n1, "// strict mode scope\n"); |
897 } | 899 } |
898 if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n"); | 900 if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n"); |
899 if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n"); | 901 if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n"); |
900 if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n"); | 902 if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n"); |
901 if (scope_uses_arguments_) Indent(n1, "// scope uses 'arguments'\n"); | 903 if (scope_uses_arguments_) Indent(n1, "// scope uses 'arguments'\n"); |
902 if (scope_uses_super_property_) | 904 if (scope_uses_super_property_) |
903 Indent(n1, "// scope uses 'super' property\n"); | 905 Indent(n1, "// scope uses 'super' property\n"); |
904 if (scope_uses_super_constructor_call_) | 906 if (scope_uses_super_constructor_call_) |
905 Indent(n1, "// scope uses 'super' constructor\n"); | 907 Indent(n1, "// scope uses 'super' constructor\n"); |
(...skipping 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1437 } | 1439 } |
1438 | 1440 |
1439 | 1441 |
1440 int Scope::ContextLocalCount() const { | 1442 int Scope::ContextLocalCount() const { |
1441 if (num_heap_slots() == 0) return 0; | 1443 if (num_heap_slots() == 0) return 0; |
1442 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1444 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
1443 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1445 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
1444 } | 1446 } |
1445 | 1447 |
1446 } } // namespace v8::internal | 1448 } } // namespace v8::internal |
OLD | NEW |