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

Issue 120723003: Refactors CPU feature detection. (Closed)

Created:
6 years, 12 months ago by zra
Modified:
6 years, 10 months ago
Reviewers:
Cutch, siva, Ivan Posva
CC:
reviews_dartlang.org, vm-dev_dartlang.org
Visibility:
Public.

Description

Refactors some CPU feature detection into new class CpuInfo, and uses new information in VM service. This change rewrites the code from the ARM assembler for parsing /proc/cpuinfo on Linux and Android, and collects it into a CpuInfo class that can be used for other architectures as well. This code is in cpuinfo_*.cc. /proc/cpuinfo equivalents are used for Mac and Windows. CpuInfo is used by the VM service to report on the hardware dart is running on. In the future CpuInfo can also be used here to provide more information. R=iposva@google.com, johnmccutchan@google.com Committed: https://code.google.com/p/dart/source/detail?r=32468

Patch Set 1 #

Patch Set 2 : #

Patch Set 3 : #

Patch Set 4 : #

Patch Set 5 : #

Patch Set 6 : #

Patch Set 7 : #

Patch Set 8 : #

Patch Set 9 : Adds windows GetCpuModel #

Patch Set 10 : Windows fixes #

Patch Set 11 : Cleanup #

Total comments: 6

Patch Set 12 : Refactored #

Patch Set 13 : Fixes for Mac #

Patch Set 14 : Fixes for Mac #

Patch Set 15 : Fixes for Windows #

Patch Set 16 : Fixed cpu service field names. #

Total comments: 6

Patch Set 17 : Updates #

Patch Set 18 : #

Patch Set 19 : #

Total comments: 2
Unified diffs Side-by-side diffs Delta from patch set Stats (+1128 lines, -344 lines) Patch
M runtime/vm/assembler_arm.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +0 lines, -20 lines 0 comments Download
M runtime/vm/assembler_arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 4 chunks +3 lines, -93 lines 0 comments Download
M runtime/vm/assembler_arm_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 57 chunks +61 lines, -60 lines 0 comments Download
M runtime/vm/assembler_ia32.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +0 lines, -19 lines 0 comments Download
M runtime/vm/assembler_ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 6 chunks +5 lines, -57 lines 0 comments Download
M runtime/vm/assembler_ia32_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 9 chunks +9 lines, -8 lines 0 comments Download
M runtime/vm/assembler_mips.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +0 lines, -9 lines 0 comments Download
M runtime/vm/assembler_mips_test.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +1 line, -0 lines 0 comments Download
M runtime/vm/assembler_x64.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +0 lines, -18 lines 0 comments Download
M runtime/vm/assembler_x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +1 line, -47 lines 0 comments Download
M runtime/vm/cpu.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +13 lines, -0 lines 0 comments Download
A runtime/vm/cpu_arm.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +76 lines, -0 lines 0 comments Download
M runtime/vm/cpu_arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +51 lines, -2 lines 0 comments Download
A runtime/vm/cpu_ia32.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +61 lines, -0 lines 0 comments Download
M runtime/vm/cpu_ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +32 lines, -1 line 0 comments Download
A runtime/vm/cpu_mips.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +43 lines, -0 lines 0 comments Download
M runtime/vm/cpu_mips.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +33 lines, -2 lines 0 comments Download
A runtime/vm/cpu_x64.h View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +61 lines, -0 lines 0 comments Download
M runtime/vm/cpu_x64.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +28 lines, -0 lines 0 comments Download
A runtime/vm/cpuinfo.h View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +69 lines, -0 lines 0 comments Download
A runtime/vm/cpuinfo_android.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +169 lines, -0 lines 0 comments Download
A runtime/vm/cpuinfo_linux.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +169 lines, -0 lines 2 comments Download
A runtime/vm/cpuinfo_macos.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +77 lines, -0 lines 0 comments Download
A runtime/vm/cpuinfo_test.cc View 1 2 3 4 5 6 7 8 9 10 11 1 chunk +19 lines, -0 lines 0 comments Download
A runtime/vm/cpuinfo_win.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 1 chunk +115 lines, -0 lines 0 comments Download
M runtime/vm/dart.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +3 lines, -2 lines 0 comments Download
M runtime/vm/flow_graph_compiler_arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 3 chunks +5 lines, -2 lines 0 comments Download
M runtime/vm/flow_graph_compiler_ia32.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +2 lines, -1 line 0 comments Download
M runtime/vm/flow_graph_optimizer.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +2 lines, -1 line 0 comments Download
M runtime/vm/intermediate_language.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +2 lines, -1 line 0 comments Download
M runtime/vm/service.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +10 lines, -0 lines 0 comments Download
M runtime/vm/simulator_arm.cc View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 2 chunks +2 lines, -1 line 0 comments Download
M runtime/vm/vm_sources.gypi View 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 1 chunk +6 lines, -0 lines 0 comments Download

Messages

Total messages: 11 (0 generated)
zra
6 years, 11 months ago (2013-12-30 23:12:01 UTC) #1
Cutch
https://codereview.chromium.org/120723003/diff/1190001/runtime/vm/cpu_ia32.h File runtime/vm/cpu_ia32.h (right): https://codereview.chromium.org/120723003/diff/1190001/runtime/vm/cpu_ia32.h#newcode22 runtime/vm/cpu_ia32.h:22: static const uint64_t kSSE2BitMask = static_cast<uint64_t>(1) << 26; Should ...
6 years, 11 months ago (2014-01-02 19:39:18 UTC) #2
zra
PTAL Reorganized following discussion with Ivan. Aside from the reorg, this also uses __cpuid on ...
6 years, 11 months ago (2014-01-13 21:57:18 UTC) #3
Cutch
https://codereview.chromium.org/120723003/diff/1700001/runtime/vm/cpuinfo_macos.cc File runtime/vm/cpuinfo_macos.cc (right): https://codereview.chromium.org/120723003/diff/1700001/runtime/vm/cpuinfo_macos.cc#newcode69 runtime/vm/cpuinfo_macos.cc:69: "machdep.cpu.brand_string", Wouldn't it be better if the field names ...
6 years, 11 months ago (2014-01-15 20:50:48 UTC) #4
Cutch
lgtm
6 years, 11 months ago (2014-01-15 21:30:48 UTC) #5
Ivan Posva
https://codereview.chromium.org/120723003/diff/1700001/runtime/vm/cpu_mips.h File runtime/vm/cpu_mips.h (right): https://codereview.chromium.org/120723003/diff/1700001/runtime/vm/cpu_mips.h#newcode12 runtime/vm/cpu_mips.h:12: class HostCPUFeatures: public AllStatic { Don't you support the ...
6 years, 11 months ago (2014-01-21 21:41:02 UTC) #6
zra
https://codereview.chromium.org/120723003/diff/1700001/runtime/vm/cpu_mips.h File runtime/vm/cpu_mips.h (right): https://codereview.chromium.org/120723003/diff/1700001/runtime/vm/cpu_mips.h#newcode12 runtime/vm/cpu_mips.h:12: class HostCPUFeatures: public AllStatic { On 2014/01/21 21:41:02, Ivan ...
6 years, 11 months ago (2014-01-24 21:18:27 UTC) #7
Ivan Posva
LGTM -ip
6 years, 10 months ago (2014-02-06 00:41:54 UTC) #8
zra
Committed patchset #19 manually as r32468 (presubmit successful).
6 years, 10 months ago (2014-02-08 22:27:41 UTC) #9
siva
https://codereview.chromium.org/120723003/diff/2240001/runtime/vm/cpuinfo_linux.cc File runtime/vm/cpuinfo_linux.cc (right): https://codereview.chromium.org/120723003/diff/2240001/runtime/vm/cpuinfo_linux.cc#newcode42 runtime/vm/cpuinfo_linux.cc:42: fp = fopen(PATHNAME, "r"); We need to rethink this ...
6 years, 10 months ago (2014-02-11 01:13:22 UTC) #10
zra
6 years, 10 months ago (2014-02-11 02:57:47 UTC) #11
Message was sent while issue was closed.
https://codereview.chromium.org/120723003/diff/2240001/runtime/vm/cpuinfo_lin...
File runtime/vm/cpuinfo_linux.cc (right):

https://codereview.chromium.org/120723003/diff/2240001/runtime/vm/cpuinfo_lin...
runtime/vm/cpuinfo_linux.cc:42: fp = fopen(PATHNAME, "r");
We can revert ia32 and x64 to assemble and run the cpuinfo instruction, but the
analogous instruction is privileged on ARM and MIPS, so reading /proc/cpuinfo is
the only way on Linux and Android to find out what CPU we're running on. Is
there some other way to read files in Dartium?

On 2014/02/11 01:13:22, siva wrote:
> We need to rethink this CL.
> 
> The renderer process in chrome is not going to allow reading of files like
this.
> 
> 
> The current assertion that we are hitting in Dartium with debug builds is
> because the fields are not initialized and HasField returns false resulting in
> the assertion
> HasField(FieldName(kCpuInfoModel)) being triggered.

Powered by Google App Engine
This is Rietveld 408576698