| 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 |
| 11 #include <ostream> |
| 12 |
| 11 #include "src/base/build_config.h" | 13 #include "src/base/build_config.h" |
| 12 #include "src/base/logging.h" | 14 #include "src/base/logging.h" |
| 13 #include "src/base/macros.h" | 15 #include "src/base/macros.h" |
| 14 | 16 |
| 15 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' | 17 // Unfortunately, the INFINITY macro cannot be used with the '-pedantic' |
| 16 // warning flag and certain versions of GCC due to a bug: | 18 // warning flag and certain versions of GCC due to a bug: |
| 17 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 | 19 // http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11931 |
| 18 // For now, we use the more involved template-based version from <limits>, but | 20 // For now, we use the more involved template-based version from <limits>, but |
| 19 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) | 21 // only when compiling with GCC versions affected by the bug (2.96.x - 4.0.x) |
| 20 #if V8_CC_GNU && V8_GNUC_PREREQ(2, 96, 0) && !V8_GNUC_PREREQ(4, 1, 0) | 22 #if V8_CC_GNU && V8_GNUC_PREREQ(2, 96, 0) && !V8_GNUC_PREREQ(4, 1, 0) |
| (...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 STRONG_BIT = 1 << 1, | 233 STRONG_BIT = 1 << 1, |
| 232 LANGUAGE_END, | 234 LANGUAGE_END, |
| 233 | 235 |
| 234 // Shorthands for some common language modes. | 236 // Shorthands for some common language modes. |
| 235 SLOPPY = 0, | 237 SLOPPY = 0, |
| 236 STRICT = STRICT_BIT, | 238 STRICT = STRICT_BIT, |
| 237 STRONG = STRICT_BIT | STRONG_BIT | 239 STRONG = STRICT_BIT | STRONG_BIT |
| 238 }; | 240 }; |
| 239 | 241 |
| 240 | 242 |
| 243 inline std::ostream& operator<<(std::ostream& os, LanguageMode mode) { |
| 244 switch (mode) { |
| 245 case SLOPPY: |
| 246 return os << "sloppy"; |
| 247 case STRICT: |
| 248 return os << "strict"; |
| 249 case STRONG: |
| 250 return os << "strong"; |
| 251 default: |
| 252 return os << "unknown"; |
| 253 } |
| 254 } |
| 255 |
| 256 |
| 241 inline bool is_sloppy(LanguageMode language_mode) { | 257 inline bool is_sloppy(LanguageMode language_mode) { |
| 242 return (language_mode & STRICT_BIT) == 0; | 258 return (language_mode & STRICT_BIT) == 0; |
| 243 } | 259 } |
| 244 | 260 |
| 245 | 261 |
| 246 inline bool is_strict(LanguageMode language_mode) { | 262 inline bool is_strict(LanguageMode language_mode) { |
| 247 return language_mode & STRICT_BIT; | 263 return language_mode & STRICT_BIT; |
| 248 } | 264 } |
| 249 | 265 |
| 250 | 266 |
| (...skipping 676 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 927 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { | 943 inline FunctionKind WithObjectLiteralBit(FunctionKind kind) { |
| 928 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); | 944 kind = static_cast<FunctionKind>(kind | FunctionKind::kInObjectLiteral); |
| 929 DCHECK(IsValidFunctionKind(kind)); | 945 DCHECK(IsValidFunctionKind(kind)); |
| 930 return kind; | 946 return kind; |
| 931 } | 947 } |
| 932 } } // namespace v8::internal | 948 } } // namespace v8::internal |
| 933 | 949 |
| 934 namespace i = v8::internal; | 950 namespace i = v8::internal; |
| 935 | 951 |
| 936 #endif // V8_GLOBALS_H_ | 952 #endif // V8_GLOBALS_H_ |
| OLD | NEW |