Index: src/ia32/assembler-ia32.h |
=================================================================== |
--- src/ia32/assembler-ia32.h (revision 3297) |
+++ src/ia32/assembler-ia32.h (working copy) |
@@ -37,6 +37,8 @@ |
#ifndef V8_IA32_ASSEMBLER_IA32_H_ |
#define V8_IA32_ASSEMBLER_IA32_H_ |
+#include "serialize.h" |
+ |
namespace v8 { |
namespace internal { |
@@ -358,15 +360,11 @@ |
// } |
class CpuFeatures : public AllStatic { |
public: |
- // Feature flags bit positions. They are mostly based on the CPUID spec. |
- // (We assign CPUID itself to one of the currently reserved bits -- |
- // feel free to change this if needed.) |
- enum Feature { SSE3 = 32, SSE2 = 26, CMOV = 15, RDTSC = 4, CPUID = 10 }; |
// Detect features of the target CPU. Set safe defaults if the serializer |
// is enabled (snapshots must be portable). |
static void Probe(); |
// Check whether a feature is supported by the target CPU. |
- static bool IsSupported(Feature f) { |
+ static bool IsSupported(CpuFeature f) { |
if (f == SSE2 && !FLAG_enable_sse2) return false; |
if (f == SSE3 && !FLAG_enable_sse3) return false; |
if (f == CMOV && !FLAG_enable_cmov) return false; |
@@ -374,29 +372,32 @@ |
return (supported_ & (static_cast<uint64_t>(1) << f)) != 0; |
} |
// Check whether a feature is currently enabled. |
- static bool IsEnabled(Feature f) { |
+ static bool IsEnabled(CpuFeature f) { |
return (enabled_ & (static_cast<uint64_t>(1) << f)) != 0; |
} |
// Enable a specified feature within a scope. |
class Scope BASE_EMBEDDED { |
#ifdef DEBUG |
public: |
- explicit Scope(Feature f) { |
+ explicit Scope(CpuFeature f) { |
+ uint64_t mask = static_cast<uint64_t>(1) << f; |
ASSERT(CpuFeatures::IsSupported(f)); |
+ ASSERT(!Serializer::enabled() || (found_by_runtime_probing_ & mask) == 0); |
old_enabled_ = CpuFeatures::enabled_; |
- CpuFeatures::enabled_ |= (static_cast<uint64_t>(1) << f); |
+ CpuFeatures::enabled_ |= mask; |
} |
~Scope() { CpuFeatures::enabled_ = old_enabled_; } |
private: |
uint64_t old_enabled_; |
#else |
public: |
- explicit Scope(Feature f) {} |
+ explicit Scope(CpuFeature f) {} |
#endif |
}; |
private: |
static uint64_t supported_; |
static uint64_t enabled_; |
+ static uint64_t found_by_runtime_probing_; |
}; |