File tree 3 files changed +50
-6
lines changed 3 files changed +50
-6
lines changed Original file line number Diff line number Diff line change 6
6
#if defined(TARGET_ARCH_DBC)
7
7
8
8
#include " vm/cpu.h"
9
+ #include " vm/cpu_dbc.h"
9
10
11
+ #include " vm/cpuinfo.h"
10
12
11
13
namespace dart {
12
14
13
-
14
15
void CPU::FlushICache (uword start, uword size) {
15
16
// Nothing to do.
16
17
}
@@ -21,6 +22,31 @@ const char* CPU::Id() {
21
22
}
22
23
23
24
25
+ const char * HostCPUFeatures::hardware_ = NULL ;
26
+ #if defined(DEBUG)
27
+ bool HostCPUFeatures::initialized_ = false ;
28
+ #endif
29
+
30
+ void HostCPUFeatures::InitOnce () {
31
+ CpuInfo::InitOnce ();
32
+ hardware_ = CpuInfo::GetCpuModel ();
33
+ #if defined(DEBUG)
34
+ initialized_ = true ;
35
+ #endif
36
+ }
37
+
38
+
39
+ void HostCPUFeatures::Cleanup () {
40
+ DEBUG_ASSERT (initialized_);
41
+ #if defined(DEBUG)
42
+ initialized_ = false ;
43
+ #endif
44
+ ASSERT (hardware_ != NULL );
45
+ free (const_cast <char *>(hardware_));
46
+ hardware_ = NULL ;
47
+ CpuInfo::Cleanup ();
48
+ }
49
+
24
50
} // namespace dart
25
51
26
52
#endif // defined TARGET_ARCH_DBC
Original file line number Diff line number Diff line change @@ -12,13 +12,33 @@ namespace dart {
12
12
13
13
class HostCPUFeatures : public AllStatic {
14
14
public:
15
- static const char * hardware () { return " simdbc" ; }
15
+ static void InitOnce ();
16
+ static void Cleanup ();
17
+
18
+ static const char * hardware () {
19
+ DEBUG_ASSERT (initialized_);
20
+ return hardware_;
21
+ }
22
+
23
+ private:
24
+ static const char * hardware_;
25
+ #if defined(DEBUG)
26
+ static bool initialized_;
27
+ #endif
16
28
};
17
29
18
30
class TargetCPUFeatures : public AllStatic {
19
31
public:
20
- static void InitOnce () {}
21
- static void Cleanup () {}
32
+ static void InitOnce () {
33
+ HostCPUFeatures::InitOnce ();
34
+ }
35
+ static void Cleanup () {
36
+ HostCPUFeatures::Cleanup ();
37
+ }
38
+
39
+ static const char * hardware () {
40
+ return CPU::Id ();
41
+ }
22
42
23
43
static bool double_truncate_round_supported () {
24
44
return true ;
Original file line number Diff line number Diff line change 9
9
10
10
namespace dart {
11
11
12
- #if !defined(TARGET_ARCH_DBC)
13
12
UNIT_TEST_CASE (GetCpuModelTest) {
14
13
const char * cpumodel = CpuInfo::GetCpuModel ();
15
14
EXPECT_NE (strlen (cpumodel), 0UL );
16
15
// caller is responsible for deleting the returned cpumodel string.
17
16
free (const_cast <char *>(cpumodel));
18
17
}
19
- #endif
20
18
21
19
} // namespace dart
You can’t perform that action at this time.
0 commit comments