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
This commit is contained in:
parent
87d0659e76
commit
a5e0f768b3
@ -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);
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user