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

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

Issue 2974233002: VM: Re-format to use at most one newline between functions (Closed)
Patch Set: Rebase and merge Created 3 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
« no previous file with comments | « runtime/vm/cpuinfo_test.cc ('k') | runtime/vm/custom_isolate_test.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS 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 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(HOST_OS_WINDOWS) 6 #if defined(HOST_OS_WINDOWS)
7 7
8 #include "vm/cpuid.h"
8 #include "vm/cpuinfo.h" 9 #include "vm/cpuinfo.h"
9 #include "vm/cpuid.h"
10 10
11 // __cpuid() 11 // __cpuid()
12 #include <intrin.h> // NOLINT 12 #include <intrin.h> // NOLINT
13 #include <string.h> // NOLINT 13 #include <string.h> // NOLINT
14 14
15 #include "platform/assert.h" 15 #include "platform/assert.h"
16 16
17 namespace dart { 17 namespace dart {
18 18
19 CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault; 19 CpuInfoMethod CpuInfo::method_ = kCpuInfoDefault;
20 const char* CpuInfo::fields_[kCpuInfoMax] = {0}; 20 const char* CpuInfo::fields_[kCpuInfoMax] = {0};
21 21
22 void CpuInfo::InitOnce() { 22 void CpuInfo::InitOnce() {
23 method_ = kCpuInfoCpuId; 23 method_ = kCpuInfoCpuId;
24 24
25 // Initialize the CpuId information. 25 // Initialize the CpuId information.
26 CpuId::InitOnce(); 26 CpuId::InitOnce();
27 27
28 fields_[kCpuInfoProcessor] = "Processor"; 28 fields_[kCpuInfoProcessor] = "Processor";
29 fields_[kCpuInfoModel] = "Hardware"; 29 fields_[kCpuInfoModel] = "Hardware";
30 fields_[kCpuInfoHardware] = "Hardware"; 30 fields_[kCpuInfoHardware] = "Hardware";
31 fields_[kCpuInfoFeatures] = "Features"; 31 fields_[kCpuInfoFeatures] = "Features";
32 fields_[kCpuInfoArchitecture] = NULL; 32 fields_[kCpuInfoArchitecture] = NULL;
33 } 33 }
34 34
35
36 void CpuInfo::Cleanup() { 35 void CpuInfo::Cleanup() {
37 CpuId::Cleanup(); 36 CpuId::Cleanup();
38 } 37 }
39 38
40
41 bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) { 39 bool CpuInfo::FieldContains(CpuInfoIndices idx, const char* search_string) {
42 ASSERT(method_ != kCpuInfoDefault); 40 ASSERT(method_ != kCpuInfoDefault);
43 return strstr(CpuId::field(idx), search_string); 41 return strstr(CpuId::field(idx), search_string);
44 } 42 }
45 43
46
47 const char* CpuInfo::ExtractField(CpuInfoIndices idx) { 44 const char* CpuInfo::ExtractField(CpuInfoIndices idx) {
48 ASSERT(method_ != kCpuInfoDefault); 45 ASSERT(method_ != kCpuInfoDefault);
49 return CpuId::field(idx); 46 return CpuId::field(idx);
50 } 47 }
51 48
52
53 bool CpuInfo::HasField(const char* field) { 49 bool CpuInfo::HasField(const char* field) {
54 ASSERT(method_ != kCpuInfoDefault); 50 ASSERT(method_ != kCpuInfoDefault);
55 return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) || 51 return (strcmp(field, fields_[kCpuInfoProcessor]) == 0) ||
56 (strcmp(field, fields_[kCpuInfoModel]) == 0) || 52 (strcmp(field, fields_[kCpuInfoModel]) == 0) ||
57 (strcmp(field, fields_[kCpuInfoHardware]) == 0) || 53 (strcmp(field, fields_[kCpuInfoHardware]) == 0) ||
58 (strcmp(field, fields_[kCpuInfoFeatures]) == 0); 54 (strcmp(field, fields_[kCpuInfoFeatures]) == 0);
59 } 55 }
60 56
61 } // namespace dart 57 } // namespace dart
62 58
63 #endif // defined(HOST_OS_WINDOWS) 59 #endif // defined(HOST_OS_WINDOWS)
OLDNEW
« no previous file with comments | « runtime/vm/cpuinfo_test.cc ('k') | runtime/vm/custom_isolate_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698