| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef RUNTIME_VM_CPU_MIPS_H_ | 5 #ifndef RUNTIME_VM_CPU_MIPS_H_ |
| 6 #define RUNTIME_VM_CPU_MIPS_H_ | 6 #define RUNTIME_VM_CPU_MIPS_H_ |
| 7 | 7 |
| 8 #include "vm/allocation.h" | 8 #include "vm/allocation.h" |
| 9 | 9 |
| 10 namespace dart { | 10 namespace dart { |
| 11 | 11 |
| 12 // TargetCPUFeatures gives CPU features for the architecture that we are | 12 // TargetCPUFeatures gives CPU features for the architecture that we are |
| 13 // generating code for. HostCPUFeatures gives the CPU features for the | 13 // generating code for. HostCPUFeatures gives the CPU features for the |
| 14 // architecture that we are actually running on. When the architectures | 14 // architecture that we are actually running on. When the architectures |
| 15 // are the same, TargetCPUFeatures will query HostCPUFeatures. When they are | 15 // are the same, TargetCPUFeatures will query HostCPUFeatures. When they are |
| 16 // different (i.e. we are running in a simulator), HostCPUFeatures will | 16 // different (i.e. we are running in a simulator), HostCPUFeatures will |
| 17 // additionally mock the options needed for the target architecture so that | 17 // additionally mock the options needed for the target architecture so that |
| 18 // they may be altered for testing. | 18 // they may be altered for testing. |
| 19 | 19 |
| 20 enum MIPSVersion { | 20 enum MIPSVersion { |
| 21 MIPS32, | 21 MIPS32, |
| 22 MIPS32r2, | 22 MIPS32r2, |
| 23 MIPSvUnknown, | 23 MIPSvUnknown, |
| 24 }; | 24 }; |
| 25 | 25 |
| 26 class HostCPUFeatures: public AllStatic { | 26 class HostCPUFeatures : public AllStatic { |
| 27 public: | 27 public: |
| 28 static void InitOnce(); | 28 static void InitOnce(); |
| 29 static void Cleanup(); | 29 static void Cleanup(); |
| 30 static const char* hardware() { | 30 static const char* hardware() { |
| 31 DEBUG_ASSERT(initialized_); | 31 DEBUG_ASSERT(initialized_); |
| 32 return hardware_; | 32 return hardware_; |
| 33 } | 33 } |
| 34 static MIPSVersion mips_version() { | 34 static MIPSVersion mips_version() { |
| 35 DEBUG_ASSERT(initialized_); | 35 DEBUG_ASSERT(initialized_); |
| 36 return mips_version_; | 36 return mips_version_; |
| 37 } | 37 } |
| 38 | 38 |
| 39 private: | 39 private: |
| 40 static const char* hardware_; | 40 static const char* hardware_; |
| 41 static MIPSVersion mips_version_; | 41 static MIPSVersion mips_version_; |
| 42 #if defined(DEBUG) | 42 #if defined(DEBUG) |
| 43 static bool initialized_; | 43 static bool initialized_; |
| 44 #endif | 44 #endif |
| 45 }; | 45 }; |
| 46 | 46 |
| 47 class TargetCPUFeatures : public AllStatic { | 47 class TargetCPUFeatures : public AllStatic { |
| 48 public: | 48 public: |
| 49 static void InitOnce() { | 49 static void InitOnce() { HostCPUFeatures::InitOnce(); } |
| 50 HostCPUFeatures::InitOnce(); | 50 static void Cleanup() { HostCPUFeatures::Cleanup(); } |
| 51 } | 51 static const char* hardware() { return HostCPUFeatures::hardware(); } |
| 52 static void Cleanup() { | 52 static bool double_truncate_round_supported() { return false; } |
| 53 HostCPUFeatures::Cleanup(); | 53 static MIPSVersion mips_version() { return HostCPUFeatures::mips_version(); } |
| 54 } | |
| 55 static const char* hardware() { | |
| 56 return HostCPUFeatures::hardware(); | |
| 57 } | |
| 58 static bool double_truncate_round_supported() { | |
| 59 return false; | |
| 60 } | |
| 61 static MIPSVersion mips_version() { | |
| 62 return HostCPUFeatures::mips_version(); | |
| 63 } | |
| 64 }; | 54 }; |
| 65 | 55 |
| 66 } // namespace dart | 56 } // namespace dart |
| 67 | 57 |
| 68 #endif // RUNTIME_VM_CPU_MIPS_H_ | 58 #endif // RUNTIME_VM_CPU_MIPS_H_ |
| OLD | NEW |