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 849 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
860 | 860 |
861 // The order of this enum has to be kept in sync with the predicates below. | 861 // The order of this enum has to be kept in sync with the predicates below. |
862 enum VariableMode { | 862 enum VariableMode { |
863 // User declared variables: | 863 // User declared variables: |
864 VAR, // declared via 'var', and 'function' declarations | 864 VAR, // declared via 'var', and 'function' declarations |
865 | 865 |
866 CONST_LEGACY, // declared via legacy 'const' declarations | 866 CONST_LEGACY, // declared via legacy 'const' declarations |
867 | 867 |
868 LET, // declared via 'let' declarations (first lexical) | 868 LET, // declared via 'let' declarations (first lexical) |
869 | 869 |
| 870 // TODO(neis): Is it correct to make this one of the lexical modes? |
| 871 IMPORT, // declared via 'import' declarations (except namespace imports) |
| 872 |
870 CONST, // declared via 'const' declarations (last lexical) | 873 CONST, // declared via 'const' declarations (last lexical) |
871 | 874 |
872 // Variables introduced by the compiler: | 875 // Variables introduced by the compiler: |
873 TEMPORARY, // temporary variables (not user-visible), stack-allocated | 876 TEMPORARY, // temporary variables (not user-visible), stack-allocated |
874 // unless the scope as a whole has forced context allocation | 877 // unless the scope as a whole has forced context allocation |
875 | 878 |
876 DYNAMIC, // always require dynamic lookup (we don't know | 879 DYNAMIC, // always require dynamic lookup (we don't know |
877 // the declaration) | 880 // the declaration) |
878 | 881 |
879 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the | 882 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the |
(...skipping 15 matching lines...) Expand all Loading... |
895 return mode >= VAR && mode <= CONST; | 898 return mode >= VAR && mode <= CONST; |
896 } | 899 } |
897 | 900 |
898 | 901 |
899 inline bool IsLexicalVariableMode(VariableMode mode) { | 902 inline bool IsLexicalVariableMode(VariableMode mode) { |
900 return mode >= LET && mode <= CONST; | 903 return mode >= LET && mode <= CONST; |
901 } | 904 } |
902 | 905 |
903 | 906 |
904 inline bool IsImmutableVariableMode(VariableMode mode) { | 907 inline bool IsImmutableVariableMode(VariableMode mode) { |
905 return mode == CONST || mode == CONST_LEGACY; | 908 return mode == CONST || mode == CONST_LEGACY || mode == IMPORT; |
906 } | 909 } |
907 | 910 |
908 | 911 |
909 enum class VariableLocation { | 912 enum class VariableLocation { |
910 // Before and during variable allocation, a variable whose location is | 913 // Before and during variable allocation, a variable whose location is |
911 // not yet determined. After allocation, a variable looked up as a | 914 // not yet determined. After allocation, a variable looked up as a |
912 // property on the global object (and possibly absent). name() is the | 915 // property on the global object (and possibly absent). name() is the |
913 // variable name, index() is invalid. | 916 // variable name, index() is invalid. |
914 UNALLOCATED, | 917 UNALLOCATED, |
915 | 918 |
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1127 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1130 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> |
1128 kPointerSizeLog2); | 1131 kPointerSizeLog2); |
1129 } | 1132 } |
1130 | 1133 |
1131 } // namespace internal | 1134 } // namespace internal |
1132 } // namespace v8 | 1135 } // namespace v8 |
1133 | 1136 |
1134 namespace i = v8::internal; | 1137 namespace i = v8::internal; |
1135 | 1138 |
1136 #endif // V8_GLOBALS_H_ | 1139 #endif // V8_GLOBALS_H_ |
OLD | NEW |