| 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 440 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 451 // Detect features of the target CPU. Set safe defaults if the serializer | 451 // Detect features of the target CPU. Set safe defaults if the serializer |
| 452 // is enabled (snapshots must be portable). | 452 // is enabled (snapshots must be portable). |
| 453 static void Probe(bool serializer_enabled); | 453 static void Probe(bool serializer_enabled); |
| 454 | 454 |
| 455 // Check whether a feature is supported by the target CPU. | 455 // Check whether a feature is supported by the target CPU. |
| 456 static bool IsSupported(CpuFeature f) { | 456 static bool IsSupported(CpuFeature f) { |
| 457 if (Check(f, cross_compile_)) return true; | 457 if (Check(f, cross_compile_)) return true; |
| 458 ASSERT(initialized_); | 458 ASSERT(initialized_); |
| 459 if (f == SSE3 && !FLAG_enable_sse3) return false; | 459 if (f == SSE3 && !FLAG_enable_sse3) return false; |
| 460 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; | 460 if (f == SSE4_1 && !FLAG_enable_sse4_1) return false; |
| 461 if (f == CMOV && !FLAG_enable_cmov) return false; | |
| 462 if (f == SAHF && !FLAG_enable_sahf) return false; | 461 if (f == SAHF && !FLAG_enable_sahf) return false; |
| 463 return Check(f, supported_); | 462 return Check(f, supported_); |
| 464 } | 463 } |
| 465 | 464 |
| 466 static bool IsSafeForSnapshot(Isolate* isolate, CpuFeature f) { | 465 static bool IsSafeForSnapshot(Isolate* isolate, CpuFeature f) { |
| 467 return Check(f, cross_compile_) || | 466 return Check(f, cross_compile_) || |
| 468 (IsSupported(f) && | 467 (IsSupported(f) && |
| 469 !(Serializer::enabled(isolate) && | 468 !(Serializer::enabled(isolate) && |
| 470 Check(f, found_by_runtime_probing_only_))); | 469 Check(f, found_by_runtime_probing_only_))); |
| 471 } | 470 } |
| (...skipping 12 matching lines...) Expand all Loading... |
| 484 | 483 |
| 485 private: | 484 private: |
| 486 static bool Check(CpuFeature f, uint64_t set) { | 485 static bool Check(CpuFeature f, uint64_t set) { |
| 487 return (set & flag2set(f)) != 0; | 486 return (set & flag2set(f)) != 0; |
| 488 } | 487 } |
| 489 | 488 |
| 490 static uint64_t flag2set(CpuFeature f) { | 489 static uint64_t flag2set(CpuFeature f) { |
| 491 return static_cast<uint64_t>(1) << f; | 490 return static_cast<uint64_t>(1) << f; |
| 492 } | 491 } |
| 493 | 492 |
| 494 // Safe defaults include CMOV for X64. It is always available, if | |
| 495 // anyone checks, but they shouldn't need to check. | |
| 496 // The required user mode extensions in X64 are (from AMD64 ABI Table A.1): | |
| 497 // fpu, tsc, cx8, cmov, mmx, sse, sse2, fxsr, syscall | |
| 498 static const uint64_t kDefaultCpuFeatures = (1 << CMOV); | |
| 499 | |
| 500 #ifdef DEBUG | 493 #ifdef DEBUG |
| 501 static bool initialized_; | 494 static bool initialized_; |
| 502 #endif | 495 #endif |
| 503 static uint64_t supported_; | 496 static uint64_t supported_; |
| 504 static uint64_t found_by_runtime_probing_only_; | 497 static uint64_t found_by_runtime_probing_only_; |
| 505 | 498 |
| 506 static uint64_t cross_compile_; | 499 static uint64_t cross_compile_; |
| 507 | 500 |
| 508 friend class ExternalReference; | 501 friend class ExternalReference; |
| 509 friend class PlatformFeatureScope; | 502 friend class PlatformFeatureScope; |
| (...skipping 1140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1650 private: | 1643 private: |
| 1651 Assembler* assembler_; | 1644 Assembler* assembler_; |
| 1652 #ifdef DEBUG | 1645 #ifdef DEBUG |
| 1653 int space_before_; | 1646 int space_before_; |
| 1654 #endif | 1647 #endif |
| 1655 }; | 1648 }; |
| 1656 | 1649 |
| 1657 } } // namespace v8::internal | 1650 } } // namespace v8::internal |
| 1658 | 1651 |
| 1659 #endif // V8_X64_ASSEMBLER_X64_H_ | 1652 #endif // V8_X64_ASSEMBLER_X64_H_ |
| OLD | NEW |