Index: src/arm/assembler-arm.h |
diff --git a/src/arm/assembler-arm.h b/src/arm/assembler-arm.h |
index 47dda2aa7224cd6622e997a1621fac6996a4cf2b..8caa64df34c2ce442b4919122c45b531dd06c864 100644 |
--- a/src/arm/assembler-arm.h |
+++ b/src/arm/assembler-arm.h |
@@ -64,23 +64,41 @@ class CpuFeatures : public AllStatic { |
// Check whether a feature is supported by the target CPU. |
static bool IsSupported(CpuFeature f) { |
ASSERT(initialized_); |
- return (supported_ & (1u << f)) != 0; |
+ return Check(f, supported_); |
} |
static bool IsFoundByRuntimeProbingOnly(CpuFeature f) { |
ASSERT(initialized_); |
- return (found_by_runtime_probing_only_ & |
- (static_cast<uint64_t>(1) << f)) != 0; |
+ return Check(f, found_by_runtime_probing_only_); |
} |
static bool IsSafeForSnapshot(CpuFeature f) { |
- return (IsSupported(f) && |
+ return Check(f, cross_compile_) || |
+ (IsSupported(f) && |
(!Serializer::enabled() || !IsFoundByRuntimeProbingOnly(f))); |
} |
static unsigned cache_line_size() { return cache_line_size_; } |
+ static bool VerifyCrossCompiling() { |
+ return cross_compile_ == 0; |
+ } |
+ |
+ static bool VerifyCrossCompiling(CpuFeature f) { |
+ unsigned mask = flag2set(f); |
+ return cross_compile_ == 0 || |
+ (cross_compile_ & mask) == mask; |
+ } |
+ |
private: |
+ static bool Check(CpuFeature f, unsigned set) { |
+ return (set & flag2set(f)) != 0; |
+ } |
+ |
+ static unsigned flag2set(CpuFeature f) { |
+ return 1u << f; |
+ } |
+ |
#ifdef DEBUG |
static bool initialized_; |
#endif |
@@ -88,6 +106,8 @@ class CpuFeatures : public AllStatic { |
static unsigned found_by_runtime_probing_only_; |
static unsigned cache_line_size_; |
+ static unsigned cross_compile_; |
+ |
friend class ExternalReference; |
friend class PlatformFeatureScope; |
DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |