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