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 #ifndef V8_AST_SCOPES_H_ | 5 #ifndef V8_AST_SCOPES_H_ |
6 #define V8_AST_SCOPES_H_ | 6 #define V8_AST_SCOPES_H_ |
7 | 7 |
8 #include "src/ast/ast.h" | 8 #include "src/ast/ast.h" |
9 #include "src/base/hashmap.h" | 9 #include "src/base/hashmap.h" |
10 #include "src/globals.h" | 10 #include "src/globals.h" |
(...skipping 560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
571 // the scope where var declarations will be hoisted to in the implementation. | 571 // the scope where var declarations will be hoisted to in the implementation. |
572 Scope* DeclarationScope(); | 572 Scope* DeclarationScope(); |
573 | 573 |
574 // Find the first non-block declaration scope. This should be either a script, | 574 // Find the first non-block declaration scope. This should be either a script, |
575 // function, or eval scope. Same as DeclarationScope(), but skips | 575 // function, or eval scope. Same as DeclarationScope(), but skips |
576 // declaration "block" scopes. Used for differentiating associated | 576 // declaration "block" scopes. Used for differentiating associated |
577 // function objects (i.e., the scope for which a function prologue allocates | 577 // function objects (i.e., the scope for which a function prologue allocates |
578 // a context) or declaring temporaries. | 578 // a context) or declaring temporaries. |
579 Scope* ClosureScope(); | 579 Scope* ClosureScope(); |
580 | 580 |
| 581 // Find the module scope if there is one. |
| 582 Scope* ModuleScope(); |
| 583 |
581 // Find the first (non-arrow) function or script scope. This is where | 584 // Find the first (non-arrow) function or script scope. This is where |
582 // 'this' is bound, and what determines the function kind. | 585 // 'this' is bound, and what determines the function kind. |
583 Scope* ReceiverScope(); | 586 Scope* ReceiverScope(); |
584 | 587 |
585 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); | 588 Handle<ScopeInfo> GetScopeInfo(Isolate* isolate); |
586 | 589 |
587 Handle<StringSet> CollectNonLocals(Handle<StringSet> non_locals); | 590 Handle<StringSet> CollectNonLocals(Handle<StringSet> non_locals); |
588 | 591 |
589 // --------------------------------------------------------------------------- | 592 // --------------------------------------------------------------------------- |
590 // Strict mode support. | 593 // Strict mode support. |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 void AllocateParameterLocals(); | 822 void AllocateParameterLocals(); |
820 void AllocateNonParameterLocal(Variable* var, | 823 void AllocateNonParameterLocal(Variable* var, |
821 AstValueFactory* ast_value_factory); | 824 AstValueFactory* ast_value_factory); |
822 void AllocateDeclaredGlobal(Variable* var, | 825 void AllocateDeclaredGlobal(Variable* var, |
823 AstValueFactory* ast_value_factory); | 826 AstValueFactory* ast_value_factory); |
824 void AllocateNonParameterLocalsAndDeclaredGlobals( | 827 void AllocateNonParameterLocalsAndDeclaredGlobals( |
825 AstValueFactory* ast_value_factory); | 828 AstValueFactory* ast_value_factory); |
826 void AllocateVariablesRecursively(AstValueFactory* ast_value_factory); | 829 void AllocateVariablesRecursively(AstValueFactory* ast_value_factory); |
827 void AllocateParameter(Variable* var, int index); | 830 void AllocateParameter(Variable* var, int index); |
828 void AllocateReceiver(); | 831 void AllocateReceiver(); |
| 832 // Set MODULE as VariableLocation for all variables that will live in some |
| 833 // module's export table. |
| 834 void AllocateModuleVariables(); |
829 | 835 |
830 // Resolve and fill in the allocation information for all variables | 836 // Resolve and fill in the allocation information for all variables |
831 // in this scopes. Must be called *after* all scopes have been | 837 // in this scopes. Must be called *after* all scopes have been |
832 // processed (parsed) to ensure that unresolved variables can be | 838 // processed (parsed) to ensure that unresolved variables can be |
833 // resolved properly. | 839 // resolved properly. |
834 // | 840 // |
835 // In the case of code compiled and run using 'eval', the context | 841 // In the case of code compiled and run using 'eval', the context |
836 // parameter is the context in which eval was called. In all other | 842 // parameter is the context in which eval was called. In all other |
837 // cases the context parameter is an empty handle. | 843 // cases the context parameter is an empty handle. |
838 MUST_USE_RESULT | 844 MUST_USE_RESULT |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
871 | 877 |
872 void SetDefaults(); | 878 void SetDefaults(); |
873 | 879 |
874 PendingCompilationErrorHandler pending_error_handler_; | 880 PendingCompilationErrorHandler pending_error_handler_; |
875 }; | 881 }; |
876 | 882 |
877 } // namespace internal | 883 } // namespace internal |
878 } // namespace v8 | 884 } // namespace v8 |
879 | 885 |
880 #endif // V8_AST_SCOPES_H_ | 886 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |