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 868 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
879 | 879 |
880 // ES6 section 20.1.2.6 Number.MAX_SAFE_INTEGER | 880 // ES6 section 20.1.2.6 Number.MAX_SAFE_INTEGER |
881 const double kMaxSafeInteger = 9007199254740991.0; // 2^53-1 | 881 const double kMaxSafeInteger = 9007199254740991.0; // 2^53-1 |
882 | 882 |
883 | 883 |
884 // The order of this enum has to be kept in sync with the predicates below. | 884 // The order of this enum has to be kept in sync with the predicates below. |
885 enum VariableMode : uint8_t { | 885 enum VariableMode : uint8_t { |
886 // User declared variables: | 886 // User declared variables: |
887 VAR, // declared via 'var', and 'function' declarations | 887 VAR, // declared via 'var', and 'function' declarations |
888 | 888 |
889 CONST_LEGACY, // declared via legacy 'const' declarations | |
890 | |
891 LET, // declared via 'let' declarations (first lexical) | 889 LET, // declared via 'let' declarations (first lexical) |
892 | 890 |
893 CONST, // declared via 'const' declarations (last lexical) | 891 CONST, // declared via 'const' declarations (last lexical) |
894 | 892 |
895 // Variables introduced by the compiler: | 893 // Variables introduced by the compiler: |
896 TEMPORARY, // temporary variables (not user-visible), stack-allocated | 894 TEMPORARY, // temporary variables (not user-visible), stack-allocated |
897 // unless the scope as a whole has forced context allocation | 895 // unless the scope as a whole has forced context allocation |
898 | 896 |
899 DYNAMIC, // always require dynamic lookup (we don't know | 897 DYNAMIC, // always require dynamic lookup (we don't know |
900 // the declaration) | 898 // the declaration) |
(...skipping 18 matching lines...) Expand all Loading... |
919 inline bool IsDeclaredVariableMode(VariableMode mode) { | 917 inline bool IsDeclaredVariableMode(VariableMode mode) { |
920 STATIC_ASSERT(VAR == 0); // Implies that mode >= VAR. | 918 STATIC_ASSERT(VAR == 0); // Implies that mode >= VAR. |
921 return mode <= CONST; | 919 return mode <= CONST; |
922 } | 920 } |
923 | 921 |
924 | 922 |
925 inline bool IsLexicalVariableMode(VariableMode mode) { | 923 inline bool IsLexicalVariableMode(VariableMode mode) { |
926 return mode >= LET && mode <= CONST; | 924 return mode >= LET && mode <= CONST; |
927 } | 925 } |
928 | 926 |
929 | |
930 inline bool IsImmutableVariableMode(VariableMode mode) { | |
931 return mode == CONST || mode == CONST_LEGACY; | |
932 } | |
933 | |
934 enum VariableLocation : uint8_t { | 927 enum VariableLocation : uint8_t { |
935 // Before and during variable allocation, a variable whose location is | 928 // Before and during variable allocation, a variable whose location is |
936 // not yet determined. After allocation, a variable looked up as a | 929 // not yet determined. After allocation, a variable looked up as a |
937 // property on the global object (and possibly absent). name() is the | 930 // property on the global object (and possibly absent). name() is the |
938 // variable name, index() is invalid. | 931 // variable name, index() is invalid. |
939 UNALLOCATED, | 932 UNALLOCATED, |
940 | 933 |
941 // A slot in the parameter section on the stack. index() is the | 934 // A slot in the parameter section on the stack. index() is the |
942 // parameter index, counting left-to-right. The receiver is index -1; | 935 // parameter index, counting left-to-right. The receiver is index -1; |
943 // the first parameter is index 0. | 936 // the first parameter is index 0. |
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1166 public: | 1159 public: |
1167 enum { kNone = 0x00, kSignedSmall = 0x01, kNumber = 0x3, kAny = 0x7 }; | 1160 enum { kNone = 0x00, kSignedSmall = 0x01, kNumber = 0x3, kAny = 0x7 }; |
1168 }; | 1161 }; |
1169 | 1162 |
1170 } // namespace internal | 1163 } // namespace internal |
1171 } // namespace v8 | 1164 } // namespace v8 |
1172 | 1165 |
1173 namespace i = v8::internal; | 1166 namespace i = v8::internal; |
1174 | 1167 |
1175 #endif // V8_GLOBALS_H_ | 1168 #endif // V8_GLOBALS_H_ |
OLD | NEW |