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 |
811 private: | 825 private: |
812 void AllocateParameter(Variable* var, int index); | 826 void AllocateParameter(Variable* var, int index); |
813 | 827 |
814 // Resolve and fill in the allocation information for all variables | 828 // Resolve and fill in the allocation information for all variables |
815 // in this scopes. Must be called *after* all scopes have been | 829 // in this scopes. Must be called *after* all scopes have been |
816 // processed (parsed) to ensure that unresolved variables can be | 830 // processed (parsed) to ensure that unresolved variables can be |
817 // resolved properly. | 831 // resolved properly. |
818 // | 832 // |
819 // In the case of code compiled and run using 'eval', the context | 833 // In the case of code compiled and run using 'eval', the context |
820 // parameter is the context in which eval was called. In all other | 834 // 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... |
879 void AllocateModuleVariables(); | 893 void AllocateModuleVariables(); |
880 | 894 |
881 private: | 895 private: |
882 ModuleDescriptor* module_descriptor_; | 896 ModuleDescriptor* module_descriptor_; |
883 }; | 897 }; |
884 | 898 |
885 } // namespace internal | 899 } // namespace internal |
886 } // namespace v8 | 900 } // namespace v8 |
887 | 901 |
888 #endif // V8_AST_SCOPES_H_ | 902 #endif // V8_AST_SCOPES_H_ |
OLD | NEW |