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

Unified 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: Address comments 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/atomic_fuchsia.h ('k') | runtime/vm/os_fuchsia.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/cpuinfo_fuchsia.cc
diff --git a/runtime/vm/cpuinfo_fuchsia.cc b/runtime/vm/cpuinfo_fuchsia.cc
index 04fe196415eb393d4425163c157346e0c0acbe39..ad9e990dd9042fe3da57fbf2f48e603254945321 100644
--- a/runtime/vm/cpuinfo_fuchsia.cc
+++ b/runtime/vm/cpuinfo_fuchsia.cc
@@ -8,8 +8,7 @@
#include "vm/cpuinfo.h"
#include "platform/assert.h"
-
-// TODO(zra): Use "vm/cpuid.h"
+#include "vm/cpuid.h"
namespace dart {
@@ -17,30 +16,55 @@ CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
const char* CpuInfo::fields_[kCpuInfoMax] = {0};
void CpuInfo::InitOnce() {
- UNIMPLEMENTED();
+ // TODO(zra): Add support for HOST_ARCH_ARM64
+#if defined(HOST_ARCH_IA32) || defined(HOST_ARCH_X64)
+ method_ = kCpuInfoCpuId;
+
+ // Initialize the CpuId information.
+ CpuId::InitOnce();
+
+ fields_[kCpuInfoProcessor] = "Processor";
+ fields_[kCpuInfoModel] = "Hardware";
+ fields_[kCpuInfoHardware] = "Hardware";
+ fields_[kCpuInfoFeatures] = "Features";
+#endif
}
void CpuInfo::Cleanup() {
- UNIMPLEMENTED();
+ if (method_ == kCpuInfoCpuId) {
+ CpuId::Cleanup();
+ }
}
bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) {
- UNIMPLEMENTED();
- return false;
+ if (method_ == kCpuInfoCpuId) {
+ return strstr(CpuId::field(idx), search_string);
+ } else {
+ return false;
+ }
}
const char* CpuInfo::ExtractField(CpuInfoIndices idx) {
- UNIMPLEMENTED();
- return "<undefined>";
+ if (method_ == kCpuInfoCpuId) {
+ return CpuId::field(idx);
+ } else {
+ return strdup("");
+ }
}
bool CpuInfo::HasField(const char* field) {
- UNIMPLEMENTED();
- return false;
+ if (method_ == kCpuInfoCpuId) {
+ return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) ||
+ (strcmp(field, fields_[kCpuInfoModel]) == 0) ||
+ (strcmp(field, fields_[kCpuInfoHardware]) == 0) ||
+ (strcmp(field, fields_[kCpuInfoFeatures]) == 0);
+ } else {
+ return false;
+ }
}
} // namespace dart
« no previous file with comments | « runtime/vm/atomic_fuchsia.h ('k') | runtime/vm/os_fuchsia.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698