Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
cpu_ia32.cc
Go to the documentation of this file.
1// Copyright (c) 2011, 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#include "vm/globals.h"
6#if defined(TARGET_ARCH_IA32)
7
8#include "vm/cpu.h"
9#include "vm/cpu_ia32.h"
10
11#include "vm/cpuinfo.h"
12
13namespace dart {
14
15DEFINE_FLAG(bool, use_sse41, true, "Use SSE 4.1 if available");
16
18 // Nothing to be done here.
19}
20
21const char* CPU::Id() {
22 return
23#if defined(USING_SIMULATOR)
24 "sim"
25#endif // !defined(USING_SIMULATOR)
26 "ia32";
27}
28
29const char* HostCPUFeatures::hardware_ = nullptr;
30bool HostCPUFeatures::sse2_supported_ = false;
31bool HostCPUFeatures::sse4_1_supported_ = false;
32bool HostCPUFeatures::popcnt_supported_ = false;
33bool HostCPUFeatures::abm_supported_ = false;
34#if defined(DEBUG)
35bool HostCPUFeatures::initialized_ = false;
36#endif
37
40 hardware_ = CpuInfo::GetCpuModel();
41 sse2_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse2");
42 sse4_1_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "sse4_1") ||
44 popcnt_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "popcnt");
45 abm_supported_ = CpuInfo::FieldContains(kCpuInfoFeatures, "abm");
46#if defined(DEBUG)
47 initialized_ = true;
48#endif
49}
50
52 DEBUG_ASSERT(initialized_);
53#if defined(DEBUG)
54 initialized_ = false;
55#endif
56 ASSERT(hardware_ != nullptr);
57 free(const_cast<char*>(hardware_));
58 hardware_ = nullptr;
60}
61
62} // namespace dart
63
64#endif // defined TARGET_ARCH_IA32
#define DEBUG_ASSERT(cond)
Definition assert.h:321
static const char * Id()
static void FlushICache(uword start, uword size)
static void Init()
static const char * GetCpuModel()
Definition cpuinfo.h:59
static void Cleanup()
static bool FieldContains(CpuInfoIndices idx, const char *search_string)
static void Init()
static void Cleanup()
#define ASSERT(E)
#define DEFINE_FLAG(type, name, default_value, comment)
Definition flags.h:16
@ kCpuInfoFeatures
Definition cpuinfo.h:19
uintptr_t uword
Definition globals.h:501