Index: src/assembler.cc |
diff --git a/src/assembler.cc b/src/assembler.cc |
index b3640c3f54a10c3d2f79b0019ecf10db110dd0ce..fdc000e33c819d3a31ce8be6f5a4d77a4448f673 100644 |
--- a/src/assembler.cc |
+++ b/src/assembler.cc |
@@ -115,6 +115,7 @@ static double* math_exp_log_table_array = NULL; |
AssemblerBase::AssemblerBase(Isolate* isolate, void* buffer, int buffer_size) |
: isolate_(isolate), |
jit_cookie_(0), |
+ enabled_cpu_features_(0), |
emit_debug_code_(FLAG_debug_code), |
predictable_code_size_(false) { |
if (FLAG_mask_constants_with_cookie && isolate != NULL) { |
@@ -180,6 +181,36 @@ PredictableCodeSizeScope::~PredictableCodeSizeScope() { |
// ----------------------------------------------------------------------------- |
+// Implementation of CpuFeatureScope |
+ |
+#ifdef DEBUG |
+CpuFeatureScope::CpuFeatureScope(AssemblerBase* assembler, CpuFeature f) |
+ : assembler_(assembler) { |
+ ASSERT(CpuFeatures::IsSupported(f)); |
+ ASSERT(!Serializer::enabled() || |
+ !CpuFeatures::IsFoundByRuntimeProbingOnly(f)); |
+ old_enabled_ = assembler_->enabled_cpu_features(); |
+ uint64_t mask = static_cast<uint64_t>(1) << f; |
+ // TODO(svenpanne) This special case below doesn't belong here! |
+#if V8_TARGET_ARCH_ARM |
+ // VFP2 and ARMv7 are implied by VFP3. |
+ if (f == VFP3) { |
+ mask |= |
+ static_cast<uint64_t>(1) << VFP2 | |
+ static_cast<uint64_t>(1) << ARMv7; |
+ } |
+#endif |
+ assembler_->set_enabled_cpu_features(old_enabled_ | mask); |
+} |
+ |
+ |
+CpuFeatureScope::~CpuFeatureScope() { |
+ assembler_->set_enabled_cpu_features(old_enabled_); |
+} |
+#endif |
+ |
+ |
+// ----------------------------------------------------------------------------- |
// Implementation of Label |
int Label::pos() const { |