Flutter Engine
The Flutter Engine
cpu_ia32.h
Go to the documentation of this 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
3// BSD-style license that can be found in the LICENSE file.
4
5#ifndef RUNTIME_VM_CPU_IA32_H_
6#define RUNTIME_VM_CPU_IA32_H_
7
8#if !defined(RUNTIME_VM_CPU_H_)
9#error Do not include cpu_ia32.h directly; use cpu.h instead.
10#endif
11
12#include "vm/allocation.h"
13#include "vm/flags.h"
14
15namespace dart {
16
17DECLARE_FLAG(bool, use_sse41);
18
19class HostCPUFeatures : public AllStatic {
20 public:
21 static void Init();
22 static void Cleanup();
23 static const char* hardware() {
24 DEBUG_ASSERT(initialized_);
25 return hardware_;
26 }
27 static bool sse2_supported() {
28 DEBUG_ASSERT(initialized_);
29 return sse2_supported_;
30 }
31 static bool sse4_1_supported() {
32 DEBUG_ASSERT(initialized_);
33 return sse4_1_supported_ && FLAG_use_sse41 && !FLAG_target_unknown_cpu;
34 }
35 static bool popcnt_supported() {
36 DEBUG_ASSERT(initialized_);
37 return popcnt_supported_ && !FLAG_target_unknown_cpu;
38 }
39 static bool abm_supported() {
40 DEBUG_ASSERT(initialized_);
41 return abm_supported_ && !FLAG_target_unknown_cpu;
42 }
43
44 private:
45 static const char* hardware_;
46 static bool sse2_supported_;
47 static bool sse4_1_supported_;
48 static bool popcnt_supported_;
49 static bool abm_supported_;
50#if defined(DEBUG)
51 static bool initialized_;
52#endif
53};
54
55class TargetCPUFeatures : public AllStatic {
56 public:
57 static void Init() { HostCPUFeatures::Init(); }
58 static void Cleanup() { HostCPUFeatures::Cleanup(); }
59 static const char* hardware() { return HostCPUFeatures::hardware(); }
65};
66
67} // namespace dart
68
69#endif // RUNTIME_VM_CPU_IA32_H_
#define DEBUG_ASSERT(cond)
Definition: assert.h:321
static bool popcnt_supported()
Definition: cpu_ia32.h:35
static const char * hardware()
Definition: cpu_ia32.h:23
static void Init()
static bool abm_supported()
Definition: cpu_ia32.h:39
static bool sse4_1_supported()
Definition: cpu_ia32.h:31
static bool sse2_supported()
Definition: cpu_ia32.h:27
static void Cleanup()
static bool sse4_1_supported()
Definition: cpu_ia32.h:61
static void Init()
Definition: cpu_ia32.h:57
static bool sse2_supported()
Definition: cpu_ia32.h:60
static bool popcnt_supported()
Definition: cpu_ia32.h:62
static bool double_truncate_round_supported()
Definition: cpu_ia32.h:64
static void Cleanup()
Definition: cpu_ia32.h:58
static const char * hardware()
Definition: cpu_ia32.h:59
static bool abm_supported()
Definition: cpu_ia32.h:63
Definition: dart_vm.cc:33
DECLARE_FLAG(bool, show_invisible_frames)