Chromium Code Reviews| Index: src/assembler.h |
| diff --git a/src/assembler.h b/src/assembler.h |
| index a4c19e6b027bbfdddc97bdec2dd5ab02addce19d..244766bbdf95644d207e4053a3f65068525c7576 100644 |
| --- a/src/assembler.h |
| +++ b/src/assembler.h |
| @@ -51,6 +51,59 @@ namespace internal { |
| // Forward declarations. |
| class StatsCounter; |
| + |
| +// CpuFeatures keeps track of which features are supported by the target CPU. |
| +// Supported features must be enabled by a CpuFeatureScope before use. |
| +// Example: |
| +// if (assembler->IsSupported(SSE3)) { |
| +// CpuFeatureScope fscope(assembler, SSE3); |
| +// // Generate code containing SSE3 instructions. |
| +// } else { |
| +// // Generate alternative code. |
| +// } |
| +class CpuFeatures : public AllStatic { |
|
Michael Starzinger
2015/09/11 11:40:03
I don't see a particular need to move this up here
Michael Lippautz
2015/09/11 11:54:52
Done. This was needed when the methods were still
|
| + public: |
| + static void Probe(bool cross_compile) { |
| + STATIC_ASSERT(NUMBER_OF_CPU_FEATURES <= kBitsPerInt); |
| + if (initialized_) return; |
| + initialized_ = true; |
| + ProbeImpl(cross_compile); |
| + } |
| + |
| + static unsigned SupportedFeatures() { |
| + Probe(false); |
| + return supported_; |
| + } |
| + |
| + static bool IsSupported(CpuFeature f) { |
| + return (supported_ & (1u << f)) != 0; |
| + } |
| + |
| + static inline bool SupportsCrankshaft(); |
| + |
| + static inline unsigned cache_line_size() { |
| + DCHECK(cache_line_size_ != 0); |
| + return cache_line_size_; |
| + } |
| + |
| + static void PrintTarget(); |
| + static void PrintFeatures(); |
| + |
| + // Flush instruction cache. |
| + static void FlushICache(void* start, size_t size); |
| + |
| + private: |
| + // Platform-dependent implementation. |
| + static void ProbeImpl(bool cross_compile); |
| + |
| + static unsigned supported_; |
| + static unsigned cache_line_size_; |
| + static bool initialized_; |
| + friend class ExternalReference; |
| + DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
| +}; |
| + |
| + |
| // ----------------------------------------------------------------------------- |
| // Platform independent assembler base class. |
| @@ -102,6 +155,11 @@ class AssemblerBase: public Malloced { |
| static const int kMinimalBufferSize = 4*KB; |
| protected: |
| + static void FlushICache(Isolate* isolate, void* start, size_t size); |
| + |
| + // TODO(all): Help get rid of this one. |
| + static void FlushICacheWithoutIsolate(void* start, size_t size); |
| + |
| // The buffer into which code and relocation info are generated. It could |
| // either be owned by the assembler or be provided externally. |
| byte* buffer_; |
| @@ -187,58 +245,6 @@ class CpuFeatureScope BASE_EMBEDDED { |
| }; |
| -// CpuFeatures keeps track of which features are supported by the target CPU. |
| -// Supported features must be enabled by a CpuFeatureScope before use. |
| -// Example: |
| -// if (assembler->IsSupported(SSE3)) { |
| -// CpuFeatureScope fscope(assembler, SSE3); |
| -// // Generate code containing SSE3 instructions. |
| -// } else { |
| -// // Generate alternative code. |
| -// } |
| -class CpuFeatures : public AllStatic { |
| - public: |
| - static void Probe(bool cross_compile) { |
| - STATIC_ASSERT(NUMBER_OF_CPU_FEATURES <= kBitsPerInt); |
| - if (initialized_) return; |
| - initialized_ = true; |
| - ProbeImpl(cross_compile); |
| - } |
| - |
| - static unsigned SupportedFeatures() { |
| - Probe(false); |
| - return supported_; |
| - } |
| - |
| - static bool IsSupported(CpuFeature f) { |
| - return (supported_ & (1u << f)) != 0; |
| - } |
| - |
| - static inline bool SupportsCrankshaft(); |
| - |
| - static inline unsigned cache_line_size() { |
| - DCHECK(cache_line_size_ != 0); |
| - return cache_line_size_; |
| - } |
| - |
| - static void PrintTarget(); |
| - static void PrintFeatures(); |
| - |
| - // Flush instruction cache. |
| - static void FlushICache(void* start, size_t size); |
| - |
| - private: |
| - // Platform-dependent implementation. |
| - static void ProbeImpl(bool cross_compile); |
| - |
| - static unsigned supported_; |
| - static unsigned cache_line_size_; |
| - static bool initialized_; |
| - friend class ExternalReference; |
| - DISALLOW_COPY_AND_ASSIGN(CpuFeatures); |
| -}; |
| - |
| - |
| // ----------------------------------------------------------------------------- |
| // Labels represent pc locations; they are typically jump or call targets. |
| // After declaration, a label can be freely used to denote known or (yet) |