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 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 // (sorted alphabetically) | 218 // (sorted alphabetically) |
219 | 219 |
220 class FreeStoreAllocationPolicy; | 220 class FreeStoreAllocationPolicy; |
221 template <typename T, class P = FreeStoreAllocationPolicy> class List; | 221 template <typename T, class P = FreeStoreAllocationPolicy> class List; |
222 | 222 |
223 // ----------------------------------------------------------------------------- | 223 // ----------------------------------------------------------------------------- |
224 // Declarations for use in both the preparser and the rest of V8. | 224 // Declarations for use in both the preparser and the rest of V8. |
225 | 225 |
226 // The Strict Mode (ECMA-262 5th edition, 4.2.2). | 226 // The Strict Mode (ECMA-262 5th edition, 4.2.2). |
227 | 227 |
228 enum StrictMode { SLOPPY, STRICT }; | 228 enum LanguageMode { |
| 229 // LanguageMode is expressed as a bitmask. Descriptions of the bits: |
| 230 STRICT = 1 << 0, |
| 231 LANGUAGE_END, |
229 | 232 |
| 233 // Shorthands for some common language modes. |
| 234 SLOPPY = 0 |
| 235 }; |
| 236 |
| 237 inline bool is_strict(LanguageMode language_mode) { |
| 238 return language_mode & STRICT; |
| 239 } |
| 240 |
| 241 inline bool is_sloppy(LanguageMode language_mode) { |
| 242 return (language_mode & STRICT) == 0; |
| 243 } |
| 244 |
| 245 inline bool is_valid_language_mode(int language_mode) { |
| 246 return language_mode == SLOPPY || language_mode == STRICT; |
| 247 } |
230 | 248 |
231 // Mask for the sign bit in a smi. | 249 // Mask for the sign bit in a smi. |
232 const intptr_t kSmiSignMask = kIntptrSignBit; | 250 const intptr_t kSmiSignMask = kIntptrSignBit; |
233 | 251 |
234 const int kObjectAlignmentBits = kPointerSizeLog2; | 252 const int kObjectAlignmentBits = kPointerSizeLog2; |
235 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; | 253 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; |
236 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; | 254 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; |
237 | 255 |
238 // Desired alignment for pointers. | 256 // Desired alignment for pointers. |
239 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); | 257 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); |
(...skipping 579 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 | 837 |
820 inline bool IsSubclassConstructor(FunctionKind kind) { | 838 inline bool IsSubclassConstructor(FunctionKind kind) { |
821 DCHECK(IsValidFunctionKind(kind)); | 839 DCHECK(IsValidFunctionKind(kind)); |
822 return kind & FunctionKind::kSubclassConstructor; | 840 return kind & FunctionKind::kSubclassConstructor; |
823 } | 841 } |
824 } } // namespace v8::internal | 842 } } // namespace v8::internal |
825 | 843 |
826 namespace i = v8::internal; | 844 namespace i = v8::internal; |
827 | 845 |
828 #endif // V8_GLOBALS_H_ | 846 #endif // V8_GLOBALS_H_ |
OLD | NEW |