| 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 // ----------------------------------------------------------------------------- | 218 // ----------------------------------------------------------------------------- |
| 219 // Forward declarations for frequently used classes | 219 // Forward declarations for frequently used classes |
| 220 // (sorted alphabetically) | 220 // (sorted alphabetically) |
| 221 | 221 |
| 222 class FreeStoreAllocationPolicy; | 222 class FreeStoreAllocationPolicy; |
| 223 template <typename T, class P = FreeStoreAllocationPolicy> class List; | 223 template <typename T, class P = FreeStoreAllocationPolicy> class List; |
| 224 | 224 |
| 225 // ----------------------------------------------------------------------------- | 225 // ----------------------------------------------------------------------------- |
| 226 // Declarations for use in both the preparser and the rest of V8. | 226 // Declarations for use in both the preparser and the rest of V8. |
| 227 | 227 |
| 228 enum ObjectStrength { |
| 229 WEAK, |
| 230 FIRM // strong object |
| 231 }; |
| 232 |
| 228 // The Strict Mode (ECMA-262 5th edition, 4.2.2). | 233 // The Strict Mode (ECMA-262 5th edition, 4.2.2). |
| 229 | 234 |
| 230 enum LanguageMode { | 235 enum LanguageMode { |
| 231 // LanguageMode is expressed as a bitmask. Descriptions of the bits: | 236 // LanguageMode is expressed as a bitmask. Descriptions of the bits: |
| 232 STRICT_BIT = 1 << 0, | 237 STRICT_BIT = 1 << 0, |
| 233 STRONG_BIT = 1 << 1, | 238 STRONG_BIT = 1 << 1, |
| 234 LANGUAGE_END, | 239 LANGUAGE_END, |
| 235 | 240 |
| 236 // Shorthands for some common language modes. | 241 // Shorthands for some common language modes. |
| 237 SLOPPY = 0, | 242 SLOPPY = 0, |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 282 |
| 278 inline LanguageMode construct_language_mode(bool strict_bit, bool strong_bit) { | 283 inline LanguageMode construct_language_mode(bool strict_bit, bool strong_bit) { |
| 279 int language_mode = 0; | 284 int language_mode = 0; |
| 280 if (strict_bit) language_mode |= STRICT_BIT; | 285 if (strict_bit) language_mode |= STRICT_BIT; |
| 281 if (strong_bit) language_mode |= STRONG_BIT; | 286 if (strong_bit) language_mode |= STRONG_BIT; |
| 282 DCHECK(is_valid_language_mode(language_mode)); | 287 DCHECK(is_valid_language_mode(language_mode)); |
| 283 return static_cast<LanguageMode>(language_mode); | 288 return static_cast<LanguageMode>(language_mode); |
| 284 } | 289 } |
| 285 | 290 |
| 286 | 291 |
| 292 inline ObjectStrength strength(LanguageMode language_mode) { |
| 293 return is_strong(language_mode) ? FIRM : WEAK; |
| 294 } |
| 295 |
| 296 |
| 287 // Mask for the sign bit in a smi. | 297 // Mask for the sign bit in a smi. |
| 288 const intptr_t kSmiSignMask = kIntptrSignBit; | 298 const intptr_t kSmiSignMask = kIntptrSignBit; |
| 289 | 299 |
| 290 const int kObjectAlignmentBits = kPointerSizeLog2; | 300 const int kObjectAlignmentBits = kPointerSizeLog2; |
| 291 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; | 301 const intptr_t kObjectAlignment = 1 << kObjectAlignmentBits; |
| 292 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; | 302 const intptr_t kObjectAlignmentMask = kObjectAlignment - 1; |
| 293 | 303 |
| 294 // Desired alignment for pointers. | 304 // Desired alignment for pointers. |
| 295 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); | 305 const intptr_t kPointerAlignment = (1 << kPointerSizeLog2); |
| 296 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; | 306 const intptr_t kPointerAlignmentMask = kPointerAlignment - 1; |
| (...skipping 642 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 939 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { | 949 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { |
| 940 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); | 950 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); |
| 941 DCHECK(IsValidFunctionKind(kind)); | 951 DCHECK(IsValidFunctionKind(kind)); |
| 942 return kind; | 952 return kind; |
| 943 } | 953 } |
| 944 } } // namespace v8::internal | 954 } } // namespace v8::internal |
| 945 | 955 |
| 946 namespace i = v8::internal; | 956 namespace i = v8::internal; |
| 947 | 957 |
| 948 #endif // V8_GLOBALS_H_ | 958 #endif // V8_GLOBALS_H_ |
| OLD | NEW |