Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(324)

Unified Diff: src/assembler.h

Issue 2360243002: [arm] Clean up use of IsSupported and IsEnabled. (Closed)
Patch Set: Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/assembler.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/assembler.h
diff --git a/src/assembler.h b/src/assembler.h
index 77beac12a2b984272e9408a5cf4f11d29c874235..acd77e45eb6e5896b6d7038703ecc3d6cb48e24c 100644
--- a/src/assembler.h
+++ b/src/assembler.h
@@ -80,9 +80,14 @@ class AssemblerBase: public Malloced {
void set_enabled_cpu_features(uint64_t features) {
enabled_cpu_features_ = features;
}
+ // Features are usually enabled by CpuFeatureScope, which also asserts that
+ // the features are supported before they are enabled.
bool IsEnabled(CpuFeature f) {
return (enabled_cpu_features_ & (static_cast<uint64_t>(1) << f)) != 0;
}
+ void EnableCpuFeature(CpuFeature f) {
+ enabled_cpu_features_ |= (static_cast<uint64_t>(1) << f);
+ }
bool is_constant_pool_available() const {
if (FLAG_enable_embedded_constant_pool) {
@@ -184,15 +189,22 @@ class PredictableCodeSizeScope {
// Enable a specified feature within a scope.
class CpuFeatureScope BASE_EMBEDDED {
public:
+ enum CheckPolicy {
+ kCheckSupported,
+ kDontCheckSupported,
+ };
+
#ifdef DEBUG
- CpuFeatureScope(AssemblerBase* assembler, CpuFeature f);
+ CpuFeatureScope(AssemblerBase* assembler, CpuFeature f,
+ CheckPolicy check = kCheckSupported);
~CpuFeatureScope();
private:
AssemblerBase* assembler_;
uint64_t old_enabled_;
#else
- CpuFeatureScope(AssemblerBase* assembler, CpuFeature f) {}
+ CpuFeatureScope(AssemblerBase* assembler, CpuFeature f,
+ CheckPolicy check = kCheckSupported) {}
#endif
};
« no previous file with comments | « src/arm/macro-assembler-arm.cc ('k') | src/assembler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698