OLD | NEW |
---|---|
1 // Copyright 2006-2013 the V8 project authors. All rights reserved. | 1 // Copyright 2006-2013 the V8 project authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // This module contains the architecture-specific code. This make the rest of | 5 // This module contains the architecture-specific code. This make the rest of |
6 // the code less dependent on differences between different processor | 6 // the code less dependent on differences between different processor |
7 // architecture. | 7 // architecture. |
8 // The classes have the same definition for all architectures. The | 8 // The classes have the same definition for all architectures. The |
9 // implementation for a particular architecture is put in cpu_<arch>.cc. | 9 // implementation for a particular architecture is put in cpu_<arch>.cc. |
10 // The build system then uses the implementation for the target architecture. | 10 // The build system then uses the implementation for the target architecture. |
11 // | 11 // |
12 | 12 |
13 #ifndef V8_CPU_H_ | 13 #ifndef V8_BASE_CPU_H_ |
14 #define V8_CPU_H_ | 14 #define V8_BASE_CPU_H_ |
15 | 15 |
16 #include "src/allocation.h" | 16 #include "src/base/macros.h" |
17 | 17 |
18 namespace v8 { | 18 namespace v8 { |
19 namespace internal { | 19 namespace base { |
20 | 20 |
21 // ---------------------------------------------------------------------------- | 21 // ---------------------------------------------------------------------------- |
22 // CPU | 22 // CPU |
23 // | 23 // |
24 // Query information about the processor. | 24 // Query information about the processor. |
25 // | 25 // |
26 // This class also has static methods for the architecture specific functions. | 26 // This class also has static methods for the architecture specific functions. |
27 // Add methods here to cope with differences between the supported | 27 // Add methods here to cope with differences between the supported |
28 // architectures. For each architecture the file cpu_<arch>.cc contains the | 28 // architectures. For each architecture the file cpu_<arch>.cc contains the |
29 // implementation of these static functions. | 29 // implementation of these static functions. |
30 | 30 |
31 class CPU V8_FINAL BASE_EMBEDDED { | 31 class CPU V8_FINAL { |
32 public: | 32 public: |
33 CPU(); | 33 CPU(); |
34 | 34 |
35 // x86 CPUID information | 35 // x86 CPUID information |
36 const char* vendor() const { return vendor_; } | 36 const char* vendor() const { return vendor_; } |
37 int stepping() const { return stepping_; } | 37 int stepping() const { return stepping_; } |
38 int model() const { return model_; } | 38 int model() const { return model_; } |
39 int ext_model() const { return ext_model_; } | 39 int ext_model() const { return ext_model_; } |
40 int family() const { return family_; } | 40 int family() const { return family_; } |
41 int ext_family() const { return ext_family_; } | 41 int ext_family() const { return ext_family_; } |
42 int type() const { return type_; } | 42 int type() const { return type_; } |
43 | 43 |
44 // arm implementer/part information | 44 // arm implementer/part information |
45 int implementer() const { return implementer_; } | 45 int implementer() const { return implementer_; } |
46 static const int ARM = 0x41; | 46 static const int ARM = 0x41; |
tfarina
2014/07/01 15:58:30
we could group these 'static const' before the cto
| |
47 static const int NVIDIA = 0x4e; | 47 static const int NVIDIA = 0x4e; |
48 static const int QUALCOMM = 0x51; | 48 static const int QUALCOMM = 0x51; |
49 int architecture() const { return architecture_; } | 49 int architecture() const { return architecture_; } |
50 int part() const { return part_; } | 50 int part() const { return part_; } |
51 static const int ARM_CORTEX_A5 = 0xc05; | 51 static const int ARM_CORTEX_A5 = 0xc05; |
52 static const int ARM_CORTEX_A7 = 0xc07; | 52 static const int ARM_CORTEX_A7 = 0xc07; |
53 static const int ARM_CORTEX_A8 = 0xc08; | 53 static const int ARM_CORTEX_A8 = 0xc08; |
54 static const int ARM_CORTEX_A9 = 0xc09; | 54 static const int ARM_CORTEX_A9 = 0xc09; |
55 static const int ARM_CORTEX_A12 = 0xc0c; | 55 static const int ARM_CORTEX_A12 = 0xc0c; |
56 static const int ARM_CORTEX_A15 = 0xc0f; | 56 static const int ARM_CORTEX_A15 = 0xc0f; |
(...skipping 13 matching lines...) Expand all Loading... | |
70 bool has_sse42() const { return has_sse42_; } | 70 bool has_sse42() const { return has_sse42_; } |
71 | 71 |
72 // arm features | 72 // arm features |
73 bool has_idiva() const { return has_idiva_; } | 73 bool has_idiva() const { return has_idiva_; } |
74 bool has_neon() const { return has_neon_; } | 74 bool has_neon() const { return has_neon_; } |
75 bool has_thumb2() const { return has_thumb2_; } | 75 bool has_thumb2() const { return has_thumb2_; } |
76 bool has_vfp() const { return has_vfp_; } | 76 bool has_vfp() const { return has_vfp_; } |
77 bool has_vfp3() const { return has_vfp3_; } | 77 bool has_vfp3() const { return has_vfp3_; } |
78 bool has_vfp3_d32() const { return has_vfp3_d32_; } | 78 bool has_vfp3_d32() const { return has_vfp3_d32_; } |
79 | 79 |
80 // Flush instruction cache. | |
81 static void FlushICache(void* start, size_t size); | |
82 | |
83 private: | 80 private: |
84 char vendor_[13]; | 81 char vendor_[13]; |
85 int stepping_; | 82 int stepping_; |
86 int model_; | 83 int model_; |
87 int ext_model_; | 84 int ext_model_; |
88 int family_; | 85 int family_; |
89 int ext_family_; | 86 int ext_family_; |
90 int type_; | 87 int type_; |
91 int implementer_; | 88 int implementer_; |
92 int architecture_; | 89 int architecture_; |
93 int part_; | 90 int part_; |
94 bool has_fpu_; | 91 bool has_fpu_; |
95 bool has_cmov_; | 92 bool has_cmov_; |
96 bool has_sahf_; | 93 bool has_sahf_; |
97 bool has_mmx_; | 94 bool has_mmx_; |
98 bool has_sse_; | 95 bool has_sse_; |
99 bool has_sse2_; | 96 bool has_sse2_; |
100 bool has_sse3_; | 97 bool has_sse3_; |
101 bool has_ssse3_; | 98 bool has_ssse3_; |
102 bool has_sse41_; | 99 bool has_sse41_; |
103 bool has_sse42_; | 100 bool has_sse42_; |
104 bool has_idiva_; | 101 bool has_idiva_; |
105 bool has_neon_; | 102 bool has_neon_; |
106 bool has_thumb2_; | 103 bool has_thumb2_; |
107 bool has_vfp_; | 104 bool has_vfp_; |
108 bool has_vfp3_; | 105 bool has_vfp3_; |
109 bool has_vfp3_d32_; | 106 bool has_vfp3_d32_; |
110 }; | 107 }; |
111 | 108 |
112 } } // namespace v8::internal | 109 } } // namespace v8::base |
113 | 110 |
114 #endif // V8_CPU_H_ | 111 #endif // V8_BASE_CPU_H_ |
OLD | NEW |