| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 #define USE_SIMULATOR 1 | 155 #define USE_SIMULATOR 1 |
| 156 #endif | 156 #endif |
| 157 #if (defined(V8_TARGET_ARCH_ARM) && !defined(V8_HOST_ARCH_ARM)) | 157 #if (defined(V8_TARGET_ARCH_ARM) && !defined(V8_HOST_ARCH_ARM)) |
| 158 #define USE_SIMULATOR 1 | 158 #define USE_SIMULATOR 1 |
| 159 #endif | 159 #endif |
| 160 #if (defined(V8_TARGET_ARCH_MIPS) && !defined(V8_HOST_ARCH_MIPS)) | 160 #if (defined(V8_TARGET_ARCH_MIPS) && !defined(V8_HOST_ARCH_MIPS)) |
| 161 #define USE_SIMULATOR 1 | 161 #define USE_SIMULATOR 1 |
| 162 #endif | 162 #endif |
| 163 #endif | 163 #endif |
| 164 | 164 |
| 165 // Determine architecture endiannes (we only support little-endian). |
| 166 #if defined(V8_TARGET_ARCH_IA32) |
| 167 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 168 #elif defined(V8_TARGET_ARCH_X64) |
| 169 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 170 #elif defined(V8_TARGET_ARCH_ARM) |
| 171 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 172 #elif defined(V8_TARGET_ARCH_A64) |
| 173 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 174 #elif defined(V8_TARGET_ARCH_MIPS) |
| 175 #define V8_TARGET_LITTLE_ENDIAN 1 |
| 176 #else |
| 177 #error Unknown target architecture endiannes |
| 178 #endif |
| 179 |
| 165 // Support for alternative bool type. This is only enabled if the code is | 180 // Support for alternative bool type. This is only enabled if the code is |
| 166 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. | 181 // compiled with USE_MYBOOL defined. This catches some nasty type bugs. |
| 167 // For instance, 'bool b = "false";' results in b == true! This is a hidden | 182 // For instance, 'bool b = "false";' results in b == true! This is a hidden |
| 168 // source of bugs. | 183 // source of bugs. |
| 169 // However, redefining the bool type does have some negative impact on some | 184 // However, redefining the bool type does have some negative impact on some |
| 170 // platforms. It gives rise to compiler warnings (i.e. with | 185 // platforms. It gives rise to compiler warnings (i.e. with |
| 171 // MSVC) in the API header files when mixing code that uses the standard | 186 // MSVC) in the API header files when mixing code that uses the standard |
| 172 // bool with code that uses the redefined version. | 187 // bool with code that uses the redefined version. |
| 173 // This does not actually belong in the platform code, but needs to be | 188 // This does not actually belong in the platform code, but needs to be |
| 174 // defined here because the platform code uses bool, and platform.h is | 189 // defined here because the platform code uses bool, and platform.h is |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 406 // neither in strict nor extended mode. However, the more distinguishing term | 421 // neither in strict nor extended mode. However, the more distinguishing term |
| 407 // 'classic mode' is used in V8 instead to avoid mix-ups. | 422 // 'classic mode' is used in V8 instead to avoid mix-ups. |
| 408 | 423 |
| 409 enum LanguageMode { | 424 enum LanguageMode { |
| 410 CLASSIC_MODE, | 425 CLASSIC_MODE, |
| 411 STRICT_MODE, | 426 STRICT_MODE, |
| 412 EXTENDED_MODE | 427 EXTENDED_MODE |
| 413 }; | 428 }; |
| 414 | 429 |
| 415 | 430 |
| 431 // A simple Maybe type, that can be passed by value. |
| 432 template<class T> |
| 433 struct Maybe { |
| 434 Maybe() : has_value(false) {} |
| 435 explicit Maybe(T t) : has_value(true), value(t) {} |
| 436 Maybe(bool has, T t) : has_value(has), value(t) {} |
| 437 |
| 438 bool has_value; |
| 439 T value; |
| 440 }; |
| 441 |
| 442 |
| 416 // The Strict Mode (ECMA-262 5th edition, 4.2.2). | 443 // The Strict Mode (ECMA-262 5th edition, 4.2.2). |
| 417 // | 444 // |
| 418 // This flag is used in the backend to represent the language mode. So far | 445 // This flag is used in the backend to represent the language mode. So far |
| 419 // there is no semantic difference between the strict and the extended mode in | 446 // there is no semantic difference between the strict and the extended mode in |
| 420 // the backend, so both modes are represented by the kStrictMode value. | 447 // the backend, so both modes are represented by the kStrictMode value. |
| 421 enum StrictModeFlag { | 448 enum StrictModeFlag { |
| 422 kNonStrictMode, | 449 kNonStrictMode, |
| 423 kStrictMode | 450 kStrictMode |
| 424 }; | 451 }; |
| 425 | 452 |
| 426 | 453 |
| 427 } } // namespace v8::internal | 454 } } // namespace v8::internal |
| 428 | 455 |
| 429 #endif // V8_GLOBALS_H_ | 456 #endif // V8_GLOBALS_H_ |
| OLD | NEW |