V8 Project
cpu.h
Go to the documentation of this file.
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
3
// found in the LICENSE file.
4
5
// This module contains the architecture-specific code. This make the rest of
6
// the code less dependent on differences between different processor
7
// architecture.
8
// The classes have the same definition for all architectures. The
9
// implementation for a particular architecture is put in cpu_<arch>.cc.
10
// The build system then uses the implementation for the target architecture.
11
//
12
13
#ifndef V8_BASE_CPU_H_
14
#define V8_BASE_CPU_H_
15
16
#include "
src/base/macros.h
"
17
18
namespace
v8
{
19
namespace
base {
20
21
// ----------------------------------------------------------------------------
22
// CPU
23
//
24
// Query information about the processor.
25
//
26
// This class also has static methods for the architecture specific functions.
27
// Add methods here to cope with differences between the supported
28
// architectures. For each architecture the file cpu_<arch>.cc contains the
29
// implementation of these static functions.
30
31
class
CPU
FINAL
{
32
public
:
33
CPU
();
34
35
// x86 CPUID information
36
const
char
*
vendor
()
const
{
return
vendor_; }
37
int
stepping
()
const
{
return
stepping_; }
38
int
model
()
const
{
return
model_; }
39
int
ext_model
()
const
{
return
ext_model_; }
40
int
family
()
const
{
return
family_; }
41
int
ext_family
()
const
{
return
ext_family_; }
42
int
type
()
const
{
return
type_; }
43
44
// arm implementer/part information
45
int
implementer
()
const
{
return
implementer_; }
46
static
const
int
ARM = 0x41;
47
static
const
int
NVIDIA = 0x4e;
48
static
const
int
QUALCOMM = 0x51;
49
int
architecture
()
const
{
return
architecture_; }
50
int
part
()
const
{
return
part_; }
51
static
const
int
ARM_CORTEX_A5 = 0xc05;
52
static
const
int
ARM_CORTEX_A7 = 0xc07;
53
static
const
int
ARM_CORTEX_A8 = 0xc08;
54
static
const
int
ARM_CORTEX_A9 = 0xc09;
55
static
const
int
ARM_CORTEX_A12 = 0xc0c;
56
static
const
int
ARM_CORTEX_A15 = 0xc0f;
57
58
// General features
59
bool
has_fpu
()
const
{
return
has_fpu_; }
60
61
// x86 features
62
bool
has_cmov
()
const
{
return
has_cmov_; }
63
bool
has_sahf
()
const
{
return
has_sahf_; }
64
bool
has_mmx
()
const
{
return
has_mmx_; }
65
bool
has_sse
()
const
{
return
has_sse_; }
66
bool
has_sse2
()
const
{
return
has_sse2_; }
67
bool
has_sse3
()
const
{
return
has_sse3_; }
68
bool
has_ssse3
()
const
{
return
has_ssse3_; }
69
bool
has_sse41
()
const
{
return
has_sse41_; }
70
bool
has_sse42
()
const
{
return
has_sse42_; }
71
72
// arm features
73
bool
has_idiva
()
const
{
return
has_idiva_; }
74
bool
has_neon
()
const
{
return
has_neon_; }
75
bool
has_thumb2
()
const
{
return
has_thumb2_; }
76
bool
has_vfp
()
const
{
return
has_vfp_; }
77
bool
has_vfp3
()
const
{
return
has_vfp3_; }
78
bool
has_vfp3_d32
()
const
{
return
has_vfp3_d32_; }
79
80
// mips features
81
bool
is_fp64_mode
()
const
{
return
is_fp64_mode_; }
82
83
private
:
84
char
vendor_[13];
85
int
stepping_
;
86
int
model_
;
87
int
ext_model_
;
88
int
family_
;
89
int
ext_family_
;
90
int
type_
;
91
int
implementer_
;
92
int
architecture_
;
93
int
part_
;
94
bool
has_fpu_
;
95
bool
has_cmov_
;
96
bool
has_sahf_
;
97
bool
has_mmx_
;
98
bool
has_sse_
;
99
bool
has_sse2_
;
100
bool
has_sse3_
;
101
bool
has_ssse3_
;
102
bool
has_sse41_
;
103
bool
has_sse42_
;
104
bool
has_idiva_
;
105
bool
has_neon_
;
106
bool
has_thumb2_
;
107
bool
has_vfp_
;
108
bool
has_vfp3_
;
109
bool
has_vfp3_d32_
;
110
bool
is_fp64_mode_
;
111
};
112
113
} }
// namespace v8::base
114
115
#endif
// V8_BASE_CPU_H_
v8::base::FINAL
Definition:
cpu.h:31
v8::base::FINAL::stepping_
int stepping_
Definition:
cpu.h:85
v8::base::FINAL::part_
int part_
Definition:
cpu.h:93
v8::base::FINAL::has_mmx_
bool has_mmx_
Definition:
cpu.h:97
v8::base::FINAL::part
int part() const
Definition:
cpu.h:50
v8::base::FINAL::has_sahf
bool has_sahf() const
Definition:
cpu.h:63
v8::base::FINAL::has_cmov_
bool has_cmov_
Definition:
cpu.h:95
v8::base::FINAL::model
int model() const
Definition:
cpu.h:38
v8::base::FINAL::has_thumb2_
bool has_thumb2_
Definition:
cpu.h:106
v8::base::FINAL::ext_family
int ext_family() const
Definition:
cpu.h:41
v8::base::FINAL::has_idiva
bool has_idiva() const
Definition:
cpu.h:73
v8::base::FINAL::implementer
int implementer() const
Definition:
cpu.h:45
v8::base::FINAL::vendor
const char * vendor() const
Definition:
cpu.h:36
v8::base::FINAL::has_sse2
bool has_sse2() const
Definition:
cpu.h:66
v8::base::FINAL::has_neon
bool has_neon() const
Definition:
cpu.h:74
v8::base::FINAL::has_sse42_
bool has_sse42_
Definition:
cpu.h:103
v8::base::FINAL::has_ssse3_
bool has_ssse3_
Definition:
cpu.h:101
v8::base::FINAL::is_fp64_mode
bool is_fp64_mode() const
Definition:
cpu.h:81
v8::base::FINAL::CPU
CPU()
v8::base::FINAL::has_sse41_
bool has_sse41_
Definition:
cpu.h:102
v8::base::FINAL::has_vfp_
bool has_vfp_
Definition:
cpu.h:107
v8::base::FINAL::has_sahf_
bool has_sahf_
Definition:
cpu.h:96
v8::base::FINAL::type
int type() const
Definition:
cpu.h:42
v8::base::FINAL::type_
int type_
Definition:
cpu.h:90
v8::base::FINAL::implementer_
int implementer_
Definition:
cpu.h:91
v8::base::FINAL::has_vfp3_d32_
bool has_vfp3_d32_
Definition:
cpu.h:109
v8::base::FINAL::ext_model_
int ext_model_
Definition:
cpu.h:87
v8::base::FINAL::has_vfp3
bool has_vfp3() const
Definition:
cpu.h:77
v8::base::FINAL::has_fpu_
bool has_fpu_
Definition:
cpu.h:94
v8::base::FINAL::has_vfp
bool has_vfp() const
Definition:
cpu.h:76
v8::base::FINAL::has_idiva_
bool has_idiva_
Definition:
cpu.h:104
v8::base::FINAL::has_cmov
bool has_cmov() const
Definition:
cpu.h:62
v8::base::FINAL::ext_family_
int ext_family_
Definition:
cpu.h:89
v8::base::FINAL::has_sse2_
bool has_sse2_
Definition:
cpu.h:99
v8::base::FINAL::family_
int family_
Definition:
cpu.h:88
v8::base::FINAL::has_sse
bool has_sse() const
Definition:
cpu.h:65
v8::base::FINAL::is_fp64_mode_
bool is_fp64_mode_
Definition:
cpu.h:110
v8::base::FINAL::has_sse3_
bool has_sse3_
Definition:
cpu.h:100
v8::base::FINAL::has_vfp3_d32
bool has_vfp3_d32() const
Definition:
cpu.h:78
v8::base::FINAL::has_vfp3_
bool has_vfp3_
Definition:
cpu.h:108
v8::base::FINAL::has_ssse3
bool has_ssse3() const
Definition:
cpu.h:68
v8::base::FINAL::stepping
int stepping() const
Definition:
cpu.h:37
v8::base::FINAL::has_sse_
bool has_sse_
Definition:
cpu.h:98
v8::base::FINAL::architecture
int architecture() const
Definition:
cpu.h:49
v8::base::FINAL::has_fpu
bool has_fpu() const
Definition:
cpu.h:59
v8::base::FINAL::has_sse42
bool has_sse42() const
Definition:
cpu.h:70
v8::base::FINAL::has_sse3
bool has_sse3() const
Definition:
cpu.h:67
v8::base::FINAL::model_
int model_
Definition:
cpu.h:86
v8::base::FINAL::has_mmx
bool has_mmx() const
Definition:
cpu.h:64
v8::base::FINAL::architecture_
int architecture_
Definition:
cpu.h:92
v8::base::FINAL::has_sse41
bool has_sse41() const
Definition:
cpu.h:69
v8::base::FINAL::family
int family() const
Definition:
cpu.h:40
v8::base::FINAL::ext_model
int ext_model() const
Definition:
cpu.h:39
v8::base::FINAL::has_neon_
bool has_neon_
Definition:
cpu.h:105
v8::base::FINAL::has_thumb2
bool has_thumb2() const
Definition:
cpu.h:75
macros.h
v8
Debugger support for the V8 JavaScript engine.
Definition:
accessors.cc:20
mnt
V8SourceCode
src
base
cpu.h
Generated on Tue Jul 1 2025 02:36:30 for V8 Project by
1.9.1