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_GLOBALS_H_ | 5 #ifndef V8_GLOBALS_H_ |
6 #define V8_GLOBALS_H_ | 6 #define V8_GLOBALS_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 897 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
908 // by an eval-introduced variable | 908 // by an eval-introduced variable |
909 | 909 |
910 DYNAMIC_LOCAL, // requires dynamic lookup, but we know that the | 910 DYNAMIC_LOCAL, // requires dynamic lookup, but we know that the |
911 // variable is local and where it is unless it | 911 // variable is local and where it is unless it |
912 // has been shadowed by an eval-introduced | 912 // has been shadowed by an eval-introduced |
913 // variable | 913 // variable |
914 | 914 |
915 kLastVariableMode = DYNAMIC_LOCAL | 915 kLastVariableMode = DYNAMIC_LOCAL |
916 }; | 916 }; |
917 | 917 |
| 918 // Printing support |
| 919 #ifdef DEBUG |
| 920 inline const char* VariableMode2String(VariableMode mode) { |
| 921 switch (mode) { |
| 922 case VAR: |
| 923 return "VAR"; |
| 924 case LET: |
| 925 return "LET"; |
| 926 case CONST: |
| 927 return "CONST"; |
| 928 case DYNAMIC: |
| 929 return "DYNAMIC"; |
| 930 case DYNAMIC_GLOBAL: |
| 931 return "DYNAMIC_GLOBAL"; |
| 932 case DYNAMIC_LOCAL: |
| 933 return "DYNAMIC_LOCAL"; |
| 934 case TEMPORARY: |
| 935 return "TEMPORARY"; |
| 936 } |
| 937 UNREACHABLE(); |
| 938 return NULL; |
| 939 } |
| 940 #endif |
| 941 |
| 942 enum VariableKind : uint8_t { |
| 943 NORMAL_VARIABLE, |
| 944 FUNCTION_VARIABLE, |
| 945 THIS_VARIABLE, |
| 946 ARGUMENTS_VARIABLE, |
| 947 SLOPPY_FUNCTION_NAME_VARIABLE, |
| 948 kLastKind = SLOPPY_FUNCTION_NAME_VARIABLE |
| 949 }; |
| 950 |
918 inline bool IsDynamicVariableMode(VariableMode mode) { | 951 inline bool IsDynamicVariableMode(VariableMode mode) { |
919 return mode >= DYNAMIC && mode <= DYNAMIC_LOCAL; | 952 return mode >= DYNAMIC && mode <= DYNAMIC_LOCAL; |
920 } | 953 } |
921 | 954 |
922 | 955 |
923 inline bool IsDeclaredVariableMode(VariableMode mode) { | 956 inline bool IsDeclaredVariableMode(VariableMode mode) { |
924 STATIC_ASSERT(VAR == 0); // Implies that mode >= VAR. | 957 STATIC_ASSERT(VAR == 0); // Implies that mode >= VAR. |
925 return mode <= CONST; | 958 return mode <= CONST; |
926 } | 959 } |
927 | 960 |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 LIVE_EDIT_FRAME_DROPPED_IN_RETURN_CALL, | 1206 LIVE_EDIT_FRAME_DROPPED_IN_RETURN_CALL, |
1174 LIVE_EDIT_CURRENTLY_SET_MODE | 1207 LIVE_EDIT_CURRENTLY_SET_MODE |
1175 }; | 1208 }; |
1176 | 1209 |
1177 } // namespace internal | 1210 } // namespace internal |
1178 } // namespace v8 | 1211 } // namespace v8 |
1179 | 1212 |
1180 namespace i = v8::internal; | 1213 namespace i = v8::internal; |
1181 | 1214 |
1182 #endif // V8_GLOBALS_H_ | 1215 #endif // V8_GLOBALS_H_ |
OLD | NEW |