Index: src/assembler.h |
diff --git a/src/assembler.h b/src/assembler.h |
index 06c3b760a60949a5cd30cec77d8e24ae93e51ee4..0fee67a9bd89a116529c812660183eda7a7968d6 100644 |
--- a/src/assembler.h |
+++ b/src/assembler.h |
@@ -68,6 +68,14 @@ class AssemblerBase: public Malloced { |
bool predictable_code_size() const { return predictable_code_size_; } |
void set_predictable_code_size(bool value) { predictable_code_size_ = value; } |
+ uint64_t enabled_cpu_features() const { return enabled_cpu_features_; } |
+ void set_enabled_cpu_features(uint64_t features) { |
+ enabled_cpu_features_ = features; |
+ } |
+ bool IsEnabled(CpuFeature f) { |
+ return (enabled_cpu_features_ & (static_cast<uint64_t>(1) << f)) != 0; |
+ } |
+ |
// Overwrite a host NaN with a quiet target NaN. Used by mksnapshot for |
// cross-snapshotting. |
static void QuietNaN(HeapObject* nan) { } |
@@ -89,6 +97,7 @@ class AssemblerBase: public Malloced { |
private: |
Isolate* isolate_; |
int jit_cookie_; |
+ uint64_t enabled_cpu_features_; |
bool emit_debug_code_; |
bool predictable_code_size_; |
}; |
@@ -109,6 +118,22 @@ class PredictableCodeSizeScope { |
}; |
+// Enable a specified feature within a scope. |
+class CpuFeatureScope BASE_EMBEDDED { |
+ public: |
+#ifdef DEBUG |
+ CpuFeatureScope(AssemblerBase* assembler, CpuFeature f); |
+ ~CpuFeatureScope(); |
+ |
+ private: |
+ AssemblerBase* assembler_; |
+ uint64_t old_enabled_; |
+#else |
+ CpuFeatureScope(AssemblerBase* assembler, CpuFeature f) {} |
+#endif |
+}; |
+ |
+ |
// ----------------------------------------------------------------------------- |
// Labels represent pc locations; they are typically jump or call targets. |
// After declaration, a label can be freely used to denote known or (yet) |