| 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/accessors.h" | 7 #include "src/accessors.h" |
| 8 #include "src/bootstrapper.h" | 8 #include "src/bootstrapper.h" |
| 9 #include "src/messages.h" | 9 #include "src/messages.h" |
| 10 #include "src/parser.h" | 10 #include "src/parser.h" |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 167 scope_uses_super_property_ = false; | 167 scope_uses_super_property_ = false; |
| 168 scope_uses_this_ = false; | 168 scope_uses_this_ = false; |
| 169 asm_module_ = false; | 169 asm_module_ = false; |
| 170 asm_function_ = outer_scope != NULL && outer_scope->asm_module_; | 170 asm_function_ = outer_scope != NULL && outer_scope->asm_module_; |
| 171 // Inherit the language mode from the parent scope. | 171 // Inherit the language mode from the parent scope. |
| 172 language_mode_ = outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY; | 172 language_mode_ = outer_scope != NULL ? outer_scope->language_mode_ : SLOPPY; |
| 173 outer_scope_calls_sloppy_eval_ = false; | 173 outer_scope_calls_sloppy_eval_ = false; |
| 174 inner_scope_calls_eval_ = false; | 174 inner_scope_calls_eval_ = false; |
| 175 inner_scope_uses_arguments_ = false; | 175 inner_scope_uses_arguments_ = false; |
| 176 inner_scope_uses_this_ = false; | 176 inner_scope_uses_this_ = false; |
| 177 inner_scope_uses_super_property_ = false; | |
| 178 force_eager_compilation_ = false; | 177 force_eager_compilation_ = false; |
| 179 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) | 178 force_context_allocation_ = (outer_scope != NULL && !is_function_scope()) |
| 180 ? outer_scope->has_forced_context_allocation() : false; | 179 ? outer_scope->has_forced_context_allocation() : false; |
| 181 num_var_or_const_ = 0; | 180 num_var_or_const_ = 0; |
| 182 num_stack_slots_ = 0; | 181 num_stack_slots_ = 0; |
| 183 num_heap_slots_ = 0; | 182 num_heap_slots_ = 0; |
| 184 num_modules_ = 0; | 183 num_modules_ = 0; |
| 185 module_var_ = NULL, | 184 module_var_ = NULL, |
| 186 rest_parameter_ = NULL; | 185 rest_parameter_ = NULL; |
| 187 rest_index_ = -1; | 186 rest_index_ = -1; |
| (...skipping 739 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n"); | 926 if (scope_inside_with_) Indent(n1, "// scope inside 'with'\n"); |
| 928 if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n"); | 927 if (scope_contains_with_) Indent(n1, "// scope contains 'with'\n"); |
| 929 if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n"); | 928 if (scope_calls_eval_) Indent(n1, "// scope calls 'eval'\n"); |
| 930 if (scope_uses_arguments_) Indent(n1, "// scope uses 'arguments'\n"); | 929 if (scope_uses_arguments_) Indent(n1, "// scope uses 'arguments'\n"); |
| 931 if (scope_uses_super_property_) | 930 if (scope_uses_super_property_) |
| 932 Indent(n1, "// scope uses 'super' property\n"); | 931 Indent(n1, "// scope uses 'super' property\n"); |
| 933 if (scope_uses_this_) Indent(n1, "// scope uses 'this'\n"); | 932 if (scope_uses_this_) Indent(n1, "// scope uses 'this'\n"); |
| 934 if (inner_scope_uses_arguments_) { | 933 if (inner_scope_uses_arguments_) { |
| 935 Indent(n1, "// inner scope uses 'arguments'\n"); | 934 Indent(n1, "// inner scope uses 'arguments'\n"); |
| 936 } | 935 } |
| 937 if (inner_scope_uses_super_property_) | |
| 938 Indent(n1, "// inner scope uses 'super' property\n"); | |
| 939 if (inner_scope_uses_this_) Indent(n1, "// inner scope uses 'this'\n"); | 936 if (inner_scope_uses_this_) Indent(n1, "// inner scope uses 'this'\n"); |
| 940 if (outer_scope_calls_sloppy_eval_) { | 937 if (outer_scope_calls_sloppy_eval_) { |
| 941 Indent(n1, "// outer scope calls 'eval' in sloppy context\n"); | 938 Indent(n1, "// outer scope calls 'eval' in sloppy context\n"); |
| 942 } | 939 } |
| 943 if (inner_scope_calls_eval_) Indent(n1, "// inner scope calls 'eval'\n"); | 940 if (inner_scope_calls_eval_) Indent(n1, "// inner scope calls 'eval'\n"); |
| 944 if (num_stack_slots_ > 0) { Indent(n1, "// "); | 941 if (num_stack_slots_ > 0) { Indent(n1, "// "); |
| 945 PrintF("%d stack slots\n", num_stack_slots_); } | 942 PrintF("%d stack slots\n", num_stack_slots_); } |
| 946 if (num_heap_slots_ > 0) { Indent(n1, "// "); | 943 if (num_heap_slots_ > 0) { Indent(n1, "// "); |
| 947 PrintF("%d heap slots\n", num_heap_slots_); } | 944 PrintF("%d heap slots\n", num_heap_slots_); } |
| 948 | 945 |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1289 if (inner->scope_calls_eval_ || inner->inner_scope_calls_eval_) { | 1286 if (inner->scope_calls_eval_ || inner->inner_scope_calls_eval_) { |
| 1290 inner_scope_calls_eval_ = true; | 1287 inner_scope_calls_eval_ = true; |
| 1291 } | 1288 } |
| 1292 // If the inner scope is an arrow function, propagate the flags tracking | 1289 // If the inner scope is an arrow function, propagate the flags tracking |
| 1293 // usage of arguments/super/this, but do not propagate them out from normal | 1290 // usage of arguments/super/this, but do not propagate them out from normal |
| 1294 // functions. | 1291 // functions. |
| 1295 if (!inner->is_function_scope() || inner->is_arrow_scope()) { | 1292 if (!inner->is_function_scope() || inner->is_arrow_scope()) { |
| 1296 if (inner->scope_uses_arguments_ || inner->inner_scope_uses_arguments_) { | 1293 if (inner->scope_uses_arguments_ || inner->inner_scope_uses_arguments_) { |
| 1297 inner_scope_uses_arguments_ = true; | 1294 inner_scope_uses_arguments_ = true; |
| 1298 } | 1295 } |
| 1299 if (inner->scope_uses_super_property_ || | |
| 1300 inner->inner_scope_uses_super_property_) { | |
| 1301 inner_scope_uses_super_property_ = true; | |
| 1302 } | |
| 1303 if (inner->scope_uses_this_ || inner->inner_scope_uses_this_) { | 1296 if (inner->scope_uses_this_ || inner->inner_scope_uses_this_) { |
| 1304 inner_scope_uses_this_ = true; | 1297 inner_scope_uses_this_ = true; |
| 1305 } | 1298 } |
| 1306 } | 1299 } |
| 1307 if (inner->force_eager_compilation_) { | 1300 if (inner->force_eager_compilation_) { |
| 1308 force_eager_compilation_ = true; | 1301 force_eager_compilation_ = true; |
| 1309 } | 1302 } |
| 1310 if (asm_module_ && inner->scope_type() == FUNCTION_SCOPE) { | 1303 if (asm_module_ && inner->scope_type() == FUNCTION_SCOPE) { |
| 1311 inner->asm_function_ = true; | 1304 inner->asm_function_ = true; |
| 1312 } | 1305 } |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1551 (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); | 1544 (function_ != NULL && function_->proxy()->var()->IsStackLocal() ? 1 : 0); |
| 1552 } | 1545 } |
| 1553 | 1546 |
| 1554 | 1547 |
| 1555 int Scope::ContextLocalCount() const { | 1548 int Scope::ContextLocalCount() const { |
| 1556 if (num_heap_slots() == 0) return 0; | 1549 if (num_heap_slots() == 0) return 0; |
| 1557 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - | 1550 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - |
| 1558 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); | 1551 (function_ != NULL && function_->proxy()->var()->IsContextSlot() ? 1 : 0); |
| 1559 } | 1552 } |
| 1560 } } // namespace v8::internal | 1553 } } // namespace v8::internal |
| OLD | NEW |