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/base/hashmap.h" | 8 #include "src/base/hashmap.h" |
9 #include "src/globals.h" | 9 #include "src/globals.h" |
10 #include "src/objects.h" | 10 #include "src/objects.h" |
(...skipping 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
801 } | 801 } |
802 | 802 |
803 #ifdef DEBUG | 803 #ifdef DEBUG |
804 void PrintParameters(); | 804 void PrintParameters(); |
805 #endif | 805 #endif |
806 | 806 |
807 void AllocateLocals(); | 807 void AllocateLocals(); |
808 void AllocateParameterLocals(); | 808 void AllocateParameterLocals(); |
809 void AllocateReceiver(); | 809 void AllocateReceiver(); |
810 | 810 |
811 void ResetAfterPreparsing() { | |
812 // Reset all non-trivial members. | |
813 decls_.Clear(); | |
814 locals_.Clear(); | |
815 params_.Clear(); | |
816 sloppy_block_function_map_.Clear(); | |
817 variables_.Clear(); | |
818 // Make sure we won't walk the scope tree from here on. | |
819 inner_scope_ = nullptr; | |
820 // Make sure we won't try to allocate the rest parameter. {params_} was | |
821 // cleared above. | |
822 has_rest_ = false; | |
823 } | |
824 | |
825 private: | 811 private: |
826 void AllocateParameter(Variable* var, int index); | 812 void AllocateParameter(Variable* var, int index); |
827 | 813 |
828 // Resolve and fill in the allocation information for all variables | 814 // Resolve and fill in the allocation information for all variables |
829 // in this scopes. Must be called *after* all scopes have been | 815 // in this scopes. Must be called *after* all scopes have been |
830 // processed (parsed) to ensure that unresolved variables can be | 816 // processed (parsed) to ensure that unresolved variables can be |
831 // resolved properly. | 817 // resolved properly. |
832 // | 818 // |
833 // In the case of code compiled and run using 'eval', the context | 819 // In the case of code compiled and run using 'eval', the context |
834 // parameter is the context in which eval was called. In all other | 820 // parameter is the context in which eval was called. In all other |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
893 void AllocateModuleVariables(); | 879 void AllocateModuleVariables(); |
894 | 880 |
895 private: | 881 private: |
896 ModuleDescriptor* module_descriptor_; | 882 ModuleDescriptor* module_descriptor_; |
897 }; | 883 }; |
898 | 884 |
899 } // namespace internal | 885 } // namespace internal |
900 } // namespace v8 | 886 } // namespace v8 |
901 | 887 |
902 #endif // V8_AST_SCOPES_H_ | 888 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |