| Index: runtime/vm/cpu_arm.cc
|
| ===================================================================
|
| --- runtime/vm/cpu_arm.cc (revision 31402)
|
| +++ runtime/vm/cpu_arm.cc (working copy)
|
| @@ -6,13 +6,15 @@
|
|
|
| #if defined(TARGET_ARCH_ARM)
|
|
|
| +#include "vm/cpu.h"
|
| +#include "vm/cpuinfo.h"
|
| +#include "vm/simulator.h"
|
| +
|
| #if defined(HOST_ARCH_ARM)
|
| #include <sys/syscall.h> /* NOLINT */
|
| #include <unistd.h> /* NOLINT */
|
| #endif
|
|
|
| -#include "vm/cpu.h"
|
| -
|
| namespace dart {
|
|
|
| void CPU::FlushICache(uword start, uword size) {
|
| @@ -48,6 +50,71 @@
|
| "arm";
|
| }
|
|
|
| +
|
| +bool CPUFeatures::integer_division_supported_ = false;
|
| +bool CPUFeatures::neon_supported_ = false;
|
| +char CPUFeatures::hardware_[HARDWARE_LEN] = {0};
|
| +#if defined(DEBUG)
|
| +bool CPUFeatures::initialized_ = false;
|
| +#endif
|
| +
|
| +
|
| +bool CPUFeatures::integer_division_supported() {
|
| + DEBUG_ASSERT(initialized_);
|
| + return integer_division_supported_;
|
| +}
|
| +
|
| +
|
| +bool CPUFeatures::neon_supported() {
|
| + DEBUG_ASSERT(initialized_);
|
| + return neon_supported_;
|
| +}
|
| +
|
| +
|
| +char* CPUFeatures::hardware() {
|
| + DEBUG_ASSERT(initialized_);
|
| + return hardware_;
|
| +}
|
| +
|
| +// If we are using the simulator, allow tests to enable/disable support for
|
| +// integer division.
|
| +#if defined(USING_SIMULATOR)
|
| +void CPUFeatures::set_integer_division_supported(bool supported) {
|
| + integer_division_supported_ = supported;
|
| +}
|
| +
|
| +
|
| +void CPUFeatures::set_neon_supported(bool supported) {
|
| + neon_supported_ = supported;
|
| +}
|
| +#endif
|
| +
|
| +
|
| +void CPUFeatures::InitOnce() {
|
| + CpuInfo::Read();
|
| + CpuInfo::GetCpuModel(hardware_, HARDWARE_LEN);
|
| +#if defined(USING_SIMULATOR)
|
| + integer_division_supported_ = true;
|
| + neon_supported_ = true;
|
| +#else
|
| + ASSERT(CpuInfo::FieldContains("Processor", "ARMv7")); // Implements ARMv7.
|
| + // Has floating point unit.
|
| + ASSERT(CpuInfo::FieldContains("Features", "vfp"));
|
| + // Has integer division.
|
| + if (CpuInfo::FieldContains("Hardware", "QCT APQ8064")) {
|
| + // Special case for Qualcomm Krait CPUs in Nexus 4 and 7.
|
| + integer_division_supported_ = true;
|
| + } else {
|
| + integer_division_supported_ = CpuInfo::FieldContains("Features", "idiva");
|
| + }
|
| + neon_supported_ = CpuInfo::FieldContains("Features", "neon");
|
| +#endif // defined(USING_SIMULATOR)
|
| +#if defined(DEBUG)
|
| + initialized_ = true;
|
| +#endif
|
| +}
|
| +
|
| +
|
| } // namespace dart
|
|
|
| #endif // defined TARGET_ARCH_ARM
|
|
|