Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(81)

Side by Side Diff: runtime/vm/cpuinfo_fuchsia.cc

Issue 2148533002: Fuchsia: Platform specific calls needed to Initialize and Cleanup VM. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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 #include "vm/globals.h" 5 #include "vm/globals.h"
6 #if defined(TARGET_OS_FUCHSIA) 6 #if defined(TARGET_OS_FUCHSIA)
7 7
8 #include "vm/cpuinfo.h" 8 #include "vm/cpuinfo.h"
9 9
10 #include "platform/assert.h" 10 #include "platform/assert.h"
11 11 #include "vm/cpuid.h"
12 // TODO(zra): Use "vm/cpuid.h"
13 12
14 namespace dart { 13 namespace dart {
15 14
16 CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault; 15 CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
17 const char* CpuInfo::fields_[kCpuInfoMax] = {0}; 16 const char* CpuInfo::fields_[kCpuInfoMax] = {0};
18 17
19 void CpuInfo::InitOnce() { 18 void CpuInfo::InitOnce() {
20 UNIMPLEMENTED(); 19 method_ = kCpuInfoCpuId;
20
21 // Initialize the CpuId information.
22 CpuId::InitOnce();
23
24 fields_[kCpuInfoProcessor] = "Processor";
25 fields_[kCpuInfoModel] = "Hardware";
26 fields_[kCpuInfoHardware] = "Hardware";
27 fields_[kCpuInfoFeatures] = "Features";
21 } 28 }
22 29
23 30
24 void CpuInfo::Cleanup() { 31 void CpuInfo::Cleanup() {
25 UNIMPLEMENTED(); 32 CpuId::Cleanup();
26 } 33 }
27 34
28 35
29 bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { 36 bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) {
30 UNIMPLEMENTED(); 37 ASSERT(method_ != kCpuInfoDefault);
31 return false; 38 return strstr(CpuId::field(idx), search_string);
32 } 39 }
33 40
34 41
35 const char* CpuInfo::ExtractField(CpuInfoIndices idx) { 42 const char* CpuInfo::ExtractField(CpuInfoIndices idx) {
36 UNIMPLEMENTED(); 43 ASSERT(method_ != kCpuInfoDefault);
37 return "<undefined>"; 44 return CpuId::field(idx);
38 } 45 }
39 46
40 47
41 bool CpuInfo::HasField(const char* field) { 48 bool CpuInfo::HasField(const char* field) {
42 UNIMPLEMENTED(); 49 ASSERT(method_ != kCpuInfoDefault);
43 return false; 50 return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) ||
51 (strcmp(field, fields_[kCpuInfoModel]) == 0) ||
52 (strcmp(field, fields_[kCpuInfoHardware]) == 0) ||
53 (strcmp(field, fields_[kCpuInfoFeatures]) == 0);
44 } 54 }
45 55
46 } // namespace dart 56 } // namespace dart
47 57
48 #endif // defined(TARGET_OS_FUCHSIA) 58 #endif // defined(TARGET_OS_FUCHSIA)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698