OLD | NEW |
1 // Copyright (c) 1994-2006 Sun Microsystems Inc. | 1 // Copyright (c) 1994-2006 Sun Microsystems Inc. |
2 // All Rights Reserved. | 2 // All Rights Reserved. |
3 // | 3 // |
4 // Redistribution and use in source and binary forms, with or without | 4 // Redistribution and use in source and binary forms, with or without |
5 // modification, are permitted provided that the following conditions are | 5 // modification, are permitted provided that the following conditions are |
6 // met: | 6 // met: |
7 // | 7 // |
8 // - Redistributions of source code must retain the above copyright notice, | 8 // - Redistributions of source code must retain the above copyright notice, |
9 // this list of conditions and the following disclaimer. | 9 // this list of conditions and the following disclaimer. |
10 // | 10 // |
(...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 public: | 360 public: |
361 // Feature flags bit positions. They are mostly based on the CPUID spec. | 361 // Feature flags bit positions. They are mostly based on the CPUID spec. |
362 // (We assign CPUID itself to one of the currently reserved bits -- | 362 // (We assign CPUID itself to one of the currently reserved bits -- |
363 // feel free to change this if needed.) | 363 // feel free to change this if needed.) |
364 enum Feature { SSE3 = 32, SSE2 = 26, CMOV = 15, RDTSC = 4, CPUID = 10 }; | 364 enum Feature { SSE3 = 32, SSE2 = 26, CMOV = 15, RDTSC = 4, CPUID = 10 }; |
365 // Detect features of the target CPU. Set safe defaults if the serializer | 365 // Detect features of the target CPU. Set safe defaults if the serializer |
366 // is enabled (snapshots must be portable). | 366 // is enabled (snapshots must be portable). |
367 static void Probe(); | 367 static void Probe(); |
368 // Check whether a feature is supported by the target CPU. | 368 // Check whether a feature is supported by the target CPU. |
369 static bool IsSupported(Feature f) { | 369 static bool IsSupported(Feature f) { |
| 370 if (f == SSE2 && !FLAG_enable_sse2) return false; |
| 371 if (f == SSE3 && !FLAG_enable_sse3) return false; |
| 372 if (f == CMOV && !FLAG_enable_cmov) return false; |
| 373 if (f == RDTSC && !FLAG_enable_rdtsc) return false; |
370 return (supported_ & (static_cast<uint64_t>(1) << f)) != 0; | 374 return (supported_ & (static_cast<uint64_t>(1) << f)) != 0; |
371 } | 375 } |
372 // Check whether a feature is currently enabled. | 376 // Check whether a feature is currently enabled. |
373 static bool IsEnabled(Feature f) { | 377 static bool IsEnabled(Feature f) { |
374 return (enabled_ & (static_cast<uint64_t>(1) << f)) != 0; | 378 return (enabled_ & (static_cast<uint64_t>(1) << f)) != 0; |
375 } | 379 } |
376 // Enable a specified feature within a scope. | 380 // Enable a specified feature within a scope. |
377 class Scope BASE_EMBEDDED { | 381 class Scope BASE_EMBEDDED { |
378 #ifdef DEBUG | 382 #ifdef DEBUG |
379 public: | 383 public: |
(...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 private: | 872 private: |
869 Assembler* assembler_; | 873 Assembler* assembler_; |
870 #ifdef DEBUG | 874 #ifdef DEBUG |
871 int space_before_; | 875 int space_before_; |
872 #endif | 876 #endif |
873 }; | 877 }; |
874 | 878 |
875 } } // namespace v8::internal | 879 } } // namespace v8::internal |
876 | 880 |
877 #endif // V8_IA32_ASSEMBLER_IA32_H_ | 881 #endif // V8_IA32_ASSEMBLER_IA32_H_ |
OLD | NEW |