Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
cpu_arm64.h
Go to the documentation of this 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
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_CPU_ARM64_H_
6#define RUNTIME_VM_CPU_ARM64_H_
7
8#if !defined(RUNTIME_VM_CPU_H_)
9#error Do not include cpu_arm64.h directly; use cpu.h instead.
10#endif
11
12#include "vm/allocation.h"
13#include "vm/flags.h"
14#include "vm/simulator.h"
15
16namespace dart {
17
18// TargetCPUFeatures gives CPU features for the architecture that we are
19// generating code for. HostCPUFeatures gives the CPU features for the
20// architecture that we are actually running on. When the architectures
21// are the same, TargetCPUFeatures will query HostCPUFeatures. When they are
22// different (i.e. we are running in a simulator), HostCPUFeatures will
23// additionally mock the options needed for the target architecture so that
24// they may be altered for testing.
25
26class HostCPUFeatures : public AllStatic {
27 public:
28 static void Init();
29 static void Cleanup();
30 static const char* hardware() {
31 DEBUG_ASSERT(initialized_);
32 return hardware_;
33 }
34
35 private:
36 static const char* hardware_;
37#if defined(DEBUG)
38 static bool initialized_;
39#endif
40};
41
42class TargetCPUFeatures : public AllStatic {
43 public:
44 static void Init() { HostCPUFeatures::Init(); }
45 static void Cleanup() { HostCPUFeatures::Cleanup(); }
46 static const char* hardware() { return HostCPUFeatures::hardware(); }
47 static bool double_truncate_round_supported() { return false; }
49#if defined(DART_TARGET_OS_MACOS) && !defined(DART_TARGET_OS_MACOS_IOS)
50 return true; // Mac ARM64 starts at ARMv8.5.
51#else
52 return false; // All else start at ARMv8.0.
53#endif
54 }
55};
56
57} // namespace dart
58
59#endif // RUNTIME_VM_CPU_ARM64_H_
#define DEBUG_ASSERT(cond)
Definition assert.h:321
static const char * hardware()
Definition cpu_arm64.h:30
static void Init()
static void Cleanup()
static bool atomic_memory_supported()
Definition cpu_arm64.h:48
static void Init()
Definition cpu_arm64.h:44
static bool double_truncate_round_supported()
Definition cpu_arm64.h:47
static void Cleanup()
Definition cpu_arm64.h:45
static const char * hardware()
Definition cpu_arm64.h:46