Commit a5e0f768 authored by olivf@chromium.org's avatar olivf@chromium.org

Add a mechanism to override the detected cpu features.

BUG=
R=svenpanne@chromium.org

Review URL: https://codereview.chromium.org/23523060

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@16772 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 87d0659e
......@@ -89,6 +89,7 @@ class CpuFeatures : public AllStatic {
static unsigned cache_line_size_;
friend class ExternalReference;
friend class PlatformFeatureScope;
DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
};
......
......@@ -206,6 +206,26 @@ CpuFeatureScope::~CpuFeatureScope() {
#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_;
}
// -----------------------------------------------------------------------------
// Implementation of Label
......
......@@ -134,6 +134,19 @@ class CpuFeatureScope BASE_EMBEDDED {
};
// 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)
......
......@@ -561,6 +561,7 @@ class CpuFeatures : public AllStatic {
static uint64_t found_by_runtime_probing_only_;
friend class ExternalReference;
friend class PlatformFeatureScope;
DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
};
......
......@@ -426,6 +426,7 @@ class CpuFeatures : public AllStatic {
static unsigned found_by_runtime_probing_only_;
friend class ExternalReference;
friend class PlatformFeatureScope;
DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
};
......
......@@ -504,6 +504,7 @@ class CpuFeatures : public AllStatic {
static uint64_t found_by_runtime_probing_only_;
friend class ExternalReference;
friend class PlatformFeatureScope;
DISALLOW_COPY_AND_ASSIGN(CpuFeatures);
};
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment