Index: src/assembler.h |
diff --git a/src/assembler.h b/src/assembler.h |
index 77beac12a2b984272e9408a5cf4f11d29c874235..acd77e45eb6e5896b6d7038703ecc3d6cb48e24c 100644 |
--- a/src/assembler.h |
+++ b/src/assembler.h |
@@ -80,9 +80,14 @@ class AssemblerBase: public Malloced { |
void set_enabled_cpu_features(uint64_t features) { |
enabled_cpu_features_ = features; |
} |
+ // Features are usually enabled by CpuFeatureScope, which also asserts that |
+ // the features are supported before they are enabled. |
bool IsEnabled(CpuFeature f) { |
return (enabled_cpu_features_ & (static_cast<uint64_t>(1) << f)) != 0; |
} |
+ void EnableCpuFeature(CpuFeature f) { |
+ enabled_cpu_features_ |= (static_cast<uint64_t>(1) << f); |
+ } |
bool is_constant_pool_available() const { |
if (FLAG_enable_embedded_constant_pool) { |
@@ -184,15 +189,22 @@ class PredictableCodeSizeScope { |
// Enable a specified feature within a scope. |
class CpuFeatureScope BASE_EMBEDDED { |
public: |
+ enum CheckPolicy { |
+ kCheckSupported, |
+ kDontCheckSupported, |
+ }; |
+ |
#ifdef DEBUG |
- CpuFeatureScope(AssemblerBase* assembler, CpuFeature f); |
+ CpuFeatureScope(AssemblerBase* assembler, CpuFeature f, |
+ CheckPolicy check = kCheckSupported); |
~CpuFeatureScope(); |
private: |
AssemblerBase* assembler_; |
uint64_t old_enabled_; |
#else |
- CpuFeatureScope(AssemblerBase* assembler, CpuFeature f) {} |
+ CpuFeatureScope(AssemblerBase* assembler, CpuFeature f, |
+ CheckPolicy check = kCheckSupported) {} |
#endif |
}; |