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 841 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
852 | 852 |
853 // The order of this enum has to be kept in sync with the predicates below. | 853 // The order of this enum has to be kept in sync with the predicates below. |
854 enum VariableMode { | 854 enum VariableMode { |
855 // User declared variables: | 855 // User declared variables: |
856 VAR, // declared via 'var', and 'function' declarations | 856 VAR, // declared via 'var', and 'function' declarations |
857 | 857 |
858 CONST_LEGACY, // declared via legacy 'const' declarations | 858 CONST_LEGACY, // declared via legacy 'const' declarations |
859 | 859 |
860 LET, // declared via 'let' declarations (first lexical) | 860 LET, // declared via 'let' declarations (first lexical) |
861 | 861 |
862 // TODO(neis): Is it correct to make this one of the lexical modes? | |
863 IMPORT, // declared via 'import' declarations (except namespace imports) | |
864 | |
862 CONST, // declared via 'const' declarations (last lexical) | 865 CONST, // declared via 'const' declarations (last lexical) |
863 | 866 |
864 // Variables introduced by the compiler: | 867 // Variables introduced by the compiler: |
865 TEMPORARY, // temporary variables (not user-visible), stack-allocated | 868 TEMPORARY, // temporary variables (not user-visible), stack-allocated |
866 // unless the scope as a whole has forced context allocation | 869 // unless the scope as a whole has forced context allocation |
867 | 870 |
868 DYNAMIC, // always require dynamic lookup (we don't know | 871 DYNAMIC, // always require dynamic lookup (we don't know |
869 // the declaration) | 872 // the declaration) |
870 | 873 |
871 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the | 874 DYNAMIC_GLOBAL, // requires dynamic lookup, but we know that the |
(...skipping 14 matching lines...) Expand all Loading... | |
886 inline bool IsDeclaredVariableMode(VariableMode mode) { | 889 inline bool IsDeclaredVariableMode(VariableMode mode) { |
887 return mode >= VAR && mode <= CONST; | 890 return mode >= VAR && mode <= CONST; |
888 } | 891 } |
889 | 892 |
890 | 893 |
891 inline bool IsLexicalVariableMode(VariableMode mode) { | 894 inline bool IsLexicalVariableMode(VariableMode mode) { |
892 return mode >= LET && mode <= CONST; | 895 return mode >= LET && mode <= CONST; |
893 } | 896 } |
894 | 897 |
895 | 898 |
896 inline bool IsImmutableVariableMode(VariableMode mode) { | 899 inline bool IsImmutableVariableMode(VariableMode mode) { |
adamk
2016/07/13 18:38:21
I think you'll want to add IMPORT here too (or a T
neis
2016/07/14 10:28:23
Yeah, probably. Added it. I suspect there are many
| |
897 return mode == CONST || mode == CONST_LEGACY; | 900 return mode == CONST || mode == CONST_LEGACY; |
898 } | 901 } |
899 | 902 |
900 | 903 |
901 enum class VariableLocation { | 904 enum class VariableLocation { |
902 // Before and during variable allocation, a variable whose location is | 905 // Before and during variable allocation, a variable whose location is |
903 // not yet determined. After allocation, a variable looked up as a | 906 // not yet determined. After allocation, a variable looked up as a |
904 // property on the global object (and possibly absent). name() is the | 907 // property on the global object (and possibly absent). name() is the |
905 // variable name, index() is invalid. | 908 // variable name, index() is invalid. |
906 UNALLOCATED, | 909 UNALLOCATED, |
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1119 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> | 1122 return static_cast<uint32_t>(bit_cast<uintptr_t>(address) >> |
1120 kPointerSizeLog2); | 1123 kPointerSizeLog2); |
1121 } | 1124 } |
1122 | 1125 |
1123 } // namespace internal | 1126 } // namespace internal |
1124 } // namespace v8 | 1127 } // namespace v8 |
1125 | 1128 |
1126 namespace i = v8::internal; | 1129 namespace i = v8::internal; |
1127 | 1130 |
1128 #endif // V8_GLOBALS_H_ | 1131 #endif // V8_GLOBALS_H_ |
OLD | NEW |