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

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

Issue 1156053006: - Determine whether the simulator is being used in globals.h (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Address review comments Created 5 years, 6 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/cpu_arm64.cc ('k') | runtime/vm/os_android.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) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, 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 6
7 #if defined(TARGET_ARCH_MIPS) 7 #if defined(TARGET_ARCH_MIPS)
8 8
9 #include "vm/cpu.h" 9 #include "vm/cpu.h"
10 #include "vm/cpuinfo.h" 10 #include "vm/cpuinfo.h"
11 #include "vm/simulator.h" 11 #include "vm/simulator.h"
12 12
13 #if defined(HOST_ARCH_MIPS) 13 #if !defined(USING_SIMULATOR)
14 #include <asm/cachectl.h> /* NOLINT */ 14 #include <asm/cachectl.h> /* NOLINT */
15 #include <sys/syscall.h> /* NOLINT */ 15 #include <sys/syscall.h> /* NOLINT */
16 #include <unistd.h> /* NOLINT */ 16 #include <unistd.h> /* NOLINT */
17 #endif 17 #endif
18 18
19 namespace dart { 19 namespace dart {
20 20
21 void CPU::FlushICache(uword start, uword size) { 21 void CPU::FlushICache(uword start, uword size) {
22 #if defined(HOST_ARCH_MIPS) 22 #if !defined(USING_SIMULATOR)
23 int res; 23 int res;
24 // See http://www.linux-mips.org/wiki/Cacheflush_Syscall. 24 // See http://www.linux-mips.org/wiki/Cacheflush_Syscall.
25 res = syscall(__NR_cacheflush, start, size, ICACHE); 25 res = syscall(__NR_cacheflush, start, size, ICACHE);
26 ASSERT(res == 0); 26 ASSERT(res == 0);
27 #else // defined(HOST_ARCH_MIPS) 27 #else // defined(HOST_ARCH_MIPS)
28 // When running in simulated mode we do not need to flush the ICache because 28 // When running in simulated mode we do not need to flush the ICache because
29 // we are not running on the actual hardware. 29 // we are not running on the actual hardware.
30 #endif // defined(HOST_ARCH_MIPS) 30 #endif // defined(HOST_ARCH_MIPS)
31 } 31 }
32 32
33 33
34 const char* CPU::Id() { 34 const char* CPU::Id() {
35 return 35 return
36 #if !defined(HOST_ARCH_MIPS) 36 #if defined(USING_SIMULATOR)
37 "sim" 37 "sim"
38 #endif // !defined(HOST_ARCH_MIPS) 38 #endif // !defined(HOST_ARCH_MIPS)
39 "mips"; 39 "mips";
40 } 40 }
41 41
42 42
43 const char* HostCPUFeatures::hardware_ = NULL; 43 const char* HostCPUFeatures::hardware_ = NULL;
44 MIPSVersion HostCPUFeatures::mips_version_ = MIPSvUnknown; 44 MIPSVersion HostCPUFeatures::mips_version_ = MIPSvUnknown;
45 #if defined(DEBUG) 45 #if defined(DEBUG)
46 bool HostCPUFeatures::initialized_ = false; 46 bool HostCPUFeatures::initialized_ = false;
47 #endif 47 #endif
48 48
49 49
50 #if defined(HOST_ARCH_MIPS) 50 #if !defined(USING_SIMULATOR)
51 void HostCPUFeatures::InitOnce() { 51 void HostCPUFeatures::InitOnce() {
52 CpuInfo::InitOnce(); 52 CpuInfo::InitOnce();
53 hardware_ = CpuInfo::GetCpuModel(); 53 hardware_ = CpuInfo::GetCpuModel();
54 // Has a floating point unit. 54 // Has a floating point unit.
55 ASSERT(CpuInfo::FieldContains(kCpuInfoModel, "FPU")); 55 ASSERT(CpuInfo::FieldContains(kCpuInfoModel, "FPU"));
56 56
57 // We want to know the ISA version, but on MIPS, CpuInfo can't tell us, so 57 // We want to know the ISA version, but on MIPS, CpuInfo can't tell us, so
58 // we use the same ISA version that Dart's C++ compiler targeted. 58 // we use the same ISA version that Dart's C++ compiler targeted.
59 #if defined(_MIPS_ARCH_MIPS32R2) 59 #if defined(_MIPS_ARCH_MIPS32R2)
60 mips_version_ = MIPS32r2; 60 mips_version_ = MIPS32r2;
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 ASSERT(hardware_ != NULL); 99 ASSERT(hardware_ != NULL);
100 free(const_cast<char*>(hardware_)); 100 free(const_cast<char*>(hardware_));
101 hardware_ = NULL; 101 hardware_ = NULL;
102 CpuInfo::Cleanup(); 102 CpuInfo::Cleanup();
103 } 103 }
104 #endif // defined(HOST_ARCH_MIPS) 104 #endif // defined(HOST_ARCH_MIPS)
105 105
106 } // namespace dart 106 } // namespace dart
107 107
108 #endif // defined TARGET_ARCH_MIPS 108 #endif // defined TARGET_ARCH_MIPS
OLDNEW
« no previous file with comments | « runtime/vm/cpu_arm64.cc ('k') | runtime/vm/os_android.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698