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 586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
597 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); | 597 void PropagateScopeInfo(bool outer_scope_calls_sloppy_eval); |
598 bool HasTrivialContext() const; | 598 bool HasTrivialContext() const; |
599 | 599 |
600 // Predicates. | 600 // Predicates. |
601 bool MustAllocate(Variable* var); | 601 bool MustAllocate(Variable* var); |
602 bool MustAllocateInContext(Variable* var); | 602 bool MustAllocateInContext(Variable* var); |
603 | 603 |
604 // Variable allocation. | 604 // Variable allocation. |
605 void AllocateStackSlot(Variable* var); | 605 void AllocateStackSlot(Variable* var); |
606 void AllocateHeapSlot(Variable* var); | 606 void AllocateHeapSlot(Variable* var); |
607 void AllocateNonParameterLocal(Variable* var, | 607 void AllocateNonParameterLocal(Variable* var); |
608 AstValueFactory* ast_value_factory); | 608 void AllocateDeclaredGlobal(Variable* var); |
609 void AllocateDeclaredGlobal(Variable* var, | 609 void AllocateNonParameterLocalsAndDeclaredGlobals(); |
610 AstValueFactory* ast_value_factory); | 610 void AllocateVariablesRecursively(); |
611 void AllocateNonParameterLocalsAndDeclaredGlobals( | |
612 AstValueFactory* ast_value_factory); | |
613 void AllocateVariablesRecursively(AstValueFactory* ast_value_factory); | |
614 | 611 |
615 // Construct a scope based on the scope info. | 612 // Construct a scope based on the scope info. |
616 Scope(Zone* zone, Scope* inner_scope, ScopeType type, | 613 Scope(Zone* zone, Scope* inner_scope, ScopeType type, |
617 Handle<ScopeInfo> scope_info); | 614 Handle<ScopeInfo> scope_info); |
618 | 615 |
619 // Construct a catch scope with a binding for the name. | 616 // Construct a catch scope with a binding for the name. |
620 Scope(Zone* zone, Scope* inner_scope, | 617 Scope(Zone* zone, Scope* inner_scope, |
621 const AstRawString* catch_variable_name); | 618 const AstRawString* catch_variable_name); |
622 | 619 |
623 void AddInnerScope(Scope* inner_scope) { | 620 void AddInnerScope(Scope* inner_scope) { |
(...skipping 217 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
841 void AnalyzePartially(DeclarationScope* migrate_to, | 838 void AnalyzePartially(DeclarationScope* migrate_to, |
842 AstNodeFactory* ast_node_factory); | 839 AstNodeFactory* ast_node_factory); |
843 | 840 |
844 Handle<StringSet> CollectNonLocals(ParseInfo* info, | 841 Handle<StringSet> CollectNonLocals(ParseInfo* info, |
845 Handle<StringSet> non_locals); | 842 Handle<StringSet> non_locals); |
846 | 843 |
847 #ifdef DEBUG | 844 #ifdef DEBUG |
848 void PrintParameters(); | 845 void PrintParameters(); |
849 #endif | 846 #endif |
850 | 847 |
851 void AllocateLocals(AstValueFactory* ast_value_factory); | 848 void AllocateLocals(); |
852 void AllocateParameterLocals(); | 849 void AllocateParameterLocals(); |
853 void AllocateReceiver(); | 850 void AllocateReceiver(); |
854 // Set MODULE as VariableLocation for all variables that will live in some | 851 // Set MODULE as VariableLocation for all variables that will live in some |
855 // module's export table. | 852 // module's export table. |
856 void AllocateModuleVariables(); | 853 void AllocateModuleVariables(); |
857 | 854 |
858 private: | 855 private: |
859 void AllocateParameter(Variable* var, int index); | 856 void AllocateParameter(Variable* var, int index); |
860 | 857 |
861 void SetDefaults(); | 858 void SetDefaults(); |
(...skipping 24 matching lines...) Expand all Loading... |
886 // Convenience variable; Subclass constructor only | 883 // Convenience variable; Subclass constructor only |
887 Variable* this_function_; | 884 Variable* this_function_; |
888 // Module descriptor; module scopes only. | 885 // Module descriptor; module scopes only. |
889 ModuleDescriptor* module_descriptor_; | 886 ModuleDescriptor* module_descriptor_; |
890 }; | 887 }; |
891 | 888 |
892 } // namespace internal | 889 } // namespace internal |
893 } // namespace v8 | 890 } // namespace v8 |
894 | 891 |
895 #endif // V8_AST_SCOPES_H_ | 892 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |