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 820 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
831 } | 831 } |
832 | 832 |
833 | 833 |
834 #ifdef DEBUG | 834 #ifdef DEBUG |
835 static const char* Header(ScopeType scope_type, FunctionKind function_kind, | 835 static const char* Header(ScopeType scope_type, FunctionKind function_kind, |
836 bool is_declaration_scope) { | 836 bool is_declaration_scope) { |
837 switch (scope_type) { | 837 switch (scope_type) { |
838 case EVAL_SCOPE: return "eval"; | 838 case EVAL_SCOPE: return "eval"; |
839 // TODO(adamk): Should we print concise method scopes specially? | 839 // TODO(adamk): Should we print concise method scopes specially? |
840 case FUNCTION_SCOPE: | 840 case FUNCTION_SCOPE: |
841 return IsArrowFunction(function_kind) ? "arrow" : "function"; | 841 if (IsGeneratorFunction(function_kind)) return "function*"; |
| 842 if (IsAsyncFunction(function_kind)) return "async function"; |
| 843 if (IsArrowFunction(function_kind)) return "arrow"; |
| 844 return "function"; |
842 case MODULE_SCOPE: return "module"; | 845 case MODULE_SCOPE: return "module"; |
843 case SCRIPT_SCOPE: return "global"; | 846 case SCRIPT_SCOPE: return "global"; |
844 case CATCH_SCOPE: return "catch"; | 847 case CATCH_SCOPE: return "catch"; |
845 case BLOCK_SCOPE: return is_declaration_scope ? "varblock" : "block"; | 848 case BLOCK_SCOPE: return is_declaration_scope ? "varblock" : "block"; |
846 case WITH_SCOPE: return "with"; | 849 case WITH_SCOPE: return "with"; |
847 } | 850 } |
848 UNREACHABLE(); | 851 UNREACHABLE(); |
849 return NULL; | 852 return NULL; |
850 } | 853 } |
851 | 854 |
(...skipping 677 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1529 function_ != NULL && function_->proxy()->var()->IsContextSlot(); | 1532 function_ != NULL && function_->proxy()->var()->IsContextSlot(); |
1530 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - | 1533 return num_heap_slots() - Context::MIN_CONTEXT_SLOTS - num_global_slots() - |
1531 (is_function_var_in_context ? 1 : 0); | 1534 (is_function_var_in_context ? 1 : 0); |
1532 } | 1535 } |
1533 | 1536 |
1534 | 1537 |
1535 int Scope::ContextGlobalCount() const { return num_global_slots(); } | 1538 int Scope::ContextGlobalCount() const { return num_global_slots(); } |
1536 | 1539 |
1537 } // namespace internal | 1540 } // namespace internal |
1538 } // namespace v8 | 1541 } // namespace v8 |
OLD | NEW |