Revision: 16772
Author:   [email protected]
Date:     Tue Sep 17 13:02:25 2013 UTC
Log:      Add a mechanism to override the detected cpu features.

BUG=
[email protected]

Review URL: https://codereview.chromium.org/23523060
http://code.google.com/p/v8/source/detail?r=16772

Modified:
 /branches/bleeding_edge/src/arm/assembler-arm.h
 /branches/bleeding_edge/src/assembler.cc
 /branches/bleeding_edge/src/assembler.h
 /branches/bleeding_edge/src/ia32/assembler-ia32.h
 /branches/bleeding_edge/src/mips/assembler-mips.h
 /branches/bleeding_edge/src/x64/assembler-x64.h

=======================================
--- /branches/bleeding_edge/src/arm/assembler-arm.h Thu Sep 12 10:37:42 2013 UTC +++ /branches/bleeding_edge/src/arm/assembler-arm.h Tue Sep 17 13:02:25 2013 UTC
@@ -89,6 +89,7 @@
   static unsigned cache_line_size_;

   friend class ExternalReference;
+  friend class PlatformFeatureScope;
   DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
 };

=======================================
--- /branches/bleeding_edge/src/assembler.cc    Tue Sep 10 11:13:55 2013 UTC
+++ /branches/bleeding_edge/src/assembler.cc    Tue Sep 17 13:02:25 2013 UTC
@@ -204,6 +204,26 @@
   assembler_->set_enabled_cpu_features(old_enabled_);
 }
 #endif
+
+
+// -----------------------------------------------------------------------------
+// Implementation of PlatformFeatureScope
+
+PlatformFeatureScope::PlatformFeatureScope(CpuFeature f)
+    : old_supported_(CpuFeatures::supported_),
+      old_found_by_runtime_probing_only_(
+          CpuFeatures::found_by_runtime_probing_only_) {
+  uint64_t mask = static_cast<uint64_t>(1) << f;
+  CpuFeatures::supported_ |= mask;
+  CpuFeatures::found_by_runtime_probing_only_ &= ~mask;
+}
+
+
+PlatformFeatureScope::~PlatformFeatureScope() {
+  CpuFeatures::supported_ = old_supported_;
+  CpuFeatures::found_by_runtime_probing_only_ =
+      old_found_by_runtime_probing_only_;
+}


// -----------------------------------------------------------------------------
=======================================
--- /branches/bleeding_edge/src/assembler.h     Thu Sep 12 10:37:42 2013 UTC
+++ /branches/bleeding_edge/src/assembler.h     Tue Sep 17 13:02:25 2013 UTC
@@ -134,6 +134,19 @@
 };


+// Enable a unsupported feature within a scope for cross-compiling for a
+// different CPU.
+class PlatformFeatureScope BASE_EMBEDDED {
+ public:
+  explicit PlatformFeatureScope(CpuFeature f);
+  ~PlatformFeatureScope();
+
+ private:
+  uint64_t old_supported_;
+  uint64_t old_found_by_runtime_probing_only_;
+};
+
+
// -----------------------------------------------------------------------------
 // Labels represent pc locations; they are typically jump or call targets.
 // After declaration, a label can be freely used to denote known or (yet)
=======================================
--- /branches/bleeding_edge/src/ia32/assembler-ia32.h Mon Sep 9 16:57:35 2013 UTC +++ /branches/bleeding_edge/src/ia32/assembler-ia32.h Tue Sep 17 13:02:25 2013 UTC
@@ -561,6 +561,7 @@
   static uint64_t found_by_runtime_probing_only_;

   friend class ExternalReference;
+  friend class PlatformFeatureScope;
   DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
 };

=======================================
--- /branches/bleeding_edge/src/mips/assembler-mips.h Tue Aug 6 13:34:51 2013 UTC +++ /branches/bleeding_edge/src/mips/assembler-mips.h Tue Sep 17 13:02:25 2013 UTC
@@ -426,6 +426,7 @@
   static unsigned found_by_runtime_probing_only_;

   friend class ExternalReference;
+  friend class PlatformFeatureScope;
   DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
 };

=======================================
--- /branches/bleeding_edge/src/x64/assembler-x64.h Mon Aug 26 14:51:51 2013 UTC +++ /branches/bleeding_edge/src/x64/assembler-x64.h Tue Sep 17 13:02:25 2013 UTC
@@ -504,6 +504,7 @@
   static uint64_t found_by_runtime_probing_only_;

   friend class ExternalReference;
+  friend class PlatformFeatureScope;
   DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
 };

--
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev
--- You received this message because you are subscribed to the Google Groups "v8-dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to